summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/array.c274
-rw-r--r--ext/standard/assert.c18
-rw-r--r--ext/standard/base64.c16
-rw-r--r--ext/standard/basic_functions.c335
-rw-r--r--ext/standard/browscap.c8
-rw-r--r--ext/standard/config.m4169
-rw-r--r--ext/standard/config.w3211
-rw-r--r--ext/standard/crc32.c7
-rw-r--r--ext/standard/credits_ext.h1
-rw-r--r--ext/standard/crypt.c8
-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.c15
-rw-r--r--ext/standard/dns.c60
-rw-r--r--ext/standard/dns_win32.c2
-rw-r--r--ext/standard/exec.c48
-rw-r--r--ext/standard/file.c230
-rw-r--r--ext/standard/file.h2
-rw-r--r--ext/standard/filestat.c78
-rw-r--r--ext/standard/filters.c20
-rw-r--r--ext/standard/flock_compat.c4
-rw-r--r--ext/standard/formatted_print.c14
-rw-r--r--ext/standard/fsock.c11
-rw-r--r--ext/standard/ftok.c7
-rw-r--r--ext/standard/ftp_fopen_wrapper.c4
-rw-r--r--ext/standard/head.c66
-rw-r--r--ext/standard/html.c18
-rw-r--r--ext/standard/http.c10
-rw-r--r--ext/standard/http_fopen_wrapper.c4
-rw-r--r--ext/standard/image.c22
-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.c82
-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.c14
-rw-r--r--ext/standard/pack.c24
-rw-r--r--ext/standard/password.c324
-rw-r--r--ext/standard/php_dns.h4
-rw-r--r--ext/standard/php_filestat.h11
-rw-r--r--ext/standard/php_mail.h32
-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.h6
-rw-r--r--ext/standard/proc_open.c102
-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/sha1.c16
-rw-r--r--ext/standard/soundex.c7
-rw-r--r--ext/standard/streamsfuncs.c282
-rw-r--r--ext/standard/streamsfuncs.h4
-rw-r--r--ext/standard/string.c464
-rw-r--r--ext/standard/strnatcmp.c10
-rw-r--r--ext/standard/syslog.c18
-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_unique_variation2.phpt76
-rw-r--r--ext/standard/tests/array/array_unique_variation6.phpt2
-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/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/count_invalid.phpt42
-rw-r--r--ext/standard/tests/array/count_recursive.phpt18
-rw-r--r--ext/standard/tests/array/count_variation1.phpt48
-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/sizeof_basic1.phpt24
-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/var_export.phpt4
-rw-r--r--ext/standard/tests/assert/assert04.phpt2
-rw-r--r--ext/standard/tests/bug49244.phpt2
-rw-r--r--ext/standard/tests/class_object/get_class_variation_001.phpt8
-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/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/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/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/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/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/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/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/parse_ini_string_002.phpt60
-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/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/mail/mail_log.phpt2
-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/dns_get_mx.phpt4
-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/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/bug43614.phpt2
-rw-r--r--ext/standard/tests/serialize/serialization_objects_005.phpt4
-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/proc_open_bug60120.phpt2
-rw-r--r--ext/standard/tests/streams/proc_open_bug64438.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_pair.phpt4
-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/join_variation6.phptbin729 -> 728 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/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/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/url/bug47174.phpt4
-rw-r--r--ext/standard/tests/versioning/php_sapi_name.phpt2
-rw-r--r--ext/standard/type.c74
-rw-r--r--ext/standard/uniqid.c9
-rw-r--r--ext/standard/url.c17
-rw-r--r--ext/standard/url_scanner_ex.c2
-rw-r--r--ext/standard/user_filters.c29
-rw-r--r--ext/standard/uuencode.c14
-rw-r--r--ext/standard/var.c48
-rw-r--r--ext/standard/var_unserializer.c69
-rw-r--r--ext/standard/var_unserializer.re7
-rw-r--r--ext/standard/versioning.c16
275 files changed, 6779 insertions, 4872 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 69439a7877..d5d5c00339 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:
@@ -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(array)
+ 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) {
@@ -1314,9 +1329,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) {
@@ -1526,11 +1541,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_DEREF_EX(userdata, 0, 1)
+ 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;
@@ -1767,12 +1787,6 @@ PHP_FUNCTION(extract)
}
symbol_table = zend_rebuild_symbol_table();
-#if 0
- if (!symbol_table) {
- php_error_docref(NULL, E_WARNING, "failed to build symbol table");
- return;
- }
-#endif
/* 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. */
@@ -1937,9 +1951,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;
@@ -1953,13 +1967,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]);
}
}
@@ -2043,9 +2057,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_DEREF(val)
+ ZEND_PARSE_PARAMETERS_END();
/* Initialize return array */
array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(keys)));
@@ -2094,9 +2109,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_DEREF(zlow)
+ Z_PARAM_ZVAL_DEREF(zhigh)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF(zstep)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (zstep) {
if (Z_TYPE_P(zstep) == IS_DOUBLE ||
@@ -2376,9 +2394,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);
@@ -2537,9 +2555,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++) {
@@ -2736,9 +2755,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++) {
@@ -2807,9 +2827,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_DEREF_EX(repl_array, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
num_in = zend_hash_num_elements(Z_ARRVAL_P(array));
@@ -3371,9 +3395,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);
@@ -3472,9 +3496,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_DEREF_EX(zcolumn, 1, 0)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF_EX(zkey, 1, 0)
+ ZEND_PARSE_PARAMETERS_END();
if ((zcolumn && !array_column_param_helper(zcolumn, "column")) ||
(zkey && !array_column_param_helper(zkey, "index"))) {
@@ -3550,9 +3577,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)));
@@ -3599,9 +3628,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_DEREF(pad_value)
+ ZEND_PARSE_PARAMETERS_END();
/* Do some initial calculations */
input_size = zend_hash_num_elements(Z_ARRVAL_P(input));
@@ -3681,9 +3712,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)));
@@ -3720,9 +3751,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)));
@@ -3765,16 +3798,18 @@ 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) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_ARRAY(array)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(sort_type)
+ ZEND_PARSE_PARAMETERS_END();
cmp = php_get_data_compare_func(sort_type, 0);
@@ -3861,7 +3896,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;
@@ -3962,7 +3997,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;
@@ -4289,7 +4324,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;
@@ -4385,7 +4420,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;
@@ -4677,9 +4712,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");
@@ -4818,7 +4853,7 @@ PHP_FUNCTION(array_multisort)
zval* args;
zval** arrays;
Bucket** indirect;
- uint idx;
+ uint32_t idx;
Bucket* p;
HashTable* hash;
int argc;
@@ -4829,9 +4864,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 *));
@@ -5002,9 +5037,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));
@@ -5098,9 +5135,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);
@@ -5124,9 +5161,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))) {
@@ -5168,9 +5205,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_DEREF(initial)
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() > 2) {
@@ -5230,9 +5270,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) {
@@ -5500,7 +5543,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;
@@ -5509,9 +5552,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");
@@ -5570,9 +5617,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 fe04f329e2..550a3ec48d 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_DEREF(assertion)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF(description)
+ ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE_P(assertion) == IS_STRING) {
zval retval;
@@ -215,7 +217,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 +292,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_DEREF(value)
+ ZEND_PARSE_PARAMETERS_END();
switch (what) {
case ASSERT_ACTIVE:
diff --git a/ext/standard/base64.c b/ext/standard/base64.c
index cd6bac0b3d..62698077e5 100644
--- a/ext/standard/base64.c
+++ b/ext/standard/base64.c
@@ -213,9 +213,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 +235,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/basic_functions.c b/ext/standard/basic_functions.c
index 4bb887d2f9..7446a21d1c 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
@@ -963,7 +961,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)
@@ -985,7 +983,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 */
@@ -1204,7 +1202,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()
@@ -1230,7 +1228,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)
@@ -1240,7 +1237,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)
@@ -2012,6 +2008,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) */
@@ -2466,6 +2473,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
@@ -2765,6 +2780,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)
@@ -3041,7 +3058,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)
@@ -3135,6 +3152,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)
@@ -3166,7 +3187,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
@@ -3225,10 +3246,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
@@ -3517,40 +3536,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;
}
/* }}} */
@@ -3642,8 +3636,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);
@@ -3704,7 +3698,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
@@ -3874,9 +3868,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);
@@ -3906,9 +3900,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) {
@@ -3940,9 +3934,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));
@@ -3980,9 +3974,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) {
@@ -4011,14 +4005,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
@@ -4046,9 +4044,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);
@@ -4124,9 +4124,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");
@@ -4298,9 +4298,12 @@ 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_EX(zoptind, 0, 1)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
/* Init zoptind to 1 */
if (zoptind) {
@@ -4478,9 +4481,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;
@@ -4501,9 +4505,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;
@@ -4521,9 +4526,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");
@@ -4559,9 +4565,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;
@@ -4636,11 +4642,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) {
@@ -4701,9 +4707,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;
@@ -4869,9 +4879,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");
@@ -4904,9 +4915,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;
@@ -5176,9 +5188,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;
@@ -5217,9 +5231,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();
@@ -5255,9 +5269,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_DEREF(expr)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(i)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
convert_to_string_ex(expr);
if (i) {
@@ -5298,11 +5314,11 @@ PHP_FUNCTION(ini_get)
char *varname, *str;
size_t varname_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;
@@ -5371,9 +5387,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();
@@ -5408,9 +5426,10 @@ 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);
@@ -5450,9 +5469,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);
}
@@ -5466,9 +5485,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! */
@@ -5494,7 +5513,7 @@ PHP_FUNCTION(get_include_path)
{
char *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -5514,7 +5533,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);
@@ -5530,9 +5549,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_DEREF(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));
@@ -5566,9 +5587,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);
@@ -5591,9 +5613,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
@@ -5625,9 +5648,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);
@@ -5649,9 +5673,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);
@@ -5672,9 +5696,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);
@@ -5749,9 +5773,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_DEREF_EX(function, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
if (!BG(user_tick_functions)) {
return;
@@ -5780,9 +5804,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;
@@ -5808,9 +5832,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;
@@ -5936,9 +5961,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!");
@@ -5976,9 +6004,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 a52ed2501f..722a7fd91e 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -457,9 +457,11 @@ PHP_FUNCTION(get_browser)
bdata = &global_bdata;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!b", &agent_name, &agent_name_len, &return_array) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 2)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING_EX(agent_name, agent_name_len, 1, 0)
+ Z_PARAM_BOOL(return_array)
+ ZEND_PARSE_PARAMETERS_END();
if (agent_name == NULL) {
if ((Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY || zend_is_auto_global_str(ZEND_STRL("_SERVER"))) &&
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index c73dace754..3f2da2dc24 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -351,143 +351,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>
-
-#ifdef HAVE_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>
-
-#ifdef HAVE_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)?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>
-
-#ifdef HAVE_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)?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>
-
-#ifdef HAVE_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,[
@@ -551,6 +414,38 @@ dnl
AC_CHECK_DECLS([getrandom])
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])
+ ])
+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..8154e7936c 100644
--- a/ext/standard/config.w32
+++ b/ext/standard/config.w32
@@ -1,6 +1,17 @@
// 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);
+ } 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);
diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c
index e6024dcf11..bef7abab96 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 a0f578bda8..9f8e7d50e3 100644
--- a/ext/standard/credits_ext.h
+++ b/ext/standard/credits_ext.h
@@ -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");
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
index f2f778e764..a6a290057d 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -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 8baef3d06c..05616de457 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 3e6d6a2338..5b53edafce 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 222c993c65..096381f532 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 eae7630fe5..abb7853c31 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,12 +76,6 @@ PHPAPI PHP_FUNCTION(dl)
#if defined(HAVE_LIBDL)
-#ifdef ZTS
-#define USING_ZTS 1
-#else
-#define USING_ZTS 0
-#endif
-
/* {{{ php_load_extension
*/
PHPAPI int php_load_extension(char *filename, int type, int start_now)
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
index de277a3035..23d09862f3 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
@@ -156,9 +151,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);
@@ -217,9 +212,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 */
@@ -241,9 +236,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 */
@@ -305,7 +300,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> */
@@ -368,9 +363,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");
@@ -473,7 +470,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;
}
@@ -785,10 +782,14 @@ 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, 1)
+ Z_PARAM_ZVAL_DEREF_EX(addtl, 1, 1)
+ Z_PARAM_BOOL(raw)
+ ZEND_PARSE_PARAMETERS_END();
if (authns) {
zval_dtor(authns);
@@ -1013,9 +1014,12 @@ 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_EX(mx_list, 0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF_EX(weight_list, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
zval_dtor(mx_list);
array_init(mx_list);
@@ -1085,7 +1089,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 d63bfd6a66..4cd2730015 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 07ae161938..9962953e1f 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_EX(ret_array, 0, 1)
}
- }
+ Z_PARAM_ZVAL_DEREF_EX(ret_code, 0, 1)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+
if (!cmd_len) {
php_error_docref(NULL, E_WARNING, "Cannot execute a blank command");
RETURN_FALSE;
@@ -473,9 +477,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 +500,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 +524,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 +554,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 c75d2d3fa0..b41704edde 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_EX(wouldblock, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -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_DEREF_EX(data, 0, 1)
+ 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;
@@ -1827,12 +1871,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 */
@@ -1959,13 +2005,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_DEREF(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 */
@@ -2293,7 +2340,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)
@@ -2440,9 +2487,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 a9b96d6b38..9d6a9e8c16 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 439e1741ad..05df801121 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_DEREF_EX(group, 0, 1)
+ 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_DEREF_EX(user, 0, 1)
+ 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:
@@ -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 70f0629c53..cf26cea340 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,8 +172,8 @@ 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)
@@ -244,7 +244,7 @@ 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};
@@ -1724,7 +1724,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 +1778,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 +1827,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;
@@ -2035,7 +2035,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;
diff --git a/ext/standard/flock_compat.c b/ext/standard/flock_compat.c
index c2c795ac8d..0a9ea4770d 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 3e3d59ca15..9058f316fa 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 675e1154a9..68579b71c3 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_EX(zerrno, 0, 1)
+ Z_PARAM_ZVAL_DEREF_EX(zerrstr, 0, 1)
+ Z_PARAM_DOUBLE(timeout)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (persistent) {
spprintf(&hashkey, 0, "pfsockopen__%s:" ZEND_LONG_FMT, host, port);
diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c
index 02cf61daf6..f19f16fe57 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 a5e00a6df9..5e156c5cf4 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 eac9159ab9..32e1eadbb5 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);
}
/* }}} */
@@ -174,7 +178,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);
@@ -191,10 +195,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;
@@ -212,10 +222,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;
@@ -234,8 +250,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_EX(arg1, 0, 1)
+ Z_PARAM_ZVAL_DEREF_EX(arg2, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
if (SG(headers_sent)) {
line = php_output_get_start_lineno();
@@ -294,9 +313,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 473b24ea27..c7d34e7890 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -1500,9 +1500,11 @@ PHP_FUNCTION(htmlspecialchars_decode)
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_STRING(str, str_len)
+ 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);
if (replaced) {
@@ -1622,10 +1624,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/http.c b/ext/standard/http.c
index 4d173e57a1..25bc7bfee7 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_DEREF(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 b9ca25687e..ddd3108d5a 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
diff --git a/ext/standard/image.c b/ext/standard/image.c
index 4fb8298f76..61cafe5e80 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,9 +1472,11 @@ 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_EX(info, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
if (argc == 2) {
zval_dtor(info);
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 982d4e461b..865c5e98c1 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 04e51b00c1..62b8473755 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 62e7295c70..e6b8220f50 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 e88ab38cd1..cdf94f0d55 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
@@ -336,7 +539,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 231d5aa0a0..f0597a4e47 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_DEREF(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_DEREF_EX(zbase, 0, 1)
+ Z_PARAM_ZVAL_DEREF_EX(zexp, 0, 1)
+ 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_DEREF(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_DEREF(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_DEREF(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_DEREF(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_DEREF(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_DEREF(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_DEREF(number)
+ Z_PARAM_LONG(frombase)
+ Z_PARAM_LONG(tobase)
+ ZEND_PARSE_PARAMETERS_END();
convert_to_string_ex(number);
if (frombase < 2 || frombase > 36) {
@@ -1283,9 +1296,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 825df21c69..cb43e67441 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 11968a6fb6..b9b5bc7c17 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 9793dcd701..196d8cf1a6 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 dde9a77134..80ec01c027 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();
@@ -288,9 +291,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 1252f4286f..447b0ee9cf 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
@@ -123,9 +116,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);
@@ -554,10 +548,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);
diff --git a/ext/standard/password.c b/ext/standard/password.c
index d01ddb0563..c5b5fe2c98 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
#if PHP_WIN32
#include "win32/winutil.h"
@@ -39,8 +43,16 @@ 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;
}
@@ -51,6 +63,10 @@ static char* php_password_get_algo_name(const php_password_algo algo)
switch (algo) {
case PHP_PASSWORD_BCRYPT:
return "bcrypt";
+#if HAVE_ARGON2LIB
+ case PHP_PASSWORD_ARGON2I:
+ return "argon2i";
+#endif
case PHP_PASSWORD_UNKNOWN:
default:
return "unknown";
@@ -61,7 +77,12 @@ static php_password_algo php_password_determine_algo(const char *hash, const siz
{
if (len > 3 && hash[0] == '$' && hash[1] == '2' && hash[2] == 'y' && len == 60) {
return PHP_PASSWORD_BCRYPT;
+ }
+#if HAVE_ARGON2LIB
+ if (len >= sizeof("$argon2i$")-1 && !memcmp(hash, "$argon2i$", sizeof("$argon2i$")-1)) {
+ return PHP_PASSWORD_ARGON2I;
}
+#endif
return PHP_PASSWORD_UNKNOWN;
}
@@ -143,6 +164,8 @@ static int php_password_make_salt(size_t length, char *ret) /* {{{ */
}
/* }}} */
+/* {{{ proto array password_get_info(string $hash)
+Retrieves information about a given hash */
PHP_FUNCTION(password_get_info)
{
php_password_algo algo;
@@ -150,9 +173,9 @@ PHP_FUNCTION(password_get_info)
char *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_STRING(hash, hash_len)
+ ZEND_PARSE_PARAMETERS_END();
array_init(&options);
@@ -167,6 +190,21 @@ PHP_FUNCTION(password_get_info)
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(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;
@@ -178,7 +216,10 @@ PHP_FUNCTION(password_get_info)
add_assoc_string(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;
@@ -188,9 +229,12 @@ PHP_FUNCTION(password_needs_rehash)
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_STRING(hash, hash_len)
+ 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);
@@ -213,14 +257,43 @@ PHP_FUNCTION(password_needs_rehash)
}
}
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(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)
{
@@ -228,35 +301,63 @@ PHP_FUNCTION(password_verify)
size_t i, password_len, hash_len;
char *password, *hash;
zend_string *ret;
+ 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_STRING(password, password_len)
+ Z_PARAM_STRING(hash, hash_len)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
- if (ZSTR_LEN(ret) != hash_len || hash_len < 13) {
- zend_string_free(ret);
- RETURN_FALSE;
- }
+ algo = php_password_determine_algo(hash, (size_t) hash_len);
- /* 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]);
- }
+ switch(algo) {
+#if HAVE_ARGON2LIB
+ case PHP_PASSWORD_ARGON2I:
+ {
+ argon2_type type = Argon2_i;
- zend_string_free(ret);
+ status = argon2_verify(hash, password, password_len, type);
+
+ if (status == ARGON2_OK) {
+ RETURN_TRUE;
+ }
- RETURN_BOOL(status == 0);
+ RETURN_FALSE;
+ }
+ break;
+#endif
+ case PHP_PASSWORD_BCRYPT:
+ case PHP_PASSWORD_UNKNOWN:
+ default:
+ {
+ if ((ret = php_crypt(password, (int)password_len, hash, (int)hash_len, 1)) == NULL) {
+ RETURN_FALSE;
+ }
+
+ if (ZSTR_LEN(ret) != hash_len || hash_len < 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 < hash_len; i++) {
+ status |= (ZSTR_VAL(ret)[i] ^ hash[i]);
+ }
+ zend_string_free(ret);
+
+ RETURN_BOOL(status == 0);
+ }
+ }
+
+ RETURN_FALSE;
}
/* }}} */
-/* {{{ 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)
{
@@ -267,31 +368,74 @@ PHP_FUNCTION(password_hash)
size_t salt_len = 0, required_salt_len = 0, hash_format_len;
HashTable *options = 0;
zval *option_buffer;
- zend_string *result;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|H", &password, &password_len, &algo, &options) == FAILURE) {
- return;
- }
+#if HAVE_ARGON2LIB
+ 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;
+#endif
+
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STRING(password, password_len)
+ 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;
+ {
+ 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;
+#if HAVE_ARGON2LIB
+ case PHP_PASSWORD_ARGON2I:
+ {
+ if (options && (option_buffer = zend_hash_str_find(options, "memory_cost", sizeof("memory_cost")-1)) != NULL) {
+ memory_cost = zval_get_long(option_buffer);
+ }
- required_salt_len = 22;
- sprintf(hash_format, "$2y$%02ld$", (long) cost);
- hash_format_len = 7;
- }
- break;
+ 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();
+ }
+
+ if (options && (option_buffer = zend_hash_str_find(options, "time_cost", sizeof("time_cost")-1)) != NULL) {
+ time_cost = zval_get_long(option_buffer);
+ }
+
+ 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();
+ }
+
+ if (options && (option_buffer = zend_hash_str_find(options, "threads", sizeof("threads")-1)) != NULL) {
+ threads = zval_get_long(option_buffer);
+ }
+
+ if (threads > ARGON2_MAX_LANES || threads == 0) {
+ php_error_docref(NULL, E_WARNING, "Invalid number of threads", threads);
+ RETURN_NULL();
+ }
+
+ required_salt_len = 16;
+ }
+ break;
+#endif
case PHP_PASSWORD_UNKNOWN:
default:
php_error_docref(NULL, E_WARNING, "Unknown password hashing algorithm: " ZEND_LONG_FMT, algo);
@@ -356,30 +500,88 @@ PHP_FUNCTION(password_hash)
salt_len = required_salt_len;
}
- salt[salt_len] = 0;
+ switch (algo) {
+ case PHP_PASSWORD_BCRYPT:
+ {
+ zend_string *result;
+ salt[salt_len] = 0;
- hash = safe_emalloc(salt_len + hash_format_len, 1, 1);
- sprintf(hash, "%s%s", hash_format, salt);
- hash[hash_format_len + salt_len] = 0;
+ hash = safe_emalloc(salt_len + hash_format_len, 1, 1);
+ sprintf(hash, "%s%s", hash_format, salt);
+ hash[hash_format_len + salt_len] = 0;
- efree(salt);
+ efree(salt);
- /* This cast is safe, since both values are defined here in code and cannot overflow */
- hash_len = (int) (hash_format_len + salt_len);
+ /* This cast is safe, since both values are defined here in code and cannot overflow */
+ hash_len = (int) (hash_format_len + salt_len);
- if ((result = php_crypt(password, (int)password_len, hash, hash_len, 1)) == NULL) {
- efree(hash);
- RETURN_FALSE;
- }
+ if ((result = php_crypt(password, (int)password_len, hash, hash_len, 1)) == NULL) {
+ efree(hash);
+ RETURN_FALSE;
+ }
- efree(hash);
+ efree(hash);
- if (ZSTR_LEN(result) < 13) {
- zend_string_free(result);
- RETURN_FALSE;
- }
+ if (ZSTR_LEN(result) < 13) {
+ zend_string_free(result);
+ RETURN_FALSE;
+ }
- RETURN_STR(result);
+ RETURN_STR(result);
+ }
+ break;
+#if HAVE_ARGON2LIB
+ case PHP_PASSWORD_ARGON2I:
+ {
+ size_t out_len = 32;
+ size_t encoded_len;
+ int status = 0;
+ char *out;
+ zend_string *encoded;
+
+ encoded_len = argon2_encodedlen(
+ time_cost,
+ memory_cost,
+ threads,
+ (uint32_t)salt_len,
+ out_len
+ );
+
+ out = emalloc(out_len + 1);
+ encoded = zend_string_alloc(encoded_len, 0);
+
+ status = argon2_hash(
+ time_cost,
+ memory_cost,
+ threads,
+ password,
+ password_len,
+ salt,
+ salt_len,
+ out,
+ out_len,
+ ZSTR_VAL(encoded),
+ encoded_len,
+ type,
+ ARGON2_VERSION_NUMBER
+ );
+
+ efree(out);
+ efree(salt);
+
+ if (status != ARGON2_OK) {
+ zend_string_free(encoded);
+ php_error_docref(NULL, E_WARNING, argon2_error_message(status));
+ RETURN_FALSE;
+ }
+
+ RETURN_STR(encoded);
+ }
+ break;
+#endif
+ default:
+ RETURN_FALSE;
+ }
}
/* }}} */
diff --git a/ext/standard/php_dns.h b/ext/standard/php_dns.h
index dfd43a40dc..6e3728e861 100644
--- a/ext/standard/php_dns.h
+++ b/ext/standard/php_dns.h
@@ -59,7 +59,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
@@ -68,7 +68,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_filestat.h b/ext/standard/php_filestat.h
index 2e87d96f05..5e141ca3e4 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 514b189681..6f7d703312 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_password.h b/ext/standard/php_password.h
index fdc72b0258..4bc2e5660f 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 b8db164076..fac844ae7a 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 = 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 dabc359676..2696d4eb0d 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 51cf8c9962..6fc7587121 100644
--- a/ext/standard/php_string.h
+++ b/ext/standard/php_string.h
@@ -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/proc_open.c b/ext/standard/proc_open.c
index 95803c9bbd..5675a69028 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_EX(pipes, 0, 1)
+ 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();
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
index be352cbf80..909470fff1 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 e97e0b46f0..9e83111f58 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 1161d76fe2..3e3d7ad500 100644
--- a/ext/standard/random.c
+++ b/ext/standard/random.c
@@ -191,9 +191,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);
@@ -265,9 +265,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/sha1.c b/ext/standard/sha1.c
index c4bed51abc..cb7e3645b7 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 9512e81475..cfad769ff2 100644
--- a/ext/standard/soundex.c
+++ b/ext/standard/soundex.c
@@ -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 01a49e5679..f0a08b68f7 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -37,6 +37,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 +56,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 +103,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_EX(zerrno, 0, 1)
+ Z_PARAM_ZVAL_DEREF_EX(zerrstr, 0, 1)
+ 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);
@@ -185,9 +193,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_EX(zerrno, 0, 1)
+ Z_PARAM_ZVAL_DEREF_EX(zerrstr, 0, 1)
+ 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);
@@ -330,9 +343,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) {
@@ -359,9 +376,13 @@ 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_EX(zremote, 0, 1)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, zstream);
@@ -405,9 +426,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);
@@ -453,9 +477,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);
@@ -1056,9 +1084,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();
@@ -1080,9 +1109,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();
@@ -1102,9 +1131,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();
@@ -1132,10 +1163,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_DEREF(filterparams)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, zstream);
@@ -1220,9 +1254,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) {
@@ -1256,9 +1290,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");
@@ -1314,9 +1351,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);
@@ -1359,9 +1399,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);
@@ -1387,9 +1428,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);
@@ -1422,9 +1464,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);
@@ -1504,9 +1547,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);
@@ -1525,9 +1568,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_DEREF(zstream)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
if (Z_TYPE_P(zstream) == IS_RESOURCE) {
php_stream_from_zval(stream, zstream);
@@ -1556,9 +1599,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);
@@ -1569,6 +1612,121 @@ PHP_FUNCTION(stream_supports_lock)
RETURN_TRUE;
}
+/* {{{ proto proto stream_isatty(resource stream)
+Check if a stream is a TTY.
+*/
+PHP_FUNCTION(stream_isatty)
+{
+ zval *zsrc;
+ php_stream *stream;
+ zend_long 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 */
+ if (php_win32_console_fileno_is_console(fileno)) {
+ RETURN_TRUE;
+ }
+ else {
+ RETURN_FALSE;
+ }
+#elif HAVE_POSIX
+ /* Check if the file descriptor identifier is a terminal */
+ if (isatty(fileno)) {
+ RETURN_TRUE;
+ }
+ else {
+ RETURN_FALSE;
+ }
+#else
+ zend_stat_t stat;
+ if (zend_fstat(fileno, &stat) == 0) {
+ if ((stat.st_mode & /*S_IFMT*/0170000) == /*S_IFCHR*/0020000) {
+ RETURN_TRUE;
+ }
+ }
+ RETURN_NULL();
+#endif
+}
+
+#ifdef PHP_WIN32
+/* {{{ proto proto 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 45f51c2954..0b7b0c6705 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 d0ebd2f5be..845855ad4c 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)));
@@ -943,9 +949,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();
@@ -1187,7 +1197,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 +1206,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 +1220,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 +1239,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 +1256,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 +1279,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 +1294,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 +1543,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 +1552,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 +1606,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 +1633,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 +1678,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 +1840,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_DEREF(needle)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(part)
+ ZEND_PARSE_PARAMETERS_END();
haystack_dup = estrndup(ZSTR_VAL(haystack), ZSTR_LEN(haystack));
@@ -1876,9 +1895,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_DEREF(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 +2000,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_DEREF(needle)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(offset)
+ ZEND_PARSE_PARAMETERS_END();
if (offset < 0) {
offset += (zend_long)ZSTR_LEN(haystack);
@@ -2106,10 +2131,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_DEREF(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 +2237,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_DEREF(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 +2322,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");
@@ -2404,9 +2435,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_DEREF(str)
+ Z_PARAM_ZVAL_DEREF(repl)
+ Z_PARAM_ZVAL_DEREF(from)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF_EX(len, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE_P(str) != IS_ARRAY) {
convert_to_string_ex(str);
@@ -2656,9 +2691,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);
@@ -2782,9 +2817,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();
@@ -3453,9 +3488,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);
@@ -3527,9 +3562,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_EX(percent, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
if (ac > 2) {
convert_to_double_ex(percent);
@@ -3596,9 +3634,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();
@@ -3636,9 +3675,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));
@@ -3651,9 +3690,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));
@@ -4117,9 +4156,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;
@@ -4383,9 +4424,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_DEREF(allow)
+ ZEND_PARSE_PARAMETERS_END();
/* To maintain a certain BC, we allow anything for the second parameter and return original string */
if (allow) {
@@ -4412,9 +4455,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;
@@ -4499,9 +4543,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_EX(arrayArg, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
res = estrndup(arg, arglen);
@@ -4597,7 +4643,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);
}
@@ -4623,11 +4669,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;
@@ -4908,10 +4954,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;
@@ -4930,9 +4979,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");
@@ -4985,9 +5035,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");
@@ -5047,9 +5099,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),
@@ -5192,9 +5245,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");
@@ -5259,9 +5316,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. */
@@ -5333,10 +5394,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);
@@ -5355,9 +5417,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();
@@ -5399,9 +5461,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) {
@@ -5428,9 +5490,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:
@@ -5508,9 +5573,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;
@@ -5548,9 +5614,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");
@@ -5587,9 +5655,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");
@@ -5618,9 +5687,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) {
@@ -5651,6 +5725,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 38605eb03d..91162d303d 100644
--- a/ext/standard/syslog.c
+++ b/ext/standard/syslog.c
@@ -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_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_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_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/bug14580.phpt b/ext/standard/tests/array/bug14580.phpt
index bf0121ad69..8a80bddcb4 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/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..5c75a0bc68 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
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/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/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_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/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/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/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/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_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/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/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/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/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..f487ed0744 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('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--
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/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/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/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/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/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/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/mail/mail_log.phpt b/ext/standard/tests/mail/mail_log.phpt
index 86346ec307..8f385d490d 100644
--- a/ext/standard/tests/mail/mail_log.phpt
+++ b/ext/standard/tests/mail/mail_log.phpt
@@ -44,5 +44,5 @@ unlink("/tmp/mail.out");
bool(true)
bool(true)
bool(true)
-[%d-%s-%d %d:%d:%d UTC] mail() on [%smail_log.php:%d]: To: test@example.com -- Headers: X-Test: 1
+[%d-%s-%d %d:%d:%d UTC] mail() on [%smail_log.php:%d]: To: test@example.com -- Headers: X-Test: 1 -- Subject: mail.log test
Done
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/dns_get_mx.phpt b/ext/standard/tests/network/dns_get_mx.phpt
index c5bf361b12..f6bb7ec05e 100644
--- a/ext/standard/tests/network/dns_get_mx.phpt
+++ b/ext/standard/tests/network/dns_get_mx.phpt
@@ -14,7 +14,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
?>
--FILE--
<?php
-$domains = array('yahoo.co.jp', 'yahoo.com', 'es.yahoo.com', 'fr.yahoo.com', 'it.yahoo.com');
+$domains = array('php.net', 'doc.php.net', 'wiki.php.net');
foreach ($domains as $domain) {
if (getmxrr($domain, $hosts, $weights)) {
echo "Hosts: " . count($hosts) . ", weights: " . count($weights) . "\n";
@@ -25,5 +25,3 @@ foreach ($domains as $domain) {
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/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/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/serialization_objects_005.phpt b/ext/standard/tests/serialize/serialization_objects_005.phpt
index 35b1593879..9800168ca2 100644
--- a/ext/standard/tests/serialize/serialization_objects_005.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_005.phpt
@@ -88,7 +88,7 @@ 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
NULL
@@ -117,4 +117,4 @@ Notice: main(): The script tried to execute a method or access a property of an
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 57
NULL
-Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 59 \ No newline at end of file
+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
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/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/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_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/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/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/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/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/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/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/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 60884da94e..5f237aecd1 100644
--- a/ext/standard/type.c
+++ b/ext/standard/type.c
@@ -27,9 +27,9 @@ PHP_FUNCTION(gettype)
{
zval *arg;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_ZVAL_DEREF(arg)
+ ZEND_PARSE_PARAMETERS_END();
switch (Z_TYPE_P(arg)) {
case IS_NULL:
@@ -59,17 +59,6 @@ PHP_FUNCTION(gettype)
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:
@@ -78,8 +67,10 @@ PHP_FUNCTION(gettype)
if (type_name) {
RETVAL_STRING("resource");
- break;
+ } else {
+ RETVAL_STRING("resource (closed)");
}
+ break;
}
default:
@@ -96,11 +87,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")) {
@@ -162,9 +153,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_DEREF(num)
+ ZEND_PARSE_PARAMETERS_END();
RETURN_DOUBLE(zval_get_double(num));
}
@@ -176,9 +167,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_DEREF(val)
+ ZEND_PARSE_PARAMETERS_END();
RETURN_BOOL(zend_is_true(val));
}
@@ -207,13 +198,7 @@ static inline void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
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;
@@ -251,11 +236,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_DEREF(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);
}
/* }}} */
@@ -373,10 +357,12 @@ 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_DEREF(var)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(syntax_only)
+ Z_PARAM_ZVAL_DEREF_EX(callable_name, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
if (syntax_only) {
check_flags |= IS_CALLABLE_CHECK_SYNTAX_ONLY;
@@ -408,10 +394,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_DEREF(var)
+ ZEND_PARSE_PARAMETERS_END();
RETURN_BOOL(zend_is_iterable(var));
}
diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c
index f429e6d4a0..48991964ed 100644
--- a/ext/standard/uniqid.c
+++ b/ext/standard/uniqid.c
@@ -54,10 +54,11 @@ PHP_FUNCTION(uniqid)
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();
#if HAVE_USLEEP && !defined(PHP_WIN32)
if (!more_entropy) {
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 915db481ba..e8eb2add76 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -336,9 +336,11 @@ PHP_FUNCTION(parse_url)
php_url *resource;
zend_long key = -1;
- 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) {
@@ -655,9 +657,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 f1dc6d27ae..100331e77e 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -1170,7 +1170,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/user_filters.c b/ext/standard/user_filters.c
index 19aff782fd..31a5d75bc9 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,9 +501,10 @@ 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_DEREF(zstream)
+ Z_PARAM_STRING(buffer, buffer_len)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, zstream);
@@ -561,9 +563,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 787569e430..a99a98d35f 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 95ead7b3e9..7143634489 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_DEREF(var)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(return_output)
+ ZEND_PARSE_PARAMETERS_END();
php_var_export_ex(var, 1, &buf);
smart_str_0 (&buf);
@@ -1039,9 +1041,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_DEREF(struc)
+ ZEND_PARSE_PARAMETERS_END();
PHP_VAR_SERIALIZE_INIT(var_hash);
php_var_serialize(&buf, struc, &var_hash);
@@ -1072,9 +1074,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;
@@ -1138,9 +1142,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));
}
@@ -1151,9 +1156,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 4e2bee3c9e..4892ae58dd 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;
@@ -283,7 +284,7 @@ static inline int unserialize_allowed_class(
#define YYMARKER marker
-#line 291 "ext/standard/var_unserializer.re"
+#line 292 "ext/standard/var_unserializer.re"
@@ -589,7 +590,7 @@ static int php_var_unserialize_internal(UNSERIALIZE_PARAMETER)
start = cursor;
-#line 593 "ext/standard/var_unserializer.c"
+#line 594 "ext/standard/var_unserializer.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -647,9 +648,9 @@ static int php_var_unserialize_internal(UNSERIALIZE_PARAMETER)
yy2:
++YYCURSOR;
yy3:
-#line 961 "ext/standard/var_unserializer.re"
+#line 962 "ext/standard/var_unserializer.re"
{ return 0; }
-#line 653 "ext/standard/var_unserializer.c"
+#line 654 "ext/standard/var_unserializer.c"
yy4:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy17;
@@ -696,13 +697,13 @@ yy14:
goto yy3;
yy15:
++YYCURSOR;
-#line 955 "ext/standard/var_unserializer.re"
+#line 956 "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 706 "ext/standard/var_unserializer.c"
+#line 707 "ext/standard/var_unserializer.c"
yy17:
yych = *++YYCURSOR;
if (yybm[0+yych] & 128) {
@@ -714,13 +715,13 @@ yy18:
goto yy3;
yy19:
++YYCURSOR;
-#line 648 "ext/standard/var_unserializer.re"
+#line 649 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
ZVAL_NULL(rval);
return 1;
}
-#line 724 "ext/standard/var_unserializer.c"
+#line 725 "ext/standard/var_unserializer.c"
yy21:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -970,7 +971,7 @@ yy62:
goto yy18;
yy63:
++YYCURSOR;
-#line 597 "ext/standard/var_unserializer.re"
+#line 598 "ext/standard/var_unserializer.re"
{
zend_long id;
@@ -996,7 +997,7 @@ yy63:
return 1;
}
-#line 1000 "ext/standard/var_unserializer.c"
+#line 1001 "ext/standard/var_unserializer.c"
yy65:
yych = *++YYCURSOR;
if (yych == '"') goto yy84;
@@ -1007,13 +1008,13 @@ yy66:
goto yy18;
yy67:
++YYCURSOR;
-#line 654 "ext/standard/var_unserializer.re"
+#line 655 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
ZVAL_BOOL(rval, parse_iv(start + 2));
return 1;
}
-#line 1017 "ext/standard/var_unserializer.c"
+#line 1018 "ext/standard/var_unserializer.c"
yy69:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
@@ -1033,7 +1034,7 @@ yy69:
}
yy71:
++YYCURSOR;
-#line 702 "ext/standard/var_unserializer.re"
+#line 703 "ext/standard/var_unserializer.re"
{
#if SIZEOF_ZEND_LONG == 4
use_double:
@@ -1042,7 +1043,7 @@ use_double:
ZVAL_DOUBLE(rval, zend_strtod((const char *)start + 2, NULL));
return 1;
}
-#line 1046 "ext/standard/var_unserializer.c"
+#line 1047 "ext/standard/var_unserializer.c"
yy73:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -1064,7 +1065,7 @@ yy75:
goto yy18;
yy76:
++YYCURSOR;
-#line 660 "ext/standard/var_unserializer.re"
+#line 661 "ext/standard/var_unserializer.re"
{
#if SIZEOF_ZEND_LONG == 4
int digits = YYCURSOR - start - 3;
@@ -1090,14 +1091,14 @@ yy76:
ZVAL_LONG(rval, parse_iv(start + 2));
return 1;
}
-#line 1094 "ext/standard/var_unserializer.c"
+#line 1095 "ext/standard/var_unserializer.c"
yy78:
yych = *++YYCURSOR;
if (yych == '"') goto yy92;
goto yy18;
yy79:
++YYCURSOR;
-#line 623 "ext/standard/var_unserializer.re"
+#line 624 "ext/standard/var_unserializer.re"
{
zend_long id;
@@ -1122,14 +1123,14 @@ yy79:
return 1;
}
-#line 1126 "ext/standard/var_unserializer.c"
+#line 1127 "ext/standard/var_unserializer.c"
yy81:
yych = *++YYCURSOR;
if (yych == '"') goto yy94;
goto yy18;
yy82:
++YYCURSOR;
-#line 808 "ext/standard/var_unserializer.re"
+#line 809 "ext/standard/var_unserializer.re"
{
size_t len, len2, len3, maxlen;
zend_long elements;
@@ -1276,10 +1277,10 @@ yy82:
return object_common2(UNSERIALIZE_PASSTHRU, elements);
}
-#line 1280 "ext/standard/var_unserializer.c"
+#line 1281 "ext/standard/var_unserializer.c"
yy84:
++YYCURSOR;
-#line 743 "ext/standard/var_unserializer.re"
+#line 744 "ext/standard/var_unserializer.re"
{
size_t len, maxlen;
zend_string *str;
@@ -1313,10 +1314,10 @@ yy84:
ZVAL_STR(rval, str);
return 1;
}
-#line 1317 "ext/standard/var_unserializer.c"
+#line 1318 "ext/standard/var_unserializer.c"
yy86:
++YYCURSOR;
-#line 777 "ext/standard/var_unserializer.re"
+#line 778 "ext/standard/var_unserializer.re"
{
zend_long elements = parse_iv(start + 2);
/* use iv() not uiv() in order to check data range */
@@ -1340,7 +1341,7 @@ yy86:
return finish_nested_data(UNSERIALIZE_PASSTHRU);
}
-#line 1344 "ext/standard/var_unserializer.c"
+#line 1345 "ext/standard/var_unserializer.c"
yy88:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -1365,17 +1366,17 @@ yy91:
goto yy18;
yy92:
++YYCURSOR;
-#line 801 "ext/standard/var_unserializer.re"
+#line 802 "ext/standard/var_unserializer.re"
{
if (!var_hash) return 0;
return object_common2(UNSERIALIZE_PASSTHRU,
object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR));
}
-#line 1376 "ext/standard/var_unserializer.c"
+#line 1377 "ext/standard/var_unserializer.c"
yy94:
++YYCURSOR;
-#line 711 "ext/standard/var_unserializer.re"
+#line 712 "ext/standard/var_unserializer.re"
{
size_t len, maxlen;
char *str;
@@ -1407,7 +1408,7 @@ yy94:
ZVAL_STRINGL(rval, str, len);
return 1;
}
-#line 1411 "ext/standard/var_unserializer.c"
+#line 1412 "ext/standard/var_unserializer.c"
yy96:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
@@ -1415,25 +1416,25 @@ yy96:
goto yy18;
yy97:
++YYCURSOR;
-#line 686 "ext/standard/var_unserializer.re"
+#line 687 "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 1435 "ext/standard/var_unserializer.c"
+#line 1436 "ext/standard/var_unserializer.c"
}
-#line 963 "ext/standard/var_unserializer.re"
+#line 964 "ext/standard/var_unserializer.re"
return 0;
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index 4f127773ef..2eb6b619b5 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;
@@ -687,11 +688,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);
}
diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c
index 29f421c72f..bf82767ad7 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)) {