summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/Makefile.frag.w3211
-rw-r--r--ext/standard/array.c1329
-rw-r--r--ext/standard/assert.c20
-rw-r--r--ext/standard/base64.c22
-rw-r--r--ext/standard/base64.h12
-rw-r--r--ext/standard/basic_functions.c388
-rw-r--r--ext/standard/browscap.c14
-rw-r--r--ext/standard/config.m4177
-rw-r--r--ext/standard/config.w3216
-rw-r--r--ext/standard/crc32.c7
-rw-r--r--ext/standard/credits_ext.h4
-rw-r--r--ext/standard/crypt.c16
-rw-r--r--ext/standard/cyr_convert.c8
-rw-r--r--ext/standard/datetime.c7
-rw-r--r--ext/standard/dir.c57
-rw-r--r--ext/standard/dl.c81
-rw-r--r--ext/standard/dl.h1
-rw-r--r--ext/standard/dns.c74
-rw-r--r--ext/standard/dns_win32.c2
-rw-r--r--ext/standard/exec.c63
-rw-r--r--ext/standard/file.c232
-rw-r--r--ext/standard/file.h2
-rw-r--r--ext/standard/filestat.c80
-rw-r--r--ext/standard/filters.c73
-rw-r--r--ext/standard/flock_compat.c4
-rw-r--r--ext/standard/formatted_print.c14
-rw-r--r--ext/standard/fsock.c19
-rw-r--r--ext/standard/ftok.c7
-rw-r--r--ext/standard/ftp_fopen_wrapper.c4
-rw-r--r--ext/standard/head.c70
-rw-r--r--ext/standard/html.c53
-rw-r--r--ext/standard/html.h2
-rw-r--r--ext/standard/http.c10
-rw-r--r--ext/standard/http_fopen_wrapper.c59
-rw-r--r--ext/standard/image.c24
-rw-r--r--ext/standard/incomplete_class.c4
-rw-r--r--ext/standard/info.c72
-rw-r--r--ext/standard/iptc.c15
-rw-r--r--ext/standard/link.c26
-rw-r--r--ext/standard/mail.c243
-rw-r--r--ext/standard/math.c87
-rw-r--r--ext/standard/md5.c16
-rw-r--r--ext/standard/metaphone.c8
-rw-r--r--ext/standard/microtime.c17
-rw-r--r--ext/standard/mt_rand.c103
-rw-r--r--ext/standard/pack.c35
-rw-r--r--ext/standard/password.c516
-rw-r--r--ext/standard/php_crypt_r.c2
-rw-r--r--ext/standard/php_dns.h4
-rw-r--r--ext/standard/php_ext_syslog.h2
-rw-r--r--ext/standard/php_filestat.h11
-rw-r--r--ext/standard/php_mail.h32
-rw-r--r--ext/standard/php_math.h2
-rw-r--r--ext/standard/php_password.h17
-rw-r--r--ext/standard/php_smart_string.h131
-rw-r--r--ext/standard/php_smart_string_public.h15
-rw-r--r--ext/standard/php_string.h8
-rw-r--r--ext/standard/php_versioning.h2
-rw-r--r--ext/standard/proc_open.c107
-rw-r--r--ext/standard/quot_print.c12
-rw-r--r--ext/standard/rand.c7
-rw-r--r--ext/standard/random.c13
-rw-r--r--ext/standard/scanf.c2
-rw-r--r--ext/standard/sha1.c16
-rw-r--r--ext/standard/soundex.c9
-rw-r--r--ext/standard/streamsfuncs.c292
-rw-r--r--ext/standard/streamsfuncs.h4
-rw-r--r--ext/standard/string.c625
-rw-r--r--ext/standard/strnatcmp.c10
-rw-r--r--ext/standard/syslog.c20
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation10.phpt2
-rw-r--r--ext/standard/tests/array/array_fill_object.phpt10
-rw-r--r--ext/standard/tests/array/array_fill_object_2_4.phpt434
-rw-r--r--ext/standard/tests/array/array_filter_variation7.phpt8
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation9.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation8.phpt2
-rw-r--r--ext/standard/tests/array/array_key_exists_object1.phpt22
-rw-r--r--ext/standard/tests/array/array_key_exists_object2.phpt22
-rw-r--r--ext/standard/tests/array/array_map_variation10.phpt12
-rw-r--r--ext/standard/tests/array/array_unique_variation2.phpt76
-rw-r--r--ext/standard/tests/array/array_unique_variation6.phpt2
-rw-r--r--ext/standard/tests/array/array_unique_variation8.phpt16
-rw-r--r--ext/standard/tests/array/array_walk_object1.phpt6
-rw-r--r--ext/standard/tests/array/array_walk_objects.phpt22
-rw-r--r--ext/standard/tests/array/array_walk_rec_objects.phpt22
-rw-r--r--ext/standard/tests/array/array_walk_recursive_object1.phpt6
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation7.phpt10
-rw-r--r--ext/standard/tests/array/array_walk_variation7.phpt10
-rw-r--r--ext/standard/tests/array/bug14580.phpt2
-rw-r--r--ext/standard/tests/array/bug44929.phpt2
-rw-r--r--ext/standard/tests/array/bug48854.phpt12
-rw-r--r--ext/standard/tests/array/bug65251.phpt10
-rw-r--r--ext/standard/tests/array/bug75433.phpt17
-rw-r--r--ext/standard/tests/array/bug75653.phpt20
-rw-r--r--ext/standard/tests/array/count_invalid.phpt42
-rw-r--r--ext/standard/tests/array/count_recursive.phpt20
-rw-r--r--ext/standard/tests/array/count_variation1.phpt48
-rw-r--r--ext/standard/tests/array/each.phptbin9574 -> 9688 bytes
-rw-r--r--ext/standard/tests/array/each_basic.phpt4
-rw-r--r--ext/standard/tests/array/each_variation1.phpt2
-rw-r--r--ext/standard/tests/array/each_variation2.phpt4
-rw-r--r--ext/standard/tests/array/each_variation3.phpt4
-rw-r--r--ext/standard/tests/array/each_variation4.phpt2
-rw-r--r--ext/standard/tests/array/each_variation5.phpt4
-rw-r--r--ext/standard/tests/array/each_variation6.phpt4
-rw-r--r--ext/standard/tests/array/extract_variation10.phpt2
-rw-r--r--ext/standard/tests/array/extract_variation11.phpt2
-rw-r--r--ext/standard/tests/array/packed_001.phpt84
-rw-r--r--ext/standard/tests/array/sizeof_basic1.phpt24
-rw-r--r--ext/standard/tests/array/sizeof_error.phpt2
-rw-r--r--ext/standard/tests/array/sizeof_object2.phpt60
-rw-r--r--ext/standard/tests/array/sizeof_variation1.phpt234
-rw-r--r--ext/standard/tests/array/sizeof_variation4.phpt120
-rw-r--r--ext/standard/tests/array/uasort_variation7.phpt16
-rw-r--r--ext/standard/tests/array/usort_variation7.phpt18
-rw-r--r--ext/standard/tests/array/var_export.phpt4
-rw-r--r--ext/standard/tests/assert/assert02.phpt12
-rw-r--r--ext/standard/tests/assert/assert03.phpt3
-rw-r--r--ext/standard/tests/assert/assert04.phpt2
-rw-r--r--ext/standard/tests/assert/assert_basic.phpt3
-rw-r--r--ext/standard/tests/assert/assert_basic3.phpt2
-rw-r--r--ext/standard/tests/assert/assert_basic5.phpt4
-rw-r--r--ext/standard/tests/assert/assert_basic6.phpt2
-rw-r--r--ext/standard/tests/assert/assert_error.phpt6
-rw-r--r--ext/standard/tests/assert/assert_error1.phpt1
-rw-r--r--ext/standard/tests/assert/assert_error2.phpt2
-rw-r--r--ext/standard/tests/assert/assert_error3.phpt3
-rw-r--r--ext/standard/tests/assert/assert_error4.phpt1
-rw-r--r--ext/standard/tests/assert/assert_variation.phpt12
-rw-r--r--ext/standard/tests/assert/bug73303.phpt3
-rw-r--r--ext/standard/tests/bug49244.phpt2
-rw-r--r--ext/standard/tests/checkdnsrr.phpt42
-rw-r--r--ext/standard/tests/class_object/class_exists_basic_001.phpt12
-rw-r--r--ext/standard/tests/class_object/class_exists_variation_001.phpt20
-rw-r--r--ext/standard/tests/class_object/class_exists_variation_002.phpt32
-rw-r--r--ext/standard/tests/class_object/get_class_variation_001.phpt8
-rw-r--r--ext/standard/tests/class_object/get_declared_classes_error_001.phpt2
-rw-r--r--ext/standard/tests/class_object/get_declared_classes_variation1.phpt4
-rw-r--r--ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt2
-rw-r--r--ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt4
-rw-r--r--ext/standard/tests/class_object/get_declared_traits_error_001.phpt2
-rw-r--r--ext/standard/tests/class_object/get_declared_traits_variation1.phpt4
-rw-r--r--ext/standard/tests/class_object/get_object_vars_variation_004.phptbin0 -> 741 bytes
-rw-r--r--ext/standard/tests/class_object/get_object_vars_variation_005.phptbin0 -> 638 bytes
-rw-r--r--ext/standard/tests/class_object/get_parent_class_variation_002.phpt12
-rw-r--r--ext/standard/tests/class_object/interface_exists_variation3.phpt6
-rw-r--r--ext/standard/tests/class_object/interface_exists_variation4.phpt7
-rw-r--r--ext/standard/tests/class_object/is_a.phpt61
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_variation_001.phpt12
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_variation_002.phpt8
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_variation_004.phpt12
-rw-r--r--ext/standard/tests/class_object/method_exists_basic_003.phpt10
-rw-r--r--ext/standard/tests/class_object/method_exists_variation_001.phpt12
-rw-r--r--ext/standard/tests/class_object/method_exists_variation_002.phpt8
-rw-r--r--ext/standard/tests/class_object/property_exists_variation1.phpt6
-rw-r--r--ext/standard/tests/class_object/trait_exists_basic_001.phpt12
-rw-r--r--ext/standard/tests/class_object/trait_exists_variation_001.phpt20
-rw-r--r--ext/standard/tests/class_object/trait_exists_variation_002.phpt32
-rw-r--r--ext/standard/tests/dir/dir_bug73971.phpt54
-rw-r--r--ext/standard/tests/file/005_variation-win32.phpt2
-rw-r--r--ext/standard/tests/file/007_variation15.phpt6
-rw-r--r--ext/standard/tests/file/007_variation23.phpt6
-rw-r--r--ext/standard/tests/file/007_variation7.phpt6
-rw-r--r--ext/standard/tests/file/bug27508.phpt8
-rw-r--r--ext/standard/tests/file/bug38450.phpt6
-rw-r--r--ext/standard/tests/file/bug38450_1.phpt6
-rw-r--r--ext/standard/tests/file/bug43008.phpt14
-rw-r--r--ext/standard/tests/file/bug43353-win32.phpt50
-rw-r--r--ext/standard/tests/file/bug44034.phpt14
-rw-r--r--ext/standard/tests/file/bug46347.phpt4
-rw-r--r--ext/standard/tests/file/bug49047.phpt34
-rw-r--r--ext/standard/tests/file/bug52820.phpt6
-rw-r--r--ext/standard/tests/file/bug53241.phpt46
-rw-r--r--ext/standard/tests/file/bug55124.phpt36
-rw-r--r--ext/standard/tests/file/bug60120.phpt148
-rw-r--r--ext/standard/tests/file/bug69442.phpt2
-rw-r--r--ext/standard/tests/file/chroot_001.phpt2
-rw-r--r--ext/standard/tests/file/clearstatcache_001.phpt8
-rw-r--r--ext/standard/tests/file/copy_variation1.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation10.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation11.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation14.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation15.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation16-win32.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation17.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation2-win32-mb.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation2-win32.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation2.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation3-win32.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation3.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation4.phptbin4966 -> 4965 bytes
-rw-r--r--ext/standard/tests/file/copy_variation5-win32.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation5.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation7.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation9.phpt2
-rw-r--r--ext/standard/tests/file/disk_free_space_basic.phpt2
-rw-r--r--ext/standard/tests/file/disk_free_space_error.phpt2
-rw-r--r--ext/standard/tests/file/disk_total_space_basic.phpt2
-rw-r--r--ext/standard/tests/file/disk_total_space_error.phpt2
-rw-r--r--ext/standard/tests/file/file_get_contents_variation5_32bit.phpt14
-rw-r--r--ext/standard/tests/file/file_get_contents_variation5_64bit.phpt14
-rw-r--r--ext/standard/tests/file/file_get_contents_variation9.phpt2
-rw-r--r--ext/standard/tests/file/file_put_contents_variation4.phpt2
-rw-r--r--ext/standard/tests/file/file_put_contents_variation5.phpt2
-rw-r--r--ext/standard/tests/file/file_put_contents_variation6.phpt4
-rw-r--r--ext/standard/tests/file/file_variation.phpt4
-rw-r--r--ext/standard/tests/file/filesize_variation3-win32.phpt2
-rw-r--r--ext/standard/tests/file/fopen_variation12.phpt2
-rw-r--r--ext/standard/tests/file/fopen_variation16.phpt2
-rw-r--r--ext/standard/tests/file/fopen_variation17.phpt2
-rw-r--r--ext/standard/tests/file/fopen_variation5.phpt8
-rw-r--r--ext/standard/tests/file/fopen_variation7.phpt2
-rw-r--r--ext/standard/tests/file/fopen_variation8.phpt8
-rw-r--r--ext/standard/tests/file/fopen_variation9.phpt2
-rw-r--r--ext/standard/tests/file/fscanf_error.phpt2
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_basic2-win32-mb.phpt2
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_basic2-win32.phpt2
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_basic2.phpt2
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt2
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation2.phpt2
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation4-win32.phpt2
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation4.phpt2
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation6-win32.phpt2
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation6.phpt2
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation8-win32.phpt2
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation8.phpt2
-rw-r--r--ext/standard/tests/file/fseek_variation3.phpt2
-rw-r--r--ext/standard/tests/file/ftruncate_error.phpt2
-rw-r--r--ext/standard/tests/file/include_streams.phpt2
-rw-r--r--ext/standard/tests/file/lstat_stat_variation7.phpt2
-rw-r--r--ext/standard/tests/file/move_uploaded_file_basic.phpt2
-rw-r--r--ext/standard/tests/file/pathinfo_basic.phpt510
-rw-r--r--ext/standard/tests/file/pathinfo_basic1.phpt832
-rw-r--r--ext/standard/tests/file/pathinfo_basic2.phpt348
-rw-r--r--ext/standard/tests/file/popen_pclose_basic.phpt4
-rw-r--r--ext/standard/tests/file/proc_open01.phpt4
-rw-r--r--ext/standard/tests/file/realpath_basic-win32-mb.phpt2
-rw-r--r--ext/standard/tests/file/realpath_basic-win32.phpt2
-rw-r--r--ext/standard/tests/file/rename_variation8-win32.phpt140
-rw-r--r--ext/standard/tests/file/stream_enclosed.phpt40
-rw-r--r--ext/standard/tests/file/stream_get_line.phpt2
-rw-r--r--ext/standard/tests/file/symlink_to_symlink.phpt10
-rw-r--r--ext/standard/tests/file/unlink_error.phpt2
-rw-r--r--ext/standard/tests/file/userfilters.phpt2
-rw-r--r--ext/standard/tests/file/userstreams.phpt2
-rw-r--r--ext/standard/tests/file/userstreams_003.phpt4
-rw-r--r--ext/standard/tests/file/windows_links/bug48746.phpt116
-rw-r--r--ext/standard/tests/file/windows_links/bug48746_1.phpt118
-rw-r--r--ext/standard/tests/file/windows_links/bug48746_2.phpt138
-rw-r--r--ext/standard/tests/file/windows_links/bug48746_3.phpt100
-rw-r--r--ext/standard/tests/filters/bug22538.phpt4
-rw-r--r--ext/standard/tests/filters/filter_errors.inc4
-rw-r--r--ext/standard/tests/filters/filter_errors_user.phpt6
-rw-r--r--ext/standard/tests/filters/filter_errors_zlib_inflate.phpt2
-rw-r--r--ext/standard/tests/forward_static_call_array.phpt47
-rw-r--r--ext/standard/tests/general_functions/bug35229.phpt5
-rw-r--r--ext/standard/tests/general_functions/bug50690.phpt28
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation8.phpt2
-rw-r--r--ext/standard/tests/general_functions/get_defined_constants_basic.phpt76
-rw-r--r--ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt44
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_basic.phpt12
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation7.phpt22
-rw-r--r--ext/standard/tests/general_functions/import_request.phpt76
-rw-r--r--ext/standard/tests/general_functions/import_request1.phpt101
-rw-r--r--ext/standard/tests/general_functions/import_request2.phpt27
-rw-r--r--ext/standard/tests/general_functions/import_request3.phpt27
-rw-r--r--ext/standard/tests/general_functions/parse_ini_string_002.phpt60
-rw-r--r--ext/standard/tests/general_functions/print_r.phpt6
-rw-r--r--ext/standard/tests/general_functions/print_r_64bit.phpt6
-rw-r--r--ext/standard/tests/general_functions/proc_nice_basic-win.phpt94
-rw-r--r--ext/standard/tests/general_functions/proc_nice_basic.phpt1
-rw-r--r--ext/standard/tests/general_functions/type.phpt14
-rw-r--r--ext/standard/tests/general_functions/uniqid_error.phpt90
-rw-r--r--ext/standard/tests/general_functions/var_dump.phpt4
-rw-r--r--ext/standard/tests/general_functions/var_dump_64bit.phpt4
-rw-r--r--ext/standard/tests/http/bug69337.phpt7
-rw-r--r--ext/standard/tests/http/server.inc8
-rw-r--r--ext/standard/tests/mail/bug73203.phpt48
-rw-r--r--ext/standard/tests/mail/ezmlm_hash_basic.phpt4
-rw-r--r--ext/standard/tests/mail/ezmlm_hash_basic_64bit.phpt4
-rw-r--r--ext/standard/tests/mail/mail_basic7.phpt218
-rw-r--r--ext/standard/tests/math/bug75170.phpt32
-rw-r--r--ext/standard/tests/math/number_format_negative_zero.phpt16
-rw-r--r--ext/standard/tests/misc/time_nanosleep_error1.phpt2
-rw-r--r--ext/standard/tests/misc/time_nanosleep_error2.phpt2
-rw-r--r--ext/standard/tests/network/bug20134.phpt2
-rw-r--r--ext/standard/tests/network/closelog_error.phpt2
-rw-r--r--ext/standard/tests/network/dns_get_mx.phpt29
-rw-r--r--ext/standard/tests/network/gethostbyname_basic003.phpt34
-rw-r--r--ext/standard/tests/network/gethostbynamel_basic1.phpt36
-rw-r--r--ext/standard/tests/network/inet.phpt40
-rw-r--r--ext/standard/tests/password/bug75221.phpt19
-rw-r--r--ext/standard/tests/password/password_get_info_argon2.phpt29
-rw-r--r--ext/standard/tests/password/password_hash_argon2.phpt18
-rw-r--r--ext/standard/tests/password/password_hash_error_argon2.phpt21
-rw-r--r--ext/standard/tests/password/password_needs_rehash_argon2.phpt22
-rw-r--r--ext/standard/tests/password/password_verify_argon2.phpt18
-rw-r--r--ext/standard/tests/serialize/005.phpt15
-rw-r--r--ext/standard/tests/serialize/bug26762.phpt1
-rw-r--r--ext/standard/tests/serialize/bug30234.phpt9
-rw-r--r--ext/standard/tests/serialize/bug43614.phpt2
-rw-r--r--ext/standard/tests/serialize/bug49649.phpt45
-rw-r--r--ext/standard/tests/serialize/bug49649_1.phpt45
-rw-r--r--ext/standard/tests/serialize/bug49649_2.phpt45
-rw-r--r--ext/standard/tests/serialize/bug62836_1.phpt4
-rw-r--r--ext/standard/tests/serialize/bug69152.phpt2
-rw-r--r--ext/standard/tests/serialize/bug70213.phpt6
-rw-r--r--ext/standard/tests/serialize/bug74300.phpt16
-rw-r--r--ext/standard/tests/serialize/incomplete_class.phpt6
-rw-r--r--ext/standard/tests/serialize/invalid_signs_in_lengths.phpt55
-rw-r--r--ext/standard/tests/serialize/serialization_objects_005.phpt24
-rw-r--r--ext/standard/tests/serialize/serialization_objects_006.phpt4
-rw-r--r--ext/standard/tests/serialize/serialization_objects_007.phpt12
-rw-r--r--ext/standard/tests/serialize/sleep_undefined_declared_properties.phpt29
-rw-r--r--ext/standard/tests/streams/bug44818.phpt2
-rw-r--r--ext/standard/tests/streams/bug46426.phpt2
-rw-r--r--ext/standard/tests/streams/bug48309.phpt2
-rw-r--r--ext/standard/tests/streams/bug49936_win32.phpt60
-rw-r--r--ext/standard/tests/streams/bug68948.phpt30
-rw-r--r--ext/standard/tests/streams/bug74556.phpt6
-rw-r--r--ext/standard/tests/streams/proc_open_bug60120.phpt2
-rw-r--r--ext/standard/tests/streams/proc_open_bug64438.phpt2
-rw-r--r--ext/standard/tests/streams/proc_open_bug69900.phpt2
-rw-r--r--ext/standard/tests/streams/stream_context_get_params_001.phpt76
-rw-r--r--ext/standard/tests/streams/stream_copy_to_stream_socket.phpt2
-rw-r--r--ext/standard/tests/streams/stream_get_contents_001.phpt2
-rw-r--r--ext/standard/tests/streams/stream_get_contents_002.phpt2
-rw-r--r--ext/standard/tests/streams/stream_get_line_nb.phpt18
-rw-r--r--ext/standard/tests/streams/stream_socket_enable_crypto-win32.phpt7
-rw-r--r--ext/standard/tests/streams/stream_socket_pair.phpt4
-rw-r--r--ext/standard/tests/strings/bug24208.phpt3
-rw-r--r--ext/standard/tests/strings/bug24281.phpt4
-rw-r--r--ext/standard/tests/strings/bug37262.phpt1
-rw-r--r--ext/standard/tests/strings/bug40754.phpt4
-rw-r--r--ext/standard/tests/strings/bug40915.phptbin377 -> 344 bytes
-rw-r--r--ext/standard/tests/strings/bug43957.phpt8
-rw-r--r--ext/standard/tests/strings/bug44703.phpt22
-rw-r--r--ext/standard/tests/strings/bug49687.phpt19
-rw-r--r--ext/standard/tests/strings/bug50052.phpt24
-rw-r--r--ext/standard/tests/strings/bug51059.phpt4
-rw-r--r--ext/standard/tests/strings/bug53021.phpt80
-rw-r--r--ext/standard/tests/strings/convert_cyr_string.phpt14
-rw-r--r--ext/standard/tests/strings/convert_uuencode_basic.phpt20
-rw-r--r--ext/standard/tests/strings/crypt_blowfish_variation1.phpt18
-rw-r--r--ext/standard/tests/strings/crypt_blowfish_variation2.phpt2
-rw-r--r--ext/standard/tests/strings/crypt_sha256.phpt48
-rw-r--r--ext/standard/tests/strings/crypt_sha512.phpt48
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic1.phpt1098
-rw-r--r--ext/standard/tests/strings/htmlentities-utf-2.phpt108
-rw-r--r--ext/standard/tests/strings/htmlentities-utf-3.phpt166
-rw-r--r--ext/standard/tests/strings/htmlentities-utf.phpt108
-rw-r--r--ext/standard/tests/strings/htmlentities01.phpt4
-rw-r--r--ext/standard/tests/strings/htmlentities24.phpt2
-rw-r--r--ext/standard/tests/strings/htmlspecialchars.phpt2
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation6.phptbin1523 -> 1522 bytes
-rw-r--r--ext/standard/tests/strings/http_build_query_variation3.phpt4
-rw-r--r--ext/standard/tests/strings/implode.phpt11
-rw-r--r--ext/standard/tests/strings/join_variation6.phptbin729 -> 728 bytes
-rw-r--r--ext/standard/tests/strings/lcfirst.phptbin6908 -> 6963 bytes
-rw-r--r--ext/standard/tests/strings/md5_basic1.phpt34
-rw-r--r--ext/standard/tests/strings/md5_basic2.phpt58
-rw-r--r--ext/standard/tests/strings/md5_error.phpt68
-rw-r--r--ext/standard/tests/strings/parse_str_basic1.phpt4
-rw-r--r--ext/standard/tests/strings/parse_str_basic2.phpt19
-rw-r--r--ext/standard/tests/strings/parse_str_basic3.phptbin5140 -> 5636 bytes
-rw-r--r--ext/standard/tests/strings/parse_str_basic4.phpt17
-rw-r--r--ext/standard/tests/strings/quoted_printable_decode_error.phpt2
-rw-r--r--ext/standard/tests/strings/sha1_file.phpt2
-rw-r--r--ext/standard/tests/strings/soundex_basic.phpt92
-rw-r--r--ext/standard/tests/strings/soundex_error.phpt66
-rw-r--r--ext/standard/tests/strings/str_getcsv_001.phpt2
-rw-r--r--ext/standard/tests/strings/str_rot13_basic.phpt108
-rw-r--r--ext/standard/tests/strings/str_rot13_error.phpt62
-rw-r--r--ext/standard/tests/strings/strip_tags_variation6.phpt2
-rw-r--r--ext/standard/tests/strings/stristr_basic.phpt2
-rw-r--r--ext/standard/tests/strings/strnatcasecmp_error.phpt64
-rw-r--r--ext/standard/tests/strings/strnatcmp_basic.phpt158
-rw-r--r--ext/standard/tests/strings/strnatcmp_error.phpt68
-rw-r--r--ext/standard/tests/strings/ucfirst.phptbin6132 -> 6187 bytes
-rw-r--r--ext/standard/tests/strings/utf8.phpt10
-rw-r--r--ext/standard/tests/strings/utf8_decode_error.phpt38
-rw-r--r--ext/standard/tests/strings/utf8_decode_variation1.phpt170
-rw-r--r--ext/standard/tests/strings/utf8_encode_error.phpt38
-rw-r--r--ext/standard/tests/strings/utf8_encode_variation1.phpt170
-rw-r--r--ext/standard/tests/time/strptime_error.phpt6
-rw-r--r--ext/standard/tests/url/bug47174.phpt4
-rw-r--r--ext/standard/tests/url/parse_url_unterminated.phpt887
-rw-r--r--ext/standard/tests/versioning/php_sapi_name.phpt2
-rw-r--r--ext/standard/type.c126
-rw-r--r--ext/standard/uniqid.c42
-rw-r--r--ext/standard/uniqid.h2
-rw-r--r--ext/standard/url.c66
-rw-r--r--ext/standard/url_scanner_ex.c100
-rw-r--r--ext/standard/url_scanner_ex.re10
-rw-r--r--ext/standard/user_filters.c33
-rw-r--r--ext/standard/uuencode.c14
-rw-r--r--ext/standard/var.c286
-rw-r--r--ext/standard/var_unserializer.c446
-rw-r--r--ext/standard/var_unserializer.re111
-rw-r--r--ext/standard/versioning.c16
400 files changed, 10458 insertions, 6961 deletions
diff --git a/ext/standard/Makefile.frag.w32 b/ext/standard/Makefile.frag.w32
new file mode 100644
index 0000000000..640e4840d3
--- /dev/null
+++ b/ext/standard/Makefile.frag.w32
@@ -0,0 +1,11 @@
+
+ext\standard\var_unserializer.c: ext\standard\var_unserializer.re
+ cd $(PHP_SRC_DIR)
+ $(RE2C) --no-generation-date -b -o ext/standard/var_unserializer.c ext/standard/var_unserializer.re
+
+ext\standard\url_scanner_ex.c: ext\standard\url_scanner_ex.re
+ cd $(PHP_SRC_DIR)
+ $(RE2C) --no-generation-date -b -o ext/standard/url_scanner_ex.c ext/standard/url_scanner_ex.re
+
+$(BUILD_DIR)\ext\standard\basic_functions.obj: $(PHP_SRC_DIR)\Zend\zend_language_parser.h
+
diff --git a/ext/standard/array.c b/ext/standard/array.c
index d7fa94e52c..72a7813aa8 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -790,6 +790,7 @@ PHP_FUNCTION(count)
switch (Z_TYPE_P(array)) {
case IS_NULL:
+ php_error_docref(NULL, E_WARNING, "Parameter must be an array or an object that implements Countable");
RETURN_LONG(0);
break;
case IS_ARRAY:
@@ -812,7 +813,7 @@ PHP_FUNCTION(count)
}
}
/* if not and the object implements Countable we call its count() method */
- if (instanceof_function(Z_OBJCE_P(array), spl_ce_Countable)) {
+ if (instanceof_function(Z_OBJCE_P(array), zend_ce_countable)) {
zend_call_method_with_0_params(array, NULL, NULL, "count", &retval);
if (Z_TYPE(retval) != IS_UNDEF) {
RETVAL_LONG(zval_get_long(&retval));
@@ -820,8 +821,14 @@ PHP_FUNCTION(count)
}
return;
}
+
+ /* If There's no handler and it doesn't implement Countable then add a warning */
+ php_error_docref(NULL, E_WARNING, "Parameter must be an array or an object that implements Countable");
+ RETURN_LONG(1);
+ break;
}
default:
+ php_error_docref(NULL, E_WARNING, "Parameter must be an array or an object that implements Countable");
RETURN_LONG(1);
break;
}
@@ -832,9 +839,9 @@ static void php_natsort(INTERNAL_FUNCTION_PARAMETERS, int fold_case) /* {{{ */
{
zval *array;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/", &array) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ARRAY_EX(array, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
if (fold_case) {
if (zend_hash_sort(Z_ARRVAL_P(array), php_array_natural_case_compare, 0) == FAILURE) {
@@ -874,9 +881,11 @@ PHP_FUNCTION(asort)
zend_long sort_type = PHP_SORT_REGULAR;
compare_func_t cmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/|l", &array, &sort_type) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ARRAY_EX(array, 0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(sort_type)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
cmp = php_get_data_compare_func(sort_type, 0);
@@ -895,9 +904,11 @@ PHP_FUNCTION(arsort)
zend_long sort_type = PHP_SORT_REGULAR;
compare_func_t cmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/|l", &array, &sort_type) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ARRAY_EX(array, 0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(sort_type)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
cmp = php_get_data_compare_func(sort_type, 1);
@@ -916,9 +927,11 @@ PHP_FUNCTION(sort)
zend_long sort_type = PHP_SORT_REGULAR;
compare_func_t cmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/|l", &array, &sort_type) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ARRAY_EX(array, 0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(sort_type)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
cmp = php_get_data_compare_func(sort_type, 0);
@@ -937,9 +950,11 @@ PHP_FUNCTION(rsort)
zend_long sort_type = PHP_SORT_REGULAR;
compare_func_t cmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/|l", &array, &sort_type) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ARRAY_EX(array, 0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(sort_type)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
cmp = php_get_data_compare_func(sort_type, 1);
@@ -1019,10 +1034,10 @@ static void php_usort(INTERNAL_FUNCTION_PARAMETERS, compare_func_t compare_func,
PHP_ARRAY_CMP_FUNC_BACKUP();
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "af", &array, &BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE) {
- PHP_ARRAY_CMP_FUNC_RESTORE();
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_ARRAY_EX2(array, 0, 1, 0)
+ Z_PARAM_FUNC(BG(user_compare_fci), BG(user_compare_fci_cache))
+ ZEND_PARSE_PARAMETERS_END_EX( PHP_ARRAY_CMP_FUNC_RESTORE(); return );
arr = Z_ARR_P(array);
if (zend_hash_num_elements(arr) == 0) {
@@ -1267,9 +1282,9 @@ PHP_FUNCTION(min)
int argc;
zval *args = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argc) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_VARIADIC('+', args, argc)
+ ZEND_PARSE_PARAMETERS_END();
/* mixed min ( array $values ) */
if (argc == 1) {
@@ -1301,7 +1316,6 @@ PHP_FUNCTION(min)
}
}
- ZVAL_DEREF(min);
ZVAL_COPY(return_value, min);
}
}
@@ -1314,9 +1328,9 @@ PHP_FUNCTION(max)
zval *args = NULL;
int argc;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argc) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_VARIADIC('+', args, argc)
+ ZEND_PARSE_PARAMETERS_END();
/* mixed max ( array $values ) */
if (argc == 1) {
@@ -1348,7 +1362,6 @@ PHP_FUNCTION(max)
}
}
- ZVAL_DEREF(max);
ZVAL_COPY(return_value, max);
}
}
@@ -1508,7 +1521,7 @@ PHP_FUNCTION(array_walk)
Z_PARAM_ARRAY_OR_OBJECT_EX(array, 0, 1)
Z_PARAM_FUNC(BG(array_walk_fci), BG(array_walk_fci_cache))
Z_PARAM_OPTIONAL
- Z_PARAM_ZVAL_EX(userdata, 0, 1)
+ Z_PARAM_ZVAL(userdata)
ZEND_PARSE_PARAMETERS_END_EX(
BG(array_walk_fci) = orig_array_walk_fci;
BG(array_walk_fci_cache) = orig_array_walk_fci_cache;
@@ -1534,11 +1547,16 @@ PHP_FUNCTION(array_walk_recursive)
orig_array_walk_fci = BG(array_walk_fci);
orig_array_walk_fci_cache = BG(array_walk_fci_cache);
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "A/f|z/", &array, &BG(array_walk_fci), &BG(array_walk_fci_cache), &userdata) == FAILURE) {
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_ARRAY_OR_OBJECT_EX(array, 0, 1)
+ Z_PARAM_FUNC(BG(array_walk_fci), BG(array_walk_fci_cache))
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL(userdata)
+ ZEND_PARSE_PARAMETERS_END_EX(
BG(array_walk_fci) = orig_array_walk_fci;
BG(array_walk_fci_cache) = orig_array_walk_fci_cache;
- return;
- }
+ return
+ );
php_array_walk(array, userdata, 1);
BG(array_walk_fci) = orig_array_walk_fci;
@@ -1724,148 +1742,464 @@ PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, size_t
}
/* }}} */
-/* {{{ proto int extract(array var_array [, int extract_type [, string prefix]])
- Imports variables into symbol table from an array */
-PHP_FUNCTION(extract)
+static zend_long php_extract_ref_if_exists(zend_array *arr, zend_array *symbol_table) /* {{{ */
{
- zval *var_array_param, *prefix = NULL;
- zend_long extract_type = EXTR_OVERWRITE;
- zval *entry;
- zend_string *var_name;
- zend_ulong num_key;
- int var_exists, count = 0;
- int extract_refs = 0;
int exception_thrown = 0;
- zend_array *symbol_table;
- zval var_array;
-
- ZEND_PARSE_PARAMETERS_START(1, 3)
- Z_PARAM_ARRAY(var_array_param)
- Z_PARAM_OPTIONAL
- Z_PARAM_LONG(extract_type)
- Z_PARAM_ZVAL_EX(prefix, 0, 1)
- ZEND_PARSE_PARAMETERS_END();
+ zend_long count = 0;
+ zend_string *var_name;
+ zval *entry, *orig_var;
- extract_refs = (extract_type & EXTR_REFS);
- if (extract_refs) {
- SEPARATE_ZVAL(var_array_param);
- }
- extract_type &= 0xff;
+ ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) {
+ if (!var_name) {
+ continue;
+ }
+ orig_var = zend_hash_find(symbol_table, var_name);
+ if (orig_var) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ if (Z_TYPE_P(orig_var) == IS_UNDEF) {
+ continue;
+ }
+ }
+ if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) {
+ continue;
+ }
+ if (ZSTR_LEN(var_name) == sizeof("GLOBALS")-1 && !strcmp(ZSTR_VAL(var_name), "GLOBALS")) {
+ continue;
+ }
+ if (ZSTR_LEN(var_name) == sizeof("this")-1 && !strcmp(ZSTR_VAL(var_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
+ }
+ continue;
+ }
+ ZVAL_MAKE_REF(entry);
+ Z_ADDREF_P(entry);
+ zval_ptr_dtor(orig_var);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ count++;
+ }
+ } ZEND_HASH_FOREACH_END();
- if (extract_type < EXTR_OVERWRITE || extract_type > EXTR_IF_EXISTS) {
- php_error_docref(NULL, E_WARNING, "Invalid extract type");
- return;
- }
+ return count;
+}
+/* }}} */
- if (extract_type > EXTR_SKIP && extract_type <= EXTR_PREFIX_IF_EXISTS && ZEND_NUM_ARGS() < 3) {
- php_error_docref(NULL, E_WARNING, "specified extract type requires the prefix parameter");
- return;
- }
+static zend_long php_extract_if_exists(zend_array *arr, zend_array *symbol_table) /* {{{ */
+{
+ int exception_thrown = 0;
+ zend_long count = 0;
+ zend_string *var_name;
+ zval *entry, *orig_var;
- if (prefix) {
- convert_to_string(prefix);
- if (Z_STRLEN_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRLEN_P(prefix))) {
- php_error_docref(NULL, E_WARNING, "prefix is not a valid identifier");
- return;
+ ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) {
+ if (!var_name) {
+ continue;
}
- }
+ orig_var = zend_hash_find(symbol_table, var_name);
+ if (orig_var) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ if (Z_TYPE_P(orig_var) == IS_UNDEF) {
+ continue;
+ }
+ }
+ if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) {
+ continue;
+ }
+ if (ZSTR_LEN(var_name) == sizeof("GLOBALS")-1 && !strcmp(ZSTR_VAL(var_name), "GLOBALS")) {
+ continue;
+ }
+ if (ZSTR_LEN(var_name) == sizeof("this")-1 && !strcmp(ZSTR_VAL(var_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
+ }
+ continue;
+ }
+ ZVAL_DEREF(entry);
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ ZVAL_DEREF(orig_var);
+ zval_ptr_dtor(orig_var);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ count++;
+ }
+ } ZEND_HASH_FOREACH_END();
- if (zend_forbid_dynamic_call("extract()") == FAILURE) {
- return;
- }
+ return count;
+}
+/* }}} */
- symbol_table = zend_rebuild_symbol_table();
-#if 0
- if (!symbol_table) {
- php_error_docref(NULL, E_WARNING, "failed to build symbol table");
- return;
- }
-#endif
+static zend_long php_extract_ref_overwrite(zend_array *arr, zend_array *symbol_table) /* {{{ */
+{
+ int exception_thrown = 0;
+ zend_long count = 0;
+ zend_string *var_name;
+ zval *entry, *orig_var;
- /* The array might be stored in a local variable that will be overwritten. To avoid losing the
- * reference in that case we work on a copy. */
- ZVAL_COPY(&var_array, var_array_param);
+ ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) {
+ if (!var_name) {
+ continue;
+ }
+ if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) {
+ continue;
+ }
+ if (ZSTR_LEN(var_name) == sizeof("this")-1 && !strcmp(ZSTR_VAL(var_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
+ }
+ continue;
+ }
+ orig_var = zend_hash_find(symbol_table, var_name);
+ if (orig_var) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ }
+ if (ZSTR_LEN(var_name) == sizeof("GLOBALS")-1 && !strcmp(ZSTR_VAL(var_name), "GLOBALS")) {
+ continue;
+ }
+ ZVAL_MAKE_REF(entry);
+ Z_ADDREF_P(entry);
+ zval_ptr_dtor(orig_var);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ } else {
+ ZVAL_MAKE_REF(entry);
+ Z_ADDREF_P(entry);
+ zend_hash_add_new(symbol_table, var_name, entry);
+ }
+ count++;
+ } ZEND_HASH_FOREACH_END();
- ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL(var_array), num_key, var_name, entry) {
- zval final_name;
+ return count;
+}
+/* }}} */
- ZVAL_NULL(&final_name);
- var_exists = 0;
+static zend_long php_extract_overwrite(zend_array *arr, zend_array *symbol_table) /* {{{ */
+{
+ int exception_thrown = 0;
+ zend_long count = 0;
+ zend_string *var_name;
+ zval *entry, *orig_var;
- if (var_name) {
- var_exists = zend_hash_exists_ind(symbol_table, var_name);
- } else if (extract_type == EXTR_PREFIX_ALL || extract_type == EXTR_PREFIX_INVALID) {
- zend_string *str = zend_long_to_str(num_key);
- php_prefix_varname(&final_name, prefix, ZSTR_VAL(str), ZSTR_LEN(str), 1);
- zend_string_release(str);
- } else {
+ ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) {
+ if (!var_name) {
continue;
}
+ if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) {
+ continue;
+ }
+ if (ZSTR_LEN(var_name) == sizeof("this")-1 && !strcmp(ZSTR_VAL(var_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
+ }
+ continue;
+ }
+ orig_var = zend_hash_find(symbol_table, var_name);
+ if (orig_var) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ }
+ if (ZSTR_LEN(var_name) == sizeof("GLOBALS")-1 && !strcmp(ZSTR_VAL(var_name), "GLOBALS")) {
+ continue;
+ }
+ ZVAL_DEREF(entry);
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ ZVAL_DEREF(orig_var);
+ zval_ptr_dtor(orig_var);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ } else {
+ ZVAL_DEREF(entry);
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ zend_hash_add_new(symbol_table, var_name, entry);
+ }
+ count++;
+ } ZEND_HASH_FOREACH_END();
- switch (extract_type) {
- case EXTR_IF_EXISTS:
- if (!var_exists) break;
- /* break omitted intentionally */
+ return count;
+}
+/* }}} */
- case EXTR_OVERWRITE:
- /* GLOBALS protection */
- if (var_exists && ZSTR_LEN(var_name) == sizeof("GLOBALS")-1 && !strcmp(ZSTR_VAL(var_name), "GLOBALS")) {
- break;
- }
- ZVAL_STR_COPY(&final_name, var_name);
- break;
+static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+{
+ int exception_thrown = 0;
+ zend_long count = 0;
+ zend_string *var_name;
+ zval *entry, *orig_var, final_name;
- case EXTR_PREFIX_IF_EXISTS:
- if (var_exists) {
- php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
+ ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) {
+ if (!var_name) {
+ continue;
+ }
+ orig_var = zend_hash_find(symbol_table, var_name);
+ if (orig_var) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ if (Z_TYPE_P(orig_var) == IS_UNDEF) {
+ ZVAL_MAKE_REF(entry);
+ Z_ADDREF_P(entry);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ count++;
+ continue;
}
- break;
-
- case EXTR_PREFIX_SAME:
- if (!var_exists && ZSTR_LEN(var_name) != 0) {
- ZVAL_STR_COPY(&final_name, var_name);
+ }
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
+ if (php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) {
+ if (Z_STRLEN(final_name) == sizeof("this")-1 && !strcmp(Z_STRVAL(final_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
+ }
+ } else {
+ ZVAL_MAKE_REF(entry);
+ Z_ADDREF_P(entry);
+ if ((orig_var = zend_hash_find(symbol_table, Z_STR(final_name))) != NULL) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ }
+ zval_ptr_dtor(orig_var);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ } else {
+ zend_hash_add_new(symbol_table, Z_STR(final_name), entry);
+ }
+ count++;
}
- /* break omitted intentionally */
+ }
+ zend_string_release(Z_STR(final_name));
+ }
+ } ZEND_HASH_FOREACH_END();
- case EXTR_PREFIX_ALL:
- if (Z_TYPE(final_name) == IS_NULL && ZSTR_LEN(var_name) != 0) {
- php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
- }
- break;
+ return count;
+}
+/* }}} */
- case EXTR_PREFIX_INVALID:
- if (Z_TYPE(final_name) == IS_NULL) {
- if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) {
- php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
+static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+{
+ int exception_thrown = 0;
+ zend_long count = 0;
+ zend_string *var_name;
+ zval *entry, *orig_var, final_name;
+
+ ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) {
+ if (!var_name) {
+ continue;
+ }
+ orig_var = zend_hash_find(symbol_table, var_name);
+ if (orig_var) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ if (Z_TYPE_P(orig_var) == IS_UNDEF) {
+ ZVAL_DEREF(entry);
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ count++;
+ continue;
+ }
+ }
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
+ if (php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) {
+ if (Z_STRLEN(final_name) == sizeof("this")-1 && !strcmp(Z_STRVAL(final_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
+ }
+ } else {
+ ZVAL_DEREF(entry);
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ if ((orig_var = zend_hash_find(symbol_table, Z_STR(final_name))) != NULL) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ }
+ ZVAL_DEREF(orig_var);
+ zval_ptr_dtor(orig_var);
+ ZVAL_COPY_VALUE(orig_var, entry);
} else {
- ZVAL_STR_COPY(&final_name, var_name);
+ zend_hash_add_new(symbol_table, Z_STR(final_name), entry);
}
+ count++;
}
- break;
+ }
+ zend_string_release(Z_STR(final_name));
+ }
+ } ZEND_HASH_FOREACH_END();
- default:
- if (!var_exists) {
- ZVAL_STR_COPY(&final_name, var_name);
+ return count;
+}
+/* }}} */
+
+static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+{
+ int exception_thrown = 0;
+ zend_long count = 0;
+ zend_string *var_name;
+ zval *entry, *orig_var, final_name;
+
+ ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) {
+ if (!var_name) {
+ continue;
+ }
+ if (ZSTR_LEN(var_name) == 0) {
+ continue;
+ }
+ orig_var = zend_hash_find(symbol_table, var_name);
+ if (orig_var) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ if (Z_TYPE_P(orig_var) == IS_UNDEF) {
+ ZVAL_MAKE_REF(entry);
+ Z_ADDREF_P(entry);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ count++;
+ continue;
}
- break;
+ }
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
+ if (php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) {
+ if (Z_STRLEN(final_name) == sizeof("this")-1 && !strcmp(Z_STRVAL(final_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
+ }
+ } else {
+ ZVAL_MAKE_REF(entry);
+ Z_ADDREF_P(entry);
+ if ((orig_var = zend_hash_find(symbol_table, Z_STR(final_name))) != NULL) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ }
+ zval_ptr_dtor(orig_var);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ } else {
+ zend_hash_add_new(symbol_table, Z_STR(final_name), entry);
+ }
+ count++;
+ }
+ }
+ zend_string_release(Z_STR(final_name));
+ } else {
+ if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) {
+ continue;
+ }
+ if (ZSTR_LEN(var_name) == sizeof("this")-1 && !strcmp(ZSTR_VAL(var_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
+ }
+ continue;
+ }
+ ZVAL_MAKE_REF(entry);
+ Z_ADDREF_P(entry);
+ zend_hash_add_new(symbol_table, var_name, entry);
+ count++;
}
+ } ZEND_HASH_FOREACH_END();
- if (Z_TYPE(final_name) == IS_STRING && php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) {
- zval *orig_var;
+ return count;
+}
+/* }}} */
- if (Z_STRLEN(final_name) == sizeof("this")-1 && !strcmp(Z_STRVAL(final_name), "this")) {
+static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+{
+ int exception_thrown = 0;
+ zend_long count = 0;
+ zend_string *var_name;
+ zval *entry, *orig_var, final_name;
+
+ ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) {
+ if (!var_name) {
+ continue;
+ }
+ if (ZSTR_LEN(var_name) == 0) {
+ continue;
+ }
+ orig_var = zend_hash_find(symbol_table, var_name);
+ if (orig_var) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ if (Z_TYPE_P(orig_var) == IS_UNDEF) {
+ ZVAL_DEREF(entry);
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ count++;
+ continue;
+ }
+ }
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
+ if (php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) {
+ if (Z_STRLEN(final_name) == sizeof("this")-1 && !strcmp(Z_STRVAL(final_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
+ }
+ } else {
+ ZVAL_DEREF(entry);
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ if ((orig_var = zend_hash_find(symbol_table, Z_STR(final_name))) != NULL) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ }
+ ZVAL_DEREF(orig_var);
+ zval_ptr_dtor(orig_var);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ } else {
+ zend_hash_add_new(symbol_table, Z_STR(final_name), entry);
+ }
+ count++;
+ }
+ }
+ zend_string_release(Z_STR(final_name));
+ } else {
+ if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) {
+ continue;
+ }
+ if (ZSTR_LEN(var_name) == sizeof("this")-1 && !strcmp(ZSTR_VAL(var_name), "this")) {
if (!exception_thrown) {
exception_thrown = 1;
zend_throw_error(NULL, "Cannot re-assign $this");
}
- zval_dtor(&final_name);
continue;
}
- if (extract_refs) {
+ ZVAL_DEREF(entry);
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ zend_hash_add_new(symbol_table, var_name, entry);
+ count++;
+ }
+ } ZEND_HASH_FOREACH_END();
+
+ return count;
+}
+/* }}} */
+static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+{
+ int exception_thrown = 0;
+ zend_long count = 0;
+ zend_string *var_name;
+ zend_ulong num_key;
+ zval *entry, *orig_var, final_name;
+
+ ZEND_HASH_FOREACH_KEY_VAL_IND(arr, num_key, var_name, entry) {
+ if (var_name) {
+ if (ZSTR_LEN(var_name) == 0) {
+ continue;
+ }
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
+ } else {
+ zend_string *str = zend_long_to_str(num_key);
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(str), ZSTR_LEN(str), 1);
+ zend_string_release(str);
+ }
+ if (php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) {
+ if (Z_STRLEN(final_name) == sizeof("this")-1 && !strcmp(Z_STRVAL(final_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
+ }
+ } else {
ZVAL_MAKE_REF(entry);
Z_ADDREF_P(entry);
-
if ((orig_var = zend_hash_find(symbol_table, Z_STR(final_name))) != NULL) {
if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
orig_var = Z_INDIRECT_P(orig_var);
@@ -1873,7 +2207,42 @@ PHP_FUNCTION(extract)
zval_ptr_dtor(orig_var);
ZVAL_COPY_VALUE(orig_var, entry);
} else {
- zend_hash_update(symbol_table, Z_STR(final_name), entry);
+ zend_hash_add_new(symbol_table, Z_STR(final_name), entry);
+ }
+ count++;
+ }
+ }
+ zend_string_release(Z_STR(final_name));
+ } ZEND_HASH_FOREACH_END();
+
+ return count;
+}
+/* }}} */
+
+static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+{
+ int exception_thrown = 0;
+ zend_long count = 0;
+ zend_string *var_name;
+ zend_ulong num_key;
+ zval *entry, *orig_var, final_name;
+
+ ZEND_HASH_FOREACH_KEY_VAL_IND(arr, num_key, var_name, entry) {
+ if (var_name) {
+ if (ZSTR_LEN(var_name) == 0) {
+ continue;
+ }
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
+ } else {
+ zend_string *str = zend_long_to_str(num_key);
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(str), ZSTR_LEN(str), 1);
+ zend_string_release(str);
+ }
+ if (php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) {
+ if (Z_STRLEN(final_name) == sizeof("this")-1 && !strcmp(Z_STRVAL(final_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
}
} else {
ZVAL_DEREF(entry);
@@ -1886,14 +2255,311 @@ PHP_FUNCTION(extract)
zval_ptr_dtor(orig_var);
ZVAL_COPY_VALUE(orig_var, entry);
} else {
- zend_hash_update(symbol_table, Z_STR(final_name), entry);
+ zend_hash_add_new(symbol_table, Z_STR(final_name), entry);
+ }
+ count++;
+ }
+ }
+ zend_string_release(Z_STR(final_name));
+ } ZEND_HASH_FOREACH_END();
+
+ return count;
+}
+/* }}} */
+
+static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+{
+ int exception_thrown = 0;
+ zend_long count = 0;
+ zend_string *var_name;
+ zend_ulong num_key;
+ zval *entry, *orig_var, final_name;
+
+ ZEND_HASH_FOREACH_KEY_VAL_IND(arr, num_key, var_name, entry) {
+ if (var_name) {
+ if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) {
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
+ if (!php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) {
+ zend_string_release(Z_STR(final_name));
+ continue;
+ }
+ } else {
+ ZVAL_STR_COPY(&final_name, var_name);
+ }
+ } else {
+ zend_string *str = zend_long_to_str(num_key);
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(str), ZSTR_LEN(str), 1);
+ zend_string_release(str);
+ if (!php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) {
+ zend_string_release(Z_STR(final_name));
+ continue;
+ }
+ }
+ if (Z_STRLEN(final_name) == sizeof("this")-1 && !strcmp(Z_STRVAL(final_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
+ }
+ } else {
+ ZVAL_MAKE_REF(entry);
+ Z_ADDREF_P(entry);
+ if ((orig_var = zend_hash_find(symbol_table, Z_STR(final_name))) != NULL) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ }
+ zval_ptr_dtor(orig_var);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ } else {
+ zend_hash_add_new(symbol_table, Z_STR(final_name), entry);
+ }
+ count++;
+ }
+ zend_string_release(Z_STR(final_name));
+ } ZEND_HASH_FOREACH_END();
+
+ return count;
+}
+/* }}} */
+
+static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+{
+ int exception_thrown = 0;
+ zend_long count = 0;
+ zend_string *var_name;
+ zend_ulong num_key;
+ zval *entry, *orig_var, final_name;
+
+ ZEND_HASH_FOREACH_KEY_VAL_IND(arr, num_key, var_name, entry) {
+ if (var_name) {
+ if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) {
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
+ if (!php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) {
+ zend_string_release(Z_STR(final_name));
+ continue;
+ }
+ } else {
+ ZVAL_STR_COPY(&final_name, var_name);
+ }
+ } else {
+ zend_string *str = zend_long_to_str(num_key);
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(str), ZSTR_LEN(str), 1);
+ zend_string_release(str);
+ if (!php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) {
+ zend_string_release(Z_STR(final_name));
+ continue;
+ }
+ }
+ if (Z_STRLEN(final_name) == sizeof("this")-1 && !strcmp(Z_STRVAL(final_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
+ }
+ } else {
+ ZVAL_DEREF(entry);
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ if ((orig_var = zend_hash_find(symbol_table, Z_STR(final_name))) != NULL) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ }
+ ZVAL_DEREF(orig_var);
+ zval_ptr_dtor(orig_var);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ } else {
+ zend_hash_add_new(symbol_table, Z_STR(final_name), entry);
+ }
+ count++;
+ }
+ zend_string_release(Z_STR(final_name));
+ } ZEND_HASH_FOREACH_END();
+
+ return count;
+}
+/* }}} */
+
+static zend_long php_extract_ref_skip(zend_array *arr, zend_array *symbol_table) /* {{{ */
+{
+ int exception_thrown = 0;
+ zend_long count = 0;
+ zend_string *var_name;
+ zval *entry, *orig_var;
+
+ ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) {
+ if (!var_name) {
+ continue;
+ }
+ if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) {
+ continue;
+ }
+ if (ZSTR_LEN(var_name) == sizeof("this")-1 && !strcmp(ZSTR_VAL(var_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
+ }
+ continue;
+ }
+ orig_var = zend_hash_find(symbol_table, var_name);
+ if (orig_var) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ if (Z_TYPE_P(orig_var) == IS_UNDEF) {
+ ZVAL_MAKE_REF(entry);
+ Z_ADDREF_P(entry);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ count++;
}
}
+ } else {
+ ZVAL_MAKE_REF(entry);
+ Z_ADDREF_P(entry);
+ zend_hash_add_new(symbol_table, var_name, entry);
count++;
}
- zval_dtor(&final_name);
} ZEND_HASH_FOREACH_END();
- zval_ptr_dtor(&var_array);
+
+ return count;
+}
+/* }}} */
+
+static zend_long php_extract_skip(zend_array *arr, zend_array *symbol_table) /* {{{ */
+{
+ int exception_thrown = 0;
+ zend_long count = 0;
+ zend_string *var_name;
+ zval *entry, *orig_var;
+
+ ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) {
+ if (!var_name) {
+ continue;
+ }
+ if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) {
+ continue;
+ }
+ if (ZSTR_LEN(var_name) == sizeof("this")-1 && !strcmp(ZSTR_VAL(var_name), "this")) {
+ if (!exception_thrown) {
+ exception_thrown = 1;
+ zend_throw_error(NULL, "Cannot re-assign $this");
+ }
+ continue;
+ }
+ orig_var = zend_hash_find(symbol_table, var_name);
+ if (orig_var) {
+ if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
+ orig_var = Z_INDIRECT_P(orig_var);
+ if (Z_TYPE_P(orig_var) == IS_UNDEF) {
+ ZVAL_DEREF(entry);
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ ZVAL_COPY_VALUE(orig_var, entry);
+ count++;
+ }
+ }
+ } else {
+ ZVAL_DEREF(entry);
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ zend_hash_add_new(symbol_table, var_name, entry);
+ count++;
+ }
+ } ZEND_HASH_FOREACH_END();
+
+ return count;
+}
+/* }}} */
+
+/* {{{ proto int extract(array var_array [, int extract_type [, string prefix]])
+ Imports variables into symbol table from an array */
+PHP_FUNCTION(extract)
+{
+ zval *var_array_param, *prefix = NULL;
+ zend_long extract_refs;
+ zend_long extract_type = EXTR_OVERWRITE;
+ zend_long count;
+ zend_array *symbol_table;
+
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_ARRAY_EX2(var_array_param, 0, 1, 0)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(extract_type)
+ Z_PARAM_ZVAL(prefix)
+ ZEND_PARSE_PARAMETERS_END();
+
+ extract_refs = (extract_type & EXTR_REFS);
+ if (extract_refs) {
+ SEPARATE_ZVAL(var_array_param);
+ }
+ extract_type &= 0xff;
+
+ if (extract_type < EXTR_OVERWRITE || extract_type > EXTR_IF_EXISTS) {
+ php_error_docref(NULL, E_WARNING, "Invalid extract type");
+ return;
+ }
+
+ if (extract_type > EXTR_SKIP && extract_type <= EXTR_PREFIX_IF_EXISTS && ZEND_NUM_ARGS() < 3) {
+ php_error_docref(NULL, E_WARNING, "specified extract type requires the prefix parameter");
+ return;
+ }
+
+ if (prefix) {
+ convert_to_string(prefix);
+ if (Z_STRLEN_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRLEN_P(prefix))) {
+ php_error_docref(NULL, E_WARNING, "prefix is not a valid identifier");
+ return;
+ }
+ }
+
+ if (zend_forbid_dynamic_call("extract()") == FAILURE) {
+ return;
+ }
+
+ symbol_table = zend_rebuild_symbol_table();
+
+ if (extract_refs) {
+ switch (extract_type) {
+ case EXTR_IF_EXISTS:
+ count = php_extract_ref_if_exists(Z_ARRVAL_P(var_array_param), symbol_table);
+ break;
+ case EXTR_OVERWRITE:
+ count = php_extract_ref_overwrite(Z_ARRVAL_P(var_array_param), symbol_table);
+ break;
+ case EXTR_PREFIX_IF_EXISTS:
+ count = php_extract_ref_prefix_if_exists(Z_ARRVAL_P(var_array_param), symbol_table, prefix);
+ break;
+ case EXTR_PREFIX_SAME:
+ count = php_extract_ref_prefix_same(Z_ARRVAL_P(var_array_param), symbol_table, prefix);
+ break;
+ case EXTR_PREFIX_ALL:
+ count = php_extract_ref_prefix_all(Z_ARRVAL_P(var_array_param), symbol_table, prefix);
+ break;
+ case EXTR_PREFIX_INVALID:
+ count = php_extract_ref_prefix_invalid(Z_ARRVAL_P(var_array_param), symbol_table, prefix);
+ break;
+ default:
+ count = php_extract_ref_skip(Z_ARRVAL_P(var_array_param), symbol_table);
+ break;
+ }
+ } else {
+ switch (extract_type) {
+ case EXTR_IF_EXISTS:
+ count = php_extract_if_exists(Z_ARRVAL_P(var_array_param), symbol_table);
+ break;
+ case EXTR_OVERWRITE:
+ count = php_extract_overwrite(Z_ARRVAL_P(var_array_param), symbol_table);
+ break;
+ case EXTR_PREFIX_IF_EXISTS:
+ count = php_extract_prefix_if_exists(Z_ARRVAL_P(var_array_param), symbol_table, prefix);
+ break;
+ case EXTR_PREFIX_SAME:
+ count = php_extract_prefix_same(Z_ARRVAL_P(var_array_param), symbol_table, prefix);
+ break;
+ case EXTR_PREFIX_ALL:
+ count = php_extract_prefix_all(Z_ARRVAL_P(var_array_param), symbol_table, prefix);
+ break;
+ case EXTR_PREFIX_INVALID:
+ count = php_extract_prefix_invalid(Z_ARRVAL_P(var_array_param), symbol_table, prefix);
+ break;
+ default:
+ count = php_extract_skip(Z_ARRVAL_P(var_array_param), symbol_table);
+ break;
+ }
+ }
RETURN_LONG(count);
}
@@ -1945,9 +2611,9 @@ PHP_FUNCTION(compact)
uint32_t num_args, i;
zend_array *symbol_table;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &num_args) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_VARIADIC('+', args, num_args)
+ ZEND_PARSE_PARAMETERS_END();
if (zend_forbid_dynamic_call("compact()") == FAILURE) {
return;
@@ -1961,13 +2627,13 @@ PHP_FUNCTION(compact)
/* compact() is probably most used with a single array of var_names
or multiple string names, rather than a combination of both.
So quickly guess a minimum result size based on that */
- if (ZEND_NUM_ARGS() == 1 && Z_TYPE(args[0]) == IS_ARRAY) {
+ if (num_args && Z_TYPE(args[0]) == IS_ARRAY) {
array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL(args[0])));
} else {
- array_init_size(return_value, ZEND_NUM_ARGS());
+ array_init_size(return_value, num_args);
}
- for (i=0; i<ZEND_NUM_ARGS(); i++) {
+ for (i = 0; i < num_args; i++) {
php_compact_var(symbol_table, return_value, &args[i]);
}
}
@@ -2051,9 +2717,10 @@ PHP_FUNCTION(array_fill_keys)
{
zval *keys, *val, *entry;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "az", &keys, &val) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_ARRAY(keys)
+ Z_PARAM_ZVAL(val)
+ ZEND_PARSE_PARAMETERS_END();
/* Initialize return array */
array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(keys)));
@@ -2102,9 +2769,12 @@ PHP_FUNCTION(range)
int err = 0, is_step_double = 0;
double step = 1.0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|z", &zlow, &zhigh, &zstep) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_ZVAL(zlow)
+ Z_PARAM_ZVAL(zhigh)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL(zstep)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (zstep) {
if (Z_TYPE_P(zstep) == IS_DOUBLE ||
@@ -2149,11 +2819,7 @@ PHP_FUNCTION(range)
zend_hash_real_init(Z_ARRVAL_P(return_value), 1);
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(return_value)) {
for (; low >= high; low -= (unsigned int)lstep) {
- if (CG(one_char_string)[low]) {
- ZVAL_INTERNED_STR(&tmp, CG(one_char_string)[low]);
- } else {
- ZVAL_STRINGL(&tmp, (char*)&low, 1);
- }
+ ZVAL_INTERNED_STR(&tmp, ZSTR_CHAR(low));
ZEND_HASH_FILL_ADD(&tmp);
if (((signed int)low - lstep) < 0) {
break;
@@ -2169,11 +2835,7 @@ PHP_FUNCTION(range)
zend_hash_real_init(Z_ARRVAL_P(return_value), 1);
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(return_value)) {
for (; low <= high; low += (unsigned int)lstep) {
- if (CG(one_char_string)[low]) {
- ZVAL_INTERNED_STR(&tmp, CG(one_char_string)[low]);
- } else {
- ZVAL_STRINGL(&tmp, (char*)&low, 1);
- }
+ ZVAL_INTERNED_STR(&tmp, ZSTR_CHAR(low));
ZEND_HASH_FILL_ADD(&tmp);
if (((signed int)low + lstep) > 255) {
break;
@@ -2182,11 +2844,7 @@ PHP_FUNCTION(range)
} ZEND_HASH_FILL_END();
} else {
array_init(return_value);
- if (CG(one_char_string)[low]) {
- ZVAL_INTERNED_STR(&tmp, CG(one_char_string)[low]);
- } else {
- ZVAL_STRINGL(&tmp, (char*)&low, 1);
- }
+ ZVAL_INTERNED_STR(&tmp, ZSTR_CHAR(low));
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp);
}
} else if (Z_TYPE_P(zlow) == IS_DOUBLE || Z_TYPE_P(zhigh) == IS_DOUBLE || is_step_double) {
@@ -2384,9 +3042,9 @@ PHP_FUNCTION(shuffle)
{
zval *array;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/", &array) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ARRAY_EX(array, 0, 1)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_array_data_shuffle(array);
@@ -2545,9 +3203,10 @@ PHP_FUNCTION(array_push)
argc; /* Number of function arguments */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/+", &stack, &args, &argc) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, -1)
+ Z_PARAM_ARRAY_EX(stack, 0, 1)
+ Z_PARAM_VARIADIC('+', args, argc)
+ ZEND_PARSE_PARAMETERS_END();
/* For each subsequent argument, make it a reference, increase refcount, and add it to the end of the array */
for (i = 0; i < argc; i++) {
@@ -2744,9 +3403,10 @@ PHP_FUNCTION(array_unshift)
zend_string *key;
zval *value;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/+", &stack, &args, &argc) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, -1)
+ Z_PARAM_ARRAY_EX(stack, 0, 1)
+ Z_PARAM_VARIADIC('+', args, argc)
+ ZEND_PARSE_PARAMETERS_END();
zend_hash_init(&new_hash, zend_hash_num_elements(Z_ARRVAL_P(stack)) + argc, NULL, ZVAL_PTR_DTOR, 0);
for (i = 0; i < argc; i++) {
@@ -2796,7 +3456,7 @@ PHP_FUNCTION(array_unshift)
Z_ARRVAL_P(stack)->nNextFreeElement = new_hash.nNextFreeElement;
Z_ARRVAL_P(stack)->arData = new_hash.arData;
Z_ARRVAL_P(stack)->pDestructor = new_hash.pDestructor;
-
+
zend_hash_internal_pointer_reset(Z_ARRVAL_P(stack));
/* Clean up and return the number of elements in the stack */
@@ -2815,9 +3475,13 @@ PHP_FUNCTION(array_splice)
length = 0;
int num_in; /* Number of elements in the input array */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/l|lz/", &array, &offset, &length, &repl_array) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 4)
+ Z_PARAM_ARRAY_EX(array, 0, 1)
+ Z_PARAM_LONG(offset)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(length)
+ Z_PARAM_ZVAL(repl_array)
+ ZEND_PARSE_PARAMETERS_END();
num_in = zend_hash_num_elements(Z_ARRVAL_P(array));
@@ -3151,47 +3815,53 @@ static inline void php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAMETE
Z_PARAM_VARIADIC('+', args, argc)
ZEND_PARSE_PARAMETERS_END();
- for (i = 0; i < argc; i++) {
- zval *arg = args + i;
-
- ZVAL_DEREF(arg);
- if (Z_TYPE_P(arg) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Argument #%d is not an array", i + 1);
- RETURN_NULL();
- }
- }
-
if (replace) {
HashTable *dest;
+ for (i = 0; i < argc; i++) {
+ zval *arg = args + i;
+
+ if (Z_TYPE_P(arg) != IS_ARRAY) {
+ php_error_docref(NULL, E_WARNING, "Argument #%d is not an array", i + 1);
+ RETURN_NULL();
+ }
+ }
+
/* copy first array */
arg = args;
- ZVAL_DEREF(arg);
dest = zend_array_dup(Z_ARRVAL_P(arg));
ZVAL_ARR(return_value, dest);
if (recursive) {
for (i = 1; i < argc; i++) {
arg = args + i;
- ZVAL_DEREF(arg);
php_array_replace_recursive(dest, Z_ARRVAL_P(arg));
}
} else {
for (i = 1; i < argc; i++) {
arg = args + i;
- ZVAL_DEREF(arg);
zend_hash_merge(dest, Z_ARRVAL_P(arg), zval_add_ref, 1);
}
}
} else {
zval *src_entry;
HashTable *src, *dest;
+ uint32_t count = 0;
+
+ for (i = 0; i < argc; i++) {
+ zval *arg = args + i;
+
+ if (Z_TYPE_P(arg) != IS_ARRAY) {
+ php_error_docref(NULL, E_WARNING, "Argument #%d is not an array", i + 1);
+ RETURN_NULL();
+ }
+ count += zend_hash_num_elements(Z_ARRVAL_P(arg));
+ }
arg = args;
- ZVAL_DEREF(arg);
src = Z_ARRVAL_P(arg);
/* copy first array */
- array_init_size(return_value, zend_hash_num_elements(src));
+ array_init_size(return_value, count);
dest = Z_ARRVAL_P(return_value);
if (src->u.flags & HASH_FLAG_PACKED) {
zend_hash_real_init(dest, 1);
@@ -3223,13 +3893,11 @@ static inline void php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAMETE
if (recursive) {
for (i = 1; i < argc; i++) {
arg = args + i;
- ZVAL_DEREF(arg);
php_array_merge_recursive(dest, Z_ARRVAL_P(arg));
}
} else {
for (i = 1; i < argc; i++) {
arg = args + i;
- ZVAL_DEREF(arg);
php_array_merge(dest, Z_ARRVAL_P(arg));
}
}
@@ -3280,6 +3948,8 @@ PHP_FUNCTION(array_keys)
zend_bool strict = 0; /* do strict comparison */
zend_ulong num_idx;
zend_string *str_idx;
+ zend_array *arrval;
+ zend_ulong elem_count;
ZEND_PARSE_PARAMETERS_START(1, 3)
Z_PARAM_ARRAY(input)
@@ -3287,13 +3957,20 @@ PHP_FUNCTION(array_keys)
Z_PARAM_ZVAL(search_value)
Z_PARAM_BOOL(strict)
ZEND_PARSE_PARAMETERS_END();
+ arrval = Z_ARRVAL_P(input);
+ elem_count = zend_hash_num_elements(arrval);
+
+ /* Base case: empty input */
+ if (!elem_count) {
+ RETURN_ZVAL(input, 1, 0)
+ }
/* Initialize return array */
if (search_value != NULL) {
array_init(return_value);
if (strict) {
- ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(input), num_idx, str_idx, entry) {
+ ZEND_HASH_FOREACH_KEY_VAL_IND(arrval, num_idx, str_idx, entry) {
ZVAL_DEREF(entry);
if (fast_is_identical_function(search_value, entry)) {
if (str_idx) {
@@ -3305,7 +3982,7 @@ PHP_FUNCTION(array_keys)
}
} ZEND_HASH_FOREACH_END();
} else {
- ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(input), num_idx, str_idx, entry) {
+ ZEND_HASH_FOREACH_KEY_VAL_IND(arrval, num_idx, str_idx, entry) {
if (fast_equal_check_function(search_value, entry)) {
if (str_idx) {
ZVAL_STR_COPY(&new_val, str_idx);
@@ -3317,21 +3994,26 @@ PHP_FUNCTION(array_keys)
} ZEND_HASH_FOREACH_END();
}
} else {
- array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(input)));
- if (!zend_hash_num_elements(Z_ARRVAL_P(input))) {
- return;
- }
+ array_init_size(return_value, elem_count);
zend_hash_real_init(Z_ARRVAL_P(return_value), 1);
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(return_value)) {
- /* Go through input array and add keys to the return array */
- ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(input), num_idx, str_idx, entry) {
- if (str_idx) {
- ZVAL_STR_COPY(&new_val, str_idx);
- } else {
- ZVAL_LONG(&new_val, num_idx);
+ if (HT_IS_PACKED(arrval) && HT_IS_WITHOUT_HOLES(arrval)) {
+ /* Optimistic case: range(0..n-1) for vector-like packed array */
+ ZVAL_LONG(&new_val, 0);
+ for (; Z_LVAL(new_val) < elem_count; ++Z_LVAL(new_val)) {
+ ZEND_HASH_FILL_ADD(&new_val);
}
- ZEND_HASH_FILL_ADD(&new_val);
- } ZEND_HASH_FOREACH_END();
+ } else {
+ /* Go through input array and add keys to the return array */
+ ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(input), num_idx, str_idx, entry) {
+ if (str_idx) {
+ ZVAL_STR_COPY(&new_val, str_idx);
+ } else {
+ ZVAL_LONG(&new_val, num_idx);
+ }
+ ZEND_HASH_FILL_ADD(&new_val);
+ } ZEND_HASH_FOREACH_END();
+ }
} ZEND_HASH_FILL_END();
}
}
@@ -3343,23 +4025,34 @@ PHP_FUNCTION(array_values)
{
zval *input, /* Input array */
*entry; /* An entry in the input array */
+ zend_array *arrval;
+ zend_long arrlen;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ARRAY(input)
ZEND_PARSE_PARAMETERS_END();
- /* Initialize return array */
- array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(input)));
+ arrval = Z_ARRVAL_P(input);
- if (!zend_hash_num_elements(Z_ARRVAL_P(input))) {
- return;
+ /* Return empty input as is */
+ arrlen = zend_hash_num_elements(arrval);
+ if (!arrlen && arrval->nNextFreeElement == arrlen) {
+ RETURN_ZVAL(input, 1, 0);
+ }
+
+ /* Return vector-like packed arrays as-is */
+ if (HT_IS_PACKED(arrval) && HT_IS_WITHOUT_HOLES(arrval) &&
+ arrval->nNextFreeElement == arrlen) {
+ RETURN_ZVAL(input, 1, 0);
}
+ /* Initialize return array */
+ array_init_size(return_value, zend_hash_num_elements(arrval));
zend_hash_real_init(Z_ARRVAL_P(return_value), 1);
/* Go through input array and add values to the return array */
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(return_value)) {
- ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(input), entry) {
+ ZEND_HASH_FOREACH_VAL(arrval, entry) {
if (UNEXPECTED(Z_ISREF_P(entry) && Z_REFCOUNT_P(entry) == 1)) {
entry = Z_REFVAL_P(entry);
}
@@ -3379,9 +4072,9 @@ PHP_FUNCTION(array_count_values)
*tmp;
HashTable *myht;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &input) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ARRAY(input)
+ ZEND_PARSE_PARAMETERS_END();
/* Initialize return array */
array_init(return_value);
@@ -3480,9 +4173,12 @@ PHP_FUNCTION(array_column)
HashTable *arr_hash;
zval *zcolval = NULL, *zkeyval = NULL, rvc, rvk;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "hz!|z!", &arr_hash, &zcolumn, &zkey) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_ARRAY_HT(arr_hash)
+ Z_PARAM_ZVAL_EX(zcolumn, 1, 0)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_EX(zkey, 1, 0)
+ ZEND_PARSE_PARAMETERS_END();
if ((zcolumn && !array_column_param_helper(zcolumn, "column")) ||
(zkey && !array_column_param_helper(zkey, "index"))) {
@@ -3558,9 +4254,11 @@ PHP_FUNCTION(array_reverse)
zend_ulong num_key;
zend_bool preserve_keys = 0; /* whether to preserve keys */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|b", &input, &preserve_keys) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ARRAY(input)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(preserve_keys)
+ ZEND_PARSE_PARAMETERS_END();
/* Initialize return array */
array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(input)));
@@ -3607,9 +4305,11 @@ PHP_FUNCTION(array_pad)
zend_string *key;
zval *value;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "alz", &input, &pad_size, &pad_value) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(3, 3)
+ Z_PARAM_ARRAY(input)
+ Z_PARAM_LONG(pad_size)
+ Z_PARAM_ZVAL(pad_value)
+ ZEND_PARSE_PARAMETERS_END();
/* Do some initial calculations */
input_size = zend_hash_num_elements(Z_ARRVAL_P(input));
@@ -3689,9 +4389,9 @@ PHP_FUNCTION(array_flip)
zend_ulong num_idx;
zend_string *str_idx;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ARRAY(array)
+ ZEND_PARSE_PARAMETERS_END();
array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(array)));
@@ -3728,9 +4428,11 @@ PHP_FUNCTION(array_change_key_case)
zend_ulong num_key;
zend_long change_to_upper=0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|l", &array, &change_to_upper) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ARRAY(array)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(change_to_upper)
+ ZEND_PARSE_PARAMETERS_END();
array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(array)));
@@ -3773,33 +4475,68 @@ static void array_bucketindex_swap(void *p, void *q) /* {{{ */
PHP_FUNCTION(array_unique)
{
zval *array;
- uint idx;
+ uint32_t idx;
Bucket *p;
struct bucketindex *arTmp, *cmpdata, *lastkept;
unsigned int i;
zend_long sort_type = PHP_SORT_STRING;
compare_func_t cmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|l", &array, &sort_type) == FAILURE) {
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ARRAY(array)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(sort_type)
+ ZEND_PARSE_PARAMETERS_END();
+
+ if (Z_ARRVAL_P(array)->nNumOfElements <= 1) { /* nothing to do */
+ ZVAL_COPY(return_value, array);
return;
}
- cmp = php_get_data_compare_func(sort_type, 0);
+ if (sort_type == PHP_SORT_STRING) {
+ HashTable seen;
+ zend_long num_key;
+ zend_string *str_key;
+ zval *val;
+ zend_hash_init(&seen, zend_hash_num_elements(Z_ARRVAL_P(array)), NULL, NULL, 0);
+ array_init(return_value);
- if (Z_ARRVAL_P(array)->nNumOfElements <= 1) { /* nothing to do */
- ZVAL_COPY(return_value, array);
+ ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_key, str_key, val) {
+ zval *retval;
+ if (Z_TYPE_P(val) == IS_STRING) {
+ retval = zend_hash_add_empty_element(&seen, Z_STR_P(val));
+ } else {
+ zend_string *str_val = zval_get_string(val);
+ retval = zend_hash_add_empty_element(&seen, str_val);
+ zend_string_release(str_val);
+ }
+
+ if (retval) {
+ /* First occurrence of the value */
+ if (UNEXPECTED(Z_ISREF_P(val) && Z_REFCOUNT_P(val) == 1)) {
+ ZVAL_DEREF(val);
+ }
+ Z_TRY_ADDREF_P(val);
+
+ if (str_key) {
+ zend_hash_add_new(Z_ARRVAL_P(return_value), str_key, val);
+ } else {
+ zend_hash_index_add_new(Z_ARRVAL_P(return_value), num_key, val);
+ }
+ }
+ } ZEND_HASH_FOREACH_END();
+
+ zend_hash_destroy(&seen);
return;
}
+ cmp = php_get_data_compare_func(sort_type, 0);
+
RETVAL_ARR(zend_array_dup(Z_ARRVAL_P(array)));
/* create and sort array with pointers to the target_hash buckets */
arTmp = (struct bucketindex *) pemalloc((Z_ARRVAL_P(array)->nNumOfElements + 1) * sizeof(struct bucketindex), Z_ARRVAL_P(array)->u.flags & HASH_FLAG_PERSISTENT);
- if (!arTmp) {
- zval_dtor(return_value);
- RETURN_FALSE;
- }
for (i = 0, idx = 0; idx < Z_ARRVAL_P(array)->nNumUsed; idx++) {
p = Z_ARRVAL_P(array)->arData + idx;
if (Z_TYPE(p->val) == IS_UNDEF) continue;
@@ -3860,7 +4597,7 @@ static int zval_user_compare(zval *a, zval *b) /* {{{ */
if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache)) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
zend_long ret = zval_get_long(&retval);
zval_ptr_dtor(&retval);
- return ret < 0 ? -1 : ret > 0 ? 1 : 0;;
+ return ret < 0 ? -1 : ret > 0 ? 1 : 0;
} else {
return 0;
}
@@ -3869,7 +4606,7 @@ static int zval_user_compare(zval *a, zval *b) /* {{{ */
static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_type) /* {{{ */
{
- uint idx;
+ uint32_t idx;
Bucket *p;
int argc, i;
zval *args;
@@ -3970,7 +4707,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
zval *args = NULL;
HashTable *hash;
int arr_argc, i, c = 0;
- uint idx;
+ uint32_t idx;
Bucket **lists, *list, **ptrs, *p;
uint32_t req_args;
char *param_spec;
@@ -4090,13 +4827,6 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
}
hash = Z_ARRVAL(args[i]);
list = (Bucket *) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket), hash->u.flags & HASH_FLAG_PERSISTENT);
- if (!list) {
- PHP_ARRAY_CMP_FUNC_RESTORE();
-
- efree(ptrs);
- efree(lists);
- RETURN_FALSE;
- }
lists[i] = list;
ptrs[i] = list;
for (idx = 0; idx < hash->nNumUsed; idx++) {
@@ -4297,7 +5027,7 @@ PHP_FUNCTION(array_uintersect_uassoc)
static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_type) /* {{{ */
{
- uint idx;
+ uint32_t idx;
Bucket *p;
int argc, i;
zval *args;
@@ -4393,7 +5123,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
zval *args = NULL;
HashTable *hash;
int arr_argc, i, c;
- uint idx;
+ uint32_t idx;
Bucket **lists, *list, **ptrs, *p;
uint32_t req_args;
char *param_spec;
@@ -4512,13 +5242,6 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
}
hash = Z_ARRVAL(args[i]);
list = (Bucket *) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket), hash->u.flags & HASH_FLAG_PERSISTENT);
- if (!list) {
- PHP_ARRAY_CMP_FUNC_RESTORE();
-
- efree(ptrs);
- efree(lists);
- RETURN_FALSE;
- }
lists[i] = list;
ptrs[i] = list;
for (idx = 0; idx < hash->nNumUsed; idx++) {
@@ -4685,9 +5408,9 @@ PHP_FUNCTION(array_diff)
return;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argc) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_VARIADIC('+', args, argc)
+ ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE(args[0]) != IS_ARRAY) {
php_error_docref(NULL, E_WARNING, "Argument #1 is not an array");
@@ -4826,7 +5549,7 @@ PHP_FUNCTION(array_multisort)
zval* args;
zval** arrays;
Bucket** indirect;
- uint idx;
+ uint32_t idx;
Bucket* p;
HashTable* hash;
int argc;
@@ -4837,9 +5560,9 @@ PHP_FUNCTION(array_multisort)
int sort_type = PHP_SORT_REGULAR;
int i, k, n;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argc) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_VARIADIC('+', args, argc)
+ ZEND_PARSE_PARAMETERS_END();
/* Allocate space for storing pointers to input arrays and sort flags. */
arrays = (zval **)ecalloc(argc, sizeof(zval *));
@@ -5010,9 +5733,11 @@ PHP_FUNCTION(array_rand)
uint32_t bitset_len;
ALLOCA_FLAG(use_heap)
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|l", &input, &num_req) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ARRAY(input)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(num_req)
+ ZEND_PARSE_PARAMETERS_END();
num_avail = zend_hash_num_elements(Z_ARRVAL_P(input));
@@ -5113,9 +5838,9 @@ PHP_FUNCTION(array_sum)
*entry,
entry_n;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &input) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ARRAY(input)
+ ZEND_PARSE_PARAMETERS_END();
ZVAL_LONG(return_value, 0);
@@ -5139,9 +5864,9 @@ PHP_FUNCTION(array_product)
entry_n;
double dval;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &input) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ARRAY(input)
+ ZEND_PARSE_PARAMETERS_END();
ZVAL_LONG(return_value, 1);
if (!zend_hash_num_elements(Z_ARRVAL_P(input))) {
@@ -5183,9 +5908,12 @@ PHP_FUNCTION(array_reduce)
zval *initial = NULL;
HashTable *htbl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "af|z", &input, &fci, &fci_cache, &initial) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_ARRAY(input)
+ Z_PARAM_FUNC(fci, fci_cache)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL(initial)
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() > 2) {
@@ -5245,9 +5973,12 @@ PHP_FUNCTION(array_filter)
zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
zend_ulong num_key;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|fl", &array, &fci, &fci_cache, &use_type) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_ARRAY(array)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_FUNC(fci, fci_cache)
+ Z_PARAM_LONG(use_type)
+ ZEND_PARSE_PARAMETERS_END();
array_init(return_value);
if (zend_hash_num_elements(Z_ARRVAL_P(array)) == 0) {
@@ -5341,6 +6072,7 @@ PHP_FUNCTION(array_map)
zend_ulong num_key;
zend_string *str_key;
zval *zv, arg;
+ int ret;
if (Z_TYPE(arrays[0]) != IS_ARRAY) {
php_error_docref(NULL, E_WARNING, "Argument #%d should be an array", 2);
@@ -5363,13 +6095,11 @@ PHP_FUNCTION(array_map)
fci.no_separation = 0;
ZVAL_COPY(&arg, zv);
-
- if (zend_call_function(&fci, &fci_cache) != SUCCESS || Z_TYPE(result) == IS_UNDEF) {
- zval_dtor(return_value);
- zval_ptr_dtor(&arg);
+ ret = zend_call_function(&fci, &fci_cache);
+ i_zval_ptr_dtor(&arg ZEND_FILE_LINE_CC);
+ if (ret != SUCCESS || Z_TYPE(result) == IS_UNDEF) {
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_NULL();
- } else {
- zval_ptr_dtor(&arg);
}
if (str_key) {
zend_hash_add_new(Z_ARRVAL_P(return_value), str_key, &result);
@@ -5453,7 +6183,7 @@ PHP_FUNCTION(array_map)
if (zend_call_function(&fci, &fci_cache) != SUCCESS || Z_TYPE(result) == IS_UNDEF) {
efree(array_pos);
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
for (i = 0; i < n_arrays; i++) {
zval_ptr_dtor(&params[i]);
}
@@ -5515,7 +6245,7 @@ PHP_FUNCTION(array_key_exists)
Split array into chunks */
PHP_FUNCTION(array_chunk)
{
- int argc = ZEND_NUM_ARGS(), num_in;
+ int num_in;
zend_long size, current = 0;
zend_string *str_key;
zend_ulong num_key;
@@ -5524,9 +6254,13 @@ PHP_FUNCTION(array_chunk)
zval chunk;
zval *entry;
- if (zend_parse_parameters(argc, "al|b", &input, &size, &preserve_keys) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_ARRAY(input)
+ Z_PARAM_LONG(size)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(preserve_keys)
+ ZEND_PARSE_PARAMETERS_END();
+
/* Do bounds checking for size parameter. */
if (size < 1) {
php_error_docref(NULL, E_WARNING, "Size parameter expected to be greater than 0");
@@ -5585,9 +6319,10 @@ PHP_FUNCTION(array_combine)
zval *entry_keys, *entry_values;
int num_keys, num_values;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "hh", &keys, &values) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_ARRAY_HT(keys)
+ Z_PARAM_ARRAY_HT(values)
+ ZEND_PARSE_PARAMETERS_END();
num_keys = zend_hash_num_elements(keys);
num_values = zend_hash_num_elements(values);
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 0a384e2ec0..f7fbc2602b 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -157,9 +157,11 @@ PHP_FUNCTION(assert)
RETURN_TRUE;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|z", &assertion, &description) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ZVAL(assertion)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL(description)
+ ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE_P(assertion) == IS_STRING) {
zval retval;
@@ -169,6 +171,8 @@ PHP_FUNCTION(assert)
RETURN_FALSE;
}
+ php_error_docref(NULL, E_DEPRECATED, "Calling assert() with a string argument is deprecated");
+
myeval = Z_STRVAL_P(assertion);
if (ASSERTG(quiet_eval)) {
@@ -215,7 +219,7 @@ PHP_FUNCTION(assert)
zval *args = safe_emalloc(!description ? 3 : 4, sizeof(zval), 0);
zval retval;
int i;
- uint lineno = zend_get_executed_lineno();
+ uint32_t lineno = zend_get_executed_lineno();
const char *filename = zend_get_executed_filename();
ZVAL_STRING(&args[0], SAFE_STRING(filename));
@@ -290,9 +294,11 @@ PHP_FUNCTION(assert_options)
int ac = ZEND_NUM_ARGS();
zend_string *key;
- if (zend_parse_parameters(ac, "l|z", &what, &value) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_LONG(what)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL(value)
+ ZEND_PARSE_PARAMETERS_END();
switch (what) {
case ASSERT_ACTIVE:
diff --git a/ext/standard/base64.c b/ext/standard/base64.c
index 9cd9584a2f..06856b8221 100644
--- a/ext/standard/base64.c
+++ b/ext/standard/base64.c
@@ -127,12 +127,6 @@ void php_base64_init(void)
*/
/* }}} */
-PHPAPI zend_string *php_base64_decode(const unsigned char *str, size_t length) /* {{{ */
-{
- return php_base64_decode_ex(str, length, 0);
-}
-/* }}} */
-
PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, zend_bool strict) /* {{{ */
{
const unsigned char *current = str;
@@ -213,9 +207,10 @@ PHP_FUNCTION(base64_encode)
size_t str_len;
zend_string *result;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &str_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(str, str_len)
+ ZEND_PARSE_PARAMETERS_END();
+
result = php_base64_encode((unsigned char*)str, str_len);
if (result != NULL) {
RETURN_STR(result);
@@ -234,9 +229,12 @@ PHP_FUNCTION(base64_decode)
size_t str_len;
zend_string *result;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &str, &str_len, &strict) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(strict)
+ ZEND_PARSE_PARAMETERS_END();
+
result = php_base64_decode_ex((unsigned char*)str, str_len, strict);
if (result != NULL) {
RETURN_STR(result);
diff --git a/ext/standard/base64.h b/ext/standard/base64.h
index c8d72d4c79..f380d3c888 100644
--- a/ext/standard/base64.h
+++ b/ext/standard/base64.h
@@ -25,8 +25,18 @@ PHP_FUNCTION(base64_decode);
PHP_FUNCTION(base64_encode);
PHPAPI extern zend_string *php_base64_encode(const unsigned char *, size_t);
+static inline zend_string *php_base64_encode_str(const zend_string *str) {
+ return php_base64_encode((const unsigned char*)(ZSTR_VAL(str)), ZSTR_LEN(str));
+}
+
PHPAPI extern zend_string *php_base64_decode_ex(const unsigned char *, size_t, zend_bool);
-PHPAPI extern zend_string *php_base64_decode(const unsigned char *, size_t);
+
+static inline zend_string *php_base64_decode(const unsigned char *str, size_t len) {
+ return php_base64_decode_ex(str, len, 0);
+}
+static inline zend_string *php_base64_decode_str(const zend_string *str) {
+ return php_base64_decode_ex((const unsigned char*)(ZSTR_VAL(str)), ZSTR_LEN(str), 0);
+}
#endif /* BASE64_H */
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 2dc6207c90..2ce900d512 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -49,6 +49,8 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#include "zend_language_scanner.h"
#include <zend_language_parser.h>
+#include "zend_portability.h"
+
#include <stdarg.h>
#include <stdlib.h>
#include <math.h>
@@ -60,10 +62,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#include <sys/stat.h>
#endif
-#ifdef NETWARE
-#include <netinet/in.h>
-#endif
-
#ifndef PHP_WIN32
# include <netdb.h>
#else
@@ -964,7 +962,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_gethostname, 0)
ZEND_END_ARG_INFO()
#endif
-#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE)))
+#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__))
ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_check_record, 0, 0, 1)
ZEND_ARG_INFO(0, host)
ZEND_ARG_INFO(0, type)
@@ -986,7 +984,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_get_mx, 0, 0, 2)
ZEND_END_ARG_INFO()
# endif
-#endif /* defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE))) */
+#endif /* defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__)) */
/* }}} */
/* {{{ exec.c */
@@ -1206,7 +1204,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetcsv, 0, 0, 1)
ZEND_ARG_INFO(0, escape)
ZEND_END_ARG_INFO()
-#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
+#if (!defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS)
ZEND_BEGIN_ARG_INFO(arginfo_realpath, 0)
ZEND_ARG_INFO(0, path)
ZEND_END_ARG_INFO()
@@ -1232,7 +1230,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_disk_free_space, 0)
ZEND_ARG_INFO(0, path)
ZEND_END_ARG_INFO()
-#ifndef NETWARE
ZEND_BEGIN_ARG_INFO(arginfo_chgrp, 0)
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, group)
@@ -1242,7 +1239,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_chown, 0)
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, user)
ZEND_END_ARG_INFO()
-#endif
#if HAVE_LCHOWN
ZEND_BEGIN_ARG_INFO(arginfo_lchgrp, 0)
@@ -2014,6 +2010,17 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_supports_lock, 0, 0, 1)
ZEND_ARG_INFO(0, stream)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_isatty, 0, 0, 1)
+ ZEND_ARG_INFO(0, stream)
+ZEND_END_ARG_INFO()
+
+#ifdef PHP_WIN32
+ZEND_BEGIN_ARG_INFO_EX(arginfo_sapi_windows_vt100_support, 0, 0, 1)
+ ZEND_ARG_INFO(0, stream)
+ ZEND_ARG_INFO(0, enable)
+ZEND_END_ARG_INFO()
+#endif
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_select, 0, 0, 4)
ZEND_ARG_INFO(1, read_streams) /* ARRAY_INFO(1, read_streams, 1) */
ZEND_ARG_INFO(1, write_streams) /* ARRAY_INFO(1, write_streams, 1) */
@@ -2468,6 +2475,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_compare, 0, 0, 3)
ZEND_ARG_INFO(0, length)
ZEND_ARG_INFO(0, case_sensitivity)
ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_utf8_encode, 0, 0, 1)
+ ZEND_ARG_INFO(0, data)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_utf8_decode, 0, 0, 1)
+ ZEND_ARG_INFO(0, data)
+ZEND_END_ARG_INFO()
/* }}} */
/* {{{ syslog.c */
#ifdef HAVE_SYSLOG_H
@@ -2767,6 +2782,8 @@ const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(str_split, arginfo_str_split)
PHP_FE(strpbrk, arginfo_strpbrk)
PHP_FE(substr_compare, arginfo_substr_compare)
+ PHP_FE(utf8_encode, arginfo_utf8_encode)
+ PHP_FE(utf8_decode, arginfo_utf8_decode)
#ifdef HAVE_STRCOLL
PHP_FE(strcoll, arginfo_strcoll)
@@ -3043,7 +3060,7 @@ const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(gethostname, arginfo_gethostname)
#endif
-#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE)))
+#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__))
PHP_FE(dns_check_record, arginfo_dns_check_record)
PHP_FALIAS(checkdnsrr, dns_check_record, arginfo_dns_check_record)
@@ -3137,6 +3154,10 @@ const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(stream_copy_to_stream, arginfo_stream_copy_to_stream)
PHP_FE(stream_get_contents, arginfo_stream_get_contents)
PHP_FE(stream_supports_lock, arginfo_stream_supports_lock)
+ PHP_FE(stream_isatty, arginfo_stream_isatty)
+#ifdef PHP_WIN32
+ PHP_FE(sapi_windows_vt100_support, arginfo_sapi_windows_vt100_support)
+#endif
PHP_FE(fgetcsv, arginfo_fgetcsv)
PHP_FE(fputcsv, arginfo_fputcsv)
PHP_FE(flock, arginfo_flock)
@@ -3168,7 +3189,7 @@ const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FALIAS(socket_get_status, stream_get_meta_data, arginfo_stream_get_meta_data)
-#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
+#if (!defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS)
PHP_FE(realpath, arginfo_realpath)
#endif
@@ -3227,10 +3248,8 @@ const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(is_link, arginfo_is_link)
PHP_NAMED_FE(stat, php_if_stat, arginfo_stat)
PHP_NAMED_FE(lstat, php_if_lstat, arginfo_lstat)
-#ifndef NETWARE
PHP_FE(chown, arginfo_chown)
PHP_FE(chgrp, arginfo_chgrp)
-#endif
#if HAVE_LCHOWN
PHP_FE(lchown, arginfo_lchown)
#endif
@@ -3519,40 +3538,15 @@ static void basic_globals_dtor(php_basic_globals *basic_globals_p) /* {{{ */
}
/* }}} */
-#define PHP_DOUBLE_INFINITY_HIGH 0x7ff00000
-#define PHP_DOUBLE_QUIET_NAN_HIGH 0xfff80000
-
PHPAPI double php_get_nan(void) /* {{{ */
{
-#if HAVE_HUGE_VAL_NAN
- return HUGE_VAL + -HUGE_VAL;
-#elif defined(__i386__) || defined(_X86_) || defined(ALPHA) || defined(_ALPHA) || defined(__alpha)
- double val = 0.0;
- ((uint32_t*)&val)[1] = PHP_DOUBLE_QUIET_NAN_HIGH;
- ((uint32_t*)&val)[0] = 0;
- return val;
-#elif HAVE_ATOF_ACCEPTS_NAN
- return atof("NAN");
-#else
- return 0.0/0.0;
-#endif
+ return ZEND_NAN;
}
/* }}} */
PHPAPI double php_get_inf(void) /* {{{ */
{
-#if HAVE_HUGE_VAL_INF
- return HUGE_VAL;
-#elif defined(__i386__) || defined(_X86_) || defined(ALPHA) || defined(_ALPHA) || defined(__alpha)
- double val = 0.0;
- ((uint32_t*)&val)[1] = PHP_DOUBLE_INFINITY_HIGH;
- ((uint32_t*)&val)[0] = 0;
- return val;
-#elif HAVE_ATOF_ACCEPTS_INF
- return atof("INF");
-#else
- return 1.0/0.0;
-#endif
+ return ZEND_INFINITY;
}
/* }}} */
@@ -3644,8 +3638,8 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
REGISTER_MATH_CONSTANT(M_SQRT2);
REGISTER_MATH_CONSTANT(M_SQRT1_2);
REGISTER_MATH_CONSTANT(M_SQRT3);
- REGISTER_DOUBLE_CONSTANT("INF", php_get_inf(), CONST_CS | CONST_PERSISTENT);
- REGISTER_DOUBLE_CONSTANT("NAN", php_get_nan(), CONST_CS | CONST_PERSISTENT);
+ REGISTER_DOUBLE_CONSTANT("INF", ZEND_INFINITY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_DOUBLE_CONSTANT("NAN", ZEND_NAN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_UP", PHP_ROUND_HALF_UP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_DOWN", PHP_ROUND_HALF_DOWN, CONST_CS | CONST_PERSISTENT);
@@ -3706,7 +3700,7 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
php_register_url_stream_wrapper("http", &php_stream_http_wrapper);
php_register_url_stream_wrapper("ftp", &php_stream_ftp_wrapper);
-#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE)))
+#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__))
# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS
BASIC_MINIT_SUBMODULE(dns)
# endif
@@ -3878,9 +3872,9 @@ PHP_FUNCTION(constant)
zval *c;
zend_class_entry *scope;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &const_name) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(const_name)
+ ZEND_PARSE_PARAMETERS_END();
scope = zend_get_executed_scope();
c = zend_get_constant_ex(const_name, scope, ZEND_FETCH_CLASS_SILENT);
@@ -3910,9 +3904,9 @@ PHP_NAMED_FUNCTION(php_inet_ntop)
int af = AF_INET;
char buffer[40];
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &address, &address_len) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(address, address_len)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
#ifdef HAVE_IPV6
if (address_len == 16) {
@@ -3944,9 +3938,9 @@ PHP_NAMED_FUNCTION(php_inet_pton)
size_t address_len;
char buffer[17];
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &address, &address_len) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(address, address_len)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
memset(buffer, 0, sizeof(buffer));
@@ -3984,9 +3978,9 @@ PHP_FUNCTION(ip2long)
zend_ulong ip;
#endif
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &addr, &addr_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(addr, addr_len)
+ ZEND_PARSE_PARAMETERS_END();
#ifdef HAVE_INET_PTON
if (addr_len == 0 || inet_pton(AF_INET, addr, &ip) != 1) {
@@ -4015,14 +4009,18 @@ PHP_FUNCTION(ip2long)
PHP_FUNCTION(long2ip)
{
zend_ulong ip;
+ zend_long sip;
struct in_addr myaddr;
#ifdef HAVE_INET_PTON
char str[40];
#endif
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &ip) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_LONG(sip)
+ ZEND_PARSE_PARAMETERS_END();
+
+ /* autoboxes on 32bit platforms, but that's expected */
+ ip = (zend_ulong)sip;
myaddr.s_addr = htonl(ip);
#ifdef HAVE_INET_PTON
@@ -4050,9 +4048,11 @@ PHP_FUNCTION(getenv)
size_t str_len;
zend_bool local_only = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|sb", &str, &str_len, &local_only) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 2)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_BOOL(local_only)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (!str) {
array_init(return_value);
@@ -4140,9 +4140,9 @@ PHP_FUNCTION(putenv)
int error_code;
#endif
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &setting, &setting_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(setting, setting_len)
+ ZEND_PARSE_PARAMETERS_END();
if(setting_len == 0 || setting[0] == '=') {
php_error_docref(NULL, E_WARNING, "Invalid parameter syntax");
@@ -4337,13 +4337,16 @@ PHP_FUNCTION(getopt)
int optname_len = 0;
opt_struct *opts, *orig_opts;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|az/", &options, &options_len, &p_longopts, &zoptind) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_STRING(options, options_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ARRAY(p_longopts)
+ Z_PARAM_ZVAL_DEREF(zoptind)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
/* Init zoptind to 1 */
if (zoptind) {
- zval_dtor(zoptind);
+ zval_ptr_dtor(zoptind);
ZVAL_LONG(zoptind, 1);
}
@@ -4517,9 +4520,10 @@ PHP_FUNCTION(sleep)
{
zend_long num;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &num) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_LONG(num)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+
if (num < 0) {
php_error_docref(NULL, E_WARNING, "Number of seconds must be greater than or equal to 0");
RETURN_FALSE;
@@ -4540,9 +4544,10 @@ PHP_FUNCTION(usleep)
#if HAVE_USLEEP
zend_long num;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &num) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_LONG(num)
+ ZEND_PARSE_PARAMETERS_END();
+
if (num < 0) {
php_error_docref(NULL, E_WARNING, "Number of microseconds must be greater than or equal to 0");
RETURN_FALSE;
@@ -4560,9 +4565,10 @@ PHP_FUNCTION(time_nanosleep)
zend_long tv_sec, tv_nsec;
struct timespec php_req, php_rem;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &tv_sec, &tv_nsec) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_LONG(tv_sec)
+ Z_PARAM_LONG(tv_nsec)
+ ZEND_PARSE_PARAMETERS_END();
if (tv_sec < 0) {
php_error_docref(NULL, E_WARNING, "The seconds value must be greater than 0");
@@ -4598,9 +4604,9 @@ PHP_FUNCTION(time_sleep_until)
struct timeval tm;
struct timespec php_req, php_rem;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "d", &d_ts) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_DOUBLE(d_ts)
+ ZEND_PARSE_PARAMETERS_END();
if (gettimeofday((struct timeval *) &tm, NULL) != 0) {
RETURN_FALSE;
@@ -4675,11 +4681,11 @@ PHP_FUNCTION(get_cfg_var)
size_t varname_len;
zval *retval;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &varname, &varname_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(varname, varname_len)
+ ZEND_PARSE_PARAMETERS_END();
- retval = cfg_get_entry(varname, (uint)varname_len);
+ retval = cfg_get_entry(varname, (uint32_t)varname_len);
if (retval) {
if (Z_TYPE_P(retval) == IS_ARRAY) {
@@ -4740,9 +4746,13 @@ PHP_FUNCTION(error_log)
int opt_err = 0, argc = ZEND_NUM_ARGS();
zend_long erropt = 0;
- if (zend_parse_parameters(argc, "s|lps", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 4)
+ Z_PARAM_STRING(message, message_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(erropt)
+ Z_PARAM_PATH(opt, opt_len)
+ Z_PARAM_STRING(headers, headers_len)
+ ZEND_PARSE_PARAMETERS_END();
if (argc > 1) {
opt_err = (int)erropt;
@@ -4912,9 +4922,10 @@ PHP_FUNCTION(forward_static_call)
zend_fcall_info_cache fci_cache;
zend_class_entry *called_scope;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "f*", &fci, &fci_cache, &fci.params, &fci.param_count) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_FUNC(fci, fci_cache)
+ Z_PARAM_VARIADIC('*', fci.params, fci.param_count)
+ ZEND_PARSE_PARAMETERS_END();
if (!EX(prev_execute_data)->func->common.scope) {
zend_throw_error(NULL, "Cannot call forward_static_call() when no class scope is active");
@@ -4947,9 +4958,10 @@ PHP_FUNCTION(forward_static_call_array)
zend_fcall_info_cache fci_cache;
zend_class_entry *called_scope;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "fa/", &fci, &fci_cache, &params) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_FUNC(fci, fci_cache)
+ Z_PARAM_ARRAY_EX(params, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
zend_fcall_info_args(&fci, params);
fci.retval = &retval;
@@ -4999,19 +5011,13 @@ static int user_shutdown_function_call(zval *zv) /* {{{ */
{
php_shutdown_function_entry *shutdown_function_entry = Z_PTR_P(zv);
zval retval;
- zend_string *function_name;
- if (!zend_is_callable(&shutdown_function_entry->arguments[0], 0, &function_name)) {
- if (function_name) {
- php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", ZSTR_VAL(function_name));
- zend_string_release(function_name);
- } else {
- php_error(E_WARNING, "(Registered shutdown functions) Unable to call - function does not exist");
- }
- return 0;
- }
- if (function_name) {
+ if (!zend_is_callable(&shutdown_function_entry->arguments[0], 0, NULL)) {
+ zend_string *function_name
+ = zend_get_callable_name(&shutdown_function_entry->arguments[0]);
+ php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", ZSTR_VAL(function_name));
zend_string_release(function_name);
+ return 0;
}
if (call_user_function(EG(function_table), NULL,
@@ -5125,7 +5131,6 @@ PHPAPI void php_free_shutdown_functions(void) /* {{{ */
PHP_FUNCTION(register_shutdown_function)
{
php_shutdown_function_entry shutdown_function_entry;
- zend_string *callback_name = NULL;
int i;
shutdown_function_entry.arg_count = ZEND_NUM_ARGS();
@@ -5142,13 +5147,12 @@ PHP_FUNCTION(register_shutdown_function)
}
/* Prevent entering of anything but valid callback (syntax check only!) */
- if (!zend_is_callable(&shutdown_function_entry.arguments[0], 0, &callback_name)) {
- if (callback_name) {
- php_error_docref(NULL, E_WARNING, "Invalid shutdown callback '%s' passed", ZSTR_VAL(callback_name));
- } else {
- php_error_docref(NULL, E_WARNING, "Invalid shutdown callback passed");
- }
+ if (!zend_is_callable(&shutdown_function_entry.arguments[0], 0, NULL)) {
+ zend_string *callback_name
+ = zend_get_callable_name(&shutdown_function_entry.arguments[0]);
+ php_error_docref(NULL, E_WARNING, "Invalid shutdown callback '%s' passed", ZSTR_VAL(callback_name));
efree(shutdown_function_entry.arguments);
+ zend_string_release(callback_name);
RETVAL_FALSE;
} else {
if (!BG(user_shutdown_function_names)) {
@@ -5161,9 +5165,6 @@ PHP_FUNCTION(register_shutdown_function)
}
zend_hash_next_index_insert_mem(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry));
}
- if (callback_name) {
- zend_string_release(callback_name);
- }
}
/* }}} */
@@ -5219,9 +5220,11 @@ PHP_FUNCTION(highlight_file)
zend_syntax_highlighter_ini syntax_highlighter_ini;
zend_bool i = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &filename, &filename_len, &i) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(i)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (php_check_open_basedir(filename)) {
RETURN_FALSE;
@@ -5260,9 +5263,9 @@ PHP_FUNCTION(php_strip_whitespace)
zend_lex_state original_lex_state;
zend_file_handle file_handle;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_PATH(filename, filename_len)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_output_start_default();
@@ -5298,9 +5301,11 @@ PHP_FUNCTION(highlight_string)
zend_bool i = 0;
int old_error_reporting = EG(error_reporting);
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &expr, &i) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ZVAL(expr)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(i)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
convert_to_string_ex(expr);
if (i) {
@@ -5339,19 +5344,25 @@ PHP_FUNCTION(highlight_string)
PHP_FUNCTION(ini_get)
{
char *varname, *str;
- size_t varname_len;
+ size_t varname_len, len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &varname, &varname_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(varname, varname_len)
+ ZEND_PARSE_PARAMETERS_END();
- str = zend_ini_string(varname, (uint)varname_len, 0);
+ str = zend_ini_string(varname, (uint32_t)varname_len, 0);
if (!str) {
RETURN_FALSE;
}
- RETURN_STRING(str);
+ len = strlen(str);
+ if (len == 0) {
+ RETURN_EMPTY_STRING();
+ } else if (len == 1) {
+ RETURN_INTERNED_STR(ZSTR_CHAR((zend_uchar)str[0]));
+ }
+ RETURN_STRINGL(str, len);
}
/* }}} */
@@ -5414,9 +5425,11 @@ PHP_FUNCTION(ini_get_all)
zend_module_entry *module;
zend_bool details = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!b", &extname, &extname_len, &details) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 2)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING_EX(extname, extname_len, 1, 0)
+ Z_PARAM_BOOL(details)
+ ZEND_PARSE_PARAMETERS_END();
zend_ini_sort_entries();
@@ -5451,15 +5464,24 @@ PHP_FUNCTION(ini_set)
zend_string *new_value;
char *old_value;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &varname, &new_value) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_STR(varname)
+ Z_PARAM_STR(new_value)
+ ZEND_PARSE_PARAMETERS_END();
old_value = zend_ini_string(ZSTR_VAL(varname), (int)ZSTR_LEN(varname), 0);
/* copy to return here, because alter might free it! */
if (old_value) {
- RETVAL_STRING(old_value);
+ size_t len = strlen(old_value);
+
+ if (len == 0) {
+ RETVAL_EMPTY_STRING();
+ } else if (len == 1) {
+ RETVAL_INTERNED_STR(ZSTR_CHAR((zend_uchar)old_value[0]));
+ } else {
+ RETVAL_STRINGL(old_value, len);
+ }
} else {
RETVAL_FALSE;
}
@@ -5493,9 +5515,9 @@ PHP_FUNCTION(ini_restore)
{
zend_string *varname;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &varname) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(varname)
+ ZEND_PARSE_PARAMETERS_END();
zend_restore_ini_entry(varname, PHP_INI_STAGE_RUNTIME);
}
@@ -5509,9 +5531,9 @@ PHP_FUNCTION(set_include_path)
char *old_value;
zend_string *key;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "P", &new_value) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_PATH_STR(new_value)
+ ZEND_PARSE_PARAMETERS_END();
old_value = zend_ini_string("include_path", sizeof("include_path") - 1, 0);
/* copy to return here, because alter might free it! */
@@ -5537,7 +5559,7 @@ PHP_FUNCTION(get_include_path)
{
char *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -5557,7 +5579,7 @@ PHP_FUNCTION(restore_include_path)
{
zend_string *key;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
key = zend_string_init("include_path", sizeof("include_path")-1, 0);
@@ -5573,9 +5595,11 @@ PHP_FUNCTION(print_r)
zval *var;
zend_bool do_return = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &var, &do_return) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ZVAL(var)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(do_return)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (do_return) {
RETURN_STR(zend_print_zval_r_to_str(var, 0));
@@ -5609,9 +5633,10 @@ PHP_FUNCTION(ignore_user_abort)
zend_bool arg = 0;
int old_setting;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &arg) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(arg)
+ ZEND_PARSE_PARAMETERS_END();
old_setting = (unsigned short)PG(ignore_user_abort);
@@ -5634,9 +5659,10 @@ PHP_FUNCTION(getservbyname)
size_t name_len, proto_len;
struct servent *serv;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &proto, &proto_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_STRING(name, name_len)
+ Z_PARAM_STRING(proto, proto_len)
+ ZEND_PARSE_PARAMETERS_END();
/* empty string behaves like NULL on windows implementation of
@@ -5677,9 +5703,10 @@ PHP_FUNCTION(getservbyport)
zend_long port;
struct servent *serv;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &port, &proto, &proto_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_LONG(port)
+ Z_PARAM_STRING(proto, proto_len)
+ ZEND_PARSE_PARAMETERS_END();
serv = getservbyport(htons((unsigned short) port), proto);
@@ -5701,9 +5728,9 @@ PHP_FUNCTION(getprotobyname)
size_t name_len;
struct protoent *ent;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(name, name_len)
+ ZEND_PARSE_PARAMETERS_END();
ent = getprotobyname(name);
@@ -5724,9 +5751,9 @@ PHP_FUNCTION(getprotobynumber)
zend_long proto;
struct protoent *ent;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &proto) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_LONG(proto)
+ ZEND_PARSE_PARAMETERS_END();
ent = getprotobynumber((int)proto);
@@ -5801,9 +5828,9 @@ PHP_FUNCTION(unregister_tick_function)
zval *function;
user_tick_function_entry tick_fe;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/", &function) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(function)
+ ZEND_PARSE_PARAMETERS_END();
if (!BG(user_tick_functions)) {
return;
@@ -5832,9 +5859,9 @@ PHP_FUNCTION(is_uploaded_file)
RETURN_FALSE;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &path, &path_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(path, path_len)
+ ZEND_PARSE_PARAMETERS_END();
if (zend_hash_str_exists(SG(rfc1867_uploaded_files), path, path_len)) {
RETURN_TRUE;
@@ -5860,9 +5887,10 @@ PHP_FUNCTION(move_uploaded_file)
RETURN_FALSE;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sp", &path, &path_len, &new_path, &new_path_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_STRING(path, path_len)
+ Z_PARAM_PATH(new_path, new_path_len)
+ ZEND_PARSE_PARAMETERS_END();
if (!zend_hash_str_exists(SG(rfc1867_uploaded_files), path, path_len)) {
RETURN_FALSE;
@@ -5988,9 +6016,12 @@ PHP_FUNCTION(parse_ini_file)
zend_file_handle fh;
zend_ini_parser_cb_t ini_parser_cb;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|bl", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(process_sections)
+ Z_PARAM_LONG(scanner_mode)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (filename_len == 0) {
php_error_docref(NULL, E_WARNING, "Filename cannot be empty!");
@@ -6028,9 +6059,12 @@ PHP_FUNCTION(parse_ini_string)
zend_long scanner_mode = ZEND_INI_SCANNER_NORMAL;
zend_ini_parser_cb_t ini_parser_cb;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|bl", &str, &str_len, &process_sections, &scanner_mode) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(process_sections)
+ Z_PARAM_LONG(scanner_mode)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (INT_MAX - str_len < ZEND_MMAP_AHEAD) {
RETVAL_FALSE;
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index c1ee2eb274..365caa51d0 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -411,10 +411,6 @@ static int browscap_read_file(char *filename, browser_data *browdata, int persis
fh.type = ZEND_HANDLE_FP;
browdata->htab = pemalloc(sizeof *browdata->htab, persistent);
- if (browdata->htab == NULL) {
- return FAILURE;
- }
-
zend_hash_init_ex(browdata->htab, 0, NULL,
persistent ? browscap_entry_dtor_persistent : browscap_entry_dtor, persistent, 0);
@@ -551,7 +547,7 @@ static int browser_reg_compare(
zend_string *agent_name = va_arg(args, zend_string *);
browscap_entry **found_entry_ptr = va_arg(args, browscap_entry **);
browscap_entry *found_entry = *found_entry_ptr;
- ALLOCA_FLAG(use_heap);
+ ALLOCA_FLAG(use_heap)
zend_string *pattern_lc, *regex;
const char *cur;
int i;
@@ -687,9 +683,11 @@ PHP_FUNCTION(get_browser)
bdata = &global_bdata;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S!b", &agent_name, &return_array) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 2)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STR_EX(agent_name, 1, 0)
+ Z_PARAM_BOOL(return_array)
+ ZEND_PARSE_PARAMETERS_END();
if (agent_name == NULL) {
zval *http_user_agent = NULL;
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index 61eefdc339..87ee059bd3 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -289,7 +289,6 @@ dnl
dnl log2 could be used to improve the log function, however it requires C99. The check for log2 should be turned on,
dnl as soon as we support C99.
AC_CHECK_FUNCS(getcwd getwd asinh acosh atanh log1p hypot glob strfmon nice fpclass mempcpy strpncpy)
-AC_CHECK_DECLS([isnan, isinf], [], [], [[#include <math.h>]])
AC_FUNC_FNMATCH
dnl
@@ -353,143 +352,6 @@ dnl
PHP_CHECK_FUNC(res_search, resolv, bind, socket)
dnl
-dnl Check if atof() accepts NAN
-dnl
-AC_CACHE_CHECK(whether atof() accepts NAN, ac_cv_atof_accept_nan,[
-AC_TRY_RUN([
-#include <math.h>
-#include <stdlib.h>
-
-#if HAVE_DECL_ISNAN
-#define zend_isnan(a) isnan(a)
-#elif defined(HAVE_FPCLASS)
-#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
-#else
-#define zend_isnan(a) 0
-#endif
-
-int main(int argc, char** argv)
-{
- return zend_isnan(atof("NAN")) ? 0 : 1;
-}
-],[
- ac_cv_atof_accept_nan=yes
-],[
- ac_cv_atof_accept_nan=no
-],[
- ac_cv_atof_accept_nan=no
-])])
-if test "$ac_cv_atof_accept_nan" = "yes"; then
- AC_DEFINE([HAVE_ATOF_ACCEPTS_NAN], 1, [whether atof() accepts NAN])
-fi
-
-dnl
-dnl Check if atof() accepts INF
-dnl
-AC_CACHE_CHECK(whether atof() accepts INF, ac_cv_atof_accept_inf,[
-AC_TRY_RUN([
-#include <math.h>
-#include <stdlib.h>
-
-#if HAVE_DECL_ISINF
-#define zend_isinf(a) isinf(a)
-#elif defined(INFINITY)
-/* Might not work, but is required by ISO C99 */
-#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
-#elif defined(HAVE_FPCLASS)
-#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
-#else
-#define zend_isinf(a) 0
-#endif
-
-int main(int argc, char** argv)
-{
- return zend_isinf(atof("INF")) && zend_isinf(atof("-INF")) ? 0 : 1;
-}
-],[
- ac_cv_atof_accept_inf=yes
-],[
- ac_cv_atof_accept_inf=no
-],[
- ac_cv_atof_accept_inf=no
-])])
-if test "$ac_cv_atof_accept_inf" = "yes"; then
- AC_DEFINE([HAVE_ATOF_ACCEPTS_INF], 1, [whether atof() accepts INF])
-fi
-
-dnl
-dnl Check if HUGE_VAL == INF
-dnl
-AC_CACHE_CHECK(whether HUGE_VAL == INF, ac_cv_huge_val_inf,[
-AC_TRY_RUN([
-#include <math.h>
-#include <stdlib.h>
-
-#if HAVE_DECL_ISINF
-#define zend_isinf(a) isinf(a)
-#elif defined(INFINITY)
-/* Might not work, but is required by ISO C99 */
-#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
-#elif defined(HAVE_FPCLASS)
-#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
-#else
-#define zend_isinf(a) 0
-#endif
-
-int main(int argc, char** argv)
-{
- return zend_isinf(HUGE_VAL) ? 0 : 1;
-}
-],[
- ac_cv_huge_val_inf=yes
-],[
- ac_cv_huge_val_inf=no
-],[
- ac_cv_huge_val_inf=yes
-])])
-dnl This is the most probable fallback so we assume yes in case of cross compile.
-if test "$ac_cv_huge_val_inf" = "yes"; then
- AC_DEFINE([HAVE_HUGE_VAL_INF], 1, [whether HUGE_VAL == INF])
-fi
-
-dnl
-dnl Check if HUGE_VAL + -HUGEVAL == NAN
-dnl
-AC_CACHE_CHECK(whether HUGE_VAL + -HUGEVAL == NAN, ac_cv_huge_val_nan,[
-AC_TRY_RUN([
-#include <math.h>
-#include <stdlib.h>
-
-#if HAVE_DECL_ISNAN
-#define zend_isnan(a) isnan(a)
-#elif defined(HAVE_FPCLASS)
-#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
-#else
-#define zend_isnan(a) 0
-#endif
-
-int main(int argc, char** argv)
-{
-#if defined(__sparc__) && !(__GNUC__ >= 3)
- /* prevent bug #27830 */
- return 1;
-#else
- return zend_isnan(HUGE_VAL + -HUGE_VAL) ? 0 : 1;
-#endif
-}
-],[
- ac_cv_huge_val_nan=yes
-],[
- ac_cv_huge_val_nan=no
-],[
- ac_cv_huge_val_nan=yes
-])])
-dnl This is the most probable fallback so we assume yes in case of cross compile.
-if test "$ac_cv_huge_val_nan" = "yes"; then
- AC_DEFINE([HAVE_HUGE_VAL_NAN], 1, [whether HUGE_VAL + -HUGEVAL == NAN])
-fi
-
-dnl
dnl Check for strptime()
dnl
AC_CACHE_CHECK(whether strptime() declaration fails, ac_cv_strptime_decl_fails,[
@@ -548,6 +410,45 @@ dnl
AC_CHECK_DECLS([arc4random_buf])
dnl
+dnl Check for argon2
+dnl
+PHP_ARG_WITH(password-argon2, for Argon2 support,
+[ --with-password-argon2[=DIR] Include Argon2 support in password_*. DIR is the Argon2 shared library path]])
+
+if test "$PHP_PASSWORD_ARGON2" != "no"; then
+ AC_MSG_CHECKING([for Argon2 library])
+ for i in $PHP_PASSWORD_ARGON2 /usr /usr/local ; do
+ if test -r $i/include/argon2.h; then
+ ARGON2_DIR=$i;
+ AC_MSG_RESULT(found in $i)
+ break
+ fi
+ done
+
+ if test -z "$ARGON2_DIR"; then
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([Please ensure the argon2 header and library are installed])
+ fi
+
+ PHP_ADD_LIBRARY_WITH_PATH(argon2, $ARGON2_DIR/$PHP_LIBDIR)
+ PHP_ADD_INCLUDE($ARGON2_DIR/include)
+
+ AC_CHECK_LIB(argon2, argon2_hash, [
+ LIBS="$LIBS -largon2"
+ AC_DEFINE(HAVE_ARGON2LIB, 1, [ Define to 1 if you have the <argon2.h> header file ])
+ ], [
+ AC_MSG_ERROR([Problem with libargon2.(a|so). Please verify that Argon2 header and libaries are installed])
+ ])
+
+ AC_CHECK_LIB(argon2, argon2id_hash_raw, [
+ LIBS="$LIBS -largon2"
+ AC_DEFINE(HAVE_ARGON2ID, 1, [ Define to 1 if Argon2 library has support for Argon2ID])
+ ], [
+ AC_MSG_RESULT([not found])
+ ])
+fi
+
+dnl
dnl Setup extension sources
dnl
PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.c crypt.c \
diff --git a/ext/standard/config.w32 b/ext/standard/config.w32
index ee5c319aa7..ee1935fe87 100644
--- a/ext/standard/config.w32
+++ b/ext/standard/config.w32
@@ -1,6 +1,20 @@
// vim:ft=javascript
// $Id$
+ARG_WITH("password-argon2", "Argon2 support", "no");
+
+if (PHP_PASSWORD_ARGON2 != "no") {
+ if (CHECK_LIB("argon2_a.lib;argon2.lib", null, PHP_PASSWORD_ARGON2)
+ && CHECK_HEADER_ADD_INCLUDE("argon2.h", "CFLAGS")) {
+ AC_DEFINE('HAVE_ARGON2LIB', 1);
+ if (CHECK_FUNC_IN_HEADER("argon2.h", "argon2id_hash_raw", PHP_PHP_BUILD + "\\include", "CFLAGS")) {
+ AC_DEFINE('HAVE_ARGON2ID', 1);
+ }
+ } else {
+ WARNING("Argon2 not enabled; libaries and headers not found");
+ }
+}
+
ARG_WITH("config-file-scan-dir", "Dir to check for additional php ini files", "");
AC_DEFINE("PHP_CONFIG_FILE_SCAN_DIR", PHP_CONFIG_FILE_SCAN_DIR);
@@ -26,4 +40,6 @@ EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \
if (PHP_MBREGEX != "no") {
CHECK_HEADER_ADD_INCLUDE("oniguruma.h", "CFLAGS_STANDARD", PHP_MBREGEX + ";ext\\mbstring\\oniguruma")
}
+ADD_MAKEFILE_FRAGMENT();
PHP_INSTALL_HEADERS("", "ext/standard");
+
diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c
index 3d2f5ed84f..e6d68a46a3 100644
--- a/ext/standard/crc32.c
+++ b/ext/standard/crc32.c
@@ -31,9 +31,10 @@ PHP_NAMED_FUNCTION(php_if_crc32)
uint32_t crcinit = 0;
register uint32_t crc;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &p, &nr) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(p, nr)
+ ZEND_PARSE_PARAMETERS_END();
+
crc = crcinit^0xFFFFFFFF;
for (; nr--; ++p) {
diff --git a/ext/standard/credits_ext.h b/ext/standard/credits_ext.h
index ad957656c5..cf42624977 100644
--- a/ext/standard/credits_ext.h
+++ b/ext/standard/credits_ext.h
@@ -17,7 +17,7 @@ CREDIT_LINE("COM and .Net", "Wez Furlong");
CREDIT_LINE("ctype", "Hartmut Holzgraefe");
CREDIT_LINE("cURL", "Sterling Hughes");
CREDIT_LINE("Date/Time Support", "Derick Rethans");
-CREDIT_LINE("DB-LIB (MS SQL, Sybase)", "Wez Furlong, Frank M. Kromann");
+CREDIT_LINE("DB-LIB (MS SQL, Sybase)", "Wez Furlong, Frank M. Kromann, Adam Baratz");
CREDIT_LINE("DBA", "Sascha Schumann, Marcus Boerger");
CREDIT_LINE("DOM", "Christian Stocker, Rob Richards, Marcus Boerger");
CREDIT_LINE("enchant", "Pierre-Alain Joye, Ilia Alshanetsky");
@@ -36,7 +36,6 @@ CREDIT_LINE("Internationalization", "Ed Batutis, Vladimir Iordanov, Dmitry Lakht
CREDIT_LINE("JSON", "Jakub Zelenka, Omar Kilani, Scott MacVicar");
CREDIT_LINE("LDAP", "Amitay Isaacs, Eric Warnke, Rasmus Lerdorf, Gerrit Thomson, Stig Venaas");
CREDIT_LINE("LIBXML", "Christian Stocker, Rob Richards, Marcus Boerger, Wez Furlong, Shane Caraveo");
-CREDIT_LINE("mcrypt", "Sascha Schumann, Derick Rethans");
CREDIT_LINE("Multibyte String Functions", "Tsukada Takuya, Rui Hirokawa");
CREDIT_LINE("MySQL driver for PDO", "George Schlossnagle, Wez Furlong, Ilia Alshanetsky, Johannes Schlueter");
CREDIT_LINE("MySQLi", "Zak Greant, Georg Richter, Andrey Hristov, Ulf Wendel");
@@ -65,6 +64,7 @@ CREDIT_LINE("SimpleXML", "Sterling Hughes, Marcus Boerger, Rob Richards");
CREDIT_LINE("SNMP", "Rasmus Lerdorf, Harrie Hazewinkel, Mike Jackson, Steven Lawrance, Johann Hanne, Boris Lytochkin");
CREDIT_LINE("SOAP", "Brad Lafountain, Shane Caraveo, Dmitry Stogov");
CREDIT_LINE("Sockets", "Chris Vandomelen, Sterling Hughes, Daniel Beulshausen, Jason Greene");
+CREDIT_LINE("Sodium", "Frank Denis");
CREDIT_LINE("SPL", "Marcus Boerger, Etienne Kneuss");
CREDIT_LINE("SQLite 3.x driver for PDO", "Wez Furlong");
CREDIT_LINE("SQLite3", "Scott MacVicar, Ilia Alshanetsky, Brad Dewar");
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
index e600367816..e873ca7946 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -129,12 +129,12 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
crypt_res = php_sha512_crypt_r(password, salt, output, PHP_MAX_SALT_LEN);
if (!crypt_res) {
- memset(output, 0, PHP_MAX_SALT_LEN);
+ ZEND_SECURE_ZERO(output, PHP_MAX_SALT_LEN);
efree(output);
return NULL;
} else {
result = zend_string_init(output, strlen(output), 0);
- memset(output, 0, PHP_MAX_SALT_LEN);
+ ZEND_SECURE_ZERO(output, PHP_MAX_SALT_LEN);
efree(output);
return result;
}
@@ -144,12 +144,12 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
crypt_res = php_sha256_crypt_r(password, salt, output, PHP_MAX_SALT_LEN);
if (!crypt_res) {
- memset(output, 0, PHP_MAX_SALT_LEN);
+ ZEND_SECURE_ZERO(output, PHP_MAX_SALT_LEN);
efree(output);
return NULL;
} else {
result = zend_string_init(output, strlen(output), 0);
- memset(output, 0, PHP_MAX_SALT_LEN);
+ ZEND_SECURE_ZERO(output, PHP_MAX_SALT_LEN);
efree(output);
return result;
}
@@ -245,9 +245,11 @@ PHP_FUNCTION(crypt)
size_t str_len, salt_in_len = 0;
zend_string *result;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &str, &str_len, &salt_in, &salt_in_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(salt_in, salt_in_len)
+ ZEND_PARSE_PARAMETERS_END();
salt[0] = salt[PHP_MAX_SALT_LEN] = '\0';
diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c
index c5eb473eaf..eedd7f50db 100644
--- a/ext/standard/cyr_convert.c
+++ b/ext/standard/cyr_convert.c
@@ -274,9 +274,11 @@ PHP_FUNCTION(convert_cyr_string)
size_t input_len, fr_cs_len, to_cs_len;
zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss", &input, &input_len, &fr_cs, &fr_cs_len, &to_cs, &to_cs_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(3, 3)
+ Z_PARAM_STRING(input, input_len)
+ Z_PARAM_STRING(fr_cs, fr_cs_len)
+ Z_PARAM_STRING(to_cs, to_cs_len)
+ ZEND_PARSE_PARAMETERS_END();
str = zend_string_init(input, input_len, 0);
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
index e589153eea..dd0d4c2303 100644
--- a/ext/standard/datetime.c
+++ b/ext/standard/datetime.c
@@ -92,9 +92,10 @@ PHP_FUNCTION(strptime)
struct tm parsed_time;
char *unparsed_part;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &ts, &ts_length, &format, &format_length) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_STRING(ts, ts_length)
+ Z_PARAM_STRING(format, format_length)
+ ZEND_PARSE_PARAMETERS_END();
memset(&parsed_time, 0, sizeof(parsed_time));
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index 2fe0d1bc65..81d1ffb611 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -63,21 +63,13 @@ int dir_globals_id;
php_dir_globals dir_globals;
#endif
-#if 0
-typedef struct {
- int id;
- DIR *dir;
-} php_dir;
-
-static int le_dirp;
-#endif
-
static zend_class_entry *dir_class_entry_ptr;
#define FETCH_DIRP() \
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &id) == FAILURE) { \
- return; \
- } \
+ ZEND_PARSE_PARAMETERS_START(0, 1) \
+ Z_PARAM_OPTIONAL \
+ Z_PARAM_RESOURCE(id) \
+ ZEND_PARSE_PARAMETERS_END(); \
if (ZEND_NUM_ARGS() == 0) { \
myself = getThis(); \
if (myself) { \
@@ -224,9 +216,11 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
php_stream_context *context = NULL;
php_stream *dirp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|r", &dirname, &dir_len, &zcontext) == FAILURE) {
- RETURN_NULL();
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_PATH(dirname, dir_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, 0);
@@ -300,9 +294,9 @@ PHP_FUNCTION(chroot)
int ret;
size_t str_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &str, &str_len) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_PATH(str, str_len)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
ret = chroot(str);
if (ret != 0) {
@@ -332,9 +326,9 @@ PHP_FUNCTION(chdir)
int ret;
size_t str_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &str, &str_len) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_PATH(str, str_len)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (php_check_open_basedir(str)) {
RETURN_FALSE;
@@ -429,7 +423,7 @@ PHP_NAMED_FUNCTION(php_if_readdir)
Find pathnames matching a pattern */
PHP_FUNCTION(glob)
{
- int cwd_skip = 0;
+ size_t cwd_skip = 0;
#ifdef ZTS
char cwd[MAXPATHLEN];
char work_pattern[MAXPATHLEN];
@@ -443,9 +437,11 @@ PHP_FUNCTION(glob)
int ret;
zend_bool basedir_limit = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|l", &pattern, &pattern_len, &flags) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_PATH(pattern, pattern_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(flags)
+ ZEND_PARSE_PARAMETERS_END();
if (pattern_len >= MAXPATHLEN) {
php_error_docref(NULL, E_WARNING, "Pattern exceeds the maximum allowed length of %d characters", MAXPATHLEN);
@@ -468,7 +464,7 @@ PHP_FUNCTION(glob)
cwd[2] = '\0';
}
#endif
- cwd_skip = (int)strlen(cwd)+1;
+ cwd_skip = strlen(cwd)+1;
snprintf(work_pattern, MAXPATHLEN, "%s%c%s", cwd, DEFAULT_SLASH, pattern);
pattern = work_pattern;
@@ -566,9 +562,12 @@ PHP_FUNCTION(scandir)
zval *zcontext = NULL;
php_stream_context *context = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|lr", &dirn, &dirn_len, &flags, &zcontext) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_PATH(dirn, dirn_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(flags)
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END();
if (dirn_len < 1) {
php_error_docref(NULL, E_WARNING, "Directory name cannot be empty");
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index e0f2574fb2..9cfccd5235 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -40,9 +40,6 @@
#include "win32/param.h"
#include "win32/winutil.h"
#define GET_DL_ERROR() php_win_err()
-#elif defined(NETWARE)
-#include <sys/param.h>
-#define GET_DL_ERROR() dlerror()
#else
#include <sys/param.h>
#define GET_DL_ERROR() DL_ERROR()
@@ -56,9 +53,9 @@ PHPAPI PHP_FUNCTION(dl)
char *filename;
size_t filename_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &filename, &filename_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(filename, filename_len)
+ ZEND_PARSE_PARAMETERS_END();
if (!PG(enable_dl)) {
php_error_docref(NULL, E_WARNING, "Dynamically loaded extensions aren't enabled");
@@ -79,11 +76,33 @@ PHPAPI PHP_FUNCTION(dl)
#if defined(HAVE_LIBDL)
-#ifdef ZTS
-#define USING_ZTS 1
+/* {{{ php_load_shlib
+ */
+PHPAPI void *php_load_shlib(char *path, char **errp)
+{
+ void *handle;
+ char *err;
+
+ handle = DL_LOAD(path);
+ if (!handle) {
+ err = GET_DL_ERROR();
+#ifdef PHP_WIN32
+ if (err && (*err)) {
+ size_t i = strlen(err);
+ (*errp)=estrdup(err);
+ LocalFree(err);
+ while (i > 0 && isspace((*errp)[i-1])) { (*errp)[i-1] = '\0'; i--; }
+ } else {
+ (*errp) = estrdup("<No message>");
+ }
#else
-#define USING_ZTS 0
+ (*errp) = estrdup(err);
+ GET_DL_ERROR(); /* free the buffer storing the error */
#endif
+ }
+ return handle;
+}
+/* }}} */
/* {{{ php_load_extension
*/
@@ -93,8 +112,9 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now)
char *libpath;
zend_module_entry *module_entry;
zend_module_entry *(*get_module)(void);
- int error_type;
+ int error_type, slash_suffix = 0;
char *extension_dir;
+ char *err1, *err2;
if (type == MODULE_PERSISTENT) {
extension_dir = INI_STR("extension_dir");
@@ -117,9 +137,9 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now)
}
libpath = estrdup(filename);
} else if (extension_dir && extension_dir[0]) {
- int extension_dir_len = (int)strlen(extension_dir);
-
- if (IS_SLASH(extension_dir[extension_dir_len-1])) {
+ slash_suffix = IS_SLASH(extension_dir[strlen(extension_dir)-1]);
+ /* Try as filename first */
+ if (slash_suffix) {
spprintf(&libpath, 0, "%s%s", extension_dir, filename); /* SAFE */
} else {
spprintf(&libpath, 0, "%s%c%s", extension_dir, DEFAULT_SLASH, filename); /* SAFE */
@@ -128,24 +148,31 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now)
return FAILURE; /* Not full path given or extension_dir is not set */
}
- /* load dynamic symbol */
- handle = DL_LOAD(libpath);
+ handle = php_load_shlib(libpath, &err1);
if (!handle) {
-#ifdef PHP_WIN32
- char *err = GET_DL_ERROR();
- if (err && (*err != '\0')) {
- php_error_docref(NULL, error_type, "Unable to load dynamic library '%s' - %s", libpath, err);
- LocalFree(err);
+ /* Now, consider 'filename' as extension name and build file name */
+ char *orig_libpath = libpath;
+
+ if (slash_suffix) {
+ spprintf(&libpath, 0, "%s" PHP_SHLIB_EXT_PREFIX "%s." PHP_SHLIB_SUFFIX, extension_dir, filename); /* SAFE */
} else {
- php_error_docref(NULL, error_type, "Unable to load dynamic library '%s' - %s", libpath, "Unknown reason");
+ spprintf(&libpath, 0, "%s%c" PHP_SHLIB_EXT_PREFIX "%s." PHP_SHLIB_SUFFIX, extension_dir, DEFAULT_SLASH, filename); /* SAFE */
}
-#else
- php_error_docref(NULL, error_type, "Unable to load dynamic library '%s' - %s", libpath, GET_DL_ERROR());
- GET_DL_ERROR(); /* free the buffer storing the error */
-#endif
- efree(libpath);
- return FAILURE;
+
+ handle = php_load_shlib(libpath, &err2);
+ if (!handle) {
+ php_error_docref(NULL, error_type, "Unable to load dynamic library '%s' (tried: %s (%s), %s (%s))",
+ filename, orig_libpath, err1, libpath, err2);
+ efree(orig_libpath);
+ efree(err1);
+ efree(libpath);
+ efree(err2);
+ return FAILURE;
+ }
+ efree(orig_libpath);
+ efree(err1);
}
+
efree(libpath);
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module");
diff --git a/ext/standard/dl.h b/ext/standard/dl.h
index fd85f85ab9..de3fd170bf 100644
--- a/ext/standard/dl.h
+++ b/ext/standard/dl.h
@@ -25,6 +25,7 @@
PHPAPI int php_load_extension(char *filename, int type, int start_now);
PHPAPI void php_dl(char *file, int type, zval *return_value, int start_now);
+PHPAPI void *php_load_shlib(char *path, char **errp);
/* dynamic loading functions */
PHPAPI PHP_FUNCTION(dl);
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
index 8e102f816f..fb21d6dd77 100644
--- a/ext/standard/dns.c
+++ b/ext/standard/dns.c
@@ -33,7 +33,7 @@
# include <winsock2.h>
# include <windows.h>
# include <Ws2tcpip.h>
-#else /* This holds good for NetWare too, both for Winsock and Berkeley sockets */
+#else
#include <netinet/in.h>
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
@@ -57,11 +57,6 @@
#endif
#endif
-/* Borrowed from SYS/SOCKET.H */
-#if defined(NETWARE) && defined(USE_WINSOCK)
-#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
-#endif
-
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 255
#endif
@@ -159,9 +154,9 @@ PHP_FUNCTION(gethostbyaddr)
size_t addr_len;
zend_string *hostname;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &addr, &addr_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(addr, addr_len)
+ ZEND_PARSE_PARAMETERS_END();
hostname = php_gethostbyaddr(addr);
@@ -220,9 +215,9 @@ PHP_FUNCTION(gethostbyname)
char *hostname;
size_t hostname_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &hostname, &hostname_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(hostname, hostname_len)
+ ZEND_PARSE_PARAMETERS_END();
if(hostname_len > MAXFQDNLEN) {
/* name too long, protect from CVE-2015-0235 */
@@ -244,9 +239,9 @@ PHP_FUNCTION(gethostbynamel)
struct in_addr in;
int i;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &hostname, &hostname_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(hostname, hostname_len)
+ ZEND_PARSE_PARAMETERS_END();
if(hostname_len > MAXFQDNLEN) {
/* name too long, protect from CVE-2015-0235 */
@@ -309,7 +304,7 @@ static zend_string *php_gethostbyname(char *name)
#endif /* HAVE_FULL_DNS_FUNCS || defined(PHP_WIN32) */
/* Note: These functions are defined in ext/standard/dns_win32.c for Windows! */
-#if !defined(PHP_WIN32) && (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE)))
+#if !defined(PHP_WIN32) && (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__))
#ifndef HFIXEDSZ
#define HFIXEDSZ 12 /* fixed data in header <arpa/nameser.h> */
@@ -372,9 +367,11 @@ PHP_FUNCTION(dns_check_record)
struct __res_state *handle = &state;
#endif
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &hostname, &hostname_len, &rectype, &rectype_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(hostname, hostname_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(rectype, rectype_len)
+ ZEND_PARSE_PARAMETERS_END();
if (hostname_len == 0) {
php_error_docref(NULL, E_WARNING, "Host cannot be empty");
@@ -478,7 +475,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
if (raw) {
add_assoc_long(subarray, "type", type);
- add_assoc_stringl(subarray, "data", (char*) cp, (uint) dlen);
+ add_assoc_stringl(subarray, "data", (char*) cp, (uint32_t) dlen);
cp += dlen;
return cp;
}
@@ -792,7 +789,7 @@ PHP_FUNCTION(dns_get_record)
{
char *hostname;
size_t hostname_len;
- long type_param = PHP_DNS_ANY;
+ zend_long type_param = PHP_DNS_ANY;
zval *authns = NULL, *addtl = NULL;
int type_to_fetch;
#if defined(HAVE_DNS_SEARCH)
@@ -810,29 +807,33 @@ PHP_FUNCTION(dns_get_record)
int type, first_query = 1, store_results = 1;
zend_bool raw = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lz/!z/!b",
- &hostname, &hostname_len, &type_param, &authns, &addtl, &raw) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 5)
+ Z_PARAM_STRING(hostname, hostname_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(type_param)
+ Z_PARAM_ZVAL_DEREF_EX(authns, 1, 0)
+ Z_PARAM_ZVAL_DEREF_EX(addtl, 1, 0)
+ Z_PARAM_BOOL(raw)
+ ZEND_PARSE_PARAMETERS_END();
if (authns) {
- zval_dtor(authns);
+ zval_ptr_dtor(authns);
array_init(authns);
}
if (addtl) {
- zval_dtor(addtl);
+ zval_ptr_dtor(addtl);
array_init(addtl);
}
if (!raw) {
if ((type_param & ~PHP_DNS_ALL) && (type_param != PHP_DNS_ANY)) {
- php_error_docref(NULL, E_WARNING, "Type '%ld' not supported", type_param);
+ php_error_docref(NULL, E_WARNING, "Type '" ZEND_LONG_FMT "' not supported", type_param);
RETURN_FALSE;
}
} else {
if ((type_param < 1) || (type_param > 0xFFFF)) {
php_error_docref(NULL, E_WARNING,
- "Numeric DNS record type must be between 1 and 65535, '%ld' given", type_param);
+ "Numeric DNS record type must be between 1 and 65535, '" ZEND_LONG_FMT "' given", type_param);
RETURN_FALSE;
}
}
@@ -1041,15 +1042,18 @@ PHP_FUNCTION(dns_get_mx)
struct __res_state *handle = &state;
#endif
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz/|z/", &hostname, &hostname_len, &mx_list, &weight_list) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STRING(hostname, hostname_len)
+ Z_PARAM_ZVAL_DEREF(mx_list)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF(weight_list)
+ ZEND_PARSE_PARAMETERS_END();
- zval_dtor(mx_list);
+ zval_ptr_dtor(mx_list);
array_init(mx_list);
if (weight_list) {
- zval_dtor(weight_list);
+ zval_ptr_dtor(weight_list);
array_init(weight_list);
}
@@ -1113,7 +1117,7 @@ PHP_FUNCTION(dns_get_mx)
}
/* }}} */
#endif /* HAVE_FULL_DNS_FUNCS */
-#endif /* !defined(PHP_WIN32) && (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE))) */
+#endif /* !defined(PHP_WIN32) && (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__)) */
#if HAVE_FULL_DNS_FUNCS || defined(PHP_WIN32)
PHP_MINIT_FUNCTION(dns) {
diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c
index a35f165676..4bca7128a1 100644
--- a/ext/standard/dns_win32.c
+++ b/ext/standard/dns_win32.c
@@ -164,7 +164,7 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw,
if (raw) {
add_assoc_long(subarray, "type", type);
- add_assoc_stringl(subarray, "data", (char*) &pRec->Data, (uint) pRec->wDataLength);
+ add_assoc_stringl(subarray, "data", (char*) &pRec->Data, (uint32_t) pRec->wDataLength);
return;
}
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 8af11801ad..6eb112cddf 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -54,6 +54,10 @@
#include <limits.h>
#endif
+#ifdef PHP_WIN32
+# include "win32/nice.h"
+#endif
+
static size_t cmd_max_len;
/* {{{ PHP_MINIT_FUNCTION(exec) */
@@ -209,15 +213,15 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
zval *ret_code=NULL, *ret_array=NULL;
int ret;
- if (mode) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z/", &cmd, &cmd_len, &ret_code) == FAILURE) {
- RETURN_FALSE;
- }
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z/z/", &cmd, &cmd_len, &ret_array, &ret_code) == FAILURE) {
- RETURN_FALSE;
+ ZEND_PARSE_PARAMETERS_START(1, (mode ? 2 : 3))
+ Z_PARAM_STRING(cmd, cmd_len)
+ Z_PARAM_OPTIONAL
+ if (!mode) {
+ Z_PARAM_ZVAL_DEREF(ret_array)
}
- }
+ Z_PARAM_ZVAL_DEREF(ret_code)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+
if (!cmd_len) {
php_error_docref(NULL, E_WARNING, "Cannot execute a blank command");
RETURN_FALSE;
@@ -231,13 +235,16 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
ret = php_exec(mode, cmd, NULL, return_value);
} else {
if (Z_TYPE_P(ret_array) != IS_ARRAY) {
- zval_dtor(ret_array);
+ zval_ptr_dtor(ret_array);
array_init(ret_array);
+ } else if (Z_REFCOUNT_P(ret_array) > 1) {
+ zval_ptr_dtor(ret_array);
+ ZVAL_ARR(ret_array, zend_array_dup(Z_ARR_P(ret_array)));
}
ret = php_exec(2, cmd, ret_array, return_value);
}
if (ret_code) {
- zval_dtor(ret_code);
+ zval_ptr_dtor(ret_code);
ZVAL_LONG(ret_code, ret);
}
}
@@ -288,7 +295,7 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str)
/* max command line length - two single quotes - \0 byte length */
if (l > cmd_max_len - 2 - 1) {
- php_error_docref(NULL, E_ERROR, "Command exceeds the allowed length of %d bytes", cmd_max_len);
+ php_error_docref(NULL, E_ERROR, "Command exceeds the allowed length of %zu bytes", cmd_max_len);
return ZSTR_EMPTY_ALLOC();
}
@@ -364,7 +371,7 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str)
ZSTR_VAL(cmd)[y] = '\0';
if (y > cmd_max_len + 1) {
- php_error_docref(NULL, E_ERROR, "Escaped command exceeds the allowed length of %d bytes", cmd_max_len);
+ php_error_docref(NULL, E_ERROR, "Escaped command exceeds the allowed length of %zu bytes", cmd_max_len);
zend_string_release(cmd);
return ZSTR_EMPTY_ALLOC();
}
@@ -392,7 +399,7 @@ PHPAPI zend_string *php_escape_shell_arg(char *str)
/* max command line length - two single quotes - \0 byte length */
if (l > cmd_max_len - 2 - 1) {
- php_error_docref(NULL, E_ERROR, "Argument exceeds the allowed length of %d bytes", cmd_max_len);
+ php_error_docref(NULL, E_ERROR, "Argument exceeds the allowed length of %zu bytes", cmd_max_len);
return ZSTR_EMPTY_ALLOC();
}
@@ -451,7 +458,7 @@ PHPAPI zend_string *php_escape_shell_arg(char *str)
ZSTR_VAL(cmd)[y] = '\0';
if (y > cmd_max_len + 1) {
- php_error_docref(NULL, E_ERROR, "Escaped argument exceeds the allowed length of %d bytes", cmd_max_len);
+ php_error_docref(NULL, E_ERROR, "Escaped argument exceeds the allowed length of %zu bytes", cmd_max_len);
zend_string_release(cmd);
return ZSTR_EMPTY_ALLOC();
}
@@ -473,9 +480,9 @@ PHP_FUNCTION(escapeshellcmd)
char *command;
size_t command_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &command, &command_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(command, command_len)
+ ZEND_PARSE_PARAMETERS_END();
if (command_len) {
if (command_len != strlen(command)) {
@@ -496,9 +503,9 @@ PHP_FUNCTION(escapeshellarg)
char *argument;
size_t argument_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &argument, &argument_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(argument, argument_len)
+ ZEND_PARSE_PARAMETERS_END();
if (argument) {
if (argument_len != strlen(argument)) {
@@ -520,9 +527,9 @@ PHP_FUNCTION(shell_exec)
zend_string *ret;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &command, &command_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(command, command_len)
+ ZEND_PARSE_PARAMETERS_END();
#ifdef PHP_WIN32
if ((in=VCWD_POPEN(command, "rt"))==NULL) {
@@ -550,14 +557,18 @@ PHP_FUNCTION(proc_nice)
{
zend_long pri;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &pri) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_LONG(pri)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
errno = 0;
php_ignore_value(nice(pri));
if (errno) {
+#ifdef PHP_WIN32
+ php_error_docref(NULL, E_WARNING, php_win_err());
+#else
php_error_docref(NULL, E_WARNING, "Only a super user may attempt to increase the priority of a process");
+#endif
RETURN_FALSE;
}
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 99abee6676..ff3bef3f03 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -57,13 +57,9 @@
# if HAVE_SYS_SELECT_H
# include <sys/select.h>
# endif
-# if defined(NETWARE) && defined(USE_WINSOCK)
-# include <novsock2.h>
-# else
-# include <sys/socket.h>
-# include <netinet/in.h>
-# include <netdb.h>
-# endif
+# include <sys/socket.h>
+# include <netinet/in.h>
+# include <netdb.h>
# if HAVE_ARPA_INET_H
# include <arpa/inet.h>
# endif
@@ -341,9 +337,12 @@ PHP_FUNCTION(flock)
php_stream *stream;
zend_long operation = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|z/", &res, &operation, &wouldblock) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_RESOURCE(res)
+ Z_PARAM_LONG(operation)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF(wouldblock)
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -354,7 +353,7 @@ PHP_FUNCTION(flock)
}
if (wouldblock) {
- zval_dtor(wouldblock);
+ zval_ptr_dtor(wouldblock);
ZVAL_LONG(wouldblock, 0);
}
@@ -390,9 +389,11 @@ PHP_FUNCTION(get_meta_tags)
memset(&md, 0, sizeof(md));
/* Parse arguments */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &filename, &filename_len, &use_include_path) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(use_include_path)
+ ZEND_PARSE_PARAMETERS_END();
md.stream = php_stream_open_wrapper(filename, "rb",
(use_include_path ? USE_PATH : 0) | REPORT_ERRORS,
@@ -530,9 +531,14 @@ PHP_FUNCTION(file_get_contents)
zend_string *contents;
/* Parse arguments */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 5)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(use_include_path)
+ Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
+ Z_PARAM_LONG(offset)
+ Z_PARAM_LONG(maxlen)
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 5 && maxlen < 0) {
php_error_docref(NULL, E_WARNING, "length must be greater than or equal to zero");
@@ -583,9 +589,13 @@ PHP_FUNCTION(file_put_contents)
php_stream *srcstream = NULL;
char mode[3] = "wb";
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pz/|lr!", &filename, &filename_len, &data, &flags, &zcontext) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 4)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_ZVAL(data)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(flags)
+ Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
+ ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE_P(data) == IS_RESOURCE) {
php_stream_from_zval(srcstream, data);
@@ -724,9 +734,13 @@ PHP_FUNCTION(file)
zend_string *target_buf;
/* Parse arguments */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|lr!", &filename, &filename_len, &flags, &zcontext) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(flags)
+ Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
+ ZEND_PARSE_PARAMETERS_END();
+
if (flags < 0 || flags > (PHP_FILE_USE_INCLUDE_PATH | PHP_FILE_IGNORE_NEW_LINES | PHP_FILE_SKIP_EMPTY_LINES | PHP_FILE_NO_DEFAULT_CONTEXT)) {
php_error_docref(NULL, E_WARNING, "'" ZEND_LONG_FMT "' flag is not supported", flags);
RETURN_FALSE;
@@ -807,9 +821,10 @@ PHP_FUNCTION(tempnam)
int fd;
zend_string *p;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &dir, &dir_len, &prefix, &prefix_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_PATH(dir, dir_len)
+ Z_PARAM_PATH(prefix, prefix_len)
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir(dir)) {
RETURN_FALSE;
@@ -861,9 +876,13 @@ PHP_NAMED_FUNCTION(php_if_fopen)
php_stream *stream;
php_stream_context *context = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ps|br", &filename, &filename_len, &mode, &mode_len, &use_include_path, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 4)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_STRING(mode, mode_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(use_include_path)
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
context = php_stream_context_from_zval(zcontext, 0);
@@ -913,9 +932,10 @@ PHP_FUNCTION(popen)
php_stream *stream;
char *posix_mode;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ps", &command, &command_len, &mode, &mode_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_PATH(command, command_len)
+ Z_PARAM_STRING(mode, mode_len)
+ ZEND_PARSE_PARAMETERS_END();
posix_mode = estrndup(mode, mode_len);
#ifndef PHP_WIN32
@@ -954,9 +974,9 @@ PHP_FUNCTION(pclose)
zval *res;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(res)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1049,9 +1069,9 @@ PHPAPI PHP_FUNCTION(fgetc)
int result;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(res)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1081,9 +1101,12 @@ PHPAPI PHP_FUNCTION(fgetss)
char *allowed_tags=NULL;
size_t allowed_tags_len=0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ls", &fd, &bytes, &allowed_tags, &allowed_tags_len) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_RESOURCE(fd)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(bytes)
+ Z_PARAM_STRING(allowed_tags, allowed_tags_len)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
PHP_STREAM_TO_ZVAL(stream, fd);
@@ -1126,9 +1149,11 @@ PHP_FUNCTION(fscanf)
size_t len;
void *what;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs*", &file_handle, &format, &format_len, &args, &argc) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, -1)
+ Z_PARAM_RESOURCE(file_handle)
+ Z_PARAM_STRING(format, format_len)
+ Z_PARAM_VARIADIC('*', args, argc)
+ ZEND_PARSE_PARAMETERS_END();
what = zend_fetch_resource2(Z_RES_P(file_handle), "File-Handle", php_file_le_stream(), php_file_le_pstream());
@@ -1314,9 +1339,13 @@ PHP_FUNCTION(mkdir)
zend_bool recursive = 0;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|lbr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 4)
+ Z_PARAM_PATH(dir, dir_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(mode)
+ Z_PARAM_BOOL(recursive)
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
context = php_stream_context_from_zval(zcontext, 0);
@@ -1333,9 +1362,11 @@ PHP_FUNCTION(rmdir)
zval *zcontext = NULL;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|r", &dir, &dir_len, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_PATH(dir, dir_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
context = php_stream_context_from_zval(zcontext, 0);
@@ -1355,9 +1386,12 @@ PHP_FUNCTION(readfile)
php_stream *stream;
php_stream_context *context = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(use_include_path)
+ Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
context = php_stream_context_from_zval(zcontext, 0);
@@ -1385,9 +1419,10 @@ PHP_FUNCTION(umask)
BG(umask) = oldumask;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &mask) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(mask)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (ZEND_NUM_ARGS() == 0) {
umask(oldumask);
@@ -1407,9 +1442,9 @@ PHPAPI PHP_FUNCTION(fpassthru)
size_t size;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(res)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1428,9 +1463,12 @@ PHP_FUNCTION(rename)
php_stream_wrapper *wrapper;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp|r", &old_name, &old_name_len, &new_name, &new_name_len, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_PATH(old_name, old_name_len)
+ Z_PARAM_PATH(new_name, new_name_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
wrapper = php_stream_locate_url_wrapper(old_name, NULL, 0);
@@ -1465,9 +1503,11 @@ PHP_FUNCTION(unlink)
zval *zcontext = NULL;
php_stream_context *context = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|r", &filename, &filename_len, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
context = php_stream_context_from_zval(zcontext, 0);
@@ -1494,9 +1534,10 @@ PHP_NAMED_FUNCTION(php_if_ftruncate)
zend_long size;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &fp, &size) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(fp)
+ Z_PARAM_LONG(size)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (size < 0) {
php_error_docref(NULL, E_WARNING, "Negative size is not supported");
@@ -1528,9 +1569,9 @@ PHP_NAMED_FUNCTION(php_if_fstat)
"size", "atime", "mtime", "ctime", "blksize", "blocks"
};
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &fp) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(fp)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
PHP_STREAM_TO_ZVAL(stream, fp);
@@ -1618,9 +1659,12 @@ PHP_FUNCTION(copy)
zval *zcontext = NULL;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp|r", &source, &source_len, &target, &target_len, &zcontext) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_PATH(source, source_len)
+ Z_PARAM_PATH(target, target_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir(source)) {
RETURN_FALSE;
@@ -1831,12 +1875,14 @@ PHP_FUNCTION(fputcsv)
char *delimiter_str = NULL, *enclosure_str = NULL, *escape_str = NULL;
size_t delimiter_str_len = 0, enclosure_str_len = 0, escape_str_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ra|sss",
- &fp, &fields, &delimiter_str, &delimiter_str_len,
- &enclosure_str, &enclosure_str_len,
- &escape_str, &escape_str_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 5)
+ Z_PARAM_RESOURCE(fp)
+ Z_PARAM_ARRAY(fields)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(delimiter_str, delimiter_str_len)
+ Z_PARAM_STRING(enclosure_str, enclosure_str_len)
+ Z_PARAM_STRING(escape_str, escape_str_len)
+ ZEND_PARSE_PARAMETERS_END();
if (delimiter_str != NULL) {
/* Make sure that there is at least one character in string */
@@ -1963,13 +2009,14 @@ PHP_FUNCTION(fgetcsv)
char *escape_str = NULL;
size_t escape_str_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|zsss",
- &fd, &len_zv, &delimiter_str, &delimiter_str_len,
- &enclosure_str, &enclosure_str_len,
- &escape_str, &escape_str_len) == FAILURE
- ) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 5)
+ Z_PARAM_RESOURCE(fd)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL(len_zv)
+ Z_PARAM_STRING(delimiter_str, delimiter_str_len)
+ Z_PARAM_STRING(enclosure_str, enclosure_str_len)
+ Z_PARAM_STRING(escape_str, escape_str_len)
+ ZEND_PARSE_PARAMETERS_END();
if (delimiter_str != NULL) {
/* Make sure that there is at least one character in string */
@@ -2297,7 +2344,7 @@ out:
}
/* }}} */
-#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
+#if (!defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS)
/* {{{ proto string realpath(string path)
Return the resolved path */
PHP_FUNCTION(realpath)
@@ -2444,9 +2491,12 @@ PHP_FUNCTION(fnmatch)
size_t pattern_len, filename_len;
zend_long flags = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp|l", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_PATH(pattern, pattern_len)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(flags)
+ ZEND_PARSE_PARAMETERS_END();
if (filename_len >= MAXPATHLEN) {
php_error_docref(NULL, E_WARNING, "Filename exceeds the maximum allowed length of %d characters", MAXPATHLEN);
diff --git a/ext/standard/file.h b/ext/standard/file.h
index 77af9b8bbb..1252226d1c 100644
--- a/ext/standard/file.h
+++ b/ext/standard/file.h
@@ -62,7 +62,7 @@ PHP_FUNCTION(get_meta_tags);
PHP_FUNCTION(flock);
PHP_FUNCTION(fd_set);
PHP_FUNCTION(fd_isset);
-#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
+#if (!defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS)
PHP_FUNCTION(realpath);
#endif
#ifdef HAVE_FNMATCH
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index e40b94ba05..e730b5ae8d 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -186,9 +186,9 @@ PHP_FUNCTION(disk_total_space)
char *path;
size_t path_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &path, &path_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_PATH(path, path_len)
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir(path)) {
RETURN_FALSE;
@@ -261,12 +261,8 @@ static int php_disk_free_space(char *path, double *space) /* {{{ */
php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
return FAILURE;
}
-#ifdef NETWARE
- bytesfree = (((double)buf.f_bsize) * ((double)buf.f_bfree));
-#else
bytesfree = (((double)buf.f_bsize) * ((double)buf.f_bavail));
#endif
-#endif
*space = bytesfree;
return SUCCESS;
@@ -283,9 +279,9 @@ PHP_FUNCTION(disk_free_space)
char *path;
size_t path_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &path, &path_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_PATH(path, path_len)
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir(path)) {
RETURN_FALSE;
@@ -298,7 +294,7 @@ PHP_FUNCTION(disk_free_space)
}
/* }}} */
-#if !defined(WINDOWS) && !defined(NETWARE)
+#ifndef PHP_WIN32
PHPAPI int php_get_gid_by_name(const char *name, gid_t *gid)
{
#if defined(ZTS) && defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX)
@@ -341,9 +337,10 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
#endif
php_stream_wrapper *wrapper;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pz/", &filename, &filename_len, &group) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_ZVAL(group)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
wrapper = php_stream_locate_url_wrapper(filename, NULL, 0);
if(wrapper != &php_plain_files_wrapper || strncasecmp("file://", filename, 7) == 0) {
@@ -411,7 +408,6 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
}
/* }}} */
-#ifndef NETWARE
/* {{{ proto bool chgrp(string filename, mixed group)
Change file group */
PHP_FUNCTION(chgrp)
@@ -433,9 +429,8 @@ PHP_FUNCTION(lchgrp)
}
#endif
/* }}} */
-#endif /* !NETWARE */
-#if !defined(WINDOWS) && !defined(NETWARE)
+#ifndef PHP_WIN32
PHPAPI uid_t php_get_uid_by_name(const char *name, uid_t *uid)
{
#if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R)
@@ -478,9 +473,10 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */
#endif
php_stream_wrapper *wrapper;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pz/", &filename, &filename_len, &user) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_ZVAL(user)
+ ZEND_PARSE_PARAMETERS_END();
wrapper = php_stream_locate_url_wrapper(filename, NULL, 0);
if(wrapper != &php_plain_files_wrapper || strncasecmp("file://", filename, 7) == 0) {
@@ -550,7 +546,6 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */
/* }}} */
-#ifndef NETWARE
/* {{{ proto bool chown (string filename, mixed user)
Change file owner */
PHP_FUNCTION(chown)
@@ -573,7 +568,6 @@ PHP_FUNCTION(lchown)
}
#endif
/* }}} */
-#endif /* !NETWARE */
/* {{{ proto bool chmod(string filename, int mode)
Change file mode */
@@ -586,9 +580,10 @@ PHP_FUNCTION(chmod)
mode_t imode;
php_stream_wrapper *wrapper;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pl", &filename, &filename_len, &mode) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_LONG(mode)
+ ZEND_PARSE_PARAMETERS_END();
wrapper = php_stream_locate_url_wrapper(filename, NULL, 0);
if(wrapper != &php_plain_files_wrapper || strncasecmp("file://", filename, 7) == 0) {
@@ -634,9 +629,12 @@ PHP_FUNCTION(touch)
struct utimbuf *newtime = &newtimebuf;
php_stream_wrapper *wrapper;
- if (zend_parse_parameters(argc, "p|ll", &filename, &filename_len, &filetime, &fileatime) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(filetime)
+ Z_PARAM_LONG(fileatime)
+ ZEND_PARSE_PARAMETERS_END();
if (!filename_len) {
RETURN_FALSE;
@@ -713,7 +711,7 @@ PHP_FUNCTION(touch)
/* {{{ php_clear_stat_cache()
*/
-PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, int filename_len)
+PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, size_t filename_len)
{
/* always clear CurrentStatFile and CurrentLStatFile even if filename is not NULL
* as it may contain outdated data (e.g. "nlink" for a directory when deleting a file
@@ -744,11 +742,13 @@ PHP_FUNCTION(clearstatcache)
char *filename = NULL;
size_t filename_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|bp", &clear_realpath_cache, &filename, &filename_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 2)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(clear_realpath_cache)
+ Z_PARAM_PATH(filename, filename_len)
+ ZEND_PARSE_PARAMETERS_END();
- php_clear_stat_cache(clear_realpath_cache, filename, (int)filename_len);
+ php_clear_stat_cache(clear_realpath_cache, filename, filename_len);
}
/* }}} */
@@ -759,7 +759,7 @@ PHP_FUNCTION(clearstatcache)
/* {{{ php_stat
*/
-PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int type, zval *return_value)
+PHPAPI void php_stat(const char *filename, size_t filename_length, int type, zval *return_value)
{
zval stat_dev, stat_ino, stat_mode, stat_nlink, stat_uid, stat_gid, stat_rdev,
stat_size, stat_atime, stat_mtime, stat_ctime, stat_blksize, stat_blocks;
@@ -826,8 +826,6 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
stat_sb = &ssb.sb;
-
-#ifndef NETWARE
if (type >= FS_IS_W && type <= FS_IS_X) {
if(ssb.sb.st_uid==getuid()) {
rmask=S_IRUSR;
@@ -857,12 +855,9 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
}
}
}
-#endif
-#ifndef NETWARE
if (IS_ABLE_CHECK(type) && getuid() == 0) {
- /* root has special perms on plain_wrapper
- But we don't know about root under Netware */
+ /* root has special perms on plain_wrapper */
if (wrapper == &php_plain_files_wrapper) {
if (type == FS_IS_X) {
xmask = S_IXROOT;
@@ -871,7 +866,6 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
}
}
}
-#endif
switch (type) {
case FS_PERMS:
@@ -1002,7 +996,7 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
/* another quickie macro to make defining similar functions easier */
/* {{{ FileFunction(name, funcnum) */
#define FileFunction(name, funcnum) \
-void name(INTERNAL_FUNCTION_PARAMETERS) { \
+ZEND_NAMED_FUNCTION(name) { \
char *filename; \
size_t filename_len; \
\
@@ -1010,7 +1004,7 @@ void name(INTERNAL_FUNCTION_PARAMETERS) { \
Z_PARAM_PATH(filename, filename_len) \
ZEND_PARSE_PARAMETERS_END(); \
\
- php_stat(filename, (php_stat_len) filename_len, funcnum, return_value); \
+ php_stat(filename, filename_len, funcnum, return_value); \
}
/* }}} */
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index 90adc63536..a2f8125ded 100644
--- a/ext/standard/filters.c
+++ b/ext/standard/filters.c
@@ -67,7 +67,7 @@ static php_stream_filter_ops strfilter_rot13_ops = {
"string.rot13"
};
-static php_stream_filter *strfilter_rot13_create(const char *filtername, zval *filterparams, int persistent)
+static php_stream_filter *strfilter_rot13_create(const char *filtername, zval *filterparams, uint8_t persistent)
{
return php_stream_filter_alloc(&strfilter_rot13_ops, NULL, persistent);
}
@@ -149,12 +149,12 @@ static php_stream_filter_ops strfilter_tolower_ops = {
"string.tolower"
};
-static php_stream_filter *strfilter_toupper_create(const char *filtername, zval *filterparams, int persistent)
+static php_stream_filter *strfilter_toupper_create(const char *filtername, zval *filterparams, uint8_t persistent)
{
return php_stream_filter_alloc(&strfilter_toupper_ops, NULL, persistent);
}
-static php_stream_filter *strfilter_tolower_create(const char *filtername, zval *filterparams, int persistent)
+static php_stream_filter *strfilter_tolower_create(const char *filtername, zval *filterparams, uint8_t persistent)
{
return php_stream_filter_alloc(&strfilter_tolower_ops, NULL, persistent);
}
@@ -172,16 +172,14 @@ static php_stream_filter_factory strfilter_tolower_factory = {
typedef struct _php_strip_tags_filter {
const char *allowed_tags;
int allowed_tags_len;
- int state;
- int persistent;
+ uint8_t state;
+ uint8_t persistent;
} php_strip_tags_filter;
static int php_strip_tags_filter_ctor(php_strip_tags_filter *inst, const char *allowed_tags, size_t allowed_tags_len, int persistent)
{
if (allowed_tags != NULL) {
- if (NULL == (inst->allowed_tags = pemalloc(allowed_tags_len, persistent))) {
- return FAILURE;
- }
+ inst->allowed_tags = pemalloc(allowed_tags_len, persistent);
memcpy((char *)inst->allowed_tags, allowed_tags, allowed_tags_len);
inst->allowed_tags_len = (int)allowed_tags_len;
} else {
@@ -244,18 +242,13 @@ static php_stream_filter_ops strfilter_strip_tags_ops = {
"string.strip_tags"
};
-static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zval *filterparams, int persistent)
+static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zval *filterparams, uint8_t persistent)
{
php_strip_tags_filter *inst;
smart_str tags_ss = {0};
inst = pemalloc(sizeof(php_strip_tags_filter), persistent);
- if (inst == NULL) { /* it's possible pemalloc returns NULL
- instead of causing it to bail out */
- return NULL;
- }
-
if (filterparams != NULL) {
if (Z_TYPE_P(filterparams) == IS_ARRAY) {
zval *tmp;
@@ -1219,10 +1212,7 @@ static php_conv_err_t php_conv_get_string_prop_ex(const HashTable *ht, char **pr
if ((tmpval = zend_hash_str_find((HashTable *)ht, field_name, field_name_len-1)) != NULL) {
zend_string *str = zval_get_string(tmpval);
- if (NULL == (*pretval = pemalloc(ZSTR_LEN(str) + 1, persistent))) {
- return PHP_CONV_ERR_ALLOC;
- }
-
+ *pretval = pemalloc(ZSTR_LEN(str) + 1, persistent);
*pretval_len = ZSTR_LEN(str);
memcpy(*pretval, ZSTR_VAL(str), ZSTR_LEN(str) + 1);
zend_string_release(str);
@@ -1485,9 +1475,7 @@ static int strfilter_convert_append_bucket(
}
out_buf_size = ocnt = initial_out_buf_size;
- if (NULL == (out_buf = pemalloc(out_buf_size, persistent))) {
- return FAILURE;
- }
+ out_buf = pemalloc(out_buf_size, persistent);
pd = out_buf;
@@ -1540,20 +1528,10 @@ static int strfilter_convert_append_bucket(
php_stream_bucket_append(buckets_out, new_bucket);
out_buf_size = ocnt = initial_out_buf_size;
- if (NULL == (out_buf = pemalloc(out_buf_size, persistent))) {
- return FAILURE;
- }
+ out_buf = pemalloc(out_buf_size, persistent);
pd = out_buf;
} else {
- if (NULL == (new_out_buf = perealloc(out_buf, new_out_buf_size, persistent))) {
- if (NULL == (new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, persistent))) {
- goto out_failure;
- }
-
- php_stream_bucket_append(buckets_out, new_bucket);
- return FAILURE;
- }
-
+ new_out_buf = perealloc(out_buf, new_out_buf_size, persistent);
pd = new_out_buf + (pd - out_buf);
ocnt += (new_out_buf_size - out_buf_size);
out_buf = new_out_buf;
@@ -1612,19 +1590,10 @@ static int strfilter_convert_append_bucket(
php_stream_bucket_append(buckets_out, new_bucket);
out_buf_size = ocnt = initial_out_buf_size;
- if (NULL == (out_buf = pemalloc(out_buf_size, persistent))) {
- return FAILURE;
- }
+ out_buf = pemalloc(out_buf_size, persistent);
pd = out_buf;
} else {
- if (NULL == (new_out_buf = perealloc(out_buf, new_out_buf_size, persistent))) {
- if (NULL == (new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, persistent))) {
- goto out_failure;
- }
-
- php_stream_bucket_append(buckets_out, new_bucket);
- return FAILURE;
- }
+ new_out_buf = perealloc(out_buf, new_out_buf_size, persistent);
pd = new_out_buf + (pd - out_buf);
ocnt += (new_out_buf_size - out_buf_size);
out_buf = new_out_buf;
@@ -1724,7 +1693,7 @@ static php_stream_filter_ops strfilter_convert_ops = {
"convert.*"
};
-static php_stream_filter *strfilter_convert_create(const char *filtername, zval *filterparams, int persistent)
+static php_stream_filter *strfilter_convert_create(const char *filtername, zval *filterparams, uint8_t persistent)
{
php_convert_filter *inst;
php_stream_filter *retval = NULL;
@@ -1778,7 +1747,7 @@ static php_stream_filter_factory strfilter_convert_factory = {
typedef struct _php_consumed_filter_data {
size_t consumed;
zend_off_t offset;
- int persistent;
+ uint8_t persistent;
} php_consumed_filter_data;
static php_stream_filter_status_t consumed_filter_filter(
@@ -1827,7 +1796,7 @@ static php_stream_filter_ops consumed_filter_ops = {
"consumed"
};
-static php_stream_filter *consumed_filter_create(const char *filtername, zval *filterparams, int persistent)
+static php_stream_filter *consumed_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
{
php_stream_filter_ops *fops = NULL;
php_consumed_filter_data *data;
@@ -1838,10 +1807,6 @@ static php_stream_filter *consumed_filter_create(const char *filtername, zval *f
/* Create this filter */
data = pecalloc(1, sizeof(php_consumed_filter_data), persistent);
- if (!data) {
- php_error_docref(NULL, E_WARNING, "Failed allocating %zd bytes", sizeof(php_consumed_filter_data));
- return NULL;
- }
data->persistent = persistent;
data->consumed = 0;
data->offset = ~0;
@@ -2035,7 +2000,7 @@ static php_stream_filter_ops chunked_filter_ops = {
"dechunk"
};
-static php_stream_filter *chunked_filter_create(const char *filtername, zval *filterparams, int persistent)
+static php_stream_filter *chunked_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
{
php_stream_filter_ops *fops = NULL;
php_chunked_filter_data *data;
@@ -2046,10 +2011,6 @@ static php_stream_filter *chunked_filter_create(const char *filtername, zval *fi
/* Create this filter */
data = (php_chunked_filter_data *)pecalloc(1, sizeof(php_chunked_filter_data), persistent);
- if (!data) {
- php_error_docref(NULL, E_WARNING, "Failed allocating %zd bytes", sizeof(php_chunked_filter_data));
- return NULL;
- }
data->state = CHUNK_SIZE_START;
data->chunk_size = 0;
data->persistent = persistent;
diff --git a/ext/standard/flock_compat.c b/ext/standard/flock_compat.c
index a04f94b014..7c1264fe17 100644
--- a/ext/standard/flock_compat.c
+++ b/ext/standard/flock_compat.c
@@ -33,10 +33,6 @@
#include "config.w32.h"
#endif
-#ifdef NETWARE
-#include <netinet/in.h>
-#endif
-
#ifndef HAVE_FLOCK
PHPAPI int flock(int fd, int operation)
{
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
index 29c9670caf..3d4a7dce3b 100644
--- a/ext/standard/formatted_print.c
+++ b/ext/standard/formatted_print.c
@@ -727,9 +727,10 @@ PHP_FUNCTION(fprintf)
WRONG_PARAM_COUNT;
}
- if (zend_parse_parameters(1, "r", &arg1) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_RESOURCE(arg1)
+ /* php_formatted_print does its own zpp for extra args */
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, arg1);
@@ -756,9 +757,10 @@ PHP_FUNCTION(vfprintf)
WRONG_PARAM_COUNT;
}
- if (zend_parse_parameters(1, "r", &arg1) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_RESOURCE(arg1)
+ /* php_formatted_print does its own zpp for extra args */
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, arg1);
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c
index dc5a305fe2..5444994aba 100644
--- a/ext/standard/fsock.c
+++ b/ext/standard/fsock.c
@@ -51,9 +51,14 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lz/z/d", &host, &host_len, &port, &zerrno, &zerrstr, &timeout) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 5)
+ Z_PARAM_STRING(host, host_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(port)
+ Z_PARAM_ZVAL_DEREF(zerrno)
+ Z_PARAM_ZVAL_DEREF(zerrstr)
+ Z_PARAM_DOUBLE(timeout)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (persistent) {
spprintf(&hashkey, 0, "pfsockopen__%s:" ZEND_LONG_FMT, host, port);
@@ -77,11 +82,11 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
tv.tv_usec = conv % 1000000;
if (zerrno) {
- zval_dtor(zerrno);
+ zval_ptr_dtor(zerrno);
ZVAL_LONG(zerrno, 0);
}
if (zerrstr) {
- zval_dtor(zerrstr);
+ zval_ptr_dtor(zerrstr);
ZVAL_EMPTY_STRING(zerrstr);
}
@@ -101,12 +106,12 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (stream == NULL) {
if (zerrno) {
- zval_dtor(zerrno);
+ zval_ptr_dtor(zerrno);
ZVAL_LONG(zerrno, err);
}
if (zerrstr && errstr) {
/* no need to dup; we need to efree buf anyway */
- zval_dtor(zerrstr);
+ zval_ptr_dtor(zerrstr);
ZVAL_STR(zerrstr, errstr);
} else if (!zerrstr && errstr) {
zend_string_release(errstr);
diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c
index acabeb675b..6115ed12e2 100644
--- a/ext/standard/ftok.c
+++ b/ext/standard/ftok.c
@@ -39,9 +39,10 @@ PHP_FUNCTION(ftok)
size_t pathname_len, proj_len;
key_t k;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ps", &pathname, &pathname_len, &proj, &proj_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_PATH(pathname, pathname_len)
+ Z_PARAM_STRING(proj, proj_len)
+ ZEND_PARSE_PARAMETERS_END();
if (pathname_len == 0){
php_error_docref(NULL, E_WARNING, "Pathname is invalid");
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index e73787cf3d..618082ea8d 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -49,8 +49,6 @@
#ifdef PHP_WIN32
#include <winsock2.h>
-#elif defined(NETWARE) && defined(USE_WINSOCK)
-#include <novsock2.h>
#else
#include <netinet/in.h>
#include <netdb.h>
@@ -59,7 +57,7 @@
#endif
#endif
-#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
+#if defined(PHP_WIN32) || defined(__riscos__)
#undef AF_UNIX
#endif
diff --git a/ext/standard/head.c b/ext/standard/head.c
index d96f142368..e3a35c9c26 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -42,11 +42,14 @@ PHP_FUNCTION(header)
sapi_header_line ctr = {0};
size_t len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|bl", &ctr.line,
- &len, &rep, &ctr.response_code) == FAILURE)
- return;
-
- ctr.line_len = (uint)len;
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_STRING(ctr.line, len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(rep)
+ Z_PARAM_LONG(ctr.response_code)
+ ZEND_PARSE_PARAMETERS_END();
+
+ ctr.line_len = (uint32_t)len;
sapi_header_op(rep ? SAPI_HEADER_REPLACE:SAPI_HEADER_ADD, &ctr);
}
/* }}} */
@@ -58,11 +61,12 @@ PHP_FUNCTION(header_remove)
sapi_header_line ctr = {0};
size_t len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &ctr.line,
- &len) == FAILURE)
- return;
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(ctr.line, len)
+ ZEND_PARSE_PARAMETERS_END();
- ctr.line_len = (uint)len;
+ ctr.line_len = (uint32_t)len;
sapi_header_op(ZEND_NUM_ARGS() == 0 ? SAPI_HEADER_DELETE_ALL : SAPI_HEADER_DELETE, &ctr);
}
/* }}} */
@@ -180,7 +184,7 @@ PHPAPI int php_setcookie(zend_string *name, zend_string *value, time_t expires,
}
ctr.line = cookie;
- ctr.line_len = (uint)strlen(cookie);
+ ctr.line_len = (uint32_t)strlen(cookie);
result = sapi_header_op(SAPI_HEADER_ADD, &ctr);
efree(cookie);
@@ -197,10 +201,16 @@ PHP_FUNCTION(setcookie)
zend_long expires = 0;
zend_bool secure = 0, httponly = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|SlSSbb",
- &name, &value, &expires, &path, &domain, &secure, &httponly) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 7)
+ Z_PARAM_STR(name)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STR(value)
+ Z_PARAM_LONG(expires)
+ Z_PARAM_STR(path)
+ Z_PARAM_STR(domain)
+ Z_PARAM_BOOL(secure)
+ Z_PARAM_BOOL(httponly)
+ ZEND_PARSE_PARAMETERS_END();
if (php_setcookie(name, value, expires, path, domain, secure, 1, httponly) == SUCCESS) {
RETVAL_TRUE;
@@ -218,10 +228,16 @@ PHP_FUNCTION(setrawcookie)
zend_long expires = 0;
zend_bool secure = 0, httponly = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|SlSSbb",
- &name, &value, &expires, &path, &domain, &secure, &httponly) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 7)
+ Z_PARAM_STR(name)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STR(value)
+ Z_PARAM_LONG(expires)
+ Z_PARAM_STR(path)
+ Z_PARAM_STR(domain)
+ Z_PARAM_BOOL(secure)
+ Z_PARAM_BOOL(httponly)
+ ZEND_PARSE_PARAMETERS_END();
if (php_setcookie(name, value, expires, path, domain, secure, 0, httponly) == SUCCESS) {
RETVAL_TRUE;
@@ -240,8 +256,11 @@ PHP_FUNCTION(headers_sent)
const char *file="";
int line=0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z/z/", &arg1, &arg2) == FAILURE)
- return;
+ ZEND_PARSE_PARAMETERS_START(0, 2)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF(arg1)
+ Z_PARAM_ZVAL_DEREF(arg2)
+ ZEND_PARSE_PARAMETERS_END();
if (SG(headers_sent)) {
line = php_output_get_start_lineno();
@@ -250,10 +269,10 @@ PHP_FUNCTION(headers_sent)
switch(ZEND_NUM_ARGS()) {
case 2:
- zval_dtor(arg2);
+ zval_ptr_dtor(arg2);
ZVAL_LONG(arg2, line);
case 1:
- zval_dtor(arg1);
+ zval_ptr_dtor(arg1);
if (file) {
ZVAL_STRING(arg1, file);
} else {
@@ -300,9 +319,10 @@ PHP_FUNCTION(http_response_code)
{
zend_long response_code = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &response_code) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(response_code)
+ ZEND_PARSE_PARAMETERS_END();
if (response_code)
{
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 62b070bcb1..f911b34388 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -1095,13 +1095,16 @@ static entity_table_opt determine_entity_table(int all, int doctype)
* only the basic ones, i.e., those in basic_entities_ex + the numeric entities
* that correspond to quotes.
*/
-PHPAPI zend_string *php_unescape_html_entities(unsigned char *old, size_t oldlen, int all, int flags, char *hint_charset)
+PHPAPI zend_string *php_unescape_html_entities(zend_string *str, int all, int flags, char *hint_charset)
{
- size_t retlen;
zend_string *ret;
enum entity_charset charset;
- const entity_ht *inverse_map = NULL;
- size_t new_size = TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(oldlen);
+ const entity_ht *inverse_map;
+ size_t new_size;
+
+ if (!memchr(ZSTR_VAL(str), '&', ZSTR_LEN(str))) {
+ return zend_string_copy(str);
+ }
if (all) {
charset = determine_charset(hint_charset);
@@ -1111,26 +1114,19 @@ PHPAPI zend_string *php_unescape_html_entities(unsigned char *old, size_t oldlen
/* don't use LIMIT_ALL! */
- if (oldlen > new_size) {
+ new_size = TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(ZSTR_LEN(str));
+ if (ZSTR_LEN(str) > new_size) {
/* overflow, refuse to do anything */
- ret = zend_string_init((char*)old, oldlen, 0);
- retlen = oldlen;
- goto empty_source;
+ return zend_string_copy(str);
}
+
ret = zend_string_alloc(new_size, 0);
- ZSTR_VAL(ret)[0] = '\0';
- ZSTR_LEN(ret) = oldlen;
- retlen = oldlen;
- if (retlen == 0) {
- goto empty_source;
- }
inverse_map = unescape_inverse_map(all, flags);
/* replace numeric entities */
- traverse_for_entities((char*)old, oldlen, ret, all, flags, inverse_map, charset);
+ traverse_for_entities(ZSTR_VAL(str), ZSTR_LEN(str), ret, all, flags, inverse_map, charset);
-empty_source:
return ret;
}
/* }}} */
@@ -1495,16 +1491,17 @@ PHP_FUNCTION(htmlspecialchars)
Convert special HTML entities back to characters */
PHP_FUNCTION(htmlspecialchars_decode)
{
- char *str;
- size_t str_len;
+ zend_string *str;
zend_long quote_style = ENT_COMPAT;
zend_string *replaced;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &str, &str_len, &quote_style) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STR(str)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(quote_style)
+ ZEND_PARSE_PARAMETERS_END();
- replaced = php_unescape_html_entities((unsigned char*)str, str_len, 0 /*!all*/, (int)quote_style, NULL);
+ replaced = php_unescape_html_entities(str, 0 /*!all*/, (int)quote_style, NULL);
if (replaced) {
RETURN_STR(replaced);
}
@@ -1531,7 +1528,7 @@ PHP_FUNCTION(html_entity_decode)
if (!hint_charset) {
default_charset = get_default_charset();
}
- replaced = php_unescape_html_entities((unsigned char*)ZSTR_VAL(str), ZSTR_LEN(str), 1 /*all*/, (int)quote_style, (hint_charset ? ZSTR_VAL(hint_charset) : default_charset));
+ replaced = php_unescape_html_entities(str, 1 /*all*/, (int)quote_style, (hint_charset ? ZSTR_VAL(hint_charset) : default_charset));
if (replaced) {
RETURN_STR(replaced);
@@ -1622,10 +1619,12 @@ PHP_FUNCTION(get_html_translation_table)
* getting the translated table from data structures that are optimized for
* random access, not traversal */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lls",
- &all, &flags, &charset_hint, &charset_hint_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 3)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(all)
+ Z_PARAM_LONG(flags)
+ Z_PARAM_STRING(charset_hint, charset_hint_len)
+ ZEND_PARSE_PARAMETERS_END();
charset = determine_charset(charset_hint);
doctype = flags & ENT_HTML_DOC_TYPE_MASK;
diff --git a/ext/standard/html.h b/ext/standard/html.h
index 7e4620c119..4f92ef56e1 100644
--- a/ext/standard/html.h
+++ b/ext/standard/html.h
@@ -56,7 +56,7 @@ PHP_FUNCTION(get_html_translation_table);
PHPAPI zend_string *php_escape_html_entities(unsigned char *old, size_t oldlen, int all, int flags, char *hint_charset);
PHPAPI zend_string *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, int all, int flags, char *hint_charset, zend_bool double_encode);
-PHPAPI zend_string *php_unescape_html_entities(unsigned char *old, size_t oldlen, int all, int flags, char *hint_charset);
+PHPAPI zend_string *php_unescape_html_entities(zend_string *str, int all, int flags, char *hint_charset);
PHPAPI unsigned int php_next_utf8_char(const unsigned char *str, size_t str_len, size_t *cursor, int *status);
#endif /* HTML_H */
diff --git a/ext/standard/http.c b/ext/standard/http.c
index 5d8ccb9cae..711a3975d1 100644
--- a/ext/standard/http.c
+++ b/ext/standard/http.c
@@ -232,9 +232,13 @@ PHP_FUNCTION(http_build_query)
smart_str formstr = {0};
zend_long enc_type = PHP_QUERY_RFC1738;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|ssl", &formdata, &prefix, &prefix_len, &arg_sep, &arg_sep_len, &enc_type) != SUCCESS) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 4)
+ Z_PARAM_ZVAL(formdata)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(prefix, prefix_len)
+ Z_PARAM_STRING(arg_sep, arg_sep_len)
+ Z_PARAM_LONG(enc_type)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (Z_TYPE_P(formdata) != IS_ARRAY && Z_TYPE_P(formdata) != IS_OBJECT) {
php_error_docref(NULL, E_WARNING, "Parameter 1 expected to be Array or Object. Incorrect value given");
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index ff49128de9..75d21c0761 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -52,8 +52,6 @@
#ifdef PHP_WIN32
#include <winsock2.h>
-#elif defined(NETWARE) && defined(USE_WINSOCK)
-#include <novsock2.h>
#else
#include <netinet/in.h>
#include <netdb.h>
@@ -62,7 +60,7 @@
#endif
#endif
-#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
+#if defined(PHP_WIN32) || defined(__riscos__)
#undef AF_UNIX
#endif
@@ -109,9 +107,10 @@ static inline void strip_header(char *header_bag, char *lc_header_bag,
}
}
-php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
+static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
const char *path, const char *mode, int options, zend_string **opened_path,
- php_stream_context *context, int redirect_max, int flags STREAMS_DC) /* {{{ */
+ php_stream_context *context, int redirect_max, int flags,
+ zval *response_header STREAMS_DC) /* {{{ */
{
php_stream *stream = NULL;
php_url *resource = NULL;
@@ -121,7 +120,6 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
char *ua_str = NULL;
zval *ua_zval = NULL, *tmpzval = NULL, ssl_proxy_peer_name;
char location[HTTP_HEADER_BLOCK_SIZE];
- zval response_header;
int reqok = 0;
char *http_header_line = NULL;
char tmp_line[128];
@@ -139,11 +137,9 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
zend_bool follow_location = 1;
php_stream_filter *transfer_encoding = NULL;
int response_code;
- zend_array *symbol_table;
smart_str req_buf = {0};
zend_bool custom_request_method;
- ZVAL_UNDEF(&response_header);
tmp_line[0] = '\0';
if (redirect_max < 1) {
@@ -661,22 +657,8 @@ finish:
location[0] = '\0';
- symbol_table = zend_rebuild_symbol_table();
-
- if (header_init) {
- zval ztmp;
- array_init(&ztmp);
- zend_set_local_var_str("http_response_header", sizeof("http_response_header")-1, &ztmp, 0);
- }
-
- {
- zval *response_header_ptr = zend_hash_str_find_ind(symbol_table, "http_response_header", sizeof("http_response_header")-1);
- if (!response_header_ptr || Z_TYPE_P(response_header_ptr) != IS_ARRAY) {
- ZVAL_UNDEF(&response_header);
- goto out;
- } else {
- ZVAL_COPY(&response_header, response_header_ptr);
- }
+ if (Z_ISUNDEF_P(response_header)) {
+ array_init(response_header);
}
if (!php_stream_eof(stream)) {
@@ -743,7 +725,7 @@ finish:
}
}
ZVAL_STRINGL(&http_response, tmp_line, tmp_line_len);
- zend_hash_next_index_insert(Z_ARRVAL(response_header), &http_response);
+ zend_hash_next_index_insert(Z_ARRVAL_P(response_header), &http_response);
}
} else {
php_stream_wrapper_log_error(wrapper, options, "HTTP request failed, unexpected end of socket!");
@@ -846,7 +828,7 @@ finish:
{
zval http_header;
ZVAL_STRINGL(&http_header, http_header_line, http_header_line_length);
- zend_hash_next_index_insert(Z_ARRVAL(response_header), &http_header);
+ zend_hash_next_index_insert(Z_ARRVAL_P(response_header), &http_header);
}
} else {
break;
@@ -936,7 +918,9 @@ finish:
CHECK_FOR_CNTRL_CHARS(resource->pass)
CHECK_FOR_CNTRL_CHARS(resource->path)
}
- stream = php_stream_url_wrap_http_ex(wrapper, new_path, mode, options, opened_path, context, --redirect_max, HTTP_WRAPPER_REDIRECTED STREAMS_CC);
+ stream = php_stream_url_wrap_http_ex(
+ wrapper, new_path, mode, options, opened_path, context,
+ --redirect_max, HTTP_WRAPPER_REDIRECTED, response_header STREAMS_CC);
} else {
php_stream_wrapper_log_error(wrapper, options, "HTTP request failed! %s", tmp_line);
}
@@ -955,7 +939,7 @@ out:
if (stream) {
if (header_init) {
- ZVAL_COPY(&stream->wrapperdata, &response_header);
+ ZVAL_COPY(&stream->wrapperdata, response_header);
}
php_stream_notify_progress_init(context, 0, file_size);
@@ -982,15 +966,28 @@ out:
}
}
- zval_ptr_dtor(&response_header);
-
return stream;
}
/* }}} */
php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC) /* {{{ */
{
- return php_stream_url_wrap_http_ex(wrapper, path, mode, options, opened_path, context, PHP_URL_REDIRECT_MAX, HTTP_WRAPPER_HEADER_INIT STREAMS_CC);
+ php_stream *stream;
+ zval headers;
+ ZVAL_UNDEF(&headers);
+
+ stream = php_stream_url_wrap_http_ex(
+ wrapper, path, mode, options, opened_path, context,
+ PHP_URL_REDIRECT_MAX, HTTP_WRAPPER_HEADER_INIT, &headers STREAMS_CC);
+
+ if (!Z_ISUNDEF(headers)) {
+ if (FAILURE == zend_set_local_var_str(
+ "http_response_header", sizeof("http_response_header")-1, &headers, 1)) {
+ zval_ptr_dtor(&headers);
+ }
+ }
+
+ return stream;
}
/* }}} */
diff --git a/ext/standard/image.c b/ext/standard/image.c
index 722497f5e8..ddd3826979 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -1217,9 +1217,9 @@ PHP_FUNCTION(image_type_to_mime_type)
{
zend_long p_image_type;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &p_image_type) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_LONG(p_image_type)
+ ZEND_PARSE_PARAMETERS_END();
ZVAL_STRING(return_value, (char*)php_image_type_to_mime_type(p_image_type));
}
@@ -1232,9 +1232,11 @@ PHP_FUNCTION(image_type_to_extension)
zend_long image_type;
zend_bool inc_dot=1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|b", &image_type, &inc_dot) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_LONG(image_type)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(inc_dot)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
switch (image_type) {
case IMAGE_FILETYPE_GIF:
@@ -1470,12 +1472,14 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) {
size_t input_len;
const int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc, "s|z/", &input, &input_len, &info) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(input, input_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF(info)
+ ZEND_PARSE_PARAMETERS_END();
if (argc == 2) {
- zval_dtor(info);
+ zval_ptr_dtor(info);
array_init(info);
}
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
index 6875b0fa06..b41ab8572f 100644
--- a/ext/standard/incomplete_class.c
+++ b/ext/standard/incomplete_class.c
@@ -27,8 +27,8 @@
"access a property of an incomplete object. " \
"Please ensure that the class definition \"%s\" of the object " \
"you are trying to operate on was loaded _before_ " \
- "unserialize() gets called or provide a __autoload() function " \
- "to load the class definition "
+ "unserialize() gets called or provide an autoloader " \
+ "to load the class definition"
static zend_object_handlers php_incomplete_object_handlers;
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 3a79312f05..0299d85262 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -41,10 +41,7 @@
#include "php_string.h"
#ifdef PHP_WIN32
-typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
-typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
# include "winver.h"
-
#endif
#define SECTION(name) if (!sapi_module.phpinfo_as_text) { \
@@ -191,7 +188,7 @@ static int _display_module_info_def(zval *el) /* {{{ */
/* {{{ php_print_gpcse_array
*/
-static void php_print_gpcse_array(char *name, uint name_length)
+static void php_print_gpcse_array(char *name, uint32_t name_length)
{
zval *data, *tmp, tmp2;
zend_string *string_key;
@@ -295,19 +292,12 @@ char* php_get_windows_name()
{
OSVERSIONINFOEX osvi = EG(windows_version_info);
SYSTEM_INFO si;
- PGNSI pGNSI;
- PGPI pGPI;
DWORD dwType;
char *major = NULL, *sub = NULL, *retval;
ZeroMemory(&si, sizeof(SYSTEM_INFO));
- pGNSI = (PGNSI) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetNativeSystemInfo");
- if(NULL != pGNSI) {
- pGNSI(&si);
- } else {
- GetSystemInfo(&si);
- }
+ GetNativeSystemInfo(&si);
if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion >= 10) {
if (osvi.dwMajorVersion == 10) {
@@ -380,8 +370,8 @@ char* php_get_windows_name()
major = "Unknown Windows version";
}
- pGPI = (PGPI) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetProductInfo");
- pGPI(6, 0, 0, 0, &dwType);
+ /* No return value check, as it can only fail if the input parameters are broken (which we manually supply) */
+ GetProductInfo(6, 0, 0, 0, &dwType);
switch (dwType) {
case PRODUCT_ULTIMATE:
@@ -743,30 +733,6 @@ PHPAPI zend_string *php_get_uname(char mode)
if (uname((struct utsname *)&buf) == -1) {
php_uname = PHP_UNAME;
} else {
-#ifdef NETWARE
- if (mode == 's') {
- php_uname = buf.sysname;
- } else if (mode == 'r') {
- snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d.%d",
- buf.netware_major, buf.netware_minor, buf.netware_revision);
- php_uname = tmp_uname;
- } else if (mode == 'n') {
- php_uname = buf.servername;
- } else if (mode == 'v') {
- snprintf(tmp_uname, sizeof(tmp_uname), "libc-%d.%d.%d #%d",
- buf.libmajor, buf.libminor, buf.librevision, buf.libthreshold);
- php_uname = tmp_uname;
- } else if (mode == 'm') {
- php_uname = buf.machine;
- } else { /* assume mode == 'a' */
- snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d.%d libc-%d.%d.%d #%d %s",
- buf.sysname, buf.servername,
- buf.netware_major, buf.netware_minor, buf.netware_revision,
- buf.libmajor, buf.libminor, buf.librevision, buf.libthreshold,
- buf.machine);
- php_uname = tmp_uname;
- }
-#else
if (mode == 's') {
php_uname = buf.sysname;
} else if (mode == 'r') {
@@ -783,7 +749,6 @@ PHPAPI zend_string *php_get_uname(char mode)
buf.machine);
php_uname = tmp_uname;
}
-#endif /* NETWARE */
}
#else
php_uname = PHP_UNAME;
@@ -1302,9 +1267,10 @@ PHP_FUNCTION(phpinfo)
{
zend_long flag = PHP_INFO_ALL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flag) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(flag)
+ ZEND_PARSE_PARAMETERS_END();
/* Andale! Andale! Yee-Hah! */
php_output_start_default();
@@ -1323,9 +1289,10 @@ PHP_FUNCTION(phpversion)
char *ext_name = NULL;
size_t ext_name_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &ext_name, &ext_name_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(ext_name, ext_name_len)
+ ZEND_PARSE_PARAMETERS_END();
if (!ext_name) {
RETURN_STRING(PHP_VERSION);
@@ -1346,9 +1313,10 @@ PHP_FUNCTION(phpcredits)
{
zend_long flag = PHP_CREDITS_ALL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flag) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(flag)
+ ZEND_PARSE_PARAMETERS_END();
php_print_credits((int)flag);
RETURN_TRUE;
@@ -1379,9 +1347,11 @@ PHP_FUNCTION(php_uname)
char *mode = "a";
size_t modelen = sizeof("a")-1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &mode, &modelen) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(mode, modelen)
+ ZEND_PARSE_PARAMETERS_END();
+
RETURN_STR(php_get_uname(*mode));
}
diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c
index a6dad56bdc..61985e2427 100644
--- a/ext/standard/iptc.c
+++ b/ext/standard/iptc.c
@@ -197,9 +197,12 @@ PHP_FUNCTION(iptcembed)
zend_stat_t sb;
zend_bool written = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sp|l", &iptcdata, &iptcdata_len, &jpeg_file, &jpeg_file_len, &spool) != SUCCESS) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STRING(iptcdata, iptcdata_len)
+ Z_PARAM_PATH(jpeg_file, jpeg_file_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(spool)
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir(jpeg_file)) {
RETURN_FALSE;
@@ -321,9 +324,9 @@ PHP_FUNCTION(iptcparse)
size_t str_len;
zval values, *element;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &str_len) != SUCCESS) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(str, str_len)
+ ZEND_PARSE_PARAMETERS_END();
buffer = (unsigned char *)str;
diff --git a/ext/standard/link.c b/ext/standard/link.c
index c88c041443..4dbe987aa7 100644
--- a/ext/standard/link.c
+++ b/ext/standard/link.c
@@ -59,9 +59,9 @@ PHP_FUNCTION(readlink)
char buff[MAXPATHLEN];
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &link, &link_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_PATH(link, link_len)
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir(link)) {
RETURN_FALSE;
@@ -90,9 +90,9 @@ PHP_FUNCTION(linkinfo)
zend_stat_t sb;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &link, &link_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_PATH(link, link_len)
+ ZEND_PARSE_PARAMETERS_END();
dirname = estrndup(link, link_len);
php_dirname(dirname, link_len);
@@ -126,9 +126,10 @@ PHP_FUNCTION(symlink)
char dirname[MAXPATHLEN];
size_t len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &topath, &topath_len, &frompath, &frompath_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_PATH(topath, topath_len)
+ Z_PARAM_PATH(frompath, frompath_len)
+ ZEND_PARSE_PARAMETERS_END();
if (!expand_filepath(frompath, source_p)) {
php_error_docref(NULL, E_WARNING, "No such file or directory");
@@ -182,9 +183,10 @@ PHP_FUNCTION(link)
char source_p[MAXPATHLEN];
char dest_p[MAXPATHLEN];
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &topath, &topath_len, &frompath, &frompath_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_PATH(topath, topath_len)
+ Z_PARAM_PATH(frompath, frompath_len)
+ ZEND_PARSE_PARAMETERS_END();
if (!expand_filepath(frompath, source_p) || !expand_filepath(topath, dest_p)) {
php_error_docref(NULL, E_WARNING, "No such file or directory");
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index ed9af20c14..39eab7b530 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -27,6 +27,7 @@
#include "ext/standard/php_string.h"
#include "ext/standard/basic_functions.h"
#include "ext/date/php_date.h"
+#include "zend_smart_str.h"
#if HAVE_SYSEXITS_H
#include <sysexits.h>
@@ -51,11 +52,6 @@
#include "win32/sendmail.h"
#endif
-#ifdef NETWARE
-#define EX_OK 0 /* successful termination */
-#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
-#endif
-
#define SKIP_LONG_HEADER_SEP(str, pos) \
if (str[pos] == '\r' && str[pos + 1] == '\n' && (str[pos + 2] == ' ' || str[pos + 2] == '\t')) { \
pos += 2; \
@@ -82,9 +78,9 @@ PHP_FUNCTION(ezmlm_hash)
unsigned int h = 5381;
size_t j, str_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &str_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(str, str_len)
+ ZEND_PARSE_PARAMETERS_END();
for (j = 0; j < str_len; j++) {
h = (h + (h << 5)) ^ (zend_ulong) (unsigned char) tolower(str[j]);
@@ -96,30 +92,237 @@ PHP_FUNCTION(ezmlm_hash)
}
/* }}} */
+
+static zend_bool php_mail_build_headers_check_field_value(zval *val)
+{
+ size_t len = 0;
+ zend_string *value = Z_STR_P(val);
+
+ /* https://tools.ietf.org/html/rfc2822#section-2.2.1 */
+ /* https://tools.ietf.org/html/rfc2822#section-2.2.3 */
+ while (len < value->len) {
+ if (*(value->val+len) == '\r') {
+ if (value->len - len >= 3
+ && *(value->val+len+1) == '\n'
+ && (*(value->val+len+2) == ' ' || *(value->val+len+2) == '\t')) {
+ len += 3;
+ continue;
+ }
+ return FAILURE;
+ }
+ if (*(value->val+len) == '\0') {
+ return FAILURE;
+ }
+ len++;
+ }
+ return SUCCESS;
+}
+
+
+static zend_bool php_mail_build_headers_check_field_name(zend_string *key)
+{
+ size_t len = 0;
+
+ /* https://tools.ietf.org/html/rfc2822#section-2.2 */
+ while (len < key->len) {
+ if (*(key->val+len) < 33 || *(key->val+len) > 126 || *(key->val+len) == ':') {
+ return FAILURE;
+ }
+ len++;
+ }
+ return SUCCESS;
+}
+
+
+static void php_mail_build_headers_elems(smart_str *s, zend_string *key, zval *val);
+
+static void php_mail_build_headers_elem(smart_str *s, zend_string *key, zval *val)
+{
+ switch(Z_TYPE_P(val)) {
+ case IS_STRING:
+ if (php_mail_build_headers_check_field_name(key) != SUCCESS) {
+ php_error_docref(NULL, E_WARNING, "Header field name (%s) contains invalid chars", ZSTR_VAL(key));
+ return;
+ }
+ if (php_mail_build_headers_check_field_value(val) != SUCCESS) {
+ php_error_docref(NULL, E_WARNING, "Header field value (%s => %s) contains invalid chars or format", ZSTR_VAL(key), Z_STRVAL_P(val));
+ return;
+ }
+ smart_str_append(s, key);
+ smart_str_appendl(s, ": ", 2);
+ smart_str_appends(s, Z_STRVAL_P(val));
+ smart_str_appendl(s, "\r\n", 2);
+ break;
+ case IS_ARRAY:
+ php_mail_build_headers_elems(s, key, val);
+ break;
+ default:
+ php_error_docref(NULL, E_WARNING, "headers array elements must be string or array (%s)", ZSTR_VAL(key));
+ }
+}
+
+
+static void php_mail_build_headers_elems(smart_str *s, zend_string *key, zval *val)
+{
+ zend_ulong idx;
+ zend_string *tmp_key;
+ zval *tmp_val;
+
+ (void)(idx);
+ ZEND_HASH_FOREACH_KEY_VAL(HASH_OF(val), idx, tmp_key, tmp_val) {
+ if (tmp_key) {
+ php_error_docref(NULL, E_WARNING, "Multiple header key must be numeric index (%s)", ZSTR_VAL(tmp_key));
+ continue;
+ }
+ if (Z_TYPE_P(tmp_val) != IS_STRING) {
+ php_error_docref(NULL, E_WARNING, "Multiple header values must be string (%s)", ZSTR_VAL(key));
+ continue;
+ }
+ php_mail_build_headers_elem(s, key, tmp_val);
+ } ZEND_HASH_FOREACH_END();
+}
+
+
+PHPAPI zend_string *php_mail_build_headers(zval *headers)
+{
+ zend_ulong idx;
+ zend_string *key;
+ zval *val;
+ smart_str s = {0};
+
+ ZEND_ASSERT(Z_TYPE_P(headers) == IS_ARRAY);
+
+ ZEND_HASH_FOREACH_KEY_VAL(HASH_OF(headers), idx, key, val) {
+ if (!key) {
+ php_error_docref(NULL, E_WARNING, "Found numeric header (" ZEND_LONG_FMT ")", idx);
+ continue;
+ }
+ /* https://tools.ietf.org/html/rfc2822#section-3.6 */
+ switch(ZSTR_LEN(key)) {
+ case sizeof("orig-date")-1:
+ if (!strncasecmp("orig-date", ZSTR_VAL(key), ZSTR_LEN(key))) {
+ PHP_MAIL_BUILD_HEADER_CHECK("orig-date", s, key, val);
+ } else {
+ PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
+ }
+ break;
+ case sizeof("from")-1:
+ if (!strncasecmp("from", ZSTR_VAL(key), ZSTR_LEN(key))) {
+ PHP_MAIL_BUILD_HEADER_CHECK("from", s, key, val);
+ } else {
+ PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
+ }
+ break;
+ case sizeof("sender")-1:
+ if (!strncasecmp("sender", ZSTR_VAL(key), ZSTR_LEN(key))) {
+ PHP_MAIL_BUILD_HEADER_CHECK("sender", s, key, val);
+ } else {
+ PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
+ }
+ break;
+ case sizeof("reply-to")-1:
+ if (!strncasecmp("reply-to", ZSTR_VAL(key), ZSTR_LEN(key))) {
+ PHP_MAIL_BUILD_HEADER_CHECK("reply-to", s, key, val);
+ } else {
+ PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
+ }
+ break;
+ case sizeof("to")-1: /* "to", "cc" */
+ if (!strncasecmp("to", ZSTR_VAL(key), ZSTR_LEN(key))) {
+ php_error_docref(NULL, E_WARNING, "Extra header cannot contain 'To' header");
+ continue;
+ }
+ if (!strncasecmp("cc", ZSTR_VAL(key), ZSTR_LEN(key))) {
+ PHP_MAIL_BUILD_HEADER_CHECK("cc", s, key, val);
+ } else {
+ PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
+ }
+ break;
+ case sizeof("bcc")-1:
+ if (!strncasecmp("bcc", ZSTR_VAL(key), ZSTR_LEN(key))) {
+ PHP_MAIL_BUILD_HEADER_CHECK("bcc", s, key, val);
+ } else {
+ PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
+ }
+ break;
+ case sizeof("message-id")-1: /* "references" */
+ if (!strncasecmp("message-id", ZSTR_VAL(key), ZSTR_LEN(key))) {
+ PHP_MAIL_BUILD_HEADER_CHECK("message-id", s, key, val);
+ } else if (!strncasecmp("references", ZSTR_VAL(key), ZSTR_LEN(key))) {
+ PHP_MAIL_BUILD_HEADER_CHECK("references", s, key, val);
+ } else {
+ PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
+ }
+ break;
+ case sizeof("in-reply-to")-1:
+ if (!strncasecmp("in-reply-to", ZSTR_VAL(key), ZSTR_LEN(key))) {
+ PHP_MAIL_BUILD_HEADER_CHECK("in-reply-to", s, key, val);
+ } else {
+ PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
+ }
+ break;
+ case sizeof("subject")-1:
+ if (!strncasecmp("subject", ZSTR_VAL(key), ZSTR_LEN(key))) {
+ php_error_docref(NULL, E_WARNING, "Extra header cannot contain 'Subject' header");
+ continue;
+ }
+ PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
+ break;
+ default:
+ PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
+ }
+ } ZEND_HASH_FOREACH_END();
+
+ /* Remove the last \r\n */
+ if (s.s) s.s->len -= 2;
+ smart_str_0(&s);
+
+ return s.s;
+}
+
+
/* {{{ proto int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
Send an email message */
PHP_FUNCTION(mail)
{
char *to=NULL, *message=NULL;
char *subject=NULL;
- zend_string *extra_cmd=NULL, *headers=NULL, *headers_trimmed=NULL;
+ zend_string *extra_cmd=NULL, *str_headers=NULL, *tmp_headers;
+ zval *headers = NULL;
size_t to_len, message_len;
size_t subject_len, i;
char *force_extra_parameters = INI_STR("mail.force_extra_parameters");
char *to_r, *subject_r;
char *p, *e;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|SS", &to, &to_len, &subject, &subject_len, &message, &message_len, &headers, &extra_cmd) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(3, 5)
+ Z_PARAM_STRING(to, to_len)
+ Z_PARAM_STRING(subject, subject_len)
+ Z_PARAM_STRING(message, message_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF(headers)
+ Z_PARAM_STR(extra_cmd)
+ ZEND_PARSE_PARAMETERS_END();
/* ASCIIZ check */
MAIL_ASCIIZ_CHECK(to, to_len);
MAIL_ASCIIZ_CHECK(subject, subject_len);
MAIL_ASCIIZ_CHECK(message, message_len);
if (headers) {
- MAIL_ASCIIZ_CHECK(ZSTR_VAL(headers), ZSTR_LEN(headers));
- headers_trimmed = php_trim(headers, NULL, 0, 2);
+ switch(Z_TYPE_P(headers)) {
+ case IS_STRING:
+ tmp_headers = zend_string_init(Z_STRVAL_P(headers), Z_STRLEN_P(headers), 0);
+ MAIL_ASCIIZ_CHECK(ZSTR_VAL(tmp_headers), ZSTR_LEN(tmp_headers));
+ str_headers = php_trim(tmp_headers, NULL, 0, 2);
+ zend_string_release(tmp_headers);
+ break;
+ case IS_ARRAY:
+ str_headers = php_mail_build_headers(headers);
+ break;
+ default:
+ php_error_docref(NULL, E_WARNING, "headers parameter must be string or array");
+ RETURN_FALSE;
+ }
}
if (extra_cmd) {
MAIL_ASCIIZ_CHECK(ZSTR_VAL(extra_cmd), ZSTR_LEN(extra_cmd));
@@ -171,14 +374,14 @@ PHP_FUNCTION(mail)
extra_cmd = php_escape_shell_cmd(ZSTR_VAL(extra_cmd));
}
- if (php_mail(to_r, subject_r, message, headers_trimmed ? ZSTR_VAL(headers_trimmed) : NULL, extra_cmd ? ZSTR_VAL(extra_cmd) : NULL)) {
+ if (php_mail(to_r, subject_r, message, str_headers ? ZSTR_VAL(str_headers) : NULL, extra_cmd ? ZSTR_VAL(extra_cmd) : NULL)) {
RETVAL_TRUE;
} else {
RETVAL_FALSE;
}
- if (headers_trimmed) {
- zend_string_release(headers_trimmed);
+ if (str_headers) {
+ zend_string_release(str_headers);
}
if (extra_cmd) {
@@ -215,7 +418,7 @@ void php_mail_log_to_syslog(char *message) {
void php_mail_log_to_file(char *filename, char *message, size_t message_size) {
/* Write 'message' to the given file. */
- uint flags = IGNORE_URL_WIN | REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR;
+ uint32_t flags = IGNORE_URL_WIN | REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR;
php_stream *stream = php_stream_open_wrapper(filename, "a", flags, NULL);
if (stream) {
php_stream_write(stream, message, message_size);
@@ -265,7 +468,7 @@ static int php_mail_detect_multiple_crlf(char *hdr) {
*/
PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd)
{
-#if (defined PHP_WIN32 || defined NETWARE)
+#ifdef PHP_WIN32
int tsm_err;
char *tsm_errmsg = NULL;
#endif
@@ -337,7 +540,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char
}
if (!sendmail_path) {
-#if (defined PHP_WIN32 || defined NETWARE)
+#ifdef PHP_WIN32
/* handle old style win smtp sending */
if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, hdr, subject, to, message, NULL, NULL, NULL) == FAILURE) {
if (tsm_errmsg) {
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 66c5d80968..d6029cdc15 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -25,6 +25,7 @@
#include "php_math.h"
#include "zend_multiply.h"
#include "zend_exceptions.h"
+#include "zend_portability.h"
#include <math.h>
#include <float.h>
@@ -239,7 +240,7 @@ static double php_acosh(double x)
if (x >= 1) {
return log(x + sqrt(x * x - 1));
} else {
- return (DBL_MAX+DBL_MAX)-(DBL_MAX+DBL_MAX);
+ return ZEND_NAN;
}
# else
return(log(x + sqrt(x * x - 1)));
@@ -276,7 +277,7 @@ static double php_log1p(double x)
*/
static double php_expm1(double x)
{
-#if !defined(PHP_WIN32) && !defined(NETWARE)
+#ifndef PHP_WIN32
return(expm1(x));
#else
return(exp(x) - 1);
@@ -361,9 +362,12 @@ PHP_FUNCTION(round)
zend_long mode = PHP_ROUND_HALF_UP;
double return_val;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|ll", &value, &precision, &mode) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_ZVAL(value)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(precision)
+ Z_PARAM_LONG(mode)
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() >= 2) {
#if SIZEOF_ZEND_LONG > SIZEOF_INT
@@ -622,9 +626,10 @@ PHP_FUNCTION(pow)
{
zval *zbase, *zexp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/z/", &zbase, &zexp) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_ZVAL(zbase)
+ Z_PARAM_ZVAL(zexp)
+ ZEND_PARSE_PARAMETERS_END();
pow_function(return_value, zbase, zexp);
}
@@ -707,7 +712,7 @@ PHP_FUNCTION(log)
}
if (base == 1.0) {
- RETURN_DOUBLE(php_get_nan());
+ RETURN_DOUBLE(ZEND_NAN);
}
if (base <= 0.0) {
@@ -951,7 +956,7 @@ PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base)
char buf[(sizeof(double) << 3) + 1];
/* Don't try to convert +/- infinity */
- if (fvalue == HUGE_VAL || fvalue == -HUGE_VAL) {
+ if (fvalue == ZEND_INFINITY || fvalue == -ZEND_INFINITY) {
php_error_docref(NULL, E_WARNING, "Number too large");
return ZSTR_EMPTY_ALLOC();
}
@@ -977,9 +982,10 @@ PHP_FUNCTION(bindec)
{
zval *arg;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(arg)
+ ZEND_PARSE_PARAMETERS_END();
+
convert_to_string_ex(arg);
if (_php_math_basetozval(arg, 2, return_value) == FAILURE) {
RETURN_FALSE;
@@ -993,9 +999,10 @@ PHP_FUNCTION(hexdec)
{
zval *arg;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(arg)
+ ZEND_PARSE_PARAMETERS_END();
+
convert_to_string_ex(arg);
if (_php_math_basetozval(arg, 16, return_value) == FAILURE) {
RETURN_FALSE;
@@ -1009,9 +1016,10 @@ PHP_FUNCTION(octdec)
{
zval *arg;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(arg)
+ ZEND_PARSE_PARAMETERS_END();
+
convert_to_string_ex(arg);
if (_php_math_basetozval(arg, 8, return_value) == FAILURE) {
RETURN_FALSE;
@@ -1026,9 +1034,10 @@ PHP_FUNCTION(decbin)
zval *arg;
zend_string *result;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(arg)
+ ZEND_PARSE_PARAMETERS_END();
+
convert_to_long_ex(arg);
result = _php_math_longtobase(arg, 2);
RETURN_STR(result);
@@ -1042,9 +1051,10 @@ PHP_FUNCTION(decoct)
zval *arg;
zend_string *result;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(arg)
+ ZEND_PARSE_PARAMETERS_END();
+
convert_to_long_ex(arg);
result = _php_math_longtobase(arg, 8);
RETURN_STR(result);
@@ -1058,9 +1068,10 @@ PHP_FUNCTION(dechex)
zval *arg;
zend_string *result;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(arg)
+ ZEND_PARSE_PARAMETERS_END();
+
convert_to_long_ex(arg);
result = _php_math_longtobase(arg, 16);
RETURN_STR(result);
@@ -1075,9 +1086,11 @@ PHP_FUNCTION(base_convert)
zend_long frombase, tobase;
zend_string *result;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zll", &number, &frombase, &tobase) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(3, 3)
+ Z_PARAM_ZVAL(number)
+ Z_PARAM_LONG(frombase)
+ Z_PARAM_LONG(tobase)
+ ZEND_PARSE_PARAMETERS_END();
convert_to_string_ex(number);
if (frombase < 2 || frombase > 36) {
@@ -1130,6 +1143,11 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin
return tmpbuf;
}
+ /* Check if the number is no longer negative after rounding */
+ if (is_negative && d == 0) {
+ is_negative = 0;
+ }
+
/* find decimal point, if expected */
if (dec) {
dp = strpbrk(ZSTR_VAL(tmpbuf), ".,");
@@ -1283,9 +1301,10 @@ PHP_FUNCTION(intdiv)
{
zend_long dividend, divisor;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &dividend, &divisor) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_LONG(dividend)
+ Z_PARAM_LONG(divisor)
+ ZEND_PARSE_PARAMETERS_END();
if (divisor == 0) {
zend_throw_exception_ex(zend_ce_division_by_zero_error, 0, "Division by zero");
diff --git a/ext/standard/md5.c b/ext/standard/md5.c
index 2b2bf7aa9f..68503781a6 100644
--- a/ext/standard/md5.c
+++ b/ext/standard/md5.c
@@ -52,9 +52,11 @@ PHP_NAMED_FUNCTION(php_if_md5)
PHP_MD5_CTX context;
unsigned char digest[16];
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|b", &arg, &raw_output) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STR(arg)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(raw_output)
+ ZEND_PARSE_PARAMETERS_END();
md5str[0] = '\0';
PHP_MD5Init(&context);
@@ -84,9 +86,11 @@ PHP_NAMED_FUNCTION(php_if_md5_file)
size_t n;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_PATH(arg, arg_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(raw_output)
+ ZEND_PARSE_PARAMETERS_END();
stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS, NULL);
if (!stream) {
diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c
index 18d13ac185..def371b523 100644
--- a/ext/standard/metaphone.c
+++ b/ext/standard/metaphone.c
@@ -35,9 +35,11 @@ PHP_FUNCTION(metaphone)
zend_string *result = NULL;
zend_long phones = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|l", &str, &phones) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STR(str)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(phones)
+ ZEND_PARSE_PARAMETERS_END();
if (metaphone((unsigned char *)ZSTR_VAL(str), ZSTR_LEN(str), phones, &result, 1) == 0) {
RETVAL_STR(result);
diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c
index 37739153e5..c9563d89c1 100644
--- a/ext/standard/microtime.c
+++ b/ext/standard/microtime.c
@@ -26,9 +26,6 @@
#ifdef PHP_WIN32
#include "win32/time.h"
#include "win32/getrusage.h"
-#elif defined(NETWARE)
-#include <sys/timeval.h>
-#include <sys/time.h>
#else
#include <sys/time.h>
#endif
@@ -56,9 +53,10 @@ static void _php_gettimeofday(INTERNAL_FUNCTION_PARAMETERS, int mode)
zend_bool get_as_float = 0;
struct timeval tp = {0};
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &get_as_float) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(get_as_float)
+ ZEND_PARSE_PARAMETERS_END();
if (gettimeofday(&tp, NULL)) {
RETURN_FALSE;
@@ -115,9 +113,10 @@ PHP_FUNCTION(getrusage)
zend_long pwho = 0;
int who = RUSAGE_SELF;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &pwho) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(pwho)
+ ZEND_PARSE_PARAMETERS_END();
if (pwho == 1) {
who = RUSAGE_CHILDREN;
diff --git a/ext/standard/mt_rand.c b/ext/standard/mt_rand.c
index 46f23d1327..66065560f9 100644
--- a/ext/standard/mt_rand.c
+++ b/ext/standard/mt_rand.c
@@ -191,8 +191,11 @@ PHP_FUNCTION(mt_srand)
zend_long seed = 0;
zend_long mode = MT_RAND_MT19937;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &seed, &mode) == FAILURE)
- return;
+ ZEND_PARSE_PARAMETERS_START(0, 2)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(seed)
+ Z_PARAM_LONG(mode)
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 0)
seed = GENERATE_SEED();
@@ -209,50 +212,81 @@ PHP_FUNCTION(mt_srand)
}
/* }}} */
-/* {{{ php_mt_rand_range
- */
-PHPAPI zend_long php_mt_rand_range(zend_long min, zend_long max)
-{
- zend_ulong umax = max - min;
- zend_ulong limit;
- zend_ulong result;
+static uint32_t rand_range32(uint32_t umax) {
+ uint32_t result, limit;
result = php_mt_rand();
-#if ZEND_ULONG_MAX > UINT32_MAX
- if (umax > UINT32_MAX) {
- result = (result << 32) | php_mt_rand();
- }
-#endif
/* Special case where no modulus is required */
- if (UNEXPECTED(umax == ZEND_ULONG_MAX)) {
- return (zend_long)result;
+ if (UNEXPECTED(umax == UINT32_MAX)) {
+ return result;
}
/* Increment the max so the range is inclusive of max */
umax++;
/* Powers of two are not biased */
- if (EXPECTED((umax & (umax - 1)) != 0)) {
- /* Ceiling under which ZEND_LONG_MAX % max == 0 */
- limit = ZEND_ULONG_MAX - (ZEND_ULONG_MAX % umax) - 1;
+ if ((umax & (umax - 1)) == 0) {
+ return result & (umax - 1);
+ }
+
+ /* Ceiling under which UINT32_MAX % max == 0 */
+ limit = UINT32_MAX - (UINT32_MAX % umax) - 1;
+
+ /* Discard numbers over the limit to avoid modulo bias */
+ while (UNEXPECTED(result > limit)) {
+ result = php_mt_rand();
+ }
+
+ return result % umax;
+}
- /* Discard numbers over the limit to avoid modulo bias */
- while (UNEXPECTED(result > limit)) {
#if ZEND_ULONG_MAX > UINT32_MAX
- if (umax > UINT32_MAX) {
- result = (result << 32) | php_mt_rand();
- }
- else {
- result = php_mt_rand();
- }
-#else
- result = php_mt_rand();
+static uint64_t rand_range64(uint64_t umax) {
+ uint64_t result, limit;
+
+ result = php_mt_rand();
+ result = (result << 32) | php_mt_rand();
+
+ /* Special case where no modulus is required */
+ if (UNEXPECTED(umax == UINT64_MAX)) {
+ return result;
+ }
+
+ /* Increment the max so the range is inclusive of max */
+ umax++;
+
+ /* Powers of two are not biased */
+ if ((umax & (umax - 1)) == 0) {
+ return result & (umax - 1);
+ }
+
+ /* Ceiling under which UINT64_MAX % max == 0 */
+ limit = UINT64_MAX - (UINT64_MAX % umax) - 1;
+
+ /* Discard numbers over the limit to avoid modulo bias */
+ while (UNEXPECTED(result > limit)) {
+ result = php_mt_rand();
+ result = (result << 32) | php_mt_rand();
+ }
+
+ return result % umax;
+}
#endif
- }
+
+/* {{{ php_mt_rand_range
+ */
+PHPAPI zend_long php_mt_rand_range(zend_long min, zend_long max)
+{
+ zend_ulong umax = max - min;
+
+#if ZEND_ULONG_MAX > UINT32_MAX
+ if (umax > UINT32_MAX) {
+ return (zend_long) (rand_range64(umax) + min);
}
+#endif
- return (zend_long)((result % umax) + min);
+ return (zend_long) (rand_range32(umax) + min);
}
/* }}} */
@@ -288,9 +322,10 @@ PHP_FUNCTION(mt_rand)
RETURN_LONG(php_mt_rand() >> 1);
}
- if (zend_parse_parameters(argc, "ll", &min, &max) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_LONG(min)
+ Z_PARAM_LONG(max)
+ ZEND_PARSE_PARAMETERS_END();
if (UNEXPECTED(max < min)) {
php_error_docref(NULL, E_WARNING, "max(" ZEND_LONG_FMT ") is smaller than min(" ZEND_LONG_FMT ")", max, min);
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
index 93de49d3a1..ae10b8a6e7 100644
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.c
@@ -28,13 +28,6 @@
#ifdef PHP_WIN32
#define O_RDONLY _O_RDONLY
#include "win32/param.h"
-#elif defined(NETWARE)
-#ifdef USE_WINSOCK
-#include <novsock2.h>
-#else
-#include <sys/socket.h>
-#endif
-#include <sys/param.h>
#else
#include <sys/param.h>
#endif
@@ -247,9 +240,10 @@ PHP_FUNCTION(pack)
int outputpos = 0, outputsize = 0;
zend_string *output;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s*", &format, &formatlen, &argv, &num_args) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_STRING(format, formatlen)
+ Z_PARAM_VARIADIC('*', argv, num_args)
+ ZEND_PARSE_PARAMETERS_END();
/* We have a maximum of <formatlen> format codes to deal with */
formatcodes = safe_emalloc(formatlen, sizeof(*formatcodes), 0);
@@ -727,10 +721,12 @@ PHP_FUNCTION(unpack)
int i;
zend_long offset = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|l", &formatarg,
- &inputarg, &offset) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STR(formatarg)
+ Z_PARAM_STR(inputarg)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(offset)
+ ZEND_PARSE_PARAMETERS_END();
format = ZSTR_VAL(formatarg);
formatlen = ZSTR_LEN(formatarg);
@@ -977,7 +973,7 @@ PHP_FUNCTION(unpack)
zend_long len = (inputlen - inputpos) * 2; /* Remaining */
int nibbleshift = (type == 'h') ? 0 : 4;
int first = 1;
- char *buf;
+ zend_string *buf;
zend_long ipos, opos;
/* If size was given take minimum of len and size */
@@ -989,7 +985,7 @@ PHP_FUNCTION(unpack)
len -= argb % 2;
}
- buf = emalloc(len + 1);
+ buf = zend_string_alloc(len, 0);
for (ipos = opos = 0; opos < len; opos++) {
char cc = (input[inputpos + ipos] >> nibbleshift) & 0xf;
@@ -1000,7 +996,7 @@ PHP_FUNCTION(unpack)
cc += 'a' - 10;
}
- buf[opos] = cc;
+ ZSTR_VAL(buf)[opos] = cc;
nibbleshift = (nibbleshift + 4) & 7;
if (first-- == 0) {
@@ -1009,9 +1005,8 @@ PHP_FUNCTION(unpack)
}
}
- buf[len] = '\0';
- add_assoc_stringl(return_value, n, buf, len);
- efree(buf);
+ ZSTR_VAL(buf)[len] = '\0';
+ add_assoc_str(return_value, n, buf);
break;
}
diff --git a/ext/standard/password.c b/ext/standard/password.c
index ebf5e98f7f..e60464a4e9 100644
--- a/ext/standard/password.c
+++ b/ext/standard/password.c
@@ -13,6 +13,7 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Anthony Ferrara <ircmaxell@php.net> |
+ | Charles R. Portwood II <charlesportwoodii@erianna.com> |
+----------------------------------------------------------------------+
*/
@@ -30,6 +31,9 @@
#include "zend_interfaces.h"
#include "info.h"
#include "php_random.h"
+#if HAVE_ARGON2LIB
+#include "argon2.h"
+#endif
#ifdef PHP_WIN32
#include "win32/winutil.h"
@@ -39,29 +43,48 @@ PHP_MINIT_FUNCTION(password) /* {{{ */
{
REGISTER_LONG_CONSTANT("PASSWORD_DEFAULT", PHP_PASSWORD_DEFAULT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PASSWORD_BCRYPT", PHP_PASSWORD_BCRYPT, CONST_CS | CONST_PERSISTENT);
+#if HAVE_ARGON2LIB
+ REGISTER_LONG_CONSTANT("PASSWORD_ARGON2I", PHP_PASSWORD_ARGON2I, CONST_CS | CONST_PERSISTENT);
+#endif
REGISTER_LONG_CONSTANT("PASSWORD_BCRYPT_DEFAULT_COST", PHP_PASSWORD_BCRYPT_COST, CONST_CS | CONST_PERSISTENT);
+#if HAVE_ARGON2LIB
+ REGISTER_LONG_CONSTANT("PASSWORD_ARGON2_DEFAULT_MEMORY_COST", PHP_PASSWORD_ARGON2_MEMORY_COST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PASSWORD_ARGON2_DEFAULT_TIME_COST", PHP_PASSWORD_ARGON2_TIME_COST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PASSWORD_ARGON2_DEFAULT_THREADS", PHP_PASSWORD_ARGON2_THREADS, CONST_CS | CONST_PERSISTENT);
+#endif
return SUCCESS;
}
/* }}} */
-static char* php_password_get_algo_name(const php_password_algo algo)
+static zend_string* php_password_get_algo_name(const php_password_algo algo)
{
switch (algo) {
case PHP_PASSWORD_BCRYPT:
- return "bcrypt";
+ return zend_string_init("bcrypt", sizeof("bcrypt") - 1, 0);
+#if HAVE_ARGON2LIB
+ case PHP_PASSWORD_ARGON2I:
+ return zend_string_init("argon2i", sizeof("argon2i") - 1, 0);
+#endif
case PHP_PASSWORD_UNKNOWN:
default:
- return "unknown";
+ return zend_string_init("unknown", sizeof("unknown") - 1, 0);
}
}
-static php_password_algo php_password_determine_algo(const char *hash, const size_t len)
+static php_password_algo php_password_determine_algo(const zend_string *hash)
{
- if (len > 3 && hash[0] == '$' && hash[1] == '2' && hash[2] == 'y' && len == 60) {
+ const char *h = ZSTR_VAL(hash);
+ const size_t len = ZSTR_LEN(hash);
+ if (len == 60 && h[0] == '$' && h[1] == '2' && h[2] == 'y') {
return PHP_PASSWORD_BCRYPT;
}
+#if HAVE_ARGON2LIB
+ if (len >= sizeof("$argon2i$")-1 && !memcmp(h, "$argon2i$", sizeof("$argon2i$")-1)) {
+ return PHP_PASSWORD_ARGON2I;
+ }
+#endif
return PHP_PASSWORD_UNKNOWN;
}
@@ -107,66 +130,75 @@ static int php_password_salt_to64(const char *str, const size_t str_len, const s
}
/* }}} */
-static int php_password_make_salt(size_t length, char *ret) /* {{{ */
+static zend_string* php_password_make_salt(size_t length) /* {{{ */
{
- size_t raw_length;
- char *buffer;
- char *result;
+ zend_string *ret, *buffer;
if (length > (INT_MAX / 3)) {
php_error_docref(NULL, E_WARNING, "Length is too large to safely generate");
- return FAILURE;
+ return NULL;
}
- raw_length = length * 3 / 4 + 1;
-
- buffer = (char *) safe_emalloc(raw_length, 1, 1);
-
- if (FAILURE == php_random_bytes_silent(buffer, raw_length)) {
+ buffer = zend_string_alloc(length * 3 / 4 + 1, 0);
+ if (FAILURE == php_random_bytes_silent(ZSTR_VAL(buffer), ZSTR_LEN(buffer))) {
php_error_docref(NULL, E_WARNING, "Unable to generate salt");
- efree(buffer);
- return FAILURE;
+ zend_string_release(buffer);
+ return NULL;
}
- result = safe_emalloc(length, 1, 1);
- if (php_password_salt_to64(buffer, raw_length, length, result) == FAILURE) {
+ ret = zend_string_alloc(length, 0);
+ if (php_password_salt_to64(ZSTR_VAL(buffer), ZSTR_LEN(buffer), length, ZSTR_VAL(ret)) == FAILURE) {
php_error_docref(NULL, E_WARNING, "Generated salt too short");
- efree(buffer);
- efree(result);
- return FAILURE;
+ zend_string_release(buffer);
+ zend_string_release(ret);
+ return NULL;
}
- memcpy(ret, result, length);
- efree(result);
- efree(buffer);
- ret[length] = 0;
- return SUCCESS;
+ zend_string_release(buffer);
+ ZSTR_VAL(ret)[length] = 0;
+ return ret;
}
/* }}} */
+/* {{{ proto array password_get_info(string $hash)
+Retrieves information about a given hash */
PHP_FUNCTION(password_get_info)
{
php_password_algo algo;
- size_t hash_len;
- char *hash, *algo_name;
+ zend_string *hash, *algo_name;
zval options;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &hash, &hash_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(hash)
+ ZEND_PARSE_PARAMETERS_END();
array_init(&options);
- algo = php_password_determine_algo(hash, (size_t) hash_len);
+ algo = php_password_determine_algo(hash);
algo_name = php_password_get_algo_name(algo);
switch (algo) {
case PHP_PASSWORD_BCRYPT:
{
zend_long cost = PHP_PASSWORD_BCRYPT_COST;
- sscanf(hash, "$2y$" ZEND_LONG_FMT "$", &cost);
+ sscanf(ZSTR_VAL(hash), "$2y$" ZEND_LONG_FMT "$", &cost);
add_assoc_long(&options, "cost", cost);
}
break;
+#if HAVE_ARGON2LIB
+ case PHP_PASSWORD_ARGON2I:
+ {
+ zend_long v = 0;
+ zend_long memory_cost = PHP_PASSWORD_ARGON2_MEMORY_COST;
+ zend_long time_cost = PHP_PASSWORD_ARGON2_TIME_COST;
+ zend_long threads = PHP_PASSWORD_ARGON2_THREADS;
+
+ sscanf(ZSTR_VAL(hash), "$%*[argon2i]$v=" ZEND_LONG_FMT "$m=" ZEND_LONG_FMT ",t=" ZEND_LONG_FMT ",p=" ZEND_LONG_FMT, &v, &memory_cost, &time_cost, &threads);
+ add_assoc_long(&options, "memory_cost", memory_cost);
+ add_assoc_long(&options, "time_cost", time_cost);
+ add_assoc_long(&options, "threads", threads);
+ }
+ break;
+#endif
case PHP_PASSWORD_UNKNOWN:
default:
break;
@@ -175,24 +207,29 @@ PHP_FUNCTION(password_get_info)
array_init(return_value);
add_assoc_long(return_value, "algo", algo);
- add_assoc_string(return_value, "algoName", algo_name);
+ add_assoc_str(return_value, "algoName", algo_name);
add_assoc_zval(return_value, "options", &options);
}
+/** }}} */
+/* {{{ proto boolean password_needs_rehash(string $hash, integer $algo[, array $options])
+Determines if a given hash requires re-hashing based upon parameters */
PHP_FUNCTION(password_needs_rehash)
{
zend_long new_algo = 0;
php_password_algo algo;
- size_t hash_len;
- char *hash;
+ zend_string *hash;
HashTable *options = 0;
zval *option_buffer;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|H", &hash, &hash_len, &new_algo, &options) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STR(hash)
+ Z_PARAM_LONG(new_algo)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ARRAY_OR_OBJECT_HT(options)
+ ZEND_PARSE_PARAMETERS_END();
- algo = php_password_determine_algo(hash, (size_t) hash_len);
+ algo = php_password_determine_algo(hash);
if ((zend_long)algo != new_algo) {
RETURN_TRUE;
@@ -207,179 +244,324 @@ PHP_FUNCTION(password_needs_rehash)
new_cost = zval_get_long(option_buffer);
}
- sscanf(hash, "$2y$" ZEND_LONG_FMT "$", &cost);
+ sscanf(ZSTR_VAL(hash), "$2y$" ZEND_LONG_FMT "$", &cost);
if (cost != new_cost) {
RETURN_TRUE;
}
}
break;
+#if HAVE_ARGON2LIB
+ case PHP_PASSWORD_ARGON2I:
+ {
+ zend_long v = 0;
+ zend_long new_memory_cost = PHP_PASSWORD_ARGON2_MEMORY_COST, memory_cost = 0;
+ zend_long new_time_cost = PHP_PASSWORD_ARGON2_TIME_COST, time_cost = 0;
+ zend_long new_threads = PHP_PASSWORD_ARGON2_THREADS, threads = 0;
+
+ if (options && (option_buffer = zend_hash_str_find(options, "memory_cost", sizeof("memory_cost")-1)) != NULL) {
+ new_memory_cost = zval_get_long(option_buffer);
+ }
+
+ if (options && (option_buffer = zend_hash_str_find(options, "time_cost", sizeof("time_cost")-1)) != NULL) {
+ new_time_cost = zval_get_long(option_buffer);
+ }
+
+ if (options && (option_buffer = zend_hash_str_find(options, "threads", sizeof("threads")-1)) != NULL) {
+ new_threads = zval_get_long(option_buffer);
+ }
+
+ sscanf(ZSTR_VAL(hash), "$%*[argon2i]$v=" ZEND_LONG_FMT "$m=" ZEND_LONG_FMT ",t=" ZEND_LONG_FMT ",p=" ZEND_LONG_FMT, &v, &memory_cost, &time_cost, &threads);
+
+ if (new_time_cost != time_cost || new_memory_cost != memory_cost || new_threads != threads) {
+ RETURN_TRUE;
+ }
+ }
+ break;
+#endif
case PHP_PASSWORD_UNKNOWN:
default:
break;
}
RETURN_FALSE;
}
+/* }}} */
-/* {{{ proto boolean password_make_salt(string password, string hash)
+/* {{{ proto boolean password_verify(string password, string hash)
Verify a hash created using crypt() or password_hash() */
PHP_FUNCTION(password_verify)
{
- int status = 0;
- size_t i, password_len, hash_len;
- char *password, *hash;
- zend_string *ret;
+ zend_string *password, *hash;
+ php_password_algo algo;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &password, &password_len, &hash, &hash_len) == FAILURE) {
- RETURN_FALSE;
- }
- if ((ret = php_crypt(password, (int)password_len, hash, (int)hash_len, 1)) == NULL) {
- RETURN_FALSE;
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_STR(password)
+ Z_PARAM_STR(hash)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+
+ algo = php_password_determine_algo(hash);
+
+ switch(algo) {
+#if HAVE_ARGON2LIB
+ case PHP_PASSWORD_ARGON2I:
+ RETURN_BOOL(ARGON2_OK == argon2_verify(ZSTR_VAL(hash), ZSTR_VAL(password), ZSTR_LEN(password), Argon2_i));
+ break;
+#endif
+ case PHP_PASSWORD_BCRYPT:
+ case PHP_PASSWORD_UNKNOWN:
+ default:
+ {
+ size_t i;
+ int status = 0;
+ zend_string *ret = php_crypt(ZSTR_VAL(password), (int)ZSTR_LEN(password), ZSTR_VAL(hash), (int)ZSTR_LEN(hash), 1);
+
+ if (!ret) {
+ RETURN_FALSE;
+ }
+
+ if (ZSTR_LEN(ret) != ZSTR_LEN(hash) || ZSTR_LEN(hash) < 13) {
+ zend_string_free(ret);
+ RETURN_FALSE;
+ }
+
+ /* We're using this method instead of == in order to provide
+ * resistance towards timing attacks. This is a constant time
+ * equality check that will always check every byte of both
+ * values. */
+ for (i = 0; i < ZSTR_LEN(hash); i++) {
+ status |= (ZSTR_VAL(ret)[i] ^ ZSTR_VAL(hash)[i]);
+ }
+
+ zend_string_free(ret);
+
+ RETURN_BOOL(status == 0);
+ }
}
- if (ZSTR_LEN(ret) != hash_len || hash_len < 13) {
- zend_string_free(ret);
- RETURN_FALSE;
+ RETURN_FALSE;
+}
+/* }}} */
+
+static zend_string* php_password_get_salt(zval *return_value, size_t required_salt_len, HashTable *options) {
+ zend_string *buffer;
+ zval *option_buffer;
+
+ if (!options || !(option_buffer = zend_hash_str_find(options, "salt", sizeof("salt") - 1))) {
+ buffer = php_password_make_salt(required_salt_len);
+ if (!buffer) {
+ RETVAL_FALSE;
+ }
+ return buffer;
}
- /* We're using this method instead of == in order to provide
- * resistance towards timing attacks. This is a constant time
- * equality check that will always check every byte of both
- * values. */
- for (i = 0; i < hash_len; i++) {
- status |= (ZSTR_VAL(ret)[i] ^ hash[i]);
+ php_error_docref(NULL, E_DEPRECATED, "Use of the 'salt' option to password_hash is deprecated");
+
+ switch (Z_TYPE_P(option_buffer)) {
+ case IS_STRING:
+ buffer = zend_string_copy(Z_STR_P(option_buffer));
+ break;
+ case IS_LONG:
+ case IS_DOUBLE:
+ case IS_OBJECT:
+ buffer = zval_get_string(option_buffer);
+ break;
+ case IS_FALSE:
+ case IS_TRUE:
+ case IS_NULL:
+ case IS_RESOURCE:
+ case IS_ARRAY:
+ default:
+ php_error_docref(NULL, E_WARNING, "Non-string salt parameter supplied");
+ return NULL;
}
- zend_string_free(ret);
+ /* XXX all the crypt related APIs work with int for string length.
+ That should be revised for size_t and then we maybe don't require
+ the > INT_MAX check. */
+ if (ZEND_SIZE_T_INT_OVFL(ZSTR_LEN(buffer))) {
+ php_error_docref(NULL, E_WARNING, "Supplied salt is too long");
+ zend_string_release(buffer);
+ return NULL;
+ }
- RETURN_BOOL(status == 0);
+ if (ZSTR_LEN(buffer) < required_salt_len) {
+ php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd expecting %zd", ZSTR_LEN(buffer), required_salt_len);
+ zend_string_release(buffer);
+ return NULL;
+ }
+ if (php_password_salt_is_alphabet(ZSTR_VAL(buffer), ZSTR_LEN(buffer)) == FAILURE) {
+ zend_string *salt = zend_string_alloc(required_salt_len, 0);
+ if (php_password_salt_to64(ZSTR_VAL(buffer), ZSTR_LEN(buffer), required_salt_len, ZSTR_VAL(salt)) == FAILURE) {
+ php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd", ZSTR_LEN(buffer));
+ zend_string_release(salt);
+ zend_string_release(buffer);
+ return NULL;
+ }
+ zend_string_release(buffer);
+ return salt;
+ } else {
+ zend_string *salt = zend_string_alloc(required_salt_len, 0);
+ memcpy(ZSTR_VAL(salt), ZSTR_VAL(buffer), required_salt_len);
+ zend_string_release(buffer);
+ return salt;
+ }
}
-/* }}} */
-/* {{{ proto string password_hash(string password, int algo, array options = array())
+/* {{{ proto string password_hash(string password, int algo[, array options = array()])
Hash a password */
PHP_FUNCTION(password_hash)
{
- char hash_format[8], *hash, *salt, *password;
- zend_long algo = 0;
- size_t password_len = 0;
- int hash_len;
- size_t salt_len = 0, required_salt_len = 0, hash_format_len;
- HashTable *options = 0;
- zval *option_buffer;
- zend_string *result;
+ zend_string *password;
+ zend_long algo = PHP_PASSWORD_DEFAULT;
+ HashTable *options = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|H", &password, &password_len, &algo, &options) == FAILURE) {
- return;
- }
+#if HAVE_ARGON2LIB
+#endif
+
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STR(password)
+ Z_PARAM_LONG(algo)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ARRAY_OR_OBJECT_HT(options)
+ ZEND_PARSE_PARAMETERS_END();
switch (algo) {
case PHP_PASSWORD_BCRYPT:
- {
- zend_long cost = PHP_PASSWORD_BCRYPT_COST;
+ {
+ char hash_format[10];
+ size_t hash_format_len;
+ zend_string *result, *hash, *salt;
+ zval *option_buffer;
+ zend_long cost = PHP_PASSWORD_BCRYPT_COST;
- if (options && (option_buffer = zend_hash_str_find(options, "cost", sizeof("cost")-1)) != NULL) {
- cost = zval_get_long(option_buffer);
- }
+ if (options && (option_buffer = zend_hash_str_find(options, "cost", sizeof("cost")-1)) != NULL) {
+ cost = zval_get_long(option_buffer);
+ }
- if (cost < 4 || cost > 31) {
- php_error_docref(NULL, E_WARNING, "Invalid bcrypt cost parameter specified: " ZEND_LONG_FMT, cost);
- RETURN_NULL();
- }
+ if (cost < 4 || cost > 31) {
+ php_error_docref(NULL, E_WARNING, "Invalid bcrypt cost parameter specified: " ZEND_LONG_FMT, cost);
+ RETURN_NULL();
+ }
- required_salt_len = 22;
- sprintf(hash_format, "$2y$%02ld$", (long) cost);
- hash_format_len = 7;
- }
- break;
- case PHP_PASSWORD_UNKNOWN:
- default:
- php_error_docref(NULL, E_WARNING, "Unknown password hashing algorithm: " ZEND_LONG_FMT, algo);
- RETURN_NULL();
- }
+ hash_format_len = snprintf(hash_format, sizeof(hash_format), "$2y$%02" ZEND_LONG_FMT_SPEC "$", cost);
+ if (!(salt = php_password_get_salt(return_value, Z_UL(22), options))) {
+ return;
+ }
+ ZSTR_VAL(salt)[ZSTR_LEN(salt)] = 0;
- if (options && (option_buffer = zend_hash_str_find(options, "salt", sizeof("salt")-1)) != NULL) {
- zend_string *buffer;
-
- php_error_docref(NULL, E_DEPRECATED, "Use of the 'salt' option to password_hash is deprecated");
-
- switch (Z_TYPE_P(option_buffer)) {
- case IS_STRING:
- buffer = zend_string_copy(Z_STR_P(option_buffer));
- break;
- case IS_LONG:
- case IS_DOUBLE:
- case IS_OBJECT:
- buffer = zval_get_string(option_buffer);
- break;
- case IS_FALSE:
- case IS_TRUE:
- case IS_NULL:
- case IS_RESOURCE:
- case IS_ARRAY:
- default:
- php_error_docref(NULL, E_WARNING, "Non-string salt parameter supplied");
- RETURN_NULL();
- }
+ hash = zend_string_alloc(ZSTR_LEN(salt) + hash_format_len, 0);
+ sprintf(ZSTR_VAL(hash), "%s%s", hash_format, ZSTR_VAL(salt));
+ ZSTR_VAL(hash)[hash_format_len + ZSTR_LEN(salt)] = 0;
- /* XXX all the crypt related APIs work with int for string length.
- That should be revised for size_t and then we maybe don't require
- the > INT_MAX check. */
- if (ZSTR_LEN(buffer) > INT_MAX) {
- php_error_docref(NULL, E_WARNING, "Supplied salt is too long");
- RETURN_NULL();
- } else if (ZSTR_LEN(buffer) < required_salt_len) {
- php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd expecting %zd", ZSTR_LEN(buffer), required_salt_len);
- zend_string_release(buffer);
- RETURN_NULL();
- } else if (php_password_salt_is_alphabet(ZSTR_VAL(buffer), ZSTR_LEN(buffer)) == FAILURE) {
- salt = safe_emalloc(required_salt_len, 1, 1);
- if (php_password_salt_to64(ZSTR_VAL(buffer), ZSTR_LEN(buffer), required_salt_len, salt) == FAILURE) {
- efree(salt);
- php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd", ZSTR_LEN(buffer));
- zend_string_release(buffer);
- RETURN_NULL();
+ zend_string_release(salt);
+
+ /* This cast is safe, since both values are defined here in code and cannot overflow */
+ result = php_crypt(ZSTR_VAL(password), (int)ZSTR_LEN(password), ZSTR_VAL(hash), (int)ZSTR_LEN(hash), 1);
+ zend_string_release(hash);
+
+ if (!result) {
+ RETURN_FALSE;
+ }
+
+ if (ZSTR_LEN(result) < 13) {
+ zend_string_free(result);
+ RETURN_FALSE;
+ }
+
+ RETURN_STR(result);
}
- salt_len = required_salt_len;
- } else {
- salt = safe_emalloc(required_salt_len, 1, 1);
- memcpy(salt, ZSTR_VAL(buffer), required_salt_len);
- salt_len = required_salt_len;
- }
- zend_string_release(buffer);
- } else {
- salt = safe_emalloc(required_salt_len, 1, 1);
- if (php_password_make_salt(required_salt_len, salt) == FAILURE) {
- efree(salt);
- RETURN_FALSE;
- }
- salt_len = required_salt_len;
- }
+ break;
+#if HAVE_ARGON2LIB
+ case PHP_PASSWORD_ARGON2I:
+ {
+ zval *option_buffer;
+ zend_string *salt, *out, *encoded;
+ size_t time_cost = PHP_PASSWORD_ARGON2_TIME_COST;
+ size_t memory_cost = PHP_PASSWORD_ARGON2_MEMORY_COST;
+ size_t threads = PHP_PASSWORD_ARGON2_THREADS;
+ argon2_type type = Argon2_i;
+ size_t encoded_len;
+ int status = 0;
+
+ if (options && (option_buffer = zend_hash_str_find(options, "memory_cost", sizeof("memory_cost")-1)) != NULL) {
+ memory_cost = zval_get_long(option_buffer);
+ }
- salt[salt_len] = 0;
+ if (memory_cost > ARGON2_MAX_MEMORY || memory_cost < ARGON2_MIN_MEMORY) {
+ php_error_docref(NULL, E_WARNING, "Memory cost is outside of allowed memory range", memory_cost);
+ RETURN_NULL();
+ }
- hash = safe_emalloc(salt_len + hash_format_len, 1, 1);
- sprintf(hash, "%s%s", hash_format, salt);
- hash[hash_format_len + salt_len] = 0;
+ if (options && (option_buffer = zend_hash_str_find(options, "time_cost", sizeof("time_cost")-1)) != NULL) {
+ time_cost = zval_get_long(option_buffer);
+ }
- efree(salt);
+ if (time_cost > ARGON2_MAX_TIME || time_cost < ARGON2_MIN_TIME) {
+ php_error_docref(NULL, E_WARNING, "Time cost is outside of allowed time range", time_cost);
+ RETURN_NULL();
+ }
- /* This cast is safe, since both values are defined here in code and cannot overflow */
- hash_len = (int) (hash_format_len + salt_len);
+ if (options && (option_buffer = zend_hash_str_find(options, "threads", sizeof("threads")-1)) != NULL) {
+ threads = zval_get_long(option_buffer);
+ }
- if ((result = php_crypt(password, (int)password_len, hash, hash_len, 1)) == NULL) {
- efree(hash);
- RETURN_FALSE;
- }
+ if (threads > ARGON2_MAX_LANES || threads == 0) {
+ php_error_docref(NULL, E_WARNING, "Invalid number of threads", threads);
+ RETURN_NULL();
+ }
- efree(hash);
+ if (!(salt = php_password_get_salt(return_value, Z_UL(16), options))) {
+ return;
+ }
- if (ZSTR_LEN(result) < 13) {
- zend_string_free(result);
- RETURN_FALSE;
- }
+ out = zend_string_alloc(32, 0);
+ encoded_len = argon2_encodedlen(
+ time_cost,
+ memory_cost,
+ threads,
+ (uint32_t)ZSTR_LEN(salt),
+ ZSTR_LEN(out)
+#if HAVE_ARGON2ID
+ , type
+#endif
+ );
+
+ encoded = zend_string_alloc(encoded_len - 1, 0);
+ status = argon2_hash(
+ time_cost,
+ memory_cost,
+ threads,
+ ZSTR_VAL(password),
+ ZSTR_LEN(password),
+ ZSTR_VAL(salt),
+ ZSTR_LEN(salt),
+ ZSTR_VAL(out),
+ ZSTR_LEN(out),
+ ZSTR_VAL(encoded),
+ encoded_len,
+ type,
+ ARGON2_VERSION_NUMBER
+ );
+
+ zend_string_release(out);
+ zend_string_release(salt);
+
+ if (status != ARGON2_OK) {
+ zend_string_free(encoded);
+ php_error_docref(NULL, E_WARNING, "%s", argon2_error_message(status));
+ RETURN_FALSE;
+ }
- RETURN_STR(result);
+ ZSTR_VAL(encoded)[ZSTR_LEN(encoded)] = 0;
+ RETURN_STR(encoded);
+ }
+ break;
+#endif
+ case PHP_PASSWORD_UNKNOWN:
+ default:
+ php_error_docref(NULL, E_WARNING, "Unknown password hashing algorithm: " ZEND_LONG_FMT, algo);
+ RETURN_NULL();
+ }
}
/* }}} */
diff --git a/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c
index deb945a5cc..52dda93348 100644
--- a/ext/standard/php_crypt_r.c
+++ b/ext/standard/php_crypt_r.c
@@ -364,7 +364,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out)
PHP_MD5Update(&ctx, final, (unsigned int)(pl > 16 ? 16 : pl));
/* Don't leave anything around in vm they could use. */
- memset(final, 0, sizeof(final));
+ ZEND_SECURE_ZERO(final, sizeof(final));
/* Then something really weird... */
for (i = pwl; i != 0; i >>= 1)
diff --git a/ext/standard/php_dns.h b/ext/standard/php_dns.h
index 1e7549bcfd..335701b7c3 100644
--- a/ext/standard/php_dns.h
+++ b/ext/standard/php_dns.h
@@ -65,7 +65,7 @@ PHP_FUNCTION(gethostbynamel);
PHP_FUNCTION(gethostname);
#endif
-#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE)))
+#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__))
PHP_FUNCTION(dns_check_record);
# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS
@@ -74,7 +74,7 @@ PHP_FUNCTION(dns_get_record);
PHP_MINIT_FUNCTION(dns);
# endif
-#endif /* defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE))) */
+#endif /* defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__)) */
#ifndef INT16SZ
#define INT16SZ 2
diff --git a/ext/standard/php_ext_syslog.h b/ext/standard/php_ext_syslog.h
index a6e5ebb19e..f0fc45c28e 100644
--- a/ext/standard/php_ext_syslog.h
+++ b/ext/standard/php_ext_syslog.h
@@ -12,7 +12,7 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
+ | Author: Stig Sæther Bakken <ssb@php.net> |
+----------------------------------------------------------------------+
*/
diff --git a/ext/standard/php_filestat.h b/ext/standard/php_filestat.h
index d2c123ef65..19f753c666 100644
--- a/ext/standard/php_filestat.h
+++ b/ext/standard/php_filestat.h
@@ -78,14 +78,11 @@ PHP_FUNCTION(clearstatcache);
#define getuid() 1
#endif
-#ifdef PHP_WIN32
-typedef unsigned int php_stat_len;
-#else
-typedef int php_stat_len;
-#endif
+/* Compatibility. */
+typedef size_t php_stat_len;
-PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, int filename_len);
-PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int type, zval *return_value);
+PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, size_t filename_len);
+PHPAPI void php_stat(const char *filename, size_t filename_length, int type, zval *return_value);
/* Switches for various filestat functions: */
#define FS_PERMS 0
diff --git a/ext/standard/php_mail.h b/ext/standard/php_mail.h
index 9760dc5585..2a23b66ab8 100644
--- a/ext/standard/php_mail.h
+++ b/ext/standard/php_mail.h
@@ -22,9 +22,39 @@
#define PHP_MAIL_H
PHP_FUNCTION(mail);
+PHP_FUNCTION(ezmlm_hash);
+
PHP_MINFO_FUNCTION(mail);
-PHP_FUNCTION(ezmlm_hash);
+PHPAPI zend_string *php_mail_build_headers(zval *headers);
PHPAPI extern int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd);
+#define PHP_MAIL_BUILD_HEADER_CHECK(target, s, key, val) \
+do { \
+ if (Z_TYPE_P(val) == IS_STRING) { \
+ php_mail_build_headers_elem(&s, key, val); \
+ } else if (Z_TYPE_P(val) == IS_ARRAY) { \
+ if (!strncasecmp(target, ZSTR_VAL(key), ZSTR_LEN(key))) { \
+ php_error_docref(NULL, E_WARNING, "'%s' header must be at most one header. Array is passed for '%s'", target, target); \
+ continue; \
+ } \
+ php_mail_build_headers_elems(&s, key, val); \
+ } else { \
+ php_error_docref(NULL, E_WARNING, "Extra header element '%s' cannot be other than string or array.", ZSTR_VAL(key)); \
+ } \
+} while(0)
+
+
+#define PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val) \
+do { \
+ if (Z_TYPE_P(val) == IS_STRING) { \
+ php_mail_build_headers_elem(&s, key, val); \
+ } else if (Z_TYPE_P(val) == IS_ARRAY) { \
+ php_mail_build_headers_elems(&s, key, val); \
+ } else { \
+ php_error_docref(NULL, E_WARNING, "Extra header element '%s' cannot be other than string or array.", ZSTR_VAL(key)); \
+ } \
+} while(0)
+
+
#endif /* PHP_MAIL_H */
diff --git a/ext/standard/php_math.h b/ext/standard/php_math.h
index e6450458ca..3ab92320b1 100644
--- a/ext/standard/php_math.h
+++ b/ext/standard/php_math.h
@@ -13,7 +13,7 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Jim Winstead <jimw@php.net> |
- | Stig Sæther Bakken <ssb@php.net> |
+ | Stig Sæther Bakken <ssb@php.net> |
+----------------------------------------------------------------------+
*/
diff --git a/ext/standard/php_password.h b/ext/standard/php_password.h
index d0a03ddef1..c7dca73839 100644
--- a/ext/standard/php_password.h
+++ b/ext/standard/php_password.h
@@ -13,6 +13,7 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Anthony Ferrara <ircmaxell@php.net> |
+ | Charles R. Portwood II <charlesportwoodii@erianna.com> |
+----------------------------------------------------------------------+
*/
@@ -28,13 +29,21 @@ PHP_FUNCTION(password_get_info);
PHP_MINIT_FUNCTION(password);
-#define PHP_PASSWORD_DEFAULT PHP_PASSWORD_BCRYPT
-
+#define PHP_PASSWORD_DEFAULT PHP_PASSWORD_BCRYPT
#define PHP_PASSWORD_BCRYPT_COST 10
+#if HAVE_ARGON2LIB
+#define PHP_PASSWORD_ARGON2_MEMORY_COST 1<<10
+#define PHP_PASSWORD_ARGON2_TIME_COST 2
+#define PHP_PASSWORD_ARGON2_THREADS 2
+#endif
+
typedef enum {
- PHP_PASSWORD_UNKNOWN,
- PHP_PASSWORD_BCRYPT
+ PHP_PASSWORD_UNKNOWN,
+ PHP_PASSWORD_BCRYPT,
+#if HAVE_ARGON2LIB
+ PHP_PASSWORD_ARGON2I,
+#endif
} php_password_algo;
#endif
diff --git a/ext/standard/php_smart_string.h b/ext/standard/php_smart_string.h
index dde33d83bc..0d6a135159 100644
--- a/ext/standard/php_smart_string.h
+++ b/ext/standard/php_smart_string.h
@@ -17,133 +17,6 @@
+----------------------------------------------------------------------+
*/
-/* $Id$ */
+/* Header moved to Zend. This file is retained for BC. */
+#include "zend_smart_string.h"
-#ifndef PHP_SMART_STRING_H
-#define PHP_SMART_STRING_H
-
-#include "php_smart_string_public.h"
-
-#include <stdlib.h>
-#ifndef SMART_STR_USE_REALLOC
-#include <zend.h>
-#endif
-
-#define smart_string_0(x) do { \
- if ((x)->c) { \
- (x)->c[(x)->len] = '\0'; \
- } \
-} while (0)
-
-#ifndef SMART_STRING_PREALLOC
-#define SMART_STRING_PREALLOC 128
-#endif
-
-#ifndef SMART_STRING_START_SIZE
-#define SMART_STRING_START_SIZE 78
-#endif
-
-#ifdef SMART_STRING_USE_REALLOC
-#define SMART_STRING_REALLOC(a,b,c) realloc((a),(b))
-#else
-#define SMART_STRING_REALLOC(a,b,c) perealloc((a),(b),(c))
-#endif
-
-#define SMART_STRING_DO_REALLOC(d, what) \
- (d)->c = (char *) SMART_STRING_REALLOC((d)->c, (d)->a + 1, (what))
-
-#define smart_string_alloc4(d, n, what, newlen) do { \
- if (!(d)->c) { \
- (d)->len = 0; \
- newlen = (n); \
- (d)->a = newlen < SMART_STRING_START_SIZE \
- ? SMART_STRING_START_SIZE \
- : newlen + SMART_STRING_PREALLOC; \
- SMART_STRING_DO_REALLOC(d, what); \
- } else { \
- if(UNEXPECTED((size_t)n > SIZE_MAX - (d)->len)) { \
- zend_error(E_ERROR, "String size overflow"); \
- } \
- newlen = (d)->len + (n); \
- if (newlen >= (d)->a) { \
- (d)->a = newlen + SMART_STRING_PREALLOC; \
- SMART_STRING_DO_REALLOC(d, what); \
- } \
- } \
-} while (0)
-
-#define smart_string_alloc(d, n, what) \
- smart_string_alloc4((d), (n), (what), newlen)
-
-/* wrapper */
-
-#define smart_string_appends_ex(dest, src, what) \
- smart_string_appendl_ex((dest), (src), strlen(src), (what))
-#define smart_string_appends(dest, src) \
- smart_string_appendl((dest), (src), strlen(src))
-
-#define smart_string_appendc(dest, c) \
- smart_string_appendc_ex((dest), (c), 0)
-#define smart_string_free(s) \
- smart_string_free_ex((s), 0)
-#define smart_string_appendl(dest, src, len) \
- smart_string_appendl_ex((dest), (src), (len), 0)
-#define smart_string_append(dest, src) \
- smart_string_append_ex((dest), (src), 0)
-#define smart_string_append_long(dest, val) \
- smart_string_append_long_ex((dest), (val), 0)
-#define smart_string_append_unsigned(dest, val) \
- smart_string_append_unsigned_ex((dest), (val), 0)
-
-#define smart_string_appendc_ex(dest, ch, what) do { \
- size_t __nl; \
- smart_string_alloc4((dest), 1, (what), __nl); \
- (dest)->len = __nl; \
- ((unsigned char *) (dest)->c)[(dest)->len - 1] = (ch); \
-} while (0)
-
-#define smart_string_free_ex(s, what) do { \
- smart_string *__s = (smart_string *) (s); \
- if (__s->c) { \
- pefree(__s->c, what); \
- __s->c = NULL; \
- } \
- __s->a = __s->len = 0; \
-} while (0)
-
-#define smart_string_appendl_ex(dest, src, nlen, what) do { \
- size_t __nl; \
- smart_string *__dest = (smart_string *) (dest); \
- \
- smart_string_alloc4(__dest, (nlen), (what), __nl); \
- memcpy(__dest->c + __dest->len, (src), (nlen)); \
- __dest->len = __nl; \
-} while (0)
-
-#define smart_string_append_generic_ex(dest, num, type, vartype, func) do { \
- char __b[32]; \
- char *__t = zend_print##func##_to_buf(__b + sizeof(__b) - 1, (num)); \
- smart_string_appendl_ex((dest), __t, __b + sizeof(__b) - 1 - __t, (type)); \
-} while (0)
-
-#define smart_string_append_unsigned_ex(dest, num, type) \
- smart_string_append_generic_ex((dest), (num), (type), zend_ulong, _ulong)
-
-#define smart_string_append_long_ex(dest, num, type) \
- smart_string_append_generic_ex((dest), (num), (type), zend_ulong, _long)
-
-#define smart_string_append_ex(dest, src, what) \
- smart_string_appendl_ex((dest), ((smart_string *)(src))->c, \
- ((smart_string *)(src))->len, (what));
-
-
-#define smart_string_setl(dest, src, nlen) do { \
- (dest)->len = (nlen); \
- (dest)->a = (nlen) + 1; \
- (dest)->c = (char *) (src); \
-} while (0)
-
-#define smart_string_sets(dest, src) \
- smart_string_setl((dest), (src), strlen(src));
-
-#endif
diff --git a/ext/standard/php_smart_string_public.h b/ext/standard/php_smart_string_public.h
index 6420137840..255fbd94a1 100644
--- a/ext/standard/php_smart_string_public.h
+++ b/ext/standard/php_smart_string_public.h
@@ -17,17 +17,6 @@
+----------------------------------------------------------------------+
*/
-/* $Id$ */
+/* Header moved to Zend. This file is retained for BC. */
+#include "zend_smart_string_public.h"
-#ifndef PHP_SMART_STRING_PUBLIC_H
-#define PHP_SMART_STRING_PUBLIC_H
-
-#include <sys/types.h>
-
-typedef struct {
- char *c;
- size_t len;
- size_t a;
-} smart_string;
-
-#endif
diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h
index 9ac594211d..68fcd3149c 100644
--- a/ext/standard/php_string.h
+++ b/ext/standard/php_string.h
@@ -13,7 +13,7 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Stig Sæther Bakken <ssb@php.net> |
+ | Stig Sæther Bakken <ssb@php.net> |
+----------------------------------------------------------------------+
*/
@@ -93,6 +93,8 @@ PHP_FUNCTION(str_word_count);
PHP_FUNCTION(str_split);
PHP_FUNCTION(strpbrk);
PHP_FUNCTION(substr_compare);
+PHP_FUNCTION(utf8_encode);
+PHP_FUNCTION(utf8_decode);
#ifdef HAVE_STRCOLL
PHP_FUNCTION(strcoll);
#endif
@@ -133,8 +135,8 @@ PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len);
PHPAPI zend_string *php_str_to_str(char *haystack, size_t length, char *needle,
size_t needle_len, char *str, size_t str_len);
PHPAPI zend_string *php_trim(zend_string *str, char *what, size_t what_len, int mode);
-PHPAPI size_t php_strip_tags(char *rbuf, size_t len, int *state, const char *allow, size_t allow_len);
-PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, int *stateptr, const char *allow, size_t allow_len, zend_bool allow_tag_spaces);
+PHPAPI size_t php_strip_tags(char *rbuf, size_t len, uint8_t *state, const char *allow, size_t allow_len);
+PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, uint8_t *stateptr, const char *allow, size_t allow_len, zend_bool allow_tag_spaces);
PHPAPI void php_implode(const zend_string *delim, zval *arr, zval *return_value);
PHPAPI void php_explode(const zend_string *delim, zend_string *str, zval *return_value, zend_long limit);
diff --git a/ext/standard/php_versioning.h b/ext/standard/php_versioning.h
index d14f3e0d5e..0b876c9611 100644
--- a/ext/standard/php_versioning.h
+++ b/ext/standard/php_versioning.h
@@ -12,7 +12,7 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
+ | Author: Stig Sæther Bakken <ssb@php.net> |
+----------------------------------------------------------------------+
*/
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index 17dcdb1e2a..9aa5f74739 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -19,9 +19,9 @@
#if 0 && (defined(__linux__) || defined(sun) || defined(__IRIX__))
# define _BSD_SOURCE /* linux wants this when XOPEN mode is on */
-# define _BSD_COMPAT /* irix: uint */
+# define _BSD_COMPAT /* irix: uint32_t */
# define _XOPEN_SOURCE 500 /* turn on Unix98 */
-# define __EXTENSIONS__ 1 /* Solaris: uint */
+# define __EXTENSIONS__ 1 /* Solaris: uint32_t */
#endif
#include "php.h"
@@ -36,11 +36,6 @@
#include "SAPI.h"
#include "main/php_network.h"
-#ifdef NETWARE
-#include <proc.h>
-#include <library.h>
-#endif
-
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
@@ -151,7 +146,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
zend_string_release(str);
} ZEND_HASH_FOREACH_END();
- assert((uint)(p - env.envp) <= sizeenv);
+ assert((uint32_t)(p - env.envp) <= sizeenv);
zend_hash_destroy(env_hash);
FREE_HASHTABLE(env_hash);
@@ -252,9 +247,11 @@ PHP_FUNCTION(proc_terminate)
struct php_process_handle *proc;
zend_long sig_no = SIGTERM;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &zproc, &sig_no) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_RESOURCE(zproc)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(sig_no)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) {
RETURN_FALSE;
@@ -283,9 +280,9 @@ PHP_FUNCTION(proc_close)
zval *zproc;
struct php_process_handle *proc;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zproc) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(zproc)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) {
RETURN_FALSE;
@@ -313,9 +310,9 @@ PHP_FUNCTION(proc_get_status)
int running = 1, signaled = 0, stopped = 0;
int exitcode = -1, termsig = 0, stopsig = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zproc) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(zproc)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) {
RETURN_FALSE;
@@ -346,11 +343,8 @@ PHP_FUNCTION(proc_get_status)
if (WIFSIGNALED(wstatus)) {
running = 0;
signaled = 1;
-#ifdef NETWARE
- termsig = WIFTERMSIG(wstatus);
-#else
+
termsig = WTERMSIG(wstatus);
-#endif
}
if (WIFSTOPPED(wstatus)) {
stopped = 1;
@@ -438,13 +432,6 @@ PHP_FUNCTION(proc_open)
wchar_t *cmdw = NULL, *cwdw = NULL, *envpw = NULL;
size_t tmp_len;
#endif
-#ifdef NETWARE
- char** child_argv = NULL;
- char* command_dup = NULL;
- char* orig_cwd = NULL;
- int command_num_args = 0;
- wiring_t channel;
-#endif
php_process_id_t child;
struct php_process_handle *proc;
int is_persistent = 0; /* TODO: ensure that persistent procs will work */
@@ -458,11 +445,15 @@ PHP_FUNCTION(proc_open)
php_file_descriptor_t slave_pty = -1;
#endif
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "saz/|s!a!a!", &command,
- &command_len, &descriptorspec, &pipes, &cwd, &cwd_len, &environment,
- &other_options) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(3, 6)
+ Z_PARAM_STRING(command, command_len)
+ Z_PARAM_ARRAY(descriptorspec)
+ Z_PARAM_ZVAL_DEREF(pipes)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING_EX(cwd, cwd_len, 1, 0)
+ Z_PARAM_ARRAY_EX(environment, 1, 0)
+ Z_PARAM_ARRAY_EX(other_options, 1, 0)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
command = pestrdup(command, is_persistent);
@@ -797,51 +788,6 @@ PHP_FUNCTION(proc_open)
childHandle = pi.hProcess;
child = pi.dwProcessId;
CloseHandle(pi.hThread);
-
-#elif defined(NETWARE)
- if (cwd) {
- orig_cwd = getcwd(NULL, PATH_MAX);
- chdir2(cwd);
- }
- channel.infd = descriptors[0].childend;
- channel.outfd = descriptors[1].childend;
- channel.errfd = -1;
- /* Duplicate the command as processing downwards will modify it*/
- command_dup = strdup(command);
- if (!command_dup) {
- goto exit_fail;
- }
- /* get a number of args */
- construct_argc_argv(command_dup, NULL, &command_num_args, NULL);
- child_argv = (char**) malloc((command_num_args + 1) * sizeof(char*));
- if(!child_argv) {
- free(command_dup);
- if (cwd && orig_cwd) {
- chdir2(orig_cwd);
- free(orig_cwd);
- }
- }
- /* fill the child arg vector */
- construct_argc_argv(command_dup, NULL, &command_num_args, child_argv);
- child_argv[command_num_args] = NULL;
- child = procve(child_argv[0], PROC_DETACHED|PROC_INHERIT_CWD, NULL, &channel, NULL, NULL, 0, NULL, (const char**)child_argv);
- free(child_argv);
- free(command_dup);
- if (cwd && orig_cwd) {
- chdir2(orig_cwd);
- free(orig_cwd);
- }
- if (child < 0) {
- /* failed to fork() */
- /* clean up all the descriptors */
- for (i = 0; i < ndesc; i++) {
- close(descriptors[i].childend);
- if (descriptors[i].parentend)
- close(descriptors[i].parentend);
- }
- php_error_docref(NULL, E_WARNING, "procve failed - %s", strerror(errno));
- goto exit_fail;
- }
#elif HAVE_FORK
/* the unix way */
child = fork();
@@ -928,10 +874,7 @@ PHP_FUNCTION(proc_open)
#endif
proc->env = env;
- if (pipes != NULL) {
- zval_dtor(pipes);
- }
-
+ zval_ptr_dtor(pipes);
array_init(pipes);
#if PHP_CAN_DO_PTS
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
index d346bae7a2..fc3ae0a048 100644
--- a/ext/standard/quot_print.c
+++ b/ext/standard/quot_print.c
@@ -206,9 +206,9 @@ PHP_FUNCTION(quoted_printable_decode)
zend_string *str_out;
size_t i = 0, j = 0, k;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &arg1) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(arg1)
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(arg1) == 0) {
/* shortcut */
@@ -267,9 +267,9 @@ PHP_FUNCTION(quoted_printable_encode)
zend_string *str;
zend_string *new_str;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) != SUCCESS) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(str)
+ ZEND_PARSE_PARAMETERS_END();
if (!ZSTR_LEN(str)) {
RETURN_EMPTY_STRING();
diff --git a/ext/standard/rand.c b/ext/standard/rand.c
index 9a384a040f..22451c7404 100644
--- a/ext/standard/rand.c
+++ b/ext/standard/rand.c
@@ -57,9 +57,10 @@ PHP_FUNCTION(rand)
RETURN_LONG(php_mt_rand() >> 1);
}
- if (zend_parse_parameters(argc, "ll", &min, &max) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_LONG(min)
+ Z_PARAM_LONG(max)
+ ZEND_PARSE_PARAMETERS_END();
if (max < min) {
RETURN_LONG(php_mt_rand_common(max, min));
diff --git a/ext/standard/random.c b/ext/standard/random.c
index b84c5bc6dd..627df9bdb8 100644
--- a/ext/standard/random.c
+++ b/ext/standard/random.c
@@ -189,9 +189,9 @@ PHP_FUNCTION(random_bytes)
zend_long size;
zend_string *bytes;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "l", &size) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1)
+ Z_PARAM_LONG(size)
+ ZEND_PARSE_PARAMETERS_END();
if (size < 1) {
zend_throw_exception(zend_ce_error, "Length must be greater than 0", 0);
@@ -263,9 +263,10 @@ PHP_FUNCTION(random_int)
zend_long max;
zend_long result;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ll", &min, &max) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 2, 2)
+ Z_PARAM_LONG(min)
+ Z_PARAM_LONG(max)
+ ZEND_PARSE_PARAMETERS_END();
if (min > max) {
zend_throw_exception(zend_ce_error, "Minimum value must be less than or equal to the maximum value", 0);
diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c
index 8747070d7d..b40e61751f 100644
--- a/ext/standard/scanf.c
+++ b/ext/standard/scanf.c
@@ -921,7 +921,7 @@ literal:
if (numVars) {
char __buf[2];
__buf[0] = sch;
- __buf[1] = '\0';;
+ __buf[1] = '\0';
current = args[objIndex++];
zval_dtor(*current);
ZVAL_STRINGL( *current, __buf, 1);
diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c
index 392523d2cc..5c20db9c5d 100644
--- a/ext/standard/sha1.c
+++ b/ext/standard/sha1.c
@@ -40,9 +40,11 @@ PHP_FUNCTION(sha1)
PHP_SHA1_CTX context;
unsigned char digest[20];
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|b", &arg, &raw_output) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STR(arg)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(raw_output)
+ ZEND_PARSE_PARAMETERS_END();
sha1str[0] = '\0';
PHP_SHA1Init(&context);
@@ -74,9 +76,11 @@ PHP_FUNCTION(sha1_file)
size_t n;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_PATH(arg, arg_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(raw_output)
+ ZEND_PARSE_PARAMETERS_END();
stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS, NULL);
if (!stream) {
diff --git a/ext/standard/soundex.c b/ext/standard/soundex.c
index 6a9c73d446..ab64a90a42 100644
--- a/ext/standard/soundex.c
+++ b/ext/standard/soundex.c
@@ -12,7 +12,7 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Author: Bjørn Borud - Guardian Networks AS <borud@guardian.no> |
+ | Author: Bjørn Borud - Guardian Networks AS <borud@guardian.no> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
@@ -60,9 +60,10 @@ PHP_FUNCTION(soundex)
0, /* Y */
'2'}; /* Z */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &str_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(str, str_len)
+ ZEND_PARSE_PARAMETERS_END();
+
if (str_len == 0) {
RETURN_FALSE;
}
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 9d2dc7ae32..86c07c3ac7 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -30,6 +30,9 @@
#include "streamsfuncs.h"
#include "php_network.h"
#include "php_string.h"
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifndef PHP_WIN32
#define php_select(m, r, w, e, t) select(m, r, w, e, t)
@@ -37,6 +40,7 @@ typedef unsigned long long php_timeout_ull;
#else
#include "win32/select.h"
#include "win32/sockets.h"
+#include "win32/console.h"
typedef unsigned __int64 php_timeout_ull;
#endif
@@ -55,10 +59,11 @@ PHP_FUNCTION(stream_socket_pair)
php_stream *s1, *s2;
php_socket_t pair[2];
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "lll",
- &domain, &type, &protocol)) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(3, 3)
+ Z_PARAM_LONG(domain)
+ Z_PARAM_LONG(type)
+ Z_PARAM_LONG(protocol)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (0 != socketpair((int)domain, (int)type, (int)protocol, pair)) {
char errbuf[256];
@@ -101,9 +106,15 @@ PHP_FUNCTION(stream_socket_client)
RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|z/z/dlr", &host, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 6)
+ Z_PARAM_STR(host)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF(zerrno)
+ Z_PARAM_ZVAL_DEREF(zerrstr)
+ Z_PARAM_DOUBLE(timeout)
+ Z_PARAM_LONG(flags)
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT);
@@ -121,11 +132,11 @@ PHP_FUNCTION(stream_socket_client)
tv.tv_usec = conv % 1000000;
#endif
if (zerrno) {
- zval_dtor(zerrno);
+ zval_ptr_dtor(zerrno);
ZVAL_LONG(zerrno, 0);
}
if (zerrstr) {
- zval_dtor(zerrstr);
+ zval_ptr_dtor(zerrstr);
ZVAL_EMPTY_STRING(zerrstr);
}
@@ -149,11 +160,11 @@ PHP_FUNCTION(stream_socket_client)
if (stream == NULL) {
if (zerrno) {
- zval_dtor(zerrno);
+ zval_ptr_dtor(zerrno);
ZVAL_LONG(zerrno, err);
}
if (zerrstr && errstr) {
- zval_dtor(zerrstr);
+ zval_ptr_dtor(zerrstr);
ZVAL_STR(zerrstr, errstr);
} else if (errstr) {
zend_string_release(errstr);
@@ -185,9 +196,14 @@ PHP_FUNCTION(stream_socket_server)
RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z/z/lr", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 5)
+ Z_PARAM_STRING(host, host_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF(zerrno)
+ Z_PARAM_ZVAL_DEREF(zerrstr)
+ Z_PARAM_LONG(flags)
+ Z_PARAM_RESOURCE(zcontext)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT);
@@ -196,11 +212,11 @@ PHP_FUNCTION(stream_socket_server)
}
if (zerrno) {
- zval_dtor(zerrno);
+ zval_ptr_dtor(zerrno);
ZVAL_LONG(zerrno, 0);
}
if (zerrstr) {
- zval_dtor(zerrstr);
+ zval_ptr_dtor(zerrstr);
ZVAL_EMPTY_STRING(zerrstr);
}
@@ -214,11 +230,11 @@ PHP_FUNCTION(stream_socket_server)
if (stream == NULL) {
if (zerrno) {
- zval_dtor(zerrno);
+ zval_ptr_dtor(zerrno);
ZVAL_LONG(zerrno, err);
}
if (zerrstr && errstr) {
- zval_dtor(zerrstr);
+ zval_ptr_dtor(zerrstr);
ZVAL_STR(zerrstr, errstr);
} else if (errstr) {
zend_string_release(errstr);
@@ -251,7 +267,7 @@ PHP_FUNCTION(stream_socket_accept)
Z_PARAM_RESOURCE(zstream)
Z_PARAM_OPTIONAL
Z_PARAM_DOUBLE(timeout)
- Z_PARAM_ZVAL_EX(zpeername, 0, 1)
+ Z_PARAM_ZVAL_DEREF(zpeername)
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, zstream);
@@ -266,7 +282,7 @@ PHP_FUNCTION(stream_socket_accept)
tv.tv_usec = conv % 1000000;
#endif
if (zpeername) {
- zval_dtor(zpeername);
+ zval_ptr_dtor(zpeername);
ZVAL_NULL(zpeername);
}
@@ -335,9 +351,13 @@ PHP_FUNCTION(stream_socket_sendto)
php_sockaddr_storage sa;
socklen_t sl = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|ls", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 4)
+ Z_PARAM_RESOURCE(zstream)
+ Z_PARAM_STRING(data, datalen)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(flags)
+ Z_PARAM_STRING(target_addr, target_addr_len)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, zstream);
if (target_addr_len) {
@@ -364,14 +384,18 @@ PHP_FUNCTION(stream_socket_recvfrom)
zend_long flags = 0;
int recvd;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|lz/", &zstream, &to_read, &flags, &zremote) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 4)
+ Z_PARAM_RESOURCE(zstream)
+ Z_PARAM_LONG(to_read)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(flags)
+ Z_PARAM_ZVAL_DEREF(zremote)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, zstream);
if (zremote) {
- zval_dtor(zremote);
+ zval_ptr_dtor(zremote);
ZVAL_NULL(zremote);
}
@@ -410,9 +434,12 @@ PHP_FUNCTION(stream_get_contents)
desiredpos = -1L;
zend_string *contents;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_RESOURCE(zsrc)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(maxlen)
+ Z_PARAM_LONG(desiredpos)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, zsrc);
@@ -458,9 +485,13 @@ PHP_FUNCTION(stream_copy_to_stream)
size_t len;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr|ll", &zsrc, &zdest, &maxlen, &pos) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 4)
+ Z_PARAM_RESOURCE(zsrc)
+ Z_PARAM_RESOURCE(zdest)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(maxlen)
+ Z_PARAM_LONG(pos)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(src, zsrc);
php_stream_from_zval(dest, zdest);
@@ -1061,9 +1092,10 @@ PHP_FUNCTION(stream_context_get_default)
zval *params = NULL;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a", &params) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ARRAY(params)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (FG(default_context) == NULL) {
FG(default_context) = php_stream_context_alloc();
@@ -1085,9 +1117,9 @@ PHP_FUNCTION(stream_context_set_default)
zval *options = NULL;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &options) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ARRAY(options)
+ ZEND_PARSE_PARAMETERS_END();
if (FG(default_context) == NULL) {
FG(default_context) = php_stream_context_alloc();
@@ -1107,9 +1139,11 @@ PHP_FUNCTION(stream_context_create)
zval *options = NULL, *params = NULL;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a!a!", &options, &params) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 2)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ARRAY_EX(options, 1, 0)
+ Z_PARAM_ARRAY_EX(params, 1, 0)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
context = php_stream_context_alloc();
@@ -1137,10 +1171,13 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS)
php_stream_filter *filter = NULL;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|lz", &zstream,
- &filtername, &filternamelen, &read_write, &filterparams) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 4)
+ Z_PARAM_RESOURCE(zstream)
+ Z_PARAM_STRING(filtername, filternamelen)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(read_write)
+ Z_PARAM_ZVAL(filterparams)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, zstream);
@@ -1225,9 +1262,9 @@ PHP_FUNCTION(stream_filter_remove)
zval *zfilter;
php_stream_filter *filter;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zfilter) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(zfilter)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
filter = zend_fetch_resource(Z_RES_P(zfilter), NULL, php_file_le_stream_filter());
if (!filter) {
@@ -1261,9 +1298,12 @@ PHP_FUNCTION(stream_get_line)
zend_string *buf;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|s", &zstream, &max_length, &str, &str_len) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_RESOURCE(zstream)
+ Z_PARAM_LONG(max_length)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(str, str_len)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (max_length < 0) {
php_error_docref(NULL, E_WARNING, "The maximum allowed length must be greater than or equal to zero");
@@ -1319,9 +1359,12 @@ PHP_FUNCTION(stream_set_timeout)
php_stream *stream;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc, "rl|l", &socket, &seconds, &microseconds) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_RESOURCE(socket)
+ Z_PARAM_LONG(seconds)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(microseconds)
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, socket);
@@ -1364,9 +1407,10 @@ PHP_FUNCTION(stream_set_write_buffer)
size_t buff;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &arg1, &arg2) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(arg1)
+ Z_PARAM_LONG(arg2)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, arg1);
@@ -1392,9 +1436,10 @@ PHP_FUNCTION(stream_set_chunk_size)
zval *zstream;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &zstream, &csize) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(zstream)
+ Z_PARAM_LONG(csize)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (csize <= 0) {
php_error_docref(NULL, E_WARNING, "The chunk size must be a positive integer, given " ZEND_LONG_FMT, csize);
@@ -1427,9 +1472,10 @@ PHP_FUNCTION(stream_set_read_buffer)
size_t buff;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &arg1, &arg2) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(arg1)
+ Z_PARAM_LONG(arg2)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, arg1);
@@ -1509,9 +1555,9 @@ PHP_FUNCTION(stream_resolve_include_path)
size_t filename_len;
zend_string *resolved_path;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_PATH(filename, filename_len)
+ ZEND_PARSE_PARAMETERS_END();
resolved_path = zend_resolve_path(filename, (int)filename_len);
@@ -1530,9 +1576,9 @@ PHP_FUNCTION(stream_is_local)
php_stream *stream = NULL;
php_stream_wrapper *wrapper = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zstream) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(zstream)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (Z_TYPE_P(zstream) == IS_RESOURCE) {
php_stream_from_zval(stream, zstream);
@@ -1561,9 +1607,9 @@ PHP_FUNCTION(stream_supports_lock)
php_stream *stream;
zval *zsrc;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zsrc) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(zsrc)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, zsrc);
@@ -1574,6 +1620,106 @@ PHP_FUNCTION(stream_supports_lock)
RETURN_TRUE;
}
+/* {{{ proto bool stream_isatty(resource stream)
+Check if a stream is a TTY.
+*/
+PHP_FUNCTION(stream_isatty)
+{
+ zval *zsrc;
+ php_stream *stream;
+ php_socket_t fileno;
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(zsrc)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+
+ php_stream_from_zval(stream, zsrc);
+
+ if (php_stream_can_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT) == SUCCESS) {
+ php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT, (void*)&fileno, 0);
+ } else if (php_stream_can_cast(stream, PHP_STREAM_AS_FD) == SUCCESS) {
+ php_stream_cast(stream, PHP_STREAM_AS_FD, (void*)&fileno, 0);
+ } else {
+ RETURN_FALSE;
+ }
+
+#ifdef PHP_WIN32
+ /* Check if the Windows standard handle is redirected to file */
+ RETVAL_BOOL(php_win32_console_fileno_is_console(fileno));
+#elif HAVE_UNISTD_H
+ /* Check if the file descriptor identifier is a terminal */
+ RETVAL_BOOL(isatty(fileno));
+#else
+ {
+ zend_stat_t stat = {0};
+ RETVAL_BOOL(zend_fstat(fileno, &stat) == 0 && (stat.st_mode & /*S_IFMT*/0170000) == /*S_IFCHR*/0020000);
+ }
+#endif
+}
+
+#ifdef PHP_WIN32
+/* {{{ proto bool sapi_windows_vt100_support(resource stream[, bool enable])
+ Get or set VT100 support for the specified stream associated to an
+ output buffer of a Windows console.
+*/
+PHP_FUNCTION(sapi_windows_vt100_support)
+{
+ zval *zsrc;
+ php_stream *stream;
+ zend_bool enable;
+ zend_long fileno;
+
+ int argc = ZEND_NUM_ARGS();
+
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_RESOURCE(zsrc)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(enable)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+
+ php_stream_from_zval(stream, zsrc);
+
+ if (php_stream_can_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT) == SUCCESS) {
+ php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT, (void*)&fileno, 0);
+ }
+ else if (php_stream_can_cast(stream, PHP_STREAM_AS_FD) == SUCCESS) {
+ php_stream_cast(stream, PHP_STREAM_AS_FD, (void*)&fileno, 0);
+ }
+ else {
+ zend_internal_type_error(
+ ZEND_ARG_USES_STRICT_TYPES(),
+ "%s() was not able to analyze the specified stream",
+ get_active_function_name()
+ );
+ RETURN_FALSE;
+ }
+
+ /* Check if the file descriptor is a console */
+ if (!php_win32_console_fileno_is_console(fileno)) {
+ RETURN_FALSE;
+ }
+
+ if (argc == 1) {
+ /* Check if the Windows standard handle has VT100 control codes enabled */
+ if (php_win32_console_fileno_has_vt100(fileno)) {
+ RETURN_TRUE;
+ }
+ else {
+ RETURN_FALSE;
+ }
+ }
+ else {
+ /* Enable/disable VT100 control codes support for the specified Windows standard handle */
+ if (php_win32_console_fileno_set_vt100(fileno, enable ? TRUE : FALSE)) {
+ RETURN_TRUE;
+ }
+ else {
+ RETURN_FALSE;
+ }
+ }
+}
+#endif
+
#ifdef HAVE_SHUTDOWN
/* {{{ proto int stream_socket_shutdown(resource stream, int how)
causes all or part of a full-duplex connection on the socket associated
diff --git a/ext/standard/streamsfuncs.h b/ext/standard/streamsfuncs.h
index 70258bc8d9..b34df344be 100644
--- a/ext/standard/streamsfuncs.h
+++ b/ext/standard/streamsfuncs.h
@@ -61,6 +61,10 @@ PHP_FUNCTION(stream_socket_shutdown);
PHP_FUNCTION(stream_resolve_include_path);
PHP_FUNCTION(stream_is_local);
PHP_FUNCTION(stream_supports_lock);
+PHP_FUNCTION(stream_isatty);
+#ifdef PHP_WIN32
+PHP_FUNCTION(sapi_windows_vt100_support);
+#endif
#if HAVE_SOCKETPAIR
PHP_FUNCTION(stream_socket_pair);
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 922d4fceaf..dd7267b934 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -62,6 +62,8 @@
/* For str_getcsv() support */
#include "ext/standard/file.h"
+/* For php_next_utf8_char() */
+#include "ext/standard/html.h"
#define STR_PAD_LEFT 0
#define STR_PAD_RIGHT 1
@@ -252,9 +254,9 @@ PHP_FUNCTION(bin2hex)
zend_string *result;
zend_string *data;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &data) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(data)
+ ZEND_PARSE_PARAMETERS_END();
result = php_bin2hex((unsigned char *)ZSTR_VAL(data), ZSTR_LEN(data));
@@ -272,9 +274,9 @@ PHP_FUNCTION(hex2bin)
{
zend_string *result, *data;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &data) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(data)
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(data) % 2 != 0) {
php_error_docref(NULL, E_WARNING, "Hexadecimal input string must have an even length");
@@ -297,10 +299,13 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /
zend_string *s11, *s22;
zend_long start = 0, len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|ll", &s11,
- &s22, &start, &len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 4)
+ Z_PARAM_STR(s11)
+ Z_PARAM_STR(s22)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(start)
+ Z_PARAM_LONG(len)
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() < 4) {
len = ZSTR_LEN(s11);
@@ -540,9 +545,9 @@ PHP_FUNCTION(nl_langinfo)
zend_long item;
char *value;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &item) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_LONG(item)
+ ZEND_PARSE_PARAMETERS_END();
switch(item) { /* {{{ */
#ifdef ABDAY_1
@@ -727,9 +732,10 @@ PHP_FUNCTION(strcoll)
{
zend_string *s1, *s2;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &s1, &s2) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_STR(s1)
+ Z_PARAM_STR(s2)
+ ZEND_PARSE_PARAMETERS_END();
RETURN_LONG(strcoll((const char *) ZSTR_VAL(s1),
(const char *) ZSTR_VAL(s2)));
@@ -785,113 +791,114 @@ static inline int php_charmask(unsigned char *input, size_t len, char *mask)
}
/* }}} */
-/* {{{ php_trim()
+/* {{{ php_trim_int()
* mode 1 : trim left
* mode 2 : trim right
* mode 3 : trim left and right
* what indicates which chars are to be trimmed. NULL->default (' \t\n\r\v\0')
*/
-PHPAPI zend_string *php_trim(zend_string *str, char *what, size_t what_len, int mode)
+static zend_always_inline zend_string *php_trim_int(zend_string *str, char *what, size_t what_len, int mode)
{
- const char *c = ZSTR_VAL(str);
- size_t len = ZSTR_LEN(str);
- register size_t i;
- size_t trimmed = 0;
+ const char *start = ZSTR_VAL(str);
+ const char *end = start + ZSTR_LEN(str);
char mask[256];
if (what) {
if (what_len == 1) {
char p = *what;
if (mode & 1) {
- for (i = 0; i < len; i++) {
- if (c[i] == p) {
- trimmed++;
+ while (start != end) {
+ if (*start == p) {
+ start++;
} else {
break;
}
}
- len -= trimmed;
- c += trimmed;
}
if (mode & 2) {
- if (len > 0) {
- i = len - 1;
- do {
- if (c[i] == p) {
- len--;
- } else {
- break;
- }
- } while (i-- != 0);
+ while (start != end) {
+ if (*(end-1) == p) {
+ end--;
+ } else {
+ break;
+ }
}
}
} else {
php_charmask((unsigned char*)what, what_len, mask);
if (mode & 1) {
- for (i = 0; i < len; i++) {
- if (mask[(unsigned char)c[i]]) {
- trimmed++;
+ while (start != end) {
+ if (mask[(unsigned char)*start]) {
+ start++;
} else {
break;
}
}
- len -= trimmed;
- c += trimmed;
}
if (mode & 2) {
- if (len > 0) {
- i = len - 1;
- do {
- if (mask[(unsigned char)c[i]]) {
- len--;
- } else {
- break;
- }
- } while (i-- != 0);
+ while (start != end) {
+ if (mask[(unsigned char)*(end-1)]) {
+ end--;
+ } else {
+ break;
+ }
}
}
}
} else {
if (mode & 1) {
- for (i = 0; i < len; i++) {
- if ((unsigned char)c[i] <= ' ' &&
- (c[i] == ' ' || c[i] == '\n' || c[i] == '\r' || c[i] == '\t' || c[i] == '\v' || c[i] == '\0')) {
- trimmed++;
+ while (start != end) {
+ unsigned char c = (unsigned char)*start;
+
+ if (c <= ' ' &&
+ (c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == '\v' || c == '\0')) {
+ start++;
} else {
break;
}
}
- len -= trimmed;
- c += trimmed;
}
if (mode & 2) {
- if (len > 0) {
- i = len - 1;
- do {
- if ((unsigned char)c[i] <= ' ' &&
- (c[i] == ' ' || c[i] == '\n' || c[i] == '\r' || c[i] == '\t' || c[i] == '\v' || c[i] == '\0')) {
- len--;
- } else {
- break;
- }
- } while (i-- != 0);
+ while (start != end) {
+ unsigned char c = (unsigned char)*(end-1);
+
+ if (c <= ' ' &&
+ (c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == '\v' || c == '\0')) {
+ end--;
+ } else {
+ break;
+ }
}
}
}
- if (ZSTR_LEN(str) == len) {
+ if (ZSTR_LEN(str) == end - start) {
return zend_string_copy(str);
+ } else if (end - start == 0) {
+ return ZSTR_EMPTY_ALLOC();
} else {
- return zend_string_init(c, len, 0);
+ return zend_string_init(start, end - start, 0);
}
}
/* }}} */
+/* {{{ php_trim_int()
+ * mode 1 : trim left
+ * mode 2 : trim right
+ * mode 3 : trim left and right
+ * what indicates which chars are to be trimmed. NULL->default (' \t\n\r\v\0')
+ */
+PHPAPI zend_string *php_trim(zend_string *str, char *what, size_t what_len, int mode)
+{
+ return php_trim_int(str, what, what_len, mode);
+}
+/* }}} */
+
/* {{{ php_do_trim
* Base for trim(), rtrim() and ltrim() functions.
*/
-static void php_do_trim(INTERNAL_FUNCTION_PARAMETERS, int mode)
+static zend_always_inline void php_do_trim(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
zend_string *str;
zend_string *what = NULL;
@@ -902,7 +909,7 @@ static void php_do_trim(INTERNAL_FUNCTION_PARAMETERS, int mode)
Z_PARAM_STR(what)
ZEND_PARSE_PARAMETERS_END();
- ZVAL_STR(return_value, php_trim(str, (what ? ZSTR_VAL(what) : NULL), (what ? ZSTR_LEN(what) : 0), mode));
+ ZVAL_STR(return_value, php_trim_int(str, (what ? ZSTR_VAL(what) : NULL), (what ? ZSTR_LEN(what) : 0), mode));
}
/* }}} */
@@ -943,9 +950,13 @@ PHP_FUNCTION(wordwrap)
zend_bool docut = 0;
zend_string *newtext;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|lsb", &text, &linelength, &breakchar, &breakchar_len, &docut) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 4)
+ Z_PARAM_STR(text)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(linelength)
+ Z_PARAM_STRING(breakchar, breakchar_len)
+ Z_PARAM_BOOL(docut)
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(text) == 0) {
RETURN_EMPTY_STRING();
@@ -1084,7 +1095,15 @@ PHPAPI void php_explode(const zend_string *delim, zend_string *str, zval *return
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp);
} else {
do {
- ZVAL_STRINGL(&tmp, p1, p2 - p1);
+ size_t l = p2 - p1;
+
+ if (l == 0) {
+ ZVAL_EMPTY_STRING(&tmp);
+ } else if (l == 1) {
+ ZVAL_INTERNED_STR(&tmp, ZSTR_CHAR((zend_uchar)(*p1)));
+ } else {
+ ZVAL_STRINGL(&tmp, p1, p2 - p1);
+ }
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp);
p1 = p2 + ZSTR_LEN(delim);
p2 = (char *) php_memnstr(p1, ZSTR_VAL(delim), ZSTR_LEN(delim), endp);
@@ -1187,7 +1206,7 @@ PHP_FUNCTION(explode)
/* {{{ php_implode
*/
-PHPAPI void php_implode(const zend_string *delim, zval *arr, zval *return_value)
+PHPAPI void php_implode(const zend_string *glue, zval *pieces, zval *return_value)
{
zval *tmp;
int numelems;
@@ -1196,13 +1215,13 @@ PHPAPI void php_implode(const zend_string *delim, zval *arr, zval *return_value)
size_t len = 0;
zend_string **strings, **strptr;
- numelems = zend_hash_num_elements(Z_ARRVAL_P(arr));
+ numelems = zend_hash_num_elements(Z_ARRVAL_P(pieces));
if (numelems == 0) {
RETURN_EMPTY_STRING();
} else if (numelems == 1) {
/* loop to search the first not undefined element... */
- ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(arr), tmp) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pieces), tmp) {
RETURN_STR(zval_get_string(tmp));
} ZEND_HASH_FOREACH_END();
}
@@ -1210,7 +1229,7 @@ PHPAPI void php_implode(const zend_string *delim, zval *arr, zval *return_value)
strings = emalloc((sizeof(zend_long) + sizeof(zend_string *)) * numelems);
strptr = strings - 1;
- ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(arr), tmp) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pieces), tmp) {
if (Z_TYPE_P(tmp) == IS_LONG) {
zend_long val = Z_LVAL_P(tmp);
@@ -1229,7 +1248,7 @@ PHPAPI void php_implode(const zend_string *delim, zval *arr, zval *return_value)
}
} ZEND_HASH_FOREACH_END();
/* numelems can not be 0, we checked above */
- str = zend_string_safe_alloc(numelems - 1, ZSTR_LEN(delim), len, 0);
+ str = zend_string_safe_alloc(numelems - 1, ZSTR_LEN(glue), len, 0);
cptr = ZSTR_VAL(str) + ZSTR_LEN(str);
*cptr = 0;
@@ -1246,8 +1265,8 @@ PHPAPI void php_implode(const zend_string *delim, zval *arr, zval *return_value)
*oldPtr = oldVal;
}
- cptr -= ZSTR_LEN(delim);
- memcpy(cptr, ZSTR_VAL(delim), ZSTR_LEN(delim));
+ cptr -= ZSTR_LEN(glue);
+ memcpy(cptr, ZSTR_VAL(glue), ZSTR_LEN(glue));
} while (--strptr > strings);
if (*strptr) {
@@ -1269,8 +1288,8 @@ PHPAPI void php_implode(const zend_string *delim, zval *arr, zval *return_value)
Joins array elements placing glue string between items and return one string */
PHP_FUNCTION(implode)
{
- zval *arg1, *arg2 = NULL, *arr;
- zend_string *delim;
+ zval *arg1, *arg2 = NULL, *pieces;
+ zend_string *glue;
ZEND_PARSE_PARAMETERS_START(1, 2)
Z_PARAM_ZVAL(arg1)
@@ -1284,23 +1303,23 @@ PHP_FUNCTION(implode)
return;
}
- delim = ZSTR_EMPTY_ALLOC();
- arr = arg1;
+ glue = ZSTR_EMPTY_ALLOC();
+ pieces = arg1;
} else {
if (Z_TYPE_P(arg1) == IS_ARRAY) {
- delim = zval_get_string(arg2);
- arr = arg1;
+ glue = zval_get_string(arg2);
+ pieces = arg1;
} else if (Z_TYPE_P(arg2) == IS_ARRAY) {
- delim = zval_get_string(arg1);
- arr = arg2;
+ glue = zval_get_string(arg1);
+ pieces = arg2;
} else {
php_error_docref(NULL, E_WARNING, "Invalid arguments passed");
return;
}
}
- php_implode(delim, arr, return_value);
- zend_string_release(delim);
+ php_implode(glue, pieces, return_value);
+ zend_string_release(glue);
}
/* }}} */
@@ -1533,7 +1552,7 @@ PHPAPI zend_string *php_basename(const char *s, size_t len, char *suffix, size_t
case 0:
goto quit_loop;
case 1:
-#if defined(PHP_WIN32) || defined(NETWARE)
+#if defined(PHP_WIN32)
if (*c == '/' || *c == '\\') {
#else
if (*c == '/') {
@@ -1542,7 +1561,7 @@ PHPAPI zend_string *php_basename(const char *s, size_t len, char *suffix, size_t
state = 0;
cend = c;
}
-#if defined(PHP_WIN32) || defined(NETWARE)
+#if defined(PHP_WIN32)
/* Catch relative paths in c:file.txt style. They're not to confuse
with the NTFS streams. This part ensures also, that no drive
letter traversing happens. */
@@ -1596,9 +1615,11 @@ PHP_FUNCTION(basename)
char *string, *suffix = NULL;
size_t string_len, suffix_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &string, &string_len, &suffix, &suffix_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(string, string_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(suffix, suffix_len)
+ ZEND_PARSE_PARAMETERS_END();
RETURN_STR(php_basename(string, string_len, suffix, suffix_len));
}
@@ -1621,9 +1642,11 @@ PHP_FUNCTION(dirname)
zend_string *ret;
zend_long levels = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &str, &str_len, &levels) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(levels)
+ ZEND_PARSE_PARAMETERS_END();
ret = zend_string_init(str, str_len, 0);
@@ -1664,9 +1687,11 @@ PHP_FUNCTION(pathinfo)
zend_long opt = PHP_PATHINFO_ALL;
zend_string *ret = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &path, &path_len, &opt) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(path, path_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(opt)
+ ZEND_PARSE_PARAMETERS_END();
have_basename = ((opt & PHP_PATHINFO_BASENAME) == PHP_PATHINFO_BASENAME);
@@ -1824,9 +1849,12 @@ PHP_FUNCTION(stristr)
char needle_char[2];
zend_bool part = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|b", &haystack, &needle, &part) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STR(haystack)
+ Z_PARAM_ZVAL(needle)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(part)
+ ZEND_PARSE_PARAMETERS_END();
haystack_dup = estrndup(ZSTR_VAL(haystack), ZSTR_LEN(haystack));
@@ -1876,9 +1904,12 @@ PHP_FUNCTION(strstr)
zend_long found_offset;
zend_bool part = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|b", &haystack, &needle, &part) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STR(haystack)
+ Z_PARAM_ZVAL(needle)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(part)
+ ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE_P(needle) == IS_STRING) {
if (!Z_STRLEN_P(needle)) {
@@ -1978,9 +2009,12 @@ PHP_FUNCTION(stripos)
zval *needle;
zend_string *needle_dup = NULL, *haystack_dup;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|l", &haystack, &needle, &offset) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STR(haystack)
+ Z_PARAM_ZVAL(needle)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(offset)
+ ZEND_PARSE_PARAMETERS_END();
if (offset < 0) {
offset += (zend_long)ZSTR_LEN(haystack);
@@ -2106,10 +2140,12 @@ PHP_FUNCTION(strripos)
zend_string *needle_dup, *haystack_dup, *ord_needle = NULL;
ALLOCA_FLAG(use_heap);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|l", &haystack, &zneedle, &offset) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STR(haystack)
+ Z_PARAM_ZVAL(zneedle)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(offset)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
ZSTR_ALLOCA_ALLOC(ord_needle, 1, use_heap);
if (Z_TYPE_P(zneedle) == IS_STRING) {
@@ -2210,9 +2246,10 @@ PHP_FUNCTION(strrchr)
const char *found = NULL;
zend_long found_offset;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &haystack, &needle) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_STR(haystack)
+ Z_PARAM_ZVAL(needle)
+ ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE_P(needle) == IS_STRING) {
found = zend_memrchr(ZSTR_VAL(haystack), *Z_STRVAL_P(needle), ZSTR_LEN(haystack));
@@ -2294,9 +2331,12 @@ PHP_FUNCTION(chunk_split)
zend_long chunklen = 76;
zend_string *result;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|ls", &str, &chunklen, &end, &endlen) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_STR(str)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(chunklen)
+ Z_PARAM_STRING(end, endlen)
+ ZEND_PARSE_PARAMETERS_END();
if (chunklen <= 0) {
php_error_docref(NULL, E_WARNING, "Chunk length should be greater than zero");
@@ -2389,6 +2429,14 @@ PHP_FUNCTION(substr)
l = ZSTR_LEN(str) - f;
}
+ if (l == 0) {
+ RETURN_EMPTY_STRING();
+ } else if (l == 1) {
+ RETURN_INTERNED_STR(ZSTR_CHAR((zend_uchar)(ZSTR_VAL(str)[f])));
+ } else if (l == ZSTR_LEN(str)) {
+ RETURN_STR_COPY(str);
+ }
+
RETURN_STRINGL(ZSTR_VAL(str) + f, l);
}
/* }}} */
@@ -2408,9 +2456,13 @@ PHP_FUNCTION(substr_replace)
HashPosition from_idx, repl_idx, len_idx;
zval *tmp_str = NULL, *tmp_from = NULL, *tmp_repl = NULL, *tmp_len= NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zzz|z/", &str, &repl, &from, &len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(3, 4)
+ Z_PARAM_ZVAL(str)
+ Z_PARAM_ZVAL(repl)
+ Z_PARAM_ZVAL(from)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL(len)
+ ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE_P(str) != IS_ARRAY) {
convert_to_string_ex(str);
@@ -2660,9 +2712,9 @@ PHP_FUNCTION(quotemeta)
char c;
zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &old) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(old)
+ ZEND_PARSE_PARAMETERS_END();
old_end = ZSTR_VAL(old) + ZSTR_LEN(old);
@@ -2731,13 +2783,7 @@ PHP_FUNCTION(chr)
ZEND_PARSE_PARAMETERS_END_EX(c = 0);
c &= 0xff;
- if (CG(one_char_string)[c]) {
- ZVAL_INTERNED_STR(return_value, CG(one_char_string)[c]);
- } else {
- ZVAL_NEW_STR(return_value, zend_string_alloc(1, 0));
- Z_STRVAL_P(return_value)[0] = (char)c;
- Z_STRVAL_P(return_value)[1] = '\0';
- }
+ ZVAL_INTERNED_STR(return_value, ZSTR_CHAR(c));
}
/* }}} */
@@ -2786,9 +2832,9 @@ PHP_FUNCTION(lcfirst)
{
zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(str)
+ ZEND_PARSE_PARAMETERS_END();
if (!ZSTR_LEN(str)) {
RETURN_EMPTY_STRING();
@@ -3198,7 +3244,14 @@ static zend_string *php_str_to_str_ex(zend_string *haystack,
nothing_todo:
return zend_string_copy(haystack);
} else {
- new_str = zend_string_init(str, str_len, 0);
+ if (str_len == 0) {
+ new_str = ZSTR_EMPTY_ALLOC();
+ } else if (str_len == 1) {
+ new_str = ZSTR_CHAR((zend_uchar)(*str));
+ } else {
+ new_str = zend_string_init(str, str_len, 0);
+ }
+
(*replace_count)++;
return new_str;
}
@@ -3457,9 +3510,9 @@ PHP_FUNCTION(strrev)
char *e, *p;
zend_string *n;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(str)
+ ZEND_PARSE_PARAMETERS_END();
n = zend_string_alloc(ZSTR_LEN(str), 0);
p = ZSTR_VAL(n);
@@ -3531,9 +3584,12 @@ PHP_FUNCTION(similar_text)
int ac = ZEND_NUM_ARGS();
size_t sim;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|z/", &t1, &t2, &percent) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STR(t1)
+ Z_PARAM_STR(t2)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF(percent)
+ ZEND_PARSE_PARAMETERS_END();
if (ac > 2) {
convert_to_double_ex(percent);
@@ -3600,9 +3656,10 @@ PHP_FUNCTION(addcslashes)
{
zend_string *str, *what;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &str, &what) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_STR(str)
+ Z_PARAM_STR(what)
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(str) == 0) {
RETURN_EMPTY_STRING();
@@ -3640,9 +3697,9 @@ PHP_FUNCTION(stripcslashes)
{
zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(str)
+ ZEND_PARSE_PARAMETERS_END();
ZVAL_STRINGL(return_value, ZSTR_VAL(str), ZSTR_LEN(str));
php_stripcslashes(Z_STR_P(return_value));
@@ -3655,9 +3712,9 @@ PHP_FUNCTION(stripslashes)
{
zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(str)
+ ZEND_PARSE_PARAMETERS_END();
ZVAL_STRINGL(return_value, ZSTR_VAL(str), ZSTR_LEN(str));
php_stripslashes(Z_STR_P(return_value));
@@ -4047,7 +4104,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit
Z_PARAM_ZVAL(replace)
Z_PARAM_ZVAL(subject)
Z_PARAM_OPTIONAL
- Z_PARAM_ZVAL_EX(zcount, 0, 1)
+ Z_PARAM_ZVAL_DEREF(zcount)
ZEND_PARSE_PARAMETERS_END();
/* Make sure we're dealing with strings and do the replacement. */
@@ -4121,9 +4178,11 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
size_t str_len;
zend_string *broken_str;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &str, &str_len, &max_chars) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(max_chars)
+ ZEND_PARSE_PARAMETERS_END();
if (str_len == 0) {
RETURN_FALSE;
@@ -4387,9 +4446,11 @@ PHP_FUNCTION(strip_tags)
char *allowed_tags=NULL;
size_t allowed_tags_len=0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|z", &str, &allow) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STR(str)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL(allow)
+ ZEND_PARSE_PARAMETERS_END();
/* To maintain a certain BC, we allow anything for the second parameter and return original string */
if (allow) {
@@ -4416,9 +4477,10 @@ PHP_FUNCTION(setlocale)
int num_args, i = 0;
uint32_t idx;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l+", &cat, &args, &num_args) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, -1)
+ Z_PARAM_LONG(cat)
+ Z_PARAM_VARIADIC('+', args, num_args)
+ ZEND_PARSE_PARAMETERS_END();
#ifdef HAVE_SETLOCALE
idx = 0;
@@ -4494,7 +4556,7 @@ PHP_FUNCTION(setlocale)
}
/* }}} */
-/* {{{ proto void parse_str(string encoded_string [, array result])
+/* {{{ proto void parse_str(string encoded_string [, array &result])
Parses GET/POST/COOKIE data and sets global variables */
PHP_FUNCTION(parse_str)
{
@@ -4503,9 +4565,11 @@ PHP_FUNCTION(parse_str)
char *res = NULL;
size_t arglen;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z/", &arg, &arglen, &arrayArg) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(arg, arglen)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF(arrayArg)
+ ZEND_PARSE_PARAMETERS_END();
res = estrndup(arg, arglen);
@@ -4517,20 +4581,19 @@ PHP_FUNCTION(parse_str)
return;
}
+ php_error_docref(NULL, E_DEPRECATED, "Calling parse_str() without the result argument is deprecated");
+
symbol_table = zend_rebuild_symbol_table();
ZVAL_ARR(&tmp, symbol_table);
sapi_module.treat_data(PARSE_STRING, res, &tmp);
- if (UNEXPECTED(zend_hash_del(symbol_table, CG(known_strings)[ZEND_STR_THIS]) == SUCCESS)) {
+ if (UNEXPECTED(zend_hash_del(symbol_table, ZSTR_KNOWN(ZEND_STR_THIS)) == SUCCESS)) {
zend_throw_error(NULL, "Cannot re-assign $this");
}
} else {
- zval ret;
-
/* Clear out the array that was passed in. */
- zval_dtor(arrayArg);
- array_init(&ret);
- sapi_module.treat_data(PARSE_STRING, res, &ret);
- ZVAL_COPY_VALUE(arrayArg, &ret);
+ zval_ptr_dtor(arrayArg);
+ array_init(arrayArg);
+ sapi_module.treat_data(PARSE_STRING, res, arrayArg);
}
}
/* }}} */
@@ -4601,7 +4664,7 @@ int php_tag_find(char *tag, size_t len, const char *set) {
}
/* }}} */
-PHPAPI size_t php_strip_tags(char *rbuf, size_t len, int *stateptr, const char *allow, size_t allow_len) /* {{{ */
+PHPAPI size_t php_strip_tags(char *rbuf, size_t len, uint8_t *stateptr, const char *allow, size_t allow_len) /* {{{ */
{
return php_strip_tags_ex(rbuf, len, stateptr, allow, allow_len, 0);
}
@@ -4627,11 +4690,11 @@ PHPAPI size_t php_strip_tags(char *rbuf, size_t len, int *stateptr, const char *
swm: Added ability to strip <?xml tags without assuming it PHP
code.
*/
-PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, int *stateptr, const char *allow, size_t allow_len, zend_bool allow_tag_spaces)
+PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, uint8_t *stateptr, const char *allow, size_t allow_len, zend_bool allow_tag_spaces)
{
char *tbuf, *buf, *p, *tp, *rp, c, lc;
int br, depth=0, in_q = 0;
- int state = 0;
+ uint8_t state = 0;
size_t pos, i = 0;
char *allow_free = NULL;
const char *allow_actual;
@@ -4912,10 +4975,13 @@ PHP_FUNCTION(str_getcsv)
char *delim_str = NULL, *enc_str = NULL, *esc_str = NULL;
size_t delim_len = 0, enc_len = 0, esc_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|sss", &str, &delim_str, &delim_len,
- &enc_str, &enc_len, &esc_str, &esc_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 4)
+ Z_PARAM_STR(str)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(delim_str, delim_len)
+ Z_PARAM_STRING(enc_str, enc_len)
+ Z_PARAM_STRING(esc_str, esc_len)
+ ZEND_PARSE_PARAMETERS_END();
delim = delim_len ? delim_str[0] : delim;
enc = enc_len ? enc_str[0] : enc;
@@ -4934,9 +5000,10 @@ PHP_FUNCTION(str_repeat)
zend_string *result; /* Resulting string */
size_t result_len; /* Length of the resulting string */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl", &input_str, &mult) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_STR(input_str)
+ Z_PARAM_LONG(mult)
+ ZEND_PARSE_PARAMETERS_END();
if (mult < 0) {
php_error_docref(NULL, E_WARNING, "Second argument has to be greater than or equal to 0");
@@ -4989,9 +5056,11 @@ PHP_FUNCTION(count_chars)
size_t retlen=0;
size_t tmp = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|l", &input, &mymode) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STR(input)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(mymode)
+ ZEND_PARSE_PARAMETERS_END();
if (mymode < 0 || mymode > 4) {
php_error_docref(NULL, E_WARNING, "Unknown mode");
@@ -5051,9 +5120,10 @@ static void php_strnatcmp(INTERNAL_FUNCTION_PARAMETERS, int fold_case)
{
zend_string *s1, *s2;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &s1, &s2) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_STR(s1)
+ Z_PARAM_STR(s2)
+ ZEND_PARSE_PARAMETERS_END();
RETURN_LONG(strnatcmp_ex(ZSTR_VAL(s1), ZSTR_LEN(s1),
ZSTR_VAL(s2), ZSTR_LEN(s2),
@@ -5196,9 +5266,13 @@ PHP_FUNCTION(substr_count)
size_t haystack_len, needle_len;
char *p, *endp, cmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ll", &haystack, &haystack_len, &needle, &needle_len, &offset, &length) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 4)
+ Z_PARAM_STRING(haystack, haystack_len)
+ Z_PARAM_STRING(needle, needle_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(offset)
+ Z_PARAM_LONG(length)
+ ZEND_PARSE_PARAMETERS_END();
if (needle_len == 0) {
php_error_docref(NULL, E_WARNING, "Empty substring");
@@ -5263,9 +5337,13 @@ PHP_FUNCTION(str_pad)
size_t i, left_pad=0, right_pad=0;
zend_string *result = NULL; /* Resulting string */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl|sl", &input, &pad_length, &pad_str, &pad_str_len, &pad_type_val) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 4)
+ Z_PARAM_STR(input)
+ Z_PARAM_LONG(pad_length)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(pad_str, pad_str_len)
+ Z_PARAM_LONG(pad_type_val)
+ ZEND_PARSE_PARAMETERS_END();
/* If resulting string turns out to be shorter than input string,
we simply copy the input and return. */
@@ -5337,10 +5415,11 @@ PHP_FUNCTION(sscanf)
size_t str_len, format_len;
int result, num_args = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss*", &str, &str_len, &format, &format_len,
- &args, &num_args) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, -1)
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_STRING(format, format_len)
+ Z_PARAM_VARIADIC('*', args, num_args)
+ ZEND_PARSE_PARAMETERS_END();
result = php_sscanf_internal(str, format, num_args, args, 0, return_value);
@@ -5359,9 +5438,9 @@ PHP_FUNCTION(str_rot13)
{
zend_string *arg;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &arg) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(arg)
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(arg) == 0) {
RETURN_EMPTY_STRING();
@@ -5403,9 +5482,9 @@ PHP_FUNCTION(str_shuffle)
{
zend_string *arg;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &arg) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(arg)
+ ZEND_PARSE_PARAMETERS_END();
RETVAL_STRINGL(ZSTR_VAL(arg), ZSTR_LEN(arg));
if (Z_STRLEN_P(return_value) > 1) {
@@ -5432,9 +5511,12 @@ PHP_FUNCTION(str_word_count)
size_t char_list_len = 0, word_count = 0;
zend_long type = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|ls", &str, &type, &char_list, &char_list_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_STR(str)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(type)
+ Z_PARAM_STRING(char_list, char_list_len)
+ ZEND_PARSE_PARAMETERS_END();
switch(type) {
case 1:
@@ -5512,9 +5594,10 @@ PHP_FUNCTION(money_format)
zend_string *str;
ssize_t res_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sd", &format, &format_len, &value) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_STRING(format, format_len)
+ Z_PARAM_DOUBLE(value)
+ ZEND_PARSE_PARAMETERS_END();
p = format;
e = p + format_len;
@@ -5560,9 +5643,11 @@ PHP_FUNCTION(str_split)
char *p;
size_t n_reg_segments;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|l", &str, &split_length) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STR(str)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(split_length)
+ ZEND_PARSE_PARAMETERS_END();
if (split_length <= 0) {
php_error_docref(NULL, E_WARNING, "The length of each segment must be greater than zero");
@@ -5599,9 +5684,10 @@ PHP_FUNCTION(strpbrk)
zend_string *haystack, *char_list;
char *haystack_ptr, *cl_ptr;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &haystack, &char_list) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_STR(haystack)
+ Z_PARAM_STR(char_list)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (!ZSTR_LEN(char_list)) {
php_error_docref(NULL, E_WARNING, "The character list cannot be empty");
@@ -5630,9 +5716,14 @@ PHP_FUNCTION(substr_compare)
zend_bool cs=0;
size_t cmp_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "SSl|l!b", &s1, &s2, &offset, &len, &len_is_default, &cs) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(3, 5)
+ Z_PARAM_STR(s1)
+ Z_PARAM_STR(s2)
+ Z_PARAM_LONG(offset)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG_EX(len, len_is_default, 1, 0)
+ Z_PARAM_BOOL(cs)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (!len_is_default && len <= 0) {
if (len == 0) {
@@ -5663,6 +5754,98 @@ PHP_FUNCTION(substr_compare)
}
/* }}} */
+/* {{{ */
+static zend_string *php_utf8_encode(const char *s, size_t len)
+{
+ size_t pos = len;
+ zend_string *str;
+ unsigned char c;
+
+ str = zend_string_safe_alloc(len, 2, 0, 0);
+ ZSTR_LEN(str) = 0;
+ while (pos > 0) {
+ /* The lower 256 codepoints of Unicode are identical to Latin-1,
+ * so we don't need to do any mapping here. */
+ c = (unsigned char)(*s);
+ if (c < 0x80) {
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = (char) c;
+ /* We only account for the single-byte and two-byte cases because
+ * we're only dealing with the first 256 Unicode codepoints. */
+ } else {
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = (0xc0 | (c >> 6));
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = (0x80 | (c & 0x3f));
+ }
+ pos--;
+ s++;
+ }
+ ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
+ str = zend_string_truncate(str, ZSTR_LEN(str), 0);
+ return str;
+}
+/* }}} */
+
+/* {{{ */
+static zend_string *php_utf8_decode(const char *s, size_t len)
+{
+ size_t pos = 0;
+ unsigned int c;
+ zend_string *str;
+
+ str = zend_string_alloc(len, 0);
+ ZSTR_LEN(str) = 0;
+ while (pos < len) {
+ int status = FAILURE;
+ c = php_next_utf8_char((const unsigned char*)s, (size_t) len, &pos, &status);
+
+ /* The lower 256 codepoints of Unicode are identical to Latin-1,
+ * so we don't need to do any mapping here beyond replacing non-Latin-1
+ * characters. */
+ if (status == FAILURE || c > 0xFFU) {
+ c = '?';
+ }
+
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = c;
+ }
+ ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
+ if (ZSTR_LEN(str) < len) {
+ str = zend_string_truncate(str, ZSTR_LEN(str), 0);
+ }
+
+ return str;
+}
+/* }}} */
+
+
+/* {{{ proto string utf8_encode(string data)
+ Encodes an ISO-8859-1 string to UTF-8 */
+PHP_FUNCTION(utf8_encode)
+{
+ char *arg;
+ size_t arg_len;
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(arg, arg_len)
+ ZEND_PARSE_PARAMETERS_END();
+
+ RETURN_STR(php_utf8_encode(arg, arg_len));
+}
+/* }}} */
+
+/* {{{ proto string utf8_decode(string data)
+ Converts a UTF-8 encoded string to ISO-8859-1 */
+PHP_FUNCTION(utf8_decode)
+{
+ char *arg;
+ size_t arg_len;
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(arg, arg_len)
+ ZEND_PARSE_PARAMETERS_END();
+
+ RETURN_STR(php_utf8_decode(arg, arg_len));
+}
+/* }}} */
+
/*
* Local variables:
* tab-width: 4
diff --git a/ext/standard/strnatcmp.c b/ext/standard/strnatcmp.c
index a272be8a29..ac8d2a2e91 100644
--- a/ext/standard/strnatcmp.c
+++ b/ext/standard/strnatcmp.c
@@ -30,16 +30,6 @@
#include "php.h"
#include "php_string.h"
-#if defined(__GNUC__)
-# define UNUSED __attribute__((__unused__))
-#else
-# define UNUSED
-#endif
-
-#if 0
-static char const *version UNUSED =
- "$Id$";
-#endif
/* {{{ compare_right
*/
static int
diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c
index fecbc6fe65..b1a5489cb9 100644
--- a/ext/standard/syslog.c
+++ b/ext/standard/syslog.c
@@ -12,7 +12,7 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
+ | Author: Stig Sæther Bakken <ssb@php.net> |
+----------------------------------------------------------------------+
*/
@@ -138,10 +138,12 @@ PHP_FUNCTION(openlog)
zend_long option, facility;
size_t ident_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sll", &ident,
- &ident_len, &option, &facility) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(3, 3)
+ Z_PARAM_STRING(ident, ident_len)
+ Z_PARAM_LONG(option)
+ Z_PARAM_LONG(facility)
+ ZEND_PARSE_PARAMETERS_END();
+
if (BG(syslog_device)) {
free(BG(syslog_device));
}
@@ -179,10 +181,10 @@ PHP_FUNCTION(syslog)
char *message;
size_t message_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &priority,
- &message, &message_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_LONG(priority)
+ Z_PARAM_STRING(message, message_len)
+ ZEND_PARSE_PARAMETERS_END();
php_syslog(priority, "%s", message);
RETURN_TRUE;
diff --git a/ext/standard/tests/array/array_diff_ukey_variation10.phpt b/ext/standard/tests/array/array_diff_ukey_variation10.phpt
index 0d93928d86..58a040b0a7 100644
--- a/ext/standard/tests/array/array_diff_ukey_variation10.phpt
+++ b/ext/standard/tests/array/array_diff_ukey_variation10.phpt
@@ -33,7 +33,7 @@ NULL
Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
NULL
-Notice: Use of undefined constant unknown_function - assumed 'unknown_function' in %s on line %d
+Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d
Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
NULL
diff --git a/ext/standard/tests/array/array_fill_object.phpt b/ext/standard/tests/array/array_fill_object.phpt
index 86773b17f8..aa1db044cc 100644
--- a/ext/standard/tests/array/array_fill_object.phpt
+++ b/ext/standard/tests/array/array_fill_object.phpt
@@ -1,7 +1,5 @@
--TEST--
Test array_fill() function : usage variations - various object values for 'val' argument
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.4.0', '>=')) die('skip ZendEngine 2.3 or below needed'); ?>
--FILE--
<?php
/* Prototype : array array_fill(int $start_key, int $num, mixed $val)
@@ -290,23 +288,23 @@ array(2) {
object(Child_test2)#%d (4) {
["member1":"Child_test2":private]=>
int(102)
- ["member1":"Test2":private]=>
- int(100)
["var1"]=>
int(30)
["var2"]=>
int(101)
+ ["member1":"Test2":private]=>
+ int(100)
}
[1]=>
object(Child_test2)#%d (4) {
["member1":"Child_test2":private]=>
int(102)
- ["member1":"Test2":private]=>
- int(100)
["var1"]=>
int(30)
["var2"]=>
int(101)
+ ["member1":"Test2":private]=>
+ int(100)
}
}
-- Iteration 6 --
diff --git a/ext/standard/tests/array/array_fill_object_2_4.phpt b/ext/standard/tests/array/array_fill_object_2_4.phpt
deleted file mode 100644
index fb8179766c..0000000000
--- a/ext/standard/tests/array/array_fill_object_2_4.phpt
+++ /dev/null
@@ -1,434 +0,0 @@
---TEST--
-Test array_fill() function : usage variations - various object values for 'val' argument
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.4.0', '<')) die('skip ZendEngine 2.4 needed'); ?>
---FILE--
-<?php
-/* Prototype : array array_fill(int $start_key, int $num, mixed $val)
- * Description: Create an array containing num elements starting with index start_key each initialized to val
- * Source code: ext/standard/array.c
- */
-
-/*
- * testing array_fill() by passing various object values for 'val' argument
- */
-
-echo "*** Testing array_fill() : usage variations ***\n";
-
-// Initialise function arguments not being substituted
-$start_key = 0;
-$num = 2;
-
-// class without a member
-class Test
-{
-}
-
-//class with public member, static member , constant and consturctor to initialize the public member
-class Test1
-{
- const test1_constant = "test1";
- public static $test1_static = 0;
- public $member1;
- var $var1 = 30;
- var $var2;
-
- function __construct($value1 , $value2)
- {
- $this->member1 = $value1;
- $this->var2 = $value2;
- }
-}
-
-// child class which inherits parent class test1
-class Child_test1 extends Test1
-{
- public $member2;
-
- function __construct($value1 , $value2 , $value3)
- {
- parent::__construct($value1 , $value2);
- $this->member2 = $value3;
- }
-}
-
-//class with private member, static member, constant and constructor to initialize the private member
-class Test2
-{
- const test2_constant = "test2";
- public static $test2_static = 0;
- private $member1;
- var $var1 = 30;
- var $var2;
-
- function __construct($value1 , $value2)
- {
- $this->member1 = $value1;
- $this->var2 = $value2;
- }
-}
-
-// child class which inherits parent class test2
-class Child_test2 extends Test2
-{
- private $member1;
-
- function __construct($value1 , $value2 , $value3)
- {
- parent::__construct($value1 , $value2);
- $this->member1 = $value3;
- }
-}
-
-// class with protected member, static member, constant and consturctor to initialize the protected member
-class Test3
-{
- const test3_constant = "test3";
- public static $test3_static = 0;
- protected $member1;
- var $var1 = 30;
- var $var2;
-
- function __construct($value1 , $value2)
- {
- $this->member1 = $value1;
- $this->var2 = $value2;
- }
-}
-
-// child class which inherits parent class test3
-class Child_test3 extends Test3
-{
- protected $member1;
-
- function __construct($value1 , $value2 , $value3)
- {
- parent::__construct($value1 , $value2);
- $this->member1 = $value3;
- }
-}
-
-// class with public, private, protected members, static, constant members and constructor to initialize all the members
-class Test4
-{
- const test4_constant = "test4";
- public static $test4_static = 0;
- public $member1;
- private $member2;
- protected $member3;
-
- function __construct($value1 , $value2 , $value3)
- {
- $this->member1 = $value1;
- $this->member2 = $value2;
- $this->member3 = $value3;
- }
-}
-
-// child class which inherits parent class test4
-class Child_test4 extends Test4
-{
- var $var1;
-
- function __construct($value1 , $value2 , $value3 , $value4)
- {
- parent::__construct($value1 , $value2 , $value3);
- $this->var1 = $value4;
- }
-}
-
-// abstract class with public, private, protected members
-abstract class AbstractClass
-{
- public $member1;
- private $member2;
- protected $member3;
- var $var1 = 30;
-
- abstract protected function display();
-}
-
-// implement abstract 'AbstractClass' class
-class ConcreteClass1 extends AbstractClass
-{
- protected function display()
- {
- echo "class name is ConcreteClass1 \n";
- }
-}
-
-
-// declarationn of the interface 'iTemplate'
-interface iTemplate
-{
- public function display();
-}
-
-// implement the interface 'iTemplate'
-class Template1 implements iTemplate
-{
- public function display()
- {
- echo "class name is Template1\n";
- }
-}
-
-//array of object values for 'val' argument
-$objects = array(
-
- /* 1 */ new Test(),
- new Test1(100 , 101),
- new Child_test1(100 , 101 , 102),
- new Test2(100 , 101),
- /* 5 */ new Child_test2(100 , 101 , 102),
- new Test3(100 , 101),
- new Child_test3(100 , 101 , 102),
- new Test4( 100 , 101 , 102),
- new Child_test4(100 , 101 , 102 , 103),
- new ConcreteClass1(),
- /* 11 */ new Template1()
-);
-
-// loop through each element of the array for 'val' argument
-// check the working of array_fill()
-echo "--- Testing array_fill() with different object values for 'val' argument ---\n";
-$counter = 1;
-for($index = 0; $index < count($objects); $index ++)
-{
- echo "-- Iteration $counter --\n";
- $val = $objects[$index];
-
- var_dump( array_fill($start_key,$num,$val) );
-
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing array_fill() : usage variations ***
---- Testing array_fill() with different object values for 'val' argument ---
--- Iteration 1 --
-array(2) {
- [0]=>
- object(Test)#%d (0) {
- }
- [1]=>
- object(Test)#%d (0) {
- }
-}
--- Iteration 2 --
-array(2) {
- [0]=>
- object(Test1)#%d (3) {
- ["member1"]=>
- int(100)
- ["var1"]=>
- int(30)
- ["var2"]=>
- int(101)
- }
- [1]=>
- object(Test1)#%d (3) {
- ["member1"]=>
- int(100)
- ["var1"]=>
- int(30)
- ["var2"]=>
- int(101)
- }
-}
--- Iteration 3 --
-array(2) {
- [0]=>
- object(Child_test1)#%d (4) {
- ["member2"]=>
- int(102)
- ["member1"]=>
- int(100)
- ["var1"]=>
- int(30)
- ["var2"]=>
- int(101)
- }
- [1]=>
- object(Child_test1)#%d (4) {
- ["member2"]=>
- int(102)
- ["member1"]=>
- int(100)
- ["var1"]=>
- int(30)
- ["var2"]=>
- int(101)
- }
-}
--- Iteration 4 --
-array(2) {
- [0]=>
- object(Test2)#%d (3) {
- ["member1":"Test2":private]=>
- int(100)
- ["var1"]=>
- int(30)
- ["var2"]=>
- int(101)
- }
- [1]=>
- object(Test2)#%d (3) {
- ["member1":"Test2":private]=>
- int(100)
- ["var1"]=>
- int(30)
- ["var2"]=>
- int(101)
- }
-}
--- Iteration 5 --
-array(2) {
- [0]=>
- object(Child_test2)#%d (4) {
- ["member1":"Child_test2":private]=>
- int(102)
- ["var1"]=>
- int(30)
- ["var2"]=>
- int(101)
- ["member1":"Test2":private]=>
- int(100)
- }
- [1]=>
- object(Child_test2)#%d (4) {
- ["member1":"Child_test2":private]=>
- int(102)
- ["var1"]=>
- int(30)
- ["var2"]=>
- int(101)
- ["member1":"Test2":private]=>
- int(100)
- }
-}
--- Iteration 6 --
-array(2) {
- [0]=>
- object(Test3)#%d (3) {
- ["member1":protected]=>
- int(100)
- ["var1"]=>
- int(30)
- ["var2"]=>
- int(101)
- }
- [1]=>
- object(Test3)#%d (3) {
- ["member1":protected]=>
- int(100)
- ["var1"]=>
- int(30)
- ["var2"]=>
- int(101)
- }
-}
--- Iteration 7 --
-array(2) {
- [0]=>
- object(Child_test3)#%d (3) {
- ["member1":protected]=>
- int(102)
- ["var1"]=>
- int(30)
- ["var2"]=>
- int(101)
- }
- [1]=>
- object(Child_test3)#%d (3) {
- ["member1":protected]=>
- int(102)
- ["var1"]=>
- int(30)
- ["var2"]=>
- int(101)
- }
-}
--- Iteration 8 --
-array(2) {
- [0]=>
- object(Test4)#%d (3) {
- ["member1"]=>
- int(100)
- ["member2":"Test4":private]=>
- int(101)
- ["member3":protected]=>
- int(102)
- }
- [1]=>
- object(Test4)#%d (3) {
- ["member1"]=>
- int(100)
- ["member2":"Test4":private]=>
- int(101)
- ["member3":protected]=>
- int(102)
- }
-}
--- Iteration 9 --
-array(2) {
- [0]=>
- object(Child_test4)#%d (4) {
- ["var1"]=>
- int(103)
- ["member1"]=>
- int(100)
- ["member2":"Test4":private]=>
- int(101)
- ["member3":protected]=>
- int(102)
- }
- [1]=>
- object(Child_test4)#%d (4) {
- ["var1"]=>
- int(103)
- ["member1"]=>
- int(100)
- ["member2":"Test4":private]=>
- int(101)
- ["member3":protected]=>
- int(102)
- }
-}
--- Iteration 10 --
-array(2) {
- [0]=>
- object(ConcreteClass1)#%d (4) {
- ["member1"]=>
- NULL
- ["member2":"AbstractClass":private]=>
- NULL
- ["member3":protected]=>
- NULL
- ["var1"]=>
- int(30)
- }
- [1]=>
- object(ConcreteClass1)#%d (4) {
- ["member1"]=>
- NULL
- ["member2":"AbstractClass":private]=>
- NULL
- ["member3":protected]=>
- NULL
- ["var1"]=>
- int(30)
- }
-}
--- Iteration 11 --
-array(2) {
- [0]=>
- object(Template1)#%d (0) {
- }
- [1]=>
- object(Template1)#%d (0) {
- }
-}
-Done
diff --git a/ext/standard/tests/array/array_filter_variation7.phpt b/ext/standard/tests/array/array_filter_variation7.phpt
index cb856f713d..79fb574e23 100644
--- a/ext/standard/tests/array/array_filter_variation7.phpt
+++ b/ext/standard/tests/array/array_filter_variation7.phpt
@@ -17,19 +17,19 @@ $input = array(0, 1, -1, 10, 100, 1000, 'Hello', null);
// anonymous callback function
echo "Anonymous callback function with regular parameter and statement\n";
-var_dump( array_filter($input, create_function('$input', 'return ($input > 1);') ) );
+var_dump( array_filter($input, function($input) { return ($input > 1); }) );
// anonymous callback function with reference
echo "Anonymous callback function with reference parameter\n";
-var_dump( array_filter($input, create_function('&$input', 'return ($input < 1);') ) );
+var_dump( array_filter($input, function(&$input) { return ($input < 1); }) );
// anonymous callback function with null argument
echo "Anonymous callback funciton with null argument\n";
-var_dump( array_filter($input, create_function(null, 'return true;') ) );
+var_dump( array_filter($input, function() { return true; }) );
// anonymous callback function with argument and null statement
echo "Anonymous callback function with regular argument and null statement\n";
-var_dump( array_filter($input, create_function('$input', null) ) );
+var_dump( array_filter($input, function($input) { }) );
echo "Done"
?>
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt
index 64f58a6d1e..fc7c526ed1 100644
--- a/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt
+++ b/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt
@@ -32,7 +32,7 @@ NULL
Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
NULL
-Notice: Use of undefined constant unknown_function - assumed 'unknown_function' in %s on line %d
+Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d
Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
NULL
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt
index 3d580e1e02..89286f8986 100644
--- a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt
+++ b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt
@@ -32,7 +32,7 @@ NULL
Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
NULL
-Notice: Use of undefined constant unknown_function - assumed 'unknown_function' in %s on line %d
+Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d
Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
NULL
diff --git a/ext/standard/tests/array/array_key_exists_object1.phpt b/ext/standard/tests/array/array_key_exists_object1.phpt
index 4ffafc4539..3b263df474 100644
--- a/ext/standard/tests/array/array_key_exists_object1.phpt
+++ b/ext/standard/tests/array/array_key_exists_object1.phpt
@@ -57,11 +57,11 @@ $key = var3:
bool(true)
$class1:
object(myClass)#1 (3) {
- [%b|u%"var1"]=>
- %unicode|string%(1) "a"
- [%b|u%"var2"]=>
- %unicode|string%(1) "b"
- [%b|u%"var3"]=>
+ ["var1"]=>
+ string(1) "a"
+ ["var2"]=>
+ string(1) "b"
+ ["var3"]=>
NULL
}
@@ -70,11 +70,11 @@ $key = var3:
bool(true)
$class2:
object(myClass)#2 (3) {
- [%b|u%"var1"]=>
- %unicode|string%(1) "x"
- [%b|u%"var2"]=>
- %unicode|string%(1) "y"
- [%b|u%"var3"]=>
- %unicode|string%(1) "z"
+ ["var1"]=>
+ string(1) "x"
+ ["var2"]=>
+ string(1) "y"
+ ["var3"]=>
+ string(1) "z"
}
Done
diff --git a/ext/standard/tests/array/array_key_exists_object2.phpt b/ext/standard/tests/array/array_key_exists_object2.phpt
index 39bb129e39..4a790e9d37 100644
--- a/ext/standard/tests/array/array_key_exists_object2.phpt
+++ b/ext/standard/tests/array/array_key_exists_object2.phpt
@@ -61,11 +61,11 @@ $key = var3:
bool(false)
$class1:
object(myClass)#1 (3) {
- [%b|u%"var1"]=>
- %unicode|string%(1) "a"
- [%b|u%"var2":protected]=>
- %unicode|string%(1) "b"
- [%b|u%"var3":%b|u%"myClass":private]=>
+ ["var1"]=>
+ string(1) "a"
+ ["var2":protected]=>
+ string(1) "b"
+ ["var3":"myClass":private]=>
NULL
}
@@ -74,11 +74,11 @@ $key = var3:
bool(false)
$class2:
object(myClass)#2 (3) {
- [%b|u%"var1"]=>
- %unicode|string%(1) "x"
- [%b|u%"var2":protected]=>
- %unicode|string%(1) "y"
- [%b|u%"var3":%b|u%"myClass":private]=>
- %unicode|string%(1) "z"
+ ["var1"]=>
+ string(1) "x"
+ ["var2":protected]=>
+ string(1) "y"
+ ["var3":"myClass":private]=>
+ string(1) "z"
}
Done
diff --git a/ext/standard/tests/array/array_map_variation10.phpt b/ext/standard/tests/array/array_map_variation10.phpt
index ecf9157620..effda06745 100644
--- a/ext/standard/tests/array/array_map_variation10.phpt
+++ b/ext/standard/tests/array/array_map_variation10.phpt
@@ -17,23 +17,23 @@ $array1 = array(1, 2, 3);
$array2 = array(3, 4, 5);
echo "-- anonymous function with all parameters and body --\n";
-var_dump( array_map( create_function('$a, $b', 'return array($a, $b);'), $array1, $array2));
+var_dump( array_map( function($a, $b) { return array($a, $b); }, $array1, $array2));
echo "-- anonymous function with two parameters and passing one array --\n";
try {
- var_dump( array_map( create_function('$a, $b', 'return array($a, $b);'), $array1));
+ var_dump( array_map( function($a, $b) { return array($a, $b); }, $array1));
} catch (Throwable $e) {
echo "Exception: " . $e->getMessage() . "\n";
}
echo "-- anonymous function with NULL parameter --\n";
-var_dump( array_map( create_function(NULL, 'return NULL;'), $array1));
+var_dump( array_map( function() { return NULL; }, $array1));
echo "-- anonymous function with NULL body --\n";
-var_dump( array_map( create_function('$a', NULL), $array1));
+var_dump( array_map( function($a) { }, $array1));
echo "-- passing NULL as 'arr1' --\n";
-var_dump( array_map( create_function('$a', 'return array($a);'), NULL));
+var_dump( array_map( function($a) { return array($a); }, NULL));
echo "Done";
?>
@@ -64,7 +64,7 @@ array(3) {
}
}
-- anonymous function with two parameters and passing one array --
-Exception: Too few arguments to function __lambda_func(), 1 passed and exactly 2 expected
+Exception: Too few arguments to function {closure}(), 1 passed and exactly 2 expected
-- anonymous function with NULL parameter --
array(3) {
[0]=>
diff --git a/ext/standard/tests/array/array_unique_variation2.phpt b/ext/standard/tests/array/array_unique_variation2.phpt
index 757dd6e057..62dfab4568 100644
--- a/ext/standard/tests/array/array_unique_variation2.phpt
+++ b/ext/standard/tests/array/array_unique_variation2.phpt
@@ -114,37 +114,37 @@ array(1) {
-- Iteration 6 --
array(4) {
[0]=>
- %unicode|string%(3) "a "
+ string(3) "a "
[1]=>
- %unicode|string%(5) "aaaa "
+ string(5) "aaaa "
[2]=>
- %unicode|string%(1) "b"
+ string(1) "b"
[4]=>
- %unicode|string%(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
+ string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
}
-- Iteration 7 --
array(4) {
[0]=>
- %unicode|string%(5) "a\v\f"
+ string(5) "a\v\f"
[1]=>
- %unicode|string%(6) "aaaa\r"
+ string(6) "aaaa\r"
[2]=>
- %unicode|string%(1) "b"
+ string(1) "b"
[4]=>
- %unicode|string%(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
+ string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
}
-- Iteration 8 --
array(3) {
- [%b|u%"h1"]=>
- %unicode|string%(1) "
+ ["h1"]=>
+ string(1) "
"
- [%b|u%"h2"]=>
- %unicode|string%(88) "hello world
+ ["h2"]=>
+ string(88) "hello world
The quick brown fox jumped over;
the lazy dog
This is a double quoted string"
- [%b|u%"h3"]=>
- %unicode|string%(88) "hello world
+ ["h3"]=>
+ string(88) "hello world
1111 != 2222
heredoc
double quoted string. with different white spaces"
@@ -152,15 +152,15 @@ double quoted string. with different white spaces"
-- Iteration 9 --
array(2) {
[1]=>
- %unicode|string%(3) "one"
+ string(3) "one"
[2]=>
- %unicode|string%(3) "two"
+ string(3) "two"
}
-- Iteration 10 --
array(2) {
- [%b|u%"one"]=>
+ ["one"]=>
int(1)
- [%b|u%"two"]=>
+ ["two"]=>
int(2)
}
-- Iteration 11 --
@@ -174,55 +174,55 @@ array(3) {
}
-- Iteration 12 --
array(2) {
- [%b|u%"one"]=>
- %unicode|string%(3) "ten"
- [%b|u%"two"]=>
- %unicode|string%(6) "twenty"
+ ["one"]=>
+ string(3) "ten"
+ ["two"]=>
+ string(6) "twenty"
}
-- Iteration 13 --
array(3) {
- [%b|u%"one"]=>
+ ["one"]=>
int(1)
[2]=>
- %unicode|string%(3) "two"
+ string(3) "two"
[4]=>
- %unicode|string%(4) "four"
+ string(4) "four"
}
-- Iteration 14 --
array(2) {
- [%b|u%""]=>
- %unicode|string%(4) "null"
- [%b|u%"NULL"]=>
+ [""]=>
+ string(4) "null"
+ ["NULL"]=>
NULL
}
-- Iteration 15 --
array(4) {
[1]=>
- %unicode|string%(4) "true"
+ string(4) "true"
[0]=>
- %unicode|string%(5) "false"
- [%b|u%"false"]=>
+ string(5) "false"
+ ["false"]=>
bool(false)
- [%b|u%"true"]=>
+ ["true"]=>
bool(true)
}
-- Iteration 16 --
array(2) {
- [%b|u%""]=>
- %unicode|string%(6) "emptys"
- [%b|u%"emptyd"]=>
- %unicode|string%(0) ""
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
}
-- Iteration 17 --
array(2) {
[1]=>
- %unicode|string%(0) ""
+ string(0) ""
[6]=>
bool(true)
}
-- Iteration 18 --
array(3) {
- [%b|u%""]=>
+ [""]=>
int(4)
[0]=>
int(5)
diff --git a/ext/standard/tests/array/array_unique_variation6.phpt b/ext/standard/tests/array/array_unique_variation6.phpt
index 82442bdfad..15a46518b7 100644
--- a/ext/standard/tests/array/array_unique_variation6.phpt
+++ b/ext/standard/tests/array/array_unique_variation6.phpt
@@ -39,6 +39,6 @@ array(2) {
[0]=>
int(0)
[1]=>
- &%unicode|string%(5) "hello"
+ &string(5) "hello"
}
Done
diff --git a/ext/standard/tests/array/array_unique_variation8.phpt b/ext/standard/tests/array/array_unique_variation8.phpt
index 3b4eac9f75..8b67adfbab 100644
--- a/ext/standard/tests/array/array_unique_variation8.phpt
+++ b/ext/standard/tests/array/array_unique_variation8.phpt
@@ -36,22 +36,6 @@ Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
-
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
-
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
-
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
-
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
-
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
-
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
-
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
-
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
array(1) {
[0]=>
array(4) {
diff --git a/ext/standard/tests/array/array_walk_object1.phpt b/ext/standard/tests/array/array_walk_object1.phpt
index 342e760ce8..3bd83fdab2 100644
--- a/ext/standard/tests/array/array_walk_object1.phpt
+++ b/ext/standard/tests/array/array_walk_object1.phpt
@@ -51,15 +51,15 @@ echo "Done"
?>
--EXPECTF--
*** Testing array_walk() : object functionality ***
-%unicode|string%(18) "%r\0%rMyClass%r\0%rpri_value"
+string(18) "%r\0%rMyClass%r\0%rpri_value"
int(10)
int(1)
-%unicode|string%(9) "pub_value"
+string(9) "pub_value"
int(10)
int(1)
-%unicode|string%(12) "%r\0%r*%r\0%rpro_value"
+string(12) "%r\0%r*%r\0%rpro_value"
int(10)
int(1)
diff --git a/ext/standard/tests/array/array_walk_objects.phpt b/ext/standard/tests/array/array_walk_objects.phpt
index 506d1cafcf..f9214d25a5 100644
--- a/ext/standard/tests/array/array_walk_objects.phpt
+++ b/ext/standard/tests/array/array_walk_objects.phpt
@@ -29,16 +29,16 @@ array_walk($var, "walk");
echo "Done\n";
?>
--EXPECTF--
-%unicode|string%(3) "foo"
-%unicode|string%(3) "foo"
-%unicode|string%(3) "bar"
-%unicode|string%(3) "bar"
-%unicode|string%(13) "%r\0%rtest%r\0%rvar_pri"
-%unicode|string%(12) "test_private"
-%unicode|string%(10) "%r\0%r*%r\0%rvar_pro"
-%unicode|string%(14) "test_protected"
-%unicode|string%(7) "var_pub"
-%unicode|string%(11) "test_public"
+string(3) "foo"
+string(3) "foo"
+string(3) "bar"
+string(3) "bar"
+string(13) "%r\0%rtest%r\0%rvar_pri"
+string(12) "test_private"
+string(10) "%r\0%r*%r\0%rvar_pro"
+string(14) "test_protected"
+string(7) "var_pub"
+string(11) "test_public"
-Warning: array_walk() expects parameter 1 to be array, %unicode_string_optional% given in %s on line %d
+Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d
Done
diff --git a/ext/standard/tests/array/array_walk_rec_objects.phpt b/ext/standard/tests/array/array_walk_rec_objects.phpt
index bbd30f37f0..d2fa9b86eb 100644
--- a/ext/standard/tests/array/array_walk_rec_objects.phpt
+++ b/ext/standard/tests/array/array_walk_rec_objects.phpt
@@ -29,16 +29,16 @@ array_walk_recursive($var, "walk");
echo "Done\n";
?>
--EXPECTF--
-%unicode|string%(3) "foo"
-%unicode|string%(3) "foo"
-%unicode|string%(3) "bar"
-%unicode|string%(3) "bar"
-%unicode|string%(13) "%r\0%rtest%r\0%rvar_pri"
-%unicode|string%(12) "test_private"
-%unicode|string%(10) "%r\0%r*%r\0%rvar_pro"
-%unicode|string%(14) "test_protected"
-%unicode|string%(7) "var_pub"
-%unicode|string%(11) "test_public"
+string(3) "foo"
+string(3) "foo"
+string(3) "bar"
+string(3) "bar"
+string(13) "%r\0%rtest%r\0%rvar_pri"
+string(12) "test_private"
+string(10) "%r\0%r*%r\0%rvar_pro"
+string(14) "test_protected"
+string(7) "var_pub"
+string(11) "test_public"
-Warning: array_walk_recursive() expects parameter 1 to be array, %unicode_string_optional% given in %s on line %d
+Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d
Done
diff --git a/ext/standard/tests/array/array_walk_recursive_object1.phpt b/ext/standard/tests/array/array_walk_recursive_object1.phpt
index 7ddced7766..5c01c55817 100644
--- a/ext/standard/tests/array/array_walk_recursive_object1.phpt
+++ b/ext/standard/tests/array/array_walk_recursive_object1.phpt
@@ -49,15 +49,15 @@ echo "Done"
?>
--EXPECTF--
*** Testing array_walk_recursive() : object functionality ***
-%unicode|string%(18) "%r\0%rMyClass%r\0%rpri_value"
+string(18) "%r\0%rMyClass%r\0%rpri_value"
int(10)
int(1)
-%unicode|string%(9) "pub_value"
+string(9) "pub_value"
int(10)
int(1)
-%unicode|string%(12) "%r\0%r*%r\0%rpro_value"
+string(12) "%r\0%r*%r\0%rpro_value"
int(10)
int(1)
diff --git a/ext/standard/tests/array/array_walk_recursive_variation7.phpt b/ext/standard/tests/array/array_walk_recursive_variation7.phpt
index 0cdd6d248d..bc0d205900 100644
--- a/ext/standard/tests/array/array_walk_recursive_variation7.phpt
+++ b/ext/standard/tests/array/array_walk_recursive_variation7.phpt
@@ -21,19 +21,19 @@ echo "*** Testing array_walk_recursive() : anonymous function as callback ***\n"
$input = array( array(2, 5), array(10, 0));
echo "-- Anonymous function with one argument --\n";
-var_dump( array_walk_recursive($input, create_function('$value', 'var_dump($value); echo "\n";')));
+var_dump( array_walk_recursive($input, function($value) { var_dump($value); echo "\n"; }));
echo "-- Anonymous function with two arguments --\n";
-var_dump( array_walk_recursive($input, create_function('$value, $key', 'var_dump($key); var_dump($value); echo "\n";')));
+var_dump( array_walk_recursive($input, function($value, $key) { var_dump($key); var_dump($value); echo "\n"; }));
echo "-- Anonymous function with three arguments --\n";
-var_dump( array_walk_recursive($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 10));
+var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10));
echo "-- Anonymous function with one more argument --\n";
-var_dump( array_walk_recursive($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 20, 30));
+var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30));
echo "-- Anonymous function with null argument --\n";
-var_dump( array_walk_recursive( $input, create_function(null, 'echo "1\n";')));
+var_dump( array_walk_recursive( $input, function() { echo "1\n"; }));
echo "Done"
?>
--EXPECTF--
diff --git a/ext/standard/tests/array/array_walk_variation7.phpt b/ext/standard/tests/array/array_walk_variation7.phpt
index da85958b8e..692f276628 100644
--- a/ext/standard/tests/array/array_walk_variation7.phpt
+++ b/ext/standard/tests/array/array_walk_variation7.phpt
@@ -21,19 +21,19 @@ echo "*** Testing array_walk() : anonymous function as callback ***\n";
$input = array(2, 5, 10, 0);
echo "-- Anonymous function with one argument --\n";
-var_dump( array_walk($input, create_function('$value', 'var_dump($value); echo "\n";')));
+var_dump( array_walk($input, function($value) { var_dump($value); echo "\n"; }));
echo "-- Anonymous function with two arguments --\n";
-var_dump( array_walk($input, create_function('$value, $key', 'var_dump($key); var_dump($value); echo "\n";')));
+var_dump( array_walk($input, function($value, $key) { var_dump($key); var_dump($value); echo "\n"; }));
echo "-- Anonymous function with three arguments --\n";
-var_dump( array_walk($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 10));
+var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10));
echo "-- Anonymous function with one more argument --\n";
-var_dump( array_walk($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 20, 30));
+var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30));
echo "-- Anonymous function with null argument --\n";
-var_dump( array_walk( $input, create_function(null, 'echo "1\n";')));
+var_dump( array_walk( $input, function() { echo "1\n"; }));
echo "Done"
?>
--EXPECTF--
diff --git a/ext/standard/tests/array/bug14580.phpt b/ext/standard/tests/array/bug14580.phpt
index c04d00356e..1cf27f22d6 100644
--- a/ext/standard/tests/array/bug14580.phpt
+++ b/ext/standard/tests/array/bug14580.phpt
@@ -2,7 +2,7 @@
Bug #14580 (key() not binary safe)
--FILE--
<?php
- $arr = array (b"foo\0bar" => b"foo\0bar");
+ $arr = array ("foo\0bar" => "foo\0bar");
$key = key($arr);
echo strlen($key), ': ';
echo urlencode($key), "\n";
diff --git a/ext/standard/tests/array/bug44929.phpt b/ext/standard/tests/array/bug44929.phpt
index 9dc85acd1f..efcbcda1cc 100644
--- a/ext/standard/tests/array/bug44929.phpt
+++ b/ext/standard/tests/array/bug44929.phpt
@@ -2,7 +2,7 @@
Bug #44929 (natsort doesn't handle leading zeros well)
--FILE--
<?php
-$a = array(b'001',b'008',b'005',b'00011',b'03',b'000014',b'-123',b'0.002',b'00',b'0',b'0_0',b'0-0');
+$a = array('001','008','005','00011','03','000014','-123','0.002','00','0','0_0','0-0');
natsort($a);
var_dump($a);
?>
diff --git a/ext/standard/tests/array/bug48854.phpt b/ext/standard/tests/array/bug48854.phpt
index 0908637503..7aaade03a4 100644
--- a/ext/standard/tests/array/bug48854.phpt
+++ b/ext/standard/tests/array/bug48854.phpt
@@ -24,20 +24,20 @@ var_dump($array1, $array2);
?>
--EXPECTF--
array(2) {
- [%u|b%"friends"]=>
+ ["friends"]=>
int(5)
- [%u|b%"children"]=>
+ ["children"]=>
array(1) {
- [%u|b%"dogs"]=>
+ ["dogs"]=>
int(0)
}
}
array(2) {
- [%u|b%"friends"]=>
+ ["friends"]=>
int(10)
- [%u|b%"children"]=>
+ ["children"]=>
array(1) {
- [%u|b%"cats"]=>
+ ["cats"]=>
int(5)
}
}
diff --git a/ext/standard/tests/array/bug65251.phpt b/ext/standard/tests/array/bug65251.phpt
new file mode 100644
index 0000000000..014517794c
--- /dev/null
+++ b/ext/standard/tests/array/bug65251.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #65251: array_merge_recursive() recursion detection broken
+--FILE--
+<?php
+
+array_merge_recursive($GLOBALS, $GLOBALS)
+
+?>
+--EXPECTF--
+Warning: array_merge_recursive(): recursion detected in %s on line %d
diff --git a/ext/standard/tests/array/bug75433.phpt b/ext/standard/tests/array/bug75433.phpt
new file mode 100644
index 0000000000..650c6ca378
--- /dev/null
+++ b/ext/standard/tests/array/bug75433.phpt
@@ -0,0 +1,17 @@
+--TEST--
+array_values() preserves next index from source array when shallow-copying
+--FILE--
+<?php
+
+$a = [1,2,3];
+unset($a[2]);
+$b = array_values($a);
+$b[] = 4;
+print_r($b);
+--EXPECT--
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 4
+)
diff --git a/ext/standard/tests/array/bug75653.phpt b/ext/standard/tests/array/bug75653.phpt
new file mode 100644
index 0000000000..d11c1e0c75
--- /dev/null
+++ b/ext/standard/tests/array/bug75653.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #75653: array_values don't work on empty array
+--FILE--
+<?php
+
+$array[] = 'data1';
+unset($array[0]);
+$array = array_values($array);
+$array[] = 'data2';
+$array[] = 'data3';
+var_dump($array);
+
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ string(5) "data2"
+ [1]=>
+ string(5) "data3"
+}
diff --git a/ext/standard/tests/array/count_invalid.phpt b/ext/standard/tests/array/count_invalid.phpt
new file mode 100644
index 0000000000..95da00dac5
--- /dev/null
+++ b/ext/standard/tests/array/count_invalid.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Only arrays and countable objects can be counted
+--FILE--
+<?php
+
+$result = count(null);
+var_dump($result);
+
+$result = count("string");
+var_dump($result);
+
+$result = count(123);
+var_dump($result);
+
+$result = count(true);
+var_dump($result);
+
+$result = count(false);
+var_dump($result);
+
+$result = count((object) []);
+var_dump($result);
+
+?>
+--EXPECTF--
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(0)
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt
index 16c754e54f..b903d8b189 100644
--- a/ext/standard/tests/array/count_recursive.phpt
+++ b/ext/standard/tests/array/count_recursive.phpt
@@ -132,7 +132,11 @@ closedir( $resource2 );
--EXPECTF--
*** Testing basic functionality of count() function ***
-- Testing NULL --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
COUNT_NORMAL: should be 0, is 0
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
COUNT_RECURSIVE: should be 0, is 0
-- Testing arrays --
COUNT_NORMAL: should be 2, is 2
@@ -141,9 +145,15 @@ COUNT_RECURSIVE: should be 8, is 8
COUNT_NORMAL: should be 3, is 3
COUNT_RECURSIVE: should be 6, is 6
-- Testing strings --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
COUNT_NORMAL: should be 1, is 1
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
COUNT_RECURSIVE: should be 1, is 1
-- Testing various types with no second argument --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
COUNT_NORMAL: should be 1, is 1
COUNT_NORMAL: should be 2, is 2
-- Testing really cool arrays --
@@ -184,11 +194,19 @@ COUNT_NORMAL is 4
COUNT_RECURSIVE is 7
-- Testing count() on constants with no second argument --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
COUNT_NORMAL: should be 1, is 1
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
COUNT_NORMAL: should be 1, is 1
-- Testing count() on NULL and Unset variables --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
COUNT_NORMAL: should be 0, is 0
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
COUNT_NORMAL: should be 1, is 1
COUNT_NORMAL: should be 0, is 0
@@ -221,7 +239,7 @@ NULL
Warning: count() expects at most 2 parameters, 3 given in %s on line %d
NULL
-Notice: Use of undefined constant ABCD - assumed 'ABCD' in %s on line %d
+Warning: Use of undefined constant ABCD - assumed 'ABCD' (this will throw an Error in a future version of PHP) in %s on line %d
Warning: count() expects parameter 2 to be integer, %s given in %s on line %d
NULL
diff --git a/ext/standard/tests/array/count_variation1.phpt b/ext/standard/tests/array/count_variation1.phpt
index b40a2ab299..a58473c219 100644
--- a/ext/standard/tests/array/count_variation1.phpt
+++ b/ext/standard/tests/array/count_variation1.phpt
@@ -97,74 +97,122 @@ echo "Done";
*** Testing count() : usage variations ***
-- Iteration 1 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 2 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 3 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 4 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 5 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 6 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 7 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 8 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 9 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 10 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 11 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 12 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 13 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 14 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 15 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 16 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 17 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 18 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 19 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 20 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 21 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
-- Iteration 22 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 23 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 24 --
+
+Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each.phpt b/ext/standard/tests/array/each.phpt
index 974808c08c..f1b6f76ea6 100644
--- a/ext/standard/tests/array/each.phpt
+++ b/ext/standard/tests/array/each.phpt
Binary files differ
diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt
index 350b40f9a3..b12b4c19f7 100644
--- a/ext/standard/tests/array/each_basic.phpt
+++ b/ext/standard/tests/array/each_basic.phpt
@@ -46,6 +46,8 @@ array(4) {
}
-- Initial position: --
+
+Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
array(4) {
[1]=>
int(1)
@@ -71,4 +73,4 @@ array(4) {
-- Passed the end of array: --
bool(false)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/array/each_variation1.phpt b/ext/standard/tests/array/each_variation1.phpt
index 0afef31432..becdfc4545 100644
--- a/ext/standard/tests/array/each_variation1.phpt
+++ b/ext/standard/tests/array/each_variation1.phpt
@@ -101,6 +101,8 @@ echo "Done";
-- Iteration 1 --
+Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
+
Warning: Variable passed to each() is not an array or object in %s on line %d
NULL
diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt
index 3f7211c89c..73b1ba2746 100644
--- a/ext/standard/tests/array/each_variation2.phpt
+++ b/ext/standard/tests/array/each_variation2.phpt
@@ -122,6 +122,8 @@ echo "Done";
*** Testing each() : usage variations ***
-- Iteration 1: int data --
+
+Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
array(4) {
[1]=>
int(0)
@@ -245,4 +247,4 @@ array(4) {
["key"]=>
int(0)
}
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt
index b31ddc61b4..375615643f 100644
--- a/ext/standard/tests/array/each_variation3.phpt
+++ b/ext/standard/tests/array/each_variation3.phpt
@@ -108,6 +108,8 @@ echo "Done";
*** Testing each() : usage variations ***
-- Iteration 1: int data --
+
+Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
array(4) {
[1]=>
string(4) "zero"
@@ -250,4 +252,4 @@ array(4) {
["key"]=>
string(0) ""
}
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt
index 535ae297d1..14b5536135 100644
--- a/ext/standard/tests/array/each_variation4.phpt
+++ b/ext/standard/tests/array/each_variation4.phpt
@@ -35,6 +35,8 @@ echo "Done";
-- Array made up of referenced variables: --
-- Call each until at the end of the array: --
+
+Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
array(4) {
[1]=>
string(3) "foo"
diff --git a/ext/standard/tests/array/each_variation5.phpt b/ext/standard/tests/array/each_variation5.phpt
index 941ad5e3ac..b6c39538a3 100644
--- a/ext/standard/tests/array/each_variation5.phpt
+++ b/ext/standard/tests/array/each_variation5.phpt
@@ -37,6 +37,8 @@ echo "Done";
*** Testing each() : usage variations ***
-- Pass each() a two-dimensional array --
+
+Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
array(4) {
[1]=>
string(4) "zero"
@@ -93,4 +95,4 @@ array(4) {
["key"]=>
int(0)
}
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt
index 445d63f318..ba0f2657c8 100644
--- a/ext/standard/tests/array/each_variation6.phpt
+++ b/ext/standard/tests/array/each_variation6.phpt
@@ -35,6 +35,8 @@ echo "Done";
0 => zero
-- Call to each(): --
+
+Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
array(4) {
[1]=>
string(4) "zero"
@@ -48,4 +50,4 @@ array(4) {
-- New position: --
1 => one
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/array/extract_variation10.phpt b/ext/standard/tests/array/extract_variation10.phpt
index d520be775e..6e4565dc8c 100644
--- a/ext/standard/tests/array/extract_variation10.phpt
+++ b/ext/standard/tests/array/extract_variation10.phpt
@@ -10,4 +10,4 @@ $a['foo'] = 'changed.foo';
var_dump($nonref);
?>
--EXPECTF--
-%unicode|string%(12) "original.foo"
+string(12) "original.foo"
diff --git a/ext/standard/tests/array/extract_variation11.phpt b/ext/standard/tests/array/extract_variation11.phpt
index 7f6e08c982..dfab4ddbba 100644
--- a/ext/standard/tests/array/extract_variation11.phpt
+++ b/ext/standard/tests/array/extract_variation11.phpt
@@ -10,4 +10,4 @@ $foo = 'changed.foo';
var_dump($a['foo']);
?>
--EXPECTF--
-%unicode|string%(11) "changed.foo"
+string(11) "changed.foo"
diff --git a/ext/standard/tests/array/packed_001.phpt b/ext/standard/tests/array/packed_001.phpt
new file mode 100644
index 0000000000..81973c7e0e
--- /dev/null
+++ b/ext/standard/tests/array/packed_001.phpt
@@ -0,0 +1,84 @@
+--TEST--
+array_keys() and array_values() w/ packed optimization
+--FILE--
+<?php
+
+$x = [1,2,3];
+unset($x[1]);
+
+$inputs = [
+ [],
+ [1,2,3],
+ [0=>1, 1=>2, 2=>3],
+ [1=>1, 2=>2, 3=>3],
+ [0=>1, 2=>3],
+ $x,
+];
+
+foreach ($inputs as $input) {
+ print_r(array_keys($input));
+ print_r(array_values($input));
+}
+--EXPECT--
+Array
+(
+)
+Array
+(
+)
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => 2
+)
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+)
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => 2
+)
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+)
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+)
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+)
+Array
+(
+ [0] => 0
+ [1] => 2
+)
+Array
+(
+ [0] => 1
+ [1] => 3
+)
+Array
+(
+ [0] => 0
+ [1] => 2
+)
+Array
+(
+ [0] => 1
+ [1] => 3
+)
diff --git a/ext/standard/tests/array/sizeof_basic1.phpt b/ext/standard/tests/array/sizeof_basic1.phpt
index dea4a68ea8..ac86cbf8d7 100644
--- a/ext/standard/tests/array/sizeof_basic1.phpt
+++ b/ext/standard/tests/array/sizeof_basic1.phpt
@@ -45,16 +45,28 @@ echo "Done";
--EXPECTF--
*** Testing sizeof() : basic functionality ***
-- Testing sizeof() for integer type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --
-default mode: int(1)
+default mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL mode: int(1)
+COUNT_NORMAL mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE mode: int(1)
+COUNT_RECURSIVE mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Testing sizeof() for float type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --
-default mode: int(1)
+default mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL mode: int(1)
+COUNT_NORMAL mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE mode: int(1)
+COUNT_RECURSIVE mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
Done
diff --git a/ext/standard/tests/array/sizeof_error.phpt b/ext/standard/tests/array/sizeof_error.phpt
index 79a75f3153..c6274830cf 100644
--- a/ext/standard/tests/array/sizeof_error.phpt
+++ b/ext/standard/tests/array/sizeof_error.phpt
@@ -17,7 +17,7 @@ echo "-- Testing sizeof() with zero arguments --\n";
var_dump( sizeof() );
echo "-- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode --\n";
$var = 100;
-$extra_arg = 10;;
+$extra_arg = 10;
var_dump( sizeof($var, COUNT_NORMAL, $extra_arg) );
echo "-- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode --\n";
var_dump( sizeof($var, COUNT_RECURSIVE, $extra_arg) );
diff --git a/ext/standard/tests/array/sizeof_object2.phpt b/ext/standard/tests/array/sizeof_object2.phpt
index e2c0816c66..404443ae59 100644
--- a/ext/standard/tests/array/sizeof_object2.phpt
+++ b/ext/standard/tests/array/sizeof_object2.phpt
@@ -101,38 +101,68 @@ echo "Done";
*** Testing sizeof() : object functionality ***
--- Testing sizeof() with objects which doesn't implement Countable interface ---
-- Iteration 1 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 2 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 3 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 4 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 5 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
Done
diff --git a/ext/standard/tests/array/sizeof_variation1.phpt b/ext/standard/tests/array/sizeof_variation1.phpt
index 328645f9e2..5917a798e1 100644
--- a/ext/standard/tests/array/sizeof_variation1.phpt
+++ b/ext/standard/tests/array/sizeof_variation1.phpt
@@ -66,150 +66,264 @@ for($i = 0; $i < count($values); $i++)
echo "COUNT_NORMAL Mode: ";
var_dump( sizeof($var, COUNT_NORMAL) );
echo "\n";
-
+
echo "COUNT_RECURSIVE Mode: ";
var_dump( sizeof($var, COUNT_RECURSIVE) );
echo "\n";
-
+
$counter++;
}
-
+
echo "Done";
?>
--EXPECTF--
*** Testing sizeof() : usage variations ***
--- Testing sizeof() for all scalar types in default,COUNT_NORMAL and COUNT_RECURSIVE mode ---
-- Iteration 1 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 2 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 3 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 4 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 5 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 6 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 7 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 8 --
-Default Mode: int(0)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(0)
-COUNT_NORMAL Mode: int(0)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(0)
-COUNT_RECURSIVE Mode: int(0)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(0)
-- Iteration 9 --
-Default Mode: int(0)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(0)
-COUNT_NORMAL Mode: int(0)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(0)
-COUNT_RECURSIVE Mode: int(0)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(0)
-- Iteration 10 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 11 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 12 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 13 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 14 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 15 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 16 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 17 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-- Iteration 18 --
-Default Mode: int(0)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(0)
-COUNT_NORMAL Mode: int(0)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(0)
-COUNT_RECURSIVE Mode: int(0)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(0)
-- Iteration 19 --
-Default Mode: int(1)
+Default Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_NORMAL Mode: int(1)
+COUNT_NORMAL Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
-COUNT_RECURSIVE Mode: int(1)
+COUNT_RECURSIVE Mode:
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
+int(1)
Done
diff --git a/ext/standard/tests/array/sizeof_variation4.phpt b/ext/standard/tests/array/sizeof_variation4.phpt
index cb8fecc822..63fc05bd46 100644
--- a/ext/standard/tests/array/sizeof_variation4.phpt
+++ b/ext/standard/tests/array/sizeof_variation4.phpt
@@ -90,261 +90,381 @@ echo "Done";
-- Iteration 1 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 2 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 3 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 4 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 5 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 6 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 7 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 8 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 9 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 10 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 11 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 12 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 13 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 14 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 15 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 16 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 17 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 18 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 19 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 20 --
Default Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
Notice: Undefined variable: value in %s on line %d
+
+Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
Done
diff --git a/ext/standard/tests/array/uasort_variation7.phpt b/ext/standard/tests/array/uasort_variation7.phpt
index 44a2bb3a26..e37d9efe6b 100644
--- a/ext/standard/tests/array/uasort_variation7.phpt
+++ b/ext/standard/tests/array/uasort_variation7.phpt
@@ -15,16 +15,26 @@ Test uasort() function : usage variations - anonymous function as 'cmp_function'
echo "*** Testing uasort() : anonymous function as 'cmp_function' ***\n";
-$cmp_function = 'if($value1 == $value2) {return 0;} else if($value1 > $value2) {return 1;} else{return -1;}';
+$cmp_function = function($value1, $value2) {
+ if ($value1 == $value2) { return 0; }
+ else if ($value1 > $value2) { return 1; }
+ else { return -1; }
+};
$array_arg = array(0 => 100, 1 => 3, 2 => -70, 3 => 24, 4 => 90);
echo "-- Anonymous 'cmp_function' with parameters passed by value --\n";
-var_dump( uasort($array_arg, create_function('$value1, $value2',$cmp_function) ) );
+var_dump( uasort($array_arg, $cmp_function) );
var_dump($array_arg);
+$cmp_function = function(&$value1, &$value2) {
+ if ($value1 == $value2) { return 0; }
+ else if ($value1 > $value2) { return 1; }
+ else { return -1; }
+};
+
$array_arg = array("b" => "Banana", "m" => "Mango", "a" => "Apple", "p" => "Pineapple");
echo "-- Anonymous 'cmp_function' with parameters passed by reference --\n";
-var_dump( uasort($array_arg, create_function('&$value1, &$value2', $cmp_function) ) );
+var_dump( uasort($array_arg, $cmp_function ) );
var_dump($array_arg);
echo "Done"
diff --git a/ext/standard/tests/array/usort_variation7.phpt b/ext/standard/tests/array/usort_variation7.phpt
index e567341b1a..171e751df2 100644
--- a/ext/standard/tests/array/usort_variation7.phpt
+++ b/ext/standard/tests/array/usort_variation7.phpt
@@ -13,18 +13,28 @@ Test usort() function : usage variations - Anonymous comparison function
echo "*** Testing usort() : usage variation ***\n";
-$cmp_function = 'if($value1 == $value2) {return 0;} else if($value1 > $value2) {return 1;} else{return -1;}';
+$cmp_function = function($value1, $value2) {
+ if ($value1 == $value2) { return 0; }
+ else if ($value1 > $value2) { return 1; }
+ else { return -1; }
+};
$array_arg = array(0 => 100, 1 => 3, 2 => -70, 3 => 24, 4 => 90);
echo "\n-- Anonymous 'cmp_function' with parameters passed by value --\n";
-var_dump( usort($array_arg, create_function('$value1, $value2',$cmp_function) ) );
+var_dump( usort($array_arg, $cmp_function) );
var_dump($array_arg);
$array_arg = array("b" => "Banana", "m" => "Mango", "a" => "Apple", "p" => "Pineapple");
+$cmp_function = function(&$value1, &$value2) {
+ if ($value1 == $value2) { return 0; }
+ else if ($value1 > $value2) { return 1; }
+ else { return -1; }
+};
+
echo "\n-- Anonymous 'cmp_function' with parameters passed by reference --\n";
-var_dump( usort($array_arg, create_function('&$value1, &$value2', $cmp_function) ) );
+var_dump( usort($array_arg, $cmp_function) );
var_dump($array_arg);
?>
===DONE===
@@ -58,4 +68,4 @@ array(4) {
[3]=>
string(9) "Pineapple"
}
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/standard/tests/array/var_export.phpt b/ext/standard/tests/array/var_export.phpt
index 8caf40789f..0b1f76094d 100644
--- a/ext/standard/tests/array/var_export.phpt
+++ b/ext/standard/tests/array/var_export.phpt
@@ -7,7 +7,7 @@ var_export($a);
?>
--EXPECT--
stdClass::__set_state(array(
- 0 => 1,
- 1 => 3,
+ '0' => 1,
+ '1' => 3,
'foo' => 'bar',
))
diff --git a/ext/standard/tests/assert/assert02.phpt b/ext/standard/tests/assert/assert02.phpt
index db60f41466..85b72369cb 100644
--- a/ext/standard/tests/assert/assert02.phpt
+++ b/ext/standard/tests/assert/assert02.phpt
@@ -33,14 +33,24 @@ echo "done\n";
?>
--EXPECTF--
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
+
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
+
Notice: Undefined variable: a in %sassert02.php(%d) : assert code on line 1
Warning: assert(): Assertion "$a" failed in %sassert02.php on line %d
+
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
Failure evaluating code:
aa=sd+as+safsafasfasafsaf
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
+
Warning: assert(): Assertion "0" failed in %sassert02.php on line %d
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
+
Fatal error: Uncaught ParseError: syntax error, unexpected '=', expecting ';' in %s(%d) : assert code:1
Stack trace:
#0 %s(%d): assert('aa=sd+as+safsaf...')
@@ -51,4 +61,4 @@ aa=sd+as+safsafasfasafsaf in %s:%d
Stack trace:
#0 %s(%d): assert('aa=sd+as+safsaf...')
#1 {main}
- thrown in %s on line %d \ No newline at end of file
+ thrown in %s on line %d
diff --git a/ext/standard/tests/assert/assert03.phpt b/ext/standard/tests/assert/assert03.phpt
index d839414cab..74cdb6eda7 100644
--- a/ext/standard/tests/assert/assert03.phpt
+++ b/ext/standard/tests/assert/assert03.phpt
@@ -34,6 +34,9 @@ assert('$a != 0');
?>
==DONE==
--EXPECTF--
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
assertion failed - a - %d,"$a != 0"
+
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
assertion failed - b - %d,"$a != 0"
==DONE==
diff --git a/ext/standard/tests/assert/assert04.phpt b/ext/standard/tests/assert/assert04.phpt
index 53f8d92167..9364a3e0a5 100644
--- a/ext/standard/tests/assert/assert04.phpt
+++ b/ext/standard/tests/assert/assert04.phpt
@@ -40,7 +40,7 @@ Warning: assert() expects at most 2 parameters, 3 given in %s on line %d
Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d
-Warning: assert_options() expects parameter 1 to be integer, %unicode_string_optional% given in %s on line %d
+Warning: assert_options() expects parameter 1 to be integer, string given in %s on line %d
Warning: assert(): assert(0) failed in %s on line %d
diff --git a/ext/standard/tests/assert/assert_basic.phpt b/ext/standard/tests/assert/assert_basic.phpt
index 48b5fb6c6a..7db2a13b19 100644
--- a/ext/standard/tests/assert/assert_basic.phpt
+++ b/ext/standard/tests/assert/assert_basic.phpt
@@ -22,8 +22,11 @@ var_dump($r2=assert($sa));
var_dump($r2=assert(0));
var_dump($r2=assert(1));
--EXPECTF--
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f1 called
bool(false)
+
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
bool(true)
f1 called
bool(false)
diff --git a/ext/standard/tests/assert/assert_basic3.phpt b/ext/standard/tests/assert/assert_basic3.phpt
index 9fcbbd5c3c..044356c312 100644
--- a/ext/standard/tests/assert/assert_basic3.phpt
+++ b/ext/standard/tests/assert/assert_basic3.phpt
@@ -20,6 +20,8 @@ var_dump($r2=assert($sa));
echo "If this is printed BAIL hasn't worked";
--EXPECTF--
int(0)
+
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f1 called
Warning: assert(): assert($sa): "0 != 0" failed in %s on line 10
diff --git a/ext/standard/tests/assert/assert_basic5.phpt b/ext/standard/tests/assert/assert_basic5.phpt
index 745f3e7e29..ac84a158f9 100644
--- a/ext/standard/tests/assert/assert_basic5.phpt
+++ b/ext/standard/tests/assert/assert_basic5.phpt
@@ -24,9 +24,13 @@ var_dump($r2=assert($sa));
var_dump($rao=assert_options(ASSERT_WARNING, 0));
--EXPECTF--
int(0)
+
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f1 called
Warning: assert(): assert($sa): "0 != 0" failed in %s on line 10
bool(false)
+
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
bool(true)
int(1)
diff --git a/ext/standard/tests/assert/assert_basic6.phpt b/ext/standard/tests/assert/assert_basic6.phpt
index 2a73713437..e9b3f04b04 100644
--- a/ext/standard/tests/assert/assert_basic6.phpt
+++ b/ext/standard/tests/assert/assert_basic6.phpt
@@ -20,6 +20,8 @@ var_dump($r2 = assert($sa, "0 is 0"));
echo "If this is printed BAIL hasn't worked";
--EXPECTF--
int(0)
+
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f1 called
Warning: assert(): 0 is 0: "0 != 0" failed in %s on line 10
diff --git a/ext/standard/tests/assert/assert_error.phpt b/ext/standard/tests/assert/assert_error.phpt
index 28655be318..5e2519ab37 100644
--- a/ext/standard/tests/assert/assert_error.phpt
+++ b/ext/standard/tests/assert/assert_error.phpt
@@ -21,7 +21,11 @@ var_dump($ra0 = assert_options(ASSERT_QUIET_EVAL, 1));
var_dump($r2=assert($sa));
--EXPECTF--
-Notice: Use of undefined constant threemeninaboat - assumed 'threemeninaboat' in %s(9) : assert code on line 1
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
+
+Warning: Use of undefined constant threemeninaboat - assumed 'threemeninaboat' (this will throw an Error in a future version of PHP) in %s(9) : assert code on line 1
bool(true)
int(0)
+
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
bool(true)
diff --git a/ext/standard/tests/assert/assert_error1.phpt b/ext/standard/tests/assert/assert_error1.phpt
index 408ede0ae4..6d7248c8ec 100644
--- a/ext/standard/tests/assert/assert_error1.phpt
+++ b/ext/standard/tests/assert/assert_error1.phpt
@@ -43,3 +43,4 @@ NULL
Warning: assert() expects at most 2 parameters, 3 given in %s on line %d
NULL
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
diff --git a/ext/standard/tests/assert/assert_error2.phpt b/ext/standard/tests/assert/assert_error2.phpt
index f9018db05b..aea86f5726 100644
--- a/ext/standard/tests/assert/assert_error2.phpt
+++ b/ext/standard/tests/assert/assert_error2.phpt
@@ -22,6 +22,8 @@ echo "If this is printed BAIL hasn't worked";
--EXPECTF--
int(0)
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
+
Warning: assert(): Assertion "0 != 0" failed in %s on line 9
Fatal error: Uncaught ArgumentCountError: Too few arguments to function f1(), 3 passed and exactly 4 expected in %sassert_error2.php:2
diff --git a/ext/standard/tests/assert/assert_error3.phpt b/ext/standard/tests/assert/assert_error3.phpt
index 80947421f1..24538f4b04 100644
--- a/ext/standard/tests/assert/assert_error3.phpt
+++ b/ext/standard/tests/assert/assert_error3.phpt
@@ -12,6 +12,7 @@ display_errors = 1
<?php
var_dump($r2 = assert("0 $ 0"));
--EXPECTF--
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
Fatal error: Uncaught ParseError: syntax error, unexpected '$', expecting ';' in %s(%d) : assert code:1
Stack trace:
@@ -23,4 +24,4 @@ Next Error: Failure evaluating code:
Stack trace:
#0 %s(%d): assert('0 $ 0')
#1 {main}
- thrown in %s on line %d \ No newline at end of file
+ thrown in %s on line %d
diff --git a/ext/standard/tests/assert/assert_error4.phpt b/ext/standard/tests/assert/assert_error4.phpt
index e4d27aecef..59b4df6935 100644
--- a/ext/standard/tests/assert/assert_error4.phpt
+++ b/ext/standard/tests/assert/assert_error4.phpt
@@ -13,6 +13,7 @@ display_errors = 1
$sa = "0 $ 0";
var_dump($r2 = assert($sa, "Describing what was asserted"));
--EXPECTF--
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
Fatal error: Uncaught ParseError: syntax error, unexpected '$', expecting ';' in %s(%d) : assert code:1
Stack trace:
diff --git a/ext/standard/tests/assert/assert_variation.phpt b/ext/standard/tests/assert/assert_variation.phpt
index 8ae84344c6..a23d468f7b 100644
--- a/ext/standard/tests/assert/assert_variation.phpt
+++ b/ext/standard/tests/assert/assert_variation.phpt
@@ -73,6 +73,8 @@ echo"\n";
--EXPECTF--
Initial values: assert_options(ASSERT_CALLBACK) => [f1]
Initial values: ini.get("assert.callback") => [f1]
+
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f1 called
bool(false)
@@ -80,6 +82,8 @@ Change callback function using ini.set and test return value
string(2) "f1"
assert_options(ASSERT_CALLBACK) => [f2]
ini.get("assert.callback") => [f2]
+
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f2 called
bool(false)
@@ -87,6 +91,8 @@ Change callback function using assert_options and test return value
string(2) "f2"
assert_options(ASSERT_CALLBACK) => [f3]
ini.get("assert.callback") => [f2]
+
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f3 called
bool(false)
@@ -94,6 +100,8 @@ Reset the name of the callback routine to a class method and check that it works
string(2) "f3"
assert_options(ASSERT_CALLBACK) => [c1]
ini.get("assert.callback") => [f2]
+
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
bool(false)
Reset callback options to use a class method
@@ -107,6 +115,8 @@ array(2) {
ini.get("assert.callback") => [f2]
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
+
Deprecated: Non-static method c1::assert() should not be called statically in %s on line 53
Class assertion failed 53, "0 != 0"
bool(false)
@@ -127,5 +137,7 @@ array(2) {
}
ini.get("assert.callback") => [f2]
+
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
Class assertion failed 61, "0 != 0"
bool(false)
diff --git a/ext/standard/tests/assert/bug73303.phpt b/ext/standard/tests/assert/bug73303.phpt
index 57990aba60..7264f5a322 100644
--- a/ext/standard/tests/assert/bug73303.phpt
+++ b/ext/standard/tests/assert/bug73303.phpt
@@ -19,5 +19,6 @@ $obj = new Test();
$obj->main();
?>
---EXPECT--
+--EXPECTF--
+Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
Success
diff --git a/ext/standard/tests/bug49244.phpt b/ext/standard/tests/bug49244.phpt
index 1ba24fb9b4..60942966a7 100644
--- a/ext/standard/tests/bug49244.phpt
+++ b/ext/standard/tests/bug49244.phpt
@@ -5,7 +5,7 @@ Bug #49244 (Floating point NaN cause garbage characters)
for ($i = 0; $i < 10; $i++) {
printf("{%f} %1\$f\n", pow(-1.0, 0.3));
- printf(b"{%f} %1\$f\n", pow(-1.0, 0.3));
+ printf("{%f} %1\$f\n", pow(-1.0, 0.3));
}
?>
diff --git a/ext/standard/tests/checkdnsrr.phpt b/ext/standard/tests/checkdnsrr.phpt
new file mode 100644
index 0000000000..9dd64ffe0d
--- /dev/null
+++ b/ext/standard/tests/checkdnsrr.phpt
@@ -0,0 +1,42 @@
+--TEST--
+bool checkdnsrr ( string $host [, string $type = "MX" ] );
+--CREDITS--
+marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
+--SKIPIF--
+<?php
+if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); }
+?>
+--FILE--
+<?php
+$serverUrl = "bugs.php.net";
+var_dump(checkdnsrr());
+var_dump(checkdnsrr($serverUrl));
+var_dump(checkdnsrr($serverUrl, "A"));
+var_dump(checkdnsrr($serverUrl, "MX"));
+var_dump(checkdnsrr($serverUrl, "NS"));
+var_dump(checkdnsrr($serverUrl, "SOA"));
+var_dump(checkdnsrr($serverUrl, "PTR"));
+var_dump(checkdnsrr($serverUrl, "CNAME"));
+var_dump(checkdnsrr($serverUrl, "AAAA"));
+var_dump(checkdnsrr($serverUrl, "A6"));
+var_dump(checkdnsrr($serverUrl, "SRV"));
+var_dump(checkdnsrr($serverUrl, "NAPTR"));
+var_dump(checkdnsrr($serverUrl, "TXT"));
+var_dump(checkdnsrr($serverUrl, "ANY"));
+?>
+--EXPECTF--
+Warning: checkdnsrr() expects at least %d parameter, %i given in %s on line %d
+NULL
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/class_object/class_exists_basic_001.phpt b/ext/standard/tests/class_object/class_exists_basic_001.phpt
index 4cb6cbd327..208a895e6b 100644
--- a/ext/standard/tests/class_object/class_exists_basic_001.phpt
+++ b/ext/standard/tests/class_object/class_exists_basic_001.phpt
@@ -10,9 +10,9 @@ Test class_exists() function : basic functionality
echo "*** Testing class_exists() : basic functionality ***\n";
-function __autoload($className) {
- echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+ echo "In autoload($className)\n";
+});
echo "Calling class_exists() on non-existent class with autoload explicitly enabled:\n";
var_dump( class_exists('C', true) );
@@ -34,7 +34,7 @@ echo "Done";
--EXPECTF--
*** Testing class_exists() : basic functionality ***
Calling class_exists() on non-existent class with autoload explicitly enabled:
-In __autoload(C)
+In autoload(C)
bool(false)
Calling class_exists() on existing class with autoload explicitly enabled:
@@ -47,9 +47,9 @@ Calling class_exists() on existing class with autoload explicitly disabled:
bool(true)
Calling class_exists() on non-existent class with autoload unspecified:
-In __autoload(E)
+In autoload(E)
bool(false)
Calling class_exists() on existing class with autoload unspecified:
bool(true)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/class_exists_variation_001.phpt b/ext/standard/tests/class_object/class_exists_variation_001.phpt
index 5f51b4bd93..b847c0285c 100644
--- a/ext/standard/tests/class_object/class_exists_variation_001.phpt
+++ b/ext/standard/tests/class_object/class_exists_variation_001.phpt
@@ -8,9 +8,9 @@ Test class_exists() function : usage variations - unexpected types for argument
* Alias to functions:
*/
-function __autoload($className) {
- echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+ echo "In autoload($className)\n";
+});
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -88,15 +88,15 @@ Error: 8 - Undefined variable: undefined_var, %s(67)
Error: 8 - Undefined variable: unset_var, %s(70)
Arg value 0
-In __autoload(0)
+In autoload(0)
bool(false)
Arg value 1
-In __autoload(1)
+In autoload(1)
bool(false)
Arg value 12345
-In __autoload(12345)
+In autoload(12345)
bool(false)
Arg value -2345
@@ -109,7 +109,7 @@ Arg value -10.5
bool(false)
Arg value 101234567000
-In __autoload(101234567000)
+In autoload(101234567000)
bool(false)
Arg value 1.07654321E-9
@@ -150,14 +150,14 @@ Arg value
bool(false)
Arg value 1
-In __autoload(1)
+In autoload(1)
bool(false)
Arg value
bool(false)
Arg value 1
-In __autoload(1)
+In autoload(1)
bool(false)
Arg value
@@ -179,4 +179,4 @@ bool(false)
Arg value
bool(false)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/class_exists_variation_002.phpt b/ext/standard/tests/class_object/class_exists_variation_002.phpt
index 954e4d8cbc..ee6832cf3e 100644
--- a/ext/standard/tests/class_object/class_exists_variation_002.phpt
+++ b/ext/standard/tests/class_object/class_exists_variation_002.phpt
@@ -8,9 +8,9 @@ Test class_exists() function : usage variations - unexpected types for argument
* Alias to functions:
*/
-function __autoload($className) {
- echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+ echo "In autoload($className)\n";
+});
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -95,35 +95,35 @@ Arg value 0
bool(false)
Arg value 1
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value 12345
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value -2345
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value 10.5
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value -10.5
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value 101234567000
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value 1.07654321E-9
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value 0.5
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d)
@@ -158,14 +158,14 @@ Arg value
bool(false)
Arg value 1
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value
bool(false)
Arg value 1
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value
@@ -178,11 +178,11 @@ Arg value
bool(false)
Arg value string
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value string
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Error: 4096 - Object of class stdClass could not be converted to string, %s(80)
@@ -195,4 +195,4 @@ bool(false)
Arg value
bool(false)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/get_class_variation_001.phpt b/ext/standard/tests/class_object/get_class_variation_001.phpt
index d39da3a991..3987968e90 100644
--- a/ext/standard/tests/class_object/get_class_variation_001.phpt
+++ b/ext/standard/tests/class_object/get_class_variation_001.phpt
@@ -152,12 +152,12 @@ bool(false)
Arg value: (type: NULL)
-Warning: get_class() called without object from outside a class in %sget_class_variation_001.php on line %d
+Warning: get_class() expects parameter 1 to be object, null given in %s on line %d
bool(false)
Arg value: (type: NULL)
-Warning: get_class() called without object from outside a class in %sget_class_variation_001.php on line %d
+Warning: get_class() expects parameter 1 to be object, null given in %s on line %d
bool(false)
Arg value: 1 (type: boolean)
@@ -202,11 +202,11 @@ bool(false)
Arg value: (type: NULL)
-Warning: get_class() called without object from outside a class in %sget_class_variation_001.php on line %d
+Warning: get_class() expects parameter 1 to be object, null given in %s on line %d
bool(false)
Arg value: (type: NULL)
-Warning: get_class() called without object from outside a class in %sget_class_variation_001.php on line %d
+Warning: get_class() expects parameter 1 to be object, null given in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/class_object/get_declared_classes_error_001.phpt b/ext/standard/tests/class_object/get_declared_classes_error_001.phpt
index d5b40beee8..ff01feb360 100644
--- a/ext/standard/tests/class_object/get_declared_classes_error_001.phpt
+++ b/ext/standard/tests/class_object/get_declared_classes_error_001.phpt
@@ -12,7 +12,7 @@ echo "*** Testing get_declared_classes() : error conditions ***\n";
// One argument
echo "\n-- Testing get_declared_classes() function with one argument --\n";
-$extra_arg = 10;;
+$extra_arg = 10;
var_dump( get_declared_classes($extra_arg) );
echo "Done";
diff --git a/ext/standard/tests/class_object/get_declared_classes_variation1.phpt b/ext/standard/tests/class_object/get_declared_classes_variation1.phpt
index 259f5dc0f8..3853bb6229 100644
--- a/ext/standard/tests/class_object/get_declared_classes_variation1.phpt
+++ b/ext/standard/tests/class_object/get_declared_classes_variation1.phpt
@@ -11,9 +11,9 @@ Test get_declared_classes() function : testing autoloaded classes
echo "*** Testing get_declared_classes() : testing autoloaded classes ***\n";
-function __autoload($class_name) {
+spl_autoload_register(function ($class_name) {
require_once $class_name . '.inc';
-}
+});
echo "\n-- before instance is declared --\n";
var_dump(in_array('AutoLoaded', get_declared_classes()));
diff --git a/ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt b/ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt
index 2a7f308a34..63b02b85c3 100644
--- a/ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt
+++ b/ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt
@@ -12,7 +12,7 @@ echo "*** Testing get_declared_interfaces() : error conditions ***\n";
// One argument
echo "\n-- Testing get_declared_interfaces() function with one argument --\n";
-$extra_arg = 10;;
+$extra_arg = 10;
var_dump( get_declared_interfaces($extra_arg) );
echo "Done";
diff --git a/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt b/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt
index 56e6161b23..12c92df7fa 100644
--- a/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt
+++ b/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt
@@ -11,9 +11,9 @@ Test get_declared_interfaces() function : autoloading of interfaces
echo "*** Testing get_declared_interfaces() : autoloading of interfaces ***\n";
-function __autoload($class_name) {
+spl_autoload_register(function ($class_name) {
require_once $class_name . '.inc';
-}
+});
echo "\n-- before interface is used --\n";
var_dump(in_array('AutoInterface', get_declared_interfaces()));
diff --git a/ext/standard/tests/class_object/get_declared_traits_error_001.phpt b/ext/standard/tests/class_object/get_declared_traits_error_001.phpt
index f7a00da0dd..0d35fa6d13 100644
--- a/ext/standard/tests/class_object/get_declared_traits_error_001.phpt
+++ b/ext/standard/tests/class_object/get_declared_traits_error_001.phpt
@@ -12,7 +12,7 @@ echo "*** Testing get_declared_traits() : error conditions ***\n";
// One argument
echo "\n-- Testing get_declared_traits() function with one argument --\n";
-$extra_arg = 10;;
+$extra_arg = 10;
var_dump( get_declared_traits($extra_arg) );
echo "Done";
diff --git a/ext/standard/tests/class_object/get_declared_traits_variation1.phpt b/ext/standard/tests/class_object/get_declared_traits_variation1.phpt
index bedd37a3db..6ea3edfa79 100644
--- a/ext/standard/tests/class_object/get_declared_traits_variation1.phpt
+++ b/ext/standard/tests/class_object/get_declared_traits_variation1.phpt
@@ -11,9 +11,9 @@ Test get_declared_traits() function : testing autoloaded traits
echo "*** Testing get_declared_traits() : testing autoloaded traits ***\n";
-function __autoload($trait_name) {
+spl_autoload_register(function ($trait_name) {
require_once $trait_name . '.inc';
-}
+});
echo "\n-- before instance is declared --\n";
var_dump(in_array('AutoTrait', get_declared_traits()));
diff --git a/ext/standard/tests/class_object/get_object_vars_variation_004.phpt b/ext/standard/tests/class_object/get_object_vars_variation_004.phpt
new file mode 100644
index 0000000000..f52b3fed78
--- /dev/null
+++ b/ext/standard/tests/class_object/get_object_vars_variation_004.phpt
Binary files differ
diff --git a/ext/standard/tests/class_object/get_object_vars_variation_005.phpt b/ext/standard/tests/class_object/get_object_vars_variation_005.phpt
new file mode 100644
index 0000000000..d33ef4879f
--- /dev/null
+++ b/ext/standard/tests/class_object/get_object_vars_variation_005.phpt
Binary files differ
diff --git a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
index 0d19e22364..97f848168d 100644
--- a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
+++ b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
@@ -8,9 +8,9 @@ Test get_parent_class() function : usage variations - unexpected argument type.
* Alias to functions:
*/
-function __autoload($className) {
- echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+ echo "In autoload($className)\n";
+});
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -160,11 +160,11 @@ Arg value
bool(false)
Arg value string
-In __autoload(string)
+In autoload(string)
bool(false)
Arg value String
-In __autoload(String)
+In autoload(String)
bool(false)
Error: 4096 - Object of class stdClass could not be converted to string, %s(77)
@@ -176,4 +176,4 @@ bool(false)
Arg value
bool(false)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/interface_exists_variation3.phpt b/ext/standard/tests/class_object/interface_exists_variation3.phpt
index d25d74bc41..5119945bac 100644
--- a/ext/standard/tests/class_object/interface_exists_variation3.phpt
+++ b/ext/standard/tests/class_object/interface_exists_variation3.phpt
@@ -10,9 +10,9 @@ Test interface_exists() function : autoloaded interface
echo "*** Testing interface_exists() : autoloaded interface ***\n";
-function __autoload($class_name) {
+spl_autoload_register(function ($class_name) {
require_once $class_name . '.inc';
-}
+});
echo "\n-- no autoloading --\n";
var_dump(interface_exists("AutoInterface", false));
@@ -32,4 +32,4 @@ bool(false)
-- with autoloading --
bool(true)
-DONE \ No newline at end of file
+DONE
diff --git a/ext/standard/tests/class_object/interface_exists_variation4.phpt b/ext/standard/tests/class_object/interface_exists_variation4.phpt
index c059805623..ca787396f7 100644
--- a/ext/standard/tests/class_object/interface_exists_variation4.phpt
+++ b/ext/standard/tests/class_object/interface_exists_variation4.phpt
@@ -10,10 +10,9 @@ Test interface_exists() function : test autoload default value
echo "*** Testing interface_exists() : test autoload default value ***\n";
-function __autoload($class_name) {
+spl_autoload_register(function ($class_name) {
require_once $class_name . '.inc';
-}
-
+});
var_dump(interface_exists("AutoInterface"));
@@ -24,4 +23,4 @@ echo "\nDONE\n";
*** Testing interface_exists() : test autoload default value ***
bool(true)
-DONE \ No newline at end of file
+DONE
diff --git a/ext/standard/tests/class_object/is_a.phpt b/ext/standard/tests/class_object/is_a.phpt
index 832d5550f1..99794cafb2 100644
--- a/ext/standard/tests/class_object/is_a.phpt
+++ b/ext/standard/tests/class_object/is_a.phpt
@@ -1,7 +1,5 @@
--TEST--
is_a and is_subclass_of behaviour (with and without autoload)
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
--FILE--
<?php
@@ -62,13 +60,10 @@ $t->test();
$t = new derived_a();
$t->test();
-eval('
- function __autoload($name)
- {
- echo ">>>> In __autoload: ";
- var_dump($name);
- }
-');
+spl_autoload_register(function ($name) {
+ echo ">>>> In autoload: ";
+ var_dump($name);
+});
echo "NOW WITH AUTOLOAD\n\n";
@@ -203,11 +198,11 @@ is_subclass_of( OBJECT:base, base) = no
is_subclass_of( STRING:base, base) = no
is_subclass_of( STRING:base, base,false) = no
>>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, base,true) = no
is_a( STRING:undefB, base) = no
is_subclass_of( STRING:undefB, base,false) = no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, base) = no
>>> With Defined class
@@ -218,11 +213,11 @@ is_subclass_of( OBJECT:base, derived_a) = no
is_subclass_of( STRING:base, derived_a) = no
is_subclass_of( STRING:base, derived_a,false) = no
>>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, derived_a,true) = no
is_a( STRING:undefB, derived_a) = no
is_subclass_of( STRING:undefB, derived_a,false) = no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, derived_a) = no
>>> With Defined class
@@ -233,11 +228,11 @@ is_subclass_of( OBJECT:base, if_a) = no
is_subclass_of( STRING:base, if_a) = no
is_subclass_of( STRING:base, if_a,false) = no
>>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, if_a,true) = no
is_a( STRING:undefB, if_a) = no
is_subclass_of( STRING:undefB, if_a,false) = no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, if_a) = no
>>> With Defined class
@@ -248,11 +243,11 @@ is_subclass_of( OBJECT:base, undefA) = no
is_subclass_of( STRING:base, undefA) = no
is_subclass_of( STRING:base, undefA,false) = no
>>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, undefA,true) = no
is_a( STRING:undefB, undefA) = no
is_subclass_of( STRING:undefB, undefA,false) = no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, undefA) = no
@@ -264,11 +259,11 @@ is_subclass_of( OBJECT:derived_a, base) = yes
is_subclass_of( STRING:derived_a, base) = yes
is_subclass_of( STRING:derived_a, base,false) = no
>>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, base,true) = no
is_a( STRING:undefB, base) = no
is_subclass_of( STRING:undefB, base,false) = no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, base) = no
>>> With Defined class
@@ -279,11 +274,11 @@ is_subclass_of( OBJECT:derived_a, derived_a) = no
is_subclass_of( STRING:derived_a, derived_a) = no
is_subclass_of( STRING:derived_a, derived_a,false) = no
>>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, derived_a,true) = no
is_a( STRING:undefB, derived_a) = no
is_subclass_of( STRING:undefB, derived_a,false) = no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, derived_a) = no
>>> With Defined class
@@ -294,11 +289,11 @@ is_subclass_of( OBJECT:derived_a, if_a) = yes
is_subclass_of( STRING:derived_a, if_a) = yes
is_subclass_of( STRING:derived_a, if_a,false) = no
>>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, if_a,true) = no
is_a( STRING:undefB, if_a) = no
is_subclass_of( STRING:undefB, if_a,false) = no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, if_a) = no
>>> With Defined class
@@ -309,11 +304,11 @@ is_subclass_of( OBJECT:derived_a, undefA) = no
is_subclass_of( STRING:derived_a, undefA) = no
is_subclass_of( STRING:derived_a, undefA,false) = no
>>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, undefA,true) = no
is_a( STRING:undefB, undefA) = no
is_subclass_of( STRING:undefB, undefA,false) = no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, undefA) = no
@@ -325,11 +320,11 @@ is_subclass_of( OBJECT:derived_b, base) = yes
is_subclass_of( STRING:derived_b, base) = yes
is_subclass_of( STRING:derived_b, base,false) = no
>>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, base,true) = no
is_a( STRING:undefB, base) = no
is_subclass_of( STRING:undefB, base,false) = no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, base) = no
>>> With Defined class
@@ -340,11 +335,11 @@ is_subclass_of( OBJECT:derived_b, derived_a) = no
is_subclass_of( STRING:derived_b, derived_a) = no
is_subclass_of( STRING:derived_b, derived_a,false) = no
>>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, derived_a,true) = no
is_a( STRING:undefB, derived_a) = no
is_subclass_of( STRING:undefB, derived_a,false) = no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, derived_a) = no
>>> With Defined class
@@ -355,11 +350,11 @@ is_subclass_of( OBJECT:derived_b, if_a) = yes
is_subclass_of( STRING:derived_b, if_a) = yes
is_subclass_of( STRING:derived_b, if_a,false) = no
>>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, if_a,true) = no
is_a( STRING:undefB, if_a) = no
is_subclass_of( STRING:undefB, if_a,false) = no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, if_a) = no
>>> With Defined class
@@ -370,9 +365,9 @@ is_subclass_of( OBJECT:derived_b, undefA) = no
is_subclass_of( STRING:derived_b, undefA) = no
is_subclass_of( STRING:derived_b, undefA,false) = no
>>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, undefA,true) = no
is_a( STRING:undefB, undefA) = no
is_subclass_of( STRING:undefB, undefA,false) = no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, undefA) = no
diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
index 201d8789ea..b1cb553abd 100644
--- a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
+++ b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
@@ -8,9 +8,9 @@ Test is_subclass_of() function : usage variations - unexpected type for arg 1
* Alias to functions:
*/
// Note: basic use cases in Zend/tests/is_a.phpt
-function __autoload($className) {
- echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+ echo "In autoload($className)\n";
+});
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -161,11 +161,11 @@ Arg value
bool(false)
Arg value string
-In __autoload(string)
+In autoload(string)
bool(false)
Arg value String
-In __autoload(String)
+In autoload(String)
bool(false)
Arg value
@@ -173,4 +173,4 @@ bool(false)
Arg value
bool(false)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt
index 9bb712b757..85f697654d 100644
--- a/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt
+++ b/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt
@@ -8,9 +8,9 @@ Test is_subclass_of() function : usage variations - unexpected type for arg 2
* Alias to functions:
*/
-function __autoload($className) {
- echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+ echo "In autoload($className)\n";
+});
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -173,4 +173,4 @@ bool(false)
Arg value
bool(false)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt
index 65ae8a4e23..adecd5003d 100644
--- a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt
+++ b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt
@@ -8,9 +8,9 @@ Test is_subclass_of() function : usage variations - unexpected type for arg 1 w
* Alias to functions:
*/
// Note: basic use cases in Zend/tests/is_a.phpt
-function __autoload($className) {
- echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+ echo "In autoload($className)\n";
+});
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -161,11 +161,11 @@ Arg value
bool(false)
Arg value string
-In __autoload(string)
+In autoload(string)
bool(false)
Arg value String
-In __autoload(String)
+In autoload(String)
bool(false)
Arg value
@@ -173,4 +173,4 @@ bool(false)
Arg value
bool(false)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/method_exists_basic_003.phpt b/ext/standard/tests/class_object/method_exists_basic_003.phpt
index 32f62b7e4b..3ac1795149 100644
--- a/ext/standard/tests/class_object/method_exists_basic_003.phpt
+++ b/ext/standard/tests/class_object/method_exists_basic_003.phpt
@@ -8,15 +8,15 @@ method_exists() on non-existent class, with __autoload().
* Alias to functions:
*/
-function __autoload($name) {
- echo "In __autoload($name)\n";
-}
+spl_autoload_register(function ($name) {
+ echo "In autoload($name)\n";
+});
var_dump(method_exists('UndefC', 'func'));
echo "Done";
?>
--EXPECTF--
-In __autoload(UndefC)
+In autoload(UndefC)
bool(false)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/method_exists_variation_001.phpt b/ext/standard/tests/class_object/method_exists_variation_001.phpt
index 1947c76ac5..b41a1a11ae 100644
--- a/ext/standard/tests/class_object/method_exists_variation_001.phpt
+++ b/ext/standard/tests/class_object/method_exists_variation_001.phpt
@@ -8,9 +8,9 @@ Test method_exists() function : usage variations - unexpected type for arg 1
* Alias to functions:
*/
-function __autoload($className) {
- echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+ echo "In autoload($className)\n";
+});
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -160,11 +160,11 @@ Arg value
bool(false)
Arg value string
-In __autoload(string)
+In autoload(string)
bool(false)
Arg value String
-In __autoload(String)
+In autoload(String)
bool(false)
Arg value
@@ -172,4 +172,4 @@ bool(false)
Arg value
bool(false)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/method_exists_variation_002.phpt b/ext/standard/tests/class_object/method_exists_variation_002.phpt
index b1204e833d..5c924bdc5a 100644
--- a/ext/standard/tests/class_object/method_exists_variation_002.phpt
+++ b/ext/standard/tests/class_object/method_exists_variation_002.phpt
@@ -8,9 +8,9 @@ Test method_exists() function : usage variations - unexpected type for arg 2
* Alias to functions:
*/
-function __autoload($className) {
- echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+ echo "In autoload($className)\n";
+});
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -173,4 +173,4 @@ bool(false)
Arg value
bool(false)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/property_exists_variation1.phpt b/ext/standard/tests/class_object/property_exists_variation1.phpt
index 1505a4bafa..1830440621 100644
--- a/ext/standard/tests/class_object/property_exists_variation1.phpt
+++ b/ext/standard/tests/class_object/property_exists_variation1.phpt
@@ -10,9 +10,9 @@ Test property_exists() function : class auto loading
echo "*** Testing property_exists() : class auto loading ***\n";
-function __autoload($class_name) {
+spl_autoload_register(function ($class_name) {
require_once $class_name . '.inc';
-}
+});
echo "\ntesting property in autoloaded class\n";
var_dump(property_exists("AutoTest", "bob"));
@@ -30,4 +30,4 @@ bool(true)
testing __get magic method
bool(false)
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/standard/tests/class_object/trait_exists_basic_001.phpt b/ext/standard/tests/class_object/trait_exists_basic_001.phpt
index 19616ab5c5..6e1d45227d 100644
--- a/ext/standard/tests/class_object/trait_exists_basic_001.phpt
+++ b/ext/standard/tests/class_object/trait_exists_basic_001.phpt
@@ -10,9 +10,9 @@ Test trait_exists() function : basic functionality
echo "*** Testing trait_exists() : basic functionality ***\n";
-function __autoload($traitName) {
- echo "In __autoload($traitName)\n";
-}
+spl_autoload_register(function ($traitName) {
+ echo "In autoload($traitName)\n";
+});
trait MyTrait {}
@@ -36,7 +36,7 @@ echo "Done";
--EXPECTF--
*** Testing trait_exists() : basic functionality ***
Calling trait_exists() on non-existent trait with autoload explicitly enabled:
-In __autoload(C)
+In autoload(C)
bool(false)
Calling trait_exists() on existing trait with autoload explicitly enabled:
@@ -49,9 +49,9 @@ Calling trait_exists() on existing trait with autoload explicitly disabled:
bool(true)
Calling trait_exists() on non-existent trait with autoload unspecified:
-In __autoload(E)
+In autoload(E)
bool(false)
Calling trait_exists() on existing trait with autoload unspecified:
bool(true)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/trait_exists_variation_001.phpt b/ext/standard/tests/class_object/trait_exists_variation_001.phpt
index 81df711cfa..4fd2b8d5af 100644
--- a/ext/standard/tests/class_object/trait_exists_variation_001.phpt
+++ b/ext/standard/tests/class_object/trait_exists_variation_001.phpt
@@ -8,9 +8,9 @@ Test trait_exists() function : usage variations - unexpected types for argument
* Alias to functions:
*/
-function __autoload($traitName) {
- echo "In __autoload($traitName)\n";
-}
+spl_autoload_register(function ($traitName) {
+ echo "In autoload($traitName)\n";
+});
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -88,15 +88,15 @@ Error: 8 - Undefined variable: undefined_var, %s(67)
Error: 8 - Undefined variable: unset_var, %s(70)
Arg value 0
-In __autoload(0)
+In autoload(0)
bool(false)
Arg value 1
-In __autoload(1)
+In autoload(1)
bool(false)
Arg value 12345
-In __autoload(12345)
+In autoload(12345)
bool(false)
Arg value -2345
@@ -109,7 +109,7 @@ Arg value -10.5
bool(false)
Arg value 101234567000
-In __autoload(101234567000)
+In autoload(101234567000)
bool(false)
Arg value 1.07654321E-9
@@ -150,14 +150,14 @@ Arg value
bool(false)
Arg value 1
-In __autoload(1)
+In autoload(1)
bool(false)
Arg value
bool(false)
Arg value 1
-In __autoload(1)
+In autoload(1)
bool(false)
Arg value
@@ -179,4 +179,4 @@ bool(false)
Arg value
bool(false)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/trait_exists_variation_002.phpt b/ext/standard/tests/class_object/trait_exists_variation_002.phpt
index 365efffe41..50f2a0256f 100644
--- a/ext/standard/tests/class_object/trait_exists_variation_002.phpt
+++ b/ext/standard/tests/class_object/trait_exists_variation_002.phpt
@@ -8,9 +8,9 @@ Test trait_exists() function : usage variations - unexpected types for argument
* Alias to functions:
*/
-function __autoload($traitName) {
- echo "In __autoload($traitName)\n";
-}
+spl_autoload_register(function ($traitName) {
+ echo "In autoload($traitName)\n";
+});
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -95,35 +95,35 @@ Arg value 0
bool(false)
Arg value 1
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value 12345
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value -2345
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value 10.5
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value -10.5
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value 101234567000
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value 1.07654321E-9
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value 0.5
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d)
@@ -158,14 +158,14 @@ Arg value
bool(false)
Arg value 1
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value
bool(false)
Arg value 1
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value
@@ -178,11 +178,11 @@ Arg value
bool(false)
Arg value string
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Arg value string
-In __autoload(string_val)
+In autoload(string_val)
bool(false)
Error: 4096 - Object of class stdClass could not be converted to string, %s(80)
@@ -195,4 +195,4 @@ bool(false)
Arg value
bool(false)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/dir/dir_bug73971.phpt b/ext/standard/tests/dir/dir_bug73971.phpt
new file mode 100644
index 0000000000..86cb29ac58
--- /dev/null
+++ b/ext/standard/tests/dir/dir_bug73971.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Bug #73971 Filename got limited to MAX_PATH on Win32 when scan directory
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip Valid only on Windows");
+}
+?>
+--FILE--
+<?php
+$base = __DIR__ . DIRECTORY_SEPARATOR . "bug73971";
+$filename = $base . DIRECTORY_SEPARATOR . str_repeat('テスト', 48); // 144 glyph here, less than 256
+
+mkdir($base);
+mkdir($filename); // created correctly
+
+var_dump(basename($filename)); // 432 bytes here, more than 256
+
+echo "\ntest dir()\n";
+$d = dir($base);
+while (false !== ($entry = $d->read())) {
+ var_dump($entry);
+}
+$d->close();
+
+echo "\ntest DirectoryIterator\n";
+$dir = new DirectoryIterator($base);
+foreach ($dir as $finfo) {
+ var_dump($finfo->getFilename());
+}
+
+?>
+==DONE==
+--CLEAN--
+<?php
+$base = __DIR__ . DIRECTORY_SEPARATOR . "bug73971";
+$filename = $base . DIRECTORY_SEPARATOR . str_repeat('テスト', 48);
+
+rmdir($filename);
+rmdir($base);
+?>
+--EXPECTF--
+string(432) "テストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテスト"
+
+test dir()
+string(1) "."
+string(2) ".."
+string(432) "テストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテスト"
+
+test DirectoryIterator
+string(1) "."
+string(2) ".."
+string(432) "テストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテスト"
+==DONE==
diff --git a/ext/standard/tests/file/005_variation-win32.phpt b/ext/standard/tests/file/005_variation-win32.phpt
index 34558758e3..ffcdc33cd6 100644
--- a/ext/standard/tests/file/005_variation-win32.phpt
+++ b/ext/standard/tests/file/005_variation-win32.phpt
@@ -81,7 +81,7 @@ sleep(2);
/* filemtime + 2 & filectime + 2 */
echo "\n-- Checking different times, after writing into the file --\n";
$file_write_handle = fopen($file_name, "w");
-fwrite($file_write_handle, b"Hello, world");
+fwrite($file_write_handle, "Hello, world");
fclose($file_write_handle);
stat_fn($file_name);
sleep(2);
diff --git a/ext/standard/tests/file/007_variation15.phpt b/ext/standard/tests/file/007_variation15.phpt
index 1a2d530b65..960ee03e91 100644
--- a/ext/standard/tests/file/007_variation15.phpt
+++ b/ext/standard/tests/file/007_variation15.phpt
@@ -21,7 +21,7 @@ Test fopen and fclose() functions - usage variations - "xt" mode
and fclose function
*/
$file_path = dirname(__FILE__);
-$string = b"abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
$file = $file_path."/007_variation15.tmp";
echo "*** Test fopen() & fclose() functions: with 'xt' mode ***\n";
@@ -45,14 +45,14 @@ unlink(dirname(__FILE__)."/007_variation15.tmp");
--EXPECTF--
*** Test fopen() & fclose() functions: with 'xt' mode ***
resource(%d) of type (stream)
-%unicode|string%(6) "stream"
+string(6) "stream"
int(0)
int(37)
int(37)
string(0) ""
int(0)
bool(true)
-%unicode|string%(7) "Unknown"
+string(7) "Unknown"
Warning: fopen(%s): failed to open stream: File exists in %s on line %s
*** Done ***
diff --git a/ext/standard/tests/file/007_variation23.phpt b/ext/standard/tests/file/007_variation23.phpt
index 1826296a06..3d1634de29 100644
--- a/ext/standard/tests/file/007_variation23.phpt
+++ b/ext/standard/tests/file/007_variation23.phpt
@@ -21,7 +21,7 @@ Test fopen and fclose() functions - usage variations - "xb" mode
and fclose function
*/
$file_path = dirname(__FILE__);
-$string = b"abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
$file = $file_path."/007_variation23.tmp";
echo "*** Test fopen() & fclose() functions: with 'xb' mode ***\n";
@@ -45,14 +45,14 @@ unlink(dirname(__FILE__)."/007_variation23.tmp");
--EXPECTF--
*** Test fopen() & fclose() functions: with 'xb' mode ***
resource(%d) of type (stream)
-%unicode|string%(6) "stream"
+string(6) "stream"
int(0)
int(37)
int(37)
string(0) ""
int(0)
bool(true)
-%unicode|string%(7) "Unknown"
+string(7) "Unknown"
Warning: fopen(%s): failed to open stream: File exists in %s on line %s
*** Done ***
diff --git a/ext/standard/tests/file/007_variation7.phpt b/ext/standard/tests/file/007_variation7.phpt
index 06bf9117f3..69f9a731cf 100644
--- a/ext/standard/tests/file/007_variation7.phpt
+++ b/ext/standard/tests/file/007_variation7.phpt
@@ -21,7 +21,7 @@ Test fopen and fclose() functions - usage variations - "x" mode
and fclose function
*/
$file_path = dirname(__FILE__);
-$string = b"abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
$file = $file_path."/007_variation7.tmp";
echo "*** Test fopen() & fclose() functions: with 'x' mode ***\n";
@@ -45,14 +45,14 @@ unlink(dirname(__FILE__)."/007_variation7.tmp");
--EXPECTF--
*** Test fopen() & fclose() functions: with 'x' mode ***
resource(%d) of type (stream)
-%unicode|string%(6) "stream"
+string(6) "stream"
int(0)
int(37)
int(37)
string(0) ""
int(0)
bool(true)
-%unicode|string%(7) "Unknown"
+string(7) "Unknown"
Warning: fopen(%s): failed to open stream: File exists in %s on line %s
*** Done ***
diff --git a/ext/standard/tests/file/bug27508.phpt b/ext/standard/tests/file/bug27508.phpt
index 188080aa25..26959ec511 100644
--- a/ext/standard/tests/file/bug27508.phpt
+++ b/ext/standard/tests/file/bug27508.phpt
@@ -46,7 +46,7 @@ stream_wrapper_register("myFile", "FileStream")
or die("Failed to register protocol");
$tmp_dir = __DIR__;
-$tn = (binary) tempnam($tmp_dir, 'foo');
+$tn = tempnam($tmp_dir, 'foo');
if (!$tn) {
die("tempnam failed");
}
@@ -56,9 +56,9 @@ if (!$fp) {
die("fopen failed");
}
-fwrite($fp, b"line1\n");
-fwrite($fp, b"line2\n");
-fwrite($fp, b"line3\n");
+fwrite($fp, "line1\n");
+fwrite($fp, "line2\n");
+fwrite($fp, "line3\n");
debug_zval_dump(feof($fp));
rewind($fp);
diff --git a/ext/standard/tests/file/bug38450.phpt b/ext/standard/tests/file/bug38450.phpt
index 4a2953ea79..2b59f50750 100644
--- a/ext/standard/tests/file/bug38450.phpt
+++ b/ext/standard/tests/file/bug38450.phpt
@@ -88,9 +88,9 @@ $myvar = "";
$fp = fopen("var://myvar", "r+");
-fwrite($fp, b"line1\n");
-fwrite($fp, b"line2\n");
-fwrite($fp, b"line3\n");
+fwrite($fp, "line1\n");
+fwrite($fp, "line2\n");
+fwrite($fp, "line3\n");
rewind($fp);
while (!feof($fp)) {
diff --git a/ext/standard/tests/file/bug38450_1.phpt b/ext/standard/tests/file/bug38450_1.phpt
index d0682186f9..07ca7166f3 100644
--- a/ext/standard/tests/file/bug38450_1.phpt
+++ b/ext/standard/tests/file/bug38450_1.phpt
@@ -88,9 +88,9 @@ $myvar = "";
$fp = fopen("var://myvar", "r+");
-fwrite($fp, b"line1\n");
-fwrite($fp, b"line2\n");
-fwrite($fp, b"line3\n");
+fwrite($fp, "line1\n");
+fwrite($fp, "line2\n");
+fwrite($fp, "line3\n");
rewind($fp);
while (!feof($fp)) {
diff --git a/ext/standard/tests/file/bug43008.phpt b/ext/standard/tests/file/bug43008.phpt
index 3c9411d329..0d9d6ed986 100644
--- a/ext/standard/tests/file/bug43008.phpt
+++ b/ext/standard/tests/file/bug43008.phpt
@@ -8,13 +8,13 @@ if (!extension_loaded("iconv")) die("skip iconv extension not available");
allow_url_fopen=1
--FILE--
<?php
-$url = b""
- . b"php://filter/read="
- . urlencode(b"convert.iconv.ISO-8859-15/UTF-8")
- . b'|' . urlencode(b"string.rot13")
- . b'|' . urlencode(b"string.rot13")
- . b'|' . urlencode(b"convert.iconv.UTF-8/ISO-8859-15")
- . b"/resource=data://text/plain,foob%E2r";
+$url = ""
+ . "php://filter/read="
+ . urlencode("convert.iconv.ISO-8859-15/UTF-8")
+ . '|' . urlencode("string.rot13")
+ . '|' . urlencode("string.rot13")
+ . '|' . urlencode("convert.iconv.UTF-8/ISO-8859-15")
+ . "/resource=data://text/plain,foob%E2r";
var_dump(urlencode(file_get_contents($url)));
?>
--EXPECTF--
diff --git a/ext/standard/tests/file/bug43353-win32.phpt b/ext/standard/tests/file/bug43353-win32.phpt
index 2faabb92c0..76605d97a8 100644
--- a/ext/standard/tests/file/bug43353-win32.phpt
+++ b/ext/standard/tests/file/bug43353-win32.phpt
@@ -1,25 +1,25 @@
---TEST--
-Bug #43353 wrong detection of 'data' wrapper
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != "WIN")
- die("skip Run only on Windows");
-?>
---INI--
-allow_url_fopen=1
---FILE--
-<?php
-
-var_dump(is_dir('file:///datafoo:test'));
-var_dump(is_dir('datafoo:test'));
-var_dump(file_get_contents('data:text/plain,foo'));
-var_dump(file_get_contents('datafoo:text/plain,foo'));
-
-?>
---EXPECTF--
-bool(false)
-bool(false)
-string(3) "foo"
-
-Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s
-bool(false)
+--TEST--
+Bug #43353 wrong detection of 'data' wrapper
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Run only on Windows");
+?>
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+
+var_dump(is_dir('file:///datafoo:test'));
+var_dump(is_dir('datafoo:test'));
+var_dump(file_get_contents('data:text/plain,foo'));
+var_dump(file_get_contents('datafoo:text/plain,foo'));
+
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+string(3) "foo"
+
+Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s
+bool(false)
diff --git a/ext/standard/tests/file/bug44034.phpt b/ext/standard/tests/file/bug44034.phpt
index 36d88a983d..863bf57e05 100644
--- a/ext/standard/tests/file/bug44034.phpt
+++ b/ext/standard/tests/file/bug44034.phpt
@@ -19,23 +19,23 @@ foreach($urls as $url) {
data://text/plain,foo\r\nbar\r\n
array(2) {
[0]=>
- %unicode|string%(3) "foo"
+ string(3) "foo"
[1]=>
- %unicode|string%(3) "bar"
+ string(3) "bar"
}
data://text/plain,\r\nfoo\r\nbar\r\n
array(3) {
[0]=>
- %unicode|string%(0) ""
+ string(0) ""
[1]=>
- %unicode|string%(3) "foo"
+ string(3) "foo"
[2]=>
- %unicode|string%(3) "bar"
+ string(3) "bar"
}
data://text/plain,foo\r\nbar
array(2) {
[0]=>
- %unicode|string%(3) "foo"
+ string(3) "foo"
[1]=>
- %unicode|string%(3) "bar"
+ string(3) "bar"
}
diff --git a/ext/standard/tests/file/bug46347.phpt b/ext/standard/tests/file/bug46347.phpt
index af81bc217f..e942c71ba3 100644
--- a/ext/standard/tests/file/bug46347.phpt
+++ b/ext/standard/tests/file/bug46347.phpt
@@ -19,6 +19,6 @@ unlink(__DIR__.'/parse.ini');
?>
--EXPECTF--
array(1) {
- [%u|b%"part1.*.part2"]=>
- %unicode|string%(1) "1"
+ ["part1.*.part2"]=>
+ string(1) "1"
}
diff --git a/ext/standard/tests/file/bug49047.phpt b/ext/standard/tests/file/bug49047.phpt
index 1ccc94e287..d0805a16fd 100644
--- a/ext/standard/tests/file/bug49047.phpt
+++ b/ext/standard/tests/file/bug49047.phpt
@@ -1,17 +1,17 @@
---TEST--
-Test fopen() function : variation: interesting paths, no use include path
---FILE--
-<?php
-// fopen with interesting windows paths.
-$testdir = __DIR__ . '/bug47177.tmpdir';
-mkdir($testdir);
-$t = time() - 3600;
-touch($testdir, $t);
-clearstatcache();
-$t2 = filemtime($testdir);
-if ($t2 != $t) echo "failed (got $t2, expecting $t)\n";
-rmdir($testdir);
-echo "Ok.";
-?>
---EXPECTF--
-Ok.
+--TEST--
+Test fopen() function : variation: interesting paths, no use include path
+--FILE--
+<?php
+// fopen with interesting windows paths.
+$testdir = __DIR__ . '/bug47177.tmpdir';
+mkdir($testdir);
+$t = time() - 3600;
+touch($testdir, $t);
+clearstatcache();
+$t2 = filemtime($testdir);
+if ($t2 != $t) echo "failed (got $t2, expecting $t)\n";
+rmdir($testdir);
+echo "Ok.";
+?>
+--EXPECTF--
+Ok.
diff --git a/ext/standard/tests/file/bug52820.phpt b/ext/standard/tests/file/bug52820.phpt
index a00ebf50b6..e51c27e457 100644
--- a/ext/standard/tests/file/bug52820.phpt
+++ b/ext/standard/tests/file/bug52820.phpt
@@ -2,7 +2,7 @@
Bug #52820 (writes to fopencookie FILE* not committed when seeking the stream)
--SKIPIF--
<?php
-if (!function_exists('leak_variable'))
+if (!function_exists('zend_leak_variable'))
die("skip only for debug builds");
/* unfortunately no standard function does a cast to FILE*, so we need
* curl to test this */
@@ -33,10 +33,10 @@ echo "\nmemory stream (close after):\n";
fclose(do_stuff("php://memory"));
echo "\ntemp stream (leak):\n";
-leak_variable(do_stuff("php://temp"), true);
+zend_leak_variable(do_stuff("php://temp"));
echo "\nmemory stream (leak):\n";
-leak_variable(do_stuff("php://memory"), true);
+zend_leak_variable(do_stuff("php://memory"));
echo "\nDone.\n";
--EXPECTF--
diff --git a/ext/standard/tests/file/bug53241.phpt b/ext/standard/tests/file/bug53241.phpt
index 685bf14620..7ccf2be109 100644
--- a/ext/standard/tests/file/bug53241.phpt
+++ b/ext/standard/tests/file/bug53241.phpt
@@ -1,23 +1,23 @@
---TEST--
-Bug #53241 (stream casting that relies on fdopen/fopencookie fails with 'xb' mode)
---SKIPIF--
-<?php
-/* unfortunately no standard function does a cast to FILE*, so we need
- * curl to test this */
-if (!extension_loaded("curl")) exit("skip curl extension not loaded");
---FILE--
-<?php
-$fn = __DIR__ . "/test.tmp";
-@unlink($fn);
-$fh = fopen($fn, 'xb');
-$ch = curl_init('http://www.yahoo.com/');
-var_dump(curl_setopt($ch, CURLOPT_FILE, $fh));
-echo "Done.\n";
---CLEAN--
-<?php
-$fn = __DIR__ . "/test.tmp";
-@unlink($fn);
-?>
---EXPECT--
-bool(true)
-Done.
+--TEST--
+Bug #53241 (stream casting that relies on fdopen/fopencookie fails with 'xb' mode)
+--SKIPIF--
+<?php
+/* unfortunately no standard function does a cast to FILE*, so we need
+ * curl to test this */
+if (!extension_loaded("curl")) exit("skip curl extension not loaded");
+--FILE--
+<?php
+$fn = __DIR__ . "/test.tmp";
+@unlink($fn);
+$fh = fopen($fn, 'xb');
+$ch = curl_init('http://www.yahoo.com/');
+var_dump(curl_setopt($ch, CURLOPT_FILE, $fh));
+echo "Done.\n";
+--CLEAN--
+<?php
+$fn = __DIR__ . "/test.tmp";
+@unlink($fn);
+?>
+--EXPECT--
+bool(true)
+Done.
diff --git a/ext/standard/tests/file/bug55124.phpt b/ext/standard/tests/file/bug55124.phpt
index 1915b7f209..7938196dbc 100644
--- a/ext/standard/tests/file/bug55124.phpt
+++ b/ext/standard/tests/file/bug55124.phpt
@@ -1,18 +1,18 @@
---TEST--
-Bug #55124 (recursive mkdir fails with current (dot) directory in path)
---FILE--
-<?php
-$old_dir_path = getcwd();
-chdir(__DIR__);
-mkdir('a/./b', 0755, true);
-if (is_dir('a/b')) {
- rmdir('a/b');
-}
-if (is_dir('./a')) {
- rmdir('a');
-}
-chdir($old_dir_path);
-echo "OK";
-?>
---EXPECT--
-OK
+--TEST--
+Bug #55124 (recursive mkdir fails with current (dot) directory in path)
+--FILE--
+<?php
+$old_dir_path = getcwd();
+chdir(__DIR__);
+mkdir('a/./b', 0755, true);
+if (is_dir('a/b')) {
+ rmdir('a/b');
+}
+if (is_dir('./a')) {
+ rmdir('a');
+}
+chdir($old_dir_path);
+echo "OK";
+?>
+--EXPECT--
+OK
diff --git a/ext/standard/tests/file/bug60120.phpt b/ext/standard/tests/file/bug60120.phpt
index 8915bb833c..92172b9112 100644
--- a/ext/standard/tests/file/bug60120.phpt
+++ b/ext/standard/tests/file/bug60120.phpt
@@ -1,74 +1,74 @@
---TEST--
-Bug #60120 (proc_open hangs when data in stdin/out/err is getting larger or equal to 2048)
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip only for Windows');
-}
-$php = getenv('TEST_PHP_EXECUTABLE');
-if (!$php) {
- die("No php executable defined\n");
-}
-?>
---FILE--
-<?php
-
-error_reporting(E_ALL);
-
-$php = getenv('TEST_PHP_EXECUTABLE');
-if (!$php) {
- die("No php executable defined\n");
-}
-$cmd = 'php -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
-$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
-$stdin = str_repeat('*', 1024 * 16) . '!';
-$stdin = str_repeat('*', 2049 );
-
-$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));
-$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
-
-foreach ($pipes as $pipe) {
- stream_set_blocking($pipe, false);
-}
-$writePipes = array($pipes[0]);
-$stdinLen = strlen($stdin);
-$stdinOffset = 0;
-
-unset($pipes[0]);
-
-while ($pipes || $writePipes) {
- $r = $pipes;
- $w = $writePipes;
- $e = null;
- $n = stream_select($r, $w, $e, 60);
-
- if (false === $n) {
- break;
- } elseif ($n === 0) {
- proc_terminate($process);
-
- }
- if ($w) {
- $written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
- if (false !== $written) {
- $stdinOffset += $written;
- }
- if ($stdinOffset >= $stdinLen) {
- fclose($writePipes[0]);
- $writePipes = null;
- }
- }
-
- foreach ($r as $pipe) {
- $type = array_search($pipe, $pipes);
- $data = fread($pipe, 8192);
- if (false === $data || feof($pipe)) {
- fclose($pipe);
- unset($pipes[$type]);
- }
- }
-}
-echo "OK.";
-?>
---EXPECT--
-OK.
+--TEST--
+Bug #60120 (proc_open hangs when data in stdin/out/err is getting larger or equal to 2048)
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only for Windows');
+}
+$php = getenv('TEST_PHP_EXECUTABLE');
+if (!$php) {
+ die("No php executable defined\n");
+}
+?>
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+$php = getenv('TEST_PHP_EXECUTABLE');
+if (!$php) {
+ die("No php executable defined\n");
+}
+$cmd = 'php -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
+$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
+$stdin = str_repeat('*', 1024 * 16) . '!';
+$stdin = str_repeat('*', 2049 );
+
+$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));
+$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
+
+foreach ($pipes as $pipe) {
+ stream_set_blocking($pipe, false);
+}
+$writePipes = array($pipes[0]);
+$stdinLen = strlen($stdin);
+$stdinOffset = 0;
+
+unset($pipes[0]);
+
+while ($pipes || $writePipes) {
+ $r = $pipes;
+ $w = $writePipes;
+ $e = null;
+ $n = stream_select($r, $w, $e, 60);
+
+ if (false === $n) {
+ break;
+ } elseif ($n === 0) {
+ proc_terminate($process);
+
+ }
+ if ($w) {
+ $written = fwrite($writePipes[0], substr($stdin, $stdinOffset), 8192);
+ if (false !== $written) {
+ $stdinOffset += $written;
+ }
+ if ($stdinOffset >= $stdinLen) {
+ fclose($writePipes[0]);
+ $writePipes = null;
+ }
+ }
+
+ foreach ($r as $pipe) {
+ $type = array_search($pipe, $pipes);
+ $data = fread($pipe, 8192);
+ if (false === $data || feof($pipe)) {
+ fclose($pipe);
+ unset($pipes[$type]);
+ }
+ }
+}
+echo "OK.";
+?>
+--EXPECT--
+OK.
diff --git a/ext/standard/tests/file/bug69442.phpt b/ext/standard/tests/file/bug69442.phpt
index e5255acb37..655eab306c 100644
--- a/ext/standard/tests/file/bug69442.phpt
+++ b/ext/standard/tests/file/bug69442.phpt
@@ -13,7 +13,7 @@ EOC;
$tmpFile = tempnam(sys_get_temp_dir(), "bug69442");
file_put_contents($tmpFile, $code);
- exec($_SERVER['TEST_PHP_EXECUTABLE']." ".$tmpFile." 2>&1", $output);
+ exec($_SERVER['TEST_PHP_EXECUTABLE']." -d display_errors=1 -d error_reporting=E_ALL ".$tmpFile." 2>&1", $output);
$output = join("\n", $output);
unlink($tmpFile);
diff --git a/ext/standard/tests/file/chroot_001.phpt b/ext/standard/tests/file/chroot_001.phpt
index daa1a8366e..b42b17b892 100644
--- a/ext/standard/tests/file/chroot_001.phpt
+++ b/ext/standard/tests/file/chroot_001.phpt
@@ -27,4 +27,4 @@ rmdir("chroot_001_x");
bool(true)
bool(true)
bool(false)
-%unicode|string%(1) "/"
+string(1) "/"
diff --git a/ext/standard/tests/file/clearstatcache_001.phpt b/ext/standard/tests/file/clearstatcache_001.phpt
index 4282430b51..5f2fe589eb 100644
--- a/ext/standard/tests/file/clearstatcache_001.phpt
+++ b/ext/standard/tests/file/clearstatcache_001.phpt
@@ -36,8 +36,8 @@ var_dump(realpath(__FILE__ . "_link2"));
@unlink(__FILE__ . "_link2");
?>
--EXPECTF--
-%unicode|string%(%d) "%s_dir1"
-%unicode|string%(%d) "%s_dir1"
-%unicode|string%(%d) "%s_dir1"
-%unicode|string%(%d) "%s_dir1"
+string(%d) "%s_dir1"
+string(%d) "%s_dir1"
+string(%d) "%s_dir1"
+string(%d) "%s_dir1"
bool(false)
diff --git a/ext/standard/tests/file/copy_variation1.phpt b/ext/standard/tests/file/copy_variation1.phpt
index 4d0a97302a..7cf20fd749 100644
--- a/ext/standard/tests/file/copy_variation1.phpt
+++ b/ext/standard/tests/file/copy_variation1.phpt
@@ -15,7 +15,7 @@ echo "*** Test copy() function: destination file names containing numerics/strin
$file_path = dirname(__FILE__);
$src_file_name = $file_path."/copy_variation1.tmp";
$file_handle = fopen($src_file_name, "w");
-fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fwrite( $file_handle, str_repeat("Hello2World...\n", 100) );
fclose($file_handle);
/* array of destination file names */
diff --git a/ext/standard/tests/file/copy_variation10.phpt b/ext/standard/tests/file/copy_variation10.phpt
index 98494af043..c5cbc84254 100644
--- a/ext/standard/tests/file/copy_variation10.phpt
+++ b/ext/standard/tests/file/copy_variation10.phpt
@@ -14,7 +14,7 @@ $file_path = dirname(__FILE__);
echo "*** Test copy(): Trying to create a copy of file with the same source name ***\n";
$file = $file_path."/copy_variation10.tmp";
$file_handle = fopen($file, "w");
-fwrite($file_handle, str_repeat(b"Hello2world...\n", 100));
+fwrite($file_handle, str_repeat("Hello2world...\n", 100));
fclose($file_handle);
var_dump( copy($file, $file) );
diff --git a/ext/standard/tests/file/copy_variation11.phpt b/ext/standard/tests/file/copy_variation11.phpt
index adee8e1c65..b01dab0890 100644
--- a/ext/standard/tests/file/copy_variation11.phpt
+++ b/ext/standard/tests/file/copy_variation11.phpt
@@ -14,7 +14,7 @@ $file_path = dirname(__FILE__);
echo "*** Test copy() function: Trying to create a copy of source file as a dir ***\n";
$file = $file_path."/copy_variation11.tmp";
$file_handle = fopen($file, "w");
-fwrite($file_handle, str_repeat(b"Hello, world...", 20));
+fwrite($file_handle, str_repeat("Hello, world...", 20));
fclose($file_handle);
$dir = $file_path."/copy_variation11";
diff --git a/ext/standard/tests/file/copy_variation14.phpt b/ext/standard/tests/file/copy_variation14.phpt
index 1a39c1c6a9..6eb8fe3ee4 100644
--- a/ext/standard/tests/file/copy_variation14.phpt
+++ b/ext/standard/tests/file/copy_variation14.phpt
@@ -15,7 +15,7 @@ $file_path = dirname(__FILE__);
echo "*** Test copy() function: Trying to create a copy of non-existing source in existing destination ***";
$file = $file_path."/copy_variation14.tmp";
$file_handle = fopen($file, "w");
-fwrite($file_handle, str_repeat(b"Hello2world...\n", 100));
+fwrite($file_handle, str_repeat("Hello2world...\n", 100));
fclose($file_handle);
var_dump( copy($file_path."/nosuchfile.tmp", $file_path."/copy_nosuchfile.tmp") ); //With non-existing source
diff --git a/ext/standard/tests/file/copy_variation15.phpt b/ext/standard/tests/file/copy_variation15.phpt
index fbf5e7bf9e..fdc84e989a 100644
--- a/ext/standard/tests/file/copy_variation15.phpt
+++ b/ext/standard/tests/file/copy_variation15.phpt
@@ -28,7 +28,7 @@ $file_path = dirname(__FILE__);
echo "*** Test copy() function: Trying to create a copy of file in a dir which doesn't have write permissions ***";
$file = $file_path."/copy_variation15.tmp";
$file_handle = fopen($file, "w");
-fwrite($file_handle, str_repeat(b"Hello, world...", 20));
+fwrite($file_handle, str_repeat("Hello, world...", 20));
fclose($file_handle);
$dir = $file_path."/copy_variation15";
diff --git a/ext/standard/tests/file/copy_variation16-win32.phpt b/ext/standard/tests/file/copy_variation16-win32.phpt
index d95d24adac..eff56a1ec7 100644
--- a/ext/standard/tests/file/copy_variation16-win32.phpt
+++ b/ext/standard/tests/file/copy_variation16-win32.phpt
@@ -27,7 +27,7 @@ mkdir($dirname_with_blank);
$src_file_name = dirname(__FILE__)."/copy_variation16.tmp";
$file_handle = fopen($src_file_name, "w");
-fwrite($file_handle, str_repeat(b"Hello world, this is 2007 year ...\n", 100));
+fwrite($file_handle, str_repeat("Hello world, this is 2007 year ...\n", 100));
fclose($file_handle);
echo "- Size of source file => ";
diff --git a/ext/standard/tests/file/copy_variation17.phpt b/ext/standard/tests/file/copy_variation17.phpt
index 97f1665f01..2dfe94c6e9 100644
--- a/ext/standard/tests/file/copy_variation17.phpt
+++ b/ext/standard/tests/file/copy_variation17.phpt
@@ -14,7 +14,7 @@ $file_path = dirname(__FILE__);
echo "*** Test copy() function: With source file names containing wild-card chars ***\n";
$src_file = $file_path."/copy_variation17.tmp";
$file_handle = fopen($src_file, "w");
-fwrite($file_handle, str_repeat(b"Hello2world...\n", 100));
+fwrite($file_handle, str_repeat("Hello2world...\n", 100));
fclose($file_handle);
$dir = $file_path."/copy_variation17";
diff --git a/ext/standard/tests/file/copy_variation2-win32-mb.phpt b/ext/standard/tests/file/copy_variation2-win32-mb.phpt
index e818e294d8..95688c97c5 100644
--- a/ext/standard/tests/file/copy_variation2-win32-mb.phpt
+++ b/ext/standard/tests/file/copy_variation2-win32-mb.phpt
@@ -20,7 +20,7 @@ echo "*** Test copy() function: destination file names containing special charac
$file_path = dirname(__FILE__);
$src_file_name = $file_path."/copy_variation2ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.tmp";
$file_handle = fopen($src_file_name, "w");
-fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fwrite( $file_handle, str_repeat("Hello2World...\n", 100) );
fclose($file_handle);
/* array of destination file names */
diff --git a/ext/standard/tests/file/copy_variation2-win32.phpt b/ext/standard/tests/file/copy_variation2-win32.phpt
index 4819d63e36..82235ba814 100644
--- a/ext/standard/tests/file/copy_variation2-win32.phpt
+++ b/ext/standard/tests/file/copy_variation2-win32.phpt
@@ -20,7 +20,7 @@ echo "*** Test copy() function: destination file names containing special charac
$file_path = dirname(__FILE__);
$src_file_name = $file_path."/copy_variation2.tmp";
$file_handle = fopen($src_file_name, "w");
-fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fwrite( $file_handle, str_repeat("Hello2World...\n", 100) );
fclose($file_handle);
/* array of destination file names */
diff --git a/ext/standard/tests/file/copy_variation2.phpt b/ext/standard/tests/file/copy_variation2.phpt
index d99f5a8da3..a9b36803d9 100644
--- a/ext/standard/tests/file/copy_variation2.phpt
+++ b/ext/standard/tests/file/copy_variation2.phpt
@@ -20,7 +20,7 @@ echo "*** Test copy() function: destination file names containing special charac
$file_path = dirname(__FILE__);
$src_file_name = $file_path."/copy_variation2.tmp";
$file_handle = fopen($src_file_name, "w");
-fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fwrite( $file_handle, str_repeat("Hello2World...\n", 100) );
fclose($file_handle);
/* array of destination file names */
diff --git a/ext/standard/tests/file/copy_variation3-win32.phpt b/ext/standard/tests/file/copy_variation3-win32.phpt
index 68ce4a1680..5055c297f6 100644
--- a/ext/standard/tests/file/copy_variation3-win32.phpt
+++ b/ext/standard/tests/file/copy_variation3-win32.phpt
@@ -20,7 +20,7 @@ echo "*** Test copy() function: destination file names containing whitespaces **
$file_path = dirname(__FILE__);
$src_file_name = $file_path."/copy_variation3.tmp";
$file_handle = fopen($src_file_name, "w");
-fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fwrite( $file_handle, str_repeat("Hello2World...\n", 100) );
fclose($file_handle);
/* array of destination file names */
diff --git a/ext/standard/tests/file/copy_variation3.phpt b/ext/standard/tests/file/copy_variation3.phpt
index 1c45c8c129..56f797bc95 100644
--- a/ext/standard/tests/file/copy_variation3.phpt
+++ b/ext/standard/tests/file/copy_variation3.phpt
@@ -20,7 +20,7 @@ echo "*** Test copy() function: destination file names containing whitespaces **
$file_path = dirname(__FILE__);
$src_file_name = $file_path."/copy_variation3.tmp";
$file_handle = fopen($src_file_name, "w");
-fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fwrite( $file_handle, str_repeat("Hello2World...\n", 100) );
fclose($file_handle);
/* array of destination file names */
diff --git a/ext/standard/tests/file/copy_variation4.phpt b/ext/standard/tests/file/copy_variation4.phpt
index 3c8224da0a..47152d4239 100644
--- a/ext/standard/tests/file/copy_variation4.phpt
+++ b/ext/standard/tests/file/copy_variation4.phpt
Binary files differ
diff --git a/ext/standard/tests/file/copy_variation5-win32.phpt b/ext/standard/tests/file/copy_variation5-win32.phpt
index baf7be470c..48e85eaf02 100644
--- a/ext/standard/tests/file/copy_variation5-win32.phpt
+++ b/ext/standard/tests/file/copy_variation5-win32.phpt
@@ -20,7 +20,7 @@ echo "*** Test copy() function: checking case sensitivity in creation of destina
$file_path = dirname(__FILE__);
$src_file_name = $file_path."/copy_variation5.tmp";
$file_handle = fopen($src_file_name, "w");
-fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fwrite( $file_handle, str_repeat("Hello2World...\n", 100) );
fclose($file_handle);
/* array of destination file names */
diff --git a/ext/standard/tests/file/copy_variation5.phpt b/ext/standard/tests/file/copy_variation5.phpt
index 8abc9c961a..c480fcc3bf 100644
--- a/ext/standard/tests/file/copy_variation5.phpt
+++ b/ext/standard/tests/file/copy_variation5.phpt
@@ -20,7 +20,7 @@ echo "*** Test copy() function: checking case sensitivity in creation of destina
$file_path = dirname(__FILE__);
$src_file_name = $file_path."/copy_variation5.tmp";
$file_handle = fopen($src_file_name, "w");
-fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fwrite( $file_handle, str_repeat("Hello2World...\n", 100) );
fclose($file_handle);
/* array of destination file names */
diff --git a/ext/standard/tests/file/copy_variation7.phpt b/ext/standard/tests/file/copy_variation7.phpt
index d687b073c7..474d33bc49 100644
--- a/ext/standard/tests/file/copy_variation7.phpt
+++ b/ext/standard/tests/file/copy_variation7.phpt
@@ -20,7 +20,7 @@ $file_path = dirname(__FILE__);
echo "*** Testing copy() with symlink and hardlink ***\n";
$file = $file_path."/copy_variation7.tmp";
$file_handle = fopen($file, "w");
-fwrite( $file_handle, str_repeat(b"Hello World, this is 2007 year ....\n", 100) );
+fwrite( $file_handle, str_repeat("Hello World, this is 2007 year ....\n", 100) );
fclose($file_handle);
$symlink = $file_path."/copy_variation7_symlink.tmp";
diff --git a/ext/standard/tests/file/copy_variation9.phpt b/ext/standard/tests/file/copy_variation9.phpt
index 824bed0c76..34d5b907d9 100644
--- a/ext/standard/tests/file/copy_variation9.phpt
+++ b/ext/standard/tests/file/copy_variation9.phpt
@@ -29,7 +29,7 @@ $file_path = dirname(__FILE__);
echo "*** Test copy() function: destination with/without write permissions ***\n";
$src_file_name = $file_path."/copy_variation9.tmp";
$file_handle = fopen($src_file_name, "w");
-fwrite($file_handle, str_repeat(b"Hello2world...\n", 100));
+fwrite($file_handle, str_repeat("Hello2world...\n", 100));
fclose($file_handle);
$dest_file_name = $file_path."/copy_copy_variation9.tmp";
diff --git a/ext/standard/tests/file/disk_free_space_basic.phpt b/ext/standard/tests/file/disk_free_space_basic.phpt
index 2904ff9a5b..57446b6ee0 100644
--- a/ext/standard/tests/file/disk_free_space_basic.phpt
+++ b/ext/standard/tests/file/disk_free_space_basic.phpt
@@ -30,7 +30,7 @@ var_dump( $space1 );
$fh = fopen($file_path.$dir."/disk_free_space.tmp", "a");
$data = str_repeat("x", 0xffff);
-fwrite($fh, (binary)$data);
+fwrite($fh, $data);
fclose($fh);
echo "\n Free Space after writing to a file\n";
diff --git a/ext/standard/tests/file/disk_free_space_error.phpt b/ext/standard/tests/file/disk_free_space_error.phpt
index ddd25a35db..ab2ad09081 100644
--- a/ext/standard/tests/file/disk_free_space_error.phpt
+++ b/ext/standard/tests/file/disk_free_space_error.phpt
@@ -27,7 +27,7 @@ var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory
var_dump( diskfreespace( $file_path."/dir1" ));
$fh = fopen( $file_path."/disk_free_space.tmp", "w" );
-fwrite( $fh, (binary)" Garbage data for the temporary file" );
+fwrite( $fh, " Garbage data for the temporary file" );
var_dump( disk_free_space( $file_path."/disk_free_space.tmp" )); // file input instead of directory
var_dump( diskfreespace( $file_path."/disk_free_space.tmp" ));
fclose($fh);
diff --git a/ext/standard/tests/file/disk_total_space_basic.phpt b/ext/standard/tests/file/disk_total_space_basic.phpt
index d211f39437..cfef2a4245 100644
--- a/ext/standard/tests/file/disk_total_space_basic.phpt
+++ b/ext/standard/tests/file/disk_total_space_basic.phpt
@@ -20,7 +20,7 @@ $dir = "/disk_total_space";
mkdir($file_path.$dir);
var_dump( disk_total_space($file_path.$dir) );
$fh = fopen($file_path.$dir."/disk_total_space.tmp", "w");
-fwrite($fh, (binary)"Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data");
+fwrite($fh, "Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data");
fclose($fh);
diff --git a/ext/standard/tests/file/disk_total_space_error.phpt b/ext/standard/tests/file/disk_total_space_error.phpt
index d986f779ba..b60ad6048f 100644
--- a/ext/standard/tests/file/disk_total_space_error.phpt
+++ b/ext/standard/tests/file/disk_total_space_error.phpt
@@ -24,7 +24,7 @@ var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid
var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory
$fh = fopen( $file_path."/disk_total_space.tmp", "w" );
-fwrite( $fh, (binary)" Garbage data for the temporary file" );
+fwrite( $fh, " Garbage data for the temporary file" );
var_dump( disk_total_space( $file_path."/disk_total_space.tmp" )); // file input instead of directory
fclose($fh);
diff --git a/ext/standard/tests/file/file_get_contents_variation5_32bit.phpt b/ext/standard/tests/file/file_get_contents_variation5_32bit.phpt
index 3afc3dc180..26ba22a47e 100644
--- a/ext/standard/tests/file/file_get_contents_variation5_32bit.phpt
+++ b/ext/standard/tests/file/file_get_contents_variation5_32bit.phpt
@@ -27,7 +27,7 @@ set_error_handler('test_error_handler');
$filename = 'FileGetContentsVar5.tmp';
$absFile = dirname(__FILE__).'/'.$filename;
$h = fopen($absFile,"w");
-fwrite($h, b"contents read");
+fwrite($h, "contents read");
fclose($h);
@@ -197,27 +197,27 @@ string(12) "ontents read"
string(%d) "contents read"
--empty string DQ--
-Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d)
+Error: 2 - file_get_contents() expects parameter 4 to be integer, string given, %s(%d)
NULL
--empty string SQ--
-Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d)
+Error: 2 - file_get_contents() expects parameter 4 to be integer, string given, %s(%d)
NULL
--string DQ--
-Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d)
+Error: 2 - file_get_contents() expects parameter 4 to be integer, string given, %s(%d)
NULL
--string SQ--
-Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d)
+Error: 2 - file_get_contents() expects parameter 4 to be integer, string given, %s(%d)
NULL
--mixed case string--
-Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d)
+Error: 2 - file_get_contents() expects parameter 4 to be integer, string given, %s(%d)
NULL
--heredoc--
-Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d)
+Error: 2 - file_get_contents() expects parameter 4 to be integer, string given, %s(%d)
NULL
--instance of classWithToString--
diff --git a/ext/standard/tests/file/file_get_contents_variation5_64bit.phpt b/ext/standard/tests/file/file_get_contents_variation5_64bit.phpt
index df33059f30..66f51895a9 100644
--- a/ext/standard/tests/file/file_get_contents_variation5_64bit.phpt
+++ b/ext/standard/tests/file/file_get_contents_variation5_64bit.phpt
@@ -27,7 +27,7 @@ set_error_handler('test_error_handler');
$filename = 'FileGetContentsVar5.tmp';
$absFile = dirname(__FILE__).'/'.$filename;
$h = fopen($absFile,"w");
-fwrite($h, b"contents read");
+fwrite($h, "contents read");
fclose($h);
@@ -196,27 +196,27 @@ string(12) "ontents read"
string(%d) "contents read"
--empty string DQ--
-Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d)
+Error: 2 - file_get_contents() expects parameter 4 to be integer, string given, %s(%d)
NULL
--empty string SQ--
-Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d)
+Error: 2 - file_get_contents() expects parameter 4 to be integer, string given, %s(%d)
NULL
--string DQ--
-Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d)
+Error: 2 - file_get_contents() expects parameter 4 to be integer, string given, %s(%d)
NULL
--string SQ--
-Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d)
+Error: 2 - file_get_contents() expects parameter 4 to be integer, string given, %s(%d)
NULL
--mixed case string--
-Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d)
+Error: 2 - file_get_contents() expects parameter 4 to be integer, string given, %s(%d)
NULL
--heredoc--
-Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d)
+Error: 2 - file_get_contents() expects parameter 4 to be integer, string given, %s(%d)
NULL
--instance of classWithToString--
diff --git a/ext/standard/tests/file/file_get_contents_variation9.phpt b/ext/standard/tests/file/file_get_contents_variation9.phpt
index 99812b5349..7e500e8c56 100644
--- a/ext/standard/tests/file/file_get_contents_variation9.phpt
+++ b/ext/standard/tests/file/file_get_contents_variation9.phpt
@@ -25,7 +25,7 @@ $chainlink = dirname(__FILE__).'/fileGetContentsVar9.ChainLink';
$h = fopen($filename,"w");
//Data should be more than the size of a link.
for ($i = 1; $i <= 10; $i++) {
- fwrite($h, b"Here is a repeated amount of data");
+ fwrite($h, "Here is a repeated amount of data");
}
fclose($h);
diff --git a/ext/standard/tests/file/file_put_contents_variation4.phpt b/ext/standard/tests/file/file_put_contents_variation4.phpt
index d919c4a08f..62d814c9fd 100644
--- a/ext/standard/tests/file/file_put_contents_variation4.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation4.phpt
@@ -37,7 +37,7 @@ function runtest() {
global $filename;
//correct php53 behaviour is to ingnore the FILE_USE_INCLUDE_PATH unless the file alread exists
// in the include path. In this case it doesn't so the file should be written in the current dir.
- file_put_contents($filename, (binary) "File in include path", FILE_USE_INCLUDE_PATH);
+ file_put_contents($filename, "File in include path", FILE_USE_INCLUDE_PATH);
$line = file_get_contents($filename);
echo "$line\n";
unlink($filename);
diff --git a/ext/standard/tests/file/file_put_contents_variation5.phpt b/ext/standard/tests/file/file_put_contents_variation5.phpt
index baaa7a65d9..fe1961d16c 100644
--- a/ext/standard/tests/file/file_put_contents_variation5.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation5.phpt
@@ -30,7 +30,7 @@ rmdir($thisTestDir);
function runtest() {
global $scriptLocFile, $filename;
- file_put_contents($filename, (binary) "File written in working directory", FILE_USE_INCLUDE_PATH);
+ file_put_contents($filename, "File written in working directory", FILE_USE_INCLUDE_PATH);
if(file_exists($scriptLocFile)) {
echo "Fail - this is PHP52 behaviour\n";
unlink($scriptLocFile);
diff --git a/ext/standard/tests/file/file_put_contents_variation6.phpt b/ext/standard/tests/file/file_put_contents_variation6.phpt
index aaea612b36..a0977faff8 100644
--- a/ext/standard/tests/file/file_put_contents_variation6.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation6.phpt
@@ -40,8 +40,8 @@ function runtest() {
//correct php53 behaviour is to ignore the FILE_USE_INCLUDE_PATH unless the file already exists
// in the include path. In this case it doesn't so the file should be written in the current dir.
- file_put_contents($filename, (binary) "File in include path", FILE_USE_INCLUDE_PATH);
- file_put_contents($filename, (binary) ". This was appended", FILE_USE_INCLUDE_PATH | FILE_APPEND);
+ file_put_contents($filename, "File in include path", FILE_USE_INCLUDE_PATH);
+ file_put_contents($filename, ". This was appended", FILE_USE_INCLUDE_PATH | FILE_APPEND);
$line = file_get_contents($filename);
echo "$line\n";
unlink($filename);
diff --git a/ext/standard/tests/file/file_variation.phpt b/ext/standard/tests/file/file_variation.phpt
index 512d5f3eb6..506575fde7 100644
--- a/ext/standard/tests/file/file_variation.phpt
+++ b/ext/standard/tests/file/file_variation.phpt
@@ -16,7 +16,7 @@ $file_path = dirname(__FILE__);
foreach( $data_array as $data ) {
echo "--Iteration $count --\n";
$fh = fopen($file_path."/file_variation.tmp", "w");
- fwrite($fh, (binary)$data);
+ fwrite($fh, $data);
var_dump( file($file_path."/file_variation.tmp", FILE_IGNORE_NEW_LINES) );
var_dump( file($file_path."/file_variation.tmp", FILE_SKIP_EMPTY_LINES) );
$count++;
@@ -35,7 +35,7 @@ var_dump( file($file_path1."/file1_variation.tmp", 1) );
echo "*** Using file function to remove line containing a key string ***\n";
$file_handle = fopen($file_path."/file2_variation.tmp", "w");
$key = "SEARCH_KEY";
-fwrite( $file_handle, (binary)"The key string to be searched is SEARCH_KEY\nLine without key string\nThe key string to be searched is SEARCH_KEY" );
+fwrite( $file_handle,"The key string to be searched is SEARCH_KEY\nLine without key string\nThe key string to be searched is SEARCH_KEY" );
$out_array = file($file_path."/file2_variation.tmp");
echo "File contents in array form Before replacement of the key\n";
diff --git a/ext/standard/tests/file/filesize_variation3-win32.phpt b/ext/standard/tests/file/filesize_variation3-win32.phpt
index ab38c7d1c3..94ba6f478a 100644
--- a/ext/standard/tests/file/filesize_variation3-win32.phpt
+++ b/ext/standard/tests/file/filesize_variation3-win32.phpt
@@ -18,7 +18,7 @@ $file_path = dirname(__FILE__);
echo "*** Testing filesize(): usage variations ***\n";
$filename = $file_path."/filesize_variation3.tmp";
$file_handle = fopen($filename, "w");
-fwrite($file_handle, (binary)str_repeat("Hello,World ", 1000) ); // create file of size 12000 bytes
+fwrite($file_handle, str_repeat("Hello,World ", 1000) ); // create file of size 12000 bytes
fclose($file_handle);
echo "-- Testing filesize() after truncating the file to a new length --\n";
diff --git a/ext/standard/tests/file/fopen_variation12.phpt b/ext/standard/tests/file/fopen_variation12.phpt
index 9df4490236..c207ec1836 100644
--- a/ext/standard/tests/file/fopen_variation12.phpt
+++ b/ext/standard/tests/file/fopen_variation12.phpt
@@ -18,7 +18,7 @@ restore_include_path();
function testme() {
$tmpfile = basename(__FILE__, ".php") . ".tmp";
$h = fopen($tmpfile, "w", true);
- fwrite($h, (binary) "This is the test file");
+ fwrite($h, "This is the test file");
fclose($h);
diff --git a/ext/standard/tests/file/fopen_variation16.phpt b/ext/standard/tests/file/fopen_variation16.phpt
index e14f2e1c16..8b793f7858 100644
--- a/ext/standard/tests/file/fopen_variation16.phpt
+++ b/ext/standard/tests/file/fopen_variation16.phpt
@@ -40,7 +40,7 @@ function runtest() {
$tmpfile = $extraDir.'/fopen_variation16.tmp';
$h = fopen($tmpfile, "w+", true);
- fwrite($h, (binary) "This is the test file");
+ fwrite($h, "This is the test file");
fclose($h);
$h = @fopen($dir1.'/'.$tmpfile, "r");
diff --git a/ext/standard/tests/file/fopen_variation17.phpt b/ext/standard/tests/file/fopen_variation17.phpt
index 8abae0fbe5..461807d26f 100644
--- a/ext/standard/tests/file/fopen_variation17.phpt
+++ b/ext/standard/tests/file/fopen_variation17.phpt
@@ -39,7 +39,7 @@ function runtest() {
$tmpfile = $extraDir . '/' . basename(__FILE__, ".php") . ".tmp";
$h = fopen($tmpfile, "w+", true);
- fwrite($h, (binary) "This is the test file");
+ fwrite($h, "This is the test file");
fclose($h);
$h = @fopen($dir1.'/'.$tmpfile, "r");
diff --git a/ext/standard/tests/file/fopen_variation5.phpt b/ext/standard/tests/file/fopen_variation5.phpt
index 975560f5ce..1fccbb70a9 100644
--- a/ext/standard/tests/file/fopen_variation5.phpt
+++ b/ext/standard/tests/file/fopen_variation5.phpt
@@ -63,7 +63,7 @@ function test_fopen($mode) {
// create a file in the middle directory
$h = fopen($secondFile, "w");
- fwrite($h, (binary) "in dir2");
+ fwrite($h, "in dir2");
fclose($h);
echo "\n** testing with mode=$mode **\n";
@@ -75,7 +75,7 @@ function test_fopen($mode) {
//create a file in dir1
$h = fopen($firstFile, "w");
- fwrite($h, (binary) "in dir1");
+ fwrite($h, "in dir1");
fclose($h);
//should now read dir1 file
@@ -86,7 +86,7 @@ function test_fopen($mode) {
// create a file in working directory
$h = fopen($filename, "w");
- fwrite($h, (binary) "in working dir");
+ fwrite($h, "in working dir");
fclose($h);
//should still read dir1 file
@@ -106,7 +106,7 @@ function test_fopen($mode) {
// create a file in the script directory
$h = fopen($scriptFile, "w");
- fwrite($h, (binary) "in script dir");
+ fwrite($h, "in script dir");
fclose($h);
//should read the file in script dir
diff --git a/ext/standard/tests/file/fopen_variation7.phpt b/ext/standard/tests/file/fopen_variation7.phpt
index 13f075cfff..f5c1048c07 100644
--- a/ext/standard/tests/file/fopen_variation7.phpt
+++ b/ext/standard/tests/file/fopen_variation7.phpt
@@ -32,7 +32,7 @@ function runtest() {
global $dir1;
$tmpfile = basename(__FILE__, ".php") . ".tmp";
$h = fopen($tmpfile, "w", true);
- fwrite($h, (binary)"This is the test file");
+ fwrite($h, "This is the test file");
fclose($h);
diff --git a/ext/standard/tests/file/fopen_variation8.phpt b/ext/standard/tests/file/fopen_variation8.phpt
index dd95014ff3..eecaec7b4c 100644
--- a/ext/standard/tests/file/fopen_variation8.phpt
+++ b/ext/standard/tests/file/fopen_variation8.phpt
@@ -62,7 +62,7 @@ function test_fopen($mode) {
// create a file in the middle directory
$h = fopen($secondFile, "w");
- fwrite($h, (binary) "in dir2");
+ fwrite($h, "in dir2");
fclose($h);
echo "\n** testing with mode=$mode **\n";
@@ -74,7 +74,7 @@ function test_fopen($mode) {
//create a file in dir1
$h = fopen($firstFile, "w");
- fwrite($h, (binary) "in dir1");
+ fwrite($h, "in dir1");
fclose($h);
//should now read dir1 file
@@ -85,7 +85,7 @@ function test_fopen($mode) {
// create a file in working directory
$h = fopen($filename, "w");
- fwrite($h, (binary) "in working dir");
+ fwrite($h, "in working dir");
fclose($h);
//should read the dir1 file
@@ -105,7 +105,7 @@ function test_fopen($mode) {
// create a file in the script directory
$h = fopen($scriptFile, "w");
- fwrite($h, (binary) "in script dir");
+ fwrite($h, "in script dir");
fclose($h);
//should read the file in script dir
diff --git a/ext/standard/tests/file/fopen_variation9.phpt b/ext/standard/tests/file/fopen_variation9.phpt
index 4b0a7270db..5d1ca139f4 100644
--- a/ext/standard/tests/file/fopen_variation9.phpt
+++ b/ext/standard/tests/file/fopen_variation9.phpt
@@ -32,7 +32,7 @@ rmdir($thisTestDir);
function runtest() {
$tmpfile = basename(__FILE__, ".php") . ".tmp";
$h = fopen($tmpfile, "w", true);
- fwrite($h, (binary) "This is the test file");
+ fwrite($h, "This is the test file");
fclose($h);
diff --git a/ext/standard/tests/file/fscanf_error.phpt b/ext/standard/tests/file/fscanf_error.phpt
index f93d1b2a57..1a80d19348 100644
--- a/ext/standard/tests/file/fscanf_error.phpt
+++ b/ext/standard/tests/file/fscanf_error.phpt
@@ -78,7 +78,7 @@ int(-1)
Notice: Undefined variable: undefined_var in %s on line %d
-Notice: Use of undefined constant undefined_constant - assumed 'undefined_constant' in %s on line %d
+Warning: Use of undefined constant undefined_constant - assumed 'undefined_constant' (this will throw an Error in a future version of PHP) in %s on line %d
array(0) {
}
array(0) {
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32-mb.phpt b/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32-mb.phpt
index ab983a2680..1bd95c3450 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32-mb.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32-mb.phpt
@@ -49,7 +49,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
- fwrite($file_handle,(binary)$data_to_be_written);
+ fwrite($file_handle,$data_to_be_written);
// set file pointer to 0
var_dump( rewind($file_handle) ); // set to beginning of file
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32.phpt b/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32.phpt
index 915ab0e558..e25ebe0946 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32.phpt
@@ -49,7 +49,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
- fwrite($file_handle,(binary)$data_to_be_written);
+ fwrite($file_handle,$data_to_be_written);
// set file pointer to 0
var_dump( rewind($file_handle) ); // set to beginning of file
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_basic2.phpt b/ext/standard/tests/file/fseek_ftell_rewind_basic2.phpt
index 63d0edd5a5..ede0c43245 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_basic2.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_basic2.phpt
@@ -48,7 +48,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
- fwrite($file_handle,(binary)$data_to_be_written);
+ fwrite($file_handle,$data_to_be_written);
// set file pointer to 0
var_dump( rewind($file_handle) ); // set to beginning of file
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt
index ad01c3aef1..cb51150dcf 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt
@@ -48,7 +48,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
- fwrite($file_handle,(binary)$data_to_be_written);
+ fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
echo "-- Testing fseek() without using argument whence --\n";
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation2.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation2.phpt
index 67987cb712..c2179fcaee 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_variation2.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation2.phpt
@@ -48,7 +48,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
- fwrite($file_handle,(binary)$data_to_be_written);
+ fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
echo "-- Testing fseek() without using argument whence --\n";
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation4-win32.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation4-win32.phpt
index 09c83447d8..1bb55b53b3 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_variation4-win32.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation4-win32.phpt
@@ -47,7 +47,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
- fwrite($file_handle,(binary)$data_to_be_written);
+ fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
foreach($offset as $count){
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation4.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation4.phpt
index e4029c718a..3c84f3eb7c 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_variation4.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation4.phpt
@@ -47,7 +47,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
- fwrite($file_handle,(binary)$data_to_be_written);
+ fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
foreach($offset as $count){
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation6-win32.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation6-win32.phpt
index d4519123c6..8c84e7e386 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_variation6-win32.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation6-win32.phpt
@@ -47,7 +47,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
- fwrite($file_handle,(binary)$data_to_be_written);
+ fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
foreach($offset as $count){
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation6.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation6.phpt
index 44519884a9..4de9b3f688 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_variation6.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation6.phpt
@@ -47,7 +47,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
- fwrite($file_handle,(binary)$data_to_be_written);
+ fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
foreach($offset as $count){
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation8-win32.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation8-win32.phpt
index 5586e2bd5a..c6ba6c430f 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_variation8-win32.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation8-win32.phpt
@@ -48,7 +48,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
- fwrite($file_handle,(binary)$data_to_be_written);
+ fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
foreach($offset as $count){
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation8.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation8.phpt
index a2a0d676c2..b4a0fa97f3 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_variation8.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation8.phpt
@@ -48,7 +48,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
- fwrite($file_handle,(binary)$data_to_be_written);
+ fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
foreach($offset as $count){
diff --git a/ext/standard/tests/file/fseek_variation3.phpt b/ext/standard/tests/file/fseek_variation3.phpt
index c29ed31759..edb0b3a3b0 100644
--- a/ext/standard/tests/file/fseek_variation3.phpt
+++ b/ext/standard/tests/file/fseek_variation3.phpt
@@ -29,7 +29,7 @@ echo "after seek back 20: ".bin2hex(fread($h,1))."\n";
echo "--- fseek beyond end of file ---\n";
var_dump(fseek($h, 16, SEEK_SET));
-fwrite($h, b"end");
+fwrite($h, "end");
fseek($h ,0, SEEK_SET);
$data = fread($h, 4096);
echo bin2hex($data)."\n";
diff --git a/ext/standard/tests/file/ftruncate_error.phpt b/ext/standard/tests/file/ftruncate_error.phpt
index 40dcf4cf51..3ccd32a2d4 100644
--- a/ext/standard/tests/file/ftruncate_error.phpt
+++ b/ext/standard/tests/file/ftruncate_error.phpt
@@ -11,7 +11,7 @@ echo "*** Testing ftruncate() : error conditions ***\n";
$filename = dirname(__FILE__)."/ftruncate_error.tmp";
$file_handle = fopen($filename, "w" );
-fwrite($file_handle, (binary)"Testing ftruncate error conditions \n");
+fwrite($file_handle, "Testing ftruncate error conditions \n");
fflush($file_handle);
echo "\n Initial file size = ".filesize($filename)."\n";
diff --git a/ext/standard/tests/file/include_streams.phpt b/ext/standard/tests/file/include_streams.phpt
index e459c6a1aa..05b16238cd 100644
--- a/ext/standard/tests/file/include_streams.phpt
+++ b/ext/standard/tests/file/include_streams.phpt
@@ -32,7 +32,7 @@ class mystream
$this->options = $options;
$split = parse_url($path);
- if ($split["host"] !== b"GLOBALS" ||
+ if ($split["host"] !== "GLOBALS" ||
empty($split["path"]) ||
empty($GLOBALS[substr($split["path"],1)])) {
return false;
diff --git a/ext/standard/tests/file/lstat_stat_variation7.phpt b/ext/standard/tests/file/lstat_stat_variation7.phpt
index 2296193c91..5a1e1c3994 100644
--- a/ext/standard/tests/file/lstat_stat_variation7.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation7.phpt
@@ -29,7 +29,7 @@ echo "*** Testing stat() on file after data is written in it ***\n";
$fh = fopen($file_name,"w");
$old_stat = stat($file_name);
clearstatcache();
-fwrite($fh, str_repeat((binary)"Hello World", $old_stat['blksize']));
+fwrite($fh, str_repeat("Hello World", $old_stat['blksize']));
$new_stat = stat($file_name);
// compare self stats
diff --git a/ext/standard/tests/file/move_uploaded_file_basic.phpt b/ext/standard/tests/file/move_uploaded_file_basic.phpt
index 00bbcf6e18..7349a694de 100644
--- a/ext/standard/tests/file/move_uploaded_file_basic.phpt
+++ b/ext/standard/tests/file/move_uploaded_file_basic.phpt
@@ -28,7 +28,7 @@ $destination1 = __FILE__ . ".tmp";
var_dump(move_uploaded_file($_FILES['file1']['tmp_name'], $destination1));
$file_contents = file_get_contents($destination1);
-$contents_matches = ($file_contents == b"abcdef123456789xxxDDDxxxDDDxxxDDD");
+$contents_matches = ($file_contents == "abcdef123456789xxxDDDxxxDDDxxxDDD");
var_dump($contents_matches);
unlink($destination1);
echo "\n";
diff --git a/ext/standard/tests/file/pathinfo_basic.phpt b/ext/standard/tests/file/pathinfo_basic.phpt
index 53eda5a64e..0ab4776e02 100644
--- a/ext/standard/tests/file/pathinfo_basic.phpt
+++ b/ext/standard/tests/file/pathinfo_basic.phpt
@@ -32,7 +32,7 @@ $paths = array (
"$file_path/foo".chr(47)."symlink.link",
"$file_path".chr(47)."foo/symlink.link",
"$file_path".chr(47)."foo".chr(47)."symlink.link",
- b"$file_path/foo/symlink.link",
+ "$file_path/foo/symlink.link",
/* Testing directories */
".", // current directory
@@ -68,184 +68,184 @@ echo "Done\n";
--EXPECTF--
*** Testing basic functions of pathinfo() ***
-- Iteration 1 --
-%unicode|string%(%d) "%s/foo"
-%unicode|string%(12) "symlink.link"
-%unicode|string%(4) "link"
-%unicode|string%(7) "symlink"
+string(%d) "%s/foo"
+string(12) "symlink.link"
+string(4) "link"
+string(7) "symlink"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(%d) "%s/foo"
- [%u|b%"basename"]=>
- %unicode|string%(12) "symlink.link"
- [%u|b%"extension"]=>
- %unicode|string%(4) "link"
- [%u|b%"filename"]=>
- %unicode|string%(7) "symlink"
+ ["dirname"]=>
+ string(%d) "%s/foo"
+ ["basename"]=>
+ string(12) "symlink.link"
+ ["extension"]=>
+ string(4) "link"
+ ["filename"]=>
+ string(7) "symlink"
}
-- Iteration 2 --
-%unicode|string%(1) "."
-%unicode|string%(17) "www.example.co.in"
-%unicode|string%(2) "in"
-%unicode|string%(14) "www.example.co"
+string(1) "."
+string(17) "www.example.co.in"
+string(2) "in"
+string(14) "www.example.co"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(17) "www.example.co.in"
- [%u|b%"extension"]=>
- %unicode|string%(2) "in"
- [%u|b%"filename"]=>
- %unicode|string%(14) "www.example.co"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(17) "www.example.co.in"
+ ["extension"]=>
+ string(2) "in"
+ ["filename"]=>
+ string(14) "www.example.co"
}
-- Iteration 3 --
-%unicode|string%(13) "/var/www/html"
-%unicode|string%(12) "example.html"
-%unicode|string%(4) "html"
-%unicode|string%(7) "example"
+string(13) "/var/www/html"
+string(12) "example.html"
+string(4) "html"
+string(7) "example"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(13) "/var/www/html"
- [%u|b%"basename"]=>
- %unicode|string%(12) "example.html"
- [%u|b%"extension"]=>
- %unicode|string%(4) "html"
- [%u|b%"filename"]=>
- %unicode|string%(7) "example"
+ ["dirname"]=>
+ string(13) "/var/www/html"
+ ["basename"]=>
+ string(12) "example.html"
+ ["extension"]=>
+ string(4) "html"
+ ["filename"]=>
+ string(7) "example"
}
-- Iteration 4 --
-%unicode|string%(4) "/dir"
-%unicode|string%(11) "test.tar.gz"
-%unicode|string%(2) "gz"
-%unicode|string%(8) "test.tar"
+string(4) "/dir"
+string(11) "test.tar.gz"
+string(2) "gz"
+string(8) "test.tar"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(4) "/dir"
- [%u|b%"basename"]=>
- %unicode|string%(11) "test.tar.gz"
- [%u|b%"extension"]=>
- %unicode|string%(2) "gz"
- [%u|b%"filename"]=>
- %unicode|string%(8) "test.tar"
+ ["dirname"]=>
+ string(4) "/dir"
+ ["basename"]=>
+ string(11) "test.tar.gz"
+ ["extension"]=>
+ string(2) "gz"
+ ["filename"]=>
+ string(8) "test.tar"
}
-- Iteration 5 --
-%unicode|string%(%d) "%s/foo"
-%unicode|string%(12) "symlink.link"
-%unicode|string%(4) "link"
-%unicode|string%(7) "symlink"
+string(%d) "%s/foo"
+string(12) "symlink.link"
+string(4) "link"
+string(7) "symlink"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(%d) "%s/foo"
- [%u|b%"basename"]=>
- %unicode|string%(12) "symlink.link"
- [%u|b%"extension"]=>
- %unicode|string%(4) "link"
- [%u|b%"filename"]=>
- %unicode|string%(7) "symlink"
+ ["dirname"]=>
+ string(%d) "%s/foo"
+ ["basename"]=>
+ string(12) "symlink.link"
+ ["extension"]=>
+ string(4) "link"
+ ["filename"]=>
+ string(7) "symlink"
}
-- Iteration 6 --
-%unicode|string%(%d) "%s/foo"
-%unicode|string%(12) "symlink.link"
-%unicode|string%(4) "link"
-%unicode|string%(7) "symlink"
+string(%d) "%s/foo"
+string(12) "symlink.link"
+string(4) "link"
+string(7) "symlink"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(%d) "%s/foo"
- [%u|b%"basename"]=>
- %unicode|string%(12) "symlink.link"
- [%u|b%"extension"]=>
- %unicode|string%(4) "link"
- [%u|b%"filename"]=>
- %unicode|string%(7) "symlink"
+ ["dirname"]=>
+ string(%d) "%s/foo"
+ ["basename"]=>
+ string(12) "symlink.link"
+ ["extension"]=>
+ string(4) "link"
+ ["filename"]=>
+ string(7) "symlink"
}
-- Iteration 7 --
-%unicode|string%(%d) "%s/foo"
-%unicode|string%(12) "symlink.link"
-%unicode|string%(4) "link"
-%unicode|string%(7) "symlink"
+string(%d) "%s/foo"
+string(12) "symlink.link"
+string(4) "link"
+string(7) "symlink"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(%d) "%s/foo"
- [%u|b%"basename"]=>
- %unicode|string%(12) "symlink.link"
- [%u|b%"extension"]=>
- %unicode|string%(4) "link"
- [%u|b%"filename"]=>
- %unicode|string%(7) "symlink"
+ ["dirname"]=>
+ string(%d) "%s/foo"
+ ["basename"]=>
+ string(12) "symlink.link"
+ ["extension"]=>
+ string(4) "link"
+ ["filename"]=>
+ string(7) "symlink"
}
-- Iteration 8 --
-%unicode|string%(%d) "%s/foo"
-%unicode|string%(12) "symlink.link"
-%unicode|string%(4) "link"
-%unicode|string%(7) "symlink"
+string(%d) "%s/foo"
+string(12) "symlink.link"
+string(4) "link"
+string(7) "symlink"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(%d) "%s/foo"
- [%u|b%"basename"]=>
- %unicode|string%(12) "symlink.link"
- [%u|b%"extension"]=>
- %unicode|string%(4) "link"
- [%u|b%"filename"]=>
- %unicode|string%(7) "symlink"
+ ["dirname"]=>
+ string(%d) "%s/foo"
+ ["basename"]=>
+ string(12) "symlink.link"
+ ["extension"]=>
+ string(4) "link"
+ ["filename"]=>
+ string(7) "symlink"
}
-- Iteration 9 --
-%unicode|string%(%d) "%s/foo"
-%unicode|string%(12) "symlink.link"
-%unicode|string%(4) "link"
-%unicode|string%(7) "symlink"
+string(%d) "%s/foo"
+string(12) "symlink.link"
+string(4) "link"
+string(7) "symlink"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(%d) "%s/foo"
- [%u|b%"basename"]=>
- %unicode|string%(12) "symlink.link"
- [%u|b%"extension"]=>
- %unicode|string%(4) "link"
- [%u|b%"filename"]=>
- %unicode|string%(7) "symlink"
+ ["dirname"]=>
+ string(%d) "%s/foo"
+ ["basename"]=>
+ string(12) "symlink.link"
+ ["extension"]=>
+ string(4) "link"
+ ["filename"]=>
+ string(7) "symlink"
}
-- Iteration 10 --
-%unicode|string%(%d) "%s/foo"
-%unicode|string%(12) "symlink.link"
-%unicode|string%(4) "link"
-%unicode|string%(7) "symlink"
+string(%d) "%s/foo"
+string(12) "symlink.link"
+string(4) "link"
+string(7) "symlink"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(%d) "%s/foo"
- [%u|b%"basename"]=>
- %unicode|string%(12) "symlink.link"
- [%u|b%"extension"]=>
- %unicode|string%(4) "link"
- [%u|b%"filename"]=>
- %unicode|string%(7) "symlink"
+ ["dirname"]=>
+ string(%d) "%s/foo"
+ ["basename"]=>
+ string(12) "symlink.link"
+ ["extension"]=>
+ string(4) "link"
+ ["filename"]=>
+ string(7) "symlink"
}
-- Iteration 11 --
-%unicode|string%(%d) "%s/foo"
-%unicode|string%(12) "symlink.link"
-%unicode|string%(4) "link"
-%unicode|string%(7) "symlink"
+string(%d) "%s/foo"
+string(12) "symlink.link"
+string(4) "link"
+string(7) "symlink"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(%d) "%s/foo"
- [%u|b%"basename"]=>
- %unicode|string%(12) "symlink.link"
- [%u|b%"extension"]=>
- %unicode|string%(4) "link"
- [%u|b%"filename"]=>
- %unicode|string%(7) "symlink"
+ ["dirname"]=>
+ string(%d) "%s/foo"
+ ["basename"]=>
+ string(12) "symlink.link"
+ ["extension"]=>
+ string(4) "link"
+ ["filename"]=>
+ string(7) "symlink"
}
-- Iteration 12 --
-%unicode|string%(%d) "%s/foo"
-%unicode|string%(12) "symlink.link"
-%unicode|string%(4) "link"
-%unicode|string%(7) "symlink"
+string(%d) "%s/foo"
+string(12) "symlink.link"
+string(4) "link"
+string(7) "symlink"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(%d) "%s/foo"
- [%u|b%"basename"]=>
- %unicode|string%(12) "symlink.link"
- [%u|b%"extension"]=>
- %unicode|string%(4) "link"
- [%u|b%"filename"]=>
- %unicode|string%(7) "symlink"
+ ["dirname"]=>
+ string(%d) "%s/foo"
+ ["basename"]=>
+ string(12) "symlink.link"
+ ["extension"]=>
+ string(4) "link"
+ ["filename"]=>
+ string(7) "symlink"
}
-- Iteration 13 --
string(%d) "%s/foo"
@@ -253,149 +253,149 @@ string(12) "symlink.link"
string(4) "link"
string(7) "symlink"
array(4) {
- [%u|b%"dirname"]=>
+ ["dirname"]=>
string(%d) "%s/foo"
- [%u|b%"basename"]=>
+ ["basename"]=>
string(12) "symlink.link"
- [%u|b%"extension"]=>
+ ["extension"]=>
string(4) "link"
- [%u|b%"filename"]=>
+ ["filename"]=>
string(7) "symlink"
}
-- Iteration 14 --
-%unicode|string%(1) "."
-%unicode|string%(1) "."
-%unicode|string%(0) ""
-%unicode|string%(0) ""
+string(1) "."
+string(1) "."
+string(0) ""
+string(0) ""
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(1) "."
- [%u|b%"extension"]=>
- %unicode|string%(0) ""
- [%u|b%"filename"]=>
- %unicode|string%(0) ""
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(1) "."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
}
-- Iteration 15 --
-%unicode|string%(%d) "%s"
-%unicode|string%(3) "foo"
-%unicode|string%(0) ""
-%unicode|string%(3) "foo"
+string(%d) "%s"
+string(3) "foo"
+string(0) ""
+string(3) "foo"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(%d) "%s"
- [%u|b%"basename"]=>
- %unicode|string%(3) "foo"
- [%u|b%"filename"]=>
- %unicode|string%(3) "foo"
+ ["dirname"]=>
+ string(%d) "%s"
+ ["basename"]=>
+ string(3) "foo"
+ ["filename"]=>
+ string(3) "foo"
}
-- Iteration 16 --
-%unicode|string%(%d) "%s"
-%unicode|string%(3) "foo"
-%unicode|string%(0) ""
-%unicode|string%(3) "foo"
+string(%d) "%s"
+string(3) "foo"
+string(0) ""
+string(3) "foo"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(%d) "%s"
- [%u|b%"basename"]=>
- %unicode|string%(3) "foo"
- [%u|b%"filename"]=>
- %unicode|string%(3) "foo"
+ ["dirname"]=>
+ string(%d) "%s"
+ ["basename"]=>
+ string(3) "foo"
+ ["filename"]=>
+ string(3) "foo"
}
-- Iteration 17 --
-%unicode|string%(%d) "%s/.."
-%unicode|string%(3) "foo"
-%unicode|string%(0) ""
-%unicode|string%(3) "foo"
+string(%d) "%s/.."
+string(3) "foo"
+string(0) ""
+string(3) "foo"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(%d) "%s/.."
- [%u|b%"basename"]=>
- %unicode|string%(3) "foo"
- [%u|b%"filename"]=>
- %unicode|string%(3) "foo"
+ ["dirname"]=>
+ string(%d) "%s/.."
+ ["basename"]=>
+ string(3) "foo"
+ ["filename"]=>
+ string(3) "foo"
}
-- Iteration 18 --
-%unicode|string%(6) "../foo"
-%unicode|string%(3) "bar"
-%unicode|string%(0) ""
-%unicode|string%(3) "bar"
+string(6) "../foo"
+string(3) "bar"
+string(0) ""
+string(3) "bar"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(6) "../foo"
- [%u|b%"basename"]=>
- %unicode|string%(3) "bar"
- [%u|b%"filename"]=>
- %unicode|string%(3) "bar"
+ ["dirname"]=>
+ string(6) "../foo"
+ ["basename"]=>
+ string(3) "bar"
+ ["filename"]=>
+ string(3) "bar"
}
-- Iteration 19 --
-%unicode|string%(5) "./foo"
-%unicode|string%(3) "bar"
-%unicode|string%(0) ""
-%unicode|string%(3) "bar"
+string(5) "./foo"
+string(3) "bar"
+string(0) ""
+string(3) "bar"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(5) "./foo"
- [%u|b%"basename"]=>
- %unicode|string%(3) "bar"
- [%u|b%"filename"]=>
- %unicode|string%(3) "bar"
+ ["dirname"]=>
+ string(5) "./foo"
+ ["basename"]=>
+ string(3) "bar"
+ ["filename"]=>
+ string(3) "bar"
}
-- Iteration 20 --
-%unicode|string%(5) "//foo"
-%unicode|string%(3) "bar"
-%unicode|string%(0) ""
-%unicode|string%(3) "bar"
+string(5) "//foo"
+string(3) "bar"
+string(0) ""
+string(3) "bar"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(5) "//foo"
- [%u|b%"basename"]=>
- %unicode|string%(3) "bar"
- [%u|b%"filename"]=>
- %unicode|string%(3) "bar"
+ ["dirname"]=>
+ string(5) "//foo"
+ ["basename"]=>
+ string(3) "bar"
+ ["filename"]=>
+ string(3) "bar"
}
-- Iteration 21 --
-%unicode|string%(5) "~/PHP"
-%unicode|string%(8) "php5.2.0"
-%unicode|string%(1) "0"
-%unicode|string%(6) "php5.2"
+string(5) "~/PHP"
+string(8) "php5.2.0"
+string(1) "0"
+string(6) "php5.2"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(5) "~/PHP"
- [%u|b%"basename"]=>
- %unicode|string%(8) "php5.2.0"
- [%u|b%"extension"]=>
- %unicode|string%(1) "0"
- [%u|b%"filename"]=>
- %unicode|string%(6) "php5.2"
+ ["dirname"]=>
+ string(5) "~/PHP"
+ ["basename"]=>
+ string(8) "php5.2.0"
+ ["extension"]=>
+ string(1) "0"
+ ["filename"]=>
+ string(6) "php5.2"
}
-- Iteration 22 --
-%unicode|string%(13) "/home/example"
-%unicode|string%(4) "test"
-%unicode|string%(0) ""
-%unicode|string%(4) "test"
+string(13) "/home/example"
+string(4) "test"
+string(0) ""
+string(4) "test"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(13) "/home/example"
- [%u|b%"basename"]=>
- %unicode|string%(4) "test"
- [%u|b%"filename"]=>
- %unicode|string%(4) "test"
+ ["dirname"]=>
+ string(13) "/home/example"
+ ["basename"]=>
+ string(4) "test"
+ ["filename"]=>
+ string(4) "test"
}
-- Iteration 23 --
-%unicode|string%(23) "http://httpd.apache.org"
-%unicode|string%(24) "core.html#acceptpathinfo"
-%unicode|string%(19) "html#acceptpathinfo"
-%unicode|string%(4) "core"
+string(23) "http://httpd.apache.org"
+string(24) "core.html#acceptpathinfo"
+string(19) "html#acceptpathinfo"
+string(4) "core"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(23) "http://httpd.apache.org"
- [%u|b%"basename"]=>
- %unicode|string%(24) "core.html#acceptpathinfo"
- [%u|b%"extension"]=>
- %unicode|string%(19) "html#acceptpathinfo"
- [%u|b%"filename"]=>
- %unicode|string%(4) "core"
+ ["dirname"]=>
+ string(23) "http://httpd.apache.org"
+ ["basename"]=>
+ string(24) "core.html#acceptpathinfo"
+ ["extension"]=>
+ string(19) "html#acceptpathinfo"
+ ["filename"]=>
+ string(4) "core"
}
Done
diff --git a/ext/standard/tests/file/pathinfo_basic1.phpt b/ext/standard/tests/file/pathinfo_basic1.phpt
index 92f0524da4..c57774a141 100644
--- a/ext/standard/tests/file/pathinfo_basic1.phpt
+++ b/ext/standard/tests/file/pathinfo_basic1.phpt
@@ -74,537 +74,537 @@ echo "Done\n";
--EXPECTF--
*** Testing basic functions of pathinfo() ***
-- Iteration 1 --
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
array(2) {
- [%u|b%"basename"]=>
- %unicode|string%(0) ""
- [%u|b%"filename"]=>
- %unicode|string%(0) ""
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
}
-- Iteration 2 --
-%unicode|string%(1) "."
-%unicode|string%(1) " "
-%unicode|string%(0) ""
-%unicode|string%(1) " "
+string(1) "."
+string(1) " "
+string(0) ""
+string(1) " "
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(1) " "
- [%u|b%"filename"]=>
- %unicode|string%(1) " "
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(1) " "
+ ["filename"]=>
+ string(1) " "
}
-- Iteration 3 --
-%unicode|string%(1) "."
-%unicode|string%(2) "c:"
-%unicode|string%(0) ""
-%unicode|string%(2) "c:"
+string(1) "."
+string(2) "c:"
+string(0) ""
+string(2) "c:"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(2) "c:"
- [%u|b%"filename"]=>
- %unicode|string%(2) "c:"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(2) "c:"
+ ["filename"]=>
+ string(2) "c:"
}
-- Iteration 4 --
-%unicode|string%(1) "."
-%unicode|string%(3) "c:\"
-%unicode|string%(0) ""
-%unicode|string%(3) "c:\"
+string(1) "."
+string(3) "c:\"
+string(0) ""
+string(3) "c:\"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(3) "c:\"
- [%u|b%"filename"]=>
- %unicode|string%(3) "c:\"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(3) "c:\"
+ ["filename"]=>
+ string(3) "c:\"
}
-- Iteration 5 --
-%unicode|string%(1) "."
-%unicode|string%(2) "c:"
-%unicode|string%(0) ""
-%unicode|string%(2) "c:"
+string(1) "."
+string(2) "c:"
+string(0) ""
+string(2) "c:"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(2) "c:"
- [%u|b%"filename"]=>
- %unicode|string%(2) "c:"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(2) "c:"
+ ["filename"]=>
+ string(2) "c:"
}
-- Iteration 6 --
-%unicode|string%(1) "."
-%unicode|string%(5) "afile"
-%unicode|string%(0) ""
-%unicode|string%(5) "afile"
+string(1) "."
+string(5) "afile"
+string(0) ""
+string(5) "afile"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(5) "afile"
- [%u|b%"filename"]=>
- %unicode|string%(5) "afile"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(5) "afile"
+ ["filename"]=>
+ string(5) "afile"
}
-- Iteration 7 --
-%unicode|string%(1) "."
-%unicode|string%(12) "c:\test\adir"
-%unicode|string%(0) ""
-%unicode|string%(12) "c:\test\adir"
+string(1) "."
+string(12) "c:\test\adir"
+string(0) ""
+string(12) "c:\test\adir"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(12) "c:\test\adir"
- [%u|b%"filename"]=>
- %unicode|string%(12) "c:\test\adir"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(12) "c:\test\adir"
+ ["filename"]=>
+ string(12) "c:\test\adir"
}
-- Iteration 8 --
-%unicode|string%(1) "."
-%unicode|string%(13) "c:\test\adir\"
-%unicode|string%(0) ""
-%unicode|string%(13) "c:\test\adir\"
+string(1) "."
+string(13) "c:\test\adir\"
+string(0) ""
+string(13) "c:\test\adir\"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(13) "c:\test\adir\"
- [%u|b%"filename"]=>
- %unicode|string%(13) "c:\test\adir\"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(13) "c:\test\adir\"
+ ["filename"]=>
+ string(13) "c:\test\adir\"
}
-- Iteration 9 --
-%unicode|string%(12) "/usr/include"
-%unicode|string%(4) "arpa"
-%unicode|string%(0) ""
-%unicode|string%(4) "arpa"
+string(12) "/usr/include"
+string(4) "arpa"
+string(0) ""
+string(4) "arpa"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(12) "/usr/include"
- [%u|b%"basename"]=>
- %unicode|string%(4) "arpa"
- [%u|b%"filename"]=>
- %unicode|string%(4) "arpa"
+ ["dirname"]=>
+ string(12) "/usr/include"
+ ["basename"]=>
+ string(4) "arpa"
+ ["filename"]=>
+ string(4) "arpa"
}
-- Iteration 10 --
-%unicode|string%(12) "/usr/include"
-%unicode|string%(4) "arpa"
-%unicode|string%(0) ""
-%unicode|string%(4) "arpa"
+string(12) "/usr/include"
+string(4) "arpa"
+string(0) ""
+string(4) "arpa"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(12) "/usr/include"
- [%u|b%"basename"]=>
- %unicode|string%(4) "arpa"
- [%u|b%"filename"]=>
- %unicode|string%(4) "arpa"
+ ["dirname"]=>
+ string(12) "/usr/include"
+ ["basename"]=>
+ string(4) "arpa"
+ ["filename"]=>
+ string(4) "arpa"
}
-- Iteration 11 --
-%unicode|string%(11) "usr/include"
-%unicode|string%(4) "arpa"
-%unicode|string%(0) ""
-%unicode|string%(4) "arpa"
+string(11) "usr/include"
+string(4) "arpa"
+string(0) ""
+string(4) "arpa"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(11) "usr/include"
- [%u|b%"basename"]=>
- %unicode|string%(4) "arpa"
- [%u|b%"filename"]=>
- %unicode|string%(4) "arpa"
+ ["dirname"]=>
+ string(11) "usr/include"
+ ["basename"]=>
+ string(4) "arpa"
+ ["filename"]=>
+ string(4) "arpa"
}
-- Iteration 12 --
-%unicode|string%(11) "usr/include"
-%unicode|string%(4) "arpa"
-%unicode|string%(0) ""
-%unicode|string%(4) "arpa"
+string(11) "usr/include"
+string(4) "arpa"
+string(0) ""
+string(4) "arpa"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(11) "usr/include"
- [%u|b%"basename"]=>
- %unicode|string%(4) "arpa"
- [%u|b%"filename"]=>
- %unicode|string%(4) "arpa"
+ ["dirname"]=>
+ string(11) "usr/include"
+ ["basename"]=>
+ string(4) "arpa"
+ ["filename"]=>
+ string(4) "arpa"
}
-- Iteration 13 --
-%unicode|string%(1) "."
-%unicode|string%(13) "c:\test\afile"
-%unicode|string%(0) ""
-%unicode|string%(13) "c:\test\afile"
+string(1) "."
+string(13) "c:\test\afile"
+string(0) ""
+string(13) "c:\test\afile"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(13) "c:\test\afile"
- [%u|b%"filename"]=>
- %unicode|string%(13) "c:\test\afile"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(13) "c:\test\afile"
+ ["filename"]=>
+ string(13) "c:\test\afile"
}
-- Iteration 14 --
-%unicode|string%(1) "."
-%unicode|string%(13) "c:\test\afile"
-%unicode|string%(0) ""
-%unicode|string%(13) "c:\test\afile"
+string(1) "."
+string(13) "c:\test\afile"
+string(0) ""
+string(13) "c:\test\afile"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(13) "c:\test\afile"
- [%u|b%"filename"]=>
- %unicode|string%(13) "c:\test\afile"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(13) "c:\test\afile"
+ ["filename"]=>
+ string(13) "c:\test\afile"
}
-- Iteration 15 --
-%unicode|string%(8) "c://test"
-%unicode|string%(5) "afile"
-%unicode|string%(0) ""
-%unicode|string%(5) "afile"
+string(8) "c://test"
+string(5) "afile"
+string(0) ""
+string(5) "afile"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(8) "c://test"
- [%u|b%"basename"]=>
- %unicode|string%(5) "afile"
- [%u|b%"filename"]=>
- %unicode|string%(5) "afile"
+ ["dirname"]=>
+ string(8) "c://test"
+ ["basename"]=>
+ string(5) "afile"
+ ["filename"]=>
+ string(5) "afile"
}
-- Iteration 16 --
-%unicode|string%(1) "."
-%unicode|string%(14) "c:\test\afile\"
-%unicode|string%(0) ""
-%unicode|string%(14) "c:\test\afile\"
+string(1) "."
+string(14) "c:\test\afile\"
+string(0) ""
+string(14) "c:\test\afile\"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(14) "c:\test\afile\"
- [%u|b%"filename"]=>
- %unicode|string%(14) "c:\test\afile\"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(14) "c:\test\afile\"
+ ["filename"]=>
+ string(14) "c:\test\afile\"
}
-- Iteration 17 --
-%unicode|string%(1) "."
-%unicode|string%(16) "c:\test\prog.exe"
-%unicode|string%(3) "exe"
-%unicode|string%(12) "c:\test\prog"
+string(1) "."
+string(16) "c:\test\prog.exe"
+string(3) "exe"
+string(12) "c:\test\prog"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(16) "c:\test\prog.exe"
- [%u|b%"extension"]=>
- %unicode|string%(3) "exe"
- [%u|b%"filename"]=>
- %unicode|string%(12) "c:\test\prog"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(16) "c:\test\prog.exe"
+ ["extension"]=>
+ string(3) "exe"
+ ["filename"]=>
+ string(12) "c:\test\prog"
}
-- Iteration 18 --
-%unicode|string%(1) "."
-%unicode|string%(16) "c:\test\prog.exe"
-%unicode|string%(3) "exe"
-%unicode|string%(12) "c:\test\prog"
+string(1) "."
+string(16) "c:\test\prog.exe"
+string(3) "exe"
+string(12) "c:\test\prog"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(16) "c:\test\prog.exe"
- [%u|b%"extension"]=>
- %unicode|string%(3) "exe"
- [%u|b%"filename"]=>
- %unicode|string%(12) "c:\test\prog"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(16) "c:\test\prog.exe"
+ ["extension"]=>
+ string(3) "exe"
+ ["filename"]=>
+ string(12) "c:\test\prog"
}
-- Iteration 19 --
-%unicode|string%(7) "c:/test"
-%unicode|string%(8) "prog.exe"
-%unicode|string%(3) "exe"
-%unicode|string%(4) "prog"
+string(7) "c:/test"
+string(8) "prog.exe"
+string(3) "exe"
+string(4) "prog"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(7) "c:/test"
- [%u|b%"basename"]=>
- %unicode|string%(8) "prog.exe"
- [%u|b%"extension"]=>
- %unicode|string%(3) "exe"
- [%u|b%"filename"]=>
- %unicode|string%(4) "prog"
+ ["dirname"]=>
+ string(7) "c:/test"
+ ["basename"]=>
+ string(8) "prog.exe"
+ ["extension"]=>
+ string(3) "exe"
+ ["filename"]=>
+ string(4) "prog"
}
-- Iteration 20 --
-%unicode|string%(17) "/usr/include/arpa"
-%unicode|string%(6) "inet.h"
-%unicode|string%(1) "h"
-%unicode|string%(4) "inet"
+string(17) "/usr/include/arpa"
+string(6) "inet.h"
+string(1) "h"
+string(4) "inet"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(17) "/usr/include/arpa"
- [%u|b%"basename"]=>
- %unicode|string%(6) "inet.h"
- [%u|b%"extension"]=>
- %unicode|string%(1) "h"
- [%u|b%"filename"]=>
- %unicode|string%(4) "inet"
+ ["dirname"]=>
+ string(17) "/usr/include/arpa"
+ ["basename"]=>
+ string(6) "inet.h"
+ ["extension"]=>
+ string(1) "h"
+ ["filename"]=>
+ string(4) "inet"
}
-- Iteration 21 --
-%unicode|string%(19) "//usr/include//arpa"
-%unicode|string%(6) "inet.h"
-%unicode|string%(1) "h"
-%unicode|string%(4) "inet"
+string(19) "//usr/include//arpa"
+string(6) "inet.h"
+string(1) "h"
+string(4) "inet"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(19) "//usr/include//arpa"
- [%u|b%"basename"]=>
- %unicode|string%(6) "inet.h"
- [%u|b%"extension"]=>
- %unicode|string%(1) "h"
- [%u|b%"filename"]=>
- %unicode|string%(4) "inet"
+ ["dirname"]=>
+ string(19) "//usr/include//arpa"
+ ["basename"]=>
+ string(6) "inet.h"
+ ["extension"]=>
+ string(1) "h"
+ ["filename"]=>
+ string(4) "inet"
}
-- Iteration 22 --
-%unicode|string%(1) "."
-%unicode|string%(1) "\"
-%unicode|string%(0) ""
-%unicode|string%(1) "\"
+string(1) "."
+string(1) "\"
+string(0) ""
+string(1) "\"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(1) "\"
- [%u|b%"filename"]=>
- %unicode|string%(1) "\"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(1) "\"
+ ["filename"]=>
+ string(1) "\"
}
-- Iteration 23 --
-%unicode|string%(1) "."
-%unicode|string%(2) "\\"
-%unicode|string%(0) ""
-%unicode|string%(2) "\\"
+string(1) "."
+string(2) "\\"
+string(0) ""
+string(2) "\\"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(2) "\\"
- [%u|b%"filename"]=>
- %unicode|string%(2) "\\"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(2) "\\"
+ ["filename"]=>
+ string(2) "\\"
}
-- Iteration 24 --
-%unicode|string%(1) "/"
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
+string(1) "/"
+string(0) ""
+string(0) ""
+string(0) ""
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "/"
- [%u|b%"basename"]=>
- %unicode|string%(0) ""
- [%u|b%"filename"]=>
- %unicode|string%(0) ""
+ ["dirname"]=>
+ string(1) "/"
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
}
-- Iteration 25 --
-%unicode|string%(1) "/"
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
+string(1) "/"
+string(0) ""
+string(0) ""
+string(0) ""
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "/"
- [%u|b%"basename"]=>
- %unicode|string%(0) ""
- [%u|b%"filename"]=>
- %unicode|string%(0) ""
+ ["dirname"]=>
+ string(1) "/"
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
}
-- Iteration 26 --
-%unicode|string%(1) "/"
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
+string(1) "/"
+string(0) ""
+string(0) ""
+string(0) ""
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "/"
- [%u|b%"basename"]=>
- %unicode|string%(0) ""
- [%u|b%"filename"]=>
- %unicode|string%(0) ""
+ ["dirname"]=>
+ string(1) "/"
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
}
-- Iteration 27 --
-%unicode|string%(17) "/usr/include/arpa"
-%unicode|string%(6) "inet.h"
-%unicode|string%(1) "h"
-%unicode|string%(4) "inet"
+string(17) "/usr/include/arpa"
+string(6) "inet.h"
+string(1) "h"
+string(4) "inet"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(17) "/usr/include/arpa"
- [%u|b%"basename"]=>
- %unicode|string%(6) "inet.h"
- [%u|b%"extension"]=>
- %unicode|string%(1) "h"
- [%u|b%"filename"]=>
- %unicode|string%(4) "inet"
+ ["dirname"]=>
+ string(17) "/usr/include/arpa"
+ ["basename"]=>
+ string(6) "inet.h"
+ ["extension"]=>
+ string(1) "h"
+ ["filename"]=>
+ string(4) "inet"
}
-- Iteration 28 --
-%unicode|string%(27) "c:\windows/system32\drivers"
-%unicode|string%(9) "etc\hosts"
-%unicode|string%(0) ""
-%unicode|string%(9) "etc\hosts"
+string(27) "c:\windows/system32\drivers"
+string(9) "etc\hosts"
+string(0) ""
+string(9) "etc\hosts"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(27) "c:\windows/system32\drivers"
- [%u|b%"basename"]=>
- %unicode|string%(9) "etc\hosts"
- [%u|b%"filename"]=>
- %unicode|string%(9) "etc\hosts"
+ ["dirname"]=>
+ string(27) "c:\windows/system32\drivers"
+ ["basename"]=>
+ string(9) "etc\hosts"
+ ["filename"]=>
+ string(9) "etc\hosts"
}
-- Iteration 29 --
-%unicode|string%(12) "/usr\include"
-%unicode|string%(11) "arpa\inet.h"
-%unicode|string%(1) "h"
-%unicode|string%(9) "arpa\inet"
+string(12) "/usr\include"
+string(11) "arpa\inet.h"
+string(1) "h"
+string(9) "arpa\inet"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(12) "/usr\include"
- [%u|b%"basename"]=>
- %unicode|string%(11) "arpa\inet.h"
- [%u|b%"extension"]=>
- %unicode|string%(1) "h"
- [%u|b%"filename"]=>
- %unicode|string%(9) "arpa\inet"
+ ["dirname"]=>
+ string(12) "/usr\include"
+ ["basename"]=>
+ string(11) "arpa\inet.h"
+ ["extension"]=>
+ string(1) "h"
+ ["filename"]=>
+ string(9) "arpa\inet"
}
-- Iteration 30 --
-%unicode|string%(1) "."
-%unicode|string%(25) " c:\test\adir\afile.txt"
-%unicode|string%(3) "txt"
-%unicode|string%(21) " c:\test\adir\afile"
+string(1) "."
+string(25) " c:\test\adir\afile.txt"
+string(3) "txt"
+string(21) " c:\test\adir\afile"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(25) " c:\test\adir\afile.txt"
- [%u|b%"extension"]=>
- %unicode|string%(3) "txt"
- [%u|b%"filename"]=>
- %unicode|string%(21) " c:\test\adir\afile"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(25) " c:\test\adir\afile.txt"
+ ["extension"]=>
+ string(3) "txt"
+ ["filename"]=>
+ string(21) " c:\test\adir\afile"
}
-- Iteration 31 --
-%unicode|string%(1) "."
-%unicode|string%(25) "c:\test\adir\afile.txt "
-%unicode|string%(6) "txt "
-%unicode|string%(18) "c:\test\adir\afile"
+string(1) "."
+string(25) "c:\test\adir\afile.txt "
+string(6) "txt "
+string(18) "c:\test\adir\afile"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(25) "c:\test\adir\afile.txt "
- [%u|b%"extension"]=>
- %unicode|string%(6) "txt "
- [%u|b%"filename"]=>
- %unicode|string%(18) "c:\test\adir\afile"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(25) "c:\test\adir\afile.txt "
+ ["extension"]=>
+ string(6) "txt "
+ ["filename"]=>
+ string(18) "c:\test\adir\afile"
}
-- Iteration 32 --
-%unicode|string%(1) "."
-%unicode|string%(28) " c:\test\adir\afile.txt "
-%unicode|string%(6) "txt "
-%unicode|string%(21) " c:\test\adir\afile"
+string(1) "."
+string(28) " c:\test\adir\afile.txt "
+string(6) "txt "
+string(21) " c:\test\adir\afile"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(28) " c:\test\adir\afile.txt "
- [%u|b%"extension"]=>
- %unicode|string%(6) "txt "
- [%u|b%"filename"]=>
- %unicode|string%(21) " c:\test\adir\afile"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(28) " c:\test\adir\afile.txt "
+ ["extension"]=>
+ string(6) "txt "
+ ["filename"]=>
+ string(21) " c:\test\adir\afile"
}
-- Iteration 33 --
-%unicode|string%(20) " /usr/include/arpa"
-%unicode|string%(6) "inet.h"
-%unicode|string%(1) "h"
-%unicode|string%(4) "inet"
+string(20) " /usr/include/arpa"
+string(6) "inet.h"
+string(1) "h"
+string(4) "inet"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(20) " /usr/include/arpa"
- [%u|b%"basename"]=>
- %unicode|string%(6) "inet.h"
- [%u|b%"extension"]=>
- %unicode|string%(1) "h"
- [%u|b%"filename"]=>
- %unicode|string%(4) "inet"
+ ["dirname"]=>
+ string(20) " /usr/include/arpa"
+ ["basename"]=>
+ string(6) "inet.h"
+ ["extension"]=>
+ string(1) "h"
+ ["filename"]=>
+ string(4) "inet"
}
-- Iteration 34 --
-%unicode|string%(17) "/usr/include/arpa"
-%unicode|string%(9) "inet.h "
-%unicode|string%(4) "h "
-%unicode|string%(4) "inet"
+string(17) "/usr/include/arpa"
+string(9) "inet.h "
+string(4) "h "
+string(4) "inet"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(17) "/usr/include/arpa"
- [%u|b%"basename"]=>
- %unicode|string%(9) "inet.h "
- [%u|b%"extension"]=>
- %unicode|string%(4) "h "
- [%u|b%"filename"]=>
- %unicode|string%(4) "inet"
+ ["dirname"]=>
+ string(17) "/usr/include/arpa"
+ ["basename"]=>
+ string(9) "inet.h "
+ ["extension"]=>
+ string(4) "h "
+ ["filename"]=>
+ string(4) "inet"
}
-- Iteration 35 --
-%unicode|string%(20) " /usr/include/arpa"
-%unicode|string%(9) "inet.h "
-%unicode|string%(4) "h "
-%unicode|string%(4) "inet"
+string(20) " /usr/include/arpa"
+string(9) "inet.h "
+string(4) "h "
+string(4) "inet"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(20) " /usr/include/arpa"
- [%u|b%"basename"]=>
- %unicode|string%(9) "inet.h "
- [%u|b%"extension"]=>
- %unicode|string%(4) "h "
- [%u|b%"filename"]=>
- %unicode|string%(4) "inet"
+ ["dirname"]=>
+ string(20) " /usr/include/arpa"
+ ["basename"]=>
+ string(9) "inet.h "
+ ["extension"]=>
+ string(4) "h "
+ ["filename"]=>
+ string(4) "inet"
}
-- Iteration 36 --
-%unicode|string%(1) "."
-%unicode|string%(3) " c:"
-%unicode|string%(0) ""
-%unicode|string%(3) " c:"
+string(1) "."
+string(3) " c:"
+string(0) ""
+string(3) " c:"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(3) " c:"
- [%u|b%"filename"]=>
- %unicode|string%(3) " c:"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(3) " c:"
+ ["filename"]=>
+ string(3) " c:"
}
-- Iteration 37 --
-%unicode|string%(1) "."
-%unicode|string%(24) " c:\test\adir\afile.txt"
-%unicode|string%(3) "txt"
-%unicode|string%(20) " c:\test\adir\afile"
+string(1) "."
+string(24) " c:\test\adir\afile.txt"
+string(3) "txt"
+string(20) " c:\test\adir\afile"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(24) " c:\test\adir\afile.txt"
- [%u|b%"extension"]=>
- %unicode|string%(3) "txt"
- [%u|b%"filename"]=>
- %unicode|string%(20) " c:\test\adir\afile"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(24) " c:\test\adir\afile.txt"
+ ["extension"]=>
+ string(3) "txt"
+ ["filename"]=>
+ string(20) " c:\test\adir\afile"
}
-- Iteration 38 --
-%unicode|string%(1) "/"
-%unicode|string%(3) "usr"
-%unicode|string%(0) ""
-%unicode|string%(3) "usr"
+string(1) "/"
+string(3) "usr"
+string(0) ""
+string(3) "usr"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "/"
- [%u|b%"basename"]=>
- %unicode|string%(3) "usr"
- [%u|b%"filename"]=>
- %unicode|string%(3) "usr"
+ ["dirname"]=>
+ string(1) "/"
+ ["basename"]=>
+ string(3) "usr"
+ ["filename"]=>
+ string(3) "usr"
}
-- Iteration 39 --
-%unicode|string%(1) "/"
-%unicode|string%(3) "usr"
-%unicode|string%(0) ""
-%unicode|string%(3) "usr"
+string(1) "/"
+string(3) "usr"
+string(0) ""
+string(3) "usr"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "/"
- [%u|b%"basename"]=>
- %unicode|string%(3) "usr"
- [%u|b%"filename"]=>
- %unicode|string%(3) "usr"
+ ["dirname"]=>
+ string(1) "/"
+ ["basename"]=>
+ string(3) "usr"
+ ["filename"]=>
+ string(3) "usr"
}
Done
diff --git a/ext/standard/tests/file/pathinfo_basic2.phpt b/ext/standard/tests/file/pathinfo_basic2.phpt
index 23c0768ded..3ec7eec358 100644
--- a/ext/standard/tests/file/pathinfo_basic2.phpt
+++ b/ext/standard/tests/file/pathinfo_basic2.phpt
@@ -51,223 +51,223 @@ echo "Done\n";
--EXPECTF--
*** Testing basic functions of pathinfo() ***
-- Iteration 1 --
-%unicode|string%(1) "."
-%unicode|string%(10) "c:\..\dir1"
-%unicode|string%(5) "\dir1"
-%unicode|string%(4) "c:\."
+string(1) "."
+string(10) "c:\..\dir1"
+string(5) "\dir1"
+string(4) "c:\."
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(10) "c:\..\dir1"
- [%u|b%"extension"]=>
- %unicode|string%(5) "\dir1"
- [%u|b%"filename"]=>
- %unicode|string%(4) "c:\."
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(10) "c:\..\dir1"
+ ["extension"]=>
+ string(5) "\dir1"
+ ["filename"]=>
+ string(4) "c:\."
}
-- Iteration 2 --
-%unicode|string%(1) "."
-%unicode|string%(33) "c:\test\..\test2\.\adir\afile.txt"
-%unicode|string%(3) "txt"
-%unicode|string%(29) "c:\test\..\test2\.\adir\afile"
+string(1) "."
+string(33) "c:\test\..\test2\.\adir\afile.txt"
+string(3) "txt"
+string(29) "c:\test\..\test2\.\adir\afile"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(33) "c:\test\..\test2\.\adir\afile.txt"
- [%u|b%"extension"]=>
- %unicode|string%(3) "txt"
- [%u|b%"filename"]=>
- %unicode|string%(29) "c:\test\..\test2\.\adir\afile"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(33) "c:\test\..\test2\.\adir\afile.txt"
+ ["extension"]=>
+ string(3) "txt"
+ ["filename"]=>
+ string(29) "c:\test\..\test2\.\adir\afile"
}
-- Iteration 3 --
-%unicode|string%(22) "/usr/include/../arpa/."
-%unicode|string%(6) "inet.h"
-%unicode|string%(1) "h"
-%unicode|string%(4) "inet"
+string(22) "/usr/include/../arpa/."
+string(6) "inet.h"
+string(1) "h"
+string(4) "inet"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(22) "/usr/include/../arpa/."
- [%u|b%"basename"]=>
- %unicode|string%(6) "inet.h"
- [%u|b%"extension"]=>
- %unicode|string%(1) "h"
- [%u|b%"filename"]=>
- %unicode|string%(4) "inet"
+ ["dirname"]=>
+ string(22) "/usr/include/../arpa/."
+ ["basename"]=>
+ string(6) "inet.h"
+ ["extension"]=>
+ string(1) "h"
+ ["filename"]=>
+ string(4) "inet"
}
-- Iteration 4 --
-%unicode|string%(1) "."
-%unicode|string%(23) "c:\test\adir\afile..txt"
-%unicode|string%(3) "txt"
-%unicode|string%(19) "c:\test\adir\afile."
+string(1) "."
+string(23) "c:\test\adir\afile..txt"
+string(3) "txt"
+string(19) "c:\test\adir\afile."
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(23) "c:\test\adir\afile..txt"
- [%u|b%"extension"]=>
- %unicode|string%(3) "txt"
- [%u|b%"filename"]=>
- %unicode|string%(19) "c:\test\adir\afile."
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(23) "c:\test\adir\afile..txt"
+ ["extension"]=>
+ string(3) "txt"
+ ["filename"]=>
+ string(19) "c:\test\adir\afile."
}
-- Iteration 5 --
-%unicode|string%(17) "/usr/include/arpa"
-%unicode|string%(7) "inet..h"
-%unicode|string%(1) "h"
-%unicode|string%(5) "inet."
+string(17) "/usr/include/arpa"
+string(7) "inet..h"
+string(1) "h"
+string(5) "inet."
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(17) "/usr/include/arpa"
- [%u|b%"basename"]=>
- %unicode|string%(7) "inet..h"
- [%u|b%"extension"]=>
- %unicode|string%(1) "h"
- [%u|b%"filename"]=>
- %unicode|string%(5) "inet."
+ ["dirname"]=>
+ string(17) "/usr/include/arpa"
+ ["basename"]=>
+ string(7) "inet..h"
+ ["extension"]=>
+ string(1) "h"
+ ["filename"]=>
+ string(5) "inet."
}
-- Iteration 6 --
-%unicode|string%(1) "."
-%unicode|string%(19) "c:\test\adir\afile."
-%unicode|string%(0) ""
-%unicode|string%(18) "c:\test\adir\afile"
+string(1) "."
+string(19) "c:\test\adir\afile."
+string(0) ""
+string(18) "c:\test\adir\afile"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(19) "c:\test\adir\afile."
- [%u|b%"extension"]=>
- %unicode|string%(0) ""
- [%u|b%"filename"]=>
- %unicode|string%(18) "c:\test\adir\afile"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(19) "c:\test\adir\afile."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(18) "c:\test\adir\afile"
}
-- Iteration 7 --
-%unicode|string%(17) "/usr/include/arpa"
-%unicode|string%(5) "inet."
-%unicode|string%(0) ""
-%unicode|string%(4) "inet"
+string(17) "/usr/include/arpa"
+string(5) "inet."
+string(0) ""
+string(4) "inet"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(17) "/usr/include/arpa"
- [%u|b%"basename"]=>
- %unicode|string%(5) "inet."
- [%u|b%"extension"]=>
- %unicode|string%(0) ""
- [%u|b%"filename"]=>
- %unicode|string%(4) "inet"
+ ["dirname"]=>
+ string(17) "/usr/include/arpa"
+ ["basename"]=>
+ string(5) "inet."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(4) "inet"
}
-- Iteration 8 --
-%unicode|string%(17) "/usr/include/arpa"
-%unicode|string%(6) "inet,h"
-%unicode|string%(0) ""
-%unicode|string%(6) "inet,h"
+string(17) "/usr/include/arpa"
+string(6) "inet,h"
+string(0) ""
+string(6) "inet,h"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(17) "/usr/include/arpa"
- [%u|b%"basename"]=>
- %unicode|string%(6) "inet,h"
- [%u|b%"filename"]=>
- %unicode|string%(6) "inet,h"
+ ["dirname"]=>
+ string(17) "/usr/include/arpa"
+ ["basename"]=>
+ string(6) "inet,h"
+ ["filename"]=>
+ string(6) "inet,h"
}
-- Iteration 9 --
-%unicode|string%(1) "."
-%unicode|string%(11) "c:afile.txt"
-%unicode|string%(3) "txt"
-%unicode|string%(7) "c:afile"
+string(1) "."
+string(11) "c:afile.txt"
+string(3) "txt"
+string(7) "c:afile"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(11) "c:afile.txt"
- [%u|b%"extension"]=>
- %unicode|string%(3) "txt"
- [%u|b%"filename"]=>
- %unicode|string%(7) "c:afile"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(11) "c:afile.txt"
+ ["extension"]=>
+ string(3) "txt"
+ ["filename"]=>
+ string(7) "c:afile"
}
-- Iteration 10 --
-%unicode|string%(1) "."
-%unicode|string%(22) "..\.\..\test\afile.txt"
-%unicode|string%(3) "txt"
-%unicode|string%(18) "..\.\..\test\afile"
+string(1) "."
+string(22) "..\.\..\test\afile.txt"
+string(3) "txt"
+string(18) "..\.\..\test\afile"
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(22) "..\.\..\test\afile.txt"
- [%u|b%"extension"]=>
- %unicode|string%(3) "txt"
- [%u|b%"filename"]=>
- %unicode|string%(18) "..\.\..\test\afile"
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(22) "..\.\..\test\afile.txt"
+ ["extension"]=>
+ string(3) "txt"
+ ["filename"]=>
+ string(18) "..\.\..\test\afile"
}
-- Iteration 11 --
-%unicode|string%(12) ".././../test"
-%unicode|string%(5) "afile"
-%unicode|string%(0) ""
-%unicode|string%(5) "afile"
+string(12) ".././../test"
+string(5) "afile"
+string(0) ""
+string(5) "afile"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(12) ".././../test"
- [%u|b%"basename"]=>
- %unicode|string%(5) "afile"
- [%u|b%"filename"]=>
- %unicode|string%(5) "afile"
+ ["dirname"]=>
+ string(12) ".././../test"
+ ["basename"]=>
+ string(5) "afile"
+ ["filename"]=>
+ string(5) "afile"
}
-- Iteration 12 --
-%unicode|string%(1) "."
-%unicode|string%(1) "."
-%unicode|string%(0) ""
-%unicode|string%(0) ""
+string(1) "."
+string(1) "."
+string(0) ""
+string(0) ""
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(1) "."
- [%u|b%"extension"]=>
- %unicode|string%(0) ""
- [%u|b%"filename"]=>
- %unicode|string%(0) ""
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(1) "."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
}
-- Iteration 13 --
-%unicode|string%(1) "."
-%unicode|string%(2) ".."
-%unicode|string%(0) ""
-%unicode|string%(1) "."
+string(1) "."
+string(2) ".."
+string(0) ""
+string(1) "."
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(2) ".."
- [%u|b%"extension"]=>
- %unicode|string%(0) ""
- [%u|b%"filename"]=>
- %unicode|string%(1) "."
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(2) ".."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(1) "."
}
-- Iteration 14 --
-%unicode|string%(1) "."
-%unicode|string%(3) "..."
-%unicode|string%(0) ""
-%unicode|string%(2) ".."
+string(1) "."
+string(3) "..."
+string(0) ""
+string(2) ".."
array(4) {
- [%u|b%"dirname"]=>
- %unicode|string%(1) "."
- [%u|b%"basename"]=>
- %unicode|string%(3) "..."
- [%u|b%"extension"]=>
- %unicode|string%(0) ""
- [%u|b%"filename"]=>
- %unicode|string%(2) ".."
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(3) "..."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(2) ".."
}
-- Iteration 15 --
-%unicode|string%(12) "/usr/lib/..."
-%unicode|string%(5) "afile"
-%unicode|string%(0) ""
-%unicode|string%(5) "afile"
+string(12) "/usr/lib/..."
+string(5) "afile"
+string(0) ""
+string(5) "afile"
array(3) {
- [%u|b%"dirname"]=>
- %unicode|string%(12) "/usr/lib/..."
- [%u|b%"basename"]=>
- %unicode|string%(5) "afile"
- [%u|b%"filename"]=>
- %unicode|string%(5) "afile"
+ ["dirname"]=>
+ string(12) "/usr/lib/..."
+ ["basename"]=>
+ string(5) "afile"
+ ["filename"]=>
+ string(5) "afile"
}
Done
diff --git a/ext/standard/tests/file/popen_pclose_basic.phpt b/ext/standard/tests/file/popen_pclose_basic.phpt
index 9812193c66..55a87bb02a 100644
--- a/ext/standard/tests/file/popen_pclose_basic.phpt
+++ b/ext/standard/tests/file/popen_pclose_basic.phpt
@@ -47,8 +47,8 @@ $file_handle = popen("sort", "w");
$counter = 0;
$newline = "\n";
foreach($arr as $str) {
- fwrite($file_handle, (binary)$str);
- fwrite($file_handle, (binary)$newline);
+ fwrite($file_handle, $str);
+ fwrite($file_handle, $newline);
}
pclose($file_handle);
diff --git a/ext/standard/tests/file/proc_open01.phpt b/ext/standard/tests/file/proc_open01.phpt
index 3348403e2b..4e619a3286 100644
--- a/ext/standard/tests/file/proc_open01.phpt
+++ b/ext/standard/tests/file/proc_open01.phpt
@@ -18,7 +18,7 @@ if ($proc === false) {
}
var_dump($pipes);
stream_set_blocking($pipes[1], FALSE);
-$test_string = b"yay!\n";
+$test_string = "yay!\n";
fwrite($pipes[0], $test_string);
fflush($pipes[0]);
fclose($pipes[0]);
@@ -57,7 +57,7 @@ array(2) {
[1]=>
resource(%d) of type (stream)
}
-%unicode|string%(5) "yay!
+string(5) "yay!
"
array(3) {
[0]=>
diff --git a/ext/standard/tests/file/realpath_basic-win32-mb.phpt b/ext/standard/tests/file/realpath_basic-win32-mb.phpt
index c0f39b6054..dbfdfc41d6 100644
--- a/ext/standard/tests/file/realpath_basic-win32-mb.phpt
+++ b/ext/standard/tests/file/realpath_basic-win32-mb.phpt
@@ -34,7 +34,7 @@ $filenames = array (
"$file_path/realpath_ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™basic/home//../././realpath_ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™basic.tmp//",
// checking for binary safe
- b"$file_path/realpath_ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™basic/home/realpath_ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™basic.tmp",
+ "$file_path/realpath_ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™basic/home/realpath_ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™basic.tmp",
/* filenames with invalid path */
"$file_path///realpath_ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™basic/home//..//././test//realpath_ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™basic.tmp",
diff --git a/ext/standard/tests/file/realpath_basic-win32.phpt b/ext/standard/tests/file/realpath_basic-win32.phpt
index 5ebfcff683..a768ca9540 100644
--- a/ext/standard/tests/file/realpath_basic-win32.phpt
+++ b/ext/standard/tests/file/realpath_basic-win32.phpt
@@ -34,7 +34,7 @@ $filenames = array (
"$file_path/realpath_basic/home//../././realpath_basic.tmp//",
// checking for binary safe
- b"$file_path/realpath_basic/home/realpath_basic.tmp",
+ "$file_path/realpath_basic/home/realpath_basic.tmp",
/* filenames with invalid path */
"$file_path///realpath_basic/home//..//././test//realpath_basic.tmp",
diff --git a/ext/standard/tests/file/rename_variation8-win32.phpt b/ext/standard/tests/file/rename_variation8-win32.phpt
index 1d25a12e04..7be25949f6 100644
--- a/ext/standard/tests/file/rename_variation8-win32.phpt
+++ b/ext/standard/tests/file/rename_variation8-win32.phpt
@@ -1,70 +1,70 @@
---TEST--
-Test rename() function: variation
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows');
-?>
---FILE--
-<?php
-/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
- Description: Renames a file or directory
-*/
-
-echo "\n*** Testing rename() on non-existing file ***\n";
-$file_path = dirname(__FILE__);
-
-// try renaming a non existing file
-$src_name = $file_path."/non_existent_file.tmp";
-$dest_name = $file_path."/rename_variation8_new.tmp";
-var_dump( rename($src_name, $dest_name) );
-
-// ensure that $dest_name didn't get created
-var_dump( file_exists($src_name) ); // expecting false
-var_dump( file_exists($dest_name) ); // expecting false
-
-// rename a existing dir to new name
-echo "\n*** Testing rename() on existing directory ***\n";
-$dir_name = $file_path."/rename_basic_dir";
-mkdir($dir_name);
-$new_dir_name = $file_path."/rename_basic_dir1";
-var_dump( rename($dir_name, $new_dir_name) );
-//ensure that $new_dir_name got created
-var_dump( file_exists($dir_name) ); // expecting false
-var_dump( file_exists($new_dir_name) ); // expecting true
-
-// try to rename an non_existing dir
-echo "\n*** Testing rename() on non-existing directory ***\n";
-$non_existent_dir_name = $file_path."/non_existent_dir";
-$new_dir_name = "$file_path/rename_basic_dir2";
-var_dump( rename($non_existent_dir_name, $new_dir_name) );
-// ensure that $new_dir_name didn't get created
-var_dump( file_exists($non_existent_dir_name) ); // expecting flase
-var_dump( file_exists($new_dir_name) ); // expecting false
-
-echo "Done\n";
-?>
---CLEAN--
-<?php
-rmdir(dirname(__FILE__)."/rename_basic_dir1");
-?>
---EXPECTF--
-*** Testing rename() on non-existing file ***
-
-Warning: rename(%s/non_existent_file.tmp,%s/rename_variation8_new.tmp): The system cannot find the file specified. (code: 2) in %s on line %d
-bool(false)
-bool(false)
-bool(false)
-
-*** Testing rename() on existing directory ***
-bool(true)
-bool(false)
-bool(true)
-
-*** Testing rename() on non-existing directory ***
-
-Warning: rename(%s/non_existent_dir,%s/rename_basic_dir2): The system cannot find the file specified. (code: 2) in %s on line %d
-bool(false)
-bool(false)
-bool(false)
-Done
-
+--TEST--
+Test rename() function: variation
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows');
+?>
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+echo "\n*** Testing rename() on non-existing file ***\n";
+$file_path = dirname(__FILE__);
+
+// try renaming a non existing file
+$src_name = $file_path."/non_existent_file.tmp";
+$dest_name = $file_path."/rename_variation8_new.tmp";
+var_dump( rename($src_name, $dest_name) );
+
+// ensure that $dest_name didn't get created
+var_dump( file_exists($src_name) ); // expecting false
+var_dump( file_exists($dest_name) ); // expecting false
+
+// rename a existing dir to new name
+echo "\n*** Testing rename() on existing directory ***\n";
+$dir_name = $file_path."/rename_basic_dir";
+mkdir($dir_name);
+$new_dir_name = $file_path."/rename_basic_dir1";
+var_dump( rename($dir_name, $new_dir_name) );
+//ensure that $new_dir_name got created
+var_dump( file_exists($dir_name) ); // expecting false
+var_dump( file_exists($new_dir_name) ); // expecting true
+
+// try to rename an non_existing dir
+echo "\n*** Testing rename() on non-existing directory ***\n";
+$non_existent_dir_name = $file_path."/non_existent_dir";
+$new_dir_name = "$file_path/rename_basic_dir2";
+var_dump( rename($non_existent_dir_name, $new_dir_name) );
+// ensure that $new_dir_name didn't get created
+var_dump( file_exists($non_existent_dir_name) ); // expecting flase
+var_dump( file_exists($new_dir_name) ); // expecting false
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+rmdir(dirname(__FILE__)."/rename_basic_dir1");
+?>
+--EXPECTF--
+*** Testing rename() on non-existing file ***
+
+Warning: rename(%s/non_existent_file.tmp,%s/rename_variation8_new.tmp): The system cannot find the file specified. (code: 2) in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing rename() on existing directory ***
+bool(true)
+bool(false)
+bool(true)
+
+*** Testing rename() on non-existing directory ***
+
+Warning: rename(%s/non_existent_dir,%s/rename_basic_dir2): The system cannot find the file specified. (code: 2) in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+Done
+
diff --git a/ext/standard/tests/file/stream_enclosed.phpt b/ext/standard/tests/file/stream_enclosed.phpt
index 9520ecce74..ff764c8f81 100644
--- a/ext/standard/tests/file/stream_enclosed.phpt
+++ b/ext/standard/tests/file/stream_enclosed.phpt
@@ -1,20 +1,20 @@
---TEST--
-Unexposed/leaked stream encloses another stream
---SKIPIF--
-<?php
-if (!function_exists('leak_variable')) die("skip only debug builds");
---FILE--
-<?php
-$s = fopen('php://temp/maxmemory=1024','wb+');
-
-$t = fopen('php://temp/maxmemory=1024','wb+');
-
-/* force conversion of inner stream to STDIO. */
-$i = 0;
-while ($i++ < 5000) {
- fwrite($t, str_repeat('a',1024));
-}
-
-leak_variable($s, true);
-leak_variable($t, true);
---EXPECT--
+--TEST--
+Unexposed/leaked stream encloses another stream
+--SKIPIF--
+<?php
+if (!function_exists('zend_leak_variable')) die("skip only debug builds");
+--FILE--
+<?php
+$s = fopen('php://temp/maxmemory=1024','wb+');
+
+$t = fopen('php://temp/maxmemory=1024','wb+');
+
+/* force conversion of inner stream to STDIO. */
+$i = 0;
+while ($i++ < 5000) {
+ fwrite($t, str_repeat('a',1024));
+}
+
+zend_leak_variable($s);
+zend_leak_variable($t);
+--EXPECT--
diff --git a/ext/standard/tests/file/stream_get_line.phpt b/ext/standard/tests/file/stream_get_line.phpt
index 89798ef95e..2c11f00eed 100644
--- a/ext/standard/tests/file/stream_get_line.phpt
+++ b/ext/standard/tests/file/stream_get_line.phpt
@@ -4,7 +4,7 @@ Crash inside stream_get_line(), when length=0
<?php
$path = dirname(__FILE__) . '/test.html';
-file_put_contents($path, b"foo<br>bar<br>foo");
+file_put_contents($path, "foo<br>bar<br>foo");
$fp = fopen($path, "r");
while ($fp && !feof($fp)) {
echo stream_get_line($fp, 0, "<br>")."\n";
diff --git a/ext/standard/tests/file/symlink_to_symlink.phpt b/ext/standard/tests/file/symlink_to_symlink.phpt
index 8b7ff65cf0..c13c26d827 100644
--- a/ext/standard/tests/file/symlink_to_symlink.phpt
+++ b/ext/standard/tests/file/symlink_to_symlink.phpt
@@ -43,8 +43,8 @@ unlink($prefix . "_file");
?>
--EXPECTF--
-%unicode|string%(%d) "symlink_to_symlink.php_file"
-%unicode|string%(%d) "symlink_to_symlink.php_link1"
-%unicode|string%(%d) "symlink_to_symlink.php_nonexistent"
-%unicode|string%(%d) "%s/symlink_to_symlink.php_file"
-%unicode|string%(%d) "%s/symlink_to_symlink.php_link4"
+string(%d) "symlink_to_symlink.php_file"
+string(%d) "symlink_to_symlink.php_link1"
+string(%d) "symlink_to_symlink.php_nonexistent"
+string(%d) "%s/symlink_to_symlink.php_file"
+string(%d) "%s/symlink_to_symlink.php_link4"
diff --git a/ext/standard/tests/file/unlink_error.phpt b/ext/standard/tests/file/unlink_error.phpt
index 9571784a31..ae888bce4a 100644
--- a/ext/standard/tests/file/unlink_error.phpt
+++ b/ext/standard/tests/file/unlink_error.phpt
@@ -89,7 +89,7 @@ Warning: unlink(): %s in %s on line %d
bool(false)
bool(false)
-Warning: unlink() expects parameter 2 to be resource, %unicode_string_optional% given in %s on line %d
+Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d
bool(false)
Warning: unlink() expects parameter 2 to be resource, boolean given in %s on line %d
diff --git a/ext/standard/tests/file/userfilters.phpt b/ext/standard/tests/file/userfilters.phpt
index 2246b5d8a4..dfa8376fff 100644
--- a/ext/standard/tests/file/userfilters.phpt
+++ b/ext/standard/tests/file/userfilters.phpt
@@ -20,7 +20,7 @@ class testfilter extends php_user_filter {
stream_filter_register('testfilter','testfilter');
-$text = b"Hello There!";
+$text = "Hello There!";
$fp = tmpfile();
fwrite($fp, $text);
diff --git a/ext/standard/tests/file/userstreams.phpt b/ext/standard/tests/file/userstreams.phpt
index d39898bbe2..0e649e9a92 100644
--- a/ext/standard/tests/file/userstreams.phpt
+++ b/ext/standard/tests/file/userstreams.phpt
@@ -67,7 +67,7 @@ for ($i = 0; $i < 30; $i++) {
/* store the data in a regular file so that we can compare
* the results */
$tf = tmpfile();
-fwrite($tf, (binary)$DATA);
+fwrite($tf, $DATA);
$n = ftell($tf);
rewind($tf) or die("failed to rewind tmp file!");
if (ftell($tf) != 0)
diff --git a/ext/standard/tests/file/userstreams_003.phpt b/ext/standard/tests/file/userstreams_003.phpt
index 01a8efbf5c..9ee71f2666 100644
--- a/ext/standard/tests/file/userstreams_003.phpt
+++ b/ext/standard/tests/file/userstreams_003.phpt
@@ -19,9 +19,9 @@ class test_wrapper extends test_wrapper_base {
var_dump($value);
echo "ptrparam:\n";
var_dump($ptrparam);
- echo "\$option === $option === " . $this->expected_option . ":\n";;
+ echo "\$option === $option === " . $this->expected_option . ":\n";
var_dump($option === $this->expected_option);
- echo "\$value === $value === " . $this->expected_value. ":\n";;
+ echo "\$value === $value === " . $this->expected_value. ":\n";
var_dump($value === $this->expected_value);
return $this->return_value;
}
diff --git a/ext/standard/tests/file/windows_links/bug48746.phpt b/ext/standard/tests/file/windows_links/bug48746.phpt
index 5978e7f7f1..671c347a61 100644
--- a/ext/standard/tests/file/windows_links/bug48746.phpt
+++ b/ext/standard/tests/file/windows_links/bug48746.phpt
@@ -1,58 +1,58 @@
---TEST--
-Bug#48746 - Junction not working properly
-
---CREDITS--
-Venkat Raman Don (don.raman@microsoft.com)
-
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$cmd = "mklink /?";
-$ret = @exec($cmd, $output, $return_val);
-if (count($output) == 0) {
- die("mklink.exe not found in PATH");
-}
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$mountvol = get_mountvol();
-$old_dir = __DIR__;
-$dirname = __DIR__ . "\\mnt\\test\\directory";
-mkdir($dirname, 0700, true);
-chdir(__DIR__ . "\\mnt\\test");
-$drive = substr(__DIR__, 0, 2);
-$pathwithoutdrive = substr(__DIR__, 2);
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
-exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
-$fullpath = "mounted_volume" . $pathwithoutdrive;
-exec("mklink /j mklink_junction directory", $output, $ret_val);
-var_dump(file_exists("directory"));
-var_dump(file_exists("mklink_junction"));
-var_dump(file_exists("mounted_volume"));
-var_dump(file_exists("$fullpath"));
-var_dump(is_dir("mklink_junction"));
-var_dump(is_dir("$fullpath"));
-var_dump(is_readable("mklink_junction"));
-var_dump(is_writeable("$fullpath"));
-chdir($old_dir);
-
-rmdir(__DIR__ . "\\mnt\\test\\directory");
-rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDITS--
+Venkat Raman Don (don.raman@microsoft.com)
+
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+include_once __DIR__ . '/common.inc';
+$cmd = "mklink /?";
+$ret = @exec($cmd, $output, $return_val);
+if (count($output) == 0) {
+ die("mklink.exe not found in PATH");
+}
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+$mountvol = get_mountvol();
+$old_dir = __DIR__;
+$dirname = __DIR__ . "\\mnt\\test\\directory";
+mkdir($dirname, 0700, true);
+chdir(__DIR__ . "\\mnt\\test");
+$drive = substr(__DIR__, 0, 2);
+$pathwithoutdrive = substr(__DIR__, 2);
+$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
+exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
+$fullpath = "mounted_volume" . $pathwithoutdrive;
+exec("mklink /j mklink_junction directory", $output, $ret_val);
+var_dump(file_exists("directory"));
+var_dump(file_exists("mklink_junction"));
+var_dump(file_exists("mounted_volume"));
+var_dump(file_exists("$fullpath"));
+var_dump(is_dir("mklink_junction"));
+var_dump(is_dir("$fullpath"));
+var_dump(is_readable("mklink_junction"));
+var_dump(is_writeable("$fullpath"));
+chdir($old_dir);
+
+rmdir(__DIR__ . "\\mnt\\test\\directory");
+rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
+rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/file/windows_links/bug48746_1.phpt b/ext/standard/tests/file/windows_links/bug48746_1.phpt
index a4277a47a1..56764bcf5f 100644
--- a/ext/standard/tests/file/windows_links/bug48746_1.phpt
+++ b/ext/standard/tests/file/windows_links/bug48746_1.phpt
@@ -1,59 +1,59 @@
---TEST--
-Bug#48746 - Junction not working properly
-
---CREDITS--
-Venkat Raman Don (don.raman@microsoft.com)
-
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$cmd = "mklink /?";
-$ret = @exec($cmd, $output, $return_val);
-if (count($output) == 0) {
- die("mklink.exe not found in PATH");
-}
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$mountvol = get_mountvol();
-$old_dir = __DIR__;
-$dirname = __DIR__ . "\\mnt\\test\\directory";
-exec("mkdir " . $dirname, $output, $ret_val);
-chdir(__DIR__ . "\\mnt\\test");
-$drive = substr(__DIR__, 0, 2);
-$pathwithoutdrive = substr(__DIR__, 2);
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
-exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
-$fullpath = "mounted_volume" . $pathwithoutdrive;
-exec("mklink /j mklink_junction directory", $output, $ret_val);
-file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");
-include_once "mklink_junction\\a.php";
-file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");
-require "$fullpath\\mnt\\test\\directory\\b.php";
-file_put_contents("$fullpath\\mnt\\test\\mklink_junction\\c.php", "<?php echo \"I am included.\n\" ?>");
-require_once "$fullpath\\mnt\\test\\mklink_junction\\c.php";
-var_dump(is_file("mklink_junction\\a.php"));
-var_dump(is_file("$fullpath\\mnt\\test\\directory\\b.php"));
-var_dump(is_file("$fullpath\\mnt\\test\\mklink_junction\\c.php"));
-unlink("$fullpath\\mnt\\test\\directory\\b.php");
-unlink("$fullpath\\mnt\\test\\mklink_junction\\c.php");
-unlink("mklink_junction\\a.php");
-chdir($old_dir);
-rmdir(__DIR__ . "\\mnt\\test\\directory");
-rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-I am included.
-I am included.
-I am included.
-bool(true)
-bool(true)
-bool(true)
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDITS--
+Venkat Raman Don (don.raman@microsoft.com)
+
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+include_once __DIR__ . '/common.inc';
+$cmd = "mklink /?";
+$ret = @exec($cmd, $output, $return_val);
+if (count($output) == 0) {
+ die("mklink.exe not found in PATH");
+}
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+$mountvol = get_mountvol();
+$old_dir = __DIR__;
+$dirname = __DIR__ . "\\mnt\\test\\directory";
+exec("mkdir " . $dirname, $output, $ret_val);
+chdir(__DIR__ . "\\mnt\\test");
+$drive = substr(__DIR__, 0, 2);
+$pathwithoutdrive = substr(__DIR__, 2);
+$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
+exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
+$fullpath = "mounted_volume" . $pathwithoutdrive;
+exec("mklink /j mklink_junction directory", $output, $ret_val);
+file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");
+include_once "mklink_junction\\a.php";
+file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");
+require "$fullpath\\mnt\\test\\directory\\b.php";
+file_put_contents("$fullpath\\mnt\\test\\mklink_junction\\c.php", "<?php echo \"I am included.\n\" ?>");
+require_once "$fullpath\\mnt\\test\\mklink_junction\\c.php";
+var_dump(is_file("mklink_junction\\a.php"));
+var_dump(is_file("$fullpath\\mnt\\test\\directory\\b.php"));
+var_dump(is_file("$fullpath\\mnt\\test\\mklink_junction\\c.php"));
+unlink("$fullpath\\mnt\\test\\directory\\b.php");
+unlink("$fullpath\\mnt\\test\\mklink_junction\\c.php");
+unlink("mklink_junction\\a.php");
+chdir($old_dir);
+rmdir(__DIR__ . "\\mnt\\test\\directory");
+rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
+rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+I am included.
+I am included.
+I am included.
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/file/windows_links/bug48746_2.phpt b/ext/standard/tests/file/windows_links/bug48746_2.phpt
index 509610f8a4..9f2ff850b6 100644
--- a/ext/standard/tests/file/windows_links/bug48746_2.phpt
+++ b/ext/standard/tests/file/windows_links/bug48746_2.phpt
@@ -1,69 +1,69 @@
---TEST--
-Bug#48746 - Junction not working properly
-
---CREDITS--
-Venkat Raman Don (don.raman@microsoft.com)
-
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);
-if (strpos($ret, 'privilege')) {
- die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
-}
-unlink('bug48746_tmp.lnk');
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$mountvol = get_mountvol();
-$old_dir = __DIR__;
-$dirname = __DIR__ . "\\mnt\\test\\directory";
-exec("mkdir " . $dirname, $output, $ret_val);
-chdir(__DIR__ . "\\mnt\\test");
-$drive = substr(__DIR__, 0, 2);
-$pathwithoutdrive = substr(__DIR__, 2);
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
-exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
-$fullpath = "mounted_volume" . $pathwithoutdrive;
-exec("mklink /j mklink_junction directory", $output, $ret_val);
-file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");
-file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");
-print_r(scandir("mklink_junction"));
-print_r(scandir("$fullpath\\mnt\\test\\directory"));
-print_r(scandir("$fullpath\\mnt\\test\\mklink_junction"));
-unlink("$fullpath\\mnt\\test\\directory\\b.php");
-unlink("mklink_junction\\a.php");
-chdir($old_dir);
-rmdir(__DIR__ . "\\mnt\\test\\directory");
-rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-Array
-(
- [0] => .
- [1] => ..
- [2] => a.php
- [3] => b.php
-)
-Array
-(
- [0] => .
- [1] => ..
- [2] => a.php
- [3] => b.php
-)
-Array
-(
- [0] => .
- [1] => ..
- [2] => a.php
- [3] => b.php
-)
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDITS--
+Venkat Raman Don (don.raman@microsoft.com)
+
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+include_once __DIR__ . '/common.inc';
+$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);
+if (strpos($ret, 'privilege')) {
+ die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
+}
+unlink('bug48746_tmp.lnk');
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+$mountvol = get_mountvol();
+$old_dir = __DIR__;
+$dirname = __DIR__ . "\\mnt\\test\\directory";
+exec("mkdir " . $dirname, $output, $ret_val);
+chdir(__DIR__ . "\\mnt\\test");
+$drive = substr(__DIR__, 0, 2);
+$pathwithoutdrive = substr(__DIR__, 2);
+$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
+exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
+$fullpath = "mounted_volume" . $pathwithoutdrive;
+exec("mklink /j mklink_junction directory", $output, $ret_val);
+file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");
+file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");
+print_r(scandir("mklink_junction"));
+print_r(scandir("$fullpath\\mnt\\test\\directory"));
+print_r(scandir("$fullpath\\mnt\\test\\mklink_junction"));
+unlink("$fullpath\\mnt\\test\\directory\\b.php");
+unlink("mklink_junction\\a.php");
+chdir($old_dir);
+rmdir(__DIR__ . "\\mnt\\test\\directory");
+rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
+rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+Array
+(
+ [0] => .
+ [1] => ..
+ [2] => a.php
+ [3] => b.php
+)
+Array
+(
+ [0] => .
+ [1] => ..
+ [2] => a.php
+ [3] => b.php
+)
+Array
+(
+ [0] => .
+ [1] => ..
+ [2] => a.php
+ [3] => b.php
+)
diff --git a/ext/standard/tests/file/windows_links/bug48746_3.phpt b/ext/standard/tests/file/windows_links/bug48746_3.phpt
index 98e81787b8..83bdea3a8c 100644
--- a/ext/standard/tests/file/windows_links/bug48746_3.phpt
+++ b/ext/standard/tests/file/windows_links/bug48746_3.phpt
@@ -1,50 +1,50 @@
---TEST--
-Bug#48746 - Junction not working properly
-
---CREDITS--
-Venkat Raman Don (don.raman@microsoft.com)
-
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$ret = exec(get_junction().' /? 2>&1', $out);
-if (strpos($out[0], 'recognized')) {
- die('skip. junction.exe not found in PATH.');
-}
-
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$old_dir = __DIR__;
-$dirname = __DIR__ . "\\mnt\\test\\directory";
-exec("mkdir " . $dirname, $output, $ret_val);
-chdir(__DIR__ . "\\mnt\\test");
-exec(get_junction()." junction directory", $output, $ret_val);
-file_put_contents("junction\\a.php", "<?php echo \"I am included.\n\" ?>");
-file_put_contents("junction\\b.php", "<?php echo \"I am included.\n\" ?>");
-include "junction/a.php";
-require_once "junction\\b.php";
-print_r(scandir("junction"));
-unlink("junction\\a.php");
-unlink("junction\\b.php");
-chdir($old_dir);
-rmdir(__DIR__ . "\\mnt\\test\\directory");
-rmdir(__DIR__ . "\\mnt\\test\\junction");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-I am included.
-I am included.
-Array
-(
- [0] => .
- [1] => ..
- [2] => a.php
- [3] => b.php
-)
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDITS--
+Venkat Raman Don (don.raman@microsoft.com)
+
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+include_once __DIR__ . '/common.inc';
+$ret = exec(get_junction().' /? 2>&1', $out);
+if (strpos($out[0], 'recognized')) {
+ die('skip. junction.exe not found in PATH.');
+}
+
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+$old_dir = __DIR__;
+$dirname = __DIR__ . "\\mnt\\test\\directory";
+exec("mkdir " . $dirname, $output, $ret_val);
+chdir(__DIR__ . "\\mnt\\test");
+exec(get_junction()." junction directory", $output, $ret_val);
+file_put_contents("junction\\a.php", "<?php echo \"I am included.\n\" ?>");
+file_put_contents("junction\\b.php", "<?php echo \"I am included.\n\" ?>");
+include "junction/a.php";
+require_once "junction\\b.php";
+print_r(scandir("junction"));
+unlink("junction\\a.php");
+unlink("junction\\b.php");
+chdir($old_dir);
+rmdir(__DIR__ . "\\mnt\\test\\directory");
+rmdir(__DIR__ . "\\mnt\\test\\junction");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+I am included.
+I am included.
+Array
+(
+ [0] => .
+ [1] => ..
+ [2] => a.php
+ [3] => b.php
+)
diff --git a/ext/standard/tests/filters/bug22538.phpt b/ext/standard/tests/filters/bug22538.phpt
index 438b5be31f..0f007e47bb 100644
--- a/ext/standard/tests/filters/bug22538.phpt
+++ b/ext/standard/tests/filters/bug22538.phpt
@@ -24,8 +24,8 @@ while (($cnt -= $str_len) > 0) {
}
$cnt = $size - ($str_len + $cnt);
fclose($fp);
-$fin = fopen($path1, "r") or die("Can not open $path1\n");;
-$fout = fopen($path2, "w") or die("Can not open $path2\n");;
+$fin = fopen($path1, "r") or die("Can not open $path1\n");
+$fout = fopen($path2, "w") or die("Can not open $path2\n");
stream_filter_append($fout, "string.rot13");
my_stream_copy_to_stream($fin, $fout);
fclose($fout);
diff --git a/ext/standard/tests/filters/filter_errors.inc b/ext/standard/tests/filters/filter_errors.inc
index 7345df383c..6d1a270c82 100644
--- a/ext/standard/tests/filters/filter_errors.inc
+++ b/ext/standard/tests/filters/filter_errors.inc
@@ -17,7 +17,7 @@ function filter_errors_test($filter, $data) {
$stream = fopen('php://memory', 'wb+');
- fwrite($stream, b".\r\n$data");
+ fwrite($stream, ".\r\n$data");
fseek($stream, 0, SEEK_SET);
stream_get_line($stream, 8192, "\r\n");
@@ -27,7 +27,7 @@ function filter_errors_test($filter, $data) {
$stream = fopen('php://memory', 'wb+');
- fwrite($stream, b"$data");
+ fwrite($stream, "$data");
fseek($stream, 0, SEEK_SET);
stream_filter_append($stream, $filter);
diff --git a/ext/standard/tests/filters/filter_errors_user.phpt b/ext/standard/tests/filters/filter_errors_user.phpt
index 7bdf8de08a..9b911cf81f 100644
--- a/ext/standard/tests/filters/filter_errors_user.phpt
+++ b/ext/standard/tests/filters/filter_errors_user.phpt
@@ -52,7 +52,7 @@ echo "test append / read / remove\n";
for($i = 0; $i < 5; ++$i) {
echo "test_filter$i\n";
$stream = fopen('php://memory', 'wb+');
- fwrite($stream, b"42");
+ fwrite($stream, "42");
fseek($stream, 0, SEEK_SET);
$f = stream_filter_append($stream, "test_filter$i");
stream_get_contents($stream);
@@ -61,7 +61,7 @@ for($i = 0; $i < 5; ++$i) {
echo "test append all / read / remove all\n";
$stream = fopen('php://memory', 'wb+');
-fwrite($stream, b"42");
+fwrite($stream, "42");
fseek($stream, 0, SEEK_SET);
$filters = array();
for($i = 0; $i < 5; ++$i) {
@@ -75,7 +75,7 @@ foreach($filters as $filter) {
echo "test append all / read / close\n";
$stream = fopen('php://memory', 'wb+');
-fwrite($stream, b"42");
+fwrite($stream, "42");
fseek($stream, 0, SEEK_SET);
$filters = array();
for($i = 0; $i < 5; ++$i) {
diff --git a/ext/standard/tests/filters/filter_errors_zlib_inflate.phpt b/ext/standard/tests/filters/filter_errors_zlib_inflate.phpt
index ebb3b21df2..be7bdba3fb 100644
--- a/ext/standard/tests/filters/filter_errors_zlib_inflate.phpt
+++ b/ext/standard/tests/filters/filter_errors_zlib_inflate.phpt
@@ -5,7 +5,7 @@ Filter errors: zlib.inflate
--FILE--
<?php
require 'filter_errors.inc';
-filter_errors_test('zlib.inflate', gzencode(b'42'));
+filter_errors_test('zlib.inflate', gzencode('42'));
?>
--EXPECTF--
test filtering of buffered data
diff --git a/ext/standard/tests/forward_static_call_array.phpt b/ext/standard/tests/forward_static_call_array.phpt
new file mode 100644
index 0000000000..a135a712fc
--- /dev/null
+++ b/ext/standard/tests/forward_static_call_array.phpt
@@ -0,0 +1,47 @@
+--TEST--
+mixed forward_static_call_array ( callable $function , array $parameters );
+--CREDITS--
+marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
+--SKIPIF--
+<?php
+if (phpversion() < "5.3.0") {
+ die('SKIP php version so lower.');
+}
+?>
+--FILE--
+<?php
+
+function test() {
+ $args = func_get_args();
+ echo "C " . join(',', $args) . " \n";
+}
+
+class A {
+
+ const NAME = 'A';
+
+ public static function test() {
+ $args = func_get_args();
+ echo static::NAME, " " . join(',', $args) . " \n";
+ }
+
+}
+
+class B extends A {
+
+ const NAME = 'B';
+
+ public static function test() {
+ echo self::NAME, "\n";
+ forward_static_call_array(array('A', 'test'), array('more', 'args'));
+ forward_static_call_array('test', array('other', 'args'));
+ }
+
+}
+
+B::test('foo');
+?>
+--EXPECT--
+B
+B more,args
+C other,args
diff --git a/ext/standard/tests/general_functions/bug35229.phpt b/ext/standard/tests/general_functions/bug35229.phpt
index c3c273dfee..8e8895dd59 100644
--- a/ext/standard/tests/general_functions/bug35229.phpt
+++ b/ext/standard/tests/general_functions/bug35229.phpt
@@ -8,8 +8,7 @@ class test2 {
}
}
-function __autoload($class)
-{
+spl_autoload_register(function ($class) {
eval('class test1 extends test2 {}');
test1::use_stack(
@@ -17,7 +16,7 @@ function __autoload($class)
11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,27,28,29,30
);
-}
+});
call_user_func(array('test1', 'use_stack'),
1,2,3,4,5,6,7,8,9,10,
diff --git a/ext/standard/tests/general_functions/bug50690.phpt b/ext/standard/tests/general_functions/bug50690.phpt
index 4d9f0dc5ee..54198a1337 100644
--- a/ext/standard/tests/general_functions/bug50690.phpt
+++ b/ext/standard/tests/general_functions/bug50690.phpt
@@ -1,14 +1,14 @@
---TEST--
-Bug #23650 (putenv() does not assign values when the value is one character)
---FILE--
-<?php
-putenv("foo=ab");
-putenv("bar=c");
-var_dump(getenv("foo"));
-var_dump(getenv("bar"));
-var_dump(getenv("thisvardoesnotexist"));
-?>
---EXPECT--
-string(2) "ab"
-string(1) "c"
-bool(false)
+--TEST--
+Bug #23650 (putenv() does not assign values when the value is one character)
+--FILE--
+<?php
+putenv("foo=ab");
+putenv("bar=c");
+var_dump(getenv("foo"));
+var_dump(getenv("bar"));
+var_dump(getenv("thisvardoesnotexist"));
+?>
+--EXPECT--
+string(2) "ab"
+string(1) "c"
+bool(false)
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
index c7a72de944..f743e7456c 100644
--- a/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
@@ -5,8 +5,6 @@ Francesco Fullone ff@ideato.it
#PHPTestFest Cesena Italia on 2009-06-20
--INI--
magic_quotes_gpc=1
---SKIPIF--
-<?php if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or greater"); ?>
--FILE--
<?php
echo "*** Test by calling method or function with deprecated option ***\n";
diff --git a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt
index 9e2e66c94c..544887129f 100644
--- a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt
+++ b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt
@@ -1,39 +1,39 @@
---TEST--
-Test get_defined_constants() function : basic functionality
---FILE--
-<?php
-/* Prototype : array get_defined_constants ([ bool $categorize ] )
- * Description: Returns an associative array with the names of all the constants and their values
- * Source code: Zend/zend_builtin_functions.c
- */
-
-echo "*** Testing get_defined_constants() : basic functionality ***\n";
-
-var_dump(gettype(get_defined_constants(true)));
-var_dump(gettype(get_defined_constants()));
-
-$arr1 = get_defined_constants(false);
-$arr2 = get_defined_constants();
-var_dump(array_diff($arr1, $arr2));
-
-$n1 = count(get_defined_constants());
-define("USER_CONSTANT", "test");
-$arr2 = get_defined_constants();
-$n2 = count($arr2);
-
-if ($n2 == $n1 + 1 && array_key_exists("USER_CONSTANT", $arr2)) {
- echo "TEST PASSED\n";
-} else {
- echo "TEST FAILED\n";
-}
-
-?>
-===DONE===
---EXPECTF--
-*** Testing get_defined_constants() : basic functionality ***
-string(5) "array"
-string(5) "array"
-array(0) {
-}
-TEST PASSED
+--TEST--
+Test get_defined_constants() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array get_defined_constants ([ bool $categorize ] )
+ * Description: Returns an associative array with the names of all the constants and their values
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_defined_constants() : basic functionality ***\n";
+
+var_dump(gettype(get_defined_constants(true)));
+var_dump(gettype(get_defined_constants()));
+
+$arr1 = get_defined_constants(false);
+$arr2 = get_defined_constants();
+var_dump(array_diff($arr1, $arr2));
+
+$n1 = count(get_defined_constants());
+define("USER_CONSTANT", "test");
+$arr2 = get_defined_constants();
+$n2 = count($arr2);
+
+if ($n2 == $n1 + 1 && array_key_exists("USER_CONSTANT", $arr2)) {
+ echo "TEST PASSED\n";
+} else {
+ echo "TEST FAILED\n";
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_defined_constants() : basic functionality ***
+string(5) "array"
+string(5) "array"
+array(0) {
+}
+TEST PASSED
===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt
index 4a8eceb24b..52b2136f5b 100644
--- a/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt
+++ b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt
@@ -1,23 +1,23 @@
---TEST--
-Test get_loaded_extensions() function : basic functionality
---FILE--
-<?php
-/* Prototype : array get_loaded_extensions ([ bool $zend_extensions= false ] )
- * Description: Returns an array with the names of all modules compiled and loaded
- * Source code: Zend/zend_builtin_functions.c
- */
-
-echo "*** Testing get_loaded_extensions() : basic functionality ***\n";
-
-echo "Get loaded extensions\n";
-var_dump(get_loaded_extensions());
-
-?>
-===DONE===
---EXPECTF--
-*** Testing get_loaded_extensions() : basic functionality ***
-Get loaded extensions
-array(%d) {
-%a
-}
+--TEST--
+Test get_loaded_extensions() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array get_loaded_extensions ([ bool $zend_extensions= false ] )
+ * Description: Returns an array with the names of all modules compiled and loaded
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_loaded_extensions() : basic functionality ***\n";
+
+echo "Get loaded extensions\n";
+var_dump(get_loaded_extensions());
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_loaded_extensions() : basic functionality ***
+Get loaded extensions
+array(%d) {
+%a
+}
===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/gettype_settype_basic.phpt b/ext/standard/tests/general_functions/gettype_settype_basic.phpt
index b2762fd83a..b082fbf5f5 100644
--- a/ext/standard/tests/general_functions/gettype_settype_basic.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_basic.phpt
@@ -740,11 +740,11 @@ string(5) "array"
-- Iteration 1 --
bool(true)
object(stdClass)#2 (3) {
- [0]=>
+ ["0"]=>
int(1)
- [1]=>
+ ["1"]=>
int(2)
- [2]=>
+ ["2"]=>
int(3)
}
string(6) "object"
@@ -758,11 +758,11 @@ string(6) "object"
-- Iteration 3 --
bool(true)
object(stdClass)#2 (3) {
- [0]=>
+ ["0"]=>
int(2)
- [1]=>
+ ["1"]=>
int(3)
- [2]=>
+ ["2"]=>
int(4)
}
string(6) "object"
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation7.phpt b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
index 437a966fd1..c4246b4204 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
@@ -531,7 +531,7 @@ string(6) "object"
string(5) "array"
bool(true)
object(stdClass)#4 (1) {
- [0]=>
+ ["0"]=>
NULL
}
string(6) "object"
@@ -539,13 +539,13 @@ string(6) "object"
string(5) "array"
bool(true)
object(stdClass)#4 (4) {
- [0]=>
+ ["0"]=>
int(1)
- [1]=>
+ ["1"]=>
int(2)
- [2]=>
+ ["2"]=>
int(3)
- [3]=>
+ ["3"]=>
int(4)
}
string(6) "object"
@@ -553,11 +553,11 @@ string(6) "object"
string(5) "array"
bool(true)
object(stdClass)#4 (4) {
- [1]=>
+ ["1"]=>
string(3) "one"
- [2]=>
+ ["2"]=>
string(3) "two"
- [3]=>
+ ["3"]=>
string(5) "three"
["four"]=>
int(4)
@@ -567,11 +567,11 @@ string(6) "object"
string(5) "array"
bool(true)
object(stdClass)#4 (3) {
- [0]=>
+ ["0"]=>
float(1.5)
- [1]=>
+ ["1"]=>
float(2.4)
- [2]=>
+ ["2"]=>
float(6500000)
}
string(6) "object"
diff --git a/ext/standard/tests/general_functions/import_request.phpt b/ext/standard/tests/general_functions/import_request.phpt
deleted file mode 100644
index 4a791c736a..0000000000
--- a/ext/standard/tests/general_functions/import_request.phpt
+++ /dev/null
@@ -1,76 +0,0 @@
---TEST--
-import_request_variables() tests
---SKIPIF--
-<?php if(PHP_VERSION_ID >= 50399){ die('skip not needed anymore without register_globals'); } ?>
---GET--
-a=1&b=heh&c=3&d[]=5&GLOBALS=test&1=hm
---POST--
-ap=25&bp=test&cp=blah3&dp[]=ar
---FILE--
-<?php
-
-var_dump(import_request_variables());
-var_dump(import_request_variables(""));
-var_dump(import_request_variables("", ""));
-
-var_dump(import_request_variables("g", ""));
-var_dump($a, $b, $c, $ap);
-
-var_dump(import_request_variables("g", "g_"));
-var_dump($g_a, $g_b, $g_c, $g_ap, $g_1);
-
-var_dump(import_request_variables("GP", "i_"));
-var_dump($i_a, $i_b, $i_c, $i_ap, $i_bp, $i_cp, $i_dp);
-
-var_dump(import_request_variables("gGg", "r_"));
-var_dump($r_a, $r_b, $r_c, $r_ap);
-
-echo "Done\n";
-?>
---EXPECTF--
-Warning: import_request_variables() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-bool(false)
-
-Notice: import_request_variables(): No prefix specified - possible security hazard in %s on line %d
-bool(false)
-
-Notice: import_request_variables(): No prefix specified - possible security hazard in %s on line %d
-
-Warning: import_request_variables(): Attempted GLOBALS variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Numeric key detected - possible security hazard in %s on line %d
-bool(true)
-
-Notice: Undefined variable: ap in %s on line %d
-string(1) "1"
-string(3) "heh"
-string(1) "3"
-NULL
-bool(true)
-
-Notice: Undefined variable: g_ap in %s on line %d
-string(1) "1"
-string(3) "heh"
-string(1) "3"
-NULL
-string(2) "hm"
-bool(true)
-string(1) "1"
-string(3) "heh"
-string(1) "3"
-string(2) "25"
-string(4) "test"
-string(5) "blah3"
-array(1) {
- [0]=>
- string(2) "ar"
-}
-bool(true)
-
-Notice: Undefined variable: r_ap in %s on line %d
-string(1) "1"
-string(3) "heh"
-string(1) "3"
-NULL
-Done
diff --git a/ext/standard/tests/general_functions/import_request1.phpt b/ext/standard/tests/general_functions/import_request1.phpt
deleted file mode 100644
index f592088afc..0000000000
--- a/ext/standard/tests/general_functions/import_request1.phpt
+++ /dev/null
@@ -1,101 +0,0 @@
---TEST--
-import_request_variables() test (overwrite super-globals)
---SKIPIF--
-<?php if(PHP_VERSION_ID >= 50399){ die('skip not needed anymore without register_globals'); } ?>
---GET--
-GET=0&POST=1&COOKIE=2&FILES=3&REQUEST=4
---POST--
-GET=5&POST=6&COOKIE=7&FILES=8&REQUEST=9
---COOKIE--
-GET=10;POST=11;COOKIE=12;FILES=13;REQUEST=14
---INI--
-variables_order=CGP
---FILE--
-<?php
-
-import_request_variables("gpc", "_");
-var_dump($_GET, $_POST, $_COOKIE, $_FILES, $_REQUEST);
-
-echo "Done\n";
-?>
---EXPECTF--
-Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d
-
-Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d
-array(5) {
- ["GET"]=>
- string(1) "0"
- ["POST"]=>
- string(1) "1"
- ["COOKIE"]=>
- string(1) "2"
- ["FILES"]=>
- string(1) "3"
- ["REQUEST"]=>
- string(1) "4"
-}
-array(5) {
- ["GET"]=>
- string(1) "5"
- ["POST"]=>
- string(1) "6"
- ["COOKIE"]=>
- string(1) "7"
- ["FILES"]=>
- string(1) "8"
- ["REQUEST"]=>
- string(1) "9"
-}
-array(5) {
- ["GET"]=>
- string(2) "10"
- ["POST"]=>
- string(2) "11"
- ["COOKIE"]=>
- string(2) "12"
- ["FILES"]=>
- string(2) "13"
- ["REQUEST"]=>
- string(2) "14"
-}
-array(0) {
-}
-array(5) {
- ["GET"]=>
- string(1) "5"
- ["POST"]=>
- string(1) "6"
- ["COOKIE"]=>
- string(1) "7"
- ["FILES"]=>
- string(1) "8"
- ["REQUEST"]=>
- string(1) "9"
-}
-Done
diff --git a/ext/standard/tests/general_functions/import_request2.phpt b/ext/standard/tests/general_functions/import_request2.phpt
deleted file mode 100644
index c290602b23..0000000000
--- a/ext/standard/tests/general_functions/import_request2.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-import_request_variables() test (numeric keys)
---SKIPIF--
-<?php if(PHP_VERSION_ID >= 50399){ die('skip not needed anymore without register_globals'); } ?>
---GET--
-1=0&2=1&3=2&4=3&5=4
---POST--
-1=5&2=6&3=7&4=8&5=9
---COOKIE--
-1=10;2=11;3=12;4=13;5=14
---INI--
-variables_order=CGP
---FILE--
-<?php
-
-import_request_variables("gpc", "_");
-var_dump($_1, $_2, $_3, $_4, $_5);
-
-echo "Done\n";
-?>
---EXPECTF--
-string(2) "10"
-string(2) "11"
-string(2) "12"
-string(2) "13"
-string(2) "14"
-Done
diff --git a/ext/standard/tests/general_functions/import_request3.phpt b/ext/standard/tests/general_functions/import_request3.phpt
deleted file mode 100644
index a8cbf565dd..0000000000
--- a/ext/standard/tests/general_functions/import_request3.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-import_request_variables() test (numeric keys, different order)
---SKIPIF--
-<?php if(PHP_VERSION_ID >= 50399){ die('skip not needed anymore without register_globals'); } ?>
---GET--
-1=0&2=1&3=2&4=3&5=4
---POST--
-1=5&2=6&3=7&4=8&5=9
---COOKIE--
-1=10;2=11;3=12;4=13;5=14
---INI--
-variables_order=CGP
---FILE--
-<?php
-
-import_request_variables("gcp", "_");
-var_dump($_1, $_2, $_3, $_4, $_5);
-
-echo "Done\n";
-?>
---EXPECTF--
-string(1) "5"
-string(1) "6"
-string(1) "7"
-string(1) "8"
-string(1) "9"
-Done
diff --git a/ext/standard/tests/general_functions/parse_ini_string_002.phpt b/ext/standard/tests/general_functions/parse_ini_string_002.phpt
index 733409c84b..98c9c0b359 100644
--- a/ext/standard/tests/general_functions/parse_ini_string_002.phpt
+++ b/ext/standard/tests/general_functions/parse_ini_string_002.phpt
@@ -93,8 +93,8 @@ bool(false)
Warning: parse_ini_string() expects at most 3 parameters, 4 given in %s
bool(false)
array(1) {
- [%u|b%"test"]=>
- %unicode|string%(0) ""
+ ["test"]=>
+ string(0) ""
}
Warning: syntax error, unexpected '='%sin Unknown on line 2
@@ -105,64 +105,64 @@ Warning: syntax error, unexpected '='%sin Unknown on line 2
in %s
bool(false)
array(1) {
- [%u|b%"test"]=>
- %unicode|string%(8) "new
+ ["test"]=>
+ string(8) "new
line"
}
array(1) {
- [%u|b%"test"]=>
- %unicode|string%(16) "test const value"
+ ["test"]=>
+ string(16) "test const value"
}
array(1) {
- [%u|b%"section"]=>
+ ["section"]=>
array(1) {
- [%u|b%"test"]=>
- %unicode|string%(5) "hello"
+ ["test"]=>
+ string(5) "hello"
}
}
array(1) {
- [%u|b%"test"]=>
- %unicode|string%(5) "hello"
+ ["test"]=>
+ string(5) "hello"
}
array(1) {
- [%u|b%"section.test"]=>
- %unicode|string%(5) "hello"
+ ["section.test"]=>
+ string(5) "hello"
}
array(1) {
- [%u|b%"section"]=>
+ ["section"]=>
array(1) {
- [%u|b%"section.test"]=>
- %unicode|string%(5) "hello"
+ ["section.test"]=>
+ string(5) "hello"
}
}
array(1) {
- [%u|b%"section"]=>
+ ["section"]=>
array(1) {
[1]=>
- %unicode|string%(1) "2"
+ string(1) "2"
}
}
array(1) {
[1]=>
- %unicode|string%(1) "2"
+ string(1) "2"
}
array(1) {
- [%u|b%"test"]=>
- %unicode|string%(5) "test4"
+ ["test"]=>
+ string(5) "test4"
}
array(1) {
- [%u|b%"section1"]=>
+ ["section1"]=>
array(1) {
- [%u|b%"name"]=>
- %unicode|string%(5) "value"
+ ["name"]=>
+ string(5) "value"
}
}
array(3) {
- [%u|b%"foo"]=>
- %unicode|string%(4) "bar1"
- [%u|b%"_foo"]=>
- %unicode|string%(4) "bar2"
- [%u|b%"foo_"]=>
- %unicode|string%(4) "bar3"
+ ["foo"]=>
+ string(4) "bar1"
+ ["_foo"]=>
+ string(4) "bar2"
+ ["foo_"]=>
+ string(4) "bar3"
}
Done
diff --git a/ext/standard/tests/general_functions/print_r.phpt b/ext/standard/tests/general_functions/print_r.phpt
index e5b630a839..e502f61291 100644
--- a/ext/standard/tests/general_functions/print_r.phpt
+++ b/ext/standard/tests/general_functions/print_r.phpt
@@ -1720,8 +1720,12 @@ Array
*** Testing print_r() on anonymous functions ***
+
+Deprecated: Function create_function() is deprecated in %s on line %d
New anonymous function:
-2 * 3 = 6
+2 * 3 = 6
+Deprecated: Function create_function() is deprecated in %s on line %d
+
*** Testing error conditions ***
diff --git a/ext/standard/tests/general_functions/print_r_64bit.phpt b/ext/standard/tests/general_functions/print_r_64bit.phpt
index 40f44ea1e4..3054e0a431 100644
--- a/ext/standard/tests/general_functions/print_r_64bit.phpt
+++ b/ext/standard/tests/general_functions/print_r_64bit.phpt
@@ -1721,8 +1721,12 @@ Array
*** Testing print_r() on anonymous functions ***
+
+Deprecated: Function create_function() is deprecated in %s on line %d
New anonymous function:
-2 * 3 = 6
+2 * 3 = 6
+Deprecated: Function create_function() is deprecated in %s on line %d
+
*** Testing error conditions ***
diff --git a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
new file mode 100644
index 0000000000..157ad74783
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
@@ -0,0 +1,94 @@
+--TEST--
+proc_nice() basic behaviour
+--SKIPIF--
+<?php
+/* No function_exists() check, proc_nice() is always available on Windows */
+
+if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
+ die('skip: Only for Windows');
+}
+
+if (PHP_SAPI != 'cli') {
+ die('skip: Only for CLI');
+}
+
+if (getenv('SKIP_SLOW_TESTS')) {
+ doe('skip: Slow test');
+}
+?>
+--FILE--
+<?php
+function get_priority_from_wmic() {
+ static $bin, $pid;
+
+ if (!$bin) {
+ $t = explode('\\', PHP_BINARY);
+
+ $bin = end($t);
+ $pid = getmypid();
+ }
+
+ $t = '';
+ $p = popen('wmic process where name="' . $bin . '"', 'r');
+
+ if (!$p) {
+ return false;
+ }
+
+ while(!feof($p)) {
+ $t .= fread($p, 1024);
+ }
+
+ pclose($p);
+
+ $t = explode(PHP_EOL, $t);
+
+ $f = false;
+ $m = [
+ strpos($t[0], ' ProcessId' ),
+ strpos($t[0], ' Priority ')
+ ];
+
+ foreach ($t as $n => $l) {
+ if (!$n || empty($l)) {
+ continue;
+ }
+
+ $d = [];
+
+ foreach ($m as $c) {
+ $d[] = (int) substr($l, $c + 1, strpos($l, ' ', $c + 2) - ($c + 1));
+ }
+
+ if ($d[0] === $pid) {
+ return $d[1];
+ }
+ }
+
+ return false;
+}
+
+$p = [
+ /* '<verbose name>' => ['<wmic value>', '<proc_nice value>'] */
+
+ 'Idle' => [4, 10],
+ 'Below normal' => [6, 5],
+ 'Normal' => [8, 0],
+ 'Above normal' => [10, -5],
+ 'High priority' => [13, -10]
+ ];
+
+foreach ($p as $test => $data) {
+ printf('Testing \'%s\' (%d): ', $test, $data[1]);
+
+ proc_nice($data[1]);
+
+ print (($wp = get_priority_from_wmic()) === $data[0] ? 'Passed' : 'Failed (' . $wp . ')') . PHP_EOL;
+}
+?>
+--EXPECTF--
+Testing 'Idle' (10): Passed
+Testing 'Below normal' (5): Passed
+Testing 'Normal' (0): Passed
+Testing 'Above normal' (-5): Passed
+Testing 'High priority' (-10): Passed
diff --git a/ext/standard/tests/general_functions/proc_nice_basic.phpt b/ext/standard/tests/general_functions/proc_nice_basic.phpt
index 83b5165679..12469bf4eb 100644
--- a/ext/standard/tests/general_functions/proc_nice_basic.phpt
+++ b/ext/standard/tests/general_functions/proc_nice_basic.phpt
@@ -8,6 +8,7 @@ Simone Gentili (sensorario@gmail.com)
--SKIPIF--
<?php
if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+if(substr(strtoupper(PHP_OS), 0, 3) == 'WIN') die('skip. not for Windows');
?>
--FILE--
<?php
diff --git a/ext/standard/tests/general_functions/type.phpt b/ext/standard/tests/general_functions/type.phpt
index eb6f0672fe..ac29a1bf38 100644
--- a/ext/standard/tests/general_functions/type.phpt
+++ b/ext/standard/tests/general_functions/type.phpt
@@ -63,7 +63,7 @@ string(6) "double"
string(4) "NULL"
string(7) "boolean"
string(6) "string"
-string(12) "unknown type"
+string(17) "resource (closed)"
string(8) "resource"
string(6) "object"
bool(true)
@@ -265,11 +265,11 @@ array(0) {
}
bool(true)
object(stdClass)#%d (3) {
- [0]=>
+ ["0"]=>
int(1)
- [1]=>
+ ["1"]=>
int(2)
- [2]=>
+ ["2"]=>
int(3)
}
bool(true)
@@ -279,11 +279,11 @@ object(stdClass)#%d (1) {
}
bool(true)
object(stdClass)#%d (3) {
- [0]=>
+ ["0"]=>
int(2)
- [1]=>
+ ["1"]=>
int(3)
- [2]=>
+ ["2"]=>
int(4)
}
bool(true)
diff --git a/ext/standard/tests/general_functions/uniqid_error.phpt b/ext/standard/tests/general_functions/uniqid_error.phpt
index 96084313c7..8f7f22d7d3 100644
--- a/ext/standard/tests/general_functions/uniqid_error.phpt
+++ b/ext/standard/tests/general_functions/uniqid_error.phpt
@@ -1,46 +1,46 @@
---TEST--
-Test uniqid() function : error conditions
---FILE--
-<?php
-/* Prototype : string uniqid ([ string $prefix= "" [, bool $more_entropy= false ]] )
- * Description: Gets a prefixed unique identifier based on the current time in microseconds.
- * Source code: ext/standard/uniqid.c
-*/
-echo "*** Testing uniqid() : error conditions ***\n";
-
-echo "\n-- Testing uniqid() function with more than expected no. of arguments --\n";
-$prefix = null;
-$more_entropy = false;
-$extra_arg = false;
-var_dump(uniqid($prefix, $more_entropy, $extra_arg));
-
-echo "\n-- Testing uniqid() function with invalid values for \$prefix --\n";
-class class1{}
-$obj = new class1();
-$res = fopen(__FILE__, "r");
-$array = array(1,2,3);
-
-uniqid($array, false);
-uniqid($res, false);
-uniqid($obj, false);
-
-fclose($res);
-
-?>
-===DONE===
---EXPECTF--
-*** Testing uniqid() : error conditions ***
-
--- Testing uniqid() function with more than expected no. of arguments --
-
-Warning: uniqid() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
--- Testing uniqid() function with invalid values for $prefix --
-
-Warning: uniqid() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: uniqid() expects parameter 1 to be string, resource given in %s on line %d
-
-Warning: uniqid() expects parameter 1 to be string, object given in %s on line %d
+--TEST--
+Test uniqid() function : error conditions
+--FILE--
+<?php
+/* Prototype : string uniqid ([ string $prefix= "" [, bool $more_entropy= false ]] )
+ * Description: Gets a prefixed unique identifier based on the current time in microseconds.
+ * Source code: ext/standard/uniqid.c
+*/
+echo "*** Testing uniqid() : error conditions ***\n";
+
+echo "\n-- Testing uniqid() function with more than expected no. of arguments --\n";
+$prefix = null;
+$more_entropy = false;
+$extra_arg = false;
+var_dump(uniqid($prefix, $more_entropy, $extra_arg));
+
+echo "\n-- Testing uniqid() function with invalid values for \$prefix --\n";
+class class1{}
+$obj = new class1();
+$res = fopen(__FILE__, "r");
+$array = array(1,2,3);
+
+uniqid($array, false);
+uniqid($res, false);
+uniqid($obj, false);
+
+fclose($res);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing uniqid() : error conditions ***
+
+-- Testing uniqid() function with more than expected no. of arguments --
+
+Warning: uniqid() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing uniqid() function with invalid values for $prefix --
+
+Warning: uniqid() expects parameter 1 to be string, array given in %s on line %d
+
+Warning: uniqid() expects parameter 1 to be string, resource given in %s on line %d
+
+Warning: uniqid() expects parameter 1 to be string, object given in %s on line %d
===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/var_dump.phpt b/ext/standard/tests/general_functions/var_dump.phpt
index 9821e95eaa..78c862b77d 100644
--- a/ext/standard/tests/general_functions/var_dump.phpt
+++ b/ext/standard/tests/general_functions/var_dump.phpt
@@ -1563,8 +1563,12 @@ array(6) {
}
*** Testing var_dump() on anonymous functions ***
+
+Deprecated: Function create_function() is deprecated in %s on line %d
New anonymous function:
string(9) "2 * 3 = 6"
+
+Deprecated: Function create_function() is deprecated in %s on line %d
string(9) "
*** Testing error conditions ***
diff --git a/ext/standard/tests/general_functions/var_dump_64bit.phpt b/ext/standard/tests/general_functions/var_dump_64bit.phpt
index 6bbbb3f51d..3b8212204a 100644
--- a/ext/standard/tests/general_functions/var_dump_64bit.phpt
+++ b/ext/standard/tests/general_functions/var_dump_64bit.phpt
@@ -1563,8 +1563,12 @@ array(6) {
}
*** Testing var_dump() on anonymous functions ***
+
+Deprecated: Function create_function() is deprecated in %s on line %d
New anonymous function:
string(9) "2 * 3 = 6"
+
+Deprecated: Function create_function() is deprecated in %s on line %d
string(9) "
*** Testing error conditions ***
diff --git a/ext/standard/tests/http/bug69337.phpt b/ext/standard/tests/http/bug69337.phpt
index 1451d4bf01..ee9016e7bb 100644
--- a/ext/standard/tests/http/bug69337.phpt
+++ b/ext/standard/tests/http/bug69337.phpt
@@ -35,7 +35,6 @@ var_dump($f);
?>
==DONE==
--EXPECTF--
-string(26) "HTTP/1.0 404 Not Found
-
-"
-==DONE== \ No newline at end of file
+Warning: file_get_contents(http://127.0.0.1:22345/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found%ain %s on line %d
+bool(false)
+==DONE==
diff --git a/ext/standard/tests/http/server.inc b/ext/standard/tests/http/server.inc
index b9ade0e9f0..db66c3dd13 100644
--- a/ext/standard/tests/http/server.inc
+++ b/ext/standard/tests/http/server.inc
@@ -54,13 +54,13 @@ function http_server($socket_string, array $files, &$output = null) {
if (!stream_select($r, $w, $e, 1)) continue;
$line = stream_get_line($sock, 8192, "\r\n");
- if ($line === b'') {
- fwrite($output, b"\r\n");
+ if ($line === '') {
+ fwrite($output, "\r\n");
break;
} else if ($line !== false) {
- fwrite($output, b"$line\r\n");
+ fwrite($output, "$line\r\n");
- if (preg_match(b'#^Content-Length\s*:\s*([[:digit:]]+)\s*$#i', $line, $matches)) {
+ if (preg_match('#^Content-Length\s*:\s*([[:digit:]]+)\s*$#i', $line, $matches)) {
$content_length = (int) $matches[1];
}
}
diff --git a/ext/standard/tests/mail/bug73203.phpt b/ext/standard/tests/mail/bug73203.phpt
index 6b3bf6618c..79615f31b5 100644
--- a/ext/standard/tests/mail/bug73203.phpt
+++ b/ext/standard/tests/mail/bug73203.phpt
@@ -1,24 +1,24 @@
---TEST--
-Bug #73203 (passing additional_parameters causes mail to fail)
---DESCRIPTION--
-We're not really interested in testing mail() here, but it is currently the
-only function besides mb_send_mail() which allows to call php_escape_shell_cmd()
-with an empty string. Therefore we don't check the resulting email, but only
-verify that the call succeeds.
---INI--
-sendmail_path=cat >/dev/null
-mail.add_x_header = Off
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) === 'WIN') die('skip won\'t run on Windows');
-?>
---FILE--
-<?php
-var_dump(
- mail('test@example.com', 'subject', 'message', 'From: lala@example.com', '')
-);
-?>
-===DONE===
---EXPECT--
-bool(true)
-===DONE===
+--TEST--
+Bug #73203 (passing additional_parameters causes mail to fail)
+--DESCRIPTION--
+We're not really interested in testing mail() here, but it is currently the
+only function besides mb_send_mail() which allows to call php_escape_shell_cmd()
+with an empty string. Therefore we don't check the resulting email, but only
+verify that the call succeeds.
+--INI--
+sendmail_path=cat >/dev/null
+mail.add_x_header = Off
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) === 'WIN') die('skip won\'t run on Windows');
+?>
+--FILE--
+<?php
+var_dump(
+ mail('test@example.com', 'subject', 'message', 'From: lala@example.com', '')
+);
+?>
+===DONE===
+--EXPECT--
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/mail/ezmlm_hash_basic.phpt b/ext/standard/tests/mail/ezmlm_hash_basic.phpt
index ce70eace23..2f810e2562 100644
--- a/ext/standard/tests/mail/ezmlm_hash_basic.phpt
+++ b/ext/standard/tests/mail/ezmlm_hash_basic.phpt
@@ -13,8 +13,8 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
echo "*** Testing ezmlm_hash() : basic functionality ***\n";
-var_dump(ezmlm_hash(b"webmaster@somewhere.com"));
-var_dump(ezmlm_hash(b"foo@somewhere.com"));
+var_dump(ezmlm_hash("webmaster@somewhere.com"));
+var_dump(ezmlm_hash("foo@somewhere.com"));
?>
===Done===
diff --git a/ext/standard/tests/mail/ezmlm_hash_basic_64bit.phpt b/ext/standard/tests/mail/ezmlm_hash_basic_64bit.phpt
index 03ac67b9b4..46abdba7c8 100644
--- a/ext/standard/tests/mail/ezmlm_hash_basic_64bit.phpt
+++ b/ext/standard/tests/mail/ezmlm_hash_basic_64bit.phpt
@@ -13,8 +13,8 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
echo "*** Testing ezmlm_hash() : basic functionality ***\n";
-var_dump(ezmlm_hash(b"webmaster@somewhere.com"));
-var_dump(ezmlm_hash(b"foo@somewhere.com"));
+var_dump(ezmlm_hash("webmaster@somewhere.com"));
+var_dump(ezmlm_hash("foo@somewhere.com"));
?>
===Done===
diff --git a/ext/standard/tests/mail/mail_basic7.phpt b/ext/standard/tests/mail/mail_basic7.phpt
new file mode 100644
index 0000000000..3b389d2c4e
--- /dev/null
+++ b/ext/standard/tests/mail/mail_basic7.phpt
@@ -0,0 +1,218 @@
+--TEST--
+Test mail() function : array extra header basic functionality
+--INI--
+sendmail_path=tee mailBasic.out >/dev/null
+mail.add_x_header = Off
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Won't run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, mixed additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+error_reporting(-1);
+
+echo "*** Testing mail() : basic functionality ***\n";
+
+echo "\n\n************* TEST ******************\n";
+// Should pass
+// Initialise all required variables
+$to = 'user@example.com';
+$subject = 'Test Subject';
+$message = 'A Message';
+$additional_headers = array(
+ 'KHeaders' => 'aaaa',
+ 'bcc'=>'foo@bar',
+ 'foo'=>
+ array(
+ "bar\r\n hoge",
+ "bar\r\n\t fuga",
+ ),
+);
+$outFile = "mailBasic.out";
+@unlink($outFile);
+
+echo "-- All Mail Content Parameters --\n";
+// Calling mail() with all additional headers
+var_dump( mail($to, $subject, $message, $additional_headers) );
+echo file_get_contents($outFile);
+unlink($outFile);
+
+
+echo "\n\n************* TEST ******************\n";
+// Should fail all
+// Initialise all required variables
+$to = 'user@example.com';
+$subject = 'Test Subject';
+$message = 'A Message';
+// Headers should not have array values
+$additional_headers = array(
+ 'orig-date' => array('foo1'),
+ 'from' => array('foo2'),
+ 'sender' => array('foo3'),
+ 'reply-to' => array('foo4'),
+ 'to' => array('foo5'),
+ 'bcc' => array('foo6'),
+ 'message-id' => array('foo7'),
+ 'in-reply-to'=> array('foo8'),
+);
+$outFile = "mailBasic.out";
+@unlink($outFile);
+
+echo "-- All Mail Content Parameters --\n";
+// Calling mail() with all additional headers
+var_dump( mail($to, $subject, $message, $additional_headers) );
+echo file_get_contents($outFile);
+unlink($outFile);
+
+
+echo "\n\n************* TEST ******************\n";
+// Should fail all
+// Initialise all required variables
+$to = 'user@example.com';
+$subject = 'Test Subject';
+$message = 'A Message';
+$additional_headers = array(
+ 'foo1' => array('foo1'=>'bar1'),
+ 'foo2' => array('foo2', array('foo3')),
+ 'foo3' => array(123),
+ 'foo4' => array(123.456),
+ 'foo5' => array(FALSE),
+ 'foo6' => array(NULL),
+ 'foo7' => array(new StdClass),
+);
+$outFile = "mailBasic.out";
+@unlink($outFile);
+
+echo "-- All Mail Content Parameters --\n";
+// Calling mail() with all additional headers
+var_dump( mail($to, $subject, $message, $additional_headers) );
+echo file_get_contents($outFile);
+unlink($outFile);
+
+
+echo "\n\n************* TEST ******************\n";
+// Should fail most
+// Initialise all required variables
+$to = 'user@example.com';
+$subject = 'Test Subject';
+$message = 'A Message';
+$additional_headers = array(
+ '*:foo1' => array('bar1'),
+ 'foo2:::' => array('bar1'),
+ 'foo3()' => array('bar1'),
+ 'foo4@' => array('bar1'),
+ 'foo5|' => array('bar1'),
+ "\0foo6" => array('bar1'),
+ "foo7\0" => array('bar1'),
+ "foo8" => array(),
+ "foo9" => '%&$#!',
+ "foo10" => "abc\0\tdef",
+);
+$outFile = "mailBasic.out";
+@unlink($outFile);
+
+echo "-- All Mail Content Parameters --\n";
+// Calling mail() with all additional headers
+var_dump( mail($to, $subject, $message, $additional_headers) );
+echo file_get_contents($outFile);
+unlink($outFile);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mail() : basic functionality ***
+
+
+************* TEST ******************
+-- All Mail Content Parameters --
+bool(true)
+To: user@example.com
+Subject: Test Subject
+KHeaders: aaaa
+bcc: foo@bar
+foo: bar
+ hoge
+foo: bar
+ fuga
+
+A Message
+
+
+************* TEST ******************
+-- All Mail Content Parameters --
+
+Warning: mail(): 'orig-date' header must be at most one header. Array is passed for 'orig-date' in %s on line 59
+
+Warning: mail(): 'from' header must be at most one header. Array is passed for 'from' in %s on line 59
+
+Warning: mail(): 'sender' header must be at most one header. Array is passed for 'sender' in %s on line 59
+
+Warning: mail(): 'reply-to' header must be at most one header. Array is passed for 'reply-to' in %s on line 59
+
+Warning: mail(): Extra header cannot contain 'To' header in %s on line 59
+
+Warning: mail(): 'bcc' header must be at most one header. Array is passed for 'bcc' in %s on line 59
+
+Warning: mail(): 'message-id' header must be at most one header. Array is passed for 'message-id' in %s on line 59
+
+Warning: mail(): 'in-reply-to' header must be at most one header. Array is passed for 'in-reply-to' in %s on line 59
+bool(true)
+To: user@example.com
+Subject: Test Subject
+
+A Message
+
+
+************* TEST ******************
+-- All Mail Content Parameters --
+
+Warning: mail(): Multiple header key must be numeric index (foo1) in %s on line 84
+
+Warning: mail(): Multiple header values must be string (foo2) in %s on line 84
+
+Warning: mail(): Multiple header values must be string (foo3) in %s on line 84
+
+Warning: mail(): Multiple header values must be string (foo4) in %s on line 84
+
+Warning: mail(): Multiple header values must be string (foo5) in %s on line 84
+
+Warning: mail(): Multiple header values must be string (foo6) in %s on line 84
+
+Warning: mail(): Multiple header values must be string (foo7) in %s on line 84
+bool(true)
+To: user@example.com
+Subject: Test Subject
+foo2: foo2
+
+A Message
+
+
+************* TEST ******************
+-- All Mail Content Parameters --
+
+Warning: mail(): Header field name (*:foo1) contains invalid chars in %s on line 112
+
+Warning: mail(): Header field name (foo2:::) contains invalid chars in %s on line 112
+
+Warning: mail(): Header field name () contains invalid chars in %s on line 112
+
+Warning: mail(): Header field name (foo7) contains invalid chars in %s on line 112
+
+Warning: mail(): Header field value (foo10 => abc) contains invalid chars or format in %s on line 112
+bool(true)
+To: user@example.com
+Subject: Test Subject
+foo3(): bar1
+foo4@: bar1
+foo5|: bar1
+foo9: %&$#!
+
+A Message
+===DONE===
diff --git a/ext/standard/tests/math/bug75170.phpt b/ext/standard/tests/math/bug75170.phpt
new file mode 100644
index 0000000000..a9aab06ef4
--- /dev/null
+++ b/ext/standard/tests/math/bug75170.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #75170: mt_rand() bias on 64-bit machines
+--CREDITS--
+Solar Designer in https://externals.io/message/100229
+--FILE--
+<?php
+
+// PHP pre-7.1.0 modulo bias
+mt_srand(1234567890);
+$total = 10000;
+$max = 0x66666666;
+$halves[0] = $halves[1] = 0;
+for ($i = 0; $i < $total; $i++) {
+ $halves[(mt_rand(0, $max - 1) >> 1) & 1]++;
+}
+printf("%.1f%% vs. %.1f%%\n", 100. * $halves[0] / $total, 100. * $halves[1] / $total);
+
+// PHP 7.1.0 to 7.2.0beta2 modulo bias bug found during work
+// on http://www.openwall.com/php_mt_seed/
+mt_srand(1234567890);
+$total = 10000;
+$max = 0x66666666;
+$halves[0] = $halves[1] = 0;
+for ($i = 0; $i < $total; $i++) {
+ $halves[mt_rand(0, $max - 1) / ($max / 2)]++;
+}
+printf("%.1f%% vs. %.1f%%\n", 100. * $halves[0] / $total, 100. * $halves[1] / $total);
+
+?>
+--EXPECT--
+49.5% vs. 50.5%
+50.5% vs. 49.5%
diff --git a/ext/standard/tests/math/number_format_negative_zero.phpt b/ext/standard/tests/math/number_format_negative_zero.phpt
new file mode 100644
index 0000000000..743a5350e2
--- /dev/null
+++ b/ext/standard/tests/math/number_format_negative_zero.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Prevent number_format from returning negative zero
+--FILE--
+<?php
+
+$number = -1.15E-15;
+
+var_dump($number);
+var_dump(number_format($number, 2));
+var_dump(number_format(-0.01, 2));
+
+?>
+--EXPECT--
+float(-1.15E-15)
+string(4) "0.00"
+string(5) "-0.01"
diff --git a/ext/standard/tests/misc/time_nanosleep_error1.phpt b/ext/standard/tests/misc/time_nanosleep_error1.phpt
index 0408396eea..3bbd330e2c 100644
--- a/ext/standard/tests/misc/time_nanosleep_error1.phpt
+++ b/ext/standard/tests/misc/time_nanosleep_error1.phpt
@@ -11,4 +11,4 @@ $nano = time_nanosleep('A', 100000);
?>
--EXPECTF--
-Warning: time_nanosleep() expects parameter 1 to be integer, %unicode_string_optional% given in %s.php on line %d
+Warning: time_nanosleep() expects parameter 1 to be integer, string given in %s.php on line %d
diff --git a/ext/standard/tests/misc/time_nanosleep_error2.phpt b/ext/standard/tests/misc/time_nanosleep_error2.phpt
index 3e8f9349e8..72d84c42b6 100644
--- a/ext/standard/tests/misc/time_nanosleep_error2.phpt
+++ b/ext/standard/tests/misc/time_nanosleep_error2.phpt
@@ -11,4 +11,4 @@ $nano = time_nanosleep(2, 'B');
?>
--EXPECTF--
-Warning: time_nanosleep() expects parameter 2 to be integer, %unicode_string_optional% given in %s.php on line %d
+Warning: time_nanosleep() expects parameter 2 to be integer, string given in %s.php on line %d
diff --git a/ext/standard/tests/network/bug20134.phpt b/ext/standard/tests/network/bug20134.phpt
index 400e3fb15c..e311f892f7 100644
--- a/ext/standard/tests/network/bug20134.phpt
+++ b/ext/standard/tests/network/bug20134.phpt
@@ -11,7 +11,7 @@ if (!$fp) {
}
else {
/* Likewise, writes will always appear to succeed */
- $x = fwrite($fp,b"\n");
+ $x = fwrite($fp,"\n");
var_dump($x);
/* But reads should always fail */
$content = fread($fp, 40);
diff --git a/ext/standard/tests/network/closelog_error.phpt b/ext/standard/tests/network/closelog_error.phpt
index ad3fdf557d..442f9a6249 100644
--- a/ext/standard/tests/network/closelog_error.phpt
+++ b/ext/standard/tests/network/closelog_error.phpt
@@ -12,7 +12,7 @@ echo "*** Testing closelog() : error conditions ***\n";
// One argument
echo "\n-- Testing closelog() function with one argument --\n";
-$extra_arg = 10;;
+$extra_arg = 10;
var_dump( closelog($extra_arg) );
?>
diff --git a/ext/standard/tests/network/dns_get_mx.phpt b/ext/standard/tests/network/dns_get_mx.phpt
deleted file mode 100644
index c5bf361b12..0000000000
--- a/ext/standard/tests/network/dns_get_mx.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-bool dns_get_mx ( string $hostname , array &$mxhosts [, array &$weight ] );
---CREDITS--
-marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
---SKIPIF--
-<?php
-if (getenv("SKIP_SLOW_TESTS"))
- die("skip slow test");
-if (getenv("SKIP_ONLINE_TESTS"))
- die("skip test requiring internet connection");
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip: no Windows support');
-}
-?>
---FILE--
-<?php
-$domains = array('yahoo.co.jp', 'yahoo.com', 'es.yahoo.com', 'fr.yahoo.com', 'it.yahoo.com');
-foreach ($domains as $domain) {
- if (getmxrr($domain, $hosts, $weights)) {
- echo "Hosts: " . count($hosts) . ", weights: " . count($weights) . "\n";
- }
-}
-?>
---EXPECTF--
-Hosts: %i, weights: %i
-Hosts: %i, weights: %i
-Hosts: %i, weights: %i
-Hosts: %i, weights: %i
-Hosts: %i, weights: %i
diff --git a/ext/standard/tests/network/gethostbyname_basic003.phpt b/ext/standard/tests/network/gethostbyname_basic003.phpt
index 711490c413..2cb3d8d229 100644
--- a/ext/standard/tests/network/gethostbyname_basic003.phpt
+++ b/ext/standard/tests/network/gethostbyname_basic003.phpt
@@ -1,18 +1,18 @@
---TEST--
-Test gethostbyname() function : basic functionality
---FILE--
-<?php
-/* Prototype : string gethostbyname ( string $hostname )
- * Description: Get the IPv4 address corresponding to a given Internet host name
- * Source code: ext/standard/dns.c
-*/
-
-echo "*** Testing gethostbyname() : basic functionality ***\n";
-
-echo gethostbyname("localhost")."\n";
-?>
-===DONE===
---EXPECT--
-*** Testing gethostbyname() : basic functionality ***
-127.0.0.1
+--TEST--
+Test gethostbyname() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string gethostbyname ( string $hostname )
+ * Description: Get the IPv4 address corresponding to a given Internet host name
+ * Source code: ext/standard/dns.c
+*/
+
+echo "*** Testing gethostbyname() : basic functionality ***\n";
+
+echo gethostbyname("localhost")."\n";
+?>
+===DONE===
+--EXPECT--
+*** Testing gethostbyname() : basic functionality ***
+127.0.0.1
===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/network/gethostbynamel_basic1.phpt b/ext/standard/tests/network/gethostbynamel_basic1.phpt
index 5ce7c4251a..9d1580c826 100644
--- a/ext/standard/tests/network/gethostbynamel_basic1.phpt
+++ b/ext/standard/tests/network/gethostbynamel_basic1.phpt
@@ -1,19 +1,19 @@
---TEST--
-Test gethostbynamel() function : basic functionality
---FILE--
-<?php
-/* Prototype : array gethostbynamel ( string $hostname )
- * Description: Get a list of IPv4 addresses corresponding to a given Internet host name
- * Source code: ext/standard/dns.c
-*/
-
-echo "*** Testing gethostbynamel() : basic functionality ***\n";
-var_dump(gethostbynamel("localhost"));
-?>
-===DONE===
---EXPECTF--
-*** Testing gethostbynamel() : basic functionality ***
-array(%d) {
- %a
-}
+--TEST--
+Test gethostbynamel() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array gethostbynamel ( string $hostname )
+ * Description: Get a list of IPv4 addresses corresponding to a given Internet host name
+ * Source code: ext/standard/dns.c
+*/
+
+echo "*** Testing gethostbynamel() : basic functionality ***\n";
+var_dump(gethostbynamel("localhost"));
+?>
+===DONE===
+--EXPECTF--
+*** Testing gethostbynamel() : basic functionality ***
+array(%d) {
+ %a
+}
===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/network/inet.phpt b/ext/standard/tests/network/inet.phpt
index 851e1ba6c5..10b4dad0a6 100644
--- a/ext/standard/tests/network/inet.phpt
+++ b/ext/standard/tests/network/inet.phpt
@@ -9,26 +9,26 @@ if (!function_exists("inet_pton")) die("skip no inet_pton()");
<?php
$packed = chr(127) . chr(0) . chr(0) . chr(1);
-var_dump(inet_ntop((binary)$packed));
+var_dump(inet_ntop($packed));
$packed = chr(255) . chr(255) . chr(255) . chr(0);
-var_dump(inet_ntop((binary)$packed));
+var_dump(inet_ntop($packed));
var_dump(inet_ntop());
var_dump(inet_ntop(-1));
-var_dump(inet_ntop(b""));
-var_dump(inet_ntop(b"blah-blah"));
+var_dump(inet_ntop(""));
+var_dump(inet_ntop("blah-blah"));
var_dump(inet_pton());
-var_dump(inet_pton(b""));
+var_dump(inet_pton(""));
var_dump(inet_pton(-1));
-var_dump(inet_pton(b"abra"));
+var_dump(inet_pton("abra"));
$array = array(
- b"127.0.0.1",
- b"66.163.161.116",
- b"255.255.255.255",
- b"0.0.0.0",
+ "127.0.0.1",
+ "66.163.161.116",
+ "255.255.255.255",
+ "0.0.0.0",
);
foreach ($array as $val) {
var_dump(bin2hex($packed = inet_pton($val)));
@@ -38,8 +38,8 @@ foreach ($array as $val) {
echo "Done\n";
?>
--EXPECTF--
-%unicode|string%(9) "127.0.0.1"
-%unicode|string%(13) "255.255.255.0"
+string(9) "127.0.0.1"
+string(13) "255.255.255.0"
Warning: inet_ntop() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
@@ -64,12 +64,12 @@ bool(false)
Warning: inet_pton(): Unrecognized address abra in %s on line %d
bool(false)
-%unicode|string%(%d) "7f000001"
-%unicode|string%(9) "127.0.0.1"
-%unicode|string%(%d) "42a3a174"
-%unicode|string%(14) "66.163.161.116"
-%unicode|string%(%d) "ffffffff"
-%unicode|string%(15) "255.255.255.255"
-%unicode|string%(%d) "00000000"
-%unicode|string%(7) "0.0.0.0"
+string(%d) "7f000001"
+string(9) "127.0.0.1"
+string(%d) "42a3a174"
+string(14) "66.163.161.116"
+string(%d) "ffffffff"
+string(15) "255.255.255.255"
+string(%d) "00000000"
+string(7) "0.0.0.0"
Done
diff --git a/ext/standard/tests/password/bug75221.phpt b/ext/standard/tests/password/bug75221.phpt
new file mode 100644
index 0000000000..ec03f92ea6
--- /dev/null
+++ b/ext/standard/tests/password/bug75221.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #75221 (Argon2i always throws NUL at the end)
+--SKIPIF--
+<?php
+if (!defined('PASSWORD_ARGON2I')) die('skip password_hash not built with Argon2');
+?>
+--FILE--
+<?php
+$hash = password_hash(
+ "php",
+ PASSWORD_ARGON2I,
+ ['memory_cost' => 16384, 'time_cost' => 2, 'threads' => 4]
+);
+var_dump(substr($hash, -1, 1) !== "\0");
+?>
+===DONE===
+--EXPECT--
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/password/password_get_info_argon2.phpt b/ext/standard/tests/password/password_get_info_argon2.phpt
new file mode 100644
index 0000000000..0c9080f0a9
--- /dev/null
+++ b/ext/standard/tests/password/password_get_info_argon2.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test normal operation of password_get_info() with Argon2
+--SKIPIF--
+<?php
+if (!defined('PASSWORD_ARGON2I')) die('skip password_get_info not built with Argon2');
+?>
+--FILE--
+<?php
+
+var_dump(password_get_info('$argon2i$v=19$m=65536,t=3,p=1$SWhIcG5MT21Pc01PbWdVZw$WagZELICsz7jlqOR2YzoEVTWb2oOX1tYdnhZYXxptbU'));
+echo "OK!";
+?>
+--EXPECT--
+array(3) {
+ ["algo"]=>
+ int(2)
+ ["algoName"]=>
+ string(7) "argon2i"
+ ["options"]=>
+ array(3) {
+ ["memory_cost"]=>
+ int(65536)
+ ["time_cost"]=>
+ int(3)
+ ["threads"]=>
+ int(1)
+ }
+}
+OK! \ No newline at end of file
diff --git a/ext/standard/tests/password/password_hash_argon2.phpt b/ext/standard/tests/password/password_hash_argon2.phpt
new file mode 100644
index 0000000000..29f7f28a95
--- /dev/null
+++ b/ext/standard/tests/password/password_hash_argon2.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test normal operation of password_hash() with argon2
+--SKIPIF--
+<?php
+if (!defined('PASSWORD_ARGON2I')) die('skip password_hash not built with Argon2');
+--FILE--
+<?php
+
+$password = "the password for testing 12345!";
+
+$hash = password_hash($password, PASSWORD_ARGON2I);
+var_dump(password_verify($password, $hash));
+
+echo "OK!";
+?>
+--EXPECT--
+bool(true)
+OK! \ No newline at end of file
diff --git a/ext/standard/tests/password/password_hash_error_argon2.phpt b/ext/standard/tests/password/password_hash_error_argon2.phpt
new file mode 100644
index 0000000000..92c71e064b
--- /dev/null
+++ b/ext/standard/tests/password/password_hash_error_argon2.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test error operation of password_hash() with argon2
+--SKIPIF--
+<?php
+if (!defined('PASSWORD_ARGON2I')) die('skip password_hash not built with Argon2');
+?>
+--FILE--
+<?php
+var_dump(password_hash('test', PASSWORD_ARGON2I, ['memory_cost' => 0]));
+var_dump(password_hash('test', PASSWORD_ARGON2I, ['time_cost' => 0]));
+var_dump(password_hash('test', PASSWORD_ARGON2I, ['threads' => 0]));
+?>
+--EXPECTF--
+Warning: password_hash(): Memory cost is outside of allowed memory range in %s on line %d
+NULL
+
+Warning: password_hash(): Time cost is outside of allowed time range in %s on line %d
+NULL
+
+Warning: password_hash(): Invalid number of threads in %s on line %d
+NULL \ No newline at end of file
diff --git a/ext/standard/tests/password/password_needs_rehash_argon2.phpt b/ext/standard/tests/password/password_needs_rehash_argon2.phpt
new file mode 100644
index 0000000000..0b5fede1e3
--- /dev/null
+++ b/ext/standard/tests/password/password_needs_rehash_argon2.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test normal operation of password_needs_rehash() with argon2
+--SKIPIF--
+<?php
+if (!defined('PASSWORD_ARGON2I')) die('skip password_needs_rehash not built with Argon2');
+?>
+--FILE--
+<?php
+
+$hash = password_hash('test', PASSWORD_ARGON2I);
+var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I));
+var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I, ['memory_cost' => 1<<17]));
+var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I, ['time_cost' => 4]));
+var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I, ['threads' => 4]));
+echo "OK!";
+?>
+--EXPECT--
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+OK!
diff --git a/ext/standard/tests/password/password_verify_argon2.phpt b/ext/standard/tests/password/password_verify_argon2.phpt
new file mode 100644
index 0000000000..986f5e7005
--- /dev/null
+++ b/ext/standard/tests/password/password_verify_argon2.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test normal operation of password_verify() with argon2
+--SKIPIF--
+<?php
+if (!defined('PASSWORD_ARGON2I')) die('skip password_verify not built with Argon2');
+?>
+--FILE--
+<?php
+
+var_dump(password_verify('test', '$argon2i$v=19$m=65536,t=3,p=1$OEVjWWs2Z3YvWlNZQ0ZmNw$JKin7ahjmh8JYvMyFcXri0Ss/Uvd3uYpD7MG6C/5Cy0'));
+
+var_dump(password_verify('argon2', '$argon2i$v=19$m=65536,t=3,p=1$OEVjWWs2Z3YvWlNZQ0ZmNw$JKin7ahjmh8JYvMyFcXri0Ss/Uvd3uYpD7MG6C/5Cy0'));
+echo "OK!";
+?>
+--EXPECT--
+bool(true)
+bool(false)
+OK! \ No newline at end of file
diff --git a/ext/standard/tests/serialize/005.phpt b/ext/standard/tests/serialize/005.phpt
index 2df270154d..1702a44f51 100644
--- a/ext/standard/tests/serialize/005.phpt
+++ b/ext/standard/tests/serialize/005.phpt
@@ -31,12 +31,11 @@ function unserializer($class_name)
eval("class TestNANew2 extends TestNew {}");
break;
default:
- echo "Try __autoload()\n";
- if (!function_exists('__autoload'))
- {
- eval('function __autoload($class_name) { do_autoload($class_name); }');
+ echo "Try autoloader\n";
+ if (!spl_autoload_functions()) {
+ spl_autoload_register(function ($class_name) { do_autoload($class_name); });
}
- __autoload($class_name);
+ spl_autoload_call($class_name);
break;
}
}
@@ -123,7 +122,7 @@ var_dump(unserialize('C:10:"TestNANew2":0:{}'));
echo "===AutoOld===\n";
var_dump(unserialize('O:19:"autoload_implements":0:{}'));
-// Now we have __autoload(), that will be called before the old style header.
+// Now we have an autoloader, that will be called before the old style header.
// If the old style handler also fails to register the class then the object
// becomes an incomplete class instance.
@@ -168,7 +167,7 @@ object(TestNANew2)#%d (0) {
}
===AutoOld===
unserializer(autoload_implements)
-Try __autoload()
+Try autoloader
do_autoload(autoload_interface)
do_autoload(autoload_implements)
object(autoload_implements)#%d (0) {
@@ -176,7 +175,7 @@ object(autoload_implements)#%d (0) {
===AutoNA===
do_autoload(autoload_not_available)
unserializer(autoload_not_available)
-Try __autoload()
+Try autoloader
do_autoload(autoload_not_available)
do_autoload(autoload_not_available)
diff --git a/ext/standard/tests/serialize/bug26762.phpt b/ext/standard/tests/serialize/bug26762.phpt
index 3011bb602c..dd779780f4 100644
--- a/ext/standard/tests/serialize/bug26762.phpt
+++ b/ext/standard/tests/serialize/bug26762.phpt
@@ -2,7 +2,6 @@
Bug #26762 (unserialize() produces lowercase classnames)
--SKIPIF--
<?php
- if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed');
if (class_exists('autoload_root')) die('skip Autoload test classes exist already');
?>
--FILE--
diff --git a/ext/standard/tests/serialize/bug30234.phpt b/ext/standard/tests/serialize/bug30234.phpt
index 9b40cc54b3..ae3a0b2f55 100644
--- a/ext/standard/tests/serialize/bug30234.phpt
+++ b/ext/standard/tests/serialize/bug30234.phpt
@@ -7,11 +7,10 @@ Bug #30234 (__autoload() not invoked for interfaces)
--FILE--
<?php
-function __autoload($class_name)
-{
+spl_autoload_register(function ($class_name) {
require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.p5c');
echo __FUNCTION__ . '(' . $class_name . ")\n";
-}
+});
var_dump(interface_exists('autoload_interface', false));
var_dump(class_exists('autoload_implements', false));
@@ -30,8 +29,8 @@ var_dump(class_exists('autoload_implements', false));
--EXPECTF--
bool(false)
bool(false)
-__autoload(autoload_interface)
-__autoload(Autoload_Implements)
+{closure}(autoload_interface)
+{closure}(Autoload_Implements)
object(autoload_implements)#%d (0) {
}
bool(true)
diff --git a/ext/standard/tests/serialize/bug43614.phpt b/ext/standard/tests/serialize/bug43614.phpt
index 68568a1224..127dfba586 100644
--- a/ext/standard/tests/serialize/bug43614.phpt
+++ b/ext/standard/tests/serialize/bug43614.phpt
@@ -7,7 +7,7 @@ error_reporting(E_ALL);
var_dump($a = unserialize('a:2:{s:2:"10";i:1;s:2:"01";i:2;}'));
var_dump($a['10']);
-var_dump($a[b'01']);
+var_dump($a['01']);
?>
--EXPECT--
diff --git a/ext/standard/tests/serialize/bug49649.phpt b/ext/standard/tests/serialize/bug49649.phpt
new file mode 100644
index 0000000000..2e0a505930
--- /dev/null
+++ b/ext/standard/tests/serialize/bug49649.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #49649 (unserialize() doesn't handle changes in property visibility) - to public
+--FILE--
+<?php
+
+/**
+ *class Foo
+ *{
+ * private $private = 1;
+ *
+ * protected $protected = 2;
+ *
+ * public $public = 3;
+ *
+ * public $notThere = 'old';
+ * }
+ *
+ * echo base64_encode(serialize(new Foo()));
+ *
+ * The class above represents the serialized, base64_encoded string below.
+*/
+$serialized = 'TzozOiJGb28iOjQ6e3M6MTI6IgBGb28AcHJpdmF0ZSI7aToxO3M6MTI6IgAqAHByb3RlY3RlZCI7aToyO3M6NjoicHVibGljIjtpOjM7czo4OiJub3RUaGVyZSI7czozOiJvbGQiO30';
+
+class Foo
+{
+ public $public = null;
+
+ public $protected = null;
+
+ public $private = null;
+}
+
+$class = unserialize(base64_decode($serialized));
+var_dump($class);
+--EXPECT--
+object(Foo)#1 (4) {
+ ["public"]=>
+ int(3)
+ ["protected"]=>
+ int(2)
+ ["private"]=>
+ int(1)
+ ["notThere"]=>
+ string(3) "old"
+}
diff --git a/ext/standard/tests/serialize/bug49649_1.phpt b/ext/standard/tests/serialize/bug49649_1.phpt
new file mode 100644
index 0000000000..1ca840a9b6
--- /dev/null
+++ b/ext/standard/tests/serialize/bug49649_1.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #49649 (unserialize() doesn't handle changes in property visibility) - to protected
+--FILE--
+<?php
+
+/**
+ *class Foo
+ *{
+ * private $private = 1;
+ *
+ * protected $protected = 2;
+ *
+ * public $public = 3;
+ *
+ * public $notThere = 'old';
+ * }
+ *
+ * echo base64_encode(serialize(new Foo()));
+ *
+ * The class above represents the serialized, base64_encoded string below.
+*/
+$serialized = 'TzozOiJGb28iOjQ6e3M6MTI6IgBGb28AcHJpdmF0ZSI7aToxO3M6MTI6IgAqAHByb3RlY3RlZCI7aToyO3M6NjoicHVibGljIjtpOjM7czo4OiJub3RUaGVyZSI7czozOiJvbGQiO30';
+
+class Foo
+{
+ protected $public = null;
+
+ protected $protected = null;
+
+ protected $private = null;
+}
+
+$class = unserialize(base64_decode($serialized));
+var_dump($class);
+--EXPECT--
+object(Foo)#1 (4) {
+ ["public":protected]=>
+ int(3)
+ ["protected":protected]=>
+ int(2)
+ ["private":protected]=>
+ int(1)
+ ["notThere"]=>
+ string(3) "old"
+}
diff --git a/ext/standard/tests/serialize/bug49649_2.phpt b/ext/standard/tests/serialize/bug49649_2.phpt
new file mode 100644
index 0000000000..e9fe4290de
--- /dev/null
+++ b/ext/standard/tests/serialize/bug49649_2.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #49649 (unserialize() doesn't handle changes in property visibility) - to private
+--FILE--
+<?php
+
+/**
+ *class Foo
+ *{
+ * private $private = 1;
+ *
+ * protected $protected = 2;
+ *
+ * public $public = 3;
+ *
+ * public $notThere = 'old';
+ * }
+ *
+ * echo base64_encode(serialize(new Foo()));
+ *
+ * The class above represents the serialized, base64_encoded string below.
+*/
+$serialized = 'TzozOiJGb28iOjQ6e3M6MTI6IgBGb28AcHJpdmF0ZSI7aToxO3M6MTI6IgAqAHByb3RlY3RlZCI7aToyO3M6NjoicHVibGljIjtpOjM7czo4OiJub3RUaGVyZSI7czozOiJvbGQiO30';
+
+class Foo
+{
+ private $public = null;
+
+ private $protected = null;
+
+ private $private = null;
+}
+
+$class = unserialize(base64_decode($serialized));
+var_dump($class);
+--EXPECT--
+object(Foo)#1 (4) {
+ ["public":"Foo":private]=>
+ int(3)
+ ["protected":"Foo":private]=>
+ int(2)
+ ["private":"Foo":private]=>
+ int(1)
+ ["notThere"]=>
+ string(3) "old"
+}
diff --git a/ext/standard/tests/serialize/bug62836_1.phpt b/ext/standard/tests/serialize/bug62836_1.phpt
index 7291046410..7d03e9fd18 100644
--- a/ext/standard/tests/serialize/bug62836_1.phpt
+++ b/ext/standard/tests/serialize/bug62836_1.phpt
@@ -3,10 +3,10 @@ Bug #62836 (Seg fault or broken object references on unserialize())
--FILE--
<?php
$serialized_object='O:1:"A":4:{s:1:"b";O:1:"B":0:{}s:2:"b1";r:2;s:1:"c";O:1:"B":0:{}s:2:"c1";r:4;}';
-function __autoload($name) {
+spl_autoload_register(function ($name) {
unserialize("i:4;");
eval("class $name {} ");
-}
+});
print_r(unserialize($serialized_object));
echo "okey";
diff --git a/ext/standard/tests/serialize/bug69152.phpt b/ext/standard/tests/serialize/bug69152.phpt
index b766c0afbd..c4dbcd6926 100644
--- a/ext/standard/tests/serialize/bug69152.phpt
+++ b/ext/standard/tests/serialize/bug69152.phpt
@@ -13,4 +13,4 @@ Exception in %s:%d
Stack trace:
#0 {main}
-Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d
+Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
diff --git a/ext/standard/tests/serialize/bug70213.phpt b/ext/standard/tests/serialize/bug70213.phpt
index c01d362be0..fd7d4001f8 100644
--- a/ext/standard/tests/serialize/bug70213.phpt
+++ b/ext/standard/tests/serialize/bug70213.phpt
@@ -6,9 +6,9 @@ Bug #70213: Unserialize context shared on double class lookup
ini_set('unserialize_callback_func', 'evil');
function evil() {
- function __autoload($arg) {
+ spl_autoload_register(function ($arg) {
var_dump(unserialize('R:1;'));
- }
+ });
}
var_dump(unserialize('a:2:{i:0;i:42;i:1;O:4:"evil":0:{}}'));
@@ -23,7 +23,7 @@ array(2) {
[0]=>
int(42)
[1]=>
- object(__PHP_Incomplete_Class)#1 (1) {
+ object(__PHP_Incomplete_Class)#2 (1) {
["__PHP_Incomplete_Class_Name"]=>
string(4) "evil"
}
diff --git a/ext/standard/tests/serialize/bug74300.phpt b/ext/standard/tests/serialize/bug74300.phpt
new file mode 100644
index 0000000000..d9adda256b
--- /dev/null
+++ b/ext/standard/tests/serialize/bug74300.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #74300 (unserialize() for float nvexp part)
+--INI--
+serialize_precision=10
+--FILE--
+<?php
+var_dump(unserialize('d:2e+2;'));
+var_dump(unserialize('d:2e++2;'));
+?>
+===DONE===
+--EXPECTF--
+float(200)
+
+Notice: unserialize(): Error at offset 0 of 8 bytes in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/serialize/incomplete_class.phpt b/ext/standard/tests/serialize/incomplete_class.phpt
index 8280485516..7e6aa7b39f 100644
--- a/ext/standard/tests/serialize/incomplete_class.phpt
+++ b/ext/standard/tests/serialize/incomplete_class.phpt
@@ -17,11 +17,11 @@ echo "Done\n";
object(__PHP_Incomplete_Class)#%d (0) {
}
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL
Done
diff --git a/ext/standard/tests/serialize/invalid_signs_in_lengths.phpt b/ext/standard/tests/serialize/invalid_signs_in_lengths.phpt
new file mode 100644
index 0000000000..6288cfc52e
--- /dev/null
+++ b/ext/standard/tests/serialize/invalid_signs_in_lengths.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Lengths and references are not signed
+--FILE--
+<?php
+
+var_dump(unserialize('s:+1:"x";'));
+var_dump(unserialize('s:-1:"x";'));
+var_dump(unserialize('a:+0:{}'));
+var_dump(unserialize('a:-0:{}'));
+var_dump(unserialize('O:+8:"stdClass":0:{}'));
+var_dump(unserialize('O:-8:"stdClass":0:{}'));
+var_dump(unserialize('C:+11:"ArrayObject":0:{}'));
+var_dump(unserialize('C:-11:"ArrayObject":0:{}'));
+var_dump(unserialize('a:1:{i:0;r:+1;}'));
+var_dump(unserialize('a:1:{i:0;r:-1;}'));
+var_dump(unserialize('a:1:{i:0;R:+1;}'));
+var_dump(unserialize('a:1:{i:0;R:-1;}'));
+
+?>
+--EXPECTF--
+Notice: unserialize(): Error at offset 0 of 9 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 9 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 7 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 7 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 20 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 20 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 24 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 24 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 9 of 15 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 9 of 15 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 9 of 15 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 9 of 15 bytes in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/serialize/serialization_objects_005.phpt b/ext/standard/tests/serialize/serialization_objects_005.phpt
index 35b1593879..fd58b0323a 100644
--- a/ext/standard/tests/serialize/serialization_objects_005.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_005.phpt
@@ -88,33 +88,33 @@ object(__PHP_Incomplete_Class)#%d (2) {
["p"]=>
int(1)
}
-bool(false)
+bool(true)
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 43
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 46
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 47
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 49
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 50
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
string(9) "p.changed"
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 53
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
bool(false)
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 54
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 55
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
bool(false)
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 56
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 57
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL
-Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 59 \ No newline at end of file
+Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
diff --git a/ext/standard/tests/serialize/serialization_objects_006.phpt b/ext/standard/tests/serialize/serialization_objects_006.phpt
index e223f4ee12..918e59d0aa 100644
--- a/ext/standard/tests/serialize/serialization_objects_006.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_006.phpt
@@ -23,6 +23,6 @@ echo "Done";
object(__PHP_Incomplete_Class)#%d (0) {
}
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 15
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/serialize/serialization_objects_007.phpt b/ext/standard/tests/serialize/serialization_objects_007.phpt
index 9cba9d13b5..2837e1ec46 100644
--- a/ext/standard/tests/serialize/serialization_objects_007.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_007.phpt
@@ -13,9 +13,9 @@ Ensure __autoload is called twice if unserialize_callback_func is defined.
* Alias to functions:
*/
-function __autoload($name) {
- echo "in __autoload($name)\n";
-}
+spl_autoload_register(function ($name) {
+ echo "in autoload($name)\n";
+});
ini_set('unserialize_callback_func','check');
@@ -30,13 +30,13 @@ var_dump($o);
echo "Done";
?>
--EXPECTF--
-in __autoload(FOO)
+in autoload(FOO)
in check(FOO)
-in __autoload(FOO)
+in autoload(FOO)
Warning: unserialize(): Function check() hasn't defined the class it was called for in %s on line 23
object(__PHP_Incomplete_Class)#%d (1) {
["__PHP_Incomplete_Class_Name"]=>
string(3) "FOO"
}
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/serialize/sleep_undefined_declared_properties.phpt b/ext/standard/tests/serialize/sleep_undefined_declared_properties.phpt
new file mode 100644
index 0000000000..ac33f4388c
--- /dev/null
+++ b/ext/standard/tests/serialize/sleep_undefined_declared_properties.phpt
@@ -0,0 +1,29 @@
+--TEST--
+__sleep() returning undefined declared properties
+--FILE--
+<?php
+
+class Test {
+ public $pub;
+ protected $prot;
+ private $priv;
+
+ public function __construct() {
+ unset($this->pub, $this->prot, $this->priv);
+ }
+
+ public function __sleep() {
+ return ['pub', 'prot', 'priv'];
+ }
+}
+
+var_dump(serialize(new Test));
+
+?>
+--EXPECTF--
+Notice: serialize(): "pub" returned as member variable from __sleep() but does not exist in %s on line %d
+
+Notice: serialize(): "prot" returned as member variable from __sleep() but does not exist in %s on line %d
+
+Notice: serialize(): "priv" returned as member variable from __sleep() but does not exist in %s on line %d
+string(53) "O:4:"Test":3:{s:3:"pub";N;s:4:"prot";N;s:4:"priv";N;}"
diff --git a/ext/standard/tests/streams/bug44818.phpt b/ext/standard/tests/streams/bug44818.phpt
index 628f64e341..7bd9fe5168 100644
--- a/ext/standard/tests/streams/bug44818.phpt
+++ b/ext/standard/tests/streams/bug44818.phpt
@@ -5,7 +5,7 @@ Bug #44818 (php://memory writeable when opened read only)
function test($url, $mode) {
echo "$url, $mode\n";
$fd = fopen($url, $mode);
- var_dump($fd, fwrite($fd, b"foo"));
+ var_dump($fd, fwrite($fd, "foo"));
var_dump(fseek($fd, 0, SEEK_SET), fread($fd, 3));
fclose($fd);
}
diff --git a/ext/standard/tests/streams/bug46426.phpt b/ext/standard/tests/streams/bug46426.phpt
index 80dbcded80..8c95ea456e 100644
--- a/ext/standard/tests/streams/bug46426.phpt
+++ b/ext/standard/tests/streams/bug46426.phpt
@@ -5,7 +5,7 @@ Bug #46426 (3rd parameter offset of stream_get_contents not works for "0")
$tmp = tmpfile();
-fwrite($tmp, b"12345");
+fwrite($tmp, "12345");
echo stream_get_contents($tmp, 2, 1);
echo "\n";
diff --git a/ext/standard/tests/streams/bug48309.phpt b/ext/standard/tests/streams/bug48309.phpt
index d347cc39c8..bb2d9d28f7 100644
--- a/ext/standard/tests/streams/bug48309.phpt
+++ b/ext/standard/tests/streams/bug48309.phpt
@@ -4,7 +4,7 @@ Bug #48309 (stream_copy_to_stream() and fpasstru() do not update stream position
<?php
$tmp = tmpfile();
-fwrite($tmp, b'test');
+fwrite($tmp, 'test');
fseek($tmp, 0, SEEK_SET);
echo "-- stream_copy_to_stream() --\n";
diff --git a/ext/standard/tests/streams/bug49936_win32.phpt b/ext/standard/tests/streams/bug49936_win32.phpt
index 4db4a5044f..594fcae4be 100644
--- a/ext/standard/tests/streams/bug49936_win32.phpt
+++ b/ext/standard/tests/streams/bug49936_win32.phpt
@@ -1,30 +1,30 @@
---TEST--
-Bug #49936 (crash with ftp stream in php_stream_context_get_option())
---SKIPIF--
-<?php
-if( substr(PHP_OS, 0, 3) != "WIN" )
- die("skip. Do run on Windows only");
-?>
---INI--
-default_socket_timeout=2
---FILE--
-<?php
-
-$dir = 'ftp://your:self@localhost/';
-
-var_dump(opendir($dir));
-var_dump(opendir($dir));
-
-?>
---EXPECTF--
-Warning: opendir(): connect() failed: %s
- in %s on line %d
-
-Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
-bool(false)
-
-Warning: opendir(): connect() failed: %s
- in %s on line %d
-
-Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
-bool(false)
+--TEST--
+Bug #49936 (crash with ftp stream in php_stream_context_get_option())
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die("skip. Do run on Windows only");
+?>
+--INI--
+default_socket_timeout=2
+--FILE--
+<?php
+
+$dir = 'ftp://your:self@localhost/';
+
+var_dump(opendir($dir));
+var_dump(opendir($dir));
+
+?>
+--EXPECTF--
+Warning: opendir(): connect() failed: %s
+ in %s on line %d
+
+Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
+bool(false)
+
+Warning: opendir(): connect() failed: %s
+ in %s on line %d
+
+Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/streams/bug68948.phpt b/ext/standard/tests/streams/bug68948.phpt
new file mode 100644
index 0000000000..7ce9d7ad03
--- /dev/null
+++ b/ext/standard/tests/streams/bug68948.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #68948: feof() on temporary streams broken
+--FILE--
+<?php
+
+$testString = '0123456789';
+
+$stream = fopen("php://memory", "r+");
+fwrite($stream, $testString);
+rewind($stream);
+
+var_dump(fread($stream, 10));
+var_dump(ftell($stream));
+var_dump(feof($stream));
+
+rewind($stream);
+
+var_dump(fread($stream, 11));
+var_dump(ftell($stream));
+var_dump(feof($stream));
+
+?>
+--EXPECT--
+string(10) "0123456789"
+int(10)
+bool(false)
+string(10) "0123456789"
+int(10)
+bool(true)
+
diff --git a/ext/standard/tests/streams/bug74556.phpt b/ext/standard/tests/streams/bug74556.phpt
index 016a3dce86..121426105a 100644
--- a/ext/standard/tests/streams/bug74556.phpt
+++ b/ext/standard/tests/streams/bug74556.phpt
@@ -6,7 +6,7 @@ if (!strncasecmp(PHP_OS, 'WIN', 3)) echo "skip Unix Only";
--FILE--
<?php
-$sock = __DIR__ . '/bug74556.sock';
+$sock = tempnam(sys_get_temp_dir(), 'bug74556') . '.sock';
$s = stream_socket_server("unix://$sock");
$c = stream_socket_client("unix://$sock");
@@ -14,9 +14,7 @@ var_dump(
stream_socket_get_name($s, true),
stream_socket_get_name($c, false)
);
---CLEAN--
-<?php
-unlink(__DIR__ . '/bug74556.sock');
+unlink($sock);
--EXPECT--
bool(false)
bool(false)
diff --git a/ext/standard/tests/streams/proc_open_bug60120.phpt b/ext/standard/tests/streams/proc_open_bug60120.phpt
index 8768257a2e..4587f0718e 100644
--- a/ext/standard/tests/streams/proc_open_bug60120.phpt
+++ b/ext/standard/tests/streams/proc_open_bug60120.phpt
@@ -38,7 +38,7 @@ while ($pipes || $writePipes) {
}
if ($w) {
- $written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
+ $written = fwrite($writePipes[0], substr($stdin, $stdinOffset), 8192);
if (false !== $written) {
$stdinOffset += $written;
}
diff --git a/ext/standard/tests/streams/proc_open_bug64438.phpt b/ext/standard/tests/streams/proc_open_bug64438.phpt
index b3857d09d4..747f1171f3 100644
--- a/ext/standard/tests/streams/proc_open_bug64438.phpt
+++ b/ext/standard/tests/streams/proc_open_bug64438.phpt
@@ -38,7 +38,7 @@ while ($pipes || $writePipes) {
}
if ($w) {
- $written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
+ $written = fwrite($writePipes[0], substr($stdin, $stdinOffset), 8192);
if (false !== $written) {
$stdinOffset += $written;
}
diff --git a/ext/standard/tests/streams/proc_open_bug69900.phpt b/ext/standard/tests/streams/proc_open_bug69900.phpt
index d55af3c769..a3fdfa6c55 100644
--- a/ext/standard/tests/streams/proc_open_bug69900.phpt
+++ b/ext/standard/tests/streams/proc_open_bug69900.phpt
@@ -6,7 +6,7 @@ Bug #69900 Commandline input/output weird behaviour with STDIO
error_reporting(E_ALL);
$fl = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test69900.php";
-$max_ms = ((bool)getenv('TRAVIS')) ? 5 : 1;
+$max_ms = ((bool)getenv('TRAVIS')) ? 10 : 1;
$test_content = '<?php
diff --git a/ext/standard/tests/streams/stream_context_get_params_001.phpt b/ext/standard/tests/streams/stream_context_get_params_001.phpt
index d946184f63..e8b107ccfe 100644
--- a/ext/standard/tests/streams/stream_context_get_params_001.phpt
+++ b/ext/standard/tests/streams/stream_context_get_params_001.phpt
@@ -25,97 +25,97 @@ var_dump(stream_context_get_options($ctx));
--EXPECTF--
resource(%d) of type (stream-context)
array(1) {
- [%u|b%"options"]=>
+ ["options"]=>
array(0) {
}
}
bool(true)
array(1) {
- [%u|b%"options"]=>
+ ["options"]=>
array(1) {
- [%u|b%"foo"]=>
+ ["foo"]=>
array(1) {
- [%u|b%"bar"]=>
- %unicode|string%(3) "baz"
+ ["bar"]=>
+ string(3) "baz"
}
}
}
bool(true)
array(2) {
- [%u|b%"notification"]=>
- %unicode|string%(28) "stream_notification_callback"
- [%u|b%"options"]=>
+ ["notification"]=>
+ string(28) "stream_notification_callback"
+ ["options"]=>
array(1) {
- [%u|b%"foo"]=>
+ ["foo"]=>
array(1) {
- [%u|b%"bar"]=>
- %unicode|string%(3) "baz"
+ ["bar"]=>
+ string(3) "baz"
}
}
}
bool(true)
array(2) {
- [%u|b%"notification"]=>
+ ["notification"]=>
array(2) {
[0]=>
- %unicode|string%(6) "stream"
+ string(6) "stream"
[1]=>
- %unicode|string%(21) "notification_callback"
+ string(21) "notification_callback"
}
- [%u|b%"options"]=>
+ ["options"]=>
array(1) {
- [%u|b%"foo"]=>
+ ["foo"]=>
array(1) {
- [%u|b%"bar"]=>
- %unicode|string%(3) "baz"
+ ["bar"]=>
+ string(3) "baz"
}
}
}
array(2) {
- [%u|b%"notification"]=>
+ ["notification"]=>
array(2) {
[0]=>
- %unicode|string%(6) "stream"
+ string(6) "stream"
[1]=>
- %unicode|string%(21) "notification_callback"
+ string(21) "notification_callback"
}
- [%u|b%"options"]=>
+ ["options"]=>
array(1) {
- [%u|b%"foo"]=>
+ ["foo"]=>
array(1) {
- [%u|b%"bar"]=>
- %unicode|string%(3) "baz"
+ ["bar"]=>
+ string(3) "baz"
}
}
}
array(1) {
- [%u|b%"foo"]=>
+ ["foo"]=>
array(1) {
- [%u|b%"bar"]=>
- %unicode|string%(3) "baz"
+ ["bar"]=>
+ string(3) "baz"
}
}
array(2) {
- [%u|b%"notification"]=>
+ ["notification"]=>
array(2) {
[0]=>
- %unicode|string%(6) "stream"
+ string(6) "stream"
[1]=>
- %unicode|string%(21) "notification_callback"
+ string(21) "notification_callback"
}
- [%u|b%"options"]=>
+ ["options"]=>
array(1) {
- [%u|b%"foo"]=>
+ ["foo"]=>
array(1) {
- [%u|b%"bar"]=>
- %unicode|string%(3) "baz"
+ ["bar"]=>
+ string(3) "baz"
}
}
}
array(1) {
- [%u|b%"foo"]=>
+ ["foo"]=>
array(1) {
- [%u|b%"bar"]=>
- %unicode|string%(3) "baz"
+ ["bar"]=>
+ string(3) "baz"
}
}
diff --git a/ext/standard/tests/streams/stream_copy_to_stream_socket.phpt b/ext/standard/tests/streams/stream_copy_to_stream_socket.phpt
index 7e304b1188..dafe90e40c 100644
--- a/ext/standard/tests/streams/stream_copy_to_stream_socket.phpt
+++ b/ext/standard/tests/streams/stream_copy_to_stream_socket.phpt
@@ -11,7 +11,7 @@ if (!$sockets) die("skip stream_socket_pair");
$sockets = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
$tmp = tmpfile();
-fwrite($sockets[0], b"a");
+fwrite($sockets[0], "a");
stream_socket_shutdown($sockets[0], STREAM_SHUT_WR);
stream_copy_to_stream($sockets[1], $tmp);
diff --git a/ext/standard/tests/streams/stream_get_contents_001.phpt b/ext/standard/tests/streams/stream_get_contents_001.phpt
index e8e1c3d26b..dc7fcb239c 100644
--- a/ext/standard/tests/streams/stream_get_contents_001.phpt
+++ b/ext/standard/tests/streams/stream_get_contents_001.phpt
@@ -5,7 +5,7 @@ stream_get_contents() - Testing offset out of range
$tmp = tmpfile();
-fwrite($tmp, b"12345");
+fwrite($tmp, "12345");
echo stream_get_contents($tmp, 2, 5), "--\n";
echo stream_get_contents($tmp, 2), "--\n";
diff --git a/ext/standard/tests/streams/stream_get_contents_002.phpt b/ext/standard/tests/streams/stream_get_contents_002.phpt
index 66ff3fb189..3e01e71953 100644
--- a/ext/standard/tests/streams/stream_get_contents_002.phpt
+++ b/ext/standard/tests/streams/stream_get_contents_002.phpt
@@ -10,7 +10,7 @@ $sockets = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
stream_set_timeout($sockets[1], 6000);
-fwrite($sockets[0], b"foo");
+fwrite($sockets[0], "foo");
var_dump(stream_get_contents($sockets[1], 3));
?>
diff --git a/ext/standard/tests/streams/stream_get_line_nb.phpt b/ext/standard/tests/streams/stream_get_line_nb.phpt
index ce981203ff..40a6095374 100644
--- a/ext/standard/tests/streams/stream_get_line_nb.phpt
+++ b/ext/standard/tests/streams/stream_get_line_nb.phpt
@@ -20,25 +20,25 @@ var_dump($sockets);
stream_set_blocking($sockets[1], 0);
-$eol = b'<EOL>';
+$eol = '<EOL>';
-fwrite($sockets[0], b"line start");
+fwrite($sockets[0], "line start");
var_dump(stream_get_line($sockets[1], 8192, $eol)); // Does not returns incomplete line (EOL not found)
var_dump(stream_get_line($sockets[1], 8192, $eol));
-fwrite($sockets[0], b", line end");
-fwrite($sockets[0], b", $eol");
+fwrite($sockets[0], ", line end");
+fwrite($sockets[0], ", $eol");
var_dump(stream_get_line($sockets[1], 8192, $eol)); // Returns full line (EOL found)
var_dump(stream_get_line($sockets[1], 8192, $eol)); // Nothing to read
var_dump(stream_get_line($sockets[1], 8192, $eol));
-fwrite($sockets[0], b"incomplete line");
-var_dump(stream_get_line($sockets[1], strlen(b"incomplete line"), $eol)); // EOL not found but $length has been read, return incomplete line
+fwrite($sockets[0], "incomplete line");
+var_dump(stream_get_line($sockets[1], strlen("incomplete line"), $eol)); // EOL not found but $length has been read, return incomplete line
-fwrite($sockets[0], b"incomplete line");
+fwrite($sockets[0], "incomplete line");
var_dump(stream_get_line($sockets[1], 8192, $eol)); // Does not returns incomplete line (EOL not found)
-var_dump(fread($sockets[1], strlen(b"incomplete line"))); // Returns buffer readden by stream_get_line
+var_dump(fread($sockets[1], strlen("incomplete line"))); // Returns buffer readden by stream_get_line
-fwrite($sockets[0], b"end of file");
+fwrite($sockets[0], "end of file");
var_dump(stream_get_line($sockets[1], 8192, $eol)); // Does not returns incomplete line (EOL not found)
fclose($sockets[0]);
diff --git a/ext/standard/tests/streams/stream_socket_enable_crypto-win32.phpt b/ext/standard/tests/streams/stream_socket_enable_crypto-win32.phpt
index 7353ee4d97..1ae61b50e2 100644
--- a/ext/standard/tests/streams/stream_socket_enable_crypto-win32.phpt
+++ b/ext/standard/tests/streams/stream_socket_enable_crypto-win32.phpt
@@ -10,6 +10,7 @@ if (!extension_loaded('openssl')) {
if (substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test');
}
+if (OPENSSL_VERSION_NUMBER < 0x10100000) die("skip OpenSSLv1.1.0 required");
?>
--FILE--
<?php
@@ -47,11 +48,11 @@ bool(false)
Warning: stream_socket_enable_crypto(): SSLv2 unavailable in this PHP version in %s on line %d
bool(false)
-Warning: stream_socket_enable_crypto(): SSL: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied.
- in %s on line %d
+Warning: stream_socket_enable_crypto(): SSLv3 unavailable %s in %s on line %d
bool(false)
-Warning: stream_socket_enable_crypto(): SSL/TLS already set-up for this stream in %s on line %d
+Warning: stream_socket_enable_crypto(): SSL: The operation completed successfully.
+ in %s on line %d
bool(false)
Warning: stream_socket_enable_crypto(): SSL/TLS already set-up for this stream in %s on line %d
diff --git a/ext/standard/tests/streams/stream_socket_pair.phpt b/ext/standard/tests/streams/stream_socket_pair.phpt
index 203ae982d1..b926c9d9f4 100644
--- a/ext/standard/tests/streams/stream_socket_pair.phpt
+++ b/ext/standard/tests/streams/stream_socket_pair.phpt
@@ -5,8 +5,8 @@ stream_socket_pair()
$domain = (strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? STREAM_PF_INET : STREAM_PF_UNIX);
$sockets = stream_socket_pair($domain, STREAM_SOCK_STREAM, 0);
var_dump($sockets);
-fwrite($sockets[0], b"foo");
-var_dump(fread($sockets[1], strlen(b"foo")));
+fwrite($sockets[0], "foo");
+var_dump(fread($sockets[1], strlen("foo")));
fclose($sockets[0]);
?>
--EXPECTF--
diff --git a/ext/standard/tests/strings/bug24208.phpt b/ext/standard/tests/strings/bug24208.phpt
index bed28d95c5..f85c9c1e54 100644
--- a/ext/standard/tests/strings/bug24208.phpt
+++ b/ext/standard/tests/strings/bug24208.phpt
@@ -6,7 +6,8 @@ $a = $b = $c = "oops";
parse_str("a=1&b=2&c=3");
var_dump($a, $b, $c);
?>
---EXPECT--
+--EXPECTF--
+Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d
string(1) "1"
string(1) "2"
string(1) "3"
diff --git a/ext/standard/tests/strings/bug24281.phpt b/ext/standard/tests/strings/bug24281.phpt
index 3c041d67cb..66a30913e8 100644
--- a/ext/standard/tests/strings/bug24281.phpt
+++ b/ext/standard/tests/strings/bug24281.phpt
@@ -1,9 +1,5 @@
--TEST--
Bug #24281 (str_replace count not returned if variable wasn't initialized)
---SKIPIF--
-<?php
- if (version_compare(zend_version(), '2.0.0-dev', '<')) die('SKIP PHP5 functionality');
-?>
--FILE--
<?php
$string = "He had had to have had it";
diff --git a/ext/standard/tests/strings/bug37262.phpt b/ext/standard/tests/strings/bug37262.phpt
index 5a9f7f724d..ffdc994f46 100644
--- a/ext/standard/tests/strings/bug37262.phpt
+++ b/ext/standard/tests/strings/bug37262.phpt
@@ -6,4 +6,5 @@ $func = create_function('$a', 'return $a;');
var_export($func);
?>
--EXPECTF--
+Deprecated: Function create_function() is deprecated in %s on line %d
'' . "\0" . 'lambda_%d'
diff --git a/ext/standard/tests/strings/bug40754.phpt b/ext/standard/tests/strings/bug40754.phpt
index 84e4337463..b30042e939 100644
--- a/ext/standard/tests/strings/bug40754.phpt
+++ b/ext/standard/tests/strings/bug40754.phpt
@@ -27,8 +27,8 @@ var_dump(substr("abcde", $v, $v));
?>
--EXPECTF--
-%unicode|string%(4) "bcde"
-%unicode|string%(6) "abcdex"
+string(4) "bcde"
+string(6) "abcdex"
bool(false)
bool(false)
diff --git a/ext/standard/tests/strings/bug40915.phpt b/ext/standard/tests/strings/bug40915.phpt
index e3a501a178..88674ee953 100644
--- a/ext/standard/tests/strings/bug40915.phpt
+++ b/ext/standard/tests/strings/bug40915.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/bug43957.phpt b/ext/standard/tests/strings/bug43957.phpt
new file mode 100644
index 0000000000..0380787b73
--- /dev/null
+++ b/ext/standard/tests/strings/bug43957.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #43957 (utf8_decode() bogus conversion on multibyte indicator near end of string)
+--FILE--
+<?php
+ echo utf8_decode('abc'.chr(0xe0));
+?>
+--EXPECTF--
+abc?
diff --git a/ext/standard/tests/strings/bug44703.phpt b/ext/standard/tests/strings/bug44703.phpt
index e20b1dd83f..6171cee923 100644
--- a/ext/standard/tests/strings/bug44703.phpt
+++ b/ext/standard/tests/strings/bug44703.phpt
@@ -3,22 +3,22 @@ Bug #44703 (htmlspecialchars() does not detect bad character set argument)
--FILE--
<?php
-var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 1));
-var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 12));
-var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 125));
-var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 1252));
-var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 12526));
+var_dump(htmlspecialchars("<a href='test'>Test</a>", ENT_COMPAT, 1));
+var_dump(htmlspecialchars("<a href='test'>Test</a>", ENT_COMPAT, 12));
+var_dump(htmlspecialchars("<a href='test'>Test</a>", ENT_COMPAT, 125));
+var_dump(htmlspecialchars("<a href='test'>Test</a>", ENT_COMPAT, 1252));
+var_dump(htmlspecialchars("<a href='test'>Test</a>", ENT_COMPAT, 12526));
-var_dump(htmlspecialchars(b"<>", ENT_COMPAT, 866));
-var_dump(htmlspecialchars(b"<>", ENT_COMPAT, 8666));
+var_dump(htmlspecialchars("<>", ENT_COMPAT, 866));
+var_dump(htmlspecialchars("<>", ENT_COMPAT, 8666));
-var_dump(htmlspecialchars(b"<>", ENT_COMPAT, NULL));
+var_dump(htmlspecialchars("<>", ENT_COMPAT, NULL));
-var_dump(htmlspecialchars(b"<>", ENT_COMPAT, 'SJIS'));
-var_dump(htmlspecialchars(b"<>", ENT_COMPAT, 'SjiS'));
+var_dump(htmlspecialchars("<>", ENT_COMPAT, 'SJIS'));
+var_dump(htmlspecialchars("<>", ENT_COMPAT, 'SjiS'));
-var_dump(htmlspecialchars(b"<>", ENT_COMPAT, str_repeat('a', 100)));
+var_dump(htmlspecialchars("<>", ENT_COMPAT, str_repeat('a', 100)));
?>
--EXPECTF--
diff --git a/ext/standard/tests/strings/bug49687.phpt b/ext/standard/tests/strings/bug49687.phpt
new file mode 100644
index 0000000000..ae191be088
--- /dev/null
+++ b/ext/standard/tests/strings/bug49687.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #49687 Several utf8_decode deficiencies and vulnerabilities
+--FILE--
+<?php
+
+$tests = array(
+ "\x41\xC2\x3E\x42",
+ "\xE3\x80\x22",
+ "\x41\x98\xBA\x42\xE2\x98\x43\xE2\x98\xBA\xE2\x98",
+);
+foreach ($tests as $t) {
+ echo bin2hex(utf8_decode($t)), "\n";
+}
+echo "Done.\n";
+--EXPECT--
+413f3e42
+3f22
+413f3f423f433f3f
+Done.
diff --git a/ext/standard/tests/strings/bug50052.phpt b/ext/standard/tests/strings/bug50052.phpt
index 96d859992e..97a4481ea9 100644
--- a/ext/standard/tests/strings/bug50052.phpt
+++ b/ext/standard/tests/strings/bug50052.phpt
@@ -1,12 +1,12 @@
---TEST--
-Bug #50052 (Different Hashes on Windows and Linux on wrong Salt size)
---FILE--
-<?php
-$salt = '$1$f+uslYF01$';
-$password = 'test';
-echo $salt . "\n";
-echo crypt($password,$salt) . "\n";
-?>
---EXPECT--
-$1$f+uslYF01$
-$1$f+uslYF0$orVloNmKSLvOeswusE0bY.
+--TEST--
+Bug #50052 (Different Hashes on Windows and Linux on wrong Salt size)
+--FILE--
+<?php
+$salt = '$1$f+uslYF01$';
+$password = 'test';
+echo $salt . "\n";
+echo crypt($password,$salt) . "\n";
+?>
+--EXPECT--
+$1$f+uslYF01$
+$1$f+uslYF0$orVloNmKSLvOeswusE0bY.
diff --git a/ext/standard/tests/strings/bug51059.phpt b/ext/standard/tests/strings/bug51059.phpt
index bdc56f1762..d17305ca50 100644
--- a/ext/standard/tests/strings/bug51059.phpt
+++ b/ext/standard/tests/strings/bug51059.phpt
@@ -2,8 +2,8 @@
Bug #51059 crypt() segfaults on certain salts
--FILE--
<?php
-$res = crypt(b'a', b'_');
-if ($res === b'*0' || $res === b'*1') echo 'OK';
+$res = crypt('a', '_');
+if ($res === '*0' || $res === '*1') echo 'OK';
else echo 'Not OK';
?>
diff --git a/ext/standard/tests/strings/bug53021.phpt b/ext/standard/tests/strings/bug53021.phpt
index 38d904761d..15b3cb07e9 100644
--- a/ext/standard/tests/strings/bug53021.phpt
+++ b/ext/standard/tests/strings/bug53021.phpt
@@ -1,40 +1,40 @@
---TEST--
-Bug #53021 (Failure to convert numeric entities with ENT_NOQUOTES and ISO-8859-1)
---FILE--
-<?php
-var_dump(unpack("H*",html_entity_decode("&#233;", ENT_QUOTES, "ISO-8859-1")));
-echo "double quotes variations:", "\n";
-echo html_entity_decode("&quot;", ENT_NOQUOTES, 'UTF-8'), "\n";
-echo html_entity_decode("&#34;", ENT_NOQUOTES, 'UTF-8'), "\n";
-echo html_entity_decode("&quot;", ENT_QUOTES, 'UTF-8'), "\n";
-echo html_entity_decode("&#34;", ENT_QUOTES, 'UTF-8'), "\n";
-echo html_entity_decode("&quot;", ENT_COMPAT, 'UTF-8'), "\n";
-echo html_entity_decode("&#34;", ENT_COMPAT, 'UTF-8'), "\n";
-echo html_entity_decode("&quot;"), "\n";
-echo html_entity_decode("&#34;"), "\n";
-
-echo "\nsingle quotes variations:", "\n";
-echo html_entity_decode("&#39;", ENT_NOQUOTES, 'UTF-8'), "\n";
-echo html_entity_decode("&#39;", ENT_QUOTES, 'UTF-8'), "\n";
-echo html_entity_decode("&#39;", ENT_COMPAT, 'UTF-8'), "\n";
-echo html_entity_decode("&#39;"), "\n";
---EXPECT--
-array(1) {
- [1]=>
- string(2) "e9"
-}
-double quotes variations:
-&quot;
-&#34;
-"
-"
-"
-"
-"
-"
-
-single quotes variations:
-&#39;
-'
-&#39;
-&#39;
+--TEST--
+Bug #53021 (Failure to convert numeric entities with ENT_NOQUOTES and ISO-8859-1)
+--FILE--
+<?php
+var_dump(unpack("H*",html_entity_decode("&#233;", ENT_QUOTES, "ISO-8859-1")));
+echo "double quotes variations:", "\n";
+echo html_entity_decode("&quot;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&quot;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&quot;", ENT_COMPAT, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_COMPAT, 'UTF-8'), "\n";
+echo html_entity_decode("&quot;"), "\n";
+echo html_entity_decode("&#34;"), "\n";
+
+echo "\nsingle quotes variations:", "\n";
+echo html_entity_decode("&#39;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#39;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#39;", ENT_COMPAT, 'UTF-8'), "\n";
+echo html_entity_decode("&#39;"), "\n";
+--EXPECT--
+array(1) {
+ [1]=>
+ string(2) "e9"
+}
+double quotes variations:
+&quot;
+&#34;
+"
+"
+"
+"
+"
+"
+
+single quotes variations:
+&#39;
+'
+&#39;
+&#39;
diff --git a/ext/standard/tests/strings/convert_cyr_string.phpt b/ext/standard/tests/strings/convert_cyr_string.phpt
index 0b4db2510a..b62768eff4 100644
--- a/ext/standard/tests/strings/convert_cyr_string.phpt
+++ b/ext/standard/tests/strings/convert_cyr_string.phpt
@@ -9,13 +9,13 @@ var_dump(convert_cyr_string("", ""));
var_dump(convert_cyr_string("", "", ""));
var_dump(convert_cyr_string(array(), array(), array()));
-var_dump(convert_cyr_string((binary)"[[[[[[", "q", "m"));
-var_dump(convert_cyr_string((binary)"[[[[[[", "k", "w"));
-var_dump(convert_cyr_string((binary)"[[[[[[", "m", "a"));
-var_dump(convert_cyr_string((binary)"[[[[[[", "d", "i"));
-var_dump(convert_cyr_string((binary)"[[[[[[", "w", "k"));
-var_dump(convert_cyr_string((binary)"[[[[[[", "i", "q"));
-var_dump(convert_cyr_string((binary)"", "d", "i"));
+var_dump(convert_cyr_string("[[[[[[", "q", "m"));
+var_dump(convert_cyr_string("[[[[[[", "k", "w"));
+var_dump(convert_cyr_string("[[[[[[", "m", "a"));
+var_dump(convert_cyr_string("[[[[[[", "d", "i"));
+var_dump(convert_cyr_string("[[[[[[", "w", "k"));
+var_dump(convert_cyr_string("[[[[[[", "i", "q"));
+var_dump(convert_cyr_string("", "d", "i"));
echo "Done\n";
?>
diff --git a/ext/standard/tests/strings/convert_uuencode_basic.phpt b/ext/standard/tests/strings/convert_uuencode_basic.phpt
index df8ee3666e..9849997d41 100644
--- a/ext/standard/tests/strings/convert_uuencode_basic.phpt
+++ b/ext/standard/tests/strings/convert_uuencode_basic.phpt
@@ -14,18 +14,18 @@ echo "*** Testing convert_uuencode() : basic functionality ***\n";
$strings = array (
//double quoted strings
- b"123",
- b"abc",
- b"1a2b3c",
- b"Here is a simple string to test convert_uuencode/decode",
- b"\t This String contains \t\t some control characters\r\n",
- b"\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
+ "123",
+ "abc",
+ "1a2b3c",
+ "Here is a simple string to test convert_uuencode/decode",
+ "\t This String contains \t\t some control characters\r\n",
+ "\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
//single quoted strings
- b'123',
- b'abc',
- b'1a2b3c',
- b'\t This String contains \t\t some control characters\r\n',
+ '123',
+ 'abc',
+ '1a2b3c',
+ '\t This String contains \t\t some control characters\r\n',
);
diff --git a/ext/standard/tests/strings/crypt_blowfish_variation1.phpt b/ext/standard/tests/strings/crypt_blowfish_variation1.phpt
index 1592cfe876..4436700104 100644
--- a/ext/standard/tests/strings/crypt_blowfish_variation1.phpt
+++ b/ext/standard/tests/strings/crypt_blowfish_variation1.phpt
@@ -9,17 +9,17 @@ if (!function_exists('crypt') || !defined("CRYPT_BLOWFISH")) {
--FILE--
<?php
-$salts = array(b'32' => b'$2a$32$CCCCCCCCCCCCCCCCCCCCCC$',
- b'33' => b'$2a$33$CCCCCCCCCCCCCCCCCCCCCC$',
- b'34' => b'$2a$34$CCCCCCCCCCCCCCCCCCCCCC$',
- b'35' => b'$2a$35$CCCCCCCCCCCCCCCCCCCCCC$',
- b'36' => b'$2a$36$CCCCCCCCCCCCCCCCCCCCCC$',
- b'37' => b'$2a$37$CCCCCCCCCCCCCCCCCCCCCC$',
- b'38' => b'$2a$38$CCCCCCCCCCCCCCCCCCCCCC$',);
+$salts = array('32' => '$2a$32$CCCCCCCCCCCCCCCCCCCCCC$',
+ '33' => '$2a$33$CCCCCCCCCCCCCCCCCCCCCC$',
+ '34' => '$2a$34$CCCCCCCCCCCCCCCCCCCCCC$',
+ '35' => '$2a$35$CCCCCCCCCCCCCCCCCCCCCC$',
+ '36' => '$2a$36$CCCCCCCCCCCCCCCCCCCCCC$',
+ '37' => '$2a$37$CCCCCCCCCCCCCCCCCCCCCC$',
+ '38' => '$2a$38$CCCCCCCCCCCCCCCCCCCCCC$',);
foreach($salts as $i=>$salt) {
- $crypt = crypt(b'U*U', $salt);
- if ($crypt === b'*0' || $crypt === b'*1') {
+ $crypt = crypt('U*U', $salt);
+ if ($crypt === '*0' || $crypt === '*1') {
echo "$i. OK\n";
} else {
echo "$i. Not OK\n";
diff --git a/ext/standard/tests/strings/crypt_blowfish_variation2.phpt b/ext/standard/tests/strings/crypt_blowfish_variation2.phpt
index 9db9e21424..f354a8ec77 100644
--- a/ext/standard/tests/strings/crypt_blowfish_variation2.phpt
+++ b/ext/standard/tests/strings/crypt_blowfish_variation2.phpt
@@ -3,7 +3,7 @@ Test Blowfish crypt() does not fall back to DES when rounds are not specified,
or Blowfish is not available.
--FILE--
<?php
-$crypt = crypt(b'U*U', b'$2a$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW');
+$crypt = crypt('U*U', '$2a$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW');
if ($crypt==='*0') {
echo "OK\n";
} else {
diff --git a/ext/standard/tests/strings/crypt_sha256.phpt b/ext/standard/tests/strings/crypt_sha256.phpt
index 86c7245fe9..a29bbf3c88 100644
--- a/ext/standard/tests/strings/crypt_sha256.phpt
+++ b/ext/standard/tests/strings/crypt_sha256.phpt
@@ -11,44 +11,44 @@ if (!function_exists('crypt') || !defined("CRYPT_SHA256")) {
$tests = array(
1 => array(
- b'$5$saltstring',
- b'Hello world!',
- b'$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5'
+ '$5$saltstring',
+ 'Hello world!',
+ '$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5'
),
2 => array(
- b'$5$rounds=10000$saltstringsaltstring',
- b'Hello world!',
- b'$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA'
+ '$5$rounds=10000$saltstringsaltstring',
+ 'Hello world!',
+ '$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA'
),
3 => array(
- b'$5$rounds=10000$saltstringsaltstring',
- b'Hello world!',
- b'$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA'
+ '$5$rounds=10000$saltstringsaltstring',
+ 'Hello world!',
+ '$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA'
),
4 => array(
- b'$5$rounds=5000$toolongsaltstring',
- b'This is just a test',
- b'$5$rounds=5000$toolongsaltstrin$Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8mGRcvxa5'
+ '$5$rounds=5000$toolongsaltstring',
+ 'This is just a test',
+ '$5$rounds=5000$toolongsaltstrin$Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8mGRcvxa5'
),
5 => array(
- b'$5$rounds=1400$anotherlongsaltstring',
- b'a very much longer text to encrypt. This one even stretches over morethan one line.',
- b'$5$rounds=1400$anotherlongsalts$Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12oP84Bnq1'
+ '$5$rounds=1400$anotherlongsaltstring',
+ 'a very much longer text to encrypt. This one even stretches over morethan one line.',
+ '$5$rounds=1400$anotherlongsalts$Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12oP84Bnq1'
),
6 => array(
- b'$5$rounds=77777$short',
- b'we have a short salt string but not a short password',
- b'$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/'
+ '$5$rounds=77777$short',
+ 'we have a short salt string but not a short password',
+ '$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/'
),
7 => array(
- b'$5$rounds=123456$asaltof16chars..',
- b'a short string',
- b'$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/cZKmF/wJvD'
+ '$5$rounds=123456$asaltof16chars..',
+ 'a short string',
+ '$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/cZKmF/wJvD'
),
8 => array(
- b'$5$rounds=10$roundstoolow',
- b'the minimum number is still observed',
- b'$5$rounds=1000$roundstoolow$yfvwcWrQ8l/K0DAWyuPMDNHpIVlTQebY9l/gL972bIC'
+ '$5$rounds=10$roundstoolow',
+ 'the minimum number is still observed',
+ '$5$rounds=1000$roundstoolow$yfvwcWrQ8l/K0DAWyuPMDNHpIVlTQebY9l/gL972bIC'
)
);
diff --git a/ext/standard/tests/strings/crypt_sha512.phpt b/ext/standard/tests/strings/crypt_sha512.phpt
index d6f9df6013..3d51f4aafa 100644
--- a/ext/standard/tests/strings/crypt_sha512.phpt
+++ b/ext/standard/tests/strings/crypt_sha512.phpt
@@ -11,44 +11,44 @@ if (!function_exists('crypt') || !defined("CRYPT_SHA512")) {
$tests = array(
1 => array(
- b'$6$saltstring',
- b'Hello world!',
- b'$6$saltstring$svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3uBnIFNjnQJuesI68u4OTLiBFdcbYEdFCoEOfaS35inz1'
+ '$6$saltstring',
+ 'Hello world!',
+ '$6$saltstring$svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3uBnIFNjnQJuesI68u4OTLiBFdcbYEdFCoEOfaS35inz1'
),
2 => array(
- b'$6$rounds=10000$saltstringsaltstring',
- b'Hello world!',
- b'$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sbHbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v.'
+ '$6$rounds=10000$saltstringsaltstring',
+ 'Hello world!',
+ '$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sbHbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v.'
),
3 => array(
- b'$6$rounds=5000$toolongsaltstring',
- b'This is just a test',
- b'$6$rounds=5000$toolongsaltstrin$lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQzQ3glMhwllF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0'
+ '$6$rounds=5000$toolongsaltstring',
+ 'This is just a test',
+ '$6$rounds=5000$toolongsaltstrin$lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQzQ3glMhwllF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0'
),
4 => array(
- b'$6$rounds=1400$anotherlongsaltstring',
- b'a very much longer text to encrypt. This one even stretches over morethan one line.',
- b'$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wPvMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1'
+ '$6$rounds=1400$anotherlongsaltstring',
+ 'a very much longer text to encrypt. This one even stretches over morethan one line.',
+ '$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wPvMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1'
),
5 => array(
- b'$6$rounds=77777$short',
- b'we have a short salt string but not a short password',
- b'$6$rounds=77777$short$WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr0gge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0'
+ '$6$rounds=77777$short',
+ 'we have a short salt string but not a short password',
+ '$6$rounds=77777$short$WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr0gge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0'
),
6 => array(
- b'$6$rounds=123456$asaltof16chars..',
- b'a short string',
- b'$6$rounds=123456$asaltof16chars..$BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwcelCjmw2kSYu.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1'
+ '$6$rounds=123456$asaltof16chars..',
+ 'a short string',
+ '$6$rounds=123456$asaltof16chars..$BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwcelCjmw2kSYu.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1'
),
7 => array(
- b'$6$rounds=10$roundstoolow',
- b'the minimum number is still observed',
- b'$6$rounds=1000$roundstoolow$kUMsbe306n21p9R.FRkW3IGn.S9NPN0x50YhH1xhLsPuWGsUSklZt58jaTfF4ZEQpyUNGc0dqbpBYYBaHHrsX.'
+ '$6$rounds=10$roundstoolow',
+ 'the minimum number is still observed',
+ '$6$rounds=1000$roundstoolow$kUMsbe306n21p9R.FRkW3IGn.S9NPN0x50YhH1xhLsPuWGsUSklZt58jaTfF4ZEQpyUNGc0dqbpBYYBaHHrsX.'
),
8 => array(
- b'$6$$bar$',
- b'foo',
- b'$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu.'
+ '$6$$bar$',
+ 'foo',
+ '$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu.'
),
);
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic1.phpt b/ext/standard/tests/strings/get_html_translation_table_basic1.phpt
index 87857d9cbd..83892a381a 100644
--- a/ext/standard/tests/strings/get_html_translation_table_basic1.phpt
+++ b/ext/standard/tests/strings/get_html_translation_table_basic1.phpt
@@ -1,549 +1,549 @@
---TEST--
-Test get_html_translation_table() function : basic functionality - with default args
---FILE--
-<?php
-/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
- * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
- * Source code: ext/standard/html.c
-*/
-
-/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */
-
-
-echo "*** Testing get_html_translation_table() : basic functionality ***\n";
-
-echo "-- with table = HTML_ENTITIES --\n";
-$table = HTML_ENTITIES;
-$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
-asort($tt);
-var_dump( $tt );
-
-echo "-- with table = HTML_SPECIALCHARS --\n";
-$table = HTML_SPECIALCHARS;
-$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
-asort($tt);
-var_dump( $tt );
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing get_html_translation_table() : basic functionality ***
--- with table = HTML_ENTITIES --
-array(252) {
- ["Æ"]=>
- string(7) "&AElig;"
- ["Ã"]=>
- string(8) "&Aacute;"
- ["Â"]=>
- string(7) "&Acirc;"
- ["À"]=>
- string(8) "&Agrave;"
- ["Α"]=>
- string(7) "&Alpha;"
- ["Ã…"]=>
- string(7) "&Aring;"
- ["Ã"]=>
- string(8) "&Atilde;"
- ["Ä"]=>
- string(6) "&Auml;"
- ["Î’"]=>
- string(6) "&Beta;"
- ["Ç"]=>
- string(8) "&Ccedil;"
- ["Χ"]=>
- string(5) "&Chi;"
- ["‡"]=>
- string(8) "&Dagger;"
- ["Δ"]=>
- string(7) "&Delta;"
- ["Ã"]=>
- string(5) "&ETH;"
- ["É"]=>
- string(8) "&Eacute;"
- ["Ê"]=>
- string(7) "&Ecirc;"
- ["È"]=>
- string(8) "&Egrave;"
- ["Ε"]=>
- string(9) "&Epsilon;"
- ["Η"]=>
- string(5) "&Eta;"
- ["Ë"]=>
- string(6) "&Euml;"
- ["Γ"]=>
- string(7) "&Gamma;"
- ["Ã"]=>
- string(8) "&Iacute;"
- ["ÃŽ"]=>
- string(7) "&Icirc;"
- ["Ì"]=>
- string(8) "&Igrave;"
- ["Ι"]=>
- string(6) "&Iota;"
- ["Ã"]=>
- string(6) "&Iuml;"
- ["Κ"]=>
- string(7) "&Kappa;"
- ["Λ"]=>
- string(8) "&Lambda;"
- ["Μ"]=>
- string(4) "&Mu;"
- ["Ñ"]=>
- string(8) "&Ntilde;"
- ["Î"]=>
- string(4) "&Nu;"
- ["Å’"]=>
- string(7) "&OElig;"
- ["Ó"]=>
- string(8) "&Oacute;"
- ["Ô"]=>
- string(7) "&Ocirc;"
- ["Ã’"]=>
- string(8) "&Ograve;"
- ["Ω"]=>
- string(7) "&Omega;"
- ["Ο"]=>
- string(9) "&Omicron;"
- ["Ø"]=>
- string(8) "&Oslash;"
- ["Õ"]=>
- string(8) "&Otilde;"
- ["Ö"]=>
- string(6) "&Ouml;"
- ["Φ"]=>
- string(5) "&Phi;"
- ["Π"]=>
- string(4) "&Pi;"
- ["″"]=>
- string(7) "&Prime;"
- ["Ψ"]=>
- string(5) "&Psi;"
- ["Ρ"]=>
- string(5) "&Rho;"
- ["Å "]=>
- string(8) "&Scaron;"
- ["Σ"]=>
- string(7) "&Sigma;"
- ["Þ"]=>
- string(7) "&THORN;"
- ["Τ"]=>
- string(5) "&Tau;"
- ["Θ"]=>
- string(7) "&Theta;"
- ["Ú"]=>
- string(8) "&Uacute;"
- ["Û"]=>
- string(7) "&Ucirc;"
- ["Ù"]=>
- string(8) "&Ugrave;"
- ["Î¥"]=>
- string(9) "&Upsilon;"
- ["Ü"]=>
- string(6) "&Uuml;"
- ["Ξ"]=>
- string(4) "&Xi;"
- ["Ã"]=>
- string(8) "&Yacute;"
- ["Ÿ"]=>
- string(6) "&Yuml;"
- ["Ζ"]=>
- string(6) "&Zeta;"
- ["á"]=>
- string(8) "&aacute;"
- ["â"]=>
- string(7) "&acirc;"
- ["´"]=>
- string(7) "&acute;"
- ["æ"]=>
- string(7) "&aelig;"
- ["à"]=>
- string(8) "&agrave;"
- ["ℵ"]=>
- string(9) "&alefsym;"
- ["α"]=>
- string(7) "&alpha;"
- ["&"]=>
- string(5) "&amp;"
- ["∧"]=>
- string(5) "&and;"
- ["∠"]=>
- string(5) "&ang;"
- ["Ã¥"]=>
- string(7) "&aring;"
- ["≈"]=>
- string(7) "&asymp;"
- ["ã"]=>
- string(8) "&atilde;"
- ["ä"]=>
- string(6) "&auml;"
- ["„"]=>
- string(7) "&bdquo;"
- ["β"]=>
- string(6) "&beta;"
- ["¦"]=>
- string(8) "&brvbar;"
- ["•"]=>
- string(6) "&bull;"
- ["∩"]=>
- string(5) "&cap;"
- ["ç"]=>
- string(8) "&ccedil;"
- ["¸"]=>
- string(7) "&cedil;"
- ["¢"]=>
- string(6) "&cent;"
- ["χ"]=>
- string(5) "&chi;"
- ["ˆ"]=>
- string(6) "&circ;"
- ["♣"]=>
- string(7) "&clubs;"
- ["≅"]=>
- string(6) "&cong;"
- ["©"]=>
- string(6) "&copy;"
- ["↵"]=>
- string(7) "&crarr;"
- ["∪"]=>
- string(5) "&cup;"
- ["¤"]=>
- string(8) "&curren;"
- ["⇓"]=>
- string(6) "&dArr;"
- ["†"]=>
- string(8) "&dagger;"
- ["↓"]=>
- string(6) "&darr;"
- ["°"]=>
- string(5) "&deg;"
- ["δ"]=>
- string(7) "&delta;"
- ["♦"]=>
- string(7) "&diams;"
- ["÷"]=>
- string(8) "&divide;"
- ["é"]=>
- string(8) "&eacute;"
- ["ê"]=>
- string(7) "&ecirc;"
- ["è"]=>
- string(8) "&egrave;"
- ["∅"]=>
- string(7) "&empty;"
- [" "]=>
- string(6) "&emsp;"
- [" "]=>
- string(6) "&ensp;"
- ["ε"]=>
- string(9) "&epsilon;"
- ["≡"]=>
- string(7) "&equiv;"
- ["η"]=>
- string(5) "&eta;"
- ["ð"]=>
- string(5) "&eth;"
- ["ë"]=>
- string(6) "&euml;"
- ["€"]=>
- string(6) "&euro;"
- ["∃"]=>
- string(7) "&exist;"
- ["Æ’"]=>
- string(6) "&fnof;"
- ["∀"]=>
- string(8) "&forall;"
- ["½"]=>
- string(8) "&frac12;"
- ["¼"]=>
- string(8) "&frac14;"
- ["¾"]=>
- string(8) "&frac34;"
- ["â„"]=>
- string(7) "&frasl;"
- ["γ"]=>
- string(7) "&gamma;"
- ["≥"]=>
- string(4) "&ge;"
- [">"]=>
- string(4) "&gt;"
- ["⇔"]=>
- string(6) "&hArr;"
- ["↔"]=>
- string(6) "&harr;"
- ["♥"]=>
- string(8) "&hearts;"
- ["…"]=>
- string(8) "&hellip;"
- ["í"]=>
- string(8) "&iacute;"
- ["î"]=>
- string(7) "&icirc;"
- ["¡"]=>
- string(7) "&iexcl;"
- ["ì"]=>
- string(8) "&igrave;"
- ["â„‘"]=>
- string(7) "&image;"
- ["∞"]=>
- string(7) "&infin;"
- ["∫"]=>
- string(5) "&int;"
- ["ι"]=>
- string(6) "&iota;"
- ["¿"]=>
- string(8) "&iquest;"
- ["∈"]=>
- string(6) "&isin;"
- ["ï"]=>
- string(6) "&iuml;"
- ["κ"]=>
- string(7) "&kappa;"
- ["â‡"]=>
- string(6) "&lArr;"
- ["λ"]=>
- string(8) "&lambda;"
- ["〈"]=>
- string(6) "&lang;"
- ["«"]=>
- string(7) "&laquo;"
- ["â†"]=>
- string(6) "&larr;"
- ["⌈"]=>
- string(7) "&lceil;"
- ["“"]=>
- string(7) "&ldquo;"
- ["≤"]=>
- string(4) "&le;"
- ["⌊"]=>
- string(8) "&lfloor;"
- ["∗"]=>
- string(8) "&lowast;"
- ["â—Š"]=>
- string(5) "&loz;"
- ["‎"]=>
- string(5) "&lrm;"
- ["‹"]=>
- string(8) "&lsaquo;"
- ["‘"]=>
- string(7) "&lsquo;"
- ["<"]=>
- string(4) "&lt;"
- ["¯"]=>
- string(6) "&macr;"
- ["—"]=>
- string(7) "&mdash;"
- ["µ"]=>
- string(7) "&micro;"
- ["·"]=>
- string(8) "&middot;"
- ["−"]=>
- string(7) "&minus;"
- ["μ"]=>
- string(4) "&mu;"
- ["∇"]=>
- string(7) "&nabla;"
- [" "]=>
- string(6) "&nbsp;"
- ["–"]=>
- string(7) "&ndash;"
- ["≠"]=>
- string(4) "&ne;"
- ["∋"]=>
- string(4) "&ni;"
- ["¬"]=>
- string(5) "&not;"
- ["∉"]=>
- string(7) "&notin;"
- ["⊄"]=>
- string(6) "&nsub;"
- ["ñ"]=>
- string(8) "&ntilde;"
- ["ν"]=>
- string(4) "&nu;"
- ["ó"]=>
- string(8) "&oacute;"
- ["ô"]=>
- string(7) "&ocirc;"
- ["Å“"]=>
- string(7) "&oelig;"
- ["ò"]=>
- string(8) "&ograve;"
- ["‾"]=>
- string(7) "&oline;"
- ["ω"]=>
- string(7) "&omega;"
- ["ο"]=>
- string(9) "&omicron;"
- ["⊕"]=>
- string(7) "&oplus;"
- ["∨"]=>
- string(4) "&or;"
- ["ª"]=>
- string(6) "&ordf;"
- ["º"]=>
- string(6) "&ordm;"
- ["ø"]=>
- string(8) "&oslash;"
- ["õ"]=>
- string(8) "&otilde;"
- ["⊗"]=>
- string(8) "&otimes;"
- ["ö"]=>
- string(6) "&ouml;"
- ["¶"]=>
- string(6) "&para;"
- ["∂"]=>
- string(6) "&part;"
- ["‰"]=>
- string(8) "&permil;"
- ["⊥"]=>
- string(6) "&perp;"
- ["φ"]=>
- string(5) "&phi;"
- ["Ï€"]=>
- string(4) "&pi;"
- ["Ï–"]=>
- string(5) "&piv;"
- ["±"]=>
- string(8) "&plusmn;"
- ["£"]=>
- string(7) "&pound;"
- ["′"]=>
- string(7) "&prime;"
- ["âˆ"]=>
- string(6) "&prod;"
- ["âˆ"]=>
- string(6) "&prop;"
- ["ψ"]=>
- string(5) "&psi;"
- ["""]=>
- string(6) "&quot;"
- ["⇒"]=>
- string(6) "&rArr;"
- ["√"]=>
- string(7) "&radic;"
- ["〉"]=>
- string(6) "&rang;"
- ["»"]=>
- string(7) "&raquo;"
- ["→"]=>
- string(6) "&rarr;"
- ["⌉"]=>
- string(7) "&rceil;"
- ["â€"]=>
- string(7) "&rdquo;"
- ["ℜ"]=>
- string(6) "&real;"
- ["®"]=>
- string(5) "&reg;"
- ["⌋"]=>
- string(8) "&rfloor;"
- ["Ï"]=>
- string(5) "&rho;"
- ["â€"]=>
- string(5) "&rlm;"
- ["›"]=>
- string(8) "&rsaquo;"
- ["’"]=>
- string(7) "&rsquo;"
- ["‚"]=>
- string(7) "&sbquo;"
- ["Å¡"]=>
- string(8) "&scaron;"
- ["â‹…"]=>
- string(6) "&sdot;"
- ["§"]=>
- string(6) "&sect;"
- ["­"]=>
- string(5) "&shy;"
- ["σ"]=>
- string(7) "&sigma;"
- ["Ï‚"]=>
- string(8) "&sigmaf;"
- ["∼"]=>
- string(5) "&sim;"
- ["â™ "]=>
- string(8) "&spades;"
- ["⊂"]=>
- string(5) "&sub;"
- ["⊆"]=>
- string(6) "&sube;"
- ["∑"]=>
- string(5) "&sum;"
- ["¹"]=>
- string(6) "&sup1;"
- ["²"]=>
- string(6) "&sup2;"
- ["³"]=>
- string(6) "&sup3;"
- ["⊃"]=>
- string(5) "&sup;"
- ["⊇"]=>
- string(6) "&supe;"
- ["ß"]=>
- string(7) "&szlig;"
- ["Ï„"]=>
- string(5) "&tau;"
- ["∴"]=>
- string(8) "&there4;"
- ["θ"]=>
- string(7) "&theta;"
- ["Ï‘"]=>
- string(10) "&thetasym;"
- [" "]=>
- string(8) "&thinsp;"
- ["þ"]=>
- string(7) "&thorn;"
- ["˜"]=>
- string(7) "&tilde;"
- ["×"]=>
- string(7) "&times;"
- ["â„¢"]=>
- string(7) "&trade;"
- ["⇑"]=>
- string(6) "&uArr;"
- ["ú"]=>
- string(8) "&uacute;"
- ["↑"]=>
- string(6) "&uarr;"
- ["û"]=>
- string(7) "&ucirc;"
- ["ù"]=>
- string(8) "&ugrave;"
- ["¨"]=>
- string(5) "&uml;"
- ["Ï’"]=>
- string(7) "&upsih;"
- ["Ï…"]=>
- string(9) "&upsilon;"
- ["ü"]=>
- string(6) "&uuml;"
- ["℘"]=>
- string(8) "&weierp;"
- ["ξ"]=>
- string(4) "&xi;"
- ["ý"]=>
- string(8) "&yacute;"
- ["Â¥"]=>
- string(5) "&yen;"
- ["ÿ"]=>
- string(6) "&yuml;"
- ["ζ"]=>
- string(6) "&zeta;"
- ["â€"]=>
- string(5) "&zwj;"
- ["‌"]=>
- string(6) "&zwnj;"
-}
--- with table = HTML_SPECIALCHARS --
-array(4) {
- ["&"]=>
- string(5) "&amp;"
- [">"]=>
- string(4) "&gt;"
- ["<"]=>
- string(4) "&lt;"
- ["""]=>
- string(6) "&quot;"
-}
-Done
+--TEST--
+Test get_html_translation_table() function : basic functionality - with default args
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */
+
+
+echo "*** Testing get_html_translation_table() : basic functionality ***\n";
+
+echo "-- with table = HTML_ENTITIES --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
+asort($tt);
+var_dump( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
+asort($tt);
+var_dump( $tt );
+
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing get_html_translation_table() : basic functionality ***
+-- with table = HTML_ENTITIES --
+array(252) {
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ã"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Α"]=>
+ string(7) "&Alpha;"
+ ["Ã…"]=>
+ string(7) "&Aring;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Î’"]=>
+ string(6) "&Beta;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["Χ"]=>
+ string(5) "&Chi;"
+ ["‡"]=>
+ string(8) "&Dagger;"
+ ["Δ"]=>
+ string(7) "&Delta;"
+ ["Ã"]=>
+ string(5) "&ETH;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["Ε"]=>
+ string(9) "&Epsilon;"
+ ["Η"]=>
+ string(5) "&Eta;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Γ"]=>
+ string(7) "&Gamma;"
+ ["Ã"]=>
+ string(8) "&Iacute;"
+ ["ÃŽ"]=>
+ string(7) "&Icirc;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Ι"]=>
+ string(6) "&Iota;"
+ ["Ã"]=>
+ string(6) "&Iuml;"
+ ["Κ"]=>
+ string(7) "&Kappa;"
+ ["Λ"]=>
+ string(8) "&Lambda;"
+ ["Μ"]=>
+ string(4) "&Mu;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Î"]=>
+ string(4) "&Nu;"
+ ["Å’"]=>
+ string(7) "&OElig;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Ã’"]=>
+ string(8) "&Ograve;"
+ ["Ω"]=>
+ string(7) "&Omega;"
+ ["Ο"]=>
+ string(9) "&Omicron;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["Φ"]=>
+ string(5) "&Phi;"
+ ["Π"]=>
+ string(4) "&Pi;"
+ ["″"]=>
+ string(7) "&Prime;"
+ ["Ψ"]=>
+ string(5) "&Psi;"
+ ["Ρ"]=>
+ string(5) "&Rho;"
+ ["Å "]=>
+ string(8) "&Scaron;"
+ ["Σ"]=>
+ string(7) "&Sigma;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["Τ"]=>
+ string(5) "&Tau;"
+ ["Θ"]=>
+ string(7) "&Theta;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Î¥"]=>
+ string(9) "&Upsilon;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ξ"]=>
+ string(4) "&Xi;"
+ ["Ã"]=>
+ string(8) "&Yacute;"
+ ["Ÿ"]=>
+ string(6) "&Yuml;"
+ ["Ζ"]=>
+ string(6) "&Zeta;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["ℵ"]=>
+ string(9) "&alefsym;"
+ ["α"]=>
+ string(7) "&alpha;"
+ ["&"]=>
+ string(5) "&amp;"
+ ["∧"]=>
+ string(5) "&and;"
+ ["∠"]=>
+ string(5) "&ang;"
+ ["Ã¥"]=>
+ string(7) "&aring;"
+ ["≈"]=>
+ string(7) "&asymp;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["„"]=>
+ string(7) "&bdquo;"
+ ["β"]=>
+ string(6) "&beta;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["•"]=>
+ string(6) "&bull;"
+ ["∩"]=>
+ string(5) "&cap;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["χ"]=>
+ string(5) "&chi;"
+ ["ˆ"]=>
+ string(6) "&circ;"
+ ["♣"]=>
+ string(7) "&clubs;"
+ ["≅"]=>
+ string(6) "&cong;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["↵"]=>
+ string(7) "&crarr;"
+ ["∪"]=>
+ string(5) "&cup;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["⇓"]=>
+ string(6) "&dArr;"
+ ["†"]=>
+ string(8) "&dagger;"
+ ["↓"]=>
+ string(6) "&darr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["δ"]=>
+ string(7) "&delta;"
+ ["♦"]=>
+ string(7) "&diams;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["∅"]=>
+ string(7) "&empty;"
+ [" "]=>
+ string(6) "&emsp;"
+ [" "]=>
+ string(6) "&ensp;"
+ ["ε"]=>
+ string(9) "&epsilon;"
+ ["≡"]=>
+ string(7) "&equiv;"
+ ["η"]=>
+ string(5) "&eta;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["€"]=>
+ string(6) "&euro;"
+ ["∃"]=>
+ string(7) "&exist;"
+ ["Æ’"]=>
+ string(6) "&fnof;"
+ ["∀"]=>
+ string(8) "&forall;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["â„"]=>
+ string(7) "&frasl;"
+ ["γ"]=>
+ string(7) "&gamma;"
+ ["≥"]=>
+ string(4) "&ge;"
+ [">"]=>
+ string(4) "&gt;"
+ ["⇔"]=>
+ string(6) "&hArr;"
+ ["↔"]=>
+ string(6) "&harr;"
+ ["♥"]=>
+ string(8) "&hearts;"
+ ["…"]=>
+ string(8) "&hellip;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["â„‘"]=>
+ string(7) "&image;"
+ ["∞"]=>
+ string(7) "&infin;"
+ ["∫"]=>
+ string(5) "&int;"
+ ["ι"]=>
+ string(6) "&iota;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["∈"]=>
+ string(6) "&isin;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["κ"]=>
+ string(7) "&kappa;"
+ ["â‡"]=>
+ string(6) "&lArr;"
+ ["λ"]=>
+ string(8) "&lambda;"
+ ["〈"]=>
+ string(6) "&lang;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["â†"]=>
+ string(6) "&larr;"
+ ["⌈"]=>
+ string(7) "&lceil;"
+ ["“"]=>
+ string(7) "&ldquo;"
+ ["≤"]=>
+ string(4) "&le;"
+ ["⌊"]=>
+ string(8) "&lfloor;"
+ ["∗"]=>
+ string(8) "&lowast;"
+ ["â—Š"]=>
+ string(5) "&loz;"
+ ["‎"]=>
+ string(5) "&lrm;"
+ ["‹"]=>
+ string(8) "&lsaquo;"
+ ["‘"]=>
+ string(7) "&lsquo;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["—"]=>
+ string(7) "&mdash;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["−"]=>
+ string(7) "&minus;"
+ ["μ"]=>
+ string(4) "&mu;"
+ ["∇"]=>
+ string(7) "&nabla;"
+ [" "]=>
+ string(6) "&nbsp;"
+ ["–"]=>
+ string(7) "&ndash;"
+ ["≠"]=>
+ string(4) "&ne;"
+ ["∋"]=>
+ string(4) "&ni;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["∉"]=>
+ string(7) "&notin;"
+ ["⊄"]=>
+ string(6) "&nsub;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ν"]=>
+ string(4) "&nu;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["Å“"]=>
+ string(7) "&oelig;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["‾"]=>
+ string(7) "&oline;"
+ ["ω"]=>
+ string(7) "&omega;"
+ ["ο"]=>
+ string(9) "&omicron;"
+ ["⊕"]=>
+ string(7) "&oplus;"
+ ["∨"]=>
+ string(4) "&or;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["⊗"]=>
+ string(8) "&otimes;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["∂"]=>
+ string(6) "&part;"
+ ["‰"]=>
+ string(8) "&permil;"
+ ["⊥"]=>
+ string(6) "&perp;"
+ ["φ"]=>
+ string(5) "&phi;"
+ ["Ï€"]=>
+ string(4) "&pi;"
+ ["Ï–"]=>
+ string(5) "&piv;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["′"]=>
+ string(7) "&prime;"
+ ["âˆ"]=>
+ string(6) "&prod;"
+ ["âˆ"]=>
+ string(6) "&prop;"
+ ["ψ"]=>
+ string(5) "&psi;"
+ ["""]=>
+ string(6) "&quot;"
+ ["⇒"]=>
+ string(6) "&rArr;"
+ ["√"]=>
+ string(7) "&radic;"
+ ["〉"]=>
+ string(6) "&rang;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["→"]=>
+ string(6) "&rarr;"
+ ["⌉"]=>
+ string(7) "&rceil;"
+ ["â€"]=>
+ string(7) "&rdquo;"
+ ["ℜ"]=>
+ string(6) "&real;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["⌋"]=>
+ string(8) "&rfloor;"
+ ["Ï"]=>
+ string(5) "&rho;"
+ ["â€"]=>
+ string(5) "&rlm;"
+ ["›"]=>
+ string(8) "&rsaquo;"
+ ["’"]=>
+ string(7) "&rsquo;"
+ ["‚"]=>
+ string(7) "&sbquo;"
+ ["Å¡"]=>
+ string(8) "&scaron;"
+ ["â‹…"]=>
+ string(6) "&sdot;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["σ"]=>
+ string(7) "&sigma;"
+ ["Ï‚"]=>
+ string(8) "&sigmaf;"
+ ["∼"]=>
+ string(5) "&sim;"
+ ["â™ "]=>
+ string(8) "&spades;"
+ ["⊂"]=>
+ string(5) "&sub;"
+ ["⊆"]=>
+ string(6) "&sube;"
+ ["∑"]=>
+ string(5) "&sum;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["⊃"]=>
+ string(5) "&sup;"
+ ["⊇"]=>
+ string(6) "&supe;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["Ï„"]=>
+ string(5) "&tau;"
+ ["∴"]=>
+ string(8) "&there4;"
+ ["θ"]=>
+ string(7) "&theta;"
+ ["Ï‘"]=>
+ string(10) "&thetasym;"
+ [" "]=>
+ string(8) "&thinsp;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["˜"]=>
+ string(7) "&tilde;"
+ ["×"]=>
+ string(7) "&times;"
+ ["â„¢"]=>
+ string(7) "&trade;"
+ ["⇑"]=>
+ string(6) "&uArr;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["↑"]=>
+ string(6) "&uarr;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["Ï’"]=>
+ string(7) "&upsih;"
+ ["Ï…"]=>
+ string(9) "&upsilon;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["℘"]=>
+ string(8) "&weierp;"
+ ["ξ"]=>
+ string(4) "&xi;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["Â¥"]=>
+ string(5) "&yen;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["ζ"]=>
+ string(6) "&zeta;"
+ ["â€"]=>
+ string(5) "&zwj;"
+ ["‌"]=>
+ string(6) "&zwnj;"
+}
+-- with table = HTML_SPECIALCHARS --
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+Done
diff --git a/ext/standard/tests/strings/htmlentities-utf-2.phpt b/ext/standard/tests/strings/htmlentities-utf-2.phpt
index d515dc0ff1..81c974cbf8 100644
--- a/ext/standard/tests/strings/htmlentities-utf-2.phpt
+++ b/ext/standard/tests/strings/htmlentities-utf-2.phpt
@@ -5,10 +5,10 @@ output_handler=
--FILE--
<?php
@setlocale (LC_CTYPE, "C");
-$strings = array(b"<", b"\xD0", b"\xD0\x90", b"\xD0\x90\xD0", b"\xD0\x90\xD0\xB0", b"\xE0", b"A\xE0", b"\xE0\x80", b"\xE0\x79", b"\xE0\x80\xBE",
- b"Voil\xE0", b"Clich\xE9s",
- b"\xFE", b"\xFE\x41", b"\xC3\xA9", b"\xC3\x79", b"\xF7\xBF\xBF\xBF", b"\xFB\xBF\xBF\xBF\xBF", b"\xFD\xBF\xBF\xBF\xBF\xBF",
- b"\x41\xF7\xF7\x42", b"\x42\xFB\xFB\x42", b"\x43\xFD\xFD\x42", b"\x44\xF7\xF7", b"\x45\xFB\xFB", b"\x46\xFD\xFD"
+$strings = array("<", "\xD0", "\xD0\x90", "\xD0\x90\xD0", "\xD0\x90\xD0\xB0", "\xE0", "A\xE0", "\xE0\x80", "\xE0\x79", "\xE0\x80\xBE",
+ "Voil\xE0", "Clich\xE9s",
+ "\xFE", "\xFE\x41", "\xC3\xA9", "\xC3\x79", "\xF7\xBF\xBF\xBF", "\xFB\xBF\xBF\xBF\xBF", "\xFD\xBF\xBF\xBF\xBF\xBF",
+ "\x41\xF7\xF7\x42", "\x42\xFB\xFB\x42", "\x43\xFD\xFD\x42", "\x44\xF7\xF7", "\x45\xFB\xFB", "\x46\xFD\xFD"
);
foreach($strings as $string) {
$sc_encoded = htmlspecialchars ($string, ENT_QUOTES | ENT_IGNORE, "utf-8");
@@ -18,53 +18,53 @@ foreach($strings as $string) {
}
?>
--EXPECTF--
-%unicode|string%(8) "266c743b"
-%unicode|string%(8) "266c743b"
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(4) "d090"
-%unicode|string%(4) "d090"
-%unicode|string%(4) "d090"
-%unicode|string%(4) "d090"
-%unicode|string%(8) "d090d0b0"
-%unicode|string%(8) "d090d0b0"
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(2) "41"
-%unicode|string%(2) "41"
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(2) "79"
-%unicode|string%(2) "79"
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(8) "566f696c"
-%unicode|string%(8) "566f696c"
-%unicode|string%(12) "436c69636873"
-%unicode|string%(12) "436c69636873"
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(2) "41"
-%unicode|string%(2) "41"
-%unicode|string%(4) "c3a9"
-%unicode|string%(16) "266561637574653b"
-%unicode|string%(2) "79"
-%unicode|string%(2) "79"
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(4) "4142"
-%unicode|string%(4) "4142"
-%unicode|string%(4) "4242"
-%unicode|string%(4) "4242"
-%unicode|string%(4) "4342"
-%unicode|string%(4) "4342"
-%unicode|string%(2) "44"
-%unicode|string%(2) "44"
-%unicode|string%(2) "45"
-%unicode|string%(2) "45"
-%unicode|string%(2) "46"
-%unicode|string%(2) "46"
+string(8) "266c743b"
+string(8) "266c743b"
+string(0) ""
+string(0) ""
+string(4) "d090"
+string(4) "d090"
+string(4) "d090"
+string(4) "d090"
+string(8) "d090d0b0"
+string(8) "d090d0b0"
+string(0) ""
+string(0) ""
+string(2) "41"
+string(2) "41"
+string(0) ""
+string(0) ""
+string(2) "79"
+string(2) "79"
+string(0) ""
+string(0) ""
+string(8) "566f696c"
+string(8) "566f696c"
+string(12) "436c69636873"
+string(12) "436c69636873"
+string(0) ""
+string(0) ""
+string(2) "41"
+string(2) "41"
+string(4) "c3a9"
+string(16) "266561637574653b"
+string(2) "79"
+string(2) "79"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "4142"
+string(4) "4142"
+string(4) "4242"
+string(4) "4242"
+string(4) "4342"
+string(4) "4342"
+string(2) "44"
+string(2) "44"
+string(2) "45"
+string(2) "45"
+string(2) "46"
+string(2) "46"
diff --git a/ext/standard/tests/strings/htmlentities-utf-3.phpt b/ext/standard/tests/strings/htmlentities-utf-3.phpt
index c28917ba16..82693056ef 100644
--- a/ext/standard/tests/strings/htmlentities-utf-3.phpt
+++ b/ext/standard/tests/strings/htmlentities-utf-3.phpt
@@ -1,83 +1,83 @@
---TEST--
-Test get_next_char(), used by htmlentities()/htmlspecialchars(): validity of UTF-8 sequences
---FILE--
-<?php
-
-/* conformance to Unicode 5.2, section 3.9, D92 */
-
-$val_ranges = array(
- array(array(0x00, 0x7F)),
- array(array(0xC2, 0xDF), array(0x80, 0xBF)),
- array(array(0xE0, 0xE0), array(0xA0, 0xBF), array(0x80, 0xBF)),
- array(array(0xE1, 0xEC), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xED, 0xED), array(0x80, 0x9F), array(0x80, 0xBF)),
- array(array(0xEE, 0xEF), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xF0, 0xF0), array(0x90, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xF1, 0xF3), array(0x80, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xF4, 0xF4), array(0x80, 0x8F), array(0x80, 0xBF), array(0x80, 0xBF)),
-);
-
-function is_valid($seq) {
- global $val_ranges;
- $b = ord($seq[0]);
- foreach ($val_ranges as $l) {
- if ($b >= $l[0][0] && $b <= $l[0][1]) {
- if (count($l) != strlen($seq)) {
- return false;
- }
- for ($n = 1; $n < strlen($seq); $n++) {
- if (ord($seq[$n]) < $l[$n][0] || ord($seq[$n]) > $l[$n][1]) {
- return false;
- }
- }
- return true;
- }
- }
- return false;
-}
-
-function concordance($s) {
- $vhe = strlen(htmlspecialchars($s, ENT_QUOTES, "UTF-8")) > 0;
- $v = is_valid($s);
- return ($vhe === $v);
-}
-
-for ($b1 = 0xC0; $b1 < 0xE0; $b1++) {
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
- $s = chr($b1).chr($b2);
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- }
-}
-
-
-for ($b1 = 0xE0; $b1 < 0xEF; $b1++) {
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
- $s = chr($b1).chr($b2)."\x80";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\xBF";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- }
-}
-
-for ($b1 = 0xF0; $b1 < 0xFF; $b1++) {
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
- $s = chr($b1).chr($b2)."\x80\x80";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\xBF\x80";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\x80\xBF";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\xBF\xBF";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- }
-}
-echo "Done.\n";
---EXPECT--
-Done.
+--TEST--
+Test get_next_char(), used by htmlentities()/htmlspecialchars(): validity of UTF-8 sequences
+--FILE--
+<?php
+
+/* conformance to Unicode 5.2, section 3.9, D92 */
+
+$val_ranges = array(
+ array(array(0x00, 0x7F)),
+ array(array(0xC2, 0xDF), array(0x80, 0xBF)),
+ array(array(0xE0, 0xE0), array(0xA0, 0xBF), array(0x80, 0xBF)),
+ array(array(0xE1, 0xEC), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xED, 0xED), array(0x80, 0x9F), array(0x80, 0xBF)),
+ array(array(0xEE, 0xEF), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xF0, 0xF0), array(0x90, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xF1, 0xF3), array(0x80, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xF4, 0xF4), array(0x80, 0x8F), array(0x80, 0xBF), array(0x80, 0xBF)),
+);
+
+function is_valid($seq) {
+ global $val_ranges;
+ $b = ord($seq[0]);
+ foreach ($val_ranges as $l) {
+ if ($b >= $l[0][0] && $b <= $l[0][1]) {
+ if (count($l) != strlen($seq)) {
+ return false;
+ }
+ for ($n = 1; $n < strlen($seq); $n++) {
+ if (ord($seq[$n]) < $l[$n][0] || ord($seq[$n]) > $l[$n][1]) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+function concordance($s) {
+ $vhe = strlen(htmlspecialchars($s, ENT_QUOTES, "UTF-8")) > 0;
+ $v = is_valid($s);
+ return ($vhe === $v);
+}
+
+for ($b1 = 0xC0; $b1 < 0xE0; $b1++) {
+ for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
+ $s = chr($b1).chr($b2);
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ }
+}
+
+
+for ($b1 = 0xE0; $b1 < 0xEF; $b1++) {
+ for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
+ $s = chr($b1).chr($b2)."\x80";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\xBF";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ }
+}
+
+for ($b1 = 0xF0; $b1 < 0xFF; $b1++) {
+ for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
+ $s = chr($b1).chr($b2)."\x80\x80";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\xBF\x80";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\x80\xBF";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\xBF\xBF";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ }
+}
+echo "Done.\n";
+--EXPECT--
+Done.
diff --git a/ext/standard/tests/strings/htmlentities-utf.phpt b/ext/standard/tests/strings/htmlentities-utf.phpt
index 6a66e4df45..0dc5b8030c 100644
--- a/ext/standard/tests/strings/htmlentities-utf.phpt
+++ b/ext/standard/tests/strings/htmlentities-utf.phpt
@@ -5,10 +5,10 @@ output_handler=
--FILE--
<?php
@setlocale (LC_CTYPE, "C");
-$strings = array(b"<", b"\xD0", b"\xD0\x90", b"\xD0\x90\xD0", b"\xD0\x90\xD0\xB0", b"\xE0", b"A\xE0", b"\xE0\x80", b"\xE0\x79", b"\xE0\x80\xBE",
- b"Voil\xE0", b"Clich\xE9s",
- b"\xFE", b"\xFE\x41", b"\xC3\xA9", b"\xC3\x79", b"\xF7\xBF\xBF\xBF", b"\xFB\xBF\xBF\xBF\xBF", b"\xFD\xBF\xBF\xBF\xBF\xBF",
- b"\x41\xF7\xF7\x42", b"\x42\xFB\xFB\x42", b"\x43\xFD\xFD\x42", b"\x44\xF7\xF7", b"\x45\xFB\xFB", b"\x46\xFD\xFD"
+$strings = array("<", "\xD0", "\xD0\x90", "\xD0\x90\xD0", "\xD0\x90\xD0\xB0", "\xE0", "A\xE0", "\xE0\x80", "\xE0\x79", "\xE0\x80\xBE",
+ "Voil\xE0", "Clich\xE9s",
+ "\xFE", "\xFE\x41", "\xC3\xA9", "\xC3\x79", "\xF7\xBF\xBF\xBF", "\xFB\xBF\xBF\xBF\xBF", "\xFD\xBF\xBF\xBF\xBF\xBF",
+ "\x41\xF7\xF7\x42", "\x42\xFB\xFB\x42", "\x43\xFD\xFD\x42", "\x44\xF7\xF7", "\x45\xFB\xFB", "\x46\xFD\xFD"
);
foreach($strings as $string) {
$sc_encoded = htmlspecialchars ($string, ENT_QUOTES, "utf-8");
@@ -18,53 +18,53 @@ foreach($strings as $string) {
}
?>
--EXPECTF--
-%unicode|string%(8) "266c743b"
-%unicode|string%(8) "266c743b"
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(4) "d090"
-%unicode|string%(4) "d090"
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(8) "d090d0b0"
-%unicode|string%(8) "d090d0b0"
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(4) "c3a9"
-%unicode|string%(16) "266561637574653b"
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
-%unicode|string%(0) ""
+string(8) "266c743b"
+string(8) "266c743b"
+string(0) ""
+string(0) ""
+string(4) "d090"
+string(4) "d090"
+string(0) ""
+string(0) ""
+string(8) "d090d0b0"
+string(8) "d090d0b0"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c3a9"
+string(16) "266561637574653b"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
diff --git a/ext/standard/tests/strings/htmlentities01.phpt b/ext/standard/tests/strings/htmlentities01.phpt
index eb64b0a63b..4ab49472d1 100644
--- a/ext/standard/tests/strings/htmlentities01.phpt
+++ b/ext/standard/tests/strings/htmlentities01.phpt
@@ -5,8 +5,8 @@ output_handler=
mbstring.internal_encoding=pass
--FILE--
<?php
- var_dump(htmlentities(b"\x82\x86\x99\x9f", ENT_QUOTES, 'cp1252'));
- var_dump(htmlentities(b"\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, 'cp1252'));
+ var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, 'cp1252'));
+ var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, 'cp1252'));
?>
--EXPECT--
string(28) "&sbquo;&dagger;&trade;&Yuml;"
diff --git a/ext/standard/tests/strings/htmlentities24.phpt b/ext/standard/tests/strings/htmlentities24.phpt
index 3ffdd65a5f..51271bdddf 100644
--- a/ext/standard/tests/strings/htmlentities24.phpt
+++ b/ext/standard/tests/strings/htmlentities24.phpt
@@ -9,7 +9,7 @@ Test htmlentities() function
/* retrieving htmlentities from the ANSI character table */
echo "*** Retrieving htmlentities for 256 characters ***\n";
for($i=0; $i<256; $i++)
- var_dump( bin2hex( htmlentities(b"chr($i)")) );
+ var_dump( bin2hex( htmlentities("chr($i)")) );
/* giving arguments as NULL */
echo "\n*** Testing htmlentities() with NULL as first,second and third argument ***\n";
diff --git a/ext/standard/tests/strings/htmlspecialchars.phpt b/ext/standard/tests/strings/htmlspecialchars.phpt
index 5d741e5ecb..2c886b9af7 100644
--- a/ext/standard/tests/strings/htmlspecialchars.phpt
+++ b/ext/standard/tests/strings/htmlspecialchars.phpt
@@ -9,7 +9,7 @@ Test htmlspecialchars() function
/* retrieving htmlspecialchars from the ANSI character table */
echo "*** Retrieving htmlspecialchars for 256 characters ***\n";
for($i=0; $i<256; $i++)
-var_dump( bin2hex( htmlspecialchars(b"chr($i)") ) );
+var_dump( bin2hex( htmlspecialchars("chr($i)") ) );
/* giving NULL as the argument */
echo "\n*** Testing htmlspecialchars() with NULL as first, second and third argument ***\n";
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt
index fc3666ff65..7b1295c54e 100644
--- a/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/http_build_query_variation3.phpt b/ext/standard/tests/strings/http_build_query_variation3.phpt
index 107120e084..350f3c8661 100644
--- a/ext/standard/tests/strings/http_build_query_variation3.phpt
+++ b/ext/standard/tests/strings/http_build_query_variation3.phpt
@@ -2,10 +2,6 @@
Test http_build_query() function: usage variations - testing four parameter added in PHP 5.4.0
--CREDITS--
Adam Gegotek <adam [dot] gegotek [at] gmail [dot] com>
---SKIPIF--
-<?php
- if (version_compare(PHP_VERSION, '5.4.0', '<')) die("skip this test if PHP_VERSION is less than 5.4.0");
-?>
--FILE--
<?php
/* Prototype : string http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, int $enc_type = PHP_QUERY_RFC1738 ]]] )
diff --git a/ext/standard/tests/strings/implode.phpt b/ext/standard/tests/strings/implode.phpt
index 36be0f395c..330ba2ff30 100644
--- a/ext/standard/tests/strings/implode.phpt
+++ b/ext/standard/tests/strings/implode.phpt
@@ -1,10 +1,5 @@
--TEST--
implode() function
---INI--
-error_reporting=2047
-log_errors=0
-display_errors=0
-track_errors=1
--FILE--
<?php
echo implode(array())."\n";
@@ -12,12 +7,10 @@ echo implode('nothing', array())."\n";
echo implode(array('foo', 'bar', 'baz'))."\n";
echo implode(':', array('foo', 'bar', 'baz'))."\n";
echo implode(':', array('foo', array('bar', 'baz'), 'burp'))."\n";
-echo $php_errormsg."\n";
?>
--EXPECTF--
-
-
foobarbaz
foo:bar:baz
+
+Notice: Array to string conversion in %s on line %d
foo:Array:burp
-Array to string conversion
diff --git a/ext/standard/tests/strings/join_variation6.phpt b/ext/standard/tests/strings/join_variation6.phpt
index a627d77bf4..621b69521c 100644
--- a/ext/standard/tests/strings/join_variation6.phpt
+++ b/ext/standard/tests/strings/join_variation6.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt
index 5424c5018d..9451ea80a3 100644
--- a/ext/standard/tests/strings/lcfirst.phpt
+++ b/ext/standard/tests/strings/lcfirst.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/md5_basic1.phpt b/ext/standard/tests/strings/md5_basic1.phpt
index eda414bc25..af91ade73f 100644
--- a/ext/standard/tests/strings/md5_basic1.phpt
+++ b/ext/standard/tests/strings/md5_basic1.phpt
@@ -1,17 +1,17 @@
---TEST--
-Test md5() function : basic functionality
---FILE--
-<?php
-/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
- * Description: Calculate the md5 hash of a string
- * Source code: ext/standard/md5.c
-*/
-
-echo "*** Testing md5() : basic functionality ***\n";
-var_dump(md5(b"apple"));
-?>
-===DONE===
---EXPECTF--
-*** Testing md5() : basic functionality ***
-string(32) "1f3870be274f6c49b3e31a0c6728957f"
-===DONE===
+--TEST--
+Test md5() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
+ * Description: Calculate the md5 hash of a string
+ * Source code: ext/standard/md5.c
+*/
+
+echo "*** Testing md5() : basic functionality ***\n";
+var_dump(md5("apple"));
+?>
+===DONE===
+--EXPECTF--
+*** Testing md5() : basic functionality ***
+string(32) "1f3870be274f6c49b3e31a0c6728957f"
+===DONE===
diff --git a/ext/standard/tests/strings/md5_basic2.phpt b/ext/standard/tests/strings/md5_basic2.phpt
index 1f89ba82f5..7098dc41b5 100644
--- a/ext/standard/tests/strings/md5_basic2.phpt
+++ b/ext/standard/tests/strings/md5_basic2.phpt
@@ -1,30 +1,30 @@
---TEST--
-Test md5() function : basic functionality - with raw output
---FILE--
-<?php
-/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
- * Description: Calculate the md5 hash of a string
- * Source code: ext/standard/md5.c
-*/
-
-echo "*** Testing md5() : basic functionality - with raw output***\n";
-$str = b"Hello World";
-$md5_raw = md5($str, true);
-var_dump(bin2hex($md5_raw));
-
-$md5 = md5($str, false);
-
-if (strcmp(bin2hex($md5_raw), $md5) == 0 ) {
- echo "TEST PASSED\n";
-} else {
- echo "TEST FAILED\n";
- var_dump($md5_raw, $md5);
-}
-
-?>
-===DONE===
---EXPECT--
-*** Testing md5() : basic functionality - with raw output***
-string(32) "b10a8db164e0754105b7a99be72e3fe5"
-TEST PASSED
+--TEST--
+Test md5() function : basic functionality - with raw output
+--FILE--
+<?php
+/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
+ * Description: Calculate the md5 hash of a string
+ * Source code: ext/standard/md5.c
+*/
+
+echo "*** Testing md5() : basic functionality - with raw output***\n";
+$str = "Hello World";
+$md5_raw = md5($str, true);
+var_dump(bin2hex($md5_raw));
+
+$md5 = md5($str, false);
+
+if (strcmp(bin2hex($md5_raw), $md5) == 0 ) {
+ echo "TEST PASSED\n";
+} else {
+ echo "TEST FAILED\n";
+ var_dump($md5_raw, $md5);
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing md5() : basic functionality - with raw output***
+string(32) "b10a8db164e0754105b7a99be72e3fe5"
+TEST PASSED
===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/md5_error.phpt b/ext/standard/tests/strings/md5_error.phpt
index 190b09c8e5..dbdbdcb2a5 100644
--- a/ext/standard/tests/strings/md5_error.phpt
+++ b/ext/standard/tests/strings/md5_error.phpt
@@ -1,35 +1,35 @@
---TEST--
-Test md5() function : error conditions
---FILE--
-<?php
-/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
- * Description: Calculate the md5 hash of a string
- * Source code: ext/standard/md5.c
-*/
-
-echo "*** Testing md5() : error conditions ***\n";
-
-echo "\n-- Testing md5() function with no arguments --\n";
-var_dump( md5());
-
-echo "\n-- Testing md5() function with more than expected no. of arguments --\n";
-$str = "Hello World";
-$raw_output = true;
-$extra_arg = 10;
-
-var_dump(md5($str, $raw_output, $extra_arg));
-?>
-===DONE==
---EXPECTF--
-*** Testing md5() : error conditions ***
-
--- Testing md5() function with no arguments --
-
-Warning: md5() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing md5() function with more than expected no. of arguments --
-
-Warning: md5() expects at most 2 parameters, 3 given in %s on line %d
-NULL
+--TEST--
+Test md5() function : error conditions
+--FILE--
+<?php
+/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
+ * Description: Calculate the md5 hash of a string
+ * Source code: ext/standard/md5.c
+*/
+
+echo "*** Testing md5() : error conditions ***\n";
+
+echo "\n-- Testing md5() function with no arguments --\n";
+var_dump( md5());
+
+echo "\n-- Testing md5() function with more than expected no. of arguments --\n";
+$str = "Hello World";
+$raw_output = true;
+$extra_arg = 10;
+
+var_dump(md5($str, $raw_output, $extra_arg));
+?>
+===DONE==
+--EXPECTF--
+*** Testing md5() : error conditions ***
+
+-- Testing md5() function with no arguments --
+
+Warning: md5() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing md5() function with more than expected no. of arguments --
+
+Warning: md5() expects at most 2 parameters, 3 given in %s on line %d
+NULL
===DONE== \ No newline at end of file
diff --git a/ext/standard/tests/strings/parse_str_basic1.phpt b/ext/standard/tests/strings/parse_str_basic1.phpt
index 7a8fda80db..a1222814f7 100644
--- a/ext/standard/tests/strings/parse_str_basic1.phpt
+++ b/ext/standard/tests/strings/parse_str_basic1.phpt
@@ -36,6 +36,8 @@ var_dump($res3_array);
--EXPECTF--
*** Testing parse_str() : basic functionality ***
Basic test WITHOUT result arg
+
+Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d
NULL
string(4) "val1"
string(4) "val2"
@@ -73,4 +75,4 @@ array(3) {
["third"]=>
string(4) "val3"
}
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/standard/tests/strings/parse_str_basic2.phpt b/ext/standard/tests/strings/parse_str_basic2.phpt
index e42c9caaa4..88a13ca387 100644
--- a/ext/standard/tests/strings/parse_str_basic2.phpt
+++ b/ext/standard/tests/strings/parse_str_basic2.phpt
@@ -12,15 +12,20 @@ arg_separator.input = "/"
echo "*** Testing parse_str() : non-default arg_separator.input specified ***\n";
$s1 = "first=val1/second=val2/third=val3";
-var_dump(parse_str($s1));
-var_dump($first, $second, $third);
+var_dump(parse_str($s1, $result));
+var_dump($result);
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing parse_str() : non-default arg_separator.input specified ***
NULL
-string(4) "val1"
-string(4) "val2"
-string(4) "val3"
-===DONE=== \ No newline at end of file
+array(3) {
+ ["first"]=>
+ string(4) "val1"
+ ["second"]=>
+ string(4) "val2"
+ ["third"]=>
+ string(4) "val3"
+}
+===DONE===
diff --git a/ext/standard/tests/strings/parse_str_basic3.phpt b/ext/standard/tests/strings/parse_str_basic3.phpt
index 84f6a53bb1..a38395b884 100644
--- a/ext/standard/tests/strings/parse_str_basic3.phpt
+++ b/ext/standard/tests/strings/parse_str_basic3.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/parse_str_basic4.phpt b/ext/standard/tests/strings/parse_str_basic4.phpt
index 894dbf0c2d..b6126e974b 100644
--- a/ext/standard/tests/strings/parse_str_basic4.phpt
+++ b/ext/standard/tests/strings/parse_str_basic4.phpt
@@ -22,8 +22,8 @@ var_dump($res);
echo "\nTest string with badly formed % numbers\n";
$str = "first=%41&second=%a&third=%b";
-var_dump(parse_str($str));
-var_dump($first, $second, $third);
+var_dump(parse_str($str, $res));
+var_dump($res);
echo "\nTest string with non-binary safe name\n";
$str = "arr.test[1]=sid&arr test[4][two]=fred";
@@ -66,9 +66,14 @@ array(2) {
Test string with badly formed % numbers
NULL
-string(1) "A"
-string(2) "%a"
-string(2) "%b"
+array(3) {
+ ["first"]=>
+ string(1) "A"
+ ["second"]=>
+ string(2) "%a"
+ ["third"]=>
+ string(2) "%b"
+}
Test string with non-binary safe name
NULL
@@ -84,4 +89,4 @@ array(1) {
}
}
}
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/standard/tests/strings/quoted_printable_decode_error.phpt b/ext/standard/tests/strings/quoted_printable_decode_error.phpt
index 5018837049..0515fea2a7 100644
--- a/ext/standard/tests/strings/quoted_printable_decode_error.phpt
+++ b/ext/standard/tests/strings/quoted_printable_decode_error.phpt
@@ -13,7 +13,7 @@ echo "\n-- Testing quoted_printable_decode() function with no arguments --\n";
var_dump( quoted_printable_decode() );
echo "\n-- Testing quoted_printable_decode() function with more than expected no. of arguments --\n";
-$str = b"=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A=
+$str = "=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A=
=20=D4=cf=D2=C7=CF=D7=D9=C5=
=20=
=D0=
diff --git a/ext/standard/tests/strings/sha1_file.phpt b/ext/standard/tests/strings/sha1_file.phpt
index fafe106d51..20d62e6999 100644
--- a/ext/standard/tests/strings/sha1_file.phpt
+++ b/ext/standard/tests/strings/sha1_file.phpt
@@ -19,7 +19,7 @@ return false;
/* Writing into file */
$filename = "DataFile.txt";
-$content = b"Add this to the file\n";
+$content = "Add this to the file\n";
if (is_writable($filename)) {
if (fwrite($handle2, $content) === FALSE) {
echo "Cannot write to file ($filename)";
diff --git a/ext/standard/tests/strings/soundex_basic.phpt b/ext/standard/tests/strings/soundex_basic.phpt
index 65bcb64252..9777473ee9 100644
--- a/ext/standard/tests/strings/soundex_basic.phpt
+++ b/ext/standard/tests/strings/soundex_basic.phpt
@@ -1,46 +1,46 @@
---TEST--
-Test soundex() function : basic functionality
---FILE--
-<?php
-/* Prototype : string soundex ( string $str )
- * Description: Calculate the soundex key of a string
- * Source code: ext/standard/string.c
-*/
-echo "*** Testing soundex() : basic functionality ***\n";
-
-var_dump(soundex("Euler"));
-var_dump(soundex("Gauss"));
-var_dump(soundex("Hilbert"));
-var_dump(soundex("Knuth"));
-var_dump(soundex("Lloyd"));
-var_dump(soundex("Lukasiewicz"));
-
-var_dump(soundex("Euler") == soundex("Ellery")); // E460
-var_dump(soundex("Gauss") == soundex("Ghosh")); // G200
-var_dump(soundex("Hilbert") == soundex("Heilbronn")); // H416
-var_dump(soundex("Knuth") == soundex("Kant")); // K530
-var_dump(soundex("Lloyd") == soundex("Ladd")); // L300
-var_dump(soundex("Lukasiewicz") == soundex("Lissajous")); // L222
-
-var_dump(soundex("Lukasiewicz") == soundex("Ghosh"));
-var_dump(soundex("Hilbert") == soundex("Ladd"));
-?>
-===DONE===
---EXPECT--
-*** Testing soundex() : basic functionality ***
-string(4) "E460"
-string(4) "G200"
-string(4) "H416"
-string(4) "K530"
-string(4) "L300"
-string(4) "L222"
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(false)
-bool(false)
-
-===DONE===
+--TEST--
+Test soundex() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string soundex ( string $str )
+ * Description: Calculate the soundex key of a string
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing soundex() : basic functionality ***\n";
+
+var_dump(soundex("Euler"));
+var_dump(soundex("Gauss"));
+var_dump(soundex("Hilbert"));
+var_dump(soundex("Knuth"));
+var_dump(soundex("Lloyd"));
+var_dump(soundex("Lukasiewicz"));
+
+var_dump(soundex("Euler") == soundex("Ellery")); // E460
+var_dump(soundex("Gauss") == soundex("Ghosh")); // G200
+var_dump(soundex("Hilbert") == soundex("Heilbronn")); // H416
+var_dump(soundex("Knuth") == soundex("Kant")); // K530
+var_dump(soundex("Lloyd") == soundex("Ladd")); // L300
+var_dump(soundex("Lukasiewicz") == soundex("Lissajous")); // L222
+
+var_dump(soundex("Lukasiewicz") == soundex("Ghosh"));
+var_dump(soundex("Hilbert") == soundex("Ladd"));
+?>
+===DONE===
+--EXPECT--
+*** Testing soundex() : basic functionality ***
+string(4) "E460"
+string(4) "G200"
+string(4) "H416"
+string(4) "K530"
+string(4) "L300"
+string(4) "L222"
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+
+===DONE===
diff --git a/ext/standard/tests/strings/soundex_error.phpt b/ext/standard/tests/strings/soundex_error.phpt
index a81b9d24fe..20cf2c9d3e 100644
--- a/ext/standard/tests/strings/soundex_error.phpt
+++ b/ext/standard/tests/strings/soundex_error.phpt
@@ -1,34 +1,34 @@
---TEST--
-Test soundex() function : error conditions
---FILE--
-<?php
-/* Prototype : string soundex ( string $str )
- * Description: Calculate the soundex key of a string
- * Source code: ext/standard/string.c
-*/
-
-echo "\n*** Testing soundex error conditions ***";
-
-echo "-- Testing soundex() function with Zero arguments --\n";
-var_dump( soundex() );
-
-echo "\n\n-- Testing soundex() function with more than expected no. of arguments --\n";
-$str = "Euler";
-$extra_arg = 10;
-var_dump( soundex( $str, $extra_arg) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing soundex error conditions ***-- Testing soundex() function with Zero arguments --
-
-Warning: soundex() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-
--- Testing soundex() function with more than expected no. of arguments --
-
-Warning: soundex() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
+--TEST--
+Test soundex() function : error conditions
+--FILE--
+<?php
+/* Prototype : string soundex ( string $str )
+ * Description: Calculate the soundex key of a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "\n*** Testing soundex error conditions ***";
+
+echo "-- Testing soundex() function with Zero arguments --\n";
+var_dump( soundex() );
+
+echo "\n\n-- Testing soundex() function with more than expected no. of arguments --\n";
+$str = "Euler";
+$extra_arg = 10;
+var_dump( soundex( $str, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing soundex error conditions ***-- Testing soundex() function with Zero arguments --
+
+Warning: soundex() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+
+-- Testing soundex() function with more than expected no. of arguments --
+
+Warning: soundex() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/str_getcsv_001.phpt b/ext/standard/tests/strings/str_getcsv_001.phpt
index 23c6faf918..becff2163b 100644
--- a/ext/standard/tests/strings/str_getcsv_001.phpt
+++ b/ext/standard/tests/strings/str_getcsv_001.phpt
@@ -18,7 +18,7 @@ var_dump(str_getcsv('.foo..bar.', '.', '.', '.'));
print "-----\n";
var_dump(str_getcsv('.foo. .bar.', ' ', '.', '.'));
print "-----\n";
-var_dump(str_getcsv((binary)'1foo1 1bar111', (binary)' ', (binary)'1 ', (binary) '\ '));
+var_dump(str_getcsv('1foo1 1bar111', ' ', '1 ', '\ '));
print "-----\n";
var_dump(str_getcsv('.foo . . bar .', ' ', '.', ''));
print "-----\n";
diff --git a/ext/standard/tests/strings/str_rot13_basic.phpt b/ext/standard/tests/strings/str_rot13_basic.phpt
index 949d725754..321a2bf1b7 100644
--- a/ext/standard/tests/strings/str_rot13_basic.phpt
+++ b/ext/standard/tests/strings/str_rot13_basic.phpt
@@ -1,55 +1,55 @@
---TEST--
-Test soundex() function : basic functionality
---FILE--
-<?php
-/* Prototype : string str_rot13 ( string $str )
- * Description: Perform the rot13 transform on a string
- * Source code: ext/standard/string.c
-*/
-echo "*** Testing str_rot13() : basic functionality ***\n";
-
-echo "\nBasic tests\n";
-var_dump(str_rot13("str_rot13() tests starting"));
-var_dump(str_rot13("abcdefghijklmnopqrstuvwxyz"));
-
-echo "\nEnsure numeric characters are left untouched\n";
-if (strcmp(str_rot13("0123456789"), "0123456789") == 0) {
- echo "Strings equal : TEST PASSED\n";
-} else {
- echo "Strings unequal : TEST FAILED\n";
-}
-
-echo "\nEnsure non-alphabetic characters are left untouched\n";
-if (strcmp(str_rot13("!%^&*()_-+={}[]:;@~#<,>.?"), "!%^&*()_-+={}[]:;@~#<,>.?")) {
- echo "Strings equal : TEST PASSED\n";
-} else {
- echo "Strings unequal : TEST FAILED\n";
-}
-
-echo "\nEnsure strings round trip\n";
-$str = "str_rot13() tests starting";
-$encode = str_rot13($str);
-$decode = str_rot13($encode);
-if (strcmp($str, $decode) == 0) {
- echo "Strings equal : TEST PASSED\n";
-} else {
- echo "Strings unequal : TEST FAILED\n";
-}
-?>
-===DONE===
---EXPECTF--
-*** Testing str_rot13() : basic functionality ***
-
-Basic tests
-string(26) "fge_ebg13() grfgf fgnegvat"
-string(26) "nopqrstuvwxyzabcdefghijklm"
-
-Ensure numeric characters are left untouched
-Strings equal : TEST PASSED
-
-Ensure non-alphabetic characters are left untouched
-Strings unequal : TEST FAILED
-
-Ensure strings round trip
-Strings equal : TEST PASSED
+--TEST--
+Test soundex() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string str_rot13 ( string $str )
+ * Description: Perform the rot13 transform on a string
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing str_rot13() : basic functionality ***\n";
+
+echo "\nBasic tests\n";
+var_dump(str_rot13("str_rot13() tests starting"));
+var_dump(str_rot13("abcdefghijklmnopqrstuvwxyz"));
+
+echo "\nEnsure numeric characters are left untouched\n";
+if (strcmp(str_rot13("0123456789"), "0123456789") == 0) {
+ echo "Strings equal : TEST PASSED\n";
+} else {
+ echo "Strings unequal : TEST FAILED\n";
+}
+
+echo "\nEnsure non-alphabetic characters are left untouched\n";
+if (strcmp(str_rot13("!%^&*()_-+={}[]:;@~#<,>.?"), "!%^&*()_-+={}[]:;@~#<,>.?")) {
+ echo "Strings equal : TEST PASSED\n";
+} else {
+ echo "Strings unequal : TEST FAILED\n";
+}
+
+echo "\nEnsure strings round trip\n";
+$str = "str_rot13() tests starting";
+$encode = str_rot13($str);
+$decode = str_rot13($encode);
+if (strcmp($str, $decode) == 0) {
+ echo "Strings equal : TEST PASSED\n";
+} else {
+ echo "Strings unequal : TEST FAILED\n";
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_rot13() : basic functionality ***
+
+Basic tests
+string(26) "fge_ebg13() grfgf fgnegvat"
+string(26) "nopqrstuvwxyzabcdefghijklm"
+
+Ensure numeric characters are left untouched
+Strings equal : TEST PASSED
+
+Ensure non-alphabetic characters are left untouched
+Strings unequal : TEST FAILED
+
+Ensure strings round trip
+Strings equal : TEST PASSED
===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/str_rot13_error.phpt b/ext/standard/tests/strings/str_rot13_error.phpt
index 99a99f29c5..2361c0abb5 100644
--- a/ext/standard/tests/strings/str_rot13_error.phpt
+++ b/ext/standard/tests/strings/str_rot13_error.phpt
@@ -1,32 +1,32 @@
---TEST--
-Test str_rot13() function : error conditions
---FILE--
-<?php
-/* Prototype : string str_rot13 ( string $str )
- * Description: Perform the rot13 transform on a string
- * Source code: ext/standard/string.c
-*/
-echo "*** Testing str_rot13() : error conditions ***\n";
-
-echo "-- Testing str_rot13() function with Zero arguments --\n";
-var_dump( str_rot13() );
-
-echo "\n\n-- Testing str_rot13() function with more than expected no. of arguments --\n";
-$str = "str_rot13() tests starting";
-$extra_arg = 10;
-var_dump( str_rot13( $str, $extra_arg) );
-?>
-===DONE===
---EXPECTF--
-*** Testing str_rot13() : error conditions ***
--- Testing str_rot13() function with Zero arguments --
-
-Warning: str_rot13() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-
--- Testing str_rot13() function with more than expected no. of arguments --
-
-Warning: str_rot13() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
+--TEST--
+Test str_rot13() function : error conditions
+--FILE--
+<?php
+/* Prototype : string str_rot13 ( string $str )
+ * Description: Perform the rot13 transform on a string
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing str_rot13() : error conditions ***\n";
+
+echo "-- Testing str_rot13() function with Zero arguments --\n";
+var_dump( str_rot13() );
+
+echo "\n\n-- Testing str_rot13() function with more than expected no. of arguments --\n";
+$str = "str_rot13() tests starting";
+$extra_arg = 10;
+var_dump( str_rot13( $str, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_rot13() : error conditions ***
+-- Testing str_rot13() function with Zero arguments --
+
+Warning: str_rot13() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+
+-- Testing str_rot13() function with more than expected no. of arguments --
+
+Warning: str_rot13() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/strip_tags_variation6.phpt b/ext/standard/tests/strings/strip_tags_variation6.phpt
index 454f46e558..c838970868 100644
--- a/ext/standard/tests/strings/strip_tags_variation6.phpt
+++ b/ext/standard/tests/strings/strip_tags_variation6.phpt
@@ -19,7 +19,7 @@ echo "*** Testing strip_tags() : usage variations ***\n";
$strings = array (
"<html> I am html string </html>".chr(0)."<?php I am php string ?>",
"<html> I am html string\0 </html><?php I am php string ?>",
- b"<a>I am html string</a>",
+ "<a>I am html string</a>",
"<html>I am html string</html>".decbin(65)."<?php I am php string?>"
);
diff --git a/ext/standard/tests/strings/stristr_basic.phpt b/ext/standard/tests/strings/stristr_basic.phpt
index f0a863cee9..0d2171496c 100644
--- a/ext/standard/tests/strings/stristr_basic.phpt
+++ b/ext/standard/tests/strings/stristr_basic.phpt
@@ -13,7 +13,7 @@ var_dump( stristr("test stRIng", "striNG") );
var_dump( stristr("teST StrinG", "stRIn") );
var_dump( stristr("tesT string", "t S") );
var_dump( stristr("test strinG", "g") );
-var_dump( bin2hex(stristr(b"te".chr(0).b"St", chr(0))) );
+var_dump( bin2hex(stristr("te".chr(0)."St", chr(0))) );
var_dump( stristr("tEst", "test") );
var_dump( stristr("teSt", "test") );
diff --git a/ext/standard/tests/strings/strnatcasecmp_error.phpt b/ext/standard/tests/strings/strnatcasecmp_error.phpt
index 45a15daefc..3085e8d8fd 100644
--- a/ext/standard/tests/strings/strnatcasecmp_error.phpt
+++ b/ext/standard/tests/strings/strnatcasecmp_error.phpt
@@ -1,33 +1,33 @@
---TEST--
-Test strnatcasecmp() function : error conditions
---FILE--
-<?php
-/* Prototype : int strnatcasecmp ( string $str1 , string $str2 )
- * Description: Case insensitive string comparisons using a "natural order" algorithm
- * Source code: ext/standard/string.c
-*/
-echo "*** Testing strnatcasecmp() : error conditions ***\n";
-
-echo "-- Testing strnatcmp() function with Zero arguments --\n";
-var_dump( strnatcasecmp() );
-
-echo "\n\n-- Testing strnatcasecmp() function with more than expected no. of arguments --\n";
-$str1 = "abc1";
-$str2 = "ABC1";
-$extra_arg = 10;
-var_dump( strnatcasecmp( $str1, $str2, $extra_arg) );
-?>
-===DONE===
---EXPECTF--
-*** Testing strnatcasecmp() : error conditions ***
--- Testing strnatcmp() function with Zero arguments --
-
-Warning: strnatcasecmp() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-
--- Testing strnatcasecmp() function with more than expected no. of arguments --
-
-Warning: strnatcasecmp() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
+--TEST--
+Test strnatcasecmp() function : error conditions
+--FILE--
+<?php
+/* Prototype : int strnatcasecmp ( string $str1 , string $str2 )
+ * Description: Case insensitive string comparisons using a "natural order" algorithm
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing strnatcasecmp() : error conditions ***\n";
+
+echo "-- Testing strnatcmp() function with Zero arguments --\n";
+var_dump( strnatcasecmp() );
+
+echo "\n\n-- Testing strnatcasecmp() function with more than expected no. of arguments --\n";
+$str1 = "abc1";
+$str2 = "ABC1";
+$extra_arg = 10;
+var_dump( strnatcasecmp( $str1, $str2, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing strnatcasecmp() : error conditions ***
+-- Testing strnatcmp() function with Zero arguments --
+
+Warning: strnatcasecmp() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+
+-- Testing strnatcasecmp() function with more than expected no. of arguments --
+
+Warning: strnatcasecmp() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/strnatcmp_basic.phpt b/ext/standard/tests/strings/strnatcmp_basic.phpt
index 140bd48d6c..bef01de653 100644
--- a/ext/standard/tests/strings/strnatcmp_basic.phpt
+++ b/ext/standard/tests/strings/strnatcmp_basic.phpt
@@ -1,80 +1,80 @@
---TEST--
-Test strnatcmp() function : basic functionality
---FILE--
-<?php
-/* Prototype : int strnatcmp ( string $str1 , string $str2 )
- * Description: String comparisons using a "natural order" algorithm
- * Source code: ext/standard/string.c
-*/
-echo "*** Testing strnatcmp() : basic functionality ***\n";
-
-$a1 = "abc1";
-$b1 = "abc10";
-$c1 = "abc15";
-$d1 = "abc2";
-
-$a2 = "ABC1";
-$b2 = "ABC10";
-$c2 = "ABC15";
-$d2 = "ABC2";
-
-echo "Less than tests\n";
-var_dump(strnatcmp($a1, $b1));
-var_dump(strnatcmp($a1, $c1));
-var_dump(strnatcmp($a1, $d1));
-var_dump(strnatcmp($b1, $c1));
-var_dump(strnatcmp($d1, $c1));
-
-var_dump(strnatcmp($a1, $b2));
-var_dump(strnatcmp($a1, $c2));
-var_dump(strnatcmp($a1, $d2));
-var_dump(strnatcmp($b1, $c2));
-var_dump(strnatcmp($d1, $c2));
-
-
-echo "Equal too tests\n";
-var_dump(strnatcmp($b1, $b1));
-var_dump(strnatcmp($b1, $b2));
-
-echo "Greater than tests\n";
-var_dump(strnatcmp($b1, $a1));
-var_dump(strnatcmp($c1, $a1));
-var_dump(strnatcmp($d1, $a1));
-var_dump(strnatcmp($c1, $b1));
-var_dump(strnatcmp($c1, $d1));
-
-var_dump(strnatcmp($b1, $a2));
-var_dump(strnatcmp($c1, $a2));
-var_dump(strnatcmp($d1, $a2));
-var_dump(strnatcmp($c1, $b2));
-var_dump(strnatcmp($c1, $d2));
-?>
-===DONE===
---EXPECT--
-*** Testing strnatcmp() : basic functionality ***
-Less than tests
-int(-1)
-int(-1)
-int(-1)
-int(-1)
-int(-1)
-int(1)
-int(1)
-int(1)
-int(1)
-int(1)
-Equal too tests
-int(0)
-int(1)
-Greater than tests
-int(1)
-int(1)
-int(1)
-int(1)
-int(1)
-int(1)
-int(1)
-int(1)
-int(1)
-int(1)
+--TEST--
+Test strnatcmp() function : basic functionality
+--FILE--
+<?php
+/* Prototype : int strnatcmp ( string $str1 , string $str2 )
+ * Description: String comparisons using a "natural order" algorithm
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing strnatcmp() : basic functionality ***\n";
+
+$a1 = "abc1";
+$b1 = "abc10";
+$c1 = "abc15";
+$d1 = "abc2";
+
+$a2 = "ABC1";
+$b2 = "ABC10";
+$c2 = "ABC15";
+$d2 = "ABC2";
+
+echo "Less than tests\n";
+var_dump(strnatcmp($a1, $b1));
+var_dump(strnatcmp($a1, $c1));
+var_dump(strnatcmp($a1, $d1));
+var_dump(strnatcmp($b1, $c1));
+var_dump(strnatcmp($d1, $c1));
+
+var_dump(strnatcmp($a1, $b2));
+var_dump(strnatcmp($a1, $c2));
+var_dump(strnatcmp($a1, $d2));
+var_dump(strnatcmp($b1, $c2));
+var_dump(strnatcmp($d1, $c2));
+
+
+echo "Equal too tests\n";
+var_dump(strnatcmp($b1, $b1));
+var_dump(strnatcmp($b1, $b2));
+
+echo "Greater than tests\n";
+var_dump(strnatcmp($b1, $a1));
+var_dump(strnatcmp($c1, $a1));
+var_dump(strnatcmp($d1, $a1));
+var_dump(strnatcmp($c1, $b1));
+var_dump(strnatcmp($c1, $d1));
+
+var_dump(strnatcmp($b1, $a2));
+var_dump(strnatcmp($c1, $a2));
+var_dump(strnatcmp($d1, $a2));
+var_dump(strnatcmp($c1, $b2));
+var_dump(strnatcmp($c1, $d2));
+?>
+===DONE===
+--EXPECT--
+*** Testing strnatcmp() : basic functionality ***
+Less than tests
+int(-1)
+int(-1)
+int(-1)
+int(-1)
+int(-1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+Equal too tests
+int(0)
+int(1)
+Greater than tests
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/strnatcmp_error.phpt b/ext/standard/tests/strings/strnatcmp_error.phpt
index 09cc668af9..2b6d93afee 100644
--- a/ext/standard/tests/strings/strnatcmp_error.phpt
+++ b/ext/standard/tests/strings/strnatcmp_error.phpt
@@ -1,34 +1,34 @@
---TEST--
-Test strnatcmp() function : error conditions
---FILE--
-<?php
-/* Prototype : int strnatcmp ( string $str1 , string $str2 )
- * Description: String comparisons using a "natural order" algorithm
- * Source code: ext/standard/string.c
-*/
-echo "*** Testing strnatcmp() : error conditions ***\n";
-
-echo "-- Testing strnatcmp() function with Zero arguments --\n";
-var_dump( strnatcmp() );
-
-echo "\n\n-- Testing strnatcmp() function with more than expected no. of arguments --\n";
-$str1 = "abc1";
-$str2 = "ABC1";
-$extra_arg = 10;
-var_dump( strnatcmp( $str1, $str2, $extra_arg) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing strnatcmp() : error conditions ***
--- Testing strnatcmp() function with Zero arguments --
-
-Warning: strnatcmp() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-
--- Testing strnatcmp() function with more than expected no. of arguments --
-
-Warning: strnatcmp() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-===DONE===
+--TEST--
+Test strnatcmp() function : error conditions
+--FILE--
+<?php
+/* Prototype : int strnatcmp ( string $str1 , string $str2 )
+ * Description: String comparisons using a "natural order" algorithm
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing strnatcmp() : error conditions ***\n";
+
+echo "-- Testing strnatcmp() function with Zero arguments --\n";
+var_dump( strnatcmp() );
+
+echo "\n\n-- Testing strnatcmp() function with more than expected no. of arguments --\n";
+$str1 = "abc1";
+$str2 = "ABC1";
+$extra_arg = 10;
+var_dump( strnatcmp( $str1, $str2, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strnatcmp() : error conditions ***
+-- Testing strnatcmp() function with Zero arguments --
+
+Warning: strnatcmp() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+
+-- Testing strnatcmp() function with more than expected no. of arguments --
+
+Warning: strnatcmp() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt
index 143c4bd426..572d26ebd1 100644
--- a/ext/standard/tests/strings/ucfirst.phpt
+++ b/ext/standard/tests/strings/ucfirst.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/utf8.phpt b/ext/standard/tests/strings/utf8.phpt
new file mode 100644
index 0000000000..aea04fdecd
--- /dev/null
+++ b/ext/standard/tests/strings/utf8.phpt
@@ -0,0 +1,10 @@
+--TEST--
+UTF-8<->ISO Latin 1 encoding/decoding test
+--FILE--
+<?php
+printf("%s -> %s\n", urlencode("æ"), urlencode(utf8_encode("æ")));
+printf("%s <- %s\n", urlencode(utf8_decode(urldecode("%C3%A6"))), "%C3%A6");
+?>
+--EXPECT--
+%E6 -> %C3%A6
+%E6 <- %C3%A6
diff --git a/ext/standard/tests/strings/utf8_decode_error.phpt b/ext/standard/tests/strings/utf8_decode_error.phpt
new file mode 100644
index 0000000000..911cc15cfc
--- /dev/null
+++ b/ext/standard/tests/strings/utf8_decode_error.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test utf8_decode() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto string utf8_decode(string data)
+ * Description: Converts a UTF-8 encoded string to ISO-8859-1
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing utf8_decode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing utf8_decode() function with Zero arguments --\n";
+var_dump( utf8_decode() );
+
+//Test utf8_decode with one more than the expected number of arguments
+echo "\n-- Testing utf8_decode() function with more than expected no. of arguments --\n";
+$data = 'string_val';
+$extra_arg = 10;
+var_dump( utf8_decode($data, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing utf8_decode() : error conditions ***
+
+-- Testing utf8_decode() function with Zero arguments --
+
+Warning: utf8_decode() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing utf8_decode() function with more than expected no. of arguments --
+
+Warning: utf8_decode() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
+
diff --git a/ext/standard/tests/strings/utf8_decode_variation1.phpt b/ext/standard/tests/strings/utf8_decode_variation1.phpt
new file mode 100644
index 0000000000..f564b87da0
--- /dev/null
+++ b/ext/standard/tests/strings/utf8_decode_variation1.phpt
@@ -0,0 +1,170 @@
+--TEST--
+Test utf8_decode() function : usage variations - different types for data
+--FILE--
+<?php
+/* Prototype : proto string utf8_decode(string data)
+ * Description: Converts a UTF-8 encoded string to ISO-8859-1
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing utf8_decode() : usage variations ***\n";
+error_reporting(E_ALL & ~E_NOTICE);
+
+class aClass {
+ function __toString() {
+ return "Some Ascii Data";
+ }
+}
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new aClass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for data
+
+foreach($values as $value) {
+ echo @"\nArg value $value \n";
+ var_dump( utf8_decode($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing utf8_decode() : usage variations ***
+
+Arg value 0
+string(1) "0"
+
+Arg value 1
+string(1) "1"
+
+Arg value 12345
+string(5) "12345"
+
+Arg value -2345
+string(5) "-2345"
+
+Arg value 10.5
+string(4) "10.5"
+
+Arg value -10.5
+string(5) "-10.5"
+
+Arg value 101234567000
+string(12) "101234567000"
+
+Arg value 1.07654321E-9
+string(13) "1.07654321E-9"
+
+Arg value 0.5
+string(3) "0.5"
+
+Arg value Array
+
+Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Arg value Array
+
+Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Arg value Array
+
+Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Arg value Array
+
+Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Arg value Array
+
+Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(1) "1"
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(1) "1"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value Some Ascii Data
+string(15) "Some Ascii Data"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Done
+
diff --git a/ext/standard/tests/strings/utf8_encode_error.phpt b/ext/standard/tests/strings/utf8_encode_error.phpt
new file mode 100644
index 0000000000..e12f0978b6
--- /dev/null
+++ b/ext/standard/tests/strings/utf8_encode_error.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test utf8_encode() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto string utf8_encode(string data)
+ * Description: Encodes an ISO-8859-1 string to UTF-8
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing utf8_encode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing utf8_encode() function with Zero arguments --\n";
+var_dump( utf8_encode() );
+
+//Test utf8_encode with one more than the expected number of arguments
+echo "\n-- Testing utf8_encode() function with more than expected no. of arguments --\n";
+$data = 'string_val';
+$extra_arg = 10;
+var_dump( utf8_encode($data, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing utf8_encode() : error conditions ***
+
+-- Testing utf8_encode() function with Zero arguments --
+
+Warning: utf8_encode() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing utf8_encode() function with more than expected no. of arguments --
+
+Warning: utf8_encode() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
+
diff --git a/ext/standard/tests/strings/utf8_encode_variation1.phpt b/ext/standard/tests/strings/utf8_encode_variation1.phpt
new file mode 100644
index 0000000000..fa4b79976e
--- /dev/null
+++ b/ext/standard/tests/strings/utf8_encode_variation1.phpt
@@ -0,0 +1,170 @@
+--TEST--
+Test utf8_encode() function : usage variations - <type here specifics of this variation>
+--FILE--
+<?php
+/* Prototype : proto string utf8_encode(string data)
+ * Description: Encodes an ISO-8859-1 string to UTF-8
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing utf8_encode() : usage variations ***\n";
+error_reporting(E_ALL & ~E_NOTICE);
+
+class aClass {
+ function __toString() {
+ return "Some Ascii Data";
+ }
+}
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new aClass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for data
+
+foreach($values as $value) {
+ echo @"\nArg value $value \n";
+ var_dump( utf8_encode($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing utf8_encode() : usage variations ***
+
+Arg value 0
+string(1) "0"
+
+Arg value 1
+string(1) "1"
+
+Arg value 12345
+string(5) "12345"
+
+Arg value -2345
+string(5) "-2345"
+
+Arg value 10.5
+string(4) "10.5"
+
+Arg value -10.5
+string(5) "-10.5"
+
+Arg value 101234567000
+string(12) "101234567000"
+
+Arg value 1.07654321E-9
+string(13) "1.07654321E-9"
+
+Arg value 0.5
+string(3) "0.5"
+
+Arg value Array
+
+Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Arg value Array
+
+Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Arg value Array
+
+Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Arg value Array
+
+Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Arg value Array
+
+Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(1) "1"
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(1) "1"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value Some Ascii Data
+string(15) "Some Ascii Data"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Done
+
diff --git a/ext/standard/tests/time/strptime_error.phpt b/ext/standard/tests/time/strptime_error.phpt
index 92c7ca3474..ae55028cb2 100644
--- a/ext/standard/tests/time/strptime_error.phpt
+++ b/ext/standard/tests/time/strptime_error.phpt
@@ -32,6 +32,9 @@ echo "\n-- Testing strptime() function with more than expected no. of arguments
$extra_arg = 10;
var_dump( strptime($date, $format, $extra_arg) );
+echo "\n-- Testing strptime() function on failure --\n";
+var_dump( strptime('foo', $format) );
+
?>
===DONE===
--EXPECTF--
@@ -51,5 +54,8 @@ NULL
Warning: strptime() expects exactly 2 parameters, 3 given in %s on line %d
NULL
+
+-- Testing strptime() function on failure --
+bool(false)
===DONE===
diff --git a/ext/standard/tests/url/bug47174.phpt b/ext/standard/tests/url/bug47174.phpt
index 0296dbe753..6d08063253 100644
--- a/ext/standard/tests/url/bug47174.phpt
+++ b/ext/standard/tests/url/bug47174.phpt
@@ -2,13 +2,13 @@
Bug #47174 (base64_decode() interprets pad char in mid string as terminator)
--FILE--
<?php
-if (base64_decode(b"dGVzdA==") == base64_decode(b"dGVzdA==CRAP")) {
+if (base64_decode("dGVzdA==") == base64_decode("dGVzdA==CRAP")) {
echo "Same octect data - Signature Valid\n";
} else {
echo "Invalid Signature\n";
}
-$in = base64_encode(b"foo") . b'==' . base64_encode(b"bar");
+$in = base64_encode("foo") . '==' . base64_encode("bar");
var_dump($in, base64_decode($in));
?>
diff --git a/ext/standard/tests/url/parse_url_unterminated.phpt b/ext/standard/tests/url/parse_url_unterminated.phpt
new file mode 100644
index 0000000000..bb0e096856
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_unterminated.phpt
@@ -0,0 +1,887 @@
+--TEST--
+Test parse_url() function: Parse unterminated string
+--SKIPIF--
+<?php
+if (!function_exists('zend_create_unterminated_string')) die('skip ext/test required');
+?>
+--FILE--
+<?php
+
+/*
+ * This is the same as the basic001 test, but with unterminated strings.
+ */
+
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "\n--> $url: ";
+ $str = zend_create_unterminated_string($url);
+ var_dump(parse_url($str));
+ zend_terminate_string($str);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+
+--> 64.246.30.37: array(1) {
+ ["path"]=>
+ string(12) "64.246.30.37"
+}
+
+--> http://64.246.30.37: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(12) "64.246.30.37"
+}
+
+--> http://64.246.30.37/: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(12) "64.246.30.37"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> 64.246.30.37/: array(1) {
+ ["path"]=>
+ string(13) "64.246.30.37/"
+}
+
+--> 64.246.30.37:80/: array(3) {
+ ["host"]=>
+ string(12) "64.246.30.37"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> php.net: array(1) {
+ ["path"]=>
+ string(7) "php.net"
+}
+
+--> php.net/: array(1) {
+ ["path"]=>
+ string(8) "php.net/"
+}
+
+--> http://php.net: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(7) "php.net"
+}
+
+--> http://php.net/: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(7) "php.net"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> www.php.net: array(1) {
+ ["path"]=>
+ string(11) "www.php.net"
+}
+
+--> www.php.net/: array(1) {
+ ["path"]=>
+ string(12) "www.php.net/"
+}
+
+--> http://www.php.net: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+}
+
+--> http://www.php.net/: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> www.php.net:80: array(2) {
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+}
+
+--> http://www.php.net:80: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+}
+
+--> http://www.php.net:80/: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net/index.php: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(10) "/index.php"
+}
+
+--> www.php.net/?: array(1) {
+ ["path"]=>
+ string(12) "www.php.net/"
+}
+
+--> www.php.net:80/?: array(3) {
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net/?: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net:80/?: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net:80/index.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+}
+
+--> http://www.php.net:80/foo/bar/index.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(18) "/foo/bar/index.php"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+ ["query"]=>
+ string(37) "lots=1&of=2&parameters=3&too=4&here=5"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(45) "/this/is/a/very/deep/directory/structure/and/"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+}
+
+--> http://www.php.net:80/this/../a/../deep/directory: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(28) "/this/../a/../deep/directory"
+}
+
+--> http://www.php.net:80/this/../a/../deep/directory/: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(29) "/this/../a/../deep/directory/"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(42) "/this/is/a/very/deep/directory/../file.php"
+}
+
+--> http://www.php.net:80/index.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+}
+
+--> http://www.php.net:80/index.php?: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+}
+
+--> http://www.php.net:80/#foo: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+ ["fragment"]=>
+ string(3) "foo"
+}
+
+--> http://www.php.net:80/?#: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net:80/?test=1: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+ ["query"]=>
+ string(6) "test=1"
+}
+
+--> http://www.php.net/?test=1&: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(1) "/"
+ ["query"]=>
+ string(7) "test=1&"
+}
+
+--> http://www.php.net:80/?&: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+ ["query"]=>
+ string(1) "&"
+}
+
+--> http://www.php.net:80/index.php?test=1&: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(7) "test=1&"
+}
+
+--> http://www.php.net/index.php?&: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(1) "&"
+}
+
+--> http://www.php.net:80/index.php?foo&: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(4) "foo&"
+}
+
+--> http://www.php.net/index.php?&foo: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(4) "&foo"
+}
+
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+}
+
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(5) {
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(6) "secret"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(0) ""
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(8) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(0) ""
+ ["pass"]=>
+ string(7) "hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(7) "hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(14) "secret@hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(8) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(7) "hid:out"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> nntp://news.php.net: array(2) {
+ ["scheme"]=>
+ string(4) "nntp"
+ ["host"]=>
+ string(12) "news.php.net"
+}
+
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz: array(3) {
+ ["scheme"]=>
+ string(3) "ftp"
+ ["host"]=>
+ string(11) "ftp.gnu.org"
+ ["path"]=>
+ string(22) "/gnu/glic/glibc.tar.gz"
+}
+
+--> zlib:http://foo@bar: array(2) {
+ ["scheme"]=>
+ string(4) "zlib"
+ ["path"]=>
+ string(14) "http://foo@bar"
+}
+
+--> zlib:filename.txt: array(2) {
+ ["scheme"]=>
+ string(4) "zlib"
+ ["path"]=>
+ string(12) "filename.txt"
+}
+
+--> zlib:/path/to/my/file/file.txt: array(2) {
+ ["scheme"]=>
+ string(4) "zlib"
+ ["path"]=>
+ string(25) "/path/to/my/file/file.txt"
+}
+
+--> foo://foo@bar: array(3) {
+ ["scheme"]=>
+ string(3) "foo"
+ ["host"]=>
+ string(3) "bar"
+ ["user"]=>
+ string(3) "foo"
+}
+
+--> mailto:me@mydomain.com: array(2) {
+ ["scheme"]=>
+ string(6) "mailto"
+ ["path"]=>
+ string(15) "me@mydomain.com"
+}
+
+--> /foo.php?a=b&c=d: array(2) {
+ ["path"]=>
+ string(8) "/foo.php"
+ ["query"]=>
+ string(7) "a=b&c=d"
+}
+
+--> foo.php?a=b&c=d: array(2) {
+ ["path"]=>
+ string(7) "foo.php"
+ ["query"]=>
+ string(7) "a=b&c=d"
+}
+
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0: array(6) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(15) "www.example.com"
+ ["port"]=>
+ int(8080)
+ ["user"]=>
+ string(4) "user"
+ ["pass"]=>
+ string(6) "passwd"
+ ["query"]=>
+ string(12) "bar=1&boom=0"
+}
+
+--> http://user_me-you:my_pas-word@www.example.com:8080?bar=1&boom=0: array(6) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(15) "www.example.com"
+ ["port"]=>
+ int(8080)
+ ["user"]=>
+ string(11) "user_me-you"
+ ["pass"]=>
+ string(11) "my_pas-word"
+ ["query"]=>
+ string(12) "bar=1&boom=0"
+}
+
+--> file:///path/to/file: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(13) "/path/to/file"
+}
+
+--> file://path/to/file: array(3) {
+ ["scheme"]=>
+ string(4) "file"
+ ["host"]=>
+ string(4) "path"
+ ["path"]=>
+ string(8) "/to/file"
+}
+
+--> file:/path/to/file: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(13) "/path/to/file"
+}
+
+--> http://1.2.3.4:/abc.asp?a=1&b=2: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(7) "1.2.3.4"
+ ["path"]=>
+ string(8) "/abc.asp"
+ ["query"]=>
+ string(7) "a=1&b=2"
+}
+
+--> http://foo.com#bar: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(7) "foo.com"
+ ["fragment"]=>
+ string(3) "bar"
+}
+
+--> scheme:: array(1) {
+ ["scheme"]=>
+ string(6) "scheme"
+}
+
+--> foo+bar://baz@bang/bla: array(4) {
+ ["scheme"]=>
+ string(7) "foo+bar"
+ ["host"]=>
+ string(4) "bang"
+ ["user"]=>
+ string(3) "baz"
+ ["path"]=>
+ string(4) "/bla"
+}
+
+--> gg:9130731: array(2) {
+ ["scheme"]=>
+ string(2) "gg"
+ ["path"]=>
+ string(7) "9130731"
+}
+
+--> http://user:@pass@host/path?argument?value#etc: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(4) "host"
+ ["user"]=>
+ string(4) "user"
+ ["pass"]=>
+ string(5) "@pass"
+ ["path"]=>
+ string(5) "/path"
+ ["query"]=>
+ string(14) "argument?value"
+ ["fragment"]=>
+ string(3) "etc"
+}
+
+--> http://10.10.10.10/:80: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "10.10.10.10"
+ ["path"]=>
+ string(4) "/:80"
+}
+
+--> http://x:?: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(1) "x"
+}
+
+--> x:blah.com: array(2) {
+ ["scheme"]=>
+ string(1) "x"
+ ["path"]=>
+ string(8) "blah.com"
+}
+
+--> x:/blah.com: array(2) {
+ ["scheme"]=>
+ string(1) "x"
+ ["path"]=>
+ string(9) "/blah.com"
+}
+
+--> x://::abc/?: bool(false)
+
+--> http://::?: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(1) ":"
+}
+
+--> http://::#: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(1) ":"
+}
+
+--> x://::6.5: array(3) {
+ ["scheme"]=>
+ string(1) "x"
+ ["host"]=>
+ string(1) ":"
+ ["port"]=>
+ int(6)
+}
+
+--> http://?:/: bool(false)
+
+--> http://@?:/: bool(false)
+
+--> file:///:: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(2) "/:"
+}
+
+--> file:///a:/: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(3) "a:/"
+}
+
+--> file:///ab:/: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(5) "/ab:/"
+}
+
+--> file:///a:/: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(3) "a:/"
+}
+
+--> file:///@:/: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(3) "@:/"
+}
+
+--> file:///:80/: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(5) "/:80/"
+}
+
+--> []: array(1) {
+ ["path"]=>
+ string(2) "[]"
+}
+
+--> http://[x:80]/: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(6) "[x:80]"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> : array(1) {
+ ["path"]=>
+ string(0) ""
+}
+
+--> /: array(1) {
+ ["path"]=>
+ string(1) "/"
+}
+
+--> /rest/Users?filter={"id":"123"}: array(2) {
+ ["path"]=>
+ string(11) "/rest/Users"
+ ["query"]=>
+ string(19) "filter={"id":"123"}"
+}
+
+--> http:///blah.com: bool(false)
+
+--> http://:80: bool(false)
+
+--> http://user@:80: bool(false)
+
+--> http://user:pass@:80: bool(false)
+
+--> http://:: bool(false)
+
+--> http://@/: bool(false)
+
+--> http://@:/: bool(false)
+
+--> http://:/: bool(false)
+
+--> http://?: bool(false)
+
+--> http://#: bool(false)
+
+--> http://?:: bool(false)
+
+--> http://:?: bool(false)
+
+--> http://blah.com:123456: bool(false)
+
+--> http://blah.com:abcdef: bool(false)
+Done
diff --git a/ext/standard/tests/versioning/php_sapi_name.phpt b/ext/standard/tests/versioning/php_sapi_name.phpt
index c9d4988d95..0747b32d66 100644
--- a/ext/standard/tests/versioning/php_sapi_name.phpt
+++ b/ext/standard/tests/versioning/php_sapi_name.phpt
@@ -6,4 +6,4 @@ php_sapi_name test
var_dump(php_sapi_name());
--EXPECTF--
-%unicode|string%(3) "c%ci"
+string(3) "c%ci"
diff --git a/ext/standard/type.c b/ext/standard/type.c
index 6bdd8610b1..070ca8ef93 100644
--- a/ext/standard/type.c
+++ b/ext/standard/type.c
@@ -26,69 +26,22 @@
PHP_FUNCTION(gettype)
{
zval *arg;
+ zend_string *type;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg) == FAILURE) {
- return;
- }
-
- switch (Z_TYPE_P(arg)) {
- case IS_NULL:
- RETVAL_STRING("NULL");
- break;
-
- case IS_FALSE:
- case IS_TRUE:
- RETVAL_STRING("boolean");
- break;
-
- case IS_LONG:
- RETVAL_STRING("integer");
- break;
-
- case IS_DOUBLE:
- RETVAL_STRING("double");
- break;
-
- case IS_STRING:
- RETVAL_STRING("string");
- break;
-
- case IS_ARRAY:
- RETVAL_STRING("array");
- break;
-
- case IS_OBJECT:
- RETVAL_STRING("object");
- /*
- {
- char *result;
- int res_len;
-
- res_len = sizeof("object of type ")-1 + Z_OBJCE_P(arg)->name_length;
- spprintf(&result, 0, "object of type %s", Z_OBJCE_P(arg)->name);
- RETVAL_STRINGL(result, res_len);
- efree(result);
- }
- */
- break;
-
- case IS_RESOURCE:
- {
- const char *type_name = zend_rsrc_list_get_rsrc_type(Z_RES_P(arg));
-
- if (type_name) {
- RETVAL_STRING("resource");
- break;
- }
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(arg)
+ ZEND_PARSE_PARAMETERS_END();
- default:
- RETVAL_STRING("unknown type");
+ type = zend_zval_get_type(arg);
+ if (EXPECTED(type)) {
+ RETURN_INTERNED_STR(type);
+ } else {
+ RETURN_STRING("unknown type");
}
}
/* }}} */
-/* {{{ proto bool settype(mixed var, string type)
+/* {{{ proto bool settype(mixed &var, string type)
Set the type of the variable */
PHP_FUNCTION(settype)
{
@@ -96,11 +49,11 @@ PHP_FUNCTION(settype)
char *type;
size_t type_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs", &var, &type, &type_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_ZVAL_DEREF(var)
+ Z_PARAM_STRING(type, type_len)
+ ZEND_PARSE_PARAMETERS_END();
- ZVAL_DEREF(var);
if (!strcasecmp(type, "integer")) {
convert_to_long(var);
} else if (!strcasecmp(type, "int")) {
@@ -201,9 +154,9 @@ PHP_FUNCTION(floatval)
{
zval *num;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &num) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(num)
+ ZEND_PARSE_PARAMETERS_END();
RETURN_DOUBLE(zval_get_double(num));
}
@@ -215,9 +168,9 @@ PHP_FUNCTION(boolval)
{
zval *val;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(val)
+ ZEND_PARSE_PARAMETERS_END();
RETURN_BOOL(zend_is_true(val));
}
@@ -242,17 +195,11 @@ static inline void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
zval *arg;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL_DEREF(arg)
+ Z_PARAM_ZVAL(arg)
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (Z_TYPE_P(arg) == type) {
- if (type == IS_OBJECT) {
- zend_class_entry *ce = Z_OBJCE_P(arg);
- if (ZSTR_LEN(ce->name) == sizeof(INCOMPLETE_CLASS) - 1
- && !memcmp(ZSTR_VAL(ce->name), INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1)) {
- RETURN_FALSE;
- }
- } else if (type == IS_RESOURCE) {
+ if (type == IS_RESOURCE) {
const char *type_name = zend_rsrc_list_get_rsrc_type(Z_RES_P(arg));
if (!type_name) {
RETURN_FALSE;
@@ -290,11 +237,10 @@ PHP_FUNCTION(is_bool)
{
zval *arg;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(arg)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
- ZVAL_DEREF(arg);
RETURN_BOOL(Z_TYPE_P(arg) == IS_FALSE || Z_TYPE_P(arg) == IS_TRUE);
}
/* }}} */
@@ -401,7 +347,7 @@ PHP_FUNCTION(is_scalar)
}
/* }}} */
-/* {{{ proto bool is_callable(mixed var [, bool syntax_only [, string callable_name]])
+/* {{{ proto bool is_callable(mixed var [, bool syntax_only [, string &callable_name]])
Returns true if var is callable. */
PHP_FUNCTION(is_callable)
{
@@ -412,17 +358,19 @@ PHP_FUNCTION(is_callable)
zend_bool syntax_only = 0;
int check_flags = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|bz/", &var,
- &syntax_only, &callable_name) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_ZVAL(var)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(syntax_only)
+ Z_PARAM_ZVAL_DEREF(callable_name)
+ ZEND_PARSE_PARAMETERS_END();
if (syntax_only) {
check_flags |= IS_CALLABLE_CHECK_SYNTAX_ONLY;
}
if (ZEND_NUM_ARGS() > 2) {
retval = zend_is_callable_ex(var, NULL, check_flags, &name, NULL, &error);
- zval_dtor(callable_name);
+ zval_ptr_dtor(callable_name);
ZVAL_STR(callable_name, name);
} else {
retval = zend_is_callable_ex(var, NULL, check_flags, NULL, NULL, &error);
@@ -441,10 +389,10 @@ PHP_FUNCTION(is_callable)
PHP_FUNCTION(is_iterable)
{
zval *var;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &var) == FAILURE) {
- return;
- }
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(var)
+ ZEND_PARSE_PARAMETERS_END();
RETURN_BOOL(zend_is_iterable(var));
}
diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c
index 78698c3e84..9b4668ff46 100644
--- a/ext/standard/uniqid.c
+++ b/ext/standard/uniqid.c
@@ -12,7 +12,7 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
+ | Author: Stig Sæther Bakken <ssb@php.net> |
+----------------------------------------------------------------------+
*/
@@ -38,38 +38,38 @@
#include "php_lcg.h"
#include "uniqid.h"
+#ifdef HAVE_GETTIMEOFDAY
+ZEND_TLS struct timeval prev_tv = { 0, 0 };
+
/* {{{ proto string uniqid([string prefix [, bool more_entropy]])
Generates a unique ID */
-#ifdef HAVE_GETTIMEOFDAY
PHP_FUNCTION(uniqid)
{
char *prefix = "";
-#if defined(__CYGWIN__)
- zend_bool more_entropy = 1;
-#else
zend_bool more_entropy = 0;
-#endif
zend_string *uniqid;
int sec, usec;
size_t prefix_len = 0;
struct timeval tv;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|sb", &prefix, &prefix_len,
- &more_entropy)) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 2)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(prefix, prefix_len)
+ Z_PARAM_BOOL(more_entropy)
+ ZEND_PARSE_PARAMETERS_END();
+
+ /* This implementation needs current microsecond to change,
+ * hence we poll time until it does. This is much faster than
+ * calling usleep(1) which may cause the kernel to schedule
+ * another process, causing a pause of around 10ms.
+ */
+ do {
+ (void)gettimeofday((struct timeval *) &tv, (struct timezone *) NULL);
+ } while (tv.tv_sec == prev_tv.tv_sec && tv.tv_usec == prev_tv.tv_usec);
+
+ prev_tv.tv_sec = tv.tv_sec;
+ prev_tv.tv_usec = tv.tv_usec;
-#if HAVE_USLEEP && !defined(PHP_WIN32)
- if (!more_entropy) {
-#if defined(__CYGWIN__)
- php_error_docref(NULL, E_WARNING, "You must use 'more entropy' under CYGWIN");
- RETURN_FALSE;
-#else
- usleep(1);
-#endif
- }
-#endif
- gettimeofday((struct timeval *) &tv, (struct timezone *) NULL);
sec = (int) tv.tv_sec;
usec = (int) (tv.tv_usec % 0x100000);
diff --git a/ext/standard/uniqid.h b/ext/standard/uniqid.h
index 065240b91c..5adfbadbc5 100644
--- a/ext/standard/uniqid.h
+++ b/ext/standard/uniqid.h
@@ -12,7 +12,7 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@php.net> |
+ | Author: Stig Sæther Bakken <ssb@php.net> |
+----------------------------------------------------------------------+
*/
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 0eac03ee0a..57fd80cc1d 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -340,10 +340,13 @@ PHP_FUNCTION(parse_url)
size_t str_len;
php_url *resource;
zend_long key = -1;
+ zval tmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &str, &str_len, &key) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(key)
+ ZEND_PARSE_PARAMETERS_END();
resource = php_url_parse_ex(str, str_len);
if (resource == NULL) {
@@ -388,22 +391,38 @@ PHP_FUNCTION(parse_url)
array_init(return_value);
/* add the various elements to the array */
- if (resource->scheme != NULL)
- add_assoc_string(return_value, "scheme", resource->scheme);
- if (resource->host != NULL)
- add_assoc_string(return_value, "host", resource->host);
- if (resource->port != 0)
- add_assoc_long(return_value, "port", resource->port);
- if (resource->user != NULL)
- add_assoc_string(return_value, "user", resource->user);
- if (resource->pass != NULL)
- add_assoc_string(return_value, "pass", resource->pass);
- if (resource->path != NULL)
- add_assoc_string(return_value, "path", resource->path);
- if (resource->query != NULL)
- add_assoc_string(return_value, "query", resource->query);
- if (resource->fragment != NULL)
- add_assoc_string(return_value, "fragment", resource->fragment);
+ if (resource->scheme != NULL) {
+ ZVAL_STRING(&tmp, resource->scheme);
+ zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_SCHEME), &tmp);
+ }
+ if (resource->host != NULL) {
+ ZVAL_STRING(&tmp, resource->host);
+ zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_HOST), &tmp);
+ }
+ if (resource->port != 0) {
+ ZVAL_LONG(&tmp, resource->port);
+ zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_PORT), &tmp);
+ }
+ if (resource->user != NULL) {
+ ZVAL_STRING(&tmp, resource->user);
+ zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_USER), &tmp);
+ }
+ if (resource->pass != NULL) {
+ ZVAL_STRING(&tmp, resource->pass);
+ zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_PASS), &tmp);
+ }
+ if (resource->path != NULL) {
+ ZVAL_STRING(&tmp, resource->path);
+ zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_PATH), &tmp);
+ }
+ if (resource->query != NULL) {
+ ZVAL_STRING(&tmp, resource->query);
+ zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_QUERY), &tmp);
+ }
+ if (resource->fragment != NULL) {
+ ZVAL_STRING(&tmp, resource->fragment);
+ zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_FRAGMENT), &tmp);
+ }
done:
php_url_free(resource);
}
@@ -660,9 +679,12 @@ PHP_FUNCTION(get_headers)
zval *zcontext = NULL;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lr!", &url, &url_len, &format, &zcontext) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_STRING(url, url_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(format)
+ Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, 0);
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
index 9cb0733d87..54d89512ea 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -194,13 +194,6 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
return;
}
- /* Don't modify URLs of the format "#mark" */
- if (url_parts->fragment && '#' == ZSTR_VAL(url->s)[0]) {
- smart_str_append_smart_str(dest, url);
- php_url_free(url_parts);
- return;
- }
-
/* Check protocol. Only http/https is allowed. */
if (url_parts->scheme
&& strcasecmp("http", url_parts->scheme)
@@ -224,12 +217,13 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
* When URL does not have path and query string add "/?".
* i.e. If URL is only "?foo=bar", should not add "/?".
*/
- if (!url_parts->path && !url_parts->query && !url_parts->fragment) {
+ if (!url_parts->path && !url_parts->query) {
/* URL is http://php.net or like */
smart_str_append_smart_str(dest, url);
smart_str_appendc(dest, '/');
smart_str_appendc(dest, '?');
smart_str_append_smart_str(dest, url_app);
+ /* There should not be fragment. Just return */
php_url_free(url_parts);
return;
}
@@ -519,7 +513,7 @@ state_plain_begin:
state_plain:
start = YYCURSOR;
-#line 523 "ext/standard/url_scanner_ex.c"
+#line 517 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -569,22 +563,22 @@ yy2:
if (yybm[0+yych] & 128) {
goto yy2;
}
-#line 526 "ext/standard/url_scanner_ex.re"
+#line 520 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain; }
-#line 575 "ext/standard/url_scanner_ex.c"
+#line 569 "ext/standard/url_scanner_ex.c"
yy5:
++YYCURSOR;
-#line 525 "ext/standard/url_scanner_ex.re"
+#line 519 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; }
-#line 580 "ext/standard/url_scanner_ex.c"
+#line 574 "ext/standard/url_scanner_ex.c"
}
-#line 527 "ext/standard/url_scanner_ex.re"
+#line 521 "ext/standard/url_scanner_ex.re"
state_tag:
start = YYCURSOR;
-#line 588 "ext/standard/url_scanner_ex.c"
+#line 582 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -627,9 +621,9 @@ state_tag:
goto yy11;
}
++YYCURSOR;
-#line 533 "ext/standard/url_scanner_ex.re"
+#line 527 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain_begin; }
-#line 633 "ext/standard/url_scanner_ex.c"
+#line 627 "ext/standard/url_scanner_ex.c"
yy11:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -637,11 +631,11 @@ yy11:
if (yybm[0+yych] & 128) {
goto yy11;
}
-#line 532 "ext/standard/url_scanner_ex.re"
+#line 526 "ext/standard/url_scanner_ex.re"
{ handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; }
-#line 643 "ext/standard/url_scanner_ex.c"
+#line 637 "ext/standard/url_scanner_ex.c"
}
-#line 534 "ext/standard/url_scanner_ex.re"
+#line 528 "ext/standard/url_scanner_ex.re"
state_next_arg_begin:
@@ -650,7 +644,7 @@ state_next_arg_begin:
state_next_arg:
start = YYCURSOR;
-#line 654 "ext/standard/url_scanner_ex.c"
+#line 648 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -706,9 +700,9 @@ state_next_arg:
yy16:
++YYCURSOR;
yy17:
-#line 545 "ext/standard/url_scanner_ex.re"
+#line 539 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain_begin; }
-#line 712 "ext/standard/url_scanner_ex.c"
+#line 706 "ext/standard/url_scanner_ex.c"
yy18:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -716,30 +710,30 @@ yy18:
if (yybm[0+yych] & 128) {
goto yy18;
}
-#line 543 "ext/standard/url_scanner_ex.re"
+#line 537 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_next_arg; }
-#line 722 "ext/standard/url_scanner_ex.c"
+#line 716 "ext/standard/url_scanner_ex.c"
yy21:
yych = *++YYCURSOR;
if (yych != '>') goto yy17;
yy22:
++YYCURSOR;
-#line 542 "ext/standard/url_scanner_ex.re"
+#line 536 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
-#line 730 "ext/standard/url_scanner_ex.c"
+#line 724 "ext/standard/url_scanner_ex.c"
yy24:
++YYCURSOR;
-#line 544 "ext/standard/url_scanner_ex.re"
+#line 538 "ext/standard/url_scanner_ex.re"
{ --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
-#line 735 "ext/standard/url_scanner_ex.c"
+#line 729 "ext/standard/url_scanner_ex.c"
}
-#line 546 "ext/standard/url_scanner_ex.re"
+#line 540 "ext/standard/url_scanner_ex.re"
state_arg:
start = YYCURSOR;
-#line 743 "ext/standard/url_scanner_ex.c"
+#line 737 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -784,9 +778,9 @@ state_arg:
if (yych <= 'z') goto yy30;
yy28:
++YYCURSOR;
-#line 552 "ext/standard/url_scanner_ex.re"
+#line 546 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; }
-#line 790 "ext/standard/url_scanner_ex.c"
+#line 784 "ext/standard/url_scanner_ex.c"
yy30:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -794,17 +788,17 @@ yy30:
if (yybm[0+yych] & 128) {
goto yy30;
}
-#line 551 "ext/standard/url_scanner_ex.re"
+#line 545 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; }
-#line 800 "ext/standard/url_scanner_ex.c"
+#line 794 "ext/standard/url_scanner_ex.c"
}
-#line 553 "ext/standard/url_scanner_ex.re"
+#line 547 "ext/standard/url_scanner_ex.re"
state_before_val:
start = YYCURSOR;
-#line 808 "ext/standard/url_scanner_ex.c"
+#line 802 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -847,9 +841,9 @@ state_before_val:
if (yych == '=') goto yy38;
++YYCURSOR;
yy36:
-#line 559 "ext/standard/url_scanner_ex.re"
+#line 553 "ext/standard/url_scanner_ex.re"
{ --YYCURSOR; goto state_next_arg_begin; }
-#line 853 "ext/standard/url_scanner_ex.c"
+#line 847 "ext/standard/url_scanner_ex.c"
yy37:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ' ') goto yy41;
@@ -861,9 +855,9 @@ yy38:
if (yybm[0+yych] & 128) {
goto yy38;
}
-#line 558 "ext/standard/url_scanner_ex.re"
+#line 552 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; }
-#line 867 "ext/standard/url_scanner_ex.c"
+#line 861 "ext/standard/url_scanner_ex.c"
yy41:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -873,14 +867,14 @@ yy41:
YYCURSOR = YYMARKER;
goto yy36;
}
-#line 560 "ext/standard/url_scanner_ex.re"
+#line 554 "ext/standard/url_scanner_ex.re"
state_val:
start = YYCURSOR;
-#line 884 "ext/standard/url_scanner_ex.c"
+#line 878 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -933,15 +927,15 @@ yy46:
if (yybm[0+yych] & 32) {
goto yy46;
}
-#line 568 "ext/standard/url_scanner_ex.re"
+#line 562 "ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; }
-#line 939 "ext/standard/url_scanner_ex.c"
+#line 933 "ext/standard/url_scanner_ex.c"
yy49:
++YYCURSOR;
yy50:
-#line 569 "ext/standard/url_scanner_ex.re"
+#line 563 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_next_arg_begin; }
-#line 945 "ext/standard/url_scanner_ex.c"
+#line 939 "ext/standard/url_scanner_ex.c"
yy51:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == '>') goto yy50;
@@ -964,9 +958,9 @@ yy55:
goto yy50;
yy56:
++YYCURSOR;
-#line 566 "ext/standard/url_scanner_ex.re"
+#line 560 "ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
-#line 970 "ext/standard/url_scanner_ex.c"
+#line 964 "ext/standard/url_scanner_ex.c"
yy58:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -977,11 +971,11 @@ yy59:
}
if (yych >= '(') goto yy55;
++YYCURSOR;
-#line 567 "ext/standard/url_scanner_ex.re"
+#line 561 "ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
-#line 983 "ext/standard/url_scanner_ex.c"
+#line 977 "ext/standard/url_scanner_ex.c"
}
-#line 570 "ext/standard/url_scanner_ex.re"
+#line 564 "ext/standard/url_scanner_ex.re"
stop:
@@ -1109,7 +1103,7 @@ static inline void php_url_scanner_session_handler_impl(char *output, size_t out
if (ZSTR_LEN(url_state->url_app.s) != 0) {
*handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & (PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_CONT | PHP_OUTPUT_HANDLER_FLUSH | PHP_OUTPUT_HANDLER_FINAL) ? 1 : 0), url_state);
- if (sizeof(uint) < sizeof(size_t)) {
+ if (sizeof(uint32_t) < sizeof(size_t)) {
if (len > UINT_MAX)
len = UINT_MAX;
}
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index 628a7fee58..9addd9c924 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -197,13 +197,6 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
return;
}
- /* Don't modify URLs of the format "#mark" */
- if (url_parts->fragment && '#' == ZSTR_VAL(url->s)[0]) {
- smart_str_append_smart_str(dest, url);
- php_url_free(url_parts);
- return;
- }
-
/* Check protocol. Only http/https is allowed. */
if (url_parts->scheme
&& strcasecmp("http", url_parts->scheme)
@@ -227,12 +220,13 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
* When URL does not have path and query string add "/?".
* i.e. If URL is only "?foo=bar", should not add "/?".
*/
- if (!url_parts->path && !url_parts->query && !url_parts->fragment) {
+ if (!url_parts->path && !url_parts->query) {
/* URL is http://php.net or like */
smart_str_append_smart_str(dest, url);
smart_str_appendc(dest, '/');
smart_str_appendc(dest, '?');
smart_str_append_smart_str(dest, url_app);
+ /* There should not be fragment. Just return */
php_url_free(url_parts);
return;
}
diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c
index a2725a4034..7749887f8f 100644
--- a/ext/standard/user_filters.c
+++ b/ext/standard/user_filters.c
@@ -261,7 +261,7 @@ static php_stream_filter_ops userfilter_ops = {
};
static php_stream_filter *user_filter_factory_create(const char *filtername,
- zval *filterparams, int persistent)
+ zval *filterparams, uint8_t persistent)
{
struct php_user_filter_data *fdat = NULL;
php_stream_filter *filter;
@@ -399,9 +399,9 @@ PHP_FUNCTION(stream_bucket_make_writeable)
php_stream_bucket_brigade *brigade;
php_stream_bucket *bucket;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zbrigade) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(zbrigade)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if ((brigade = (php_stream_bucket_brigade*)zend_fetch_resource(
Z_RES_P(zbrigade), PHP_STREAM_BRIGADE_RES_NAME, le_bucket_brigade)) == NULL) {
@@ -430,9 +430,10 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS)
php_stream_bucket_brigade *brigade;
php_stream_bucket *bucket;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ro", &zbrigade, &zobject) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(zbrigade)
+ Z_PARAM_OBJECT(zobject)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (NULL == (pzbucket = zend_hash_str_find(Z_OBJPROP_P(zobject), "bucket", sizeof("bucket")-1))) {
php_error_docref(NULL, E_WARNING, "Object has no bucket property");
@@ -500,15 +501,14 @@ PHP_FUNCTION(stream_bucket_new)
size_t buffer_len;
php_stream_bucket *bucket;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs", &zstream, &buffer, &buffer_len) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_ZVAL(zstream)
+ Z_PARAM_STRING(buffer, buffer_len)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, zstream);
- if (!(pbuffer = pemalloc(buffer_len, php_stream_is_persistent(stream)))) {
- RETURN_FALSE;
- }
+ pbuffer = pemalloc(buffer_len, php_stream_is_persistent(stream));
memcpy(pbuffer, buffer, buffer_len);
@@ -561,9 +561,10 @@ PHP_FUNCTION(stream_filter_register)
zend_string *filtername, *classname;
struct php_user_filter_data *fdat;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &filtername, &classname) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_STR(filtername)
+ Z_PARAM_STR(classname)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
RETVAL_FALSE;
diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c
index 5613e068a8..3a619d379e 100644
--- a/ext/standard/uuencode.c
+++ b/ext/standard/uuencode.c
@@ -204,9 +204,10 @@ PHP_FUNCTION(convert_uuencode)
{
zend_string *src;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &src) == FAILURE || ZSTR_LEN(src) < 1) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(src)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ if (ZSTR_LEN(src) < 1) { RETURN_FALSE; }
RETURN_STR(php_uuencode(ZSTR_VAL(src), ZSTR_LEN(src)));
}
@@ -219,9 +220,10 @@ PHP_FUNCTION(convert_uudecode)
zend_string *src;
zend_string *dest;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &src) == FAILURE || ZSTR_LEN(src) < 1) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(src)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ if (ZSTR_LEN(src) < 1) { RETURN_FALSE; }
if ((dest = php_uudecode(ZSTR_VAL(src), ZSTR_LEN(src))) == NULL) {
php_error_docref(NULL, E_WARNING, "The given parameter is not a valid uuencoded string");
diff --git a/ext/standard/var.c b/ext/standard/var.c
index c18f1d31ad..a5a88b634d 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -202,9 +202,9 @@ PHP_FUNCTION(var_dump)
int argc;
int i;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argc) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_VARIADIC('+', args, argc)
+ ZEND_PARSE_PARAMETERS_END();
for (i = 0; i < argc; i++) {
php_var_dump(&args[i], 1);
@@ -366,9 +366,9 @@ PHP_FUNCTION(debug_zval_dump)
int argc;
int i;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argc) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_VARIADIC('+', args, argc)
+ ZEND_PARSE_PARAMETERS_END();
for (i = 0; i < argc; i++) {
php_debug_zval_dump(&args[i], 1);
@@ -572,9 +572,11 @@ PHP_FUNCTION(var_export)
zend_bool return_output = 0;
smart_str buf = {0};
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &var, &return_output) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ZVAL(var)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(return_output)
+ ZEND_PARSE_PARAMETERS_END();
php_var_export_ex(var, 1, &buf);
smart_str_0 (&buf);
@@ -669,21 +671,44 @@ static inline zend_bool php_var_serialize_class_name(smart_str *buf, zval *struc
}
/* }}} */
-static HashTable *php_var_serialize_collect_names(HashTable *src, uint32_t count, zend_bool incomplete) /* {{{ */ {
+static int php_var_serialize_call_sleep(zval *retval, zval *struc) /* {{{ */
+{
+ zval fname;
+ int res;
+
+ ZVAL_STRINGL(&fname, "__sleep", sizeof("__sleep") - 1);
+ BG(serialize_lock)++;
+ res = call_user_function_ex(CG(function_table), struc, &fname, retval, 0, 0, 1, NULL);
+ BG(serialize_lock)--;
+ zval_dtor(&fname);
+
+ if (res == FAILURE || Z_ISUNDEF_P(retval)) {
+ zval_ptr_dtor(retval);
+ return FAILURE;
+ }
+
+ if (!HASH_OF(retval)) {
+ zval_ptr_dtor(retval);
+ php_error_docref(NULL, E_NOTICE, "__sleep should return an array only containing the names of instance-variables to serialize");
+ return FAILURE;
+ }
+
+ return SUCCESS;
+}
+/* }}} */
+
+static void php_var_serialize_collect_names(HashTable *ht, HashTable *src) /* {{{ */
+{
zval *val;
- HashTable *ht;
- zend_string *key, *name;
+ zend_string *name;
- ALLOC_HASHTABLE(ht);
- zend_hash_init(ht, count, NULL, NULL, 0);
- ZEND_HASH_FOREACH_STR_KEY_VAL(src, key, val) {
- if (incomplete && strcmp(ZSTR_VAL(key), MAGIC_MEMBER) == 0) {
- continue;
- }
+ zend_hash_init(ht, zend_hash_num_elements(src), NULL, NULL, 0);
+ ZEND_HASH_FOREACH_VAL(src, val) {
if (Z_TYPE_P(val) != IS_STRING) {
php_error_docref(NULL, E_NOTICE,
"__sleep should return an array only containing the names of instance-variables to serialize.");
}
+
name = zval_get_string(val);
if (zend_hash_exists(ht, name)) {
php_error_docref(NULL, E_NOTICE,
@@ -694,114 +719,89 @@ static HashTable *php_var_serialize_collect_names(HashTable *src, uint32_t count
zend_hash_add_empty_element(ht, name);
zend_string_release(name);
} ZEND_HASH_FOREACH_END();
-
- return ht;
}
/* }}} */
static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_ptr, php_serialize_data_t var_hash) /* {{{ */
{
- uint32_t count;
- zend_bool incomplete_class;
- HashTable *ht;
-
- incomplete_class = php_var_serialize_class_name(buf, struc);
- /* count after serializing name, since php_var_serialize_class_name
- * changes the count if the variable is incomplete class */
- if (Z_TYPE_P(retval_ptr) == IS_ARRAY) {
- ht = Z_ARRVAL_P(retval_ptr);
- count = zend_array_count(ht);
- } else if (Z_TYPE_P(retval_ptr) == IS_OBJECT) {
- ht = Z_OBJPROP_P(retval_ptr);
- count = zend_array_count(ht);
- if (incomplete_class) {
- --count;
- }
- } else {
- count = 0;
- ht = NULL;
- }
+ zend_class_entry *ce = Z_OBJCE_P(struc);
+ HashTable names, *propers;
+ zval nval;
+ zend_string *name;
- if (count > 0) {
- zval *d;
- zval nval, *nvalp;
- zend_string *name;
- HashTable *names, *propers;
+ php_var_serialize_class_name(buf, struc);
+ php_var_serialize_collect_names(&names, HASH_OF(retval_ptr));
- names = php_var_serialize_collect_names(ht, count, incomplete_class);
+ smart_str_append_unsigned(buf, zend_hash_num_elements(&names));
+ smart_str_appendl(buf, ":{", 2);
- smart_str_append_unsigned(buf, zend_hash_num_elements(names));
- smart_str_appendl(buf, ":{", 2);
+ ZVAL_NULL(&nval);
+ propers = Z_OBJPROP_P(struc);
- ZVAL_NULL(&nval);
- nvalp = &nval;
- propers = Z_OBJPROP_P(struc);
+ ZEND_HASH_FOREACH_STR_KEY(&names, name) {
+ zend_string *prot_name, *priv_name;
- ZEND_HASH_FOREACH_STR_KEY(names, name) {
- if ((d = zend_hash_find(propers, name)) != NULL) {
- if (Z_TYPE_P(d) == IS_INDIRECT) {
- d = Z_INDIRECT_P(d);
- if (Z_TYPE_P(d) == IS_UNDEF) {
- continue;
- }
+ zval *val = zend_hash_find(propers, name);
+ if (val != NULL) {
+ if (Z_TYPE_P(val) == IS_INDIRECT) {
+ val = Z_INDIRECT_P(val);
+ if (Z_TYPE_P(val) == IS_UNDEF) {
+ goto undef_prop;
}
- php_var_serialize_string(buf, ZSTR_VAL(name), ZSTR_LEN(name));
- php_var_serialize_intern(buf, d, var_hash);
- } else {
- zend_class_entry *ce = Z_OBJ_P(struc)->ce;
- if (ce) {
- zend_string *prot_name, *priv_name;
-
- do {
- priv_name = zend_mangle_property_name(
- ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), ZSTR_VAL(name), ZSTR_LEN(name), ce->type & ZEND_INTERNAL_CLASS);
- if ((d = zend_hash_find(propers, priv_name)) != NULL) {
- if (Z_TYPE_P(d) == IS_INDIRECT) {
- d = Z_INDIRECT_P(d);
- if (Z_ISUNDEF_P(d)) {
- break;
- }
- }
- php_var_serialize_string(buf, ZSTR_VAL(priv_name), ZSTR_LEN(priv_name));
- zend_string_free(priv_name);
- php_var_serialize_intern(buf, d, var_hash);
- break;
- }
- zend_string_free(priv_name);
- prot_name = zend_mangle_property_name(
- "*", 1, ZSTR_VAL(name), ZSTR_LEN(name), ce->type & ZEND_INTERNAL_CLASS);
- if ((d = zend_hash_find(propers, prot_name)) != NULL) {
- if (Z_TYPE_P(d) == IS_INDIRECT) {
- d = Z_INDIRECT_P(d);
- if (Z_TYPE_P(d) == IS_UNDEF) {
- zend_string_free(prot_name);
- break;
- }
- }
- php_var_serialize_string(buf, ZSTR_VAL(prot_name), ZSTR_LEN(prot_name));
- zend_string_free(prot_name);
- php_var_serialize_intern(buf, d, var_hash);
- break;
- }
- zend_string_free(prot_name);
- php_var_serialize_string(buf, ZSTR_VAL(name), ZSTR_LEN(name));
- php_var_serialize_intern(buf, nvalp, var_hash);
- php_error_docref(NULL, E_NOTICE,
- "\"%s\" returned as member variable from __sleep() but does not exist", ZSTR_VAL(name));
- } while (0);
- } else {
- php_var_serialize_string(buf, ZSTR_VAL(name), ZSTR_LEN(name));
- php_var_serialize_intern(buf, nvalp, var_hash);
+ }
+
+ php_var_serialize_string(buf, ZSTR_VAL(name), ZSTR_LEN(name));
+ php_var_serialize_intern(buf, val, var_hash);
+ continue;
+ }
+
+ priv_name = zend_mangle_property_name(
+ ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), ZSTR_VAL(name), ZSTR_LEN(name), ce->type & ZEND_INTERNAL_CLASS);
+ val = zend_hash_find(propers, priv_name);
+ if (val != NULL) {
+ if (Z_TYPE_P(val) == IS_INDIRECT) {
+ val = Z_INDIRECT_P(val);
+ if (Z_ISUNDEF_P(val)) {
+ zend_string_free(priv_name);
+ goto undef_prop;
}
}
- } ZEND_HASH_FOREACH_END();
- smart_str_appendc(buf, '}');
- zend_hash_destroy(names);
- FREE_HASHTABLE(names);
- } else {
- smart_str_appendl(buf, "0:{}", 4);
- }
+ php_var_serialize_string(buf, ZSTR_VAL(priv_name), ZSTR_LEN(priv_name));
+ zend_string_free(priv_name);
+ php_var_serialize_intern(buf, val, var_hash);
+ continue;
+ }
+ zend_string_free(priv_name);
+
+ prot_name = zend_mangle_property_name(
+ "*", 1, ZSTR_VAL(name), ZSTR_LEN(name), ce->type & ZEND_INTERNAL_CLASS);
+ val = zend_hash_find(propers, prot_name);
+ if (val != NULL) {
+ if (Z_TYPE_P(val) == IS_INDIRECT) {
+ val = Z_INDIRECT_P(val);
+ if (Z_TYPE_P(val) == IS_UNDEF) {
+ zend_string_free(prot_name);
+ goto undef_prop;
+ }
+ }
+
+ php_var_serialize_string(buf, ZSTR_VAL(prot_name), ZSTR_LEN(prot_name));
+ zend_string_free(prot_name);
+ php_var_serialize_intern(buf, val, var_hash);
+ continue;
+ }
+ zend_string_free(prot_name);
+
+undef_prop:
+ php_var_serialize_string(buf, ZSTR_VAL(name), ZSTR_LEN(name));
+ php_var_serialize_intern(buf, &nval, var_hash);
+ php_error_docref(NULL, E_NOTICE,
+ "\"%s\" returned as member variable from __sleep() but does not exist", ZSTR_VAL(name));
+ } ZEND_HASH_FOREACH_END();
+ smart_str_appendc(buf, '}');
+
+ zend_hash_destroy(&names);
}
/* }}} */
@@ -888,39 +888,23 @@ again:
}
if (ce != PHP_IC_ENTRY && zend_hash_str_exists(&ce->function_table, "__sleep", sizeof("__sleep")-1)) {
- zval fname, tmp, retval;
- int res;
-
+ zval retval, tmp;
ZVAL_COPY(&tmp, struc);
- ZVAL_STRINGL(&fname, "__sleep", sizeof("__sleep") - 1);
- BG(serialize_lock)++;
- res = call_user_function_ex(CG(function_table), &tmp, &fname, &retval, 0, 0, 1, NULL);
- BG(serialize_lock)--;
- zval_dtor(&fname);
-
- if (EG(exception)) {
- zval_ptr_dtor(&retval);
- zval_ptr_dtor(&tmp);
- return;
- }
- if (res == SUCCESS) {
- if (Z_TYPE(retval) != IS_UNDEF) {
- if (HASH_OF(&retval)) {
- php_var_serialize_class(buf, &tmp, &retval, var_hash);
- } else {
- php_error_docref(NULL, E_NOTICE, "__sleep should return an array only containing the names of instance-variables to serialize");
- /* we should still add element even if it's not OK,
- * since we already wrote the length of the array before */
- smart_str_appendl(buf,"N;", 2);
- }
+ if (php_var_serialize_call_sleep(&retval, &tmp) == FAILURE) {
+ if (!EG(exception)) {
+ /* we should still add element even if it's not OK,
+ * since we already wrote the length of the array before */
+ smart_str_appendl(buf, "N;", 2);
}
- zval_ptr_dtor(&retval);
zval_ptr_dtor(&tmp);
return;
}
+
+ php_var_serialize_class(buf, &tmp, &retval, var_hash);
zval_ptr_dtor(&retval);
zval_ptr_dtor(&tmp);
+ return;
}
/* fall-through */
@@ -1039,9 +1023,9 @@ PHP_FUNCTION(serialize)
php_serialize_data_t var_hash;
smart_str buf = {0};
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &struc) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL(struc)
+ ZEND_PARSE_PARAMETERS_END();
PHP_VAR_SERIALIZE_INIT(var_hash);
php_var_serialize(&buf, struc, &var_hash);
@@ -1072,9 +1056,11 @@ PHP_FUNCTION(unserialize)
zval *retval;
HashTable *class_hash = NULL, *prev_class_hash;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|a", &buf, &buf_len, &options) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(buf, buf_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ARRAY(options)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (buf_len == 0) {
RETURN_FALSE;
@@ -1144,9 +1130,10 @@ PHP_FUNCTION(unserialize)
PHP_FUNCTION(memory_get_usage) {
zend_bool real_usage = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &real_usage) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(real_usage)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
RETURN_LONG(zend_memory_usage(real_usage));
}
@@ -1157,9 +1144,10 @@ PHP_FUNCTION(memory_get_usage) {
PHP_FUNCTION(memory_get_peak_usage) {
zend_bool real_usage = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &real_usage) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(real_usage)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
RETURN_LONG(zend_memory_peak_usage(real_usage));
}
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c
index 35c6160138..679d9c6d8b 100644
--- a/ext/standard/var_unserializer.c
+++ b/ext/standard/var_unserializer.c
@@ -23,6 +23,7 @@
#include "php.h"
#include "ext/standard/php_var.h"
#include "php_incomplete_class.h"
+#include "zend_portability.h"
struct php_unserialize_data {
void *first;
@@ -232,14 +233,14 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
}
}
- zval_ptr_dtor(zv);
+ i_zval_ptr_dtor(zv ZEND_FILE_LINE_CC);
}
next = var_dtor_hash->next;
efree_size(var_dtor_hash, sizeof(var_dtor_entries));
var_dtor_hash = next;
}
- zval_ptr_dtor(&wakeup_name);
+ zval_ptr_dtor_nogc(&wakeup_name);
}
/* }}} */
@@ -316,7 +317,7 @@ static inline int unserialize_allowed_class(
#define YYMARKER marker
-#line 324 "ext/standard/var_unserializer.re"
+#line 325 "ext/standard/var_unserializer.re"
@@ -352,10 +353,6 @@ static inline size_t parse_uiv(const unsigned char *p)
unsigned char cursor;
size_t result = 0;
- if (*p == '+') {
- p++;
- }
-
while (1) {
cursor = *p;
if (cursor >= '0' && cursor <= '9') {
@@ -382,7 +379,7 @@ static zend_always_inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTab
ZVAL_UNDEF(&key);
if (!php_var_unserialize_internal(&key, p, max, NULL)) {
- zval_dtor(&key);
+ zval_ptr_dtor(&key);
return 0;
}
@@ -412,38 +409,82 @@ numeric_key:
data = zend_hash_add_new(ht, Z_STR(key), &d);
}
} else {
- zval_dtor(&key);
+ zval_ptr_dtor(&key);
return 0;
}
} else {
if (EXPECTED(Z_TYPE(key) == IS_STRING)) {
string_key:
- if ((old_data = zend_hash_find(ht, Z_STR(key))) != NULL) {
- if (Z_TYPE_P(old_data) == IS_INDIRECT) {
- old_data = Z_INDIRECT_P(old_data);
+ {
+ zend_property_info *existing_propinfo;
+ zend_string *new_key, *unmangled;
+ const char *unmangled_class = NULL;
+ const char *unmangled_prop;
+ size_t unmangled_prop_len;
+
+ if (UNEXPECTED(zend_unmangle_property_name_ex(Z_STR(key), &unmangled_class, &unmangled_prop, &unmangled_prop_len) == FAILURE)) {
+ zval_ptr_dtor(&key);
+ return 0;
+ }
+
+ unmangled = zend_string_init(unmangled_prop, unmangled_prop_len, 0);
+ if (Z_TYPE_P(rval) == IS_OBJECT
+ && ((existing_propinfo = zend_hash_find_ptr(&Z_OBJCE_P(rval)->properties_info, unmangled)) != NULL)
+ && (existing_propinfo->flags & ZEND_ACC_PPP_MASK)) {
+ if (existing_propinfo->flags & ZEND_ACC_PROTECTED) {
+ new_key = zend_mangle_property_name(
+ "*", 1, ZSTR_VAL(unmangled), ZSTR_LEN(unmangled), Z_OBJCE_P(rval)->type & ZEND_INTERNAL_CLASS);
+ zend_string_release(unmangled);
+ } else if (existing_propinfo->flags & ZEND_ACC_PRIVATE) {
+ if (unmangled_class != NULL && strcmp(unmangled_class, "*") != 0) {
+ new_key = zend_mangle_property_name(
+ unmangled_class, strlen(unmangled_class),
+ ZSTR_VAL(unmangled), ZSTR_LEN(unmangled),
+ Z_OBJCE_P(rval)->type & ZEND_INTERNAL_CLASS);
+ } else {
+ new_key = zend_mangle_property_name(
+ ZSTR_VAL(existing_propinfo->ce->name), ZSTR_LEN(existing_propinfo->ce->name),
+ ZSTR_VAL(unmangled), ZSTR_LEN(unmangled),
+ Z_OBJCE_P(rval)->type & ZEND_INTERNAL_CLASS);
+ }
+ zend_string_release(unmangled);
+ } else {
+ ZEND_ASSERT(existing_propinfo->flags & ZEND_ACC_PUBLIC);
+ new_key = unmangled;
+ }
+ zend_string_release(Z_STR(key));
+ ZVAL_STR(&key, new_key);
+ } else {
+ zend_string_release(unmangled);
+ }
+
+ if ((old_data = zend_hash_find(ht, Z_STR(key))) != NULL) {
+ if (Z_TYPE_P(old_data) == IS_INDIRECT) {
+ old_data = Z_INDIRECT_P(old_data);
+ }
+ var_push_dtor(var_hash, old_data);
+ data = zend_hash_update_ind(ht, Z_STR(key), &d);
+ } else {
+ data = zend_hash_add_new(ht, Z_STR(key), &d);
}
- var_push_dtor(var_hash, old_data);
- data = zend_hash_update_ind(ht, Z_STR(key), &d);
- } else {
- data = zend_hash_add_new(ht, Z_STR(key), &d);
}
} else if (Z_TYPE(key) == IS_LONG) {
/* object properties should include no integers */
convert_to_string(&key);
goto string_key;
} else {
- zval_dtor(&key);
+ zval_ptr_dtor(&key);
return 0;
}
}
if (!php_var_unserialize_internal(data, p, max, var_hash)) {
- zval_dtor(&key);
+ zval_ptr_dtor(&key);
return 0;
}
var_push_dtor(var_hash, data);
- zval_dtor(&key);
+ zval_ptr_dtor(&key);
if (elements && *(*p-1) != ';' && *(*p-1) != '}') {
(*p)--;
@@ -603,7 +644,7 @@ static int php_var_unserialize_internal(UNSERIALIZE_PARAMETER)
start = cursor;
-#line 607 "ext/standard/var_unserializer.c"
+#line 648 "ext/standard/var_unserializer.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -661,9 +702,9 @@ static int php_var_unserialize_internal(UNSERIALIZE_PARAMETER)
yy2:
++YYCURSOR;
yy3:
-#line 982 "ext/standard/var_unserializer.re"
+#line 1035 "ext/standard/var_unserializer.re"
{ return 0; }
-#line 667 "ext/standard/var_unserializer.c"
+#line 708 "ext/standard/var_unserializer.c"
yy4:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy17;
@@ -710,288 +751,236 @@ yy14:
goto yy3;
yy15:
++YYCURSOR;
-#line 976 "ext/standard/var_unserializer.re"
+#line 1029 "ext/standard/var_unserializer.re"
{
/* this is the case where we have less data than planned */
php_error_docref(NULL, E_NOTICE, "Unexpected end of serialized data");
return 0; /* not sure if it should be 0 or 1 here? */
}
-#line 720 "ext/standard/var_unserializer.c"
+#line 761 "ext/standard/var_unserializer.c"
yy17:
yych = *++YYCURSOR;
if (yybm[0+yych] & 128) {
- goto yy31;
+ goto yy30;
}
- if (yych == '+') goto yy30;
yy18:
YYCURSOR = YYMARKER;
goto yy3;
yy19:
++YYCURSOR;
-#line 660 "ext/standard/var_unserializer.re"
+#line 701 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
ZVAL_NULL(rval);
return 1;
}
-#line 738 "ext/standard/var_unserializer.c"
+#line 778 "ext/standard/var_unserializer.c"
yy21:
yych = *++YYCURSOR;
- if (yych <= ',') {
- if (yych == '+') goto yy33;
- goto yy18;
- } else {
- if (yych <= '-') goto yy33;
- if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy34;
- goto yy18;
- }
+ if (yych <= '/') goto yy18;
+ if (yych <= '9') goto yy32;
+ goto yy18;
yy22:
yych = *++YYCURSOR;
- if (yych == '+') goto yy36;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy37;
+ if (yych <= '9') goto yy34;
goto yy18;
yy23:
yych = *++YYCURSOR;
- if (yych == '+') goto yy39;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy40;
+ if (yych <= '9') goto yy36;
goto yy18;
yy24:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
- if (yych <= '1') goto yy42;
+ if (yych <= '1') goto yy38;
goto yy18;
yy25:
yych = *++YYCURSOR;
if (yych <= '/') {
if (yych <= ',') {
- if (yych == '+') goto yy43;
+ if (yych == '+') goto yy39;
goto yy18;
} else {
- if (yych <= '-') goto yy44;
- if (yych <= '.') goto yy45;
+ if (yych <= '-') goto yy40;
+ if (yych <= '.') goto yy41;
goto yy18;
}
} else {
if (yych <= 'I') {
- if (yych <= '9') goto yy46;
+ if (yych <= '9') goto yy42;
if (yych <= 'H') goto yy18;
- goto yy48;
+ goto yy44;
} else {
- if (yych == 'N') goto yy49;
+ if (yych == 'N') goto yy45;
goto yy18;
}
}
yy26:
yych = *++YYCURSOR;
if (yych <= ',') {
- if (yych == '+') goto yy50;
+ if (yych == '+') goto yy46;
goto yy18;
} else {
- if (yych <= '-') goto yy50;
+ if (yych <= '-') goto yy46;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy51;
+ if (yych <= '9') goto yy47;
goto yy18;
}
yy27:
yych = *++YYCURSOR;
- if (yych <= ',') {
- if (yych == '+') goto yy53;
- goto yy18;
- } else {
- if (yych <= '-') goto yy53;
- if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy54;
- goto yy18;
- }
+ if (yych <= '/') goto yy18;
+ if (yych <= '9') goto yy49;
+ goto yy18;
yy28:
yych = *++YYCURSOR;
- if (yych <= ',') {
- if (yych == '+') goto yy56;
- goto yy18;
- } else {
- if (yych <= '-') goto yy56;
- if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy57;
- goto yy18;
- }
+ if (yych <= '/') goto yy18;
+ if (yych <= '9') goto yy51;
+ goto yy18;
yy29:
yych = *++YYCURSOR;
- if (yych == '+') goto yy59;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy60;
+ if (yych <= '9') goto yy53;
goto yy18;
yy30:
- yych = *++YYCURSOR;
- if (yybm[0+yych] & 128) {
- goto yy31;
- }
- goto yy18;
-yy31:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if (yybm[0+yych] & 128) {
- goto yy31;
+ goto yy30;
}
if (yych <= '/') goto yy18;
- if (yych <= ':') goto yy62;
+ if (yych <= ':') goto yy55;
goto yy18;
-yy33:
- yych = *++YYCURSOR;
- if (yych <= '/') goto yy18;
- if (yych >= ':') goto yy18;
-yy34:
+yy32:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy34;
- if (yych == ';') goto yy63;
+ if (yych <= '9') goto yy32;
+ if (yych == ';') goto yy56;
goto yy18;
-yy36:
- yych = *++YYCURSOR;
- if (yych <= '/') goto yy18;
- if (yych >= ':') goto yy18;
-yy37:
+yy34:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy37;
- if (yych <= ':') goto yy65;
+ if (yych <= '9') goto yy34;
+ if (yych <= ':') goto yy58;
goto yy18;
-yy39:
- yych = *++YYCURSOR;
- if (yych <= '/') goto yy18;
- if (yych >= ':') goto yy18;
-yy40:
+yy36:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy40;
- if (yych <= ':') goto yy66;
+ if (yych <= '9') goto yy36;
+ if (yych <= ':') goto yy59;
goto yy18;
-yy42:
+yy38:
yych = *++YYCURSOR;
- if (yych == ';') goto yy67;
+ if (yych == ';') goto yy60;
goto yy18;
-yy43:
+yy39:
yych = *++YYCURSOR;
- if (yych == '.') goto yy45;
+ if (yych == '.') goto yy41;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy46;
+ if (yych <= '9') goto yy42;
goto yy18;
-yy44:
+yy40:
yych = *++YYCURSOR;
if (yych <= '/') {
if (yych != '.') goto yy18;
} else {
- if (yych <= '9') goto yy46;
- if (yych == 'I') goto yy48;
+ if (yych <= '9') goto yy42;
+ if (yych == 'I') goto yy44;
goto yy18;
}
-yy45:
+yy41:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy69;
+ if (yych <= '9') goto yy62;
goto yy18;
-yy46:
+yy42:
++YYCURSOR;
- if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
+ if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
if (yych <= ':') {
if (yych <= '.') {
if (yych <= '-') goto yy18;
- goto yy69;
+ goto yy62;
} else {
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy46;
+ if (yych <= '9') goto yy42;
goto yy18;
}
} else {
if (yych <= 'E') {
- if (yych <= ';') goto yy71;
+ if (yych <= ';') goto yy64;
if (yych <= 'D') goto yy18;
- goto yy73;
+ goto yy66;
} else {
- if (yych == 'e') goto yy73;
+ if (yych == 'e') goto yy66;
goto yy18;
}
}
-yy48:
+yy44:
yych = *++YYCURSOR;
- if (yych == 'N') goto yy74;
+ if (yych == 'N') goto yy67;
goto yy18;
-yy49:
+yy45:
yych = *++YYCURSOR;
- if (yych == 'A') goto yy75;
+ if (yych == 'A') goto yy68;
goto yy18;
-yy50:
+yy46:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
if (yych >= ':') goto yy18;
-yy51:
+yy47:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy51;
- if (yych == ';') goto yy76;
+ if (yych <= '9') goto yy47;
+ if (yych == ';') goto yy69;
goto yy18;
-yy53:
- yych = *++YYCURSOR;
- if (yych <= '/') goto yy18;
- if (yych >= ':') goto yy18;
-yy54:
+yy49:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy54;
- if (yych <= ':') goto yy78;
+ if (yych <= '9') goto yy49;
+ if (yych <= ':') goto yy71;
goto yy18;
-yy56:
- yych = *++YYCURSOR;
- if (yych <= '/') goto yy18;
- if (yych >= ':') goto yy18;
-yy57:
+yy51:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy57;
- if (yych == ';') goto yy79;
+ if (yych <= '9') goto yy51;
+ if (yych == ';') goto yy72;
goto yy18;
-yy59:
- yych = *++YYCURSOR;
- if (yych <= '/') goto yy18;
- if (yych >= ':') goto yy18;
-yy60:
+yy53:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy60;
- if (yych <= ':') goto yy81;
+ if (yych <= '9') goto yy53;
+ if (yych <= ':') goto yy74;
goto yy18;
-yy62:
+yy55:
yych = *++YYCURSOR;
- if (yych == '"') goto yy82;
+ if (yych == '"') goto yy75;
goto yy18;
-yy63:
+yy56:
++YYCURSOR;
-#line 611 "ext/standard/var_unserializer.re"
+#line 652 "ext/standard/var_unserializer.re"
{
zend_long id;
*p = YYCURSOR;
if (!var_hash) return 0;
- id = parse_iv(start + 2) - 1;
+ id = parse_uiv(start + 2) - 1;
if (id == -1 || (rval_ref = var_access(var_hash, id)) == NULL) {
return 0;
}
@@ -1009,44 +998,44 @@ yy63:
return 1;
}
-#line 1013 "ext/standard/var_unserializer.c"
-yy65:
+#line 1002 "ext/standard/var_unserializer.c"
+yy58:
yych = *++YYCURSOR;
- if (yych == '"') goto yy84;
+ if (yych == '"') goto yy77;
goto yy18;
-yy66:
+yy59:
yych = *++YYCURSOR;
- if (yych == '{') goto yy86;
+ if (yych == '{') goto yy79;
goto yy18;
-yy67:
+yy60:
++YYCURSOR;
-#line 666 "ext/standard/var_unserializer.re"
+#line 707 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
ZVAL_BOOL(rval, parse_iv(start + 2));
return 1;
}
-#line 1030 "ext/standard/var_unserializer.c"
-yy69:
+#line 1019 "ext/standard/var_unserializer.c"
+yy62:
++YYCURSOR;
- if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
+ if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
if (yych <= ';') {
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy69;
+ if (yych <= '9') goto yy62;
if (yych <= ':') goto yy18;
} else {
if (yych <= 'E') {
if (yych <= 'D') goto yy18;
- goto yy73;
+ goto yy66;
} else {
- if (yych == 'e') goto yy73;
+ if (yych == 'e') goto yy66;
goto yy18;
}
}
-yy71:
+yy64:
++YYCURSOR;
-#line 714 "ext/standard/var_unserializer.re"
+#line 755 "ext/standard/var_unserializer.re"
{
#if SIZEOF_ZEND_LONG == 4
use_double:
@@ -1055,29 +1044,29 @@ use_double:
ZVAL_DOUBLE(rval, zend_strtod((const char *)start + 2, NULL));
return 1;
}
-#line 1059 "ext/standard/var_unserializer.c"
-yy73:
+#line 1048 "ext/standard/var_unserializer.c"
+yy66:
yych = *++YYCURSOR;
if (yych <= ',') {
- if (yych == '+') goto yy88;
+ if (yych == '+') goto yy81;
goto yy18;
} else {
- if (yych <= '-') goto yy88;
+ if (yych <= '-') goto yy81;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy89;
+ if (yych <= '9') goto yy82;
goto yy18;
}
-yy74:
+yy67:
yych = *++YYCURSOR;
- if (yych == 'F') goto yy91;
+ if (yych == 'F') goto yy84;
goto yy18;
-yy75:
+yy68:
yych = *++YYCURSOR;
- if (yych == 'N') goto yy91;
+ if (yych == 'N') goto yy84;
goto yy18;
-yy76:
+yy69:
++YYCURSOR;
-#line 672 "ext/standard/var_unserializer.re"
+#line 713 "ext/standard/var_unserializer.re"
{
#if SIZEOF_ZEND_LONG == 4
int digits = YYCURSOR - start - 3;
@@ -1103,21 +1092,21 @@ yy76:
ZVAL_LONG(rval, parse_iv(start + 2));
return 1;
}
-#line 1107 "ext/standard/var_unserializer.c"
-yy78:
+#line 1096 "ext/standard/var_unserializer.c"
+yy71:
yych = *++YYCURSOR;
- if (yych == '"') goto yy92;
+ if (yych == '"') goto yy85;
goto yy18;
-yy79:
+yy72:
++YYCURSOR;
-#line 636 "ext/standard/var_unserializer.re"
+#line 677 "ext/standard/var_unserializer.re"
{
zend_long id;
*p = YYCURSOR;
if (!var_hash) return 0;
- id = parse_iv(start + 2) - 1;
+ id = parse_uiv(start + 2) - 1;
if (id == -1 || (rval_ref = var_access(var_hash, id)) == NULL) {
return 0;
}
@@ -1134,14 +1123,14 @@ yy79:
return 1;
}
-#line 1138 "ext/standard/var_unserializer.c"
-yy81:
+#line 1127 "ext/standard/var_unserializer.c"
+yy74:
yych = *++YYCURSOR;
- if (yych == '"') goto yy94;
+ if (yych == '"') goto yy87;
goto yy18;
-yy82:
+yy75:
++YYCURSOR;
-#line 824 "ext/standard/var_unserializer.re"
+#line 877 "ext/standard/var_unserializer.re"
{
size_t len, len2, len3, maxlen;
zend_long elements;
@@ -1293,10 +1282,10 @@ yy82:
return object_common2(UNSERIALIZE_PASSTHRU, elements);
}
-#line 1297 "ext/standard/var_unserializer.c"
-yy84:
+#line 1286 "ext/standard/var_unserializer.c"
+yy77:
++YYCURSOR;
-#line 755 "ext/standard/var_unserializer.re"
+#line 802 "ext/standard/var_unserializer.re"
{
size_t len, maxlen;
zend_string *str;
@@ -1330,10 +1319,10 @@ yy84:
ZVAL_STR(rval, str);
return 1;
}
-#line 1334 "ext/standard/var_unserializer.c"
-yy86:
+#line 1323 "ext/standard/var_unserializer.c"
+yy79:
++YYCURSOR;
-#line 789 "ext/standard/var_unserializer.re"
+#line 836 "ext/standard/var_unserializer.re"
{
zend_long elements = parse_iv(start + 2);
/* use iv() not uiv() in order to check data range */
@@ -1351,38 +1340,38 @@ yy86:
zend_hash_real_init(Z_ARRVAL_P(rval), 0);
}
+ /* The array may contain references to itself, in which case we'll be modifying an
+ * rc>1 array. This is okay, since the array is, ostensibly, only visible to
+ * unserialize (in practice unserialization handlers also see it). Ideally we should
+ * prohibit "r:" references to non-objects, as we only generate them for objects. */
+ HT_ALLOW_COW_VIOLATION(Z_ARRVAL_P(rval));
+
if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_ARRVAL_P(rval), elements, 0)) {
return 0;
}
return finish_nested_data(UNSERIALIZE_PASSTHRU);
}
-#line 1361 "ext/standard/var_unserializer.c"
-yy88:
+#line 1356 "ext/standard/var_unserializer.c"
+yy81:
yych = *++YYCURSOR;
- if (yych <= ',') {
- if (yych == '+') goto yy96;
- goto yy18;
- } else {
- if (yych <= '-') goto yy96;
- if (yych <= '/') goto yy18;
- if (yych >= ':') goto yy18;
- }
-yy89:
+ if (yych <= '/') goto yy18;
+ if (yych >= ':') goto yy18;
+yy82:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy89;
- if (yych == ';') goto yy71;
+ if (yych <= '9') goto yy82;
+ if (yych == ';') goto yy64;
goto yy18;
-yy91:
+yy84:
yych = *++YYCURSOR;
- if (yych == ';') goto yy97;
+ if (yych == ';') goto yy89;
goto yy18;
-yy92:
+yy85:
++YYCURSOR;
-#line 813 "ext/standard/var_unserializer.re"
+#line 866 "ext/standard/var_unserializer.re"
{
zend_long elements;
if (!var_hash) return 0;
@@ -1393,10 +1382,10 @@ yy92:
}
return object_common2(UNSERIALIZE_PASSTHRU, elements);
}
-#line 1397 "ext/standard/var_unserializer.c"
-yy94:
+#line 1386 "ext/standard/var_unserializer.c"
+yy87:
++YYCURSOR;
-#line 723 "ext/standard/var_unserializer.re"
+#line 764 "ext/standard/var_unserializer.re"
{
size_t len, maxlen;
char *str;
@@ -1425,36 +1414,37 @@ yy94:
YYCURSOR += 2;
*p = YYCURSOR;
- ZVAL_STRINGL(rval, str, len);
+ if (len == 0) {
+ ZVAL_EMPTY_STRING(rval);
+ } else if (len == 1) {
+ ZVAL_INTERNED_STR(rval, ZSTR_CHAR((zend_uchar)*str));
+ } else {
+ ZVAL_STRINGL(rval, str, len);
+ }
return 1;
}
-#line 1432 "ext/standard/var_unserializer.c"
-yy96:
- yych = *++YYCURSOR;
- if (yych <= '/') goto yy18;
- if (yych <= '9') goto yy89;
- goto yy18;
-yy97:
+#line 1427 "ext/standard/var_unserializer.c"
+yy89:
++YYCURSOR;
-#line 698 "ext/standard/var_unserializer.re"
+#line 739 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
if (!strncmp((char*)start + 2, "NAN", 3)) {
- ZVAL_DOUBLE(rval, php_get_nan());
+ ZVAL_DOUBLE(rval, ZEND_NAN);
} else if (!strncmp((char*)start + 2, "INF", 3)) {
- ZVAL_DOUBLE(rval, php_get_inf());
+ ZVAL_DOUBLE(rval, ZEND_INFINITY);
} else if (!strncmp((char*)start + 2, "-INF", 4)) {
- ZVAL_DOUBLE(rval, -php_get_inf());
+ ZVAL_DOUBLE(rval, -ZEND_INFINITY);
} else {
ZVAL_NULL(rval);
}
return 1;
}
-#line 1456 "ext/standard/var_unserializer.c"
+#line 1446 "ext/standard/var_unserializer.c"
}
-#line 984 "ext/standard/var_unserializer.re"
+#line 1037 "ext/standard/var_unserializer.re"
return 0;
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index 5ff512bb68..5d4503b394 100644
--- a/ext/standard/var_unserializer.re
+++ b/ext/standard/var_unserializer.re
@@ -21,6 +21,7 @@
#include "php.h"
#include "ext/standard/php_var.h"
#include "php_incomplete_class.h"
+#include "zend_portability.h"
struct php_unserialize_data {
void *first;
@@ -230,14 +231,14 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
}
}
- zval_ptr_dtor(zv);
+ i_zval_ptr_dtor(zv ZEND_FILE_LINE_CC);
}
next = var_dtor_hash->next;
efree_size(var_dtor_hash, sizeof(var_dtor_entries));
var_dtor_hash = next;
}
- zval_ptr_dtor(&wakeup_name);
+ zval_ptr_dtor_nogc(&wakeup_name);
}
/* }}} */
@@ -315,10 +316,10 @@ static inline int unserialize_allowed_class(
/*!re2c
-uiv = [+]? [0-9]+;
+uiv = [0-9]+;
iv = [+-]? [0-9]+;
nv = [+-]? ([0-9]* "." [0-9]+|[0-9]+ "." [0-9]*);
-nvexp = (iv | nv) [eE] [+-]? iv;
+nvexp = (iv | nv) [eE] iv;
any = [\000-\377];
object = [OC];
*/
@@ -356,10 +357,6 @@ static inline size_t parse_uiv(const unsigned char *p)
unsigned char cursor;
size_t result = 0;
- if (*p == '+') {
- p++;
- }
-
while (1) {
cursor = *p;
if (cursor >= '0' && cursor <= '9') {
@@ -386,7 +383,7 @@ static zend_always_inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTab
ZVAL_UNDEF(&key);
if (!php_var_unserialize_internal(&key, p, max, NULL)) {
- zval_dtor(&key);
+ zval_ptr_dtor(&key);
return 0;
}
@@ -416,38 +413,82 @@ numeric_key:
data = zend_hash_add_new(ht, Z_STR(key), &d);
}
} else {
- zval_dtor(&key);
+ zval_ptr_dtor(&key);
return 0;
}
} else {
if (EXPECTED(Z_TYPE(key) == IS_STRING)) {
string_key:
- if ((old_data = zend_hash_find(ht, Z_STR(key))) != NULL) {
- if (Z_TYPE_P(old_data) == IS_INDIRECT) {
- old_data = Z_INDIRECT_P(old_data);
+ {
+ zend_property_info *existing_propinfo;
+ zend_string *new_key, *unmangled;
+ const char *unmangled_class = NULL;
+ const char *unmangled_prop;
+ size_t unmangled_prop_len;
+
+ if (UNEXPECTED(zend_unmangle_property_name_ex(Z_STR(key), &unmangled_class, &unmangled_prop, &unmangled_prop_len) == FAILURE)) {
+ zval_ptr_dtor(&key);
+ return 0;
+ }
+
+ unmangled = zend_string_init(unmangled_prop, unmangled_prop_len, 0);
+ if (Z_TYPE_P(rval) == IS_OBJECT
+ && ((existing_propinfo = zend_hash_find_ptr(&Z_OBJCE_P(rval)->properties_info, unmangled)) != NULL)
+ && (existing_propinfo->flags & ZEND_ACC_PPP_MASK)) {
+ if (existing_propinfo->flags & ZEND_ACC_PROTECTED) {
+ new_key = zend_mangle_property_name(
+ "*", 1, ZSTR_VAL(unmangled), ZSTR_LEN(unmangled), Z_OBJCE_P(rval)->type & ZEND_INTERNAL_CLASS);
+ zend_string_release(unmangled);
+ } else if (existing_propinfo->flags & ZEND_ACC_PRIVATE) {
+ if (unmangled_class != NULL && strcmp(unmangled_class, "*") != 0) {
+ new_key = zend_mangle_property_name(
+ unmangled_class, strlen(unmangled_class),
+ ZSTR_VAL(unmangled), ZSTR_LEN(unmangled),
+ Z_OBJCE_P(rval)->type & ZEND_INTERNAL_CLASS);
+ } else {
+ new_key = zend_mangle_property_name(
+ ZSTR_VAL(existing_propinfo->ce->name), ZSTR_LEN(existing_propinfo->ce->name),
+ ZSTR_VAL(unmangled), ZSTR_LEN(unmangled),
+ Z_OBJCE_P(rval)->type & ZEND_INTERNAL_CLASS);
+ }
+ zend_string_release(unmangled);
+ } else {
+ ZEND_ASSERT(existing_propinfo->flags & ZEND_ACC_PUBLIC);
+ new_key = unmangled;
+ }
+ zend_string_release(Z_STR(key));
+ ZVAL_STR(&key, new_key);
+ } else {
+ zend_string_release(unmangled);
+ }
+
+ if ((old_data = zend_hash_find(ht, Z_STR(key))) != NULL) {
+ if (Z_TYPE_P(old_data) == IS_INDIRECT) {
+ old_data = Z_INDIRECT_P(old_data);
+ }
+ var_push_dtor(var_hash, old_data);
+ data = zend_hash_update_ind(ht, Z_STR(key), &d);
+ } else {
+ data = zend_hash_add_new(ht, Z_STR(key), &d);
}
- var_push_dtor(var_hash, old_data);
- data = zend_hash_update_ind(ht, Z_STR(key), &d);
- } else {
- data = zend_hash_add_new(ht, Z_STR(key), &d);
}
} else if (Z_TYPE(key) == IS_LONG) {
/* object properties should include no integers */
convert_to_string(&key);
goto string_key;
} else {
- zval_dtor(&key);
+ zval_ptr_dtor(&key);
return 0;
}
}
if (!php_var_unserialize_internal(data, p, max, var_hash)) {
- zval_dtor(&key);
+ zval_ptr_dtor(&key);
return 0;
}
var_push_dtor(var_hash, data);
- zval_dtor(&key);
+ zval_ptr_dtor(&key);
if (elements && *(*p-1) != ';' && *(*p-1) != '}') {
(*p)--;
@@ -608,13 +649,13 @@ static int php_var_unserialize_internal(UNSERIALIZE_PARAMETER)
/*!re2c
-"R:" iv ";" {
+"R:" uiv ";" {
zend_long id;
*p = YYCURSOR;
if (!var_hash) return 0;
- id = parse_iv(start + 2) - 1;
+ id = parse_uiv(start + 2) - 1;
if (id == -1 || (rval_ref = var_access(var_hash, id)) == NULL) {
return 0;
}
@@ -633,13 +674,13 @@ static int php_var_unserialize_internal(UNSERIALIZE_PARAMETER)
return 1;
}
-"r:" iv ";" {
+"r:" uiv ";" {
zend_long id;
*p = YYCURSOR;
if (!var_hash) return 0;
- id = parse_iv(start + 2) - 1;
+ id = parse_uiv(start + 2) - 1;
if (id == -1 || (rval_ref = var_access(var_hash, id)) == NULL) {
return 0;
}
@@ -699,11 +740,11 @@ static int php_var_unserialize_internal(UNSERIALIZE_PARAMETER)
*p = YYCURSOR;
if (!strncmp((char*)start + 2, "NAN", 3)) {
- ZVAL_DOUBLE(rval, php_get_nan());
+ ZVAL_DOUBLE(rval, ZEND_NAN);
} else if (!strncmp((char*)start + 2, "INF", 3)) {
- ZVAL_DOUBLE(rval, php_get_inf());
+ ZVAL_DOUBLE(rval, ZEND_INFINITY);
} else if (!strncmp((char*)start + 2, "-INF", 4)) {
- ZVAL_DOUBLE(rval, -php_get_inf());
+ ZVAL_DOUBLE(rval, -ZEND_INFINITY);
} else {
ZVAL_NULL(rval);
}
@@ -748,7 +789,13 @@ use_double:
YYCURSOR += 2;
*p = YYCURSOR;
- ZVAL_STRINGL(rval, str, len);
+ if (len == 0) {
+ ZVAL_EMPTY_STRING(rval);
+ } else if (len == 1) {
+ ZVAL_INTERNED_STR(rval, ZSTR_CHAR((zend_uchar)*str));
+ } else {
+ ZVAL_STRINGL(rval, str, len);
+ }
return 1;
}
@@ -803,6 +850,12 @@ use_double:
zend_hash_real_init(Z_ARRVAL_P(rval), 0);
}
+ /* The array may contain references to itself, in which case we'll be modifying an
+ * rc>1 array. This is okay, since the array is, ostensibly, only visible to
+ * unserialize (in practice unserialization handlers also see it). Ideally we should
+ * prohibit "r:" references to non-objects, as we only generate them for objects. */
+ HT_ALLOW_COW_VIOLATION(Z_ARRVAL_P(rval));
+
if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_ARRVAL_P(rval), elements, 0)) {
return 0;
}
@@ -810,7 +863,7 @@ use_double:
return finish_nested_data(UNSERIALIZE_PASSTHRU);
}
-"o:" iv ":" ["] {
+"o:" uiv ":" ["] {
zend_long elements;
if (!var_hash) return 0;
diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c
index 290ec8ba87..b278b3b4dd 100644
--- a/ext/standard/versioning.c
+++ b/ext/standard/versioning.c
@@ -212,15 +212,17 @@ PHP_FUNCTION(version_compare)
{
char *v1, *v2, *op = NULL;
size_t v1_len, v2_len, op_len = 0;
- int compare, argc;
+ int compare;
+
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STRING(v1, v1_len)
+ Z_PARAM_STRING(v2, v2_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(op, op_len)
+ ZEND_PARSE_PARAMETERS_END();
- argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc, "ss|s", &v1, &v1_len, &v2,
- &v2_len, &op, &op_len) == FAILURE) {
- return;
- }
compare = php_version_compare(v1, v2);
- if (argc == 2) {
+ if (!op) {
RETURN_LONG(compare);
}
if (!strncmp(op, "<", op_len) || !strncmp(op, "lt", op_len)) {