From c4dd7a1a684490673e25aaf4fabec5df138854c4 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Thu, 14 Mar 2013 05:42:27 +0000 Subject: Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2. --- ext/standard/Makefile.frag | 10 + ext/standard/array.c | 4543 +++++ ext/standard/assert.c | 347 + ext/standard/base64.c | 266 + ext/standard/base64.h | 38 + ext/standard/basic_functions.c | 6038 +++++++ ext/standard/basic_functions.h | 264 + ext/standard/browscap.c | 545 + ext/standard/config.m4 | 586 + ext/standard/config.w32 | 28 + ext/standard/crc32.c | 53 + ext/standard/crc32.h | 109 + ext/standard/credits.c | 140 + ext/standard/credits.h | 42 + ext/standard/credits_ext.h | 86 + ext/standard/credits_sapi.h | 32 + ext/standard/crypt.c | 318 + ext/standard/crypt_blowfish.c | 909 + ext/standard/crypt_blowfish.h | 32 + ext/standard/crypt_freesec.c | 808 + ext/standard/crypt_freesec.h | 49 + ext/standard/crypt_sha256.c | 759 + ext/standard/crypt_sha512.c | 828 + ext/standard/css.c | 55 + ext/standard/css.h | 26 + ext/standard/cyr_convert.c | 296 + ext/standard/cyr_convert.h | 29 + ext/standard/datetime.c | 128 + ext/standard/datetime.h | 31 + ext/standard/dir.c | 601 + ext/standard/dl.c | 298 + ext/standard/dl.h | 34 + ext/standard/dns.c | 1048 ++ ext/standard/dns_win32.c | 506 + ext/standard/exec.c | 498 + ext/standard/exec.h | 41 + ext/standard/file.c | 2459 +++ ext/standard/file.h | 141 + ext/standard/filestat.c | 1240 ++ ext/standard/filters.c | 2152 +++ ext/standard/flock_compat.c | 239 + ext/standard/flock_compat.h | 66 + ext/standard/formatted_print.c | 793 + ext/standard/fsock.c | 141 + ext/standard/fsock.h | 42 + ext/standard/ftok.c | 71 + ext/standard/ftp_fopen_wrapper.c | 1204 ++ ext/standard/head.c | 321 + ext/standard/head.h | 36 + ext/standard/html.c | 1708 ++ ext/standard/html.h | 62 + ext/standard/html_tables.h | 6235 +++++++ ext/standard/html_tables/ents_basic.txt | 5 + ext/standard/html_tables/ents_basic_apos.txt | 5 + ext/standard/html_tables/ents_html401.txt | 253 + ext/standard/html_tables/ents_html5.txt | 2125 +++ ext/standard/html_tables/ents_xhtml.txt | 253 + ext/standard/html_tables/html_table_gen.php | 812 + ext/standard/html_tables/mappings/8859-1.TXT | 303 + ext/standard/html_tables/mappings/8859-15.TXT | 303 + ext/standard/html_tables/mappings/8859-5.TXT | 303 + ext/standard/html_tables/mappings/CP1251.TXT | 274 + ext/standard/html_tables/mappings/CP1252.TXT | 274 + ext/standard/html_tables/mappings/CP866.TXT | 275 + ext/standard/html_tables/mappings/KOI8-R.TXT | 302 + ext/standard/html_tables/mappings/ROMAN.TXT | 370 + ext/standard/http.c | 253 + ext/standard/http_fopen_wrapper.c | 962 ++ ext/standard/image.c | 1441 ++ ext/standard/incomplete_class.c | 183 + ext/standard/info.c | 1336 ++ ext/standard/info.h | 92 + ext/standard/iptc.c | 375 + ext/standard/lcg.c | 132 + ext/standard/levenshtein.c | 142 + ext/standard/link.c | 232 + ext/standard/link_win32.c | 248 + ext/standard/mail.c | 414 + ext/standard/math.c | 1295 ++ ext/standard/md5.c | 389 + ext/standard/md5.h | 55 + ext/standard/metaphone.c | 480 + ext/standard/microtime.c | 166 + ext/standard/microtime.h | 32 + ext/standard/pack.c | 953 ++ ext/standard/pack.h | 28 + ext/standard/pageinfo.c | 201 + ext/standard/pageinfo.h | 35 + ext/standard/php_array.h | 130 + ext/standard/php_assert.h | 32 + ext/standard/php_browscap.h | 29 + ext/standard/php_crypt.h | 40 + ext/standard/php_crypt_r.c | 428 + ext/standard/php_crypt_r.h | 59 + ext/standard/php_dir.h | 44 + ext/standard/php_dns.h | 81 + ext/standard/php_ext_syslog.h | 41 + ext/standard/php_filestat.h | 115 + ext/standard/php_fopen_wrapper.c | 409 + ext/standard/php_fopen_wrappers.h | 33 + ext/standard/php_ftok.h | 28 + ext/standard/php_http.h | 46 + ext/standard/php_image.h | 66 + ext/standard/php_incomplete_class.h | 68 + ext/standard/php_iptc.h | 27 + ext/standard/php_lcg.h | 43 + ext/standard/php_link.h | 33 + ext/standard/php_mail.h | 30 + ext/standard/php_math.h | 173 + ext/standard/php_metaphone.h | 26 + ext/standard/php_rand.h | 60 + ext/standard/php_smart_str.h | 195 + ext/standard/php_smart_str_public.h | 32 + ext/standard/php_standard.h | 72 + ext/standard/php_string.h | 167 + ext/standard/php_type.h | 41 + ext/standard/php_uuencode.h | 37 + ext/standard/php_var.h | 169 + ext/standard/php_versioning.h | 30 + ext/standard/proc_open.c | 982 ++ ext/standard/proc_open.h | 52 + ext/standard/quot_print.c | 289 + ext/standard/quot_print.h | 30 + ext/standard/rand.c | 383 + ext/standard/scanf.c | 1233 ++ ext/standard/scanf.h | 49 + ext/standard/sha1.c | 412 + ext/standard/sha1.h | 41 + ext/standard/soundex.c | 115 + ext/standard/streamsfuncs.c | 1638 ++ ext/standard/streamsfuncs.h | 77 + ext/standard/string.c | 5667 +++++++ ext/standard/strnatcmp.c | 189 + ext/standard/syslog.c | 201 + ext/standard/tests/array/001.phpt | 157 + ext/standard/tests/array/002.phpt | 684 + ext/standard/tests/array/003.phpt | 104 + ext/standard/tests/array/004.phpt | 59 + ext/standard/tests/array/005.phpt | 291 + ext/standard/tests/array/006.phpt | 49 + ext/standard/tests/array/007.phpt | 553 + ext/standard/tests/array/008.phpt | 310 + ext/standard/tests/array/009.phpt | 535 + .../tests/array/array_change_key_case.phpt | 817 + .../tests/array/array_change_key_case_errors.phpt | 28 + .../array/array_change_key_case_variation.phpt | 51 + .../array/array_change_key_case_variation1.phpt | 224 + .../array/array_change_key_case_variation2.phpt | 288 + .../array/array_change_key_case_variation3.phpt | 197 + .../array/array_change_key_case_variation4.phpt | 138 + .../array/array_change_key_case_variation5.phpt | 46 + .../array/array_change_key_case_variation6.phpt | 72 + .../array/array_change_key_case_variation7.phpt | 64 + .../array/array_change_key_case_variation8.phpt | 133 + ext/standard/tests/array/array_chunk.phpt | 21 + ext/standard/tests/array/array_chunk2.phpt | 146 + ext/standard/tests/array/array_chunk_basic1.phpt | 138 + ext/standard/tests/array/array_chunk_basic2.phpt | 222 + ext/standard/tests/array/array_chunk_error.phpt | 46 + .../tests/array/array_chunk_variation1.phpt | 325 + .../tests/array/array_chunk_variation10.phpt | 159 + .../tests/array/array_chunk_variation11.phpt | 93 + .../tests/array/array_chunk_variation12.phpt | 159 + .../tests/array/array_chunk_variation13.phpt | 92 + .../tests/array/array_chunk_variation14.phpt | 159 + .../tests/array/array_chunk_variation15.phpt | 159 + .../tests/array/array_chunk_variation16.phpt | 238 + .../tests/array/array_chunk_variation17.phpt | 238 + .../tests/array/array_chunk_variation18.phpt | 338 + .../tests/array/array_chunk_variation19.phpt | 1018 ++ .../tests/array/array_chunk_variation2.phpt | 427 + .../tests/array/array_chunk_variation20.phpt | 1199 ++ .../tests/array/array_chunk_variation21.phpt | 46 + .../tests/array/array_chunk_variation22.phpt | 92 + .../tests/array/array_chunk_variation23.phpt | 441 + .../tests/array/array_chunk_variation24.phpt | 46 + .../tests/array/array_chunk_variation25.phpt | 441 + .../tests/array/array_chunk_variation26.phpt | 46 + .../tests/array/array_chunk_variation27.phpt | 46 + .../tests/array/array_chunk_variation28.phpt | 46 + .../tests/array/array_chunk_variation29.phpt | 92 + .../tests/array/array_chunk_variation3.phpt | 268 + .../tests/array/array_chunk_variation30.phpt | 159 + .../tests/array/array_chunk_variation31.phpt | 46 + .../tests/array/array_chunk_variation32.phpt | 46 + .../tests/array/array_chunk_variation4.phpt | 120 + .../tests/array/array_chunk_variation5.phpt | 148 + .../tests/array/array_chunk_variation6.phpt | 135 + .../tests/array/array_chunk_variation7.phpt | 89 + .../tests/array/array_chunk_variation8.phpt | 46 + .../tests/array/array_chunk_variation9.phpt | 92 + ext/standard/tests/array/array_combine.phpt | 122 + ext/standard/tests/array/array_combine_basic.phpt | 52 + ext/standard/tests/array/array_combine_error1.phpt | 48 + ext/standard/tests/array/array_combine_error2.phpt | 52 + .../tests/array/array_combine_variation1.phpt | 198 + .../tests/array/array_combine_variation2.phpt | 198 + .../tests/array/array_combine_variation3.phpt | 278 + .../tests/array/array_combine_variation4.phpt | 191 + .../tests/array/array_combine_variation5.phpt | 185 + .../tests/array/array_combine_variation6.phpt | 53 + ext/standard/tests/array/array_count_values.phpt | 94 + ext/standard/tests/array/array_count_values2.phpt | 43 + .../tests/array/array_count_values_error.phpt | 50 + .../tests/array/array_count_values_variation.phpt | 51 + ext/standard/tests/array/array_diff_1.phpt | 15 + ext/standard/tests/array/array_diff_assoc.phpt | 49 + .../tests/array/array_diff_assoc_basic.phpt | 90 + .../tests/array/array_diff_assoc_error.phpt | 41 + .../tests/array/array_diff_assoc_variation1.phpt | 234 + .../tests/array/array_diff_assoc_variation10.phpt | 50 + .../tests/array/array_diff_assoc_variation2.phpt | 235 + .../tests/array/array_diff_assoc_variation3.phpt | 206 + .../tests/array/array_diff_assoc_variation4.phpt | 177 + .../tests/array/array_diff_assoc_variation5.phpt | 148 + .../tests/array/array_diff_assoc_variation6.phpt | 196 + .../tests/array/array_diff_assoc_variation7.phpt | 101 + .../tests/array/array_diff_assoc_variation8.phpt | 49 + .../tests/array/array_diff_assoc_variation9.phpt | 141 + ext/standard/tests/array/array_diff_basic.phpt | 116 + ext/standard/tests/array/array_diff_error.phpt | 40 + ext/standard/tests/array/array_diff_key.phpt | 250 + ext/standard/tests/array/array_diff_key2.phpt | 44 + ext/standard/tests/array/array_diff_key_basic.phpt | 19 + ext/standard/tests/array/array_diff_key_error.phpt | 36 + .../tests/array/array_diff_key_variation1.phpt | 310 + .../tests/array/array_diff_key_variation2.phpt | 311 + .../tests/array/array_diff_key_variation3.phpt | 232 + .../tests/array/array_diff_key_variation4.phpt | 61 + .../tests/array/array_diff_key_variation5.phpt | 34 + .../tests/array/array_diff_key_variation6.phpt | 36 + .../tests/array/array_diff_key_variation7.phpt | 59 + .../tests/array/array_diff_key_variation8.phpt | 54 + .../tests/array/array_diff_uassoc_basic.phpt | 28 + .../tests/array/array_diff_uassoc_error.phpt | 62 + .../tests/array/array_diff_uassoc_variation1.phpt | 244 + .../tests/array/array_diff_uassoc_variation10.phpt | 47 + .../tests/array/array_diff_uassoc_variation11.phpt | 45 + .../tests/array/array_diff_uassoc_variation12.phpt | 60 + .../tests/array/array_diff_uassoc_variation13.phpt | 68 + .../tests/array/array_diff_uassoc_variation14.phpt | 40 + .../tests/array/array_diff_uassoc_variation2.phpt | 244 + .../tests/array/array_diff_uassoc_variation3.phpt | 263 + .../tests/array/array_diff_uassoc_variation4.phpt | 246 + .../tests/array/array_diff_uassoc_variation5.phpt | 40 + .../tests/array/array_diff_uassoc_variation6.phpt | 58 + .../tests/array/array_diff_uassoc_variation7.phpt | 47 + .../tests/array/array_diff_uassoc_variation8.phpt | 62 + .../tests/array/array_diff_uassoc_variation9.phpt | 62 + .../tests/array/array_diff_ukey_basic.phpt | 24 + .../tests/array/array_diff_ukey_error.phpt | 55 + .../tests/array/array_diff_ukey_variation1.phpt | 318 + .../tests/array/array_diff_ukey_variation10.phpt | 40 + .../tests/array/array_diff_ukey_variation11.phpt | 44 + .../tests/array/array_diff_ukey_variation2.phpt | 322 + .../tests/array/array_diff_ukey_variation3.phpt | 240 + .../tests/array/array_diff_ukey_variation4.phpt | 254 + .../tests/array/array_diff_ukey_variation5.phpt | 54 + .../tests/array/array_diff_ukey_variation6.phpt | 65 + .../tests/array/array_diff_ukey_variation7.phpt | 42 + .../tests/array/array_diff_ukey_variation8.phpt | 42 + .../tests/array/array_diff_ukey_variation9.phpt | 59 + .../tests/array/array_diff_variation1.phpt | 208 + .../tests/array/array_diff_variation10.phpt | 44 + .../tests/array/array_diff_variation2.phpt | 207 + .../tests/array/array_diff_variation3.phpt | 190 + .../tests/array/array_diff_variation4.phpt | 184 + .../tests/array/array_diff_variation5.phpt | 119 + .../tests/array/array_diff_variation6.phpt | 46 + .../tests/array/array_diff_variation7.phpt | 95 + .../tests/array/array_diff_variation8.phpt | 207 + .../tests/array/array_diff_variation9.phpt | 156 + ext/standard/tests/array/array_fill.phpt | 366 + ext/standard/tests/array/array_fill_basic.phpt | 96 + ext/standard/tests/array/array_fill_error.phpt | 61 + ext/standard/tests/array/array_fill_keys.phpt | 44 + .../tests/array/array_fill_keys_error.phpt | 45 + .../tests/array/array_fill_keys_variation1.phpt | 79 + .../tests/array/array_fill_keys_variation2.phpt | 81 + .../tests/array/array_fill_keys_variation3.phpt | 54 + .../tests/array/array_fill_keys_variation4.phpt | 91 + ext/standard/tests/array/array_fill_object.phpt | 434 + .../tests/array/array_fill_object_2_4.phpt | 434 + .../tests/array/array_fill_variation1.phpt | 247 + .../tests/array/array_fill_variation1_64bit.phpt | 247 + .../tests/array/array_fill_variation2.phpt | 206 + .../tests/array/array_fill_variation3.phpt | 110 + .../tests/array/array_fill_variation4.phpt | 168 + .../tests/array/array_fill_variation5.phpt | 291 + ext/standard/tests/array/array_filter.phpt | 93 + ext/standard/tests/array/array_filter_basic.phpt | 55 + ext/standard/tests/array/array_filter_error.phpt | 50 + ext/standard/tests/array/array_filter_object.phpt | 155 + .../tests/array/array_filter_variation1.phpt | 195 + .../tests/array/array_filter_variation2.phpt | 184 + .../tests/array/array_filter_variation3.phpt | 216 + .../tests/array/array_filter_variation4.phpt | 97 + .../tests/array/array_filter_variation5.phpt | 109 + .../tests/array/array_filter_variation6.phpt | 94 + .../tests/array/array_filter_variation7.phpt | 80 + .../tests/array/array_filter_variation8.phpt | 151 + .../tests/array/array_filter_variation9.phpt | 72 + ext/standard/tests/array/array_flip.phpt | 37 + ext/standard/tests/array/array_flip_basic.phpt | 71 + ext/standard/tests/array/array_flip_error.phpt | 34 + .../tests/array/array_flip_variation1.phpt | 179 + .../tests/array/array_flip_variation2.phpt | Bin 0 -> 2179 bytes .../tests/array/array_flip_variation3.phpt | Bin 0 -> 2823 bytes .../tests/array/array_flip_variation4.phpt | 90 + .../tests/array/array_flip_variation5.phpt | 82 + ext/standard/tests/array/array_intersect_1.phpt | 364 + .../tests/array/array_intersect_assoc_basic.phpt | 69 + .../tests/array/array_intersect_assoc_error.phpt | 36 + .../array/array_intersect_assoc_variation1.phpt | 281 + .../array/array_intersect_assoc_variation10.phpt | 54 + .../array/array_intersect_assoc_variation2.phpt | 282 + .../array/array_intersect_assoc_variation3.phpt | 243 + .../array/array_intersect_assoc_variation4.phpt | 254 + .../array/array_intersect_assoc_variation5.phpt | 173 + .../array/array_intersect_assoc_variation6.phpt | 173 + .../array/array_intersect_assoc_variation7.phpt | 212 + .../array/array_intersect_assoc_variation8.phpt | 212 + .../array/array_intersect_assoc_variation9.phpt | 152 + .../tests/array/array_intersect_basic.phpt | 80 + .../tests/array/array_intersect_error.phpt | 35 + ext/standard/tests/array/array_intersect_key.phpt | 209 + .../tests/array/array_intersect_key_basic.phpt | 19 + .../tests/array/array_intersect_key_error.phpt | 36 + .../array/array_intersect_key_variation1.phpt | 314 + .../array/array_intersect_key_variation2.phpt | 315 + .../array/array_intersect_key_variation3.phpt | 235 + .../array/array_intersect_key_variation4.phpt | 60 + .../array/array_intersect_key_variation5.phpt | 41 + .../array/array_intersect_key_variation6.phpt | 37 + .../array/array_intersect_key_variation7.phpt | 63 + .../array/array_intersect_key_variation8.phpt | 64 + .../tests/array/array_intersect_uassoc_basic.phpt | 24 + .../tests/array/array_intersect_uassoc_error.phpt | 60 + .../array/array_intersect_uassoc_variation1.phpt | 323 + .../array/array_intersect_uassoc_variation10.phpt | 55 + .../array/array_intersect_uassoc_variation11.phpt | 42 + .../array/array_intersect_uassoc_variation2.phpt | 323 + .../array/array_intersect_uassoc_variation3.phpt | 244 + .../array/array_intersect_uassoc_variation4.phpt | 257 + .../array/array_intersect_uassoc_variation5.phpt | 58 + .../array/array_intersect_uassoc_variation6.phpt | 46 + .../array/array_intersect_uassoc_variation7.phpt | 54 + .../array/array_intersect_uassoc_variation8.phpt | 51 + .../array/array_intersect_uassoc_variation9.phpt | 39 + .../tests/array/array_intersect_ukey_basic.phpt | 24 + .../tests/array/array_intersect_ukey_error.phpt | 56 + .../array/array_intersect_ukey_variation1.phpt | 320 + .../array/array_intersect_ukey_variation10.phpt | 43 + .../array/array_intersect_ukey_variation2.phpt | 320 + .../array/array_intersect_ukey_variation3.phpt | 290 + .../array/array_intersect_ukey_variation4.phpt | 321 + .../array/array_intersect_ukey_variation5.phpt | 63 + .../array/array_intersect_ukey_variation6.phpt | 51 + .../array/array_intersect_ukey_variation7.phpt | 63 + .../array/array_intersect_ukey_variation8.phpt | 39 + .../array/array_intersect_ukey_variation9.phpt | 61 + .../tests/array/array_intersect_variation1.phpt | 280 + .../tests/array/array_intersect_variation10.phpt | 53 + .../tests/array/array_intersect_variation2.phpt | 281 + .../tests/array/array_intersect_variation3.phpt | 342 + .../tests/array/array_intersect_variation4.phpt | 349 + .../tests/array/array_intersect_variation5.phpt | 192 + .../tests/array/array_intersect_variation6.phpt | 192 + .../tests/array/array_intersect_variation7.phpt | 211 + .../tests/array/array_intersect_variation8.phpt | 219 + .../tests/array/array_intersect_variation9.phpt | 255 + ext/standard/tests/array/array_key_exists.phpt | 292 + .../tests/array/array_key_exists_basic.phpt | 29 + .../tests/array/array_key_exists_error.phpt | 44 + .../tests/array/array_key_exists_object1.phpt | 80 + .../tests/array/array_key_exists_object2.phpt | 84 + .../tests/array/array_key_exists_variation1.phpt | 203 + .../tests/array/array_key_exists_variation2.phpt | 225 + .../tests/array/array_key_exists_variation3.phpt | 60 + .../tests/array/array_key_exists_variation4.phpt | 31 + .../tests/array/array_key_exists_variation5.phpt | 39 + .../tests/array/array_key_exists_variation6.phpt | 96 + .../tests/array/array_key_exists_variation7.phpt | 36 + .../tests/array/array_key_exists_variation8.phpt | 547 + ext/standard/tests/array/array_keys_basic.phpt | 27 + ext/standard/tests/array/array_keys_error.phpt | 42 + .../tests/array/array_keys_variation_001.phpt | 147 + .../tests/array/array_keys_variation_002.phpt | 52 + .../array/array_keys_variation_002_64bit.phpt | 56 + .../tests/array/array_keys_variation_003.phpt | 116 + .../tests/array/array_keys_variation_004.phpt | 68 + .../tests/array/array_keys_variation_005.phpt | 40 + ext/standard/tests/array/array_map_001.phpt | 23 + ext/standard/tests/array/array_map_basic.phpt | 70 + ext/standard/tests/array/array_map_error.phpt | 73 + ext/standard/tests/array/array_map_object1.phpt | 206 + ext/standard/tests/array/array_map_object2.phpt | 46 + ext/standard/tests/array/array_map_object3.phpt | 92 + ext/standard/tests/array/array_map_variation1.phpt | 56 + .../tests/array/array_map_variation10.phpt | 120 + .../tests/array/array_map_variation11.phpt | 52 + .../tests/array/array_map_variation12.phpt | 60 + .../tests/array/array_map_variation13.phpt | 107 + .../tests/array/array_map_variation14.phpt | 125 + .../tests/array/array_map_variation15.phpt | 30 + .../tests/array/array_map_variation16.phpt | 73 + .../tests/array/array_map_variation17.phpt | 158 + .../tests/array/array_map_variation18.phpt | 205 + .../tests/array/array_map_variation19.phpt | 40 + ext/standard/tests/array/array_map_variation2.phpt | 213 + ext/standard/tests/array/array_map_variation3.phpt | 227 + ext/standard/tests/array/array_map_variation4.phpt | 179 + ext/standard/tests/array/array_map_variation5.phpt | 181 + ext/standard/tests/array/array_map_variation6.phpt | 72 + ext/standard/tests/array/array_map_variation7.phpt | 122 + ext/standard/tests/array/array_map_variation8.phpt | 81 + ext/standard/tests/array/array_map_variation9.phpt | 88 + ext/standard/tests/array/array_merge.phpt | 762 + ext/standard/tests/array/array_merge_basic.phpt | 58 + ext/standard/tests/array/array_merge_error.phpt | 30 + .../tests/array/array_merge_recursive_basic1.phpt | 97 + .../tests/array/array_merge_recursive_basic2.phpt | 94 + .../tests/array/array_merge_recursive_error.phpt | 25 + .../array/array_merge_recursive_variation1.phpt | 303 + .../array/array_merge_recursive_variation10.phpt | 174 + .../array/array_merge_recursive_variation2.phpt | 199 + .../array/array_merge_recursive_variation3.phpt | 761 + .../array/array_merge_recursive_variation4.phpt | 424 + .../array/array_merge_recursive_variation5.phpt | 404 + .../array/array_merge_recursive_variation6.phpt | 113 + .../array/array_merge_recursive_variation7.phpt | 82 + .../array/array_merge_recursive_variation8.phpt | 73 + .../array/array_merge_recursive_variation9.phpt | 117 + .../tests/array/array_merge_variation1.phpt | 231 + .../tests/array/array_merge_variation10.phpt | 70 + .../tests/array/array_merge_variation2.phpt | 230 + .../tests/array/array_merge_variation3.phpt | 379 + .../tests/array/array_merge_variation4.phpt | 368 + .../tests/array/array_merge_variation5.phpt | 61 + .../tests/array/array_merge_variation6.phpt | 53 + .../tests/array/array_merge_variation7.phpt | 65 + .../tests/array/array_merge_variation8.phpt | 74 + .../tests/array/array_merge_variation9.phpt | 99 + .../tests/array/array_multisort_basic1.phpt | 60 + .../tests/array/array_multisort_basic2.phpt | 44 + ext/standard/tests/array/array_multisort_case.phpt | 73 + .../tests/array/array_multisort_error.phpt | 44 + .../tests/array/array_multisort_incase.phpt | 73 + .../tests/array/array_multisort_natural.phpt | 61 + .../tests/array/array_multisort_natural_case.phpt | 73 + .../array/array_multisort_natural_incase.phpt | 73 + .../tests/array/array_multisort_variation1.phpt | 207 + .../tests/array/array_multisort_variation10.phpt | 20 + .../tests/array/array_multisort_variation11.phpt | 21 + .../tests/array/array_multisort_variation2.phpt | 228 + .../tests/array/array_multisort_variation3.phpt | 208 + .../tests/array/array_multisort_variation4.phpt | 58 + .../tests/array/array_multisort_variation5.phpt | 53 + .../tests/array/array_multisort_variation6.phpt | 53 + .../tests/array/array_multisort_variation7.phpt | 68 + .../tests/array/array_multisort_variation8.phpt | 74 + .../tests/array/array_multisort_variation9.phpt | 78 + ext/standard/tests/array/array_next_error1.phpt | 13 + ext/standard/tests/array/array_next_error2.phpt | 12 + ext/standard/tests/array/array_pad.phpt | 101 + ext/standard/tests/array/array_pad_error.phpt | 53 + ext/standard/tests/array/array_pad_variation1.phpt | 270 + ext/standard/tests/array/array_pad_variation2.phpt | 256 + ext/standard/tests/array/array_pad_variation3.phpt | 869 + ext/standard/tests/array/array_pad_variation4.phpt | 60 + ext/standard/tests/array/array_pad_variation5.phpt | 140 + ext/standard/tests/array/array_pad_variation6.phpt | 668 + ext/standard/tests/array/array_pad_variation7.phpt | 127 + ext/standard/tests/array/array_pop.phpt | 220 + ext/standard/tests/array/array_pop_errors.phpt | 64 + ext/standard/tests/array/array_pop_variation.phpt | 55 + ext/standard/tests/array/array_product_error.phpt | 45 + .../tests/array/array_product_variation1.phpt | 58 + .../tests/array/array_product_variation2.phpt | 22 + .../tests/array/array_product_variation3.phpt | 48 + .../tests/array/array_product_variation4.phpt | 29 + .../tests/array/array_product_variation5.phpt | 223 + ext/standard/tests/array/array_push.phpt | 282 + ext/standard/tests/array/array_push_basic.phpt | 63 + ext/standard/tests/array/array_push_error1.phpt | 30 + ext/standard/tests/array/array_push_error2.phpt | 34 + .../tests/array/array_push_variation1.phpt | 225 + .../tests/array/array_push_variation2.phpt | 178 + .../tests/array/array_push_variation3.phpt | 70 + .../tests/array/array_push_variation5.phpt | 36 + .../tests/array/array_push_variation6.phpt | 159 + ext/standard/tests/array/array_rand.phpt | 51 + ext/standard/tests/array/array_rand_basic1.phpt | 53 + ext/standard/tests/array/array_rand_basic2.phpt | 58 + ext/standard/tests/array/array_rand_error.phpt | 38 + .../tests/array/array_rand_variation1.phpt | 217 + .../tests/array/array_rand_variation2.phpt | 215 + .../tests/array/array_rand_variation3.phpt | 150 + .../tests/array/array_rand_variation4.phpt | 168 + .../tests/array/array_rand_variation5.phpt | 75 + .../tests/array/array_rand_variation6.phpt | 104 + ext/standard/tests/array/array_reduce.phpt | 79 + ext/standard/tests/array/array_reduce_error.phpt | 41 + .../tests/array/array_reduce_variation1.phpt | 44 + .../tests/array/array_reduce_variation2.phpt | 35 + .../tests/array/array_reduce_variation3.phpt | 36 + ext/standard/tests/array/array_replace.phpt | 122 + ext/standard/tests/array/array_reverse_basic1.phpt | 72 + ext/standard/tests/array/array_reverse_basic2.phpt | 60 + ext/standard/tests/array/array_reverse_error.phpt | 40 + .../tests/array/array_reverse_variation1.phpt | 340 + .../tests/array/array_reverse_variation2.phpt | 414 + .../tests/array/array_reverse_variation3.phpt | 602 + .../tests/array/array_reverse_variation4.phpt | 377 + .../tests/array/array_reverse_variation5.phpt | 399 + .../tests/array/array_reverse_variation6.phpt | 209 + ext/standard/tests/array/array_search.phpt | Bin 0 -> 539 bytes ext/standard/tests/array/array_search1.phpt | 35 + ext/standard/tests/array/array_search_errors.phpt | 44 + .../tests/array/array_search_variation1.phpt | 641 + .../tests/array/array_search_variation2.phpt | 102 + .../tests/array/array_search_variation3.phpt | 58 + .../tests/array/array_search_variation4.phpt | 74 + ext/standard/tests/array/array_shift_basic.phpt | 54 + ext/standard/tests/array/array_shift_error.phpt | 40 + .../tests/array/array_shift_variation1.phpt | 218 + .../tests/array/array_shift_variation2.phpt | 208 + .../tests/array/array_shift_variation3.phpt | 188 + .../tests/array/array_shift_variation4.phpt | 109 + .../tests/array/array_shift_variation5.phpt | 45 + .../tests/array/array_shift_variation6.phpt | 83 + .../tests/array/array_shift_variation7.phpt | 34 + .../tests/array/array_shift_variation8.phpt | 50 + ext/standard/tests/array/array_shuffle_basic.phpt | 99 + ext/standard/tests/array/array_slice.phpt | 1459 ++ ext/standard/tests/array/array_slice_basic.phpt | 51 + ext/standard/tests/array/array_slice_error.phpt | 43 + .../tests/array/array_slice_variation1.phpt | 61 + .../tests/array/array_slice_variation10.phpt | 44 + .../tests/array/array_slice_variation11.phpt | 227 + .../tests/array/array_slice_variation2.phpt | 311 + .../tests/array/array_slice_variation3.phpt | 213 + .../tests/array/array_slice_variation4.phpt | 327 + .../tests/array/array_slice_variation5.phpt | 191 + .../tests/array/array_slice_variation6.phpt | 150 + .../tests/array/array_slice_variation7.phpt | 300 + .../tests/array/array_slice_variation8.phpt | 56 + .../tests/array/array_slice_variation9.phpt | 50 + ext/standard/tests/array/array_splice_basic.phpt | 117 + ext/standard/tests/array/array_splice_errors.phpt | 41 + .../tests/array/array_splice_variation1.phpt | 109 + .../tests/array/array_splice_variation2.phpt | 27 + .../tests/array/array_splice_variation3.phpt | 856 + .../tests/array/array_splice_variation4.phpt | 69 + ext/standard/tests/array/array_sum.phpt | 30 + ext/standard/tests/array/array_sum_basic.phpt | 37 + ext/standard/tests/array/array_sum_error.phpt | 34 + ext/standard/tests/array/array_sum_variation1.phpt | 179 + ext/standard/tests/array/array_sum_variation2.phpt | 49 + ext/standard/tests/array/array_sum_variation3.phpt | 54 + ext/standard/tests/array/array_sum_variation4.phpt | 34 + ext/standard/tests/array/array_sum_variation5.phpt | 37 + ext/standard/tests/array/array_sum_variation6.phpt | 33 + ext/standard/tests/array/array_sum_variation7.phpt | 86 + .../tests/array/array_udiff_assoc_basic.phpt | 41 + .../tests/array/array_udiff_assoc_error.phpt | 42 + .../tests/array/array_udiff_assoc_variation.phpt | 36 + .../tests/array/array_udiff_assoc_variation1.phpt | 227 + .../tests/array/array_udiff_assoc_variation2.phpt | 227 + .../tests/array/array_udiff_assoc_variation3.phpt | 251 + .../tests/array/array_udiff_assoc_variation4.phpt | 228 + .../tests/array/array_udiff_assoc_variation5.phpt | 60 + ext/standard/tests/array/array_udiff_basic.phpt | 36 + ext/standard/tests/array/array_udiff_error.phpt | 42 + .../tests/array/array_udiff_uassoc_basic.phpt | 45 + .../tests/array/array_udiff_uassoc_error.phpt | 44 + .../tests/array/array_udiff_uassoc_variation1.phpt | 228 + .../tests/array/array_udiff_uassoc_variation2.phpt | 228 + .../tests/array/array_udiff_uassoc_variation3.phpt | 254 + .../tests/array/array_udiff_uassoc_variation4.phpt | 254 + .../tests/array/array_udiff_uassoc_variation5.phpt | 229 + .../tests/array/array_udiff_uassoc_variation6.phpt | 58 + .../tests/array/array_udiff_variation1.phpt | 227 + .../tests/array/array_udiff_variation2.phpt | 227 + .../tests/array/array_udiff_variation3.phpt | 251 + .../tests/array/array_udiff_variation4.phpt | 228 + .../tests/array/array_udiff_variation5.phpt | 55 + .../tests/array/array_uintersect_assoc_basic.phpt | 36 + .../tests/array/array_uintersect_assoc_basic2.phpt | 36 + .../tests/array/array_uintersect_assoc_error.phpt | 43 + .../array/array_uintersect_assoc_variation1.phpt | 227 + .../array/array_uintersect_assoc_variation2.phpt | 227 + .../array/array_uintersect_assoc_variation3.phpt | 251 + .../array/array_uintersect_assoc_variation4.phpt | 228 + .../array/array_uintersect_assoc_variation5.phpt | 54 + .../tests/array/array_uintersect_basic.phpt | 41 + .../tests/array/array_uintersect_error.phpt | 45 + .../tests/array/array_uintersect_uassoc_basic.phpt | 40 + .../tests/array/array_uintersect_uassoc_error.phpt | 45 + .../array/array_uintersect_uassoc_variation1.phpt | 228 + .../array/array_uintersect_uassoc_variation2.phpt | 228 + .../array/array_uintersect_uassoc_variation3.phpt | 254 + .../array/array_uintersect_uassoc_variation4.phpt | 254 + .../array/array_uintersect_uassoc_variation5.phpt | 229 + .../array/array_uintersect_uassoc_variation6.phpt | 56 + .../tests/array/array_uintersect_variation1.phpt | 227 + .../tests/array/array_uintersect_variation2.phpt | 227 + .../tests/array/array_uintersect_variation3.phpt | 251 + .../tests/array/array_uintersect_variation4.phpt | 228 + .../tests/array/array_uintersect_variation5.phpt | 58 + ext/standard/tests/array/array_unique_basic.phpt | 48 + ext/standard/tests/array/array_unique_error.phpt | 36 + .../tests/array/array_unique_variation1.phpt | 195 + .../tests/array/array_unique_variation2.phpt | 232 + .../tests/array/array_unique_variation3.phpt | 134 + .../tests/array/array_unique_variation4.phpt | 131 + .../tests/array/array_unique_variation5.phpt | 33 + .../tests/array/array_unique_variation6.phpt | 44 + .../tests/array/array_unique_variation7.phpt | 33 + .../tests/array/array_unique_variation8.phpt | 72 + ext/standard/tests/array/array_unshift.phpt | 40 + ext/standard/tests/array/array_unshift_basic1.phpt | 63 + ext/standard/tests/array/array_unshift_basic2.phpt | 71 + ext/standard/tests/array/array_unshift_error.phpt | 34 + ext/standard/tests/array/array_unshift_object.phpt | 287 + .../tests/array/array_unshift_variation1.phpt | 338 + .../tests/array/array_unshift_variation2.phpt | 1061 ++ .../tests/array/array_unshift_variation3.phpt | 571 + .../tests/array/array_unshift_variation4.phpt | 390 + .../tests/array/array_unshift_variation5.phpt | 398 + .../tests/array/array_unshift_variation6.phpt | 196 + .../tests/array/array_unshift_variation7.phpt | 216 + .../tests/array/array_unshift_variation8.phpt | 214 + .../tests/array/array_unshift_variation9.phpt | 309 + .../tests/array/array_user_key_compare.phpt | 19 + ext/standard/tests/array/array_values.phpt | Bin 0 -> 3060 bytes ext/standard/tests/array/array_values_basic.phpt | 40 + ext/standard/tests/array/array_values_error.phpt | 42 + ext/standard/tests/array/array_values_errors.phpt | 36 + .../tests/array/array_values_variation.phpt | 76 + .../tests/array/array_values_variation1.phpt | 224 + .../tests/array/array_values_variation2.phpt | 215 + .../tests/array/array_values_variation3.phpt | 200 + .../tests/array/array_values_variation4.phpt | 99 + .../tests/array/array_values_variation5.phpt | 46 + .../tests/array/array_values_variation6.phpt | 54 + .../tests/array/array_values_variation7.phpt | 55 + .../tests/array/array_values_variation_64bit.phpt | 74 + ext/standard/tests/array/array_walk.phpt | 50 + ext/standard/tests/array/array_walk_basic1.phpt | 80 + ext/standard/tests/array/array_walk_basic2.phpt | 105 + ext/standard/tests/array/array_walk_error1.phpt | 48 + ext/standard/tests/array/array_walk_error2.phpt | 59 + ext/standard/tests/array/array_walk_object1.phpt | 67 + ext/standard/tests/array/array_walk_object2.phpt | 104 + ext/standard/tests/array/array_walk_objects.phpt | 44 + .../tests/array/array_walk_rec_objects.phpt | 44 + ext/standard/tests/array/array_walk_recursive.phpt | 26 + .../tests/array/array_walk_recursive1.phpt | 56 + .../tests/array/array_walk_recursive_basic1.phpt | 80 + .../tests/array/array_walk_recursive_basic2.phpt | 105 + .../tests/array/array_walk_recursive_error1.phpt | 49 + .../tests/array/array_walk_recursive_error2.phpt | 59 + .../tests/array/array_walk_recursive_object1.phpt | 65 + .../tests/array/array_walk_recursive_object2.phpt | 106 + .../array/array_walk_recursive_variation1.phpt | 250 + .../array/array_walk_recursive_variation2.phpt | 268 + .../array/array_walk_recursive_variation3.phpt | 123 + .../array/array_walk_recursive_variation4.phpt | 76 + .../array/array_walk_recursive_variation5.phpt | 64 + .../array/array_walk_recursive_variation6.phpt | 147 + .../array/array_walk_recursive_variation7.phpt | 93 + .../array/array_walk_recursive_variation8.phpt | 42 + .../array/array_walk_recursive_variation9.phpt | 99 + .../tests/array/array_walk_variation1.phpt | 250 + .../tests/array/array_walk_variation2.phpt | 268 + .../tests/array/array_walk_variation3.phpt | 123 + .../tests/array/array_walk_variation4.phpt | 87 + .../tests/array/array_walk_variation5.phpt | 64 + .../tests/array/array_walk_variation6.phpt | 143 + .../tests/array/array_walk_variation7.phpt | 93 + .../tests/array/array_walk_variation8.phpt | 42 + .../tests/array/array_walk_variation9.phpt | 99 + ext/standard/tests/array/arsort_basic.phpt | 245 + ext/standard/tests/array/arsort_error.phpt | 79 + ext/standard/tests/array/arsort_object1.phpt | 90 + ext/standard/tests/array/arsort_object2.phpt | 94 + ext/standard/tests/array/arsort_variation1.phpt | 399 + ext/standard/tests/array/arsort_variation10.phpt | 114 + ext/standard/tests/array/arsort_variation11.phpt | Bin 0 -> 3384 bytes ext/standard/tests/array/arsort_variation2.phpt | 308 + ext/standard/tests/array/arsort_variation3.phpt | 326 + ext/standard/tests/array/arsort_variation4.phpt | 79 + ext/standard/tests/array/arsort_variation5.phpt | 247 + ext/standard/tests/array/arsort_variation6.phpt | 114 + ext/standard/tests/array/arsort_variation7.phpt | 98 + ext/standard/tests/array/arsort_variation8.phpt | 180 + ext/standard/tests/array/arsort_variation9.phpt | 258 + ext/standard/tests/array/asort_basic.phpt | 245 + ext/standard/tests/array/asort_error.phpt | 79 + ext/standard/tests/array/asort_object1.phpt | 245 + ext/standard/tests/array/asort_object2.phpt | 253 + ext/standard/tests/array/asort_variation1.phpt | 399 + ext/standard/tests/array/asort_variation10.phpt | 114 + ext/standard/tests/array/asort_variation11.phpt | Bin 0 -> 3374 bytes ext/standard/tests/array/asort_variation2.phpt | 308 + ext/standard/tests/array/asort_variation3.phpt | 326 + ext/standard/tests/array/asort_variation4.phpt | 79 + ext/standard/tests/array/asort_variation5.phpt | 247 + ext/standard/tests/array/asort_variation6.phpt | 114 + ext/standard/tests/array/asort_variation7.phpt | 98 + ext/standard/tests/array/asort_variation8.phpt | 180 + ext/standard/tests/array/asort_variation9.phpt | 258 + ext/standard/tests/array/bug12776.phpt | 25 + ext/standard/tests/array/bug14580.phpt | 11 + ext/standard/tests/array/bug20381.phpt | 79 + ext/standard/tests/array/bug20865.phpt | 11 + ext/standard/tests/array/bug21182.phpt | 12 + ext/standard/tests/array/bug21918.phpt | 55 + ext/standard/tests/array/bug21998.phpt | 24 + ext/standard/tests/array/bug22088.phpt | 33 + ext/standard/tests/array/bug22463.phpt | 29 + ext/standard/tests/array/bug23581.phpt | 44 + ext/standard/tests/array/bug23788.phpt | 24 + ext/standard/tests/array/bug24198.phpt | 25 + ext/standard/tests/array/bug24220.phpt | 91 + ext/standard/tests/array/bug24766.phpt | 45 + ext/standard/tests/array/bug24897.phpt | 21 + ext/standard/tests/array/bug24980.phpt | 53 + ext/standard/tests/array/bug25359.phpt | 32 + ext/standard/tests/array/bug25708.phpt | 223 + ext/standard/tests/array/bug25758.phpt | 14 + ext/standard/tests/array/bug26458.phpt | Bin 0 -> 406 bytes ext/standard/tests/array/bug28739.phpt | 58 + ext/standard/tests/array/bug28974.phpt | 89 + ext/standard/tests/array/bug29253.phpt | 13 + ext/standard/tests/array/bug29493.phpt | 115 + ext/standard/tests/array/bug30074.phpt | 15 + ext/standard/tests/array/bug30266.phpt | 37 + ext/standard/tests/array/bug30833.phpt | 35 + ext/standard/tests/array/bug31158.phpt | 17 + ext/standard/tests/array/bug31213.phpt | 57 + ext/standard/tests/array/bug32021.phpt | 14 + ext/standard/tests/array/bug33382.phpt | 27 + ext/standard/tests/array/bug33989.phpt | 10 + ext/standard/tests/array/bug34066.phpt | 804 + ext/standard/tests/array/bug34066_1.phpt | 731 + ext/standard/tests/array/bug34227.phpt | 100 + ext/standard/tests/array/bug34982.phpt | 40 + ext/standard/tests/array/bug35014.phpt | 35 + ext/standard/tests/array/bug35014_64bit.phpt | 35 + ext/standard/tests/array/bug35022.phpt | 21 + ext/standard/tests/array/bug35821.phpt | 34 + ext/standard/tests/array/bug36975.phpt | 62 + ext/standard/tests/array/bug38464.phpt | 20 + ext/standard/tests/array/bug39576.phpt | 52 + ext/standard/tests/array/bug40191.phpt | 21 + ext/standard/tests/array/bug40709.phpt | 27 + ext/standard/tests/array/bug41121.phpt | 128 + ext/standard/tests/array/bug41686.phpt | 56 + ext/standard/tests/array/bug42177.phpt | 34 + ext/standard/tests/array/bug42233.phpt | 33 + ext/standard/tests/array/bug42838.phpt | 24 + ext/standard/tests/array/bug42850.phpt | 59 + ext/standard/tests/array/bug43495.phpt | 21 + ext/standard/tests/array/bug43505.phpt | 36 + ext/standard/tests/array/bug43541.phpt | 22 + ext/standard/tests/array/bug44181.phpt | 19 + ext/standard/tests/array/bug44182.phpt | 19 + ext/standard/tests/array/bug44929.phpt | 35 + ext/standard/tests/array/bug45312.phpt | 40 + ext/standard/tests/array/bug46873.phpt | 12 + ext/standard/tests/array/bug48224.phpt | 15 + ext/standard/tests/array/bug48484.phpt | 8 + ext/standard/tests/array/bug48854.phpt | 43 + ext/standard/tests/array/bug50006.phpt | 29 + ext/standard/tests/array/bug50006_1.phpt | 29 + ext/standard/tests/array/bug50006_2.phpt | 29 + ext/standard/tests/array/bug51552.phpt | 23 + ext/standard/tests/array/bug52534.phpt | 14 + ext/standard/tests/array/bug52719.phpt | 15 + ext/standard/tests/array/bug54459.phpt | 215 + ext/standard/tests/array/bug61058.phpt | 8 + ext/standard/tests/array/bug61730.phpt | 37 + ext/standard/tests/array/compact.phpt | 24 + ext/standard/tests/array/compact_basic.phpt | 85 + ext/standard/tests/array/compact_error.phpt | 31 + ext/standard/tests/array/compact_variation1.phpt | 54 + ext/standard/tests/array/compact_variation2.phpt | 40 + ext/standard/tests/array/compare_function.inc | 13 + ext/standard/tests/array/count_basic.phpt | 45 + ext/standard/tests/array/count_error.phpt | 41 + ext/standard/tests/array/count_recursive.phpt | 235 + ext/standard/tests/array/count_variation1.phpt | 170 + ext/standard/tests/array/count_variation2.phpt | 187 + ext/standard/tests/array/count_variation3.phpt | 39 + ext/standard/tests/array/current_basic.phpt | 32 + ext/standard/tests/array/current_error.phpt | 40 + ext/standard/tests/array/current_variation1.phpt | 217 + ext/standard/tests/array/current_variation2.phpt | 155 + ext/standard/tests/array/current_variation3.phpt | 42 + ext/standard/tests/array/current_variation4.phpt | 71 + ext/standard/tests/array/current_variation5.phpt | 58 + ext/standard/tests/array/data.inc | 13 + ext/standard/tests/array/each.phpt | Bin 0 -> 9570 bytes ext/standard/tests/array/each_basic.phpt | 74 + ext/standard/tests/array/each_error.phpt | 43 + ext/standard/tests/array/each_variation1.phpt | 222 + ext/standard/tests/array/each_variation2.phpt | 248 + ext/standard/tests/array/each_variation3.phpt | 253 + ext/standard/tests/array/each_variation4.phpt | 59 + ext/standard/tests/array/each_variation5.phpt | 96 + ext/standard/tests/array/each_variation6.phpt | 51 + ext/standard/tests/array/end.phpt | 237 + ext/standard/tests/array/end_64bit.phpt | 238 + ext/standard/tests/array/end_basic.phpt | 46 + ext/standard/tests/array/end_error.phpt | 39 + ext/standard/tests/array/end_variation1.phpt | 220 + ext/standard/tests/array/end_variation2.phpt | 43 + ext/standard/tests/array/end_variation3.phpt | 41 + ext/standard/tests/array/extract_error.phpt | 59 + ext/standard/tests/array/extract_safety.phpt | 24 + ext/standard/tests/array/extract_variation1.phpt | 27 + ext/standard/tests/array/extract_variation10.phpt | 13 + ext/standard/tests/array/extract_variation11.phpt | 13 + ext/standard/tests/array/extract_variation2.phpt | 69 + ext/standard/tests/array/extract_variation3.phpt | 69 + ext/standard/tests/array/extract_variation4.phpt | 69 + ext/standard/tests/array/extract_variation5.phpt | 57 + ext/standard/tests/array/extract_variation6.phpt | 28 + ext/standard/tests/array/extract_variation7.phpt | 23 + ext/standard/tests/array/extract_variation8.phpt | 26 + ext/standard/tests/array/extract_variation9.phpt | 20 + ext/standard/tests/array/in_array_errors.phpt | 45 + ext/standard/tests/array/in_array_variation1.phpt | 642 + ext/standard/tests/array/in_array_variation2.phpt | 102 + ext/standard/tests/array/in_array_variation3.phpt | 61 + ext/standard/tests/array/in_array_variation4.phpt | 77 + ext/standard/tests/array/key_basic.phpt | 47 + ext/standard/tests/array/key_error.phpt | 39 + ext/standard/tests/array/key_exists_basic.phpt | 15 + ext/standard/tests/array/key_exists_error.phpt | 23 + .../tests/array/key_exists_variation1.phpt | 15 + .../tests/array/key_exists_variation2.phpt | 72 + ext/standard/tests/array/key_variation1.phpt | 220 + ext/standard/tests/array/key_variation2.phpt | 155 + ext/standard/tests/array/key_variation3.phpt | 43 + ext/standard/tests/array/key_variation4.phpt | 63 + ext/standard/tests/array/krsort_basic.phpt | 245 + ext/standard/tests/array/krsort_error.phpt | 78 + ext/standard/tests/array/krsort_object.phpt | 242 + ext/standard/tests/array/krsort_variation1.phpt | 397 + ext/standard/tests/array/krsort_variation10.phpt | 98 + ext/standard/tests/array/krsort_variation11.phpt | 81 + ext/standard/tests/array/krsort_variation2.phpt | 307 + ext/standard/tests/array/krsort_variation3.phpt | 262 + ext/standard/tests/array/krsort_variation4.phpt | 114 + ext/standard/tests/array/krsort_variation5.phpt | 235 + ext/standard/tests/array/krsort_variation6.phpt | 114 + ext/standard/tests/array/krsort_variation7.phpt | 177 + ext/standard/tests/array/krsort_variation8.phpt | Bin 0 -> 3328 bytes ext/standard/tests/array/krsort_variation9.phpt | 257 + ext/standard/tests/array/ksort_basic.phpt | 243 + ext/standard/tests/array/ksort_error.phpt | 78 + ext/standard/tests/array/ksort_object.phpt | 241 + ext/standard/tests/array/ksort_variation1.phpt | 397 + ext/standard/tests/array/ksort_variation10.phpt | 113 + ext/standard/tests/array/ksort_variation11.phpt | 98 + ext/standard/tests/array/ksort_variation2.phpt | 307 + ext/standard/tests/array/ksort_variation3.phpt | 262 + ext/standard/tests/array/ksort_variation4.phpt | 81 + ext/standard/tests/array/ksort_variation5.phpt | 235 + ext/standard/tests/array/ksort_variation6.phpt | 114 + ext/standard/tests/array/ksort_variation7.phpt | 177 + ext/standard/tests/array/ksort_variation8.phpt | Bin 0 -> 3295 bytes ext/standard/tests/array/ksort_variation9.phpt | 256 + ext/standard/tests/array/locale_sort.phpt | 62 + ext/standard/tests/array/max.phpt | 41 + ext/standard/tests/array/max_basic.phpt | 42 + ext/standard/tests/array/max_basiclong_64bit.phpt | 35 + ext/standard/tests/array/max_error.phpt | 32 + ext/standard/tests/array/max_variation1.phpt | 37 + ext/standard/tests/array/max_variation2.phpt | 55 + ext/standard/tests/array/min.phpt | 41 + ext/standard/tests/array/min_basic.phpt | 37 + ext/standard/tests/array/min_basiclong_64bit.phpt | 35 + ext/standard/tests/array/min_error.phpt | 32 + ext/standard/tests/array/min_variation1.phpt | 37 + ext/standard/tests/array/min_variation2.phpt | 50 + ext/standard/tests/array/natcasesort_basic.phpt | 57 + ext/standard/tests/array/natcasesort_error.phpt | 40 + ext/standard/tests/array/natcasesort_object1.phpt | 99 + ext/standard/tests/array/natcasesort_object2.phpt | 99 + .../tests/array/natcasesort_variation1.phpt | 223 + .../tests/array/natcasesort_variation10.phpt | 52 + .../tests/array/natcasesort_variation11.phpt | 232 + .../tests/array/natcasesort_variation2.phpt | 227 + .../tests/array/natcasesort_variation3.phpt | 135 + .../tests/array/natcasesort_variation4.phpt | 91 + .../tests/array/natcasesort_variation5.phpt | 49 + .../tests/array/natcasesort_variation6.phpt | 56 + .../tests/array/natcasesort_variation7.phpt | 74 + .../tests/array/natcasesort_variation8.phpt | 46 + .../tests/array/natcasesort_variation9.phpt | 110 + ext/standard/tests/array/natsort_basic.phpt | 35 + ext/standard/tests/array/next_basic.phpt | 35 + ext/standard/tests/array/next_error.phpt | 39 + ext/standard/tests/array/next_variation1.phpt | 219 + ext/standard/tests/array/next_variation2.phpt | 45 + ext/standard/tests/array/prev_basic.phpt | 53 + ext/standard/tests/array/prev_error1.phpt | 39 + ext/standard/tests/array/prev_error2.phpt | 28 + ext/standard/tests/array/prev_error3.phpt | 19 + ext/standard/tests/array/prev_variation1.phpt | 219 + ext/standard/tests/array/prev_variation2.phpt | 49 + ext/standard/tests/array/range.phpt | 448 + ext/standard/tests/array/range_errors.phpt | 99 + ext/standard/tests/array/range_variation.phpt | 626 + ext/standard/tests/array/range_variation1.phpt | 60 + .../tests/array/range_variation1_64bit.phpt | 60 + ext/standard/tests/array/reset_basic.phpt | 45 + ext/standard/tests/array/reset_error.phpt | 39 + ext/standard/tests/array/reset_variation1.phpt | 219 + ext/standard/tests/array/reset_variation2.phpt | 34 + ext/standard/tests/array/reset_variation3.phpt | 56 + ext/standard/tests/array/rsort_basic.phpt | 241 + ext/standard/tests/array/rsort_error.phpt | 51 + ext/standard/tests/array/rsort_object1.phpt | 243 + ext/standard/tests/array/rsort_object2.phpt | 258 + ext/standard/tests/array/rsort_variation1.phpt | 514 + ext/standard/tests/array/rsort_variation10.phpt | 108 + ext/standard/tests/array/rsort_variation11.phpt | Bin 0 -> 2695 bytes ext/standard/tests/array/rsort_variation2.phpt | 484 + ext/standard/tests/array/rsort_variation3.phpt | 325 + ext/standard/tests/array/rsort_variation4.phpt | 62 + ext/standard/tests/array/rsort_variation5.phpt | 226 + ext/standard/tests/array/rsort_variation6.phpt | 120 + ext/standard/tests/array/rsort_variation7.phpt | 96 + ext/standard/tests/array/rsort_variation8.phpt | 180 + ext/standard/tests/array/rsort_variation9.phpt | 259 + ext/standard/tests/array/shuffle_basic1.phpt | 150 + ext/standard/tests/array/shuffle_basic2.phpt | 89 + ext/standard/tests/array/shuffle_error.phpt | 54 + ext/standard/tests/array/shuffle_variation1.phpt | 214 + ext/standard/tests/array/shuffle_variation2.phpt | 212 + ext/standard/tests/array/shuffle_variation3.phpt | 233 + ext/standard/tests/array/shuffle_variation4.phpt | 231 + ext/standard/tests/array/shuffle_variation5.phpt | 120 + ext/standard/tests/array/sizeof_basic1.phpt | 60 + ext/standard/tests/array/sizeof_basic2.phpt | 99 + ext/standard/tests/array/sizeof_error.phpt | 41 + ext/standard/tests/array/sizeof_object1.phpt | 55 + ext/standard/tests/array/sizeof_object2.phpt | 138 + ext/standard/tests/array/sizeof_variation1.phpt | 215 + ext/standard/tests/array/sizeof_variation2.phpt | 163 + ext/standard/tests/array/sizeof_variation3.phpt | 34 + ext/standard/tests/array/sizeof_variation4.phpt | 350 + ext/standard/tests/array/sizeof_variation5.phpt | 132 + ext/standard/tests/array/sort_basic.phpt | 246 + ext/standard/tests/array/sort_error.phpt | 79 + ext/standard/tests/array/sort_object1.phpt | 242 + ext/standard/tests/array/sort_object2.phpt | 256 + ext/standard/tests/array/sort_variation1.phpt | 398 + ext/standard/tests/array/sort_variation10.phpt | 112 + ext/standard/tests/array/sort_variation11.phpt | Bin 0 -> 3144 bytes ext/standard/tests/array/sort_variation2.phpt | 311 + ext/standard/tests/array/sort_variation3.phpt | 328 + ext/standard/tests/array/sort_variation4.phpt | 79 + ext/standard/tests/array/sort_variation5.phpt | 238 + ext/standard/tests/array/sort_variation6.phpt | 123 + ext/standard/tests/array/sort_variation7.phpt | 98 + ext/standard/tests/array/sort_variation8.phpt | 178 + ext/standard/tests/array/sort_variation9.phpt | 259 + ext/standard/tests/array/uasort_basic1.phpt | 116 + ext/standard/tests/array/uasort_basic2.phpt | 102 + ext/standard/tests/array/uasort_error.phpt | 81 + ext/standard/tests/array/uasort_object1.phpt | 150 + ext/standard/tests/array/uasort_object2.phpt | 187 + ext/standard/tests/array/uasort_variation1.phpt | 188 + ext/standard/tests/array/uasort_variation10.phpt | 74 + ext/standard/tests/array/uasort_variation11.phpt | 82 + ext/standard/tests/array/uasort_variation2.phpt | 212 + ext/standard/tests/array/uasort_variation3.phpt | Bin 0 -> 2584 bytes ext/standard/tests/array/uasort_variation4.phpt | 150 + ext/standard/tests/array/uasort_variation5.phpt | 145 + ext/standard/tests/array/uasort_variation6.phpt | 115 + ext/standard/tests/array/uasort_variation7.phpt | 60 + ext/standard/tests/array/uasort_variation8.phpt | 78 + ext/standard/tests/array/uasort_variation9.phpt | 81 + ext/standard/tests/array/uksort_basic.phpt | 26 + ext/standard/tests/array/uksort_error.phpt | 45 + ext/standard/tests/array/uksort_variation1.phpt | 224 + ext/standard/tests/array/uksort_variation2.phpt | 224 + .../tests/array/unexpected_array_mod_bug.phpt | 21 + ext/standard/tests/array/usort_basic.phpt | 119 + ext/standard/tests/array/usort_error1.phpt | 41 + ext/standard/tests/array/usort_error2.phpt | 56 + ext/standard/tests/array/usort_object1.phpt | 141 + ext/standard/tests/array/usort_object2.phpt | 165 + ext/standard/tests/array/usort_variation1.phpt | 236 + ext/standard/tests/array/usort_variation10.phpt | 79 + ext/standard/tests/array/usort_variation2.phpt | 242 + ext/standard/tests/array/usort_variation3.phpt | 115 + ext/standard/tests/array/usort_variation4.phpt | 155 + ext/standard/tests/array/usort_variation5.phpt | 143 + ext/standard/tests/array/usort_variation6.phpt | 139 + ext/standard/tests/array/usort_variation7.phpt | 61 + ext/standard/tests/array/usort_variation8.phpt | 85 + ext/standard/tests/array/usort_variation9.phpt | 66 + ext/standard/tests/array/var_export.phpt | 13 + ext/standard/tests/array/var_export2.phpt | 13 + ext/standard/tests/array/var_export3.phpt | 24 + ext/standard/tests/assert/assert.phpt | 44 + ext/standard/tests/assert/assert02.phpt | 48 + ext/standard/tests/assert/assert03.phpt | 39 + ext/standard/tests/assert/assert04.phpt | 48 + ext/standard/tests/assert/assert_basic.phpt | 30 + ext/standard/tests/assert/assert_basic1.phpt | 29 + ext/standard/tests/assert/assert_basic2.phpt | 37 + ext/standard/tests/assert/assert_basic3.phpt | 25 + ext/standard/tests/assert/assert_basic4.phpt | 37 + ext/standard/tests/assert/assert_basic5.phpt | 32 + ext/standard/tests/assert/assert_basic6.phpt | 26 + ext/standard/tests/assert/assert_closures.phpt | 16 + ext/standard/tests/assert/assert_error.phpt | 27 + ext/standard/tests/assert/assert_error1.phpt | 45 + ext/standard/tests/assert/assert_error2.phpt | 30 + ext/standard/tests/assert/assert_error3.phpt | 21 + ext/standard/tests/assert/assert_error4.phpt | 21 + ext/standard/tests/assert/assert_variation.phpt | 131 + ext/standard/tests/bug49244.phpt | 32 + ext/standard/tests/class_object/AutoInterface.inc | 5 + ext/standard/tests/class_object/AutoLoaded.inc | 5 + ext/standard/tests/class_object/AutoTest.inc | 13 + ext/standard/tests/class_object/AutoTrait.inc | 5 + .../tests/class_object/class_exists_basic_001.phpt | 55 + .../tests/class_object/class_exists_error_001.phpt | 42 + .../class_object/class_exists_variation_001.phpt | 187 + .../class_object/class_exists_variation_002.phpt | 198 + .../class_object/class_exists_variation_003.phpt | 18 + .../class_object/forward_static_call_001.phpt | 83 + .../class_object/forward_static_call_002.phpt | 21 + .../class_object/forward_static_call_003.phpt | 51 + .../tests/class_object/get_class_error_001.phpt | 28 + .../class_object/get_class_methods_basic_001.phpt | 63 + .../class_object/get_class_methods_basic_002.phpt | 178 + .../class_object/get_class_methods_basic_003.phpt | 76 + .../class_object/get_class_methods_error_001.phpt | 41 + .../get_class_methods_variation_001.phpt | 177 + .../get_class_methods_variation_002.phpt | 27 + .../class_object/get_class_variation_001.phpt | 212 + .../class_object/get_class_variation_002.phpt | 18 + .../tests/class_object/get_class_vars_error.phpt | 38 + .../class_object/get_class_vars_variation1.phpt | 181 + .../class_object/get_class_vars_variation2.phpt | 168 + .../get_declared_classes_basic_001.phpt | 47 + .../get_declared_classes_error_001.phpt | 27 + .../get_declared_classes_variation1.phpt | 37 + .../get_declared_interfaces_basic_001.phpt | 47 + .../get_declared_interfaces_error_001.phpt | 27 + .../get_declared_interfaces_variation1.phpt | 37 + .../get_declared_traits_basic_001.phpt | 56 + .../get_declared_traits_error_001.phpt | 27 + .../get_declared_traits_variation1.phpt | 41 + .../class_object/get_object_vars_basic_001.phpt | 107 + .../class_object/get_object_vars_basic_002.phpt | 64 + .../class_object/get_object_vars_error_001.phpt | 37 + .../get_object_vars_variation_001.phpt | 20 + .../get_object_vars_variation_002.phpt | 47 + .../get_object_vars_variation_003.phpt | 210 + .../class_object/get_parent_class_error_001.phpt | 29 + .../get_parent_class_variation_001.phpt | 27 + .../get_parent_class_variation_002.phpt | 179 + .../tests/class_object/interface_exists_error.phpt | 38 + .../class_object/interface_exists_variation1.phpt | 184 + .../class_object/interface_exists_variation2.phpt | 204 + .../class_object/interface_exists_variation3.phpt | 35 + .../class_object/interface_exists_variation4.phpt | 27 + ext/standard/tests/class_object/is_a.phpt | 378 + .../tests/class_object/is_a_error_001.phpt | 54 + .../tests/class_object/is_a_variation_001.phpt | 163 + .../tests/class_object/is_a_variation_002.phpt | 175 + .../tests/class_object/is_a_variation_003.phpt | 25 + .../class_object/is_subclass_of_error_001.phpt | 58 + .../class_object/is_subclass_of_variation_001.phpt | 176 + .../class_object/is_subclass_of_variation_002.phpt | 176 + .../class_object/is_subclass_of_variation_003.phpt | 26 + .../class_object/is_subclass_of_variation_004.phpt | 176 + .../class_object/method_exists_basic_001.phpt | 83 + .../class_object/method_exists_basic_002.phpt | 33 + .../class_object/method_exists_basic_003.phpt | 22 + .../class_object/method_exists_error_001.phpt | 40 + .../class_object/method_exists_variation_001.phpt | 175 + .../class_object/method_exists_variation_002.phpt | 176 + .../class_object/method_exists_variation_003.phpt | 26 + .../tests/class_object/property_exists_error.phpt | 47 + .../class_object/property_exists_variation1.phpt | 33 + .../trait_class_exists_variation_003.phpt | 18 + .../tests/class_object/trait_exists_basic_001.phpt | 57 + .../tests/class_object/trait_exists_error_001.phpt | 42 + .../class_object/trait_exists_variation_001.phpt | 187 + .../class_object/trait_exists_variation_002.phpt | 198 + ext/standard/tests/dir/chdir_basic.phpt | 53 + ext/standard/tests/dir/chdir_error1.phpt | 39 + ext/standard/tests/dir/chdir_error2.phpt | 26 + ext/standard/tests/dir/chdir_variation1.phpt | 235 + ext/standard/tests/dir/chdir_variation2.phpt | 104 + ext/standard/tests/dir/closedir_basic.phpt | 56 + ext/standard/tests/dir/closedir_error.phpt | 45 + ext/standard/tests/dir/closedir_variation1.phpt | 212 + ext/standard/tests/dir/closedir_variation2.phpt | 51 + ext/standard/tests/dir/closedir_variation3.phpt | 44 + ext/standard/tests/dir/dir_basic.phpt | 86 + ext/standard/tests/dir/dir_error.phpt | 34 + ext/standard/tests/dir/dir_variation1-win32.phpt | 170 + ext/standard/tests/dir/dir_variation1.phpt | 166 + ext/standard/tests/dir/dir_variation2.phpt | 223 + ext/standard/tests/dir/dir_variation3.phpt | 204 + ext/standard/tests/dir/dir_variation4.phpt | 72 + ext/standard/tests/dir/dir_variation5-win32.phpt | 37 + ext/standard/tests/dir/dir_variation5.phpt | 35 + ext/standard/tests/dir/dir_variation6-win32.phpt | 61 + ext/standard/tests/dir/dir_variation6.phpt | 57 + ext/standard/tests/dir/dir_variation7.phpt | 94 + ext/standard/tests/dir/dir_variation8-win32.phpt | 68 + ext/standard/tests/dir/dir_variation8.phpt | 60 + ext/standard/tests/dir/dir_variation9-win32.phpt | 125 + ext/standard/tests/dir/dir_variation9.phpt | 117 + ext/standard/tests/dir/getcwd_basic.phpt | 34 + ext/standard/tests/dir/getcwd_error.phpt | 29 + ext/standard/tests/dir/opendir_basic.phpt | 62 + ext/standard/tests/dir/opendir_error1.phpt | 47 + ext/standard/tests/dir/opendir_error2-win32.phpt | 47 + ext/standard/tests/dir/opendir_error2.phpt | 43 + .../tests/dir/opendir_variation1-win32.phpt | 248 + ext/standard/tests/dir/opendir_variation1.phpt | 224 + ext/standard/tests/dir/opendir_variation2.phpt | 239 + ext/standard/tests/dir/opendir_variation3.phpt | 50 + ext/standard/tests/dir/opendir_variation4.phpt | 107 + ext/standard/tests/dir/opendir_variation5.phpt | 103 + .../tests/dir/opendir_variation6-win32.phpt | 75 + ext/standard/tests/dir/opendir_variation6.phpt | 67 + ext/standard/tests/dir/opendir_variation7.phpt | 127 + ext/standard/tests/dir/readdir_basic.phpt | 73 + ext/standard/tests/dir/readdir_error.phpt | 43 + ext/standard/tests/dir/readdir_variation1.phpt | 210 + ext/standard/tests/dir/readdir_variation2.phpt | 48 + ext/standard/tests/dir/readdir_variation3.phpt | 68 + ext/standard/tests/dir/readdir_variation4.phpt | 178 + ext/standard/tests/dir/readdir_variation5.phpt | 144 + ext/standard/tests/dir/readdir_variation6.phpt | 80 + ext/standard/tests/dir/readdir_variation7.phpt | 28 + ext/standard/tests/dir/rewinddir_basic.phpt | 96 + ext/standard/tests/dir/rewinddir_error.phpt | 42 + ext/standard/tests/dir/rewinddir_variation1.phpt | 211 + ext/standard/tests/dir/rewinddir_variation2.phpt | 45 + ext/standard/tests/dir/rewinddir_variation3.phpt | 43 + ext/standard/tests/dir/scandir_basic.phpt | 70 + ext/standard/tests/dir/scandir_error1.phpt | 47 + ext/standard/tests/dir/scandir_error2-win32.phpt | 51 + ext/standard/tests/dir/scandir_error2.phpt | 47 + .../tests/dir/scandir_variation1-win32.phpt | 289 + ext/standard/tests/dir/scandir_variation1.phpt | 259 + ext/standard/tests/dir/scandir_variation10.phpt | 79 + ext/standard/tests/dir/scandir_variation2.phpt | 283 + ext/standard/tests/dir/scandir_variation3.phpt | 238 + ext/standard/tests/dir/scandir_variation4.phpt | 169 + ext/standard/tests/dir/scandir_variation5.phpt | 98 + .../tests/dir/scandir_variation6-win32.phpt | 84 + ext/standard/tests/dir/scandir_variation6.phpt | 76 + ext/standard/tests/dir/scandir_variation7.phpt | 169 + ext/standard/tests/dir/scandir_variation8.phpt | 154 + ext/standard/tests/dir/scandir_variation9.phpt | 72 + .../tests/directory/DirectoryClass_basic_001.phpt | 65 + .../tests/directory/DirectoryClass_error_001.phpt | 59 + .../tests/directory/directory_constants-win32.phpt | 26 + .../tests/directory/directory_constants.phpt | 26 + ext/standard/tests/file/001-win32.phpt | 100 + ext/standard/tests/file/001.phpt | 146 + ext/standard/tests/file/002.phpt | 52 + ext/standard/tests/file/003.phpt | 41 + ext/standard/tests/file/004.phpt | 61 + ext/standard/tests/file/005_basic.phpt | 54 + ext/standard/tests/file/005_error.phpt | 126 + ext/standard/tests/file/005_variation-win32.phpt | 221 + ext/standard/tests/file/005_variation.phpt | 260 + ext/standard/tests/file/005_variation2-win32.phpt | 119 + ext/standard/tests/file/005_variation2.phpt | 113 + ext/standard/tests/file/006_basic.phpt | 58 + ext/standard/tests/file/006_error.phpt | 107 + ext/standard/tests/file/006_variation1.phpt | 2627 +++ ext/standard/tests/file/006_variation2.phpt | 186 + ext/standard/tests/file/007_basic.phpt | 412 + ext/standard/tests/file/007_error.phpt | 185 + ext/standard/tests/file/007_variation1.phpt | 54 + ext/standard/tests/file/007_variation10.phpt | 58 + ext/standard/tests/file/007_variation11-win32.phpt | 76 + ext/standard/tests/file/007_variation11.phpt | 76 + ext/standard/tests/file/007_variation12-win32.phpt | 78 + ext/standard/tests/file/007_variation12.phpt | 78 + ext/standard/tests/file/007_variation13-win32.phpt | 65 + ext/standard/tests/file/007_variation13.phpt | 65 + ext/standard/tests/file/007_variation14.phpt | 62 + ext/standard/tests/file/007_variation15.phpt | 58 + ext/standard/tests/file/007_variation16.phpt | 60 + ext/standard/tests/file/007_variation17.phpt | 54 + ext/standard/tests/file/007_variation18.phpt | 58 + ext/standard/tests/file/007_variation19.phpt | 71 + ext/standard/tests/file/007_variation2.phpt | 58 + ext/standard/tests/file/007_variation20.phpt | 73 + ext/standard/tests/file/007_variation21.phpt | 60 + ext/standard/tests/file/007_variation22.phpt | 62 + ext/standard/tests/file/007_variation23.phpt | 58 + ext/standard/tests/file/007_variation24.phpt | 60 + ext/standard/tests/file/007_variation3.phpt | 71 + ext/standard/tests/file/007_variation4.phpt | 73 + ext/standard/tests/file/007_variation5.phpt | 60 + ext/standard/tests/file/007_variation6.phpt | 62 + ext/standard/tests/file/007_variation7.phpt | 58 + ext/standard/tests/file/007_variation8.phpt | 60 + ext/standard/tests/file/007_variation9.phpt | 54 + ext/standard/tests/file/basename-win32.phpt | 341 + ext/standard/tests/file/basename.phpt | Bin 0 -> 8229 bytes ext/standard/tests/file/basename_basic-win32.phpt | 101 + ext/standard/tests/file/basename_basic.phpt | 101 + ext/standard/tests/file/basename_error.phpt | 38 + .../tests/file/basename_variation1-win32.phpt | 238 + ext/standard/tests/file/basename_variation1.phpt | 238 + .../tests/file/basename_variation2-win32.phpt | 253 + ext/standard/tests/file/basename_variation2.phpt | 253 + ext/standard/tests/file/basename_variation3.phpt | 185 + ext/standard/tests/file/basename_variation4.phpt | 188 + ext/standard/tests/file/bug12556.phpt | 48 + ext/standard/tests/file/bug20424.phpt | 10 + ext/standard/tests/file/bug22382.phpt | 25 + ext/standard/tests/file/bug22414.phpt | 38 + ext/standard/tests/file/bug24313.phpt | 16 + ext/standard/tests/file/bug24482.phpt | 37 + ext/standard/tests/file/bug26003.phpt | Bin 0 -> 225 bytes ext/standard/tests/file/bug26615.phpt | 20 + ext/standard/tests/file/bug26938.phpt | 33 + ext/standard/tests/file/bug27508.phpt | 80 + ext/standard/tests/file/bug27619.phpt | 18 + ext/standard/tests/file/bug30362.phpt | 26 + ext/standard/tests/file/bug30362.txt | 1 + ext/standard/tests/file/bug32160.phpt | 14 + ext/standard/tests/file/bug32160.txt | 1 + ext/standard/tests/file/bug35740.phpt | 14 + ext/standard/tests/file/bug35781.phpt | 24 + ext/standard/tests/file/bug37158.phpt | 39 + ext/standard/tests/file/bug37864.phpt | 12 + ext/standard/tests/file/bug38086.phpt | 55 + ext/standard/tests/file/bug38086.txt | 5 + ext/standard/tests/file/bug38450.phpt | 114 + ext/standard/tests/file/bug38450_1.phpt | 114 + ext/standard/tests/file/bug38450_2.phpt | 114 + ext/standard/tests/file/bug38450_3.phpt | 105 + ext/standard/tests/file/bug39367.phpt | 33 + ext/standard/tests/file/bug39538.phpt | 39 + ext/standard/tests/file/bug39551.phpt | 24 + ext/standard/tests/file/bug39673.phpt | 40 + ext/standard/tests/file/bug39863.phpt | 23 + ext/standard/tests/file/bug40374.phpt | 17 + ext/standard/tests/file/bug40501.csv | 2 + ext/standard/tests/file/bug40501.phpt | 20 + ext/standard/tests/file/bug41655_1.phpt | 15 + ext/standard/tests/file/bug41655_2.phpt | 15 + ext/standard/tests/file/bug41693.phpt | 13 + ext/standard/tests/file/bug41815.phpt | 27 + ext/standard/tests/file/bug41874.phpt | 15 + ext/standard/tests/file/bug41874_1.phpt | 16 + ext/standard/tests/file/bug41874_2.phpt | 17 + ext/standard/tests/file/bug41874_3.phpt | 16 + ext/standard/tests/file/bug43008.phpt | 19 + ext/standard/tests/file/bug43137.phpt | 20 + ext/standard/tests/file/bug43216.phpt | 8 + ext/standard/tests/file/bug43248.phpt | 8 + ext/standard/tests/file/bug43353-win32.phpt | 25 + ext/standard/tests/file/bug43353.phpt | 25 + ext/standard/tests/file/bug43522.phpt | 25 + ext/standard/tests/file/bug44034.phpt | 41 + ext/standard/tests/file/bug44607.phpt | 24 + ext/standard/tests/file/bug44805.phpt | 30 + ext/standard/tests/file/bug45181.phpt | 16 + ext/standard/tests/file/bug45303.phpt | 13 + ext/standard/tests/file/bug45985.phpt | 14 + ext/standard/tests/file/bug46347.phpt | 24 + ext/standard/tests/file/bug47767.phpt | 50 + ext/standard/tests/file/bug49047.phpt | 17 + ext/standard/tests/file/bug51094.phpt | 22 + ext/standard/tests/file/bug52624.phpt | 12 + ext/standard/tests/file/bug52820.phpt | 71 + ext/standard/tests/file/bug53241.phpt | 23 + ext/standard/tests/file/bug53848.phpt | 25 + ext/standard/tests/file/bug55124.phpt | 18 + ext/standard/tests/file/bug60120.phpt | 74 + ext/standard/tests/file/bug61961.phpt | 14 + ext/standard/tests/file/bug63512.phpt | 33 + ext/standard/tests/file/chgrp.phpt | 15 + ext/standard/tests/file/chmod_basic-win32.phpt | 545 + ext/standard/tests/file/chmod_basic.phpt | 35 + ext/standard/tests/file/chmod_error.phpt | 47 + ext/standard/tests/file/chmod_variation1.phpt | 34 + .../tests/file/chmod_variation2-win32.phpt | 74 + ext/standard/tests/file/chmod_variation2.phpt | 92 + ext/standard/tests/file/chmod_variation3.phpt | 209 + ext/standard/tests/file/chmod_variation4.phpt | 201 + ext/standard/tests/file/chown.phpt | 15 + ext/standard/tests/file/chroot_001.phpt | 30 + ext/standard/tests/file/clearstatcache_001.phpt | 43 + ext/standard/tests/file/clearstatcache_error.phpt | 19 + ext/standard/tests/file/copy_basic.phpt | 58 + ext/standard/tests/file/copy_error.phpt | 39 + ext/standard/tests/file/copy_variation1.phpt | 145 + ext/standard/tests/file/copy_variation10.phpt | 37 + ext/standard/tests/file/copy_variation11.phpt | 71 + .../tests/file/copy_variation12-win32.phpt | 47 + ext/standard/tests/file/copy_variation12.phpt | 51 + ext/standard/tests/file/copy_variation13.phpt | 57 + ext/standard/tests/file/copy_variation14.phpt | 48 + ext/standard/tests/file/copy_variation15.phpt | 64 + .../tests/file/copy_variation16-win32.phpt | 144 + ext/standard/tests/file/copy_variation16.phpt | 143 + ext/standard/tests/file/copy_variation17.phpt | 76 + ext/standard/tests/file/copy_variation18.phpt | 56 + ext/standard/tests/file/copy_variation2-win32.phpt | 218 + ext/standard/tests/file/copy_variation2.phpt | 237 + ext/standard/tests/file/copy_variation3-win32.phpt | 109 + ext/standard/tests/file/copy_variation3.phpt | 110 + ext/standard/tests/file/copy_variation4.phpt | Bin 0 -> 4966 bytes ext/standard/tests/file/copy_variation5-win32.phpt | 111 + ext/standard/tests/file/copy_variation5.phpt | 106 + ext/standard/tests/file/copy_variation6-win32.phpt | 143 + ext/standard/tests/file/copy_variation6.phpt | 142 + ext/standard/tests/file/copy_variation7.phpt | 86 + ext/standard/tests/file/copy_variation8.phpt | 176 + ext/standard/tests/file/copy_variation9.phpt | 75 + .../tests/file/directory_wrapper_fstat_basic.phpt | 13 + ext/standard/tests/file/dirname_basic-win32.phpt | 93 + ext/standard/tests/file/dirname_basic.phpt | 94 + ext/standard/tests/file/dirname_error.phpt | 40 + ext/standard/tests/file/dirname_variation1.phpt | 190 + ext/standard/tests/file/disk.phpt | 48 + ext/standard/tests/file/disk_free_space_basic.phpt | 70 + .../tests/file/disk_free_space_error-win32.phpt | 75 + ext/standard/tests/file/disk_free_space_error.phpt | 67 + .../tests/file/disk_free_space_variation.phpt | 139 + .../tests/file/disk_total_space_basic.phpt | 48 + .../tests/file/disk_total_space_error-win32.phpt | 56 + .../tests/file/disk_total_space_error.phpt | 52 + .../tests/file/disk_total_space_variation.phpt | 123 + ext/standard/tests/file/fclose_variation1.phpt | 15 + ext/standard/tests/file/feof_basic.phpt | 101 + ext/standard/tests/file/fflush_basic.phpt | 58 + ext/standard/tests/file/fflush_error.phpt | 90 + .../tests/file/fflush_variation1-win32.phpt | 531 + ext/standard/tests/file/fflush_variation1.phpt | 532 + ext/standard/tests/file/fflush_variation2.phpt | 443 + ext/standard/tests/file/fflush_variation3.phpt | 383 + ext/standard/tests/file/fflush_variation4.phpt | 53 + ext/standard/tests/file/fgetc_basic.phpt | 543 + ext/standard/tests/file/fgetc_error.phpt | 73 + ext/standard/tests/file/fgetc_variation1.phpt | 94 + ext/standard/tests/file/fgetc_variation2.phpt | 52 + ext/standard/tests/file/fgetc_variation3.phpt | 117 + ext/standard/tests/file/fgetc_variation4.phpt | 290 + ext/standard/tests/file/fgetcsv.phpt | 158 + ext/standard/tests/file/fgetcsv_error.phpt | 96 + ext/standard/tests/file/fgetcsv_variation1.phpt | 1412 ++ ext/standard/tests/file/fgetcsv_variation10.phpt | 1295 ++ ext/standard/tests/file/fgetcsv_variation11.phpt | 1835 ++ ext/standard/tests/file/fgetcsv_variation12.phpt | 957 ++ ext/standard/tests/file/fgetcsv_variation13.phpt | 189 + ext/standard/tests/file/fgetcsv_variation14.phpt | 239 + ext/standard/tests/file/fgetcsv_variation15.phpt | 940 + ext/standard/tests/file/fgetcsv_variation16.phpt | 944 ++ ext/standard/tests/file/fgetcsv_variation17.phpt | 1565 ++ ext/standard/tests/file/fgetcsv_variation18.phpt | 690 + ext/standard/tests/file/fgetcsv_variation19.phpt | 841 + ext/standard/tests/file/fgetcsv_variation2.phpt | 1413 ++ ext/standard/tests/file/fgetcsv_variation20.phpt | 191 + ext/standard/tests/file/fgetcsv_variation21.phpt | 191 + ext/standard/tests/file/fgetcsv_variation22.phpt | 614 + ext/standard/tests/file/fgetcsv_variation23.phpt | 48 + ext/standard/tests/file/fgetcsv_variation24.phpt | 671 + ext/standard/tests/file/fgetcsv_variation25.phpt | 935 + ext/standard/tests/file/fgetcsv_variation26.phpt | 441 + ext/standard/tests/file/fgetcsv_variation27.phpt | 935 + ext/standard/tests/file/fgetcsv_variation28.phpt | 935 + ext/standard/tests/file/fgetcsv_variation29.phpt | 615 + ext/standard/tests/file/fgetcsv_variation3.phpt | 933 + ext/standard/tests/file/fgetcsv_variation30.phpt | 614 + ext/standard/tests/file/fgetcsv_variation31.phpt | 616 + ext/standard/tests/file/fgetcsv_variation4.phpt | 932 + ext/standard/tests/file/fgetcsv_variation5.phpt | 934 + ext/standard/tests/file/fgetcsv_variation6.phpt | 2350 +++ ext/standard/tests/file/fgetcsv_variation7.phpt | 1292 ++ ext/standard/tests/file/fgetcsv_variation8.phpt | 1058 ++ ext/standard/tests/file/fgetcsv_variation9.phpt | 1056 ++ ext/standard/tests/file/fgets_basic.phpt | 318 + ext/standard/tests/file/fgets_error.phpt | 108 + .../tests/file/fgets_socket_variation1.phpt | 56 + .../tests/file/fgets_socket_variation2.phpt | 63 + ext/standard/tests/file/fgets_variation1.phpt | 116 + ext/standard/tests/file/fgets_variation2.phpt | 63 + ext/standard/tests/file/fgets_variation3.phpt | 500 + .../tests/file/fgets_variation4-win32.phpt | 574 + ext/standard/tests/file/fgets_variation4.phpt | 574 + ext/standard/tests/file/fgets_variation5.phpt | 302 + .../tests/file/fgets_variation6-win32.phpt | 372 + ext/standard/tests/file/fgets_variation6.phpt | 372 + ext/standard/tests/file/fgetss.phpt | 83 + ext/standard/tests/file/fgetss1.phpt | 69 + ext/standard/tests/file/fgetss_basic1.phpt | 135 + ext/standard/tests/file/fgetss_basic2-win32.phpt | 216 + ext/standard/tests/file/fgetss_basic2.phpt | 214 + ext/standard/tests/file/fgetss_error.phpt | 106 + .../tests/file/fgetss_variation1-win32.phpt | 172 + ext/standard/tests/file/fgetss_variation1.phpt | 168 + ext/standard/tests/file/fgetss_variation2.phpt | 434 + .../tests/file/fgetss_variation3-win32.phpt | 571 + ext/standard/tests/file/fgetss_variation3.phpt | 567 + ext/standard/tests/file/fgetss_variation4.phpt | 168 + .../tests/file/fgetss_variation5-win32.phpt | 220 + ext/standard/tests/file/fgetss_variation5.phpt | 217 + ext/standard/tests/file/file.inc | 650 + ext/standard/tests/file/file_basic.phpt | 77 + ext/standard/tests/file/file_error.phpt | 48 + ext/standard/tests/file/file_exists_error.phpt | 40 + .../tests/file/file_exists_variation1.phpt | 30 + .../tests/file/file_get_contents_basic.phpt | 41 + .../tests/file/file_get_contents_basic001.phpt | 21 + .../tests/file/file_get_contents_error.phpt | 67 + .../tests/file/file_get_contents_error001.phpt | 19 + .../tests/file/file_get_contents_error002.phpt | 18 + .../file_get_contents_file_put_contents_basic.phpt | 50 + .../file_get_contents_file_put_contents_error.phpt | 71 + ..._get_contents_file_put_contents_variation1.phpt | 116 + ..._get_contents_file_put_contents_variation2.phpt | 57 + .../tests/file/file_get_contents_variation1.phpt | 51 + .../tests/file/file_get_contents_variation2.phpt | 52 + .../tests/file/file_get_contents_variation3.phpt | 218 + .../tests/file/file_get_contents_variation4.phpt | 251 + .../tests/file/file_get_contents_variation5.phpt | 222 + .../tests/file/file_get_contents_variation6.phpt | 215 + .../file/file_get_contents_variation7-win32.phpt | 115 + .../tests/file/file_get_contents_variation7.phpt | 104 + .../file/file_get_contents_variation8-win32.phpt | 98 + .../tests/file/file_get_contents_variation8.phpt | 88 + .../tests/file/file_get_contents_variation9.phpt | 56 + ext/standard/tests/file/file_put_contents.phpt | 32 + .../tests/file/file_put_contents_variation1.phpt | 43 + .../tests/file/file_put_contents_variation2.phpt | 167 + .../tests/file/file_put_contents_variation3.phpt | 250 + .../tests/file/file_put_contents_variation4.phpt | 51 + .../tests/file/file_put_contents_variation5.phpt | 51 + .../tests/file/file_put_contents_variation6.phpt | 56 + .../file/file_put_contents_variation7-win32.phpt | 130 + .../tests/file/file_put_contents_variation7.phpt | 119 + .../file/file_put_contents_variation8-win32.phpt | 98 + .../tests/file/file_put_contents_variation8.phpt | Bin 0 -> 2388 bytes .../tests/file/file_put_contents_variation9.phpt | 70 + ext/standard/tests/file/file_variation.phpt | 160 + ext/standard/tests/file/file_variation2.phpt | 210 + ext/standard/tests/file/file_variation3.phpt | 294 + ext/standard/tests/file/file_variation4.phpt | 291 + ext/standard/tests/file/file_variation5-win32.phpt | 74 + ext/standard/tests/file/file_variation5.phpt | 94 + ext/standard/tests/file/file_variation6.phpt | 261 + ext/standard/tests/file/file_variation7.phpt | 87 + ext/standard/tests/file/file_variation8-win32.phpt | 142 + ext/standard/tests/file/file_variation8.phpt | 128 + ext/standard/tests/file/file_variation9.phpt | 89 + ext/standard/tests/file/filegroup_basic.phpt | 69 + ext/standard/tests/file/filegroup_error.phpt | 44 + ext/standard/tests/file/filegroup_variation1.phpt | 47 + ext/standard/tests/file/filegroup_variation2.phpt | 71 + ext/standard/tests/file/filegroup_variation3.phpt | 85 + ext/standard/tests/file/fileinode_basic.phpt | 36 + ext/standard/tests/file/fileinode_error.phpt | 44 + ext/standard/tests/file/fileinode_variation.phpt | 112 + ext/standard/tests/file/fileinode_variation1.phpt | 48 + ext/standard/tests/file/fileinode_variation2.phpt | 72 + ext/standard/tests/file/fileinode_variation3.phpt | 86 + ext/standard/tests/file/fileowner_basic.phpt | 51 + ext/standard/tests/file/fileowner_error.phpt | 44 + ext/standard/tests/file/fileowner_variation1.phpt | 48 + ext/standard/tests/file/fileowner_variation2.phpt | 72 + ext/standard/tests/file/fileowner_variation3.phpt | 86 + ext/standard/tests/file/fileperms_variation1.phpt | 47 + ext/standard/tests/file/fileperms_variation2.phpt | 71 + ext/standard/tests/file/fileperms_variation3.phpt | 85 + ext/standard/tests/file/filesize_basic.phpt | 39 + ext/standard/tests/file/filesize_error.phpt | 41 + .../tests/file/filesize_variation1-win32.phpt | 45 + ext/standard/tests/file/filesize_variation1.phpt | 45 + .../tests/file/filesize_variation2-win32.phpt | 83 + ext/standard/tests/file/filesize_variation2.phpt | 83 + .../tests/file/filesize_variation3-win32.phpt | 70 + ext/standard/tests/file/filesize_variation3.phpt | 70 + .../tests/file/filesize_variation4-win32.phpt | 109 + ext/standard/tests/file/filesize_variation4.phpt | 111 + ext/standard/tests/file/filesize_variation5.phpt | 34 + ext/standard/tests/file/filestat.phpt | 63 + ext/standard/tests/file/filetype_basic.phpt | 22 + ext/standard/tests/file/filetype_error.phpt | 39 + ext/standard/tests/file/filetype_variation.phpt | 78 + ext/standard/tests/file/filetype_variation2.phpt | 29 + ext/standard/tests/file/filetype_variation3.phpt | 29 + ext/standard/tests/file/flock.phpt | 64 + ext/standard/tests/file/flock_basic.phpt | 44 + ext/standard/tests/file/flock_error.phpt | 112 + ext/standard/tests/file/flock_variation.phpt | 371 + ext/standard/tests/file/fnmatch_basic.phpt | 49 + ext/standard/tests/file/fnmatch_error.phpt | 57 + ext/standard/tests/file/fnmatch_variation.phpt | 505 + ext/standard/tests/file/fopen_include_path.inc | 92 + ext/standard/tests/file/fopen_variation1.phpt | 14 + .../tests/file/fopen_variation10-win32.phpt | 149 + .../tests/file/fopen_variation11-win32.phpt | 147 + ext/standard/tests/file/fopen_variation12.phpt | 52 + ext/standard/tests/file/fopen_variation13.phpt | 56 + .../tests/file/fopen_variation14-win32.phpt | 189 + ext/standard/tests/file/fopen_variation14.phpt | 134 + .../tests/file/fopen_variation15-win32.phpt | 193 + ext/standard/tests/file/fopen_variation15.phpt | 138 + ext/standard/tests/file/fopen_variation16.phpt | 75 + ext/standard/tests/file/fopen_variation17.phpt | 74 + ext/standard/tests/file/fopen_variation19.phpt | 110 + ext/standard/tests/file/fopen_variation3.phpt | 218 + ext/standard/tests/file/fopen_variation4.phpt | 251 + ext/standard/tests/file/fopen_variation5.phpt | 151 + ext/standard/tests/file/fopen_variation6.phpt | 44 + ext/standard/tests/file/fopen_variation7.phpt | 66 + ext/standard/tests/file/fopen_variation8.phpt | 150 + ext/standard/tests/file/fopen_variation9.phpt | 66 + ext/standard/tests/file/fopencookie.phpt | 88 + ext/standard/tests/file/fpassthru_basic.phpt | 128 + ext/standard/tests/file/fpassthru_error.phpt | 40 + ext/standard/tests/file/fpassthru_variation.phpt | 114 + ext/standard/tests/file/fpassthru_variation1.phpt | 224 + ext/standard/tests/file/fputcsv.phpt | 105 + ext/standard/tests/file/fputcsv_002.phpt | 43 + ext/standard/tests/file/fputcsv_error.phpt | 97 + ext/standard/tests/file/fputcsv_variation1.phpt | 834 + ext/standard/tests/file/fputcsv_variation10.phpt | 336 + ext/standard/tests/file/fputcsv_variation11.phpt | 834 + ext/standard/tests/file/fputcsv_variation12.phpt | 835 + ext/standard/tests/file/fputcsv_variation13.phpt | 1051 ++ ext/standard/tests/file/fputcsv_variation14.phpt | 357 + ext/standard/tests/file/fputcsv_variation2.phpt | 942 ++ ext/standard/tests/file/fputcsv_variation3.phpt | 942 ++ ext/standard/tests/file/fputcsv_variation4.phpt | 942 ++ ext/standard/tests/file/fputcsv_variation5.phpt | 834 + ext/standard/tests/file/fputcsv_variation6.phpt | 837 + ext/standard/tests/file/fputcsv_variation7.phpt | 837 + ext/standard/tests/file/fputcsv_variation8.phpt | 837 + ext/standard/tests/file/fputcsv_variation9.phpt | 1268 ++ ext/standard/tests/file/fread_basic.phpt | 640 + ext/standard/tests/file/fread_error.phpt | 114 + ext/standard/tests/file/fread_fwrite_basic.phpt | 72 + .../tests/file/fread_socket_variation1.phpt | 16 + ext/standard/tests/file/fread_variation1.phpt | 657 + ext/standard/tests/file/fread_variation2.phpt | 656 + .../tests/file/fread_variation3-win32.phpt | 498 + ext/standard/tests/file/fread_variation3.phpt | 498 + .../tests/file/fread_variation4-win32.phpt | 469 + ext/standard/tests/file/fread_variation4.phpt | 469 + ext/standard/tests/file/fscanf.phpt | 100 + ext/standard/tests/file/fscanf_error.phpt | 99 + ext/standard/tests/file/fscanf_variation1.phpt | 50 + ext/standard/tests/file/fscanf_variation10.phpt | 222 + ext/standard/tests/file/fscanf_variation11.phpt | 713 + ext/standard/tests/file/fscanf_variation12.phpt | 946 ++ ext/standard/tests/file/fscanf_variation13.phpt | 246 + ext/standard/tests/file/fscanf_variation14.phpt | 1079 ++ ext/standard/tests/file/fscanf_variation15.phpt | 863 + ext/standard/tests/file/fscanf_variation16.phpt | 221 + ext/standard/tests/file/fscanf_variation17.phpt | 712 + ext/standard/tests/file/fscanf_variation18.phpt | 1014 ++ ext/standard/tests/file/fscanf_variation19.phpt | 250 + ext/standard/tests/file/fscanf_variation2.phpt | 1008 ++ ext/standard/tests/file/fscanf_variation20.phpt | 1012 ++ ext/standard/tests/file/fscanf_variation21.phpt | 863 + ext/standard/tests/file/fscanf_variation22.phpt | 221 + ext/standard/tests/file/fscanf_variation23.phpt | 712 + ext/standard/tests/file/fscanf_variation24.phpt | 994 ++ ext/standard/tests/file/fscanf_variation25.phpt | 294 + ext/standard/tests/file/fscanf_variation26.phpt | 356 + ext/standard/tests/file/fscanf_variation27.phpt | 1013 ++ ext/standard/tests/file/fscanf_variation28.phpt | 863 + ext/standard/tests/file/fscanf_variation29.phpt | 222 + ext/standard/tests/file/fscanf_variation3.phpt | 865 + ext/standard/tests/file/fscanf_variation30.phpt | 713 + ext/standard/tests/file/fscanf_variation31.phpt | 946 ++ ext/standard/tests/file/fscanf_variation32.phpt | 251 + ext/standard/tests/file/fscanf_variation33.phpt | 1019 ++ ext/standard/tests/file/fscanf_variation34.phpt | 869 + ext/standard/tests/file/fscanf_variation35.phpt | 217 + ext/standard/tests/file/fscanf_variation36.phpt | 708 + ext/standard/tests/file/fscanf_variation37.phpt | 946 ++ ext/standard/tests/file/fscanf_variation38.phpt | 246 + ext/standard/tests/file/fscanf_variation39.phpt | 1014 ++ ext/standard/tests/file/fscanf_variation4.phpt | 218 + ext/standard/tests/file/fscanf_variation40.phpt | 865 + ext/standard/tests/file/fscanf_variation41.phpt | 217 + ext/standard/tests/file/fscanf_variation42.phpt | 708 + ext/standard/tests/file/fscanf_variation43.phpt | 946 ++ ext/standard/tests/file/fscanf_variation44.phpt | 246 + ext/standard/tests/file/fscanf_variation45.phpt | 1008 ++ ext/standard/tests/file/fscanf_variation46.phpt | 859 + ext/standard/tests/file/fscanf_variation47.phpt | 217 + ext/standard/tests/file/fscanf_variation48.phpt | 707 + ext/standard/tests/file/fscanf_variation49.phpt | 946 ++ ext/standard/tests/file/fscanf_variation5.phpt | 708 + ext/standard/tests/file/fscanf_variation50.phpt | 246 + ext/standard/tests/file/fscanf_variation51.phpt | 153 + ext/standard/tests/file/fscanf_variation52.phpt | 178 + ext/standard/tests/file/fscanf_variation53.phpt | 229 + ext/standard/tests/file/fscanf_variation54.phpt | 101 + ext/standard/tests/file/fscanf_variation55.phpt | 1691 ++ ext/standard/tests/file/fscanf_variation6.phpt | 946 ++ ext/standard/tests/file/fscanf_variation7.phpt | 246 + ext/standard/tests/file/fscanf_variation8.phpt | 1614 ++ ext/standard/tests/file/fscanf_variation9.phpt | 1015 ++ ext/standard/tests/file/fseek_dir_basic.phpt | 96 + .../tests/file/fseek_ftell_rewind_basic1.phpt | 453 + .../file/fseek_ftell_rewind_basic2-win32.phpt | 464 + .../tests/file/fseek_ftell_rewind_basic2.phpt | 463 + .../tests/file/fseek_ftell_rewind_error1.phpt | 99 + .../tests/file/fseek_ftell_rewind_error2.phpt | 95 + .../tests/file/fseek_ftell_rewind_error3.phpt | 95 + .../tests/file/fseek_ftell_rewind_variation1.phpt | 428 + .../file/fseek_ftell_rewind_variation2-win32.phpt | 437 + .../tests/file/fseek_ftell_rewind_variation2.phpt | 437 + .../tests/file/fseek_ftell_rewind_variation3.phpt | 478 + .../file/fseek_ftell_rewind_variation4-win32.phpt | 483 + .../tests/file/fseek_ftell_rewind_variation4.phpt | 483 + .../tests/file/fseek_ftell_rewind_variation5.phpt | 474 + .../file/fseek_ftell_rewind_variation6-win32.phpt | 483 + .../tests/file/fseek_ftell_rewind_variation6.phpt | 483 + .../tests/file/fseek_ftell_rewind_variation7.phpt | 477 + .../file/fseek_ftell_rewind_variation8-win32.phpt | 484 + .../tests/file/fseek_ftell_rewind_variation8.phpt | 484 + ext/standard/tests/file/fseek_variation1.phpt | 198 + ext/standard/tests/file/fseek_variation2.phpt | 159 + ext/standard/tests/file/fseek_variation3.phpt | 54 + ext/standard/tests/file/fstat.phpt | 74 + ext/standard/tests/file/fstat_basic.phpt | 65 + ext/standard/tests/file/fstat_error.phpt | 22 + ext/standard/tests/file/fstat_variation1.phpt | 34 + ext/standard/tests/file/fstat_variation2.phpt | 31 + ext/standard/tests/file/fstat_variation3.phpt | 42 + ext/standard/tests/file/fstat_variation4.phpt | 35 + ext/standard/tests/file/fstat_variation5.phpt | 31 + ext/standard/tests/file/fstat_variation6.phpt | 46 + ext/standard/tests/file/fstat_variation7.phpt | 35 + ext/standard/tests/file/fstat_variation8.phpt | 33 + ext/standard/tests/file/ftruncate.phpt | Bin 0 -> 1077 bytes ext/standard/tests/file/ftruncate_error.phpt | 124 + .../tests/file/ftruncate_variation1-win32.phpt | 461 + ext/standard/tests/file/ftruncate_variation1.phpt | 461 + .../tests/file/ftruncate_variation2-win32.phpt | 462 + ext/standard/tests/file/ftruncate_variation2.phpt | 462 + .../tests/file/ftruncate_variation3-win32.phpt | 461 + ext/standard/tests/file/ftruncate_variation3.phpt | 461 + .../tests/file/ftruncate_variation4-win32.phpt | 462 + ext/standard/tests/file/ftruncate_variation4.phpt | 462 + .../tests/file/ftruncate_variation5-win32.phpt | 463 + ext/standard/tests/file/ftruncate_variation5.phpt | 463 + .../tests/file/ftruncate_variation6-win32.phpt | 482 + ext/standard/tests/file/ftruncate_variation6.phpt | 482 + .../tests/file/ftruncate_variation7-win32.phpt | 463 + ext/standard/tests/file/ftruncate_variation7.phpt | 463 + ext/standard/tests/file/fwrite.phpt | 52 + ext/standard/tests/file/fwrite_basic-win32.phpt | 424 + ext/standard/tests/file/fwrite_basic.phpt | 424 + ext/standard/tests/file/fwrite_error.phpt | 121 + .../tests/file/fwrite_variation1-win32.phpt | 235 + ext/standard/tests/file/fwrite_variation1.phpt | 233 + .../tests/file/fwrite_variation2-win32.phpt | 304 + ext/standard/tests/file/fwrite_variation2.phpt | 303 + .../tests/file/fwrite_variation3-win32.phpt | 380 + ext/standard/tests/file/fwrite_variation3.phpt | 381 + .../tests/file/fwrite_variation4-win32.phpt | 275 + ext/standard/tests/file/fwrite_variation4.phpt | 275 + ext/standard/tests/file/fwrite_variation5.phpt | 173 + ext/standard/tests/file/get_current_user.phpt | 15 + ext/standard/tests/file/glob_basic.phpt | 82 + ext/standard/tests/file/glob_error.phpt | 53 + ext/standard/tests/file/glob_error_002-win32.phpt | 27 + ext/standard/tests/file/glob_variation-win32.phpt | 465 + ext/standard/tests/file/glob_variation.phpt | 465 + ext/standard/tests/file/glob_variation2.phpt | 57 + ext/standard/tests/file/include_streams.phpt | 130 + .../tests/file/include_userstream_001.phpt | 82 + .../tests/file/include_userstream_002.phpt | 106 + .../tests/file/include_userstream_003.phpt | 121 + ext/standard/tests/file/is_dir_basic.phpt | 43 + ext/standard/tests/file/is_dir_error.phpt | 35 + ext/standard/tests/file/is_dir_variation1.phpt | 42 + ext/standard/tests/file/is_dir_variation2.phpt | 96 + ext/standard/tests/file/is_dir_variation3.phpt | 51 + ext/standard/tests/file/is_dir_variation4.phpt | 89 + .../tests/file/is_executable_basic-win32.phpt | 1064 ++ ext/standard/tests/file/is_executable_basic.phpt | 1076 ++ ext/standard/tests/file/is_executable_error.phpt | 29 + .../tests/file/is_executable_variation1.phpt | 92 + .../tests/file/is_executable_variation2.phpt | 110 + .../tests/file/is_executable_variation3.phpt | 69 + ext/standard/tests/file/is_file_basic.phpt | 48 + ext/standard/tests/file/is_file_error.phpt | 51 + ext/standard/tests/file/is_file_variation1.phpt | 57 + ext/standard/tests/file/is_file_variation2.phpt | 46 + ext/standard/tests/file/is_file_variation3.phpt | 60 + ext/standard/tests/file/is_file_variation4.phpt | 78 + .../tests/file/is_readable_basic-win32.phpt | 1066 ++ ext/standard/tests/file/is_readable_basic.phpt | 1076 ++ ext/standard/tests/file/is_readable_error.phpt | 29 + .../tests/file/is_readable_variation1.phpt | 105 + .../tests/file/is_readable_variation2.phpt | 109 + .../tests/file/is_readable_variation3.phpt | 68 + .../tests/file/is_uploaded_file_basic.phpt | 48 + ext/standard/tests/file/is_writable_basic.phpt | 1588 ++ ext/standard/tests/file/is_writable_error.phpt | 45 + .../tests/file/is_writable_variation1.phpt | 125 + .../tests/file/is_writable_variation2.phpt | 126 + .../tests/file/is_writable_variation3.phpt | 78 + ext/standard/tests/file/lchgrp_basic.phpt | 36 + ext/standard/tests/file/lchown_basic.phpt | 44 + ext/standard/tests/file/lchown_error.phpt | 78 + ext/standard/tests/file/link_win32.phpt | 26 + ext/standard/tests/file/lstat_stat_basic.phpt | 317 + ext/standard/tests/file/lstat_stat_error.phpt | 79 + ext/standard/tests/file/lstat_stat_variation1.phpt | 61 + .../tests/file/lstat_stat_variation10.phpt | 59 + .../tests/file/lstat_stat_variation11.phpt | 60 + .../tests/file/lstat_stat_variation12.phpt | 66 + .../tests/file/lstat_stat_variation13.phpt | 58 + .../tests/file/lstat_stat_variation14.phpt | 62 + .../tests/file/lstat_stat_variation15.phpt | 64 + .../tests/file/lstat_stat_variation16.phpt | 58 + .../tests/file/lstat_stat_variation17.phpt | 57 + .../tests/file/lstat_stat_variation18.phpt | 176 + .../tests/file/lstat_stat_variation19.phpt | 285 + ext/standard/tests/file/lstat_stat_variation2.phpt | 62 + .../tests/file/lstat_stat_variation20.phpt | 287 + .../tests/file/lstat_stat_variation21.phpt | 65 + .../tests/file/lstat_stat_variation22.phpt | 54 + ext/standard/tests/file/lstat_stat_variation3.phpt | 62 + ext/standard/tests/file/lstat_stat_variation4.phpt | 65 + ext/standard/tests/file/lstat_stat_variation5.phpt | 66 + ext/standard/tests/file/lstat_stat_variation6.phpt | 79 + ext/standard/tests/file/lstat_stat_variation7.phpt | 57 + ext/standard/tests/file/lstat_stat_variation8.phpt | 62 + ext/standard/tests/file/lstat_stat_variation9.phpt | 68 + ext/standard/tests/file/mkdir-001.phpt | 36 + ext/standard/tests/file/mkdir-002.phpt | 55 + ext/standard/tests/file/mkdir-003.phpt | 30 + ext/standard/tests/file/mkdir-004.phpt | 24 + ext/standard/tests/file/mkdir-005.phpt | 25 + ext/standard/tests/file/mkdir-006.phpt | 20 + ext/standard/tests/file/mkdir_rmdir_error.phpt | 58 + .../tests/file/mkdir_rmdir_variation-win32.phpt | 1613 ++ .../tests/file/mkdir_rmdir_variation1.phpt | 1579 ++ .../tests/file/mkdir_rmdir_variation2.phpt | 80 + .../tests/file/mkdir_variation1-win32.phpt | 122 + ext/standard/tests/file/mkdir_variation1.phpt | 121 + ext/standard/tests/file/mkdir_variation2.phpt | 189 + ext/standard/tests/file/mkdir_variation3.phpt | 208 + ext/standard/tests/file/mkdir_variation4.phpt | 220 + .../tests/file/mkdir_variation5-win32.phpt | 105 + ext/standard/tests/file/mkdir_variation5.phpt | 98 + .../tests/file/move_uploaded_file_basic.phpt | 76 + ext/standard/tests/file/parse_ini_file.phpt | 489 + ext/standard/tests/file/parse_ini_file_error.phpt | 47 + .../tests/file/parse_ini_file_variation1.phpt | 68 + .../tests/file/parse_ini_file_variation2.phpt | 111 + .../tests/file/parse_ini_file_variation3.phpt | 104 + .../tests/file/parse_ini_file_variation4.phpt | 211 + .../tests/file/parse_ini_file_variation5.phpt | 254 + .../file/parse_ini_file_variation6-win32.phpt | 143 + .../tests/file/parse_ini_file_variation6.phpt | 129 + ext/standard/tests/file/pathinfo_basic.phpt | 401 + ext/standard/tests/file/pathinfo_basic1-win32.phpt | 609 + ext/standard/tests/file/pathinfo_basic1.phpt | 610 + ext/standard/tests/file/pathinfo_basic2-win32.phpt | 270 + ext/standard/tests/file/pathinfo_basic2.phpt | 273 + ext/standard/tests/file/pathinfo_error.phpt | 24 + ext/standard/tests/file/pathinfo_variation1.phpt | 190 + ext/standard/tests/file/pathinfo_variation2.phpt | 197 + ext/standard/tests/file/pathinfo_variation3.phpt | 80 + ext/standard/tests/file/pathinfo_variaton.phpt | 442 + ext/standard/tests/file/pclose_variation1.phpt | 232 + ext/standard/tests/file/php_fd_wrapper_01.phpt | 11 + ext/standard/tests/file/php_fd_wrapper_02.phpt | 11 + ext/standard/tests/file/php_fd_wrapper_03.phpt | 22 + ext/standard/tests/file/php_fd_wrapper_04.phpt | 20 + .../tests/file/popen_pclose_basic-win32.phpt | 75 + ext/standard/tests/file/popen_pclose_basic.phpt | 103 + .../tests/file/popen_pclose_error-sunos.phpt | 55 + .../tests/file/popen_pclose_error-win32-debug.phpt | 63 + .../tests/file/popen_pclose_error-win32.phpt | 59 + ext/standard/tests/file/popen_pclose_error.phpt | 56 + ext/standard/tests/file/proc_open01.phpt | 69 + ext/standard/tests/file/readfile_basic-win32.phpt | 530 + ext/standard/tests/file/readfile_basic.phpt | 530 + ext/standard/tests/file/readfile_error.phpt | 61 + ext/standard/tests/file/readfile_variation1.phpt | 46 + .../tests/file/readfile_variation10-win32.phpt | 87 + ext/standard/tests/file/readfile_variation10.phpt | Bin 0 -> 1869 bytes ext/standard/tests/file/readfile_variation2.phpt | 87 + ext/standard/tests/file/readfile_variation3.phpt | 63 + ext/standard/tests/file/readfile_variation4.phpt | 251 + ext/standard/tests/file/readfile_variation5.phpt | 221 + ext/standard/tests/file/readfile_variation6.phpt | 50 + ext/standard/tests/file/readfile_variation7.phpt | 50 + .../tests/file/readfile_variation8-win32.phpt | 109 + ext/standard/tests/file/readfile_variation9.phpt | 99 + .../tests/file/readlink_realpath_basic1.phpt | 111 + .../tests/file/readlink_realpath_basic2.phpt | 86 + .../tests/file/readlink_realpath_error.phpt | 73 + .../tests/file/readlink_realpath_variation1.phpt | 99 + .../tests/file/readlink_realpath_variation2.phpt | 104 + .../tests/file/readlink_realpath_variation3.phpt | 77 + ext/standard/tests/file/readlink_variation1.phpt | 78 + ext/standard/tests/file/realpath_basic-win32.phpt | 89 + ext/standard/tests/file/realpath_basic2.phpt | 13 + ext/standard/tests/file/realpath_basic3.phpt | 86 + ext/standard/tests/file/realpath_basic4.phpt | 29 + ext/standard/tests/file/realpath_cache.phpt | 30 + ext/standard/tests/file/realpath_cache_win32.phpt | 38 + ext/standard/tests/file/realpath_error-win32.phpt | 29 + .../tests/file/realpath_variation-win32.phpt | 102 + ext/standard/tests/file/realpath_variation2.phpt | 74 + ext/standard/tests/file/rename_basic.phpt | 45 + ext/standard/tests/file/rename_error.phpt | 35 + .../tests/file/rename_variation-win32.phpt | 87 + ext/standard/tests/file/rename_variation.phpt | 72 + .../tests/file/rename_variation1-win32.phpt | 81 + ext/standard/tests/file/rename_variation1.phpt | 71 + ext/standard/tests/file/rename_variation10.phpt | 253 + .../tests/file/rename_variation11-win32.phpt | 128 + .../tests/file/rename_variation12-win32.phpt | 121 + ext/standard/tests/file/rename_variation12.phpt | 121 + .../tests/file/rename_variation13-win32.phpt | Bin 0 -> 5058 bytes ext/standard/tests/file/rename_variation13.phpt | 133 + .../tests/file/rename_variation2-win32.phpt | 61 + ext/standard/tests/file/rename_variation2.phpt | 65 + .../tests/file/rename_variation3-win32.phpt | 84 + ext/standard/tests/file/rename_variation3.phpt | 60 + ext/standard/tests/file/rename_variation4.phpt | 51 + ext/standard/tests/file/rename_variation5.phpt | 96 + .../tests/file/rename_variation6-win32.phpt | 40 + ext/standard/tests/file/rename_variation6.phpt | 36 + .../tests/file/rename_variation7-win32.phpt | 36 + ext/standard/tests/file/rename_variation7.phpt | 31 + .../tests/file/rename_variation8-win32.phpt | 70 + ext/standard/tests/file/rename_variation8.phpt | 71 + ext/standard/tests/file/rename_variation9.phpt | 53 + .../tests/file/rmdir_variation1-win32.phpt | 127 + ext/standard/tests/file/rmdir_variation1.phpt | 127 + ext/standard/tests/file/rmdir_variation2.phpt | 244 + .../tests/file/rmdir_variation3-win32.phpt | 108 + ext/standard/tests/file/rmdir_variation3.phpt | 96 + ext/standard/tests/file/stat_basic-win32.phpt | 192 + ext/standard/tests/file/stat_error-win32.phpt | 55 + ext/standard/tests/file/stat_variation1-win32.phpt | 94 + ext/standard/tests/file/stat_variation2-win32.phpt | 65 + ext/standard/tests/file/stat_variation3-win32.phpt | 80 + ext/standard/tests/file/stat_variation4-win32.phpt | 93 + ext/standard/tests/file/stat_variation5-win32.phpt | 66 + ext/standard/tests/file/stat_variation6-win32.phpt | 92 + ext/standard/tests/file/stat_variation7-win32.phpt | 298 + ext/standard/tests/file/stat_variation8-win32.phpt | 77 + ext/standard/tests/file/statcache-corruption.phpt | 13 + ext/standard/tests/file/statpage.phpt | 20 + ext/standard/tests/file/stream_001.phpt | 24 + ext/standard/tests/file/stream_002.phpt | 53 + ext/standard/tests/file/stream_copy_to_stream.phpt | 154 + ext/standard/tests/file/stream_enclosed.phpt | 20 + ext/standard/tests/file/stream_get_line.phpt | 18 + ext/standard/tests/file/stream_rfc2397_001.phpt | 22 + ext/standard/tests/file/stream_rfc2397_002.phpt | 182 + ext/standard/tests/file/stream_rfc2397_003.gif | Bin 0 -> 273 bytes ext/standard/tests/file/stream_rfc2397_003.phpt | 38 + ext/standard/tests/file/stream_rfc2397_004.phpt | 32 + ext/standard/tests/file/stream_rfc2397_005.phpt | 38 + ext/standard/tests/file/stream_rfc2397_006.phpt | 33 + ext/standard/tests/file/stream_rfc2397_007.phpt | 143 + ext/standard/tests/file/stream_supports_lock.phpt | 46 + ext/standard/tests/file/symlink.phpt | 78 + .../file/symlink_link_linkinfo_is_link_basic1.phpt | 114 + .../file/symlink_link_linkinfo_is_link_basic2.phpt | 90 + .../file/symlink_link_linkinfo_is_link_error1.phpt | 115 + .../file/symlink_link_linkinfo_is_link_error2.phpt | 114 + .../symlink_link_linkinfo_is_link_variation1.phpt | 136 + .../symlink_link_linkinfo_is_link_variation2.phpt | 51 + .../symlink_link_linkinfo_is_link_variation3.phpt | 146 + .../symlink_link_linkinfo_is_link_variation4.phpt | 120 + .../symlink_link_linkinfo_is_link_variation5.phpt | 75 + .../symlink_link_linkinfo_is_link_variation6.phpt | 107 + .../symlink_link_linkinfo_is_link_variation7.phpt | 94 + .../symlink_link_linkinfo_is_link_variation8.phpt | 83 + .../symlink_link_linkinfo_is_link_variation9.phpt | 121 + ext/standard/tests/file/symlink_to_symlink.phpt | 50 + ext/standard/tests/file/tempnam_error.phpt | 48 + .../tests/file/tempnam_variation1-win32.phpt | 103 + ext/standard/tests/file/tempnam_variation1.phpt | 116 + .../tests/file/tempnam_variation2-win32.phpt | 163 + ext/standard/tests/file/tempnam_variation2.phpt | 163 + .../tests/file/tempnam_variation3-win32.phpt | 115 + ext/standard/tests/file/tempnam_variation3.phpt | 122 + ext/standard/tests/file/tempnam_variation4.phpt | 1092 ++ .../tests/file/tempnam_variation5-win32.phpt | 54 + ext/standard/tests/file/tempnam_variation5.phpt | 52 + .../tests/file/tempnam_variation6-win32.phpt | 62 + ext/standard/tests/file/tempnam_variation6.phpt | 60 + .../tests/file/tempnam_variation7-win32.phpt | 113 + ext/standard/tests/file/tempnam_variation7.phpt | 118 + .../tests/file/tempnam_variation8-win32.phpt | 147 + ext/standard/tests/file/test.csv | 17 + ext/standard/tests/file/test2.csv | 1 + ext/standard/tests/file/test3.csv | Bin 0 -> 8 bytes ext/standard/tests/file/touch.phpt | 58 + ext/standard/tests/file/touch_basic-win32.phpt | 96 + ext/standard/tests/file/touch_basic.phpt | 97 + ext/standard/tests/file/touch_error.phpt | 22 + ext/standard/tests/file/touch_variation1.phpt | 39 + ext/standard/tests/file/touch_variation2.phpt | 24 + .../tests/file/touch_variation3-win32.phpt | 199 + ext/standard/tests/file/touch_variation3.phpt | 199 + .../tests/file/touch_variation4-win32.phpt | 199 + ext/standard/tests/file/touch_variation4.phpt | 199 + .../tests/file/touch_variation5-win32.phpt | 230 + ext/standard/tests/file/touch_variation5.phpt | 230 + .../tests/file/touch_variation6-win32.phpt | 242 + ext/standard/tests/file/umask_basic.phpt | 2079 +++ ext/standard/tests/file/umask_error.phpt | 26 + ext/standard/tests/file/umask_variation1.phpt | 761 + ext/standard/tests/file/umask_variation2.phpt | 899 + ext/standard/tests/file/umask_variation3.phpt | 237 + ext/standard/tests/file/unlink_basic.phpt | 43 + ext/standard/tests/file/unlink_error-win32.phpt | 110 + ext/standard/tests/file/unlink_error.phpt | 110 + .../tests/file/unlink_variation1-win32.phpt | 85 + ext/standard/tests/file/unlink_variation1.phpt | 92 + ext/standard/tests/file/unlink_variation10.phpt | 106 + .../tests/file/unlink_variation2-win32.phpt | 43 + ext/standard/tests/file/unlink_variation2.phpt | 37 + ext/standard/tests/file/unlink_variation3.phpt | 60 + ext/standard/tests/file/unlink_variation4.phpt | 37 + ext/standard/tests/file/unlink_variation5.phpt | 2087 +++ ext/standard/tests/file/unlink_variation6.phpt | 41 + ext/standard/tests/file/unlink_variation7.phpt | 246 + .../tests/file/unlink_variation8-win32.phpt | 113 + ext/standard/tests/file/unlink_variation8.phpt | 206 + .../tests/file/unlink_variation9-win32.phpt | 117 + ext/standard/tests/file/userdirstream.phpt | 51 + ext/standard/tests/file/userfilters.phpt | 37 + ext/standard/tests/file/userstreams.phpt | 325 + ext/standard/tests/file/userstreams_002.phpt | 94 + ext/standard/tests/file/userstreams_003.phpt | 153 + ext/standard/tests/file/userstreams_004.phpt | 58 + ext/standard/tests/file/userstreams_005.phpt | 63 + ext/standard/tests/file/userstreams_006.phpt | 38 + ext/standard/tests/file/userstreams_007.phpt | 49 + ext/standard/tests/file/userwrapper.phpt | 83 + ext/standard/tests/file/windows_acls/bug44859.phpt | 63 + .../tests/file/windows_acls/bug44859_2.phpt | 63 + .../tests/file/windows_acls/bug44859_3.phpt | 37 + .../tests/file/windows_acls/bug44859_4.phpt | 65 + ext/standard/tests/file/windows_acls/common.inc | 199 + ext/standard/tests/file/windows_acls/tiny.bat | 1 + ext/standard/tests/file/windows_acls/tiny.exe | Bin 0 -> 133 bytes .../tests/file/windows_links/bug48746.phpt | 58 + .../tests/file/windows_links/bug48746_1.phpt | 59 + .../tests/file/windows_links/bug48746_2.phpt | 69 + .../tests/file/windows_links/bug48746_3.phpt | 50 + ext/standard/tests/file/windows_links/common.inc | 23 + ext/standard/tests/filters/001.phpt | 31 + ext/standard/tests/filters/basic.phpt | 44 + ext/standard/tests/filters/bug22538.phpt | 44 + ext/standard/tests/filters/bug35916.phpt | 42 + ext/standard/tests/filters/bug46164-1.phpt | 22 + ext/standard/tests/filters/bug46164-2.phpt | 24 + ext/standard/tests/filters/bug50363.phpt | 17 + ext/standard/tests/filters/chunked_001.phpt | 35 + ext/standard/tests/filters/filter_errors.inc | 37 + .../filter_errors_convert_base64_decode.phpt | 18 + ext/standard/tests/filters/filter_errors_user.phpt | 179 + .../tests/filters/filter_errors_zlib_inflate.phpt | 14 + ext/standard/tests/filters/php_user_filter_01.phpt | 17 + ext/standard/tests/filters/php_user_filter_02.phpt | 12 + ext/standard/tests/filters/php_user_filter_03.phpt | 12 + ext/standard/tests/filters/read.phpt | 72 + .../tests/filters/stream_filter_remove_basic.phpt | 47 + .../tests/filters/stream_filter_remove_error.phpt | 80 + ext/standard/tests/general_functions/001.phpt | 67 + ext/standard/tests/general_functions/002.phpt | 11 + ext/standard/tests/general_functions/003.phpt | 58 + ext/standard/tests/general_functions/004.data | 4 + ext/standard/tests/general_functions/004.phpt | 16 + ext/standard/tests/general_functions/005.phpt | 24 + ext/standard/tests/general_functions/006.phpt | 11 + ext/standard/tests/general_functions/007.phpt | 24 + ext/standard/tests/general_functions/008.phpt | 40 + ext/standard/tests/general_functions/009.phpt | 24 + ext/standard/tests/general_functions/010.phpt | 19 + ext/standard/tests/general_functions/bug25038.phpt | 32 + ext/standard/tests/general_functions/bug27678.phpt | 16 + ext/standard/tests/general_functions/bug29038.phpt | 74 + ext/standard/tests/general_functions/bug31190.phpt | 26 + ext/standard/tests/general_functions/bug32647.phpt | 61 + ext/standard/tests/general_functions/bug34794.phpt | 34 + ext/standard/tests/general_functions/bug35229.phpt | 30 + ext/standard/tests/general_functions/bug36011.phpt | 46 + ext/standard/tests/general_functions/bug39322.phpt | 45 + ext/standard/tests/general_functions/bug40398.phpt | 84 + ext/standard/tests/general_functions/bug40752.phpt | 37 + ext/standard/tests/general_functions/bug41037.phpt | 23 + ext/standard/tests/general_functions/bug41445.phpt | 75 + .../tests/general_functions/bug41445_1.phpt | 54 + ext/standard/tests/general_functions/bug41518.phpt | 37 + ext/standard/tests/general_functions/bug41970.phpt | 27 + ext/standard/tests/general_functions/bug42272.phpt | 11 + .../tests/general_functions/bug43293_1.phpt | 25 + .../tests/general_functions/bug43293_2.phpt | 13 + .../tests/general_functions/bug43293_3.phpt | 30 + .../tests/general_functions/bug44295-win.phpt | 29 + ext/standard/tests/general_functions/bug44295.phpt | 29 + ext/standard/tests/general_functions/bug44394.phpt | 18 + .../tests/general_functions/bug44394_2.phpt | 35 + ext/standard/tests/general_functions/bug44461.phpt | 18 + ext/standard/tests/general_functions/bug44487.phpt | 24 + ext/standard/tests/general_functions/bug44667.phpt | 33 + ext/standard/tests/general_functions/bug46587.phpt | 16 + ext/standard/tests/general_functions/bug47027.phpt | 12 + ext/standard/tests/general_functions/bug47857.phpt | 23 + ext/standard/tests/general_functions/bug47859.phpt | 42 + ext/standard/tests/general_functions/bug48660.phpt | 58 + ext/standard/tests/general_functions/bug48768.phpt | 31 + ext/standard/tests/general_functions/bug49056.phpt | 26 + ext/standard/tests/general_functions/bug49692.ini | 4 + ext/standard/tests/general_functions/bug49692.phpt | 20 + ext/standard/tests/general_functions/bug49847.phpt | 26 + ext/standard/tests/general_functions/bug50690.phpt | 14 + ext/standard/tests/general_functions/bug50732.phpt | 12 + ext/standard/tests/general_functions/bug52138.data | 11 + ext/standard/tests/general_functions/bug52138.phpt | 37 + ext/standard/tests/general_functions/bug55371.phpt | 10 + .../tests/general_functions/bug60227_1.phpt | 20 + .../tests/general_functions/bug60227_2.phpt | 14 + .../tests/general_functions/bug60227_3.phpt | 14 + .../tests/general_functions/bug60227_4.phpt | 14 + ext/standard/tests/general_functions/bug60723.phpt | 19 + .../call_user_func_array_variation_001.phpt | 59 + .../call_user_func_array_variation_002.phpt | 208 + .../call_user_func_array_variation_003.phpt | 210 + .../general_functions/call_user_func_return.phpt | 44 + .../tests/general_functions/call_user_method.phpt | 20 + .../general_functions/call_user_method_002.phpt | 12 + .../tests/general_functions/callbacks_001.phpt | 108 + .../tests/general_functions/callbacks_002.phpt | 16 + .../tests/general_functions/closures_001.phpt | 11 + .../tests/general_functions/closures_002.phpt | 25 + .../tests/general_functions/debug_zval_dump_b.phpt | Bin 0 -> 5004 bytes .../general_functions/debug_zval_dump_b_64bit.phpt | Bin 0 -> 5004 bytes .../tests/general_functions/debug_zval_dump_e.phpt | 23 + .../tests/general_functions/debug_zval_dump_o.phpt | 841 + .../tests/general_functions/debug_zval_dump_v.phpt | 204 + .../tests/general_functions/dl-cve-2007-4887.phpt | 12 + .../tests/general_functions/error_get_last.phpt | 43 + .../escapeshellarg_basic-win32.phpt | 31 + .../general_functions/escapeshellarg_basic.phpt | 31 + .../general_functions/escapeshellarg_error.phpt | 73 + .../escapeshellarg_variation1-win32.phpt | 140 + .../escapeshellarg_variation1.phpt | 140 + .../general_functions/escapeshellcmd-win32.phpt | 49 + ext/standard/tests/general_functions/floatval.phpt | 207 + .../tests/general_functions/floatval_basic.phpt | 172 + .../tests/general_functions/floatval_error.phpt | 40 + .../general_functions/floatval_variation1.phpt | 154 + .../tests/general_functions/get_cfg_var_basic.phpt | 24 + .../tests/general_functions/get_cfg_var_error.phpt | 27 + .../general_functions/get_cfg_var_variation1.phpt | 46 + .../general_functions/get_cfg_var_variation2.phpt | 35 + .../general_functions/get_cfg_var_variation3.phpt | 42 + .../general_functions/get_cfg_var_variation4.phpt | 37 + .../general_functions/get_cfg_var_variation5.phpt | 35 + .../general_functions/get_cfg_var_variation6.phpt | 44 + .../general_functions/get_cfg_var_variation7.phpt | 39 + .../general_functions/get_cfg_var_variation8.phpt | 17 + .../general_functions/get_cfg_var_variation9.phpt | 37 + .../get_defined_constants_basic.phpt | 39 + .../get_defined_constants_error.phpt | 25 + .../general_functions/get_defined_vars_basic.phpt | 152 + .../get_extension_funcs_basic.phpt | 23 + .../get_extension_funcs_error.phpt | 40 + .../get_extension_funcs_variation.phpt | 137 + .../general_functions/get_include_path_basic.phpt | 37 + .../general_functions/get_included_files.phpt | 63 + .../general_functions/get_included_files_inc1.inc | 3 + .../general_functions/get_included_files_inc2.inc | 4 + .../general_functions/get_included_files_inc3.inc | 4 + .../get_loaded_extensions_basic.phpt | 23 + .../get_loaded_extensions_error.phpt | 26 + .../general_functions/get_magic_quotes_gpc.phpt | 26 + .../get_magic_quotes_runtime.phpt | 27 + .../general_functions/get_resource_type_basic.phpt | 20 + .../general_functions/get_resource_type_error.phpt | 34 + .../get_resource_type_variation1.phpt | 74 + .../tests/general_functions/getmypid_basic.phpt | 20 + ext/standard/tests/general_functions/getopt.phpt | 24 + .../tests/general_functions/getopt_002.phpt | 42 + .../tests/general_functions/getopt_003.phpt | 57 + .../tests/general_functions/getopt_004.phpt | 29 + .../tests/general_functions/getopt_005.phpt | 32 + .../tests/general_functions/getrusage.phpt | 23 + .../tests/general_functions/getrusage_basic.phpt | 33 + .../tests/general_functions/getrusage_error.phpt | 73 + .../general_functions/getrusage_variation1.phpt | 142 + .../general_functions/getservbyname_basic.phpt | 31 + .../general_functions/getservbyname_error.phpt | 21 + .../getservbyname_variation1.phpt | 40 + .../getservbyname_variation10.phpt | 42 + .../getservbyname_variation11.phpt | 30 + .../getservbyname_variation12.phpt | 29 + .../getservbyname_variation13.phpt | 38 + .../getservbyname_variation14.phpt | 33 + .../getservbyname_variation2.phpt | 29 + .../getservbyname_variation3.phpt | 36 + .../getservbyname_variation4.phpt | 31 + .../getservbyname_variation5.phpt | 29 + .../getservbyname_variation6.phpt | 38 + .../getservbyname_variation7.phpt | 33 + .../getservbyname_variation8.phpt | 40 + .../getservbyname_variation9.phpt | 34 + .../general_functions/getservbyport_basic.phpt | 27 + .../general_functions/getservbyport_error.phpt | 21 + .../getservbyport_variation1.phpt | 40 + .../general_functions/gettype_settype_basic.phpt | 906 + .../general_functions/gettype_settype_error.phpt | 56 + .../gettype_settype_variation1.phpt | 589 + .../gettype_settype_variation2.phpt | 1005 ++ .../gettype_settype_variation3.phpt | 1002 ++ .../gettype_settype_variation4.phpt | 1201 ++ .../gettype_settype_variation5.phpt | 714 + .../gettype_settype_variation6.phpt | 846 + .../gettype_settype_variation7.phpt | 844 + .../gettype_settype_variation8.phpt | 595 + ext/standard/tests/general_functions/head.phpt | 53 + .../tests/general_functions/highlight_heredoc.phpt | 21 + .../tests/general_functions/import_request.phpt | 76 + .../tests/general_functions/import_request1.phpt | 101 + .../tests/general_functions/import_request2.phpt | 27 + .../tests/general_functions/import_request3.phpt | 27 + .../tests/general_functions/include_path.phpt | 75 + .../tests/general_functions/ini_get_all.phpt | 64 + ext/standard/tests/general_functions/intval.phpt | 306 + .../tests/general_functions/intval_variation1.phpt | 203 + .../tests/general_functions/intval_variation2.phpt | 195 + ext/standard/tests/general_functions/is_array.phpt | 213 + ext/standard/tests/general_functions/is_bool.phpt | 294 + .../general_functions/is_callable_basic1.phpt | 109 + .../general_functions/is_callable_basic2.phpt | 787 + .../tests/general_functions/is_callable_error.phpt | 35 + .../general_functions/is_callable_variation1.phpt | 208 + .../general_functions/is_callable_variation2.phpt | 154 + ext/standard/tests/general_functions/is_float.phpt | 440 + .../tests/general_functions/is_float_64bit.phpt | 437 + ext/standard/tests/general_functions/is_int.phpt | 465 + .../tests/general_functions/is_int_64bit.phpt | 462 + ext/standard/tests/general_functions/is_null.phpt | 296 + .../tests/general_functions/is_numeric.phpt | 387 + .../tests/general_functions/is_object.phpt | 227 + .../tests/general_functions/is_resource.phpt | 10 + .../tests/general_functions/is_resource_basic.phpt | 92 + .../tests/general_functions/is_resource_error.phpt | 34 + .../tests/general_functions/is_scalar.phpt | 240 + .../tests/general_functions/is_string.phpt | 303 + .../tests/general_functions/isset_basic1.phpt | 66 + .../tests/general_functions/isset_basic2.phpt | 60 + .../general_functions/ob_get_flush_basic.phpt | 42 + .../general_functions/ob_get_flush_error.phpt | 32 + .../general_functions/ob_get_length_basic.phpt | 51 + .../tests/general_functions/ob_start_closures.phpt | 39 + .../tests/general_functions/parse_ini_basic.data | 132 + .../tests/general_functions/parse_ini_basic.phpt | 283 + .../general_functions/parse_ini_booleans.data | 27 + .../general_functions/parse_ini_booleans.phpt | 69 + .../tests/general_functions/parse_ini_file.phpt | 218 + .../general_functions/parse_ini_string_001.phpt | 479 + .../general_functions/parse_ini_string_002.phpt | 168 + .../tests/general_functions/php_uname_basic.phpt | 35 + .../tests/general_functions/php_uname_error.phpt | 56 + .../general_functions/php_uname_variation1.phpt | 112 + .../tests/general_functions/phpcredits.phpt | 54 + .../tests/general_functions/phpcredits2.phpt | 30 + ext/standard/tests/general_functions/phpinfo.phpt | 76 + ext/standard/tests/general_functions/phpinfo2.phpt | 31 + ext/standard/tests/general_functions/print_r.phpt | 1736 ++ .../tests/general_functions/print_r_64bit.phpt | 1737 ++ .../tests/general_functions/proc_nice_basic.phpt | 31 + .../tests/general_functions/proc_nice_error.phpt | 28 + .../general_functions/proc_nice_variation1.phpt | 48 + .../general_functions/proc_nice_variation2.phpt | 37 + .../general_functions/proc_nice_variation3.phpt | 48 + .../general_functions/proc_nice_variation5.phpt | 40 + .../general_functions/proc_nice_variation6.phpt | 56 + .../general_functions/proc_nice_variation7.phpt | 49 + .../tests/general_functions/proc_open.phpt | 28 + .../tests/general_functions/proc_open02.phpt | 72 + ext/standard/tests/general_functions/putenv.phpt | 28 + ext/standard/tests/general_functions/rand.phpt | 63 + .../set_magic_quotes_runtime_basic.phpt | 46 + .../set_magic_quotes_runtime_error.phpt | 37 + .../tests/general_functions/sleep_basic.phpt | 44 + .../tests/general_functions/sleep_error.phpt | 44 + ext/standard/tests/general_functions/strval.phpt | 317 + .../tests/general_functions/sys_getloadavg.phpt | 27 + ext/standard/tests/general_functions/type.phpt | 351 + .../tests/general_functions/uniqid_basic.phpt | 72 + .../tests/general_functions/uniqid_error.phpt | 46 + .../tests/general_functions/usleep_basic.phpt | 43 + .../tests/general_functions/usleep_error.phpt | 45 + ext/standard/tests/general_functions/var_dump.phpt | 1574 ++ .../tests/general_functions/var_dump_64bit.phpt | 1574 ++ .../tests/general_functions/var_export-locale.phpt | 1061 ++ .../tests/general_functions/var_export_basic1.phpt | 141 + .../tests/general_functions/var_export_basic2.phpt | 76 + .../tests/general_functions/var_export_basic3.phpt | 175 + .../tests/general_functions/var_export_basic4.phpt | 147 + .../tests/general_functions/var_export_basic5.phpt | 277 + .../tests/general_functions/var_export_basic6.phpt | 310 + .../tests/general_functions/var_export_basic7.phpt | 59 + .../tests/general_functions/var_export_basic8.phpt | 71 + .../tests/general_functions/var_export_basic9.phpt | 11 + .../tests/general_functions/var_export_error1.phpt | 38 + .../tests/general_functions/var_export_error2.phpt | 19 + .../tests/general_functions/var_export_error3.phpt | 19 + ext/standard/tests/http/bug38802.phpt | 174 + ext/standard/tests/http/bug43510.phpt | 30 + ext/standard/tests/http/bug48929.phpt | 58 + ext/standard/tests/http/bug53198.phpt | 57 + ext/standard/tests/http/bug60570.phpt | 53 + ext/standard/tests/http/ignore_errors.phpt | 126 + ext/standard/tests/http/server.inc | 92 + ext/standard/tests/image/200x100.bmp | Bin 0 -> 60054 bytes ext/standard/tests/image/200x100.gif | Bin 0 -> 1031 bytes ext/standard/tests/image/200x100.jpg | Bin 0 -> 991 bytes ext/standard/tests/image/200x100.png | Bin 0 -> 683 bytes ext/standard/tests/image/200x100.swf | Bin 0 -> 71 bytes ext/standard/tests/image/200x100.tif | Bin 0 -> 1142 bytes ext/standard/tests/image/200x100_unknown.unknown | 1 + ext/standard/tests/image/246x247.png | Bin 0 -> 360 bytes ext/standard/tests/image/2x2mm.tif | Bin 0 -> 118 bytes ext/standard/tests/image/384x385.png | Bin 0 -> 267 bytes ext/standard/tests/image/75x50.wbmp | Bin 0 -> 504 bytes ext/standard/tests/image/75x50.xbm | 59 + ext/standard/tests/image/blank_file.bmp | 0 ext/standard/tests/image/bug13213.jpg | Bin 0 -> 596 bytes ext/standard/tests/image/bug13213.phpt | 23 + ext/standard/tests/image/getimagesize.phpt | 211 + ext/standard/tests/image/getimagesize_246x247.phpt | 42 + ext/standard/tests/image/getimagesize_384x385.phpt | 42 + ext/standard/tests/image/getimagesize_basic.phpt | 219 + ext/standard/tests/image/getimagesize_error1.phpt | 38 + ext/standard/tests/image/getimagesize_jpgapp.phpt | 37 + ext/standard/tests/image/getimagesize_swc.phpt | 25 + ext/standard/tests/image/getimagesize_tif_mm.phpt | 39 + .../tests/image/getimagesize_variation1.phpt | 185 + .../tests/image/getimagesize_variation2.phpt | 167 + .../tests/image/getimagesize_variation3.phpt | 70 + .../tests/image/getimagesize_variation4.phpt | 38 + .../tests/image/getimagesize_variation_003.phpt | 70 + .../tests/image/getimagesize_variation_005.phpt | 38 + ext/standard/tests/image/getimagesize_wbmp.phpt | 39 + ext/standard/tests/image/getimagesize_xbm.phpt | 39 + .../tests/image/getimagesizefromstring1.phpt | 49 + .../tests/image/image_type_to_extension.phpt | 103 + .../tests/image/image_type_to_mime_type.phpt | 53 + .../tests/image/image_type_to_mime_type_basic.phpt | 63 + .../tests/image/image_type_to_mime_type_error.phpt | 35 + .../image/image_type_to_mime_type_variation1.phpt | 152 + .../image/image_type_to_mime_type_variation2.phpt | 80 + .../image/image_type_to_mime_type_variation3.phpt | 79 + .../image/image_type_to_mime_type_variation4.phpt | 29 + ext/standard/tests/image/iptcembed_001.phpt | 18 + ext/standard/tests/image/skipif_imagetype.inc | 15 + ext/standard/tests/image/test.gif | Bin 0 -> 2523 bytes ext/standard/tests/image/test.txt | 1 + ext/standard/tests/image/test13pix.swf | Bin 0 -> 589 bytes ext/standard/tests/image/test1bpix.bmp | Bin 0 -> 690138 bytes ext/standard/tests/image/test1pix.bmp | Bin 0 -> 58 bytes ext/standard/tests/image/test1pix.jp2 | Bin 0 -> 243 bytes ext/standard/tests/image/test1pix.jpc | Bin 0 -> 127 bytes ext/standard/tests/image/test1pix.jpg | Bin 0 -> 523 bytes ext/standard/tests/image/test2pix.gif | Bin 0 -> 35 bytes ext/standard/tests/image/test4pix.gif | Bin 0 -> 42 bytes ext/standard/tests/image/test4pix.iff | Bin 0 -> 114 bytes ext/standard/tests/image/test4pix.png | Bin 0 -> 148 bytes ext/standard/tests/image/test4pix.psd | Bin 0 -> 1247 bytes ext/standard/tests/image/test4pix.swf | Bin 0 -> 609 bytes ext/standard/tests/image/test4pix.tif | Bin 0 -> 312 bytes ext/standard/tests/image/testAPP.jpg | Bin 0 -> 12174 bytes ext/standard/tests/mail/bug51604.phpt | 35 + ext/standard/tests/mail/ezmlm_hash_basic.phpt | 25 + .../tests/mail/ezmlm_hash_basic_64bit.phpt | 25 + ext/standard/tests/mail/ezmlm_hash_error.phpt | 66 + ext/standard/tests/mail/ezmlm_hash_variation1.phpt | 193 + ext/standard/tests/mail/mail_basic.phpt | 60 + ext/standard/tests/mail/mail_basic2.phpt | 48 + ext/standard/tests/mail/mail_basic3.phpt | 35 + ext/standard/tests/mail/mail_basic4.phpt | 36 + ext/standard/tests/mail/mail_basic5.phpt | 34 + ext/standard/tests/mail/mail_basic_alt1-win32.phpt | 95 + ext/standard/tests/mail/mail_basic_alt2-win32.phpt | 93 + ext/standard/tests/mail/mail_basic_alt3-win32.phpt | 93 + ext/standard/tests/mail/mail_basic_alt4-win32.phpt | 94 + ext/standard/tests/mail/mail_error.phpt | 44 + ext/standard/tests/mail/mail_include.inc | 150 + ext/standard/tests/mail/mail_skipif.inc | 26 + ext/standard/tests/mail/mail_variation1.phpt | 30 + ext/standard/tests/mail/mail_variation2.phpt | 43 + .../tests/mail/mail_variation_alt1-win32.phpt | 92 + .../tests/mail/mail_variation_alt2-win32.phpt | 92 + .../tests/mail/mail_variation_alt3-win32.phpt | 91 + ext/standard/tests/math/abs.phpt | 24 + ext/standard/tests/math/abs_basic.phpt | 51 + ext/standard/tests/math/abs_basiclong_64bit.phpt | 60 + ext/standard/tests/math/abs_error.phpt | 39 + ext/standard/tests/math/abs_variation.phpt | 135 + ext/standard/tests/math/acos_basic.phpt | 69 + ext/standard/tests/math/acos_basiclong_64bit.phpt | 60 + ext/standard/tests/math/acos_error.phpt | 29 + ext/standard/tests/math/acos_variation.phpt | 56 + ext/standard/tests/math/acosh_basic.phpt | 41 + ext/standard/tests/math/acosh_basiclong_64bit.phpt | 60 + ext/standard/tests/math/acosh_error.phpt | 29 + ext/standard/tests/math/acosh_variation.phpt | 56 + ext/standard/tests/math/allowed_rounding_error.inc | 18 + ext/standard/tests/math/asin_basic.phpt | 68 + ext/standard/tests/math/asin_basiclong_64bit.phpt | 60 + ext/standard/tests/math/asin_error.phpt | 29 + ext/standard/tests/math/asin_variation.phpt | 56 + ext/standard/tests/math/asinh_basic.phpt | 40 + ext/standard/tests/math/asinh_basiclong_64bit.phpt | 60 + ext/standard/tests/math/asinh_error.phpt | 29 + ext/standard/tests/math/asinh_variation.phpt | 56 + ext/standard/tests/math/atan2_basic.phpt | 185 + ext/standard/tests/math/atan2_basiclong_64bit.phpt | 364 + ext/standard/tests/math/atan2_error.phpt | 14 + ext/standard/tests/math/atan2_variation1.phpt | 187 + ext/standard/tests/math/atan2_variation2.phpt | 186 + ext/standard/tests/math/atan_basic.phpt | 40 + ext/standard/tests/math/atan_basiclong_64bit.phpt | 60 + ext/standard/tests/math/atan_error.phpt | 29 + ext/standard/tests/math/atan_variation.phpt | 56 + ext/standard/tests/math/atanh_basic.phpt | 41 + ext/standard/tests/math/atanh_basiclong_64bit.phpt | 60 + ext/standard/tests/math/atanh_error.phpt | 29 + ext/standard/tests/math/atanh_variation.phpt | 56 + ext/standard/tests/math/base_convert_basic.phpt | 316 + ext/standard/tests/math/base_convert_error.phpt | 43 + .../tests/math/base_convert_variation1.phpt | 159 + .../tests/math/base_convert_variation2.phpt | 193 + .../tests/math/base_convert_variation3.phpt | 193 + ext/standard/tests/math/bindec_basic.phpt | 55 + ext/standard/tests/math/bindec_basic_64bit.phpt | 55 + .../tests/math/bindec_basiclong_64bit.phpt | 51 + ext/standard/tests/math/bindec_error.phpt | 37 + ext/standard/tests/math/bindec_variation1.phpt | 158 + .../tests/math/bindec_variation1_64bit.phpt | 158 + ext/standard/tests/math/bug21523.phpt | 12 + ext/standard/tests/math/bug24142.phpt | 20 + ext/standard/tests/math/bug25665.phpt | 16 + ext/standard/tests/math/bug25694.phpt | 37 + ext/standard/tests/math/bug27646.phpt | 48 + ext/standard/tests/math/bug28228.phpt | 14 + ext/standard/tests/math/bug30069.phpt | 12 + ext/standard/tests/math/bug30695.phpt | 54 + ext/standard/tests/math/bug45712.phpt | 75 + ext/standard/tests/math/bug62112.phpt | Bin 0 -> 143 bytes ext/standard/tests/math/ceil_basic.phpt | 70 + ext/standard/tests/math/ceil_basiclong_64bit.phpt | 60 + ext/standard/tests/math/ceil_error.phpt | 33 + ext/standard/tests/math/ceil_variation1.phpt | 128 + ext/standard/tests/math/constants.phpt | 48 + ext/standard/tests/math/constants_basic.phpt | 65 + ext/standard/tests/math/cos_basic.phpt | 92 + ext/standard/tests/math/cos_basiclong_64bit.phpt | 60 + ext/standard/tests/math/cos_error.phpt | 29 + ext/standard/tests/math/cos_variation.phpt | 56 + ext/standard/tests/math/cosh_basic.phpt | 61 + ext/standard/tests/math/cosh_basiclong_64bit.phpt | 60 + ext/standard/tests/math/cosh_error.phpt | 29 + ext/standard/tests/math/cosh_variation.phpt | 56 + ext/standard/tests/math/decbin_basic.phpt | 39 + .../tests/math/decbin_basiclong_64bit.phpt | 60 + ext/standard/tests/math/decbin_error.phpt | 37 + ext/standard/tests/math/decbin_variation1.phpt | 179 + .../tests/math/decbin_variation1_64bit.phpt | 179 + ext/standard/tests/math/dechex_basic.phpt | 38 + .../tests/math/dechex_basiclong_64bit.phpt | 60 + ext/standard/tests/math/dechex_error.phpt | 26 + ext/standard/tests/math/dechex_variation1.phpt | 179 + .../tests/math/dechex_variation1_64bit.phpt | 179 + ext/standard/tests/math/decoct_basic.phpt | 38 + .../tests/math/decoct_basiclong_64bit.phpt | 60 + ext/standard/tests/math/decoct_error.phpt | 25 + ext/standard/tests/math/decoct_variation1.phpt | 180 + .../tests/math/decoct_variation1_64bit.phpt | 180 + ext/standard/tests/math/deg2rad_basic.phpt | 67 + .../tests/math/deg2rad_basiclong_64bit.phpt | 60 + ext/standard/tests/math/deg2rad_error.phpt | 31 + ext/standard/tests/math/deg2rad_variation.phpt | 56 + ext/standard/tests/math/exp_basic.phpt | 71 + ext/standard/tests/math/exp_basiclong_64bit.phpt | 60 + ext/standard/tests/math/exp_error.phpt | 14 + ext/standard/tests/math/exp_variation1.phpt | 187 + ext/standard/tests/math/expm1_basic.phpt | 79 + ext/standard/tests/math/expm1_basiclong_64bit.phpt | 60 + ext/standard/tests/math/expm1_error.phpt | 30 + ext/standard/tests/math/expm1_variation1.phpt | 199 + ext/standard/tests/math/floor_basic.phpt | 108 + ext/standard/tests/math/floor_basiclong_64bit.phpt | 60 + ext/standard/tests/math/floor_error.phpt | 33 + ext/standard/tests/math/floor_variation1.phpt | 128 + ext/standard/tests/math/floorceil.phpt | 44 + ext/standard/tests/math/fmod_basic.phpt | 209 + ext/standard/tests/math/fmod_basiclong_64bit.phpt | 364 + ext/standard/tests/math/fmod_error.phpt | 17 + ext/standard/tests/math/fmod_variation1.phpt | 184 + ext/standard/tests/math/fmod_variation2.phpt | 184 + ext/standard/tests/math/getrandmax_basic.phpt | 9 + ext/standard/tests/math/getrandmax_error.phpt | 9 + ext/standard/tests/math/hexdec.phpt | 24 + ext/standard/tests/math/hexdec_basic.phpt | 50 + ext/standard/tests/math/hexdec_basic_64bit.phpt | 93 + .../tests/math/hexdec_basiclong_64bit.phpt | 51 + ext/standard/tests/math/hexdec_error.phpt | 36 + ext/standard/tests/math/hexdec_variation1.phpt | 168 + .../tests/math/hexdec_variation1_64bit.phpt | 168 + ext/standard/tests/math/hypot_basic.phpt | 444 + ext/standard/tests/math/hypot_basiclong_64bit.phpt | 364 + ext/standard/tests/math/hypot_error.phpt | 33 + ext/standard/tests/math/hypot_variation1.phpt | 185 + ext/standard/tests/math/hypot_variation2.phpt | 185 + ext/standard/tests/math/is_finite_basic.phpt | 41 + .../tests/math/is_finite_basiclong_64bit.phpt | 60 + ext/standard/tests/math/is_finite_error.phpt | 13 + ext/standard/tests/math/is_finite_variation1.phpt | 184 + ext/standard/tests/math/is_infinite_basic.phpt | 42 + .../tests/math/is_infinite_basiclong_64bit.phpt | 60 + ext/standard/tests/math/is_infinite_error.phpt | 12 + .../tests/math/is_infinite_variation1.phpt | 184 + ext/standard/tests/math/is_nan_basic.phpt | 45 + .../tests/math/is_nan_basiclong_64bit.phpt | 60 + ext/standard/tests/math/is_nan_error.phpt | 16 + ext/standard/tests/math/is_nan_variation1.phpt | 184 + ext/standard/tests/math/lcg_value_basic.phpt | 56 + ext/standard/tests/math/log.phpt | 42 + ext/standard/tests/math/log10_basic.phpt | 55 + ext/standard/tests/math/log10_basiclong_64bit.phpt | 60 + ext/standard/tests/math/log10_error.phpt | 31 + ext/standard/tests/math/log10_variation.phpt | 56 + ext/standard/tests/math/log1p_basic.phpt | 78 + ext/standard/tests/math/log1p_basiclong_64bit.phpt | 60 + ext/standard/tests/math/log1p_error.phpt | 29 + ext/standard/tests/math/log1p_variation1.phpt | 191 + ext/standard/tests/math/log_basic.phpt | 60 + ext/standard/tests/math/log_basiclong_64bit.phpt | 60 + ext/standard/tests/math/log_error.phpt | 16 + ext/standard/tests/math/log_variation1.phpt | 184 + ext/standard/tests/math/log_variation2.phpt | 202 + ext/standard/tests/math/mt_getrandmax_basic.phpt | 8 + ext/standard/tests/math/mt_getrandmax_error.phpt | 9 + ext/standard/tests/math/mt_rand_basic.phpt | 102 + ext/standard/tests/math/mt_rand_error.phpt | 19 + ext/standard/tests/math/mt_rand_variation1.phpt | 184 + ext/standard/tests/math/mt_rand_variation2.phpt | 184 + ext/standard/tests/math/mt_srand_basic.phpt | 24 + ext/standard/tests/math/mt_srand_error.phpt | 20 + ext/standard/tests/math/mt_srand_variation1.phpt | 184 + ext/standard/tests/math/number_format_basic.phpt | 97 + .../tests/math/number_format_multichar.phpt | 77 + ext/standard/tests/math/octdec_basic.phpt | 49 + ext/standard/tests/math/octdec_basic_64bit.phpt | 55 + .../tests/math/octdec_basiclong_64bit.phpt | 51 + ext/standard/tests/math/octdec_error.phpt | 37 + ext/standard/tests/math/octdec_variation1.phpt | 164 + ext/standard/tests/math/pi_basic.phpt | 14 + ext/standard/tests/math/pow.phpt | 149 + ext/standard/tests/math/pow_basic.phpt | 270 + ext/standard/tests/math/pow_basic2.phpt | 52 + ext/standard/tests/math/pow_basic_64bit.phpt | 270 + ext/standard/tests/math/pow_basiclong_64bit.phpt | 364 + ext/standard/tests/math/pow_error.phpt | 19 + ext/standard/tests/math/pow_variation1.phpt | 176 + ext/standard/tests/math/pow_variation1_64bit.phpt | 176 + ext/standard/tests/math/pow_variation2.phpt | 172 + ext/standard/tests/math/rad2deg_basic.phpt | 65 + .../tests/math/rad2deg_basiclong_64bit.phpt | 60 + ext/standard/tests/math/rad2deg_error.phpt | 31 + ext/standard/tests/math/rad2deg_variation.phpt | 56 + ext/standard/tests/math/rand_basic.phpt | 103 + ext/standard/tests/math/rand_error.phpt | 18 + ext/standard/tests/math/rand_variation1.phpt | 184 + ext/standard/tests/math/rand_variation2.phpt | 184 + ext/standard/tests/math/round.phpt | 37 + ext/standard/tests/math/round_basic.phpt | 192 + ext/standard/tests/math/round_basiclong_64bit.phpt | 60 + ext/standard/tests/math/round_error.phpt | 31 + ext/standard/tests/math/round_large_exp.phpt | 30 + ext/standard/tests/math/round_modes.phpt | 38 + ext/standard/tests/math/round_prerounding.phpt | 10 + ext/standard/tests/math/round_variation1.phpt | 173 + ext/standard/tests/math/round_variation2.phpt | 187 + ext/standard/tests/math/sin_basic.phpt | 92 + ext/standard/tests/math/sin_basiclong_64bit.phpt | 60 + ext/standard/tests/math/sin_error.phpt | 29 + ext/standard/tests/math/sin_variation.phpt | 56 + ext/standard/tests/math/sinh_basic.phpt | 60 + ext/standard/tests/math/sinh_basiclong_64bit.phpt | 60 + ext/standard/tests/math/sinh_error.phpt | 29 + ext/standard/tests/math/sinh_variation.phpt | 56 + ext/standard/tests/math/sqrt_basic.phpt | 18 + ext/standard/tests/math/sqrt_basiclong_64bit.phpt | 60 + ext/standard/tests/math/sqrt_error.phpt | 31 + ext/standard/tests/math/sqrt_variation.phpt | 60 + ext/standard/tests/math/srand_basic.phpt | 34 + ext/standard/tests/math/srand_error.phpt | 32 + ext/standard/tests/math/srand_variation1.phpt | 184 + ext/standard/tests/math/tan_basic.phpt | 41 + ext/standard/tests/math/tan_basiclong_64bit.phpt | 60 + ext/standard/tests/math/tan_error.phpt | 29 + ext/standard/tests/math/tan_variation.phpt | 56 + ext/standard/tests/math/tanh_basic.phpt | 60 + ext/standard/tests/math/tanh_basiclong_64bit.phpt | 60 + ext/standard/tests/math/tanh_error.phpt | 29 + ext/standard/tests/math/tanh_variation.phpt | 56 + ext/standard/tests/misc/browscap.ini | 16927 +++++++++++++++++++ ext/standard/tests/misc/browsernames.inc | 51 + ext/standard/tests/misc/get_browser_basic.phpt | 1468 ++ ext/standard/tests/misc/get_browser_error.phpt | 119 + .../tests/misc/get_browser_variation1.phpt | 1399 ++ ext/standard/tests/misc/syslog_basic.phpt | 13 + ext/standard/tests/misc/syslog_parameters.phpt | 22 + ext/standard/tests/misc/time_nanosleep_basic.phpt | 25 + ext/standard/tests/misc/time_nanosleep_error1.phpt | 14 + ext/standard/tests/misc/time_nanosleep_error2.phpt | 14 + ext/standard/tests/misc/time_nanosleep_error3.phpt | 17 + ext/standard/tests/misc/time_nanosleep_error4.phpt | 17 + ext/standard/tests/misc/time_nanosleep_error5.phpt | 14 + .../tests/misc/time_sleep_until_basic.phpt | 32 + .../tests/misc/time_sleep_until_error1.phpt | 15 + .../tests/misc/time_sleep_until_error2.phpt | 14 + .../tests/misc/time_sleep_until_error3.phpt | 14 + ext/standard/tests/network/bug20134.phpt | 24 + ext/standard/tests/network/bug41347.phpt | 9 + ext/standard/tests/network/closelog_basic.phpt | 23 + ext/standard/tests/network/closelog_error.phpt | 27 + ext/standard/tests/network/fsockopen_basic.phpt | 54 + ext/standard/tests/network/fsockopen_error.phpt | 75 + .../tests/network/fsockopen_variation1.phpt | 32 + .../tests/network/fsockopen_variation2.phpt | 48 + .../tests/network/gethostbyaddr_basic1.phpt | 18 + .../tests/network/gethostbyaddr_error.phpt | 60 + .../tests/network/gethostbyname_basic001.phpt | 15 + .../tests/network/gethostbyname_basic003.phpt | 18 + .../tests/network/gethostbyname_error001.phpt | 10 + .../tests/network/gethostbyname_error002.phpt | 10 + .../tests/network/gethostbyname_error003.phpt | 10 + .../tests/network/gethostbyname_error004.phpt | 16 + .../tests/network/gethostbyname_error005.phpt | 12 + .../tests/network/gethostbyname_error006.phpt | 10 + .../tests/network/gethostbynamel_basic1.phpt | 19 + .../tests/network/gethostbynamel_error.phpt | 36 + ext/standard/tests/network/getmxrr.phpt | 24 + ext/standard/tests/network/http-stream.phpt | 18 + ext/standard/tests/network/inet.phpt | 75 + ext/standard/tests/network/inet_ipv6.phpt | 50 + ext/standard/tests/network/ip.phpt | 67 + ext/standard/tests/network/ip2long_error.phpt | 37 + ext/standard/tests/network/ip2long_variation1.phpt | 204 + ext/standard/tests/network/ip_x86_64.phpt | 67 + ext/standard/tests/network/long2ip_error.phpt | 37 + ext/standard/tests/network/long2ip_variation1.phpt | 196 + ext/standard/tests/network/shutdown.phpt | 65 + .../tests/network/socket_get_status_basic.phpt | 27 + ext/standard/tests/network/syslog_basic-win32.phpt | 31 + ext/standard/tests/network/syslog_error.phpt | 40 + ext/standard/tests/network/tcp4loop.phpt | 34 + ext/standard/tests/network/tcp6loop.phpt | 42 + ext/standard/tests/network/udgloop.phpt | 37 + ext/standard/tests/network/udp4loop.phpt | 27 + ext/standard/tests/network/udp6loop.phpt | 41 + ext/standard/tests/network/unixloop.phpt | 44 + ext/standard/tests/php_ini_loaded_file.phpt | 14 + ext/standard/tests/php_logo_guid.phpt | 13 + ext/standard/tests/php_real_logo_guid.phpt | 12 + ext/standard/tests/serialize/001.phpt | 122 + ext/standard/tests/serialize/002.phpt | 44 + ext/standard/tests/serialize/003.phpt | 25 + ext/standard/tests/serialize/004.phpt | 33 + ext/standard/tests/serialize/005.phpt | 186 + ext/standard/tests/serialize/006.phpt | 29 + .../tests/serialize/autoload_implements.p5c | 10 + .../tests/serialize/autoload_interface.p5c | 7 + ext/standard/tests/serialize/bug14293.phpt | 36 + ext/standard/tests/serialize/bug21957.phpt | 49 + ext/standard/tests/serialize/bug23298.phpt | 13 + ext/standard/tests/serialize/bug24063.phpt | 23 + ext/standard/tests/serialize/bug25378.phpt | 59 + ext/standard/tests/serialize/bug26762.phpt | 27 + ext/standard/tests/serialize/bug27469.phpt | 27 + ext/standard/tests/serialize/bug28325.phpt | 30 + ext/standard/tests/serialize/bug30234.phpt | 40 + ext/standard/tests/serialize/bug31402.phpt | 87 + ext/standard/tests/serialize/bug31442.phpt | 10 + ext/standard/tests/serialize/bug35895.phpt | 24 + ext/standard/tests/serialize/bug36424.phpt | 72 + ext/standard/tests/serialize/bug37947.phpt | 21 + ext/standard/tests/serialize/bug42919.phpt | 14 + ext/standard/tests/serialize/bug43614.phpt | 21 + ext/standard/tests/serialize/bug45706.phpt | 28 + ext/standard/tests/serialize/bug46882.phpt | 8 + ext/standard/tests/serialize/bug55798.phpt | 18 + ext/standard/tests/serialize/bug62373.phpt | 25 + ext/standard/tests/serialize/bug62836_1.phpt | 34 + ext/standard/tests/serialize/bug62836_2.phpt | 37 + ext/standard/tests/serialize/incomplete_class.phpt | 27 + ext/standard/tests/serialize/precision.phpt | 49 + .../tests/serialize/serialization_arrays_001.phpt | 91 + .../tests/serialize/serialization_arrays_002.phpt | 544 + .../tests/serialize/serialization_arrays_003.phpt | 294 + .../tests/serialize/serialization_arrays_004.phpt | 269 + .../tests/serialize/serialization_arrays_005.phpt | 521 + .../tests/serialize/serialization_error_001.phpt | 42 + .../serialize/serialization_miscTypes_001.phpt | Bin 0 -> 7617 bytes .../tests/serialize/serialization_objects_001.phpt | Bin 0 -> 2435 bytes .../tests/serialize/serialization_objects_002.phpt | Bin 0 -> 7244 bytes .../tests/serialize/serialization_objects_003.phpt | 69 + .../tests/serialize/serialization_objects_004.phpt | 49 + .../tests/serialize/serialization_objects_005.phpt | 120 + .../tests/serialize/serialization_objects_006.phpt | 28 + .../tests/serialize/serialization_objects_007.phpt | 42 + .../tests/serialize/serialization_objects_008.phpt | 28 + .../tests/serialize/serialization_objects_009.phpt | 35 + .../tests/serialize/serialization_objects_010.phpt | 37 + .../tests/serialize/serialization_objects_011.phpt | 196 + .../tests/serialize/serialization_objects_012.phpt | 244 + .../tests/serialize/serialization_objects_013.phpt | 494 + .../tests/serialize/serialization_objects_014.phpt | 295 + .../tests/serialize/serialization_objects_015.phpt | 336 + .../serialize/serialization_precision_001.phpt | 21 + .../serialize/serialization_precision_002.phpt | 21 + .../serialize/serialization_resources_001.phpt | 30 + ext/standard/tests/serialize/unserializeS.phpt | 14 + ext/standard/tests/streams/bug40459.phpt | 103 + ext/standard/tests/streams/bug44712.phpt | 10 + ext/standard/tests/streams/bug44818.phpt | 37 + ext/standard/tests/streams/bug46024.phpt | 46 + ext/standard/tests/streams/bug46426.phpt | 34 + ext/standard/tests/streams/bug47997.phpt | 15 + ext/standard/tests/streams/bug48309.phpt | 33 + ext/standard/tests/streams/bug49936.phpt | 21 + ext/standard/tests/streams/bug49936_win32.phpt | 30 + ext/standard/tests/streams/bug53427.phpt | 27 + ext/standard/tests/streams/bug53903.phpt | 32 + ext/standard/tests/streams/bug54623.phpt | 17 + ext/standard/tests/streams/bug54946.phpt | 39 + ext/standard/tests/streams/bug60106.phpt | 23 + ext/standard/tests/streams/bug60455_01.phpt | 21 + ext/standard/tests/streams/bug60455_02.phpt | 31 + ext/standard/tests/streams/bug60455_03.phpt | 55 + ext/standard/tests/streams/bug60455_04.phpt | 32 + ext/standard/tests/streams/bug60817.phpt | 36 + ext/standard/tests/streams/bug61115-1.phpt | 17 + ext/standard/tests/streams/bug61115-2.phpt | 10 + ext/standard/tests/streams/bug61115.phpt | 13 + ext/standard/tests/streams/bug61371-win.phpt | 45 + ext/standard/tests/streams/bug61371.phpt | 45 + ext/standard/tests/streams/bug63240.phpt | 17 + .../streams/stream_context_get_params_001.phpt | 121 + .../streams/stream_context_set_option_basic.phpt | 37 + .../stream_context_set_option_error_001.phpt | 21 + .../stream_context_set_option_error_002.phpt | 18 + .../streams/stream_copy_to_stream_socket.phpt | 30 + .../tests/streams/stream_get_contents_001.phpt | 22 + .../tests/streams/stream_get_contents_002.phpt | 18 + .../streams/stream_get_line_NUL_delimiter.phpt | 27 + ext/standard/tests/streams/stream_get_line_nb.phpt | 66 + .../streams/stream_get_meta_data_dir_basic.phpt | 50 + .../streams/stream_get_meta_data_file_basic.phpt | 33 + .../streams/stream_get_meta_data_file_error.phpt | 57 + .../stream_get_meta_data_file_variation1.phpt | 510 + .../stream_get_meta_data_file_variation2.phpt | 135 + .../stream_get_meta_data_file_variation4.phpt | 71 + .../stream_get_meta_data_file_variation5.phpt | 77 + .../stream_get_meta_data_process_basic.phpt | 36 + .../streams/stream_get_meta_data_socket_basic.phpt | 27 + .../stream_get_meta_data_socket_variation1.phpt | 113 + .../stream_get_meta_data_socket_variation2.phpt | 111 + .../stream_get_meta_data_socket_variation3.phpt | 89 + .../stream_get_meta_data_socket_variation4.phpt | 92 + ext/standard/tests/streams/stream_is_local.phpt | 17 + .../tests/streams/stream_resolve_include_path.phpt | 37 + .../tests/streams/stream_set_chunk_size.phpt | 93 + .../tests/streams/stream_set_timeout_error.phpt | 74 + ext/standard/tests/streams/stream_socket_pair.phpt | 19 + ext/standard/tests/strings/004.phpt | 84 + ext/standard/tests/strings/005.phpt | 24 + ext/standard/tests/strings/006.phpt | 21 + ext/standard/tests/strings/007-win32.phpt | 20 + ext/standard/tests/strings/007.phpt | 20 + .../tests/strings/add-and-stripcslashes.phpt | 26 + .../tests/strings/add-and-stripslashes.phpt | 20 + ext/standard/tests/strings/addcslashes_001.phpt | Bin 0 -> 1587 bytes ext/standard/tests/strings/addcslashes_002.phpt | 33 + ext/standard/tests/strings/addcslashes_003.phpt | Bin 0 -> 1314 bytes ext/standard/tests/strings/addcslashes_004.phpt | 30 + ext/standard/tests/strings/addslashes_basic.phpt | 38 + ext/standard/tests/strings/addslashes_error.phpt | 43 + .../tests/strings/addslashes_variation1.phpt | 171 + .../tests/strings/addslashes_variation2.phpt | 194 + ext/standard/tests/strings/basename.phpt | Bin 0 -> 1148 bytes ext/standard/tests/strings/basename_basic.phpt | Bin 0 -> 3225 bytes ext/standard/tests/strings/basename_error.phpt | 58 + ext/standard/tests/strings/basename_variation.phpt | 235 + ext/standard/tests/strings/bin2hex.phpt | 14 + ext/standard/tests/strings/bin2hex_basic.phpt | 50 + ext/standard/tests/strings/bin2hex_error.phpt | 35 + ext/standard/tests/strings/bin2hex_variation1.phpt | 128 + ext/standard/tests/strings/bug20108.phpt | 11 + ext/standard/tests/strings/bug20169.phpt | 14 + ext/standard/tests/strings/bug20261.phpt | 26 + ext/standard/tests/strings/bug20927.phpt | 17 + ext/standard/tests/strings/bug20934.phpt | 17 + ext/standard/tests/strings/bug21338.phpt | 10 + ext/standard/tests/strings/bug21453.phpt | 18 + ext/standard/tests/strings/bug21730.phpt | 35 + ext/standard/tests/strings/bug21744.phpt | 15 + ext/standard/tests/strings/bug22008.phpt | 24 + ext/standard/tests/strings/bug22187.phpt | 10 + ext/standard/tests/strings/bug22207.phpt | 11 + ext/standard/tests/strings/bug22224.phpt | 31 + ext/standard/tests/strings/bug22227.phpt | 9 + ext/standard/tests/strings/bug23650.phpt | 31 + ext/standard/tests/strings/bug23894.phpt | 15 + ext/standard/tests/strings/bug24098.phpt | 19 + ext/standard/tests/strings/bug24208.phpt | 12 + ext/standard/tests/strings/bug24281.phpt | 18 + ext/standard/tests/strings/bug24312.phpt | 27 + ext/standard/tests/strings/bug25671.phpt | 23 + ext/standard/tests/strings/bug25707.phpt | 12 + ext/standard/tests/strings/bug26817.phpt | 26 + ext/standard/tests/strings/bug26819.phpt | 9 + ext/standard/tests/strings/bug26878.phpt | 9 + ext/standard/tests/strings/bug26973.phpt | 34 + ext/standard/tests/strings/bug27276.phpt | 15 + ext/standard/tests/strings/bug27278.phpt | 21 + ext/standard/tests/strings/bug27295.phpt | 14 + ext/standard/tests/strings/bug27457.phpt | 21 + ext/standard/tests/strings/bug27675.phpt | 8 + ext/standard/tests/strings/bug28386.phpt | 13 + ext/standard/tests/strings/bug28633.phpt | 10 + ext/standard/tests/strings/bug29075.phpt | 14 + ext/standard/tests/strings/bug29119.phpt | 8 + ext/standard/tests/strings/bug29538.phpt | 10 + ext/standard/tests/strings/bug33076.phpt | 14 + ext/standard/tests/strings/bug33605.phpt | 11 + ext/standard/tests/strings/bug34214.phpt | 10 + ext/standard/tests/strings/bug35817.phpt | 29 + ext/standard/tests/strings/bug36148.phpt | 29 + ext/standard/tests/strings/bug36306.phpt | 15 + ext/standard/tests/strings/bug36392.phpt | 16 + ext/standard/tests/strings/bug36944.phpt | 26 + ext/standard/tests/strings/bug37244.phpt | 18 + ext/standard/tests/strings/bug37262.phpt | 9 + ext/standard/tests/strings/bug38322.phpt | 13 + ext/standard/tests/strings/bug38770.phpt | 25 + ext/standard/tests/strings/bug39032.phpt | 18 + ext/standard/tests/strings/bug39350.phpt | 13 + ext/standard/tests/strings/bug39621.phpt | Bin 0 -> 866 bytes ext/standard/tests/strings/bug39873.phpt | 17 + ext/standard/tests/strings/bug40432.phpt | 8 + ext/standard/tests/strings/bug40637.phpt | 13 + ext/standard/tests/strings/bug40704.phpt | 13 + ext/standard/tests/strings/bug40754.phpt | 63 + ext/standard/tests/strings/bug40915.phpt | Bin 0 -> 377 bytes ext/standard/tests/strings/bug42107.phpt | 47 + ext/standard/tests/strings/bug42208.phpt | 15 + ext/standard/tests/strings/bug43927.phpt | 12 + ext/standard/tests/strings/bug44242.phpt | 14 + ext/standard/tests/strings/bug44703.phpt | 46 + ext/standard/tests/strings/bug45166.phpt | 10 + ext/standard/tests/strings/bug45485.phpt | 23 + ext/standard/tests/strings/bug46578.phpt | 25 + ext/standard/tests/strings/bug47168.phpt | 12 + ext/standard/tests/strings/bug47322.phpt | 19 + ext/standard/tests/strings/bug47443.phpt | 14 + ext/standard/tests/strings/bug47481.phpt | 57 + ext/standard/tests/strings/bug47842.phpt | 34 + ext/standard/tests/strings/bug48709.phpt | 31 + ext/standard/tests/strings/bug49785.phpt | 4135 +++++ ext/standard/tests/strings/bug50052.phpt | 12 + ext/standard/tests/strings/bug50847.phpt | 10 + ext/standard/tests/strings/bug51059.phpt | 11 + ext/standard/tests/strings/bug51899.phpt | 37 + ext/standard/tests/strings/bug53021.phpt | 34 + ext/standard/tests/strings/bug53319.phpt | 17 + ext/standard/tests/strings/bug54055.phpt | 589 + ext/standard/tests/strings/bug54238.phpt | 25 + ext/standard/tests/strings/bug54322.phpt | 9 + ext/standard/tests/strings/bug54332.phpt | 8 + ext/standard/tests/strings/bug54454.phpt | 8 + ext/standard/tests/strings/bug54721.phpt | 20 + ext/standard/tests/strings/bug55674.phpt | 50 + ext/standard/tests/strings/bug55871.phpt | 47 + ext/standard/tests/strings/bug60801.phpt | Bin 0 -> 489 bytes ext/standard/tests/strings/bug60965.phpt | 10 + ext/standard/tests/strings/bug61374.phpt | 7 + ext/standard/tests/strings/bug61660.phpt | 11 + ext/standard/tests/strings/bug61764.phpt | 15 + ext/standard/tests/strings/bug62443.phpt | 9 + ext/standard/tests/strings/bug62462.phpt | 17 + ext/standard/tests/strings/bug63943.phpt | 8 + ext/standard/tests/strings/chop_basic.phpt | Bin 0 -> 861 bytes ext/standard/tests/strings/chop_error.phpt | 44 + ext/standard/tests/strings/chop_variation1.phpt | 214 + ext/standard/tests/strings/chop_variation2.phpt | 175 + ext/standard/tests/strings/chop_variation3.phpt | Bin 0 -> 1974 bytes ext/standard/tests/strings/chop_variation4.phpt | Bin 0 -> 1836 bytes ext/standard/tests/strings/chop_variation5.phpt | 39 + ext/standard/tests/strings/chr_basic.phpt | 23 + ext/standard/tests/strings/chr_error.phpt | 34 + ext/standard/tests/strings/chr_ord.phpt | Bin 0 -> 3203 bytes ext/standard/tests/strings/chr_variation1.phpt | 123 + ext/standard/tests/strings/chunk_split.phpt | 34 + ext/standard/tests/strings/chunk_split_basic.phpt | 53 + ext/standard/tests/strings/chunk_split_error.phpt | 40 + .../tests/strings/chunk_split_variation1.phpt | 169 + .../tests/strings/chunk_split_variation10.phpt | 86 + .../tests/strings/chunk_split_variation11.phpt | 95 + .../tests/strings/chunk_split_variation12.phpt | 145 + .../tests/strings/chunk_split_variation13.phpt | 42 + .../tests/strings/chunk_split_variation2.phpt | 183 + .../tests/strings/chunk_split_variation3.phpt | 160 + .../tests/strings/chunk_split_variation4.phpt | 176 + .../tests/strings/chunk_split_variation5.phpt | Bin 0 -> 2289 bytes .../tests/strings/chunk_split_variation6.phpt | 76 + .../tests/strings/chunk_split_variation7.phpt | Bin 0 -> 2462 bytes .../tests/strings/chunk_split_variation8.phpt | 92 + .../tests/strings/chunk_split_variation9.phpt | Bin 0 -> 3344 bytes ext/standard/tests/strings/convert_cyr_string.phpt | 50 + .../tests/strings/convert_cyr_string_basic.phpt | 165 + .../tests/strings/convert_cyr_string_error.phpt | 73 + .../strings/convert_cyr_string_variation1.phpt | 139 + .../tests/strings/convert_uudecode_basic.phpt | 54 + .../tests/strings/convert_uudecode_error.phpt | 35 + .../tests/strings/convert_uudecode_variation1.phpt | 161 + .../tests/strings/convert_uuencode_basic.phpt | 88 + .../tests/strings/convert_uuencode_error.phpt | 35 + .../tests/strings/convert_uuencode_variation1.phpt | 137 + ext/standard/tests/strings/count_chars.phpt | 18 + ext/standard/tests/strings/count_chars_basic.phpt | 1574 ++ ext/standard/tests/strings/count_chars_error.phpt | 36 + .../tests/strings/count_chars_variation1.phpt | 262 + .../tests/strings/count_chars_variation2.phpt | 162 + ext/standard/tests/strings/crc32.phpt | 14 + ext/standard/tests/strings/crc32_basic.phpt | 41 + ext/standard/tests/strings/crc32_error.phpt | 47 + ext/standard/tests/strings/crc32_variation1.phpt | 197 + ext/standard/tests/strings/crc32_variation2.phpt | 149 + ext/standard/tests/strings/crc32_variation3.phpt | 161 + ext/standard/tests/strings/crc32_variation4.phpt | 117 + ext/standard/tests/strings/crypt.phpt | 43 + ext/standard/tests/strings/crypt_blowfish.phpt | 78 + .../tests/strings/crypt_blowfish_variation1.phpt | 37 + .../tests/strings/crypt_blowfish_variation2.phpt | 14 + ext/standard/tests/strings/crypt_chars.phpt | 19 + ext/standard/tests/strings/crypt_sha256.phpt | 64 + ext/standard/tests/strings/crypt_sha512.phpt | 65 + ext/standard/tests/strings/crypt_variation1.phpt | 23 + ext/standard/tests/strings/dirname_basic.phpt | 153 + ext/standard/tests/strings/dirname_error.phpt | 25 + ext/standard/tests/strings/dirname_variation.phpt | 143 + ext/standard/tests/strings/explode.phpt | 164 + ext/standard/tests/strings/explode1.phpt | 509 + ext/standard/tests/strings/explode_bug.phpt | 15 + ext/standard/tests/strings/explode_error.phpt | 37 + ext/standard/tests/strings/explode_variation1.phpt | 193 + ext/standard/tests/strings/explode_variation2.phpt | 195 + ext/standard/tests/strings/explode_variation3.phpt | 238 + ext/standard/tests/strings/explode_variation4.phpt | 36 + ext/standard/tests/strings/explode_variation5.phpt | 48 + ext/standard/tests/strings/explode_variation6.phpt | 70 + ext/standard/tests/strings/fprintf_error.phpt | 31 + .../tests/strings/fprintf_variation_001.phpt | 124 + .../tests/strings/fprintf_variation_002.phpt | 124 + .../tests/strings/fprintf_variation_003.phpt | 47 + .../tests/strings/fprintf_variation_003_64bit.phpt | 47 + .../tests/strings/fprintf_variation_004.phpt | Bin 0 -> 734 bytes .../tests/strings/fprintf_variation_005.phpt | 46 + .../tests/strings/fprintf_variation_006.phpt | 47 + .../tests/strings/fprintf_variation_006_64bit.phpt | 47 + .../tests/strings/fprintf_variation_007.phpt | 47 + .../tests/strings/fprintf_variation_007_64bit.phpt | 47 + .../tests/strings/fprintf_variation_008.phpt | 48 + .../tests/strings/fprintf_variation_008_64bit.phpt | 48 + .../tests/strings/fprintf_variation_009.phpt | 64 + .../strings/get_html_translation_table_basic1.phpt | 549 + .../get_html_translation_table_basic10.phpt | 121 + .../strings/get_html_translation_table_basic2.phpt | 1565 ++ .../strings/get_html_translation_table_basic3.phpt | 71 + .../strings/get_html_translation_table_basic4.phpt | 293 + .../strings/get_html_translation_table_basic5.phpt | 1598 ++ .../strings/get_html_translation_table_basic6.phpt | 249 + .../strings/get_html_translation_table_basic7.phpt | 342 + .../strings/get_html_translation_table_basic8.phpt | 93 + .../strings/get_html_translation_table_basic9.phpt | 95 + .../strings/get_html_translation_table_error.phpt | 29 + .../get_html_translation_table_variation1.phpt | 316 + .../get_html_translation_table_variation2.phpt | 209 + ext/standard/tests/strings/get_meta_tags.phpt | 95 + ext/standard/tests/strings/hebrev_basic.phpt | 35 + ext/standard/tests/strings/hebrev_error.phpt | 35 + ext/standard/tests/strings/hebrev_variation1.phpt | 138 + ext/standard/tests/strings/hebrev_variation2.phpt | 291 + ext/standard/tests/strings/hebrevc_basic.phpt | 47 + ext/standard/tests/strings/hebrevc_error.phpt | 35 + ext/standard/tests/strings/hebrevc_variation1.phpt | 138 + ext/standard/tests/strings/hebrevc_variation2.phpt | 430 + ext/standard/tests/strings/highlight_file.phpt | 59 + .../tests/strings/html_entity_decode1.phpt | 67 + .../tests/strings/html_entity_decode2.phpt | 33 + .../tests/strings/html_entity_decode3.phpt | 193 + .../tests/strings/html_entity_decode_cp866.phpt | 533 + .../tests/strings/html_entity_decode_html4.phpt | 516 + .../tests/strings/html_entity_decode_html5.phpt | 4264 +++++ .../strings/html_entity_decode_iso8859-15.phpt | 405 + .../strings/html_entity_decode_iso8859-5.phpt | 405 + .../tests/strings/html_entity_decode_koi8-r.phpt | 533 + .../tests/strings/html_entity_decode_macroman.phpt | 540 + .../tests/strings/html_entity_decode_win1251.phpt | 537 + .../tests/strings/html_entity_decode_win1252.phpt | 169 + ext/standard/tests/strings/htmlentities-utf-2.phpt | 70 + ext/standard/tests/strings/htmlentities-utf-3.phpt | 83 + ext/standard/tests/strings/htmlentities-utf.phpt | 70 + ext/standard/tests/strings/htmlentities.phpt | 19 + ext/standard/tests/strings/htmlentities01.phpt | 13 + ext/standard/tests/strings/htmlentities02.phpt | 20 + ext/standard/tests/strings/htmlentities03.phpt | 20 + ext/standard/tests/strings/htmlentities04.phpt | 21 + ext/standard/tests/strings/htmlentities05.phpt | 18 + ext/standard/tests/strings/htmlentities06.phpt | 17 + ext/standard/tests/strings/htmlentities07.phpt | 17 + ext/standard/tests/strings/htmlentities08.phpt | 18 + ext/standard/tests/strings/htmlentities09.phpt | 20 + ext/standard/tests/strings/htmlentities10.phpt | 16 + ext/standard/tests/strings/htmlentities11.phpt | 14 + ext/standard/tests/strings/htmlentities12.phpt | 14 + ext/standard/tests/strings/htmlentities13.phpt | 17 + ext/standard/tests/strings/htmlentities14.phpt | 17 + ext/standard/tests/strings/htmlentities15.phpt | 25 + ext/standard/tests/strings/htmlentities16.phpt | 21 + ext/standard/tests/strings/htmlentities17.phpt | 47 + ext/standard/tests/strings/htmlentities18.phpt | 43 + ext/standard/tests/strings/htmlentities19.phpt | 30 + ext/standard/tests/strings/htmlentities20.phpt | 199 + ext/standard/tests/strings/htmlentities21.phpt | 198 + ext/standard/tests/strings/htmlentities22.phpt | 283 + ext/standard/tests/strings/htmlentities23.phpt | 95 + ext/standard/tests/strings/htmlentities24.phpt | 331 + ext/standard/tests/strings/htmlentities_html4.phpt | 313 + ext/standard/tests/strings/htmlentities_html5.phpt | 1623 ++ ext/standard/tests/strings/htmlspecialchars.phpt | 331 + .../tests/strings/htmlspecialchars_basic.phpt | 97 + .../strings/htmlspecialchars_decode_basic.phpt | 42 + .../strings/htmlspecialchars_decode_error.phpt | 37 + .../htmlspecialchars_decode_variation1.phpt | 161 + .../htmlspecialchars_decode_variation2.phpt | 191 + .../htmlspecialchars_decode_variation3.phpt | 99 + .../htmlspecialchars_decode_variation4.phpt | 65 + .../htmlspecialchars_decode_variation5.phpt | 76 + .../htmlspecialchars_decode_variation6.phpt | Bin 0 -> 1523 bytes .../htmlspecialchars_decode_variation7.phpt | 192 + ext/standard/tests/strings/http_build_query.phpt | 15 + .../tests/strings/http_build_query_error.phpt | 13 + .../tests/strings/http_build_query_variation1.phpt | 30 + .../tests/strings/http_build_query_variation2.phpt | 39 + .../tests/strings/http_build_query_variation3.phpt | 27 + ext/standard/tests/strings/implode.phpt | 23 + ext/standard/tests/strings/implode1.phpt | Bin 0 -> 5876 bytes ext/standard/tests/strings/join_basic.phpt | 43 + ext/standard/tests/strings/join_error.phpt | 50 + ext/standard/tests/strings/join_variation1.phpt | 167 + ext/standard/tests/strings/join_variation2.phpt | 198 + ext/standard/tests/strings/join_variation3.phpt | 99 + ext/standard/tests/strings/join_variation4.phpt | Bin 0 -> 2213 bytes ext/standard/tests/strings/join_variation5.phpt | 50 + ext/standard/tests/strings/join_variation6.phpt | Bin 0 -> 729 bytes ext/standard/tests/strings/lcfirst.phpt | Bin 0 -> 6877 bytes ext/standard/tests/strings/levenshtein.phpt | 86 + ext/standard/tests/strings/ltrim.phpt | 83 + ext/standard/tests/strings/ltrim_basic.phpt | 53 + ext/standard/tests/strings/ltrim_error.phpt | 61 + ext/standard/tests/strings/ltrim_variation1.phpt | 138 + ext/standard/tests/strings/ltrim_variation2.phpt | 138 + ext/standard/tests/strings/md5.phpt | 20 + ext/standard/tests/strings/md5_basic1.phpt | 17 + ext/standard/tests/strings/md5_basic2.phpt | 30 + ext/standard/tests/strings/md5_error.phpt | 35 + ext/standard/tests/strings/md5_file.phpt | Bin 0 -> 2849 bytes ext/standard/tests/strings/md5raw.phpt | 20 + ext/standard/tests/strings/metaphone.phpt | 41 + .../tests/strings/money_format_basic1.phpt | 80 + ext/standard/tests/strings/money_format_error.phpt | 55 + .../tests/strings/money_format_variation1.phpt | 172 + .../tests/strings/money_format_variation2.phpt | 180 + ext/standard/tests/strings/moneyformat.phpt | 23 + ext/standard/tests/strings/nl2br.phpt | 45 + ext/standard/tests/strings/nl2br_error.phpt | 34 + ext/standard/tests/strings/nl2br_variation1.phpt | 80 + ext/standard/tests/strings/nl2br_variation2.phpt | 70 + ext/standard/tests/strings/nl2br_variation3.phpt | 64 + ext/standard/tests/strings/nl2br_variation4.phpt | 41 + ext/standard/tests/strings/nl2br_variation5.phpt | 152 + ext/standard/tests/strings/nl_langinfo_basic.phpt | 37 + ext/standard/tests/strings/nl_langinfo_error1.phpt | 40 + .../tests/strings/nl_langinfo_variation1.phpt | 104 + .../tests/strings/number_format_basic.phpt | 109 + .../tests/strings/number_format_error.phpt | 38 + ext/standard/tests/strings/ord_basic.phpt | 47 + ext/standard/tests/strings/ord_error.phpt | 34 + ext/standard/tests/strings/ord_variation1.phpt | 136 + ext/standard/tests/strings/pack.phpt | 385 + ext/standard/tests/strings/parse_str_basic1.phpt | 76 + ext/standard/tests/strings/parse_str_basic2.phpt | 26 + ext/standard/tests/strings/parse_str_basic3.phpt | Bin 0 -> 5141 bytes ext/standard/tests/strings/parse_str_basic4.phpt | 87 + ext/standard/tests/strings/parse_str_error1.phpt | 32 + ext/standard/tests/strings/pathinfo.phpt | 108 + .../tests/strings/php_strip_whitespace.phpt | 52 + ext/standard/tests/strings/print_basic.phpt | 92 + ext/standard/tests/strings/print_variation1.phpt | 156 + ext/standard/tests/strings/printf.phpt | 699 + ext/standard/tests/strings/printf_64bit.phpt | 699 + ext/standard/tests/strings/printf_basic1.phpt | 62 + ext/standard/tests/strings/printf_basic2.phpt | 62 + ext/standard/tests/strings/printf_basic3.phpt | 82 + ext/standard/tests/strings/printf_basic4.phpt | 61 + ext/standard/tests/strings/printf_basic5.phpt | 61 + ext/standard/tests/strings/printf_basic6.phpt | 60 + ext/standard/tests/strings/printf_basic7.phpt | 68 + ext/standard/tests/strings/printf_basic8.phpt | 67 + ext/standard/tests/strings/printf_basic9.phpt | 83 + ext/standard/tests/strings/printf_error.phpt | 70 + ext/standard/tests/strings/printf_variation1.phpt | 354 + ext/standard/tests/strings/printf_variation2.phpt | 281 + .../strings/quoted_printable_decode_basic.phpt | 25 + .../strings/quoted_printable_decode_error.phpt | 38 + .../quoted_printable_decode_variation1.phpt | 191 + .../tests/strings/quoted_printable_encode_001.phpt | 33 + .../tests/strings/quoted_printable_encode_002.phpt | Bin 0 -> 7292 bytes ext/standard/tests/strings/quotemeta_basic.phpt | 23 + ext/standard/tests/strings/quotemeta_error.phpt | 34 + ext/standard/tests/strings/rtrim.phpt | Bin 0 -> 2446 bytes ext/standard/tests/strings/rtrim_basic.phpt | 54 + ext/standard/tests/strings/rtrim_error.phpt | 61 + ext/standard/tests/strings/rtrim_variation1.phpt | 138 + ext/standard/tests/strings/rtrim_variation2.phpt | 138 + ext/standard/tests/strings/setlocale_basic1.phpt | 124 + ext/standard/tests/strings/setlocale_basic2.phpt | 129 + ext/standard/tests/strings/setlocale_basic3.phpt | 103 + ext/standard/tests/strings/setlocale_error.phpt | 69 + .../tests/strings/setlocale_variation1.phpt | 102 + .../tests/strings/setlocale_variation2.phpt | 94 + .../tests/strings/setlocale_variation3.phpt | 159 + .../tests/strings/setlocale_variation4.phpt | 157 + .../tests/strings/setlocale_variation5.phpt | 161 + ext/standard/tests/strings/sha1.phpt | 51 + ext/standard/tests/strings/sha1_basic.phpt | 70 + ext/standard/tests/strings/sha1_error.phpt | 35 + ext/standard/tests/strings/sha1_file.phpt | 119 + ext/standard/tests/strings/sha1_variation1.phpt | 157 + ext/standard/tests/strings/sha1_variation2.phpt | 160 + ext/standard/tests/strings/sha1raw.phpt | 14 + ext/standard/tests/strings/show_source_basic.phpt | 27 + .../tests/strings/show_source_variation1.phpt | 28 + .../tests/strings/show_source_variation2.phpt | 27 + ext/standard/tests/strings/similar_text_basic.phpt | 39 + ext/standard/tests/strings/similar_text_error.phpt | 29 + ext/standard/tests/strings/soundex.phpt | 55 + ext/standard/tests/strings/soundex_basic.phpt | 46 + ext/standard/tests/strings/soundex_error.phpt | 34 + ext/standard/tests/strings/sprintf_basic1.phpt | 41 + ext/standard/tests/strings/sprintf_basic2.phpt | 42 + ext/standard/tests/strings/sprintf_basic3.phpt | 53 + ext/standard/tests/strings/sprintf_basic4.phpt | 42 + ext/standard/tests/strings/sprintf_basic5.phpt | 42 + ext/standard/tests/strings/sprintf_basic6.phpt | 41 + ext/standard/tests/strings/sprintf_basic7.phpt | 48 + .../tests/strings/sprintf_basic7_64bit.phpt | 44 + ext/standard/tests/strings/sprintf_basic8.phpt | 47 + .../tests/strings/sprintf_basic8_64bit.phpt | 43 + ext/standard/tests/strings/sprintf_basic9.phpt | 54 + ext/standard/tests/strings/sprintf_error.phpt | 64 + ext/standard/tests/strings/sprintf_f.phpt | 40 + ext/standard/tests/strings/sprintf_f_2.phpt | 116 + ext/standard/tests/strings/sprintf_f_3.phpt | 23 + ext/standard/tests/strings/sprintf_variation1.phpt | 270 + .../tests/strings/sprintf_variation10.phpt | 327 + .../tests/strings/sprintf_variation11.phpt | 79 + .../tests/strings/sprintf_variation12.phpt | 263 + .../tests/strings/sprintf_variation13.phpt | 358 + .../tests/strings/sprintf_variation14.phpt | 102 + .../tests/strings/sprintf_variation15.phpt | Bin 0 -> 7416 bytes .../tests/strings/sprintf_variation16.phpt | 278 + .../tests/strings/sprintf_variation17.phpt | 78 + .../tests/strings/sprintf_variation18.phpt | 232 + .../tests/strings/sprintf_variation19.phpt | 326 + ext/standard/tests/strings/sprintf_variation2.phpt | 221 + .../tests/strings/sprintf_variation20.phpt | 102 + .../tests/strings/sprintf_variation21.phpt | Bin 0 -> 5046 bytes .../tests/strings/sprintf_variation22.phpt | Bin 0 -> 2517 bytes .../tests/strings/sprintf_variation23.phpt | 78 + .../tests/strings/sprintf_variation24.phpt | Bin 0 -> 3464 bytes .../tests/strings/sprintf_variation25.phpt | Bin 0 -> 4657 bytes .../tests/strings/sprintf_variation26.phpt | Bin 0 -> 1699 bytes .../tests/strings/sprintf_variation27.phpt | Bin 0 -> 2693 bytes .../tests/strings/sprintf_variation28.phpt | 332 + .../tests/strings/sprintf_variation28_64bit.phpt | 328 + .../tests/strings/sprintf_variation29.phpt | 172 + .../tests/strings/sprintf_variation29_64bit.phpt | 168 + ext/standard/tests/strings/sprintf_variation3.phpt | 325 + .../tests/strings/sprintf_variation30.phpt | 78 + .../tests/strings/sprintf_variation31.phpt | 246 + .../tests/strings/sprintf_variation32.phpt | 342 + .../tests/strings/sprintf_variation33.phpt | 102 + .../tests/strings/sprintf_variation34.phpt | 332 + .../tests/strings/sprintf_variation34_64bit.phpt | 328 + .../tests/strings/sprintf_variation35.phpt | 237 + .../tests/strings/sprintf_variation35_64bit.phpt | 233 + .../tests/strings/sprintf_variation36.phpt | 78 + .../tests/strings/sprintf_variation37.phpt | 230 + .../tests/strings/sprintf_variation38.phpt | 326 + .../tests/strings/sprintf_variation39.phpt | 102 + ext/standard/tests/strings/sprintf_variation4.phpt | 237 + .../tests/strings/sprintf_variation40.phpt | 333 + .../tests/strings/sprintf_variation40_64bit.phpt | 329 + .../tests/strings/sprintf_variation41.phpt | 316 + .../tests/strings/sprintf_variation41_64bit.phpt | 312 + .../tests/strings/sprintf_variation42.phpt | 79 + .../tests/strings/sprintf_variation43.phpt | 262 + .../tests/strings/sprintf_variation44.phpt | 365 + .../tests/strings/sprintf_variation44_64bit.phpt | 361 + .../tests/strings/sprintf_variation45.phpt | 102 + .../tests/strings/sprintf_variation46.phpt | 326 + .../tests/strings/sprintf_variation47.phpt | 343 + .../tests/strings/sprintf_variation48.phpt | 78 + .../tests/strings/sprintf_variation49.phpt | 278 + .../tests/strings/sprintf_variation4_64bit.phpt | 233 + ext/standard/tests/strings/sprintf_variation5.phpt | 73 + .../tests/strings/sprintf_variation50.phpt | 343 + .../tests/strings/sprintf_variation51.phpt | 102 + .../tests/strings/sprintf_variation52.phpt | 65 + .../tests/strings/sprintf_variation53.phpt | 70 + ext/standard/tests/strings/sprintf_variation6.phpt | 278 + ext/standard/tests/strings/sprintf_variation7.phpt | 102 + ext/standard/tests/strings/sprintf_variation8.phpt | 374 + ext/standard/tests/strings/sprintf_variation9.phpt | 519 + ext/standard/tests/strings/sscanf_basic1.phpt | 44 + ext/standard/tests/strings/sscanf_basic2.phpt | 44 + ext/standard/tests/strings/sscanf_basic3.phpt | 43 + ext/standard/tests/strings/sscanf_basic4.phpt | 43 + ext/standard/tests/strings/sscanf_basic5.phpt | 58 + ext/standard/tests/strings/sscanf_basic6.phpt | 53 + ext/standard/tests/strings/sscanf_basic7.phpt | 47 + ext/standard/tests/strings/sscanf_basic8.phpt | 65 + ext/standard/tests/strings/sscanf_error.phpt | 44 + ext/standard/tests/strings/sscanf_variation1.phpt | 169 + ext/standard/tests/strings/sscanf_variation2.phpt | 153 + ext/standard/tests/strings/str_getcsv_001.phpt | 115 + ext/standard/tests/strings/str_ireplace.phpt | 101 + ext/standard/tests/strings/str_pad.phpt | Bin 0 -> 9818 bytes ext/standard/tests/strings/str_pad_variation1.phpt | 140 + ext/standard/tests/strings/str_pad_variation2.phpt | 139 + ext/standard/tests/strings/str_pad_variation3.phpt | 153 + ext/standard/tests/strings/str_pad_variation4.phpt | 168 + ext/standard/tests/strings/str_pad_variation5.phpt | 34 + ext/standard/tests/strings/str_repeat.phpt | Bin 0 -> 16786 bytes ext/standard/tests/strings/str_replace.phpt | 957 ++ ext/standard/tests/strings/str_replace_basic.phpt | 49 + ext/standard/tests/strings/str_replace_error.phpt | 41 + .../tests/strings/str_replace_variation1.phpt | 392 + .../tests/strings/str_replace_variation2.phpt | Bin 0 -> 12679 bytes .../tests/strings/str_replace_variation3.phpt | 227 + ext/standard/tests/strings/str_rot13_basic.phpt | 55 + ext/standard/tests/strings/str_rot13_error.phpt | 32 + ext/standard/tests/strings/str_shuffle.phpt | 12 + ext/standard/tests/strings/str_shuffle_basic.phpt | 59 + ext/standard/tests/strings/str_shuffle_error.phpt | 33 + .../tests/strings/str_shuffle_variation1.phpt | 135 + ext/standard/tests/strings/str_split_basic.phpt | 91 + ext/standard/tests/strings/str_split_error.phpt | 38 + .../tests/strings/str_split_variation1.phpt | 241 + .../tests/strings/str_split_variation2.phpt | 290 + .../tests/strings/str_split_variation2_64bit.phpt | 291 + .../tests/strings/str_split_variation3.phpt | Bin 0 -> 3006 bytes .../tests/strings/str_split_variation4.phpt | 196 + .../tests/strings/str_split_variation5.phpt | 176 + .../tests/strings/str_split_variation6.phpt | 166 + .../tests/strings/str_split_variation6_64bit.phpt | 167 + .../tests/strings/str_split_variation7.phpt | 144 + .../tests/strings/str_split_variation7_64bit.phpt | 145 + ext/standard/tests/strings/str_word_count.phpt | 249 + ext/standard/tests/strings/str_word_count1.phpt | 26 + ext/standard/tests/strings/strcasecmp.phpt | Bin 0 -> 22268 bytes ext/standard/tests/strings/strcmp.phpt | Bin 0 -> 20034 bytes ext/standard/tests/strings/strcoll.phpt | 21 + ext/standard/tests/strings/strcoll_error.phpt | 44 + ext/standard/tests/strings/strcspn.phpt | 20 + ext/standard/tests/strings/strcspn_basic.phpt | 41 + ext/standard/tests/strings/strcspn_error.phpt | 57 + ext/standard/tests/strings/strcspn_variation1.phpt | 273 + .../tests/strings/strcspn_variation10.phpt | 272 + .../tests/strings/strcspn_variation11.phpt | 1306 ++ .../tests/strings/strcspn_variation12.phpt | 2482 +++ ext/standard/tests/strings/strcspn_variation2.phpt | 272 + ext/standard/tests/strings/strcspn_variation3.phpt | 243 + ext/standard/tests/strings/strcspn_variation4.phpt | 196 + ext/standard/tests/strings/strcspn_variation5.phpt | Bin 0 -> 2421 bytes ext/standard/tests/strings/strcspn_variation6.phpt | 177 + ext/standard/tests/strings/strcspn_variation7.phpt | 612 + ext/standard/tests/strings/strcspn_variation8.phpt | 1892 +++ ext/standard/tests/strings/strcspn_variation9.phpt | Bin 0 -> 2539 bytes ext/standard/tests/strings/strings001.phpt | 12 + ext/standard/tests/strings/strip_tags.phpt | 27 + ext/standard/tests/strings/strip_tags_basic1.phpt | 75 + ext/standard/tests/strings/strip_tags_basic2.phpt | 61 + ext/standard/tests/strings/strip_tags_error.phpt | 40 + .../tests/strings/strip_tags_variation1.phpt | 159 + .../tests/strings/strip_tags_variation10.phpt | 55 + .../tests/strings/strip_tags_variation11.phpt | 41 + .../tests/strings/strip_tags_variation2.phpt | 159 + .../tests/strings/strip_tags_variation3.phpt | 159 + .../tests/strings/strip_tags_variation4.phpt | 74 + .../tests/strings/strip_tags_variation5.phpt | 104 + .../tests/strings/strip_tags_variation6.phpt | 47 + .../tests/strings/strip_tags_variation7.phpt | 72 + .../tests/strings/strip_tags_variation8.phpt | 59 + .../tests/strings/strip_tags_variation9.phpt | 54 + .../tests/strings/stripcslashes_basic.phpt | 28 + .../tests/strings/stripcslashes_error.phpt | 34 + .../tests/strings/stripcslashes_variation1.phpt | 173 + ext/standard/tests/strings/stripos.phpt | 55 + ext/standard/tests/strings/stripos_basic1.phpt | 48 + ext/standard/tests/strings/stripos_basic2.phpt | 52 + ext/standard/tests/strings/stripos_error.phpt | 35 + ext/standard/tests/strings/stripos_variation1.phpt | 218 + .../tests/strings/stripos_variation10.phpt | 188 + .../tests/strings/stripos_variation11.phpt | 215 + .../tests/strings/stripos_variation12.phpt | 47 + .../tests/strings/stripos_variation13.phpt | 49 + .../tests/strings/stripos_variation14.phpt | 155 + .../tests/strings/stripos_variation15.phpt | 171 + ext/standard/tests/strings/stripos_variation2.phpt | 226 + ext/standard/tests/strings/stripos_variation3.phpt | 37 + ext/standard/tests/strings/stripos_variation4.phpt | 41 + ext/standard/tests/strings/stripos_variation5.phpt | 34 + ext/standard/tests/strings/stripos_variation6.phpt | 35 + ext/standard/tests/strings/stripos_variation7.phpt | 34 + ext/standard/tests/strings/stripos_variation8.phpt | 216 + ext/standard/tests/strings/stripos_variation9.phpt | 184 + ext/standard/tests/strings/stripslashes_basic.phpt | Bin 0 -> 2036 bytes ext/standard/tests/strings/stripslashes_error.phpt | 43 + .../tests/strings/stripslashes_variation1.phpt | 172 + .../tests/strings/stripslashes_variation2.phpt | Bin 0 -> 9548 bytes .../tests/strings/stripslashes_variation3.phpt | 124 + .../tests/strings/stripslashes_variation4.phpt | 133 + ext/standard/tests/strings/stristr.phpt | 43 + ext/standard/tests/strings/stristr2.phpt | 25 + ext/standard/tests/strings/stristr_basic.phpt | 36 + ext/standard/tests/strings/stristr_error.phpt | 60 + ext/standard/tests/strings/stristr_variation1.phpt | 133 + ext/standard/tests/strings/stristr_variation2.phpt | 135 + ext/standard/tests/strings/strlen.phpt | Bin 0 -> 7090 bytes ext/standard/tests/strings/strlen_basic.phpt | 24 + ext/standard/tests/strings/strlen_error.phpt | 33 + ext/standard/tests/strings/strlen_variation1.phpt | 137 + .../tests/strings/strnatcasecmp_basic.phpt | 51 + .../tests/strings/strnatcasecmp_error.phpt | 33 + .../tests/strings/strnatcasecmp_variation1.phpt | 56 + ext/standard/tests/strings/strnatcmp_basic.phpt | 80 + ext/standard/tests/strings/strnatcmp_error.phpt | 34 + ext/standard/tests/strings/strncasecmp_basic.phpt | 46 + ext/standard/tests/strings/strncasecmp_error.phpt | 52 + .../tests/strings/strncasecmp_variation1.phpt | 135 + .../tests/strings/strncasecmp_variation10.phpt | 188 + .../tests/strings/strncasecmp_variation11.phpt | 189 + .../tests/strings/strncasecmp_variation2.phpt | 63 + .../tests/strings/strncasecmp_variation3.phpt | 39 + .../tests/strings/strncasecmp_variation4.phpt | 189 + .../tests/strings/strncasecmp_variation5.phpt | 163 + .../tests/strings/strncasecmp_variation6.phpt | 810 + .../tests/strings/strncasecmp_variation7.phpt | 27 + .../tests/strings/strncasecmp_variation8.phpt | 52 + .../tests/strings/strncasecmp_variation9.phpt | 92 + ext/standard/tests/strings/strncmp_basic.phpt | 46 + ext/standard/tests/strings/strncmp_error.phpt | 45 + ext/standard/tests/strings/strncmp_variation1.phpt | 135 + ext/standard/tests/strings/strncmp_variation2.phpt | 63 + ext/standard/tests/strings/strncmp_variation3.phpt | 39 + ext/standard/tests/strings/strncmp_variation4.phpt | 192 + ext/standard/tests/strings/strncmp_variation5.phpt | 177 + ext/standard/tests/strings/strncmp_variation6.phpt | 811 + ext/standard/tests/strings/strncmp_variation7.phpt | 24 + ext/standard/tests/strings/strncmp_variation8.phpt | 52 + ext/standard/tests/strings/strncmp_variation9.phpt | 61 + ext/standard/tests/strings/strpbrk_basic.phpt | 41 + ext/standard/tests/strings/strpbrk_error.phpt | 57 + ext/standard/tests/strings/strpos.phpt | Bin 0 -> 9981 bytes ext/standard/tests/strings/strpos_number.phpt | 15 + ext/standard/tests/strings/strrchr.phpt | 22 + ext/standard/tests/strings/strrchr_basic.phpt | 57 + ext/standard/tests/strings/strrchr_error.phpt | 40 + ext/standard/tests/strings/strrchr_variation1.phpt | Bin 0 -> 4406 bytes .../tests/strings/strrchr_variation10.phpt | 200 + .../tests/strings/strrchr_variation11.phpt | 159 + .../tests/strings/strrchr_variation12.phpt | Bin 0 -> 1128 bytes ext/standard/tests/strings/strrchr_variation2.phpt | 220 + ext/standard/tests/strings/strrchr_variation3.phpt | 43 + ext/standard/tests/strings/strrchr_variation4.phpt | 58 + ext/standard/tests/strings/strrchr_variation5.phpt | 50 + ext/standard/tests/strings/strrchr_variation6.phpt | 45 + ext/standard/tests/strings/strrchr_variation7.phpt | 44 + ext/standard/tests/strings/strrchr_variation8.phpt | 41 + ext/standard/tests/strings/strrchr_variation9.phpt | 198 + ext/standard/tests/strings/strrev.phpt | 19 + ext/standard/tests/strings/strrev_basic.phpt | 47 + ext/standard/tests/strings/strrev_error.phpt | 27 + ext/standard/tests/strings/strrev_variation1.phpt | Bin 0 -> 2941 bytes ext/standard/tests/strings/strrev_variation2.phpt | Bin 0 -> 2955 bytes ext/standard/tests/strings/strrev_variation3.phpt | Bin 0 -> 1628 bytes ext/standard/tests/strings/strrev_variation4.phpt | 182 + ext/standard/tests/strings/strripos.phpt | 33 + ext/standard/tests/strings/strripos_basic1.phpt | 51 + ext/standard/tests/strings/strripos_basic2.phpt | 64 + ext/standard/tests/strings/strripos_error.phpt | 34 + ext/standard/tests/strings/strripos_offset.phpt | 45 + .../tests/strings/strripos_variation1.phpt | 254 + .../tests/strings/strripos_variation2.phpt | 260 + .../tests/strings/strripos_variation3.phpt | 59 + .../tests/strings/strripos_variation4.phpt | 41 + .../tests/strings/strripos_variation5.phpt | 34 + ext/standard/tests/strings/strrpos.phpt | 32 + ext/standard/tests/strings/strrpos_basic1.phpt | 45 + ext/standard/tests/strings/strrpos_basic2.phpt | 50 + ext/standard/tests/strings/strrpos_error.phpt | 34 + ext/standard/tests/strings/strrpos_offset.phpt | 41 + ext/standard/tests/strings/strrpos_variation1.phpt | 182 + .../tests/strings/strrpos_variation10.phpt | 162 + .../tests/strings/strrpos_variation11.phpt | 199 + .../tests/strings/strrpos_variation12.phpt | 47 + .../tests/strings/strrpos_variation13.phpt | 49 + .../tests/strings/strrpos_variation14.phpt | 153 + .../tests/strings/strrpos_variation15.phpt | 171 + ext/standard/tests/strings/strrpos_variation2.phpt | 186 + ext/standard/tests/strings/strrpos_variation3.phpt | 37 + ext/standard/tests/strings/strrpos_variation4.phpt | 41 + ext/standard/tests/strings/strrpos_variation5.phpt | 34 + ext/standard/tests/strings/strrpos_variation6.phpt | 35 + ext/standard/tests/strings/strrpos_variation7.phpt | 32 + ext/standard/tests/strings/strrpos_variation8.phpt | 59 + ext/standard/tests/strings/strrpos_variation9.phpt | 184 + ext/standard/tests/strings/strspn.phpt | 18 + ext/standard/tests/strings/strspn_basic.phpt | 41 + ext/standard/tests/strings/strspn_error.phpt | 57 + ext/standard/tests/strings/strspn_variation1.phpt | 273 + ext/standard/tests/strings/strspn_variation10.phpt | 274 + ext/standard/tests/strings/strspn_variation11.phpt | 1306 ++ ext/standard/tests/strings/strspn_variation12.phpt | 2878 ++++ ext/standard/tests/strings/strspn_variation2.phpt | 272 + ext/standard/tests/strings/strspn_variation3.phpt | 243 + ext/standard/tests/strings/strspn_variation4.phpt | 196 + ext/standard/tests/strings/strspn_variation5.phpt | Bin 0 -> 2415 bytes ext/standard/tests/strings/strspn_variation6.phpt | 179 + ext/standard/tests/strings/strspn_variation7.phpt | 612 + ext/standard/tests/strings/strspn_variation8.phpt | 1894 +++ ext/standard/tests/strings/strspn_variation9.phpt | Bin 0 -> 2538 bytes ext/standard/tests/strings/strstr.phpt | Bin 0 -> 10539 bytes ext/standard/tests/strings/strstr2.phpt | 40 + ext/standard/tests/strings/strtok_basic.phpt | 63 + ext/standard/tests/strings/strtok_error.phpt | 55 + ext/standard/tests/strings/strtok_variation1.phpt | 174 + ext/standard/tests/strings/strtok_variation2.phpt | 174 + ext/standard/tests/strings/strtok_variation3.phpt | 150 + ext/standard/tests/strings/strtok_variation4.phpt | 110 + ext/standard/tests/strings/strtok_variation5.phpt | 150 + ext/standard/tests/strings/strtok_variation6.phpt | 160 + ext/standard/tests/strings/strtok_variation7.phpt | 108 + ext/standard/tests/strings/strtolower-win32.phpt | Bin 0 -> 4878 bytes ext/standard/tests/strings/strtolower.phpt | Bin 0 -> 3889 bytes ext/standard/tests/strings/strtoupper.phpt | 20 + ext/standard/tests/strings/strtoupper1-win32.phpt | Bin 0 -> 4889 bytes ext/standard/tests/strings/strtoupper1.phpt | Bin 0 -> 3900 bytes ext/standard/tests/strings/strtr.phpt | 10 + ext/standard/tests/strings/strtr_basic.phpt | 54 + ext/standard/tests/strings/strtr_error.phpt | 41 + ext/standard/tests/strings/strtr_variation1.phpt | 86 + ext/standard/tests/strings/strtr_variation2.phpt | 90 + ext/standard/tests/strings/strtr_variation3.phpt | 103 + ext/standard/tests/strings/strtr_variation4.phpt | 79 + ext/standard/tests/strings/strtr_variation5.phpt | 139 + ext/standard/tests/strings/strtr_variation6.phpt | 136 + ext/standard/tests/strings/strtr_variation7.phpt | 158 + ext/standard/tests/strings/strtr_variation8.phpt | 179 + ext/standard/tests/strings/strtr_variation9.phpt | 225 + ext/standard/tests/strings/strval.phpt | 26 + ext/standard/tests/strings/strval_basic.phpt | 77 + ext/standard/tests/strings/strval_error.phpt | 51 + ext/standard/tests/strings/strval_variation1.phpt | 190 + ext/standard/tests/strings/strval_variation2.phpt | 82 + ext/standard/tests/strings/substr.phpt | Bin 0 -> 4770 bytes ext/standard/tests/strings/substr_compare.phpt | 41 + ext/standard/tests/strings/substr_count_basic.phpt | 33 + ext/standard/tests/strings/substr_count_error.phpt | 65 + .../tests/strings/substr_count_variation_001.phpt | 99 + .../tests/strings/substr_count_variation_002.phpt | 53 + ext/standard/tests/strings/substr_replace.phpt | 810 + .../tests/strings/substr_replace_array.phpt | 19 + .../tests/strings/substr_replace_error.phpt | 70 + ext/standard/tests/strings/trim.phpt | 27 + ext/standard/tests/strings/trim1.phpt | Bin 0 -> 2046 bytes ext/standard/tests/strings/trim_basic.phpt | 45 + ext/standard/tests/strings/trim_error.phpt | 61 + ext/standard/tests/strings/trim_variation1.phpt | 138 + ext/standard/tests/strings/trim_variation2.phpt | 138 + ext/standard/tests/strings/ucfirst.phpt | Bin 0 -> 6105 bytes ext/standard/tests/strings/ucwords_basic.phpt | 83 + ext/standard/tests/strings/ucwords_error.phpt | 41 + ext/standard/tests/strings/ucwords_variation1.phpt | 201 + ext/standard/tests/strings/ucwords_variation2.phpt | 96 + ext/standard/tests/strings/ucwords_variation3.phpt | 97 + ext/standard/tests/strings/ucwords_variation4.phpt | 124 + ext/standard/tests/strings/unpack.phpt | 11 + ext/standard/tests/strings/unpack_error.phpt | 42 + ext/standard/tests/strings/url_t.phpt | 712 + ext/standard/tests/strings/uuencode.phpt | 40 + ext/standard/tests/strings/vfprintf_basic.phpt | 71 + ext/standard/tests/strings/vfprintf_basic1.phpt | 49 + ext/standard/tests/strings/vfprintf_basic2.phpt | 53 + ext/standard/tests/strings/vfprintf_basic3.phpt | 64 + ext/standard/tests/strings/vfprintf_basic4.phpt | 47 + ext/standard/tests/strings/vfprintf_basic5.phpt | 48 + ext/standard/tests/strings/vfprintf_basic6.phpt | 49 + ext/standard/tests/strings/vfprintf_basic7.phpt | 53 + .../tests/strings/vfprintf_basic7_64bit.phpt | 51 + ext/standard/tests/strings/vfprintf_basic8.phpt | 46 + ext/standard/tests/strings/vfprintf_basic9.phpt | 60 + ext/standard/tests/strings/vfprintf_error1.phpt | 46 + ext/standard/tests/strings/vfprintf_error2.phpt | 48 + ext/standard/tests/strings/vfprintf_error3.phpt | 54 + ext/standard/tests/strings/vfprintf_error4.phpt | 43 + .../tests/strings/vfprintf_variation1.phpt | 86 + .../tests/strings/vfprintf_variation10.phpt | Bin 0 -> 2963 bytes .../tests/strings/vfprintf_variation11.phpt | 88 + .../tests/strings/vfprintf_variation11_64bit.phpt | 88 + .../tests/strings/vfprintf_variation12.phpt | 125 + .../tests/strings/vfprintf_variation12_64bit.phpt | 125 + .../tests/strings/vfprintf_variation13.phpt | 88 + .../tests/strings/vfprintf_variation13_64bit.phpt | 88 + .../tests/strings/vfprintf_variation14.phpt | 125 + .../tests/strings/vfprintf_variation14_64bit.phpt | 125 + .../tests/strings/vfprintf_variation15.phpt | 75 + .../tests/strings/vfprintf_variation15_64bit.phpt | 75 + .../tests/strings/vfprintf_variation16.phpt | 112 + .../tests/strings/vfprintf_variation16_64bit.phpt | 112 + .../tests/strings/vfprintf_variation17.phpt | 70 + .../tests/strings/vfprintf_variation18.phpt | 107 + .../tests/strings/vfprintf_variation19.phpt | 94 + .../tests/strings/vfprintf_variation19_64bit.phpt | 94 + .../tests/strings/vfprintf_variation20.phpt | 175 + .../tests/strings/vfprintf_variation21.phpt | 168 + .../tests/strings/vfprintf_variation3.phpt | 87 + .../tests/strings/vfprintf_variation4.phpt | 113 + .../tests/strings/vfprintf_variation4_64bit.phpt | 113 + .../tests/strings/vfprintf_variation5.phpt | 86 + .../tests/strings/vfprintf_variation6.phpt | 108 + .../tests/strings/vfprintf_variation7.phpt | Bin 0 -> 2391 bytes .../tests/strings/vfprintf_variation8.phpt | 111 + .../tests/strings/vfprintf_variation9.phpt | Bin 0 -> 1857 bytes ext/standard/tests/strings/vprintf_basic1.phpt | 43 + ext/standard/tests/strings/vprintf_basic2.phpt | 47 + ext/standard/tests/strings/vprintf_basic3.phpt | 66 + ext/standard/tests/strings/vprintf_basic4.phpt | 43 + ext/standard/tests/strings/vprintf_basic5.phpt | 43 + ext/standard/tests/strings/vprintf_basic6.phpt | 43 + ext/standard/tests/strings/vprintf_basic7.phpt | 47 + .../tests/strings/vprintf_basic7_64bit.phpt | 46 + ext/standard/tests/strings/vprintf_basic8.phpt | 43 + ext/standard/tests/strings/vprintf_basic9.phpt | 62 + ext/standard/tests/strings/vprintf_error.phpt | 46 + ext/standard/tests/strings/vprintf_variation1.phpt | 219 + .../tests/strings/vprintf_variation10.phpt | Bin 0 -> 2783 bytes .../tests/strings/vprintf_variation11.phpt | 94 + .../tests/strings/vprintf_variation11_64bit.phpt | 94 + .../tests/strings/vprintf_variation12.phpt | 125 + .../tests/strings/vprintf_variation12_64bit.phpt | 125 + .../tests/strings/vprintf_variation13.phpt | 94 + .../tests/strings/vprintf_variation13_64bit.phpt | 94 + .../tests/strings/vprintf_variation14.phpt | 126 + .../tests/strings/vprintf_variation14_64bit.phpt | 126 + .../tests/strings/vprintf_variation15.phpt | 75 + .../tests/strings/vprintf_variation15_64bit.phpt | 75 + .../tests/strings/vprintf_variation16.phpt | 109 + .../tests/strings/vprintf_variation16_64bit.phpt | 110 + .../tests/strings/vprintf_variation17.phpt | 71 + .../tests/strings/vprintf_variation18.phpt | 106 + .../tests/strings/vprintf_variation19.phpt | 104 + .../tests/strings/vprintf_variation19_64bit.phpt | 104 + ext/standard/tests/strings/vprintf_variation2.phpt | 202 + ext/standard/tests/strings/vprintf_variation3.phpt | 91 + ext/standard/tests/strings/vprintf_variation4.phpt | 110 + .../tests/strings/vprintf_variation4_64bit.phpt | 110 + ext/standard/tests/strings/vprintf_variation5.phpt | 91 + ext/standard/tests/strings/vprintf_variation6.phpt | 106 + ext/standard/tests/strings/vprintf_variation7.phpt | Bin 0 -> 2230 bytes ext/standard/tests/strings/vprintf_variation8.phpt | 109 + ext/standard/tests/strings/vprintf_variation9.phpt | Bin 0 -> 1698 bytes ext/standard/tests/strings/vsprintf_basic1.phpt | 33 + ext/standard/tests/strings/vsprintf_basic2.phpt | 36 + ext/standard/tests/strings/vsprintf_basic3.phpt | 45 + ext/standard/tests/strings/vsprintf_basic4.phpt | 32 + ext/standard/tests/strings/vsprintf_basic5.phpt | 32 + ext/standard/tests/strings/vsprintf_basic6.phpt | 32 + ext/standard/tests/strings/vsprintf_basic7.phpt | 36 + .../tests/strings/vsprintf_basic7_64bit.phpt | 36 + ext/standard/tests/strings/vsprintf_basic8.phpt | 32 + ext/standard/tests/strings/vsprintf_basic9.phpt | 45 + ext/standard/tests/strings/vsprintf_error.phpt | 46 + .../tests/strings/vsprintf_variation1.phpt | 191 + .../tests/strings/vsprintf_variation10.phpt | Bin 0 -> 2779 bytes .../tests/strings/vsprintf_variation11.phpt | 85 + .../tests/strings/vsprintf_variation11_64bit.phpt | 85 + .../tests/strings/vsprintf_variation12.phpt | 118 + .../tests/strings/vsprintf_variation12_64bit.phpt | 118 + .../tests/strings/vsprintf_variation13.phpt | 85 + .../tests/strings/vsprintf_variation13_64bit.phpt | 85 + .../tests/strings/vsprintf_variation14.phpt | 119 + .../tests/strings/vsprintf_variation14_64bit.phpt | 119 + .../tests/strings/vsprintf_variation15.phpt | 68 + .../tests/strings/vsprintf_variation15_64bit.phpt | 68 + .../tests/strings/vsprintf_variation16.phpt | 104 + .../tests/strings/vsprintf_variation16_64bit.phpt | 104 + .../tests/strings/vsprintf_variation17.phpt | 64 + .../tests/strings/vsprintf_variation18.phpt | 100 + .../tests/strings/vsprintf_variation19.phpt | 91 + .../tests/strings/vsprintf_variation19_64bit.phpt | 91 + .../tests/strings/vsprintf_variation2.phpt | 177 + .../tests/strings/vsprintf_variation3.phpt | 82 + .../tests/strings/vsprintf_variation4.phpt | 104 + .../tests/strings/vsprintf_variation4_64bit.phpt | 104 + .../tests/strings/vsprintf_variation5.phpt | 82 + .../tests/strings/vsprintf_variation6.phpt | 100 + .../tests/strings/vsprintf_variation7.phpt | Bin 0 -> 2238 bytes .../tests/strings/vsprintf_variation8.phpt | 103 + .../tests/strings/vsprintf_variation9.phpt | Bin 0 -> 1709 bytes ext/standard/tests/strings/wordwrap.phpt | 37 + ext/standard/tests/strings/wordwrap_basic.phpt | 47 + ext/standard/tests/strings/wordwrap_error.phpt | 78 + .../tests/strings/wordwrap_variation1.phpt | 335 + .../tests/strings/wordwrap_variation2.phpt | 340 + .../tests/strings/wordwrap_variation3.phpt | 301 + .../tests/strings/wordwrap_variation4.phpt | 144 + .../tests/strings/wordwrap_variation5.phpt | 60 + ext/standard/tests/time/001.phpt | 34 + ext/standard/tests/time/bug38524.phpt | 31 + ext/standard/tests/time/bug60222.phpt | 15 + ext/standard/tests/time/idate.phpt | 31 + ext/standard/tests/time/strptime_basic.phpt | 100 + ext/standard/tests/time/strptime_error.phpt | 55 + ext/standard/tests/time/strptime_parts.phpt | 76 + .../tests/url/base64_decode_basic_001.phpt | 24 + .../tests/url/base64_decode_basic_002.phpt | 47 + .../tests/url/base64_decode_error_001.phpt | 38 + .../tests/url/base64_decode_variation_001.phpt | 181 + .../tests/url/base64_decode_variation_002.phpt | 175 + .../tests/url/base64_encode_basic_001.phpt | 283 + .../tests/url/base64_encode_basic_002.phpt | 59 + .../tests/url/base64_encode_error_001.phpt | 37 + .../tests/url/base64_encode_variation_001.phpt | 172 + ext/standard/tests/url/bug47174.phpt | 18 + ext/standard/tests/url/bug52327.phpt | 12 + ext/standard/tests/url/bug53248.phpt | 12 + ext/standard/tests/url/bug54180.phpt | 32 + ext/standard/tests/url/bug55273.phpt | 25 + ext/standard/tests/url/bug55399.phpt | 10 + ext/standard/tests/url/bug63162.phpt | 38 + ext/standard/tests/url/get_headers_error_001.phpt | 44 + ext/standard/tests/url/get_headers_error_002.phpt | 55 + ext/standard/tests/url/parse_url_basic_001.phpt | 866 + ext/standard/tests/url/parse_url_basic_002.phpt | 125 + ext/standard/tests/url/parse_url_basic_003.phpt | 124 + ext/standard/tests/url/parse_url_basic_004.phpt | 124 + ext/standard/tests/url/parse_url_basic_005.phpt | 124 + ext/standard/tests/url/parse_url_basic_006.phpt | 124 + ext/standard/tests/url/parse_url_basic_007.phpt | 124 + ext/standard/tests/url/parse_url_basic_008.phpt | 124 + ext/standard/tests/url/parse_url_basic_009.phpt | 124 + ext/standard/tests/url/parse_url_basic_010.phpt | 31 + ext/standard/tests/url/parse_url_error_001.phpt | 38 + ext/standard/tests/url/parse_url_error_002.phpt | 47 + .../tests/url/parse_url_relative_scheme.phpt | 11 + .../tests/url/parse_url_variation_001.phpt | 226 + .../tests/url/parse_url_variation_002_32bit.phpt | 205 + .../tests/url/parse_url_variation_002_64bit.phpt | 189 + ext/standard/tests/url/rawurldecode_error_001.phpt | 39 + .../tests/url/rawurldecode_variation_001.phpt | 173 + ext/standard/tests/url/rawurlencode_error_001.phpt | 39 + .../tests/url/rawurlencode_variation_001.phpt | 173 + ext/standard/tests/url/urldecode_error_001.phpt | 39 + .../tests/url/urldecode_variation_001.phpt | 173 + ext/standard/tests/url/urlencode_error_001.phpt | 39 + .../tests/url/urlencode_variation_001.phpt | 173 + ext/standard/tests/url/urls.inc | 109 + ext/standard/tests/versioning/php_sapi_name.phpt | 9 + .../versioning/php_sapi_name_variation001.phpt | 14 + ext/standard/tests/versioning/version_compare.phpt | 795 + ext/standard/tests/zend_logo_guid.phpt | 12 + ext/standard/type.c | 396 + ext/standard/uniqid.c | 96 + ext/standard/uniqid.h | 28 + ext/standard/url.c | 785 + ext/standard/url.h | 68 + ext/standard/url_scanner_ex.c | 1054 ++ ext/standard/url_scanner_ex.h | 58 + ext/standard/url_scanner_ex.re | 548 + ext/standard/user_filters.c | 623 + ext/standard/uuencode.c | 233 + ext/standard/var.c | 994 ++ ext/standard/var_unserializer.c | 1182 ++ ext/standard/var_unserializer.re | 764 + ext/standard/versioning.c | 255 + ext/standard/winver.h | 97 + 3648 files changed, 591579 insertions(+) create mode 100644 ext/standard/Makefile.frag create mode 100644 ext/standard/array.c create mode 100644 ext/standard/assert.c create mode 100644 ext/standard/base64.c create mode 100644 ext/standard/base64.h create mode 100644 ext/standard/basic_functions.c create mode 100644 ext/standard/basic_functions.h create mode 100644 ext/standard/browscap.c create mode 100644 ext/standard/config.m4 create mode 100644 ext/standard/config.w32 create mode 100644 ext/standard/crc32.c create mode 100644 ext/standard/crc32.h create mode 100644 ext/standard/credits.c create mode 100644 ext/standard/credits.h create mode 100644 ext/standard/credits_ext.h create mode 100644 ext/standard/credits_sapi.h create mode 100644 ext/standard/crypt.c create mode 100644 ext/standard/crypt_blowfish.c create mode 100644 ext/standard/crypt_blowfish.h create mode 100644 ext/standard/crypt_freesec.c create mode 100644 ext/standard/crypt_freesec.h create mode 100644 ext/standard/crypt_sha256.c create mode 100644 ext/standard/crypt_sha512.c create mode 100644 ext/standard/css.c create mode 100644 ext/standard/css.h create mode 100644 ext/standard/cyr_convert.c create mode 100644 ext/standard/cyr_convert.h create mode 100644 ext/standard/datetime.c create mode 100644 ext/standard/datetime.h create mode 100644 ext/standard/dir.c create mode 100644 ext/standard/dl.c create mode 100644 ext/standard/dl.h create mode 100644 ext/standard/dns.c create mode 100644 ext/standard/dns_win32.c create mode 100644 ext/standard/exec.c create mode 100644 ext/standard/exec.h create mode 100644 ext/standard/file.c create mode 100644 ext/standard/file.h create mode 100644 ext/standard/filestat.c create mode 100644 ext/standard/filters.c create mode 100644 ext/standard/flock_compat.c create mode 100644 ext/standard/flock_compat.h create mode 100644 ext/standard/formatted_print.c create mode 100644 ext/standard/fsock.c create mode 100644 ext/standard/fsock.h create mode 100644 ext/standard/ftok.c create mode 100644 ext/standard/ftp_fopen_wrapper.c create mode 100644 ext/standard/head.c create mode 100644 ext/standard/head.h create mode 100644 ext/standard/html.c create mode 100644 ext/standard/html.h create mode 100644 ext/standard/html_tables.h create mode 100644 ext/standard/html_tables/ents_basic.txt create mode 100644 ext/standard/html_tables/ents_basic_apos.txt create mode 100644 ext/standard/html_tables/ents_html401.txt create mode 100644 ext/standard/html_tables/ents_html5.txt create mode 100644 ext/standard/html_tables/ents_xhtml.txt create mode 100644 ext/standard/html_tables/html_table_gen.php create mode 100644 ext/standard/html_tables/mappings/8859-1.TXT create mode 100644 ext/standard/html_tables/mappings/8859-15.TXT create mode 100644 ext/standard/html_tables/mappings/8859-5.TXT create mode 100644 ext/standard/html_tables/mappings/CP1251.TXT create mode 100644 ext/standard/html_tables/mappings/CP1252.TXT create mode 100644 ext/standard/html_tables/mappings/CP866.TXT create mode 100644 ext/standard/html_tables/mappings/KOI8-R.TXT create mode 100644 ext/standard/html_tables/mappings/ROMAN.TXT create mode 100644 ext/standard/http.c create mode 100644 ext/standard/http_fopen_wrapper.c create mode 100644 ext/standard/image.c create mode 100644 ext/standard/incomplete_class.c create mode 100644 ext/standard/info.c create mode 100644 ext/standard/info.h create mode 100644 ext/standard/iptc.c create mode 100644 ext/standard/lcg.c create mode 100644 ext/standard/levenshtein.c create mode 100644 ext/standard/link.c create mode 100644 ext/standard/link_win32.c create mode 100644 ext/standard/mail.c create mode 100644 ext/standard/math.c create mode 100644 ext/standard/md5.c create mode 100644 ext/standard/md5.h create mode 100644 ext/standard/metaphone.c create mode 100644 ext/standard/microtime.c create mode 100644 ext/standard/microtime.h create mode 100644 ext/standard/pack.c create mode 100644 ext/standard/pack.h create mode 100644 ext/standard/pageinfo.c create mode 100644 ext/standard/pageinfo.h create mode 100644 ext/standard/php_array.h create mode 100644 ext/standard/php_assert.h create mode 100644 ext/standard/php_browscap.h create mode 100644 ext/standard/php_crypt.h create mode 100644 ext/standard/php_crypt_r.c create mode 100644 ext/standard/php_crypt_r.h create mode 100644 ext/standard/php_dir.h create mode 100644 ext/standard/php_dns.h create mode 100644 ext/standard/php_ext_syslog.h create mode 100644 ext/standard/php_filestat.h create mode 100644 ext/standard/php_fopen_wrapper.c create mode 100644 ext/standard/php_fopen_wrappers.h create mode 100644 ext/standard/php_ftok.h create mode 100644 ext/standard/php_http.h create mode 100644 ext/standard/php_image.h create mode 100644 ext/standard/php_incomplete_class.h create mode 100644 ext/standard/php_iptc.h create mode 100644 ext/standard/php_lcg.h create mode 100644 ext/standard/php_link.h create mode 100644 ext/standard/php_mail.h create mode 100644 ext/standard/php_math.h create mode 100644 ext/standard/php_metaphone.h create mode 100644 ext/standard/php_rand.h create mode 100644 ext/standard/php_smart_str.h create mode 100644 ext/standard/php_smart_str_public.h create mode 100644 ext/standard/php_standard.h create mode 100644 ext/standard/php_string.h create mode 100644 ext/standard/php_type.h create mode 100644 ext/standard/php_uuencode.h create mode 100644 ext/standard/php_var.h create mode 100644 ext/standard/php_versioning.h create mode 100644 ext/standard/proc_open.c create mode 100644 ext/standard/proc_open.h create mode 100644 ext/standard/quot_print.c create mode 100644 ext/standard/quot_print.h create mode 100644 ext/standard/rand.c create mode 100644 ext/standard/scanf.c create mode 100644 ext/standard/scanf.h create mode 100644 ext/standard/sha1.c create mode 100644 ext/standard/sha1.h create mode 100644 ext/standard/soundex.c create mode 100644 ext/standard/streamsfuncs.c create mode 100644 ext/standard/streamsfuncs.h create mode 100644 ext/standard/string.c create mode 100644 ext/standard/strnatcmp.c create mode 100644 ext/standard/syslog.c create mode 100644 ext/standard/tests/array/001.phpt create mode 100644 ext/standard/tests/array/002.phpt create mode 100644 ext/standard/tests/array/003.phpt create mode 100644 ext/standard/tests/array/004.phpt create mode 100644 ext/standard/tests/array/005.phpt create mode 100644 ext/standard/tests/array/006.phpt create mode 100644 ext/standard/tests/array/007.phpt create mode 100644 ext/standard/tests/array/008.phpt create mode 100644 ext/standard/tests/array/009.phpt create mode 100644 ext/standard/tests/array/array_change_key_case.phpt create mode 100644 ext/standard/tests/array/array_change_key_case_errors.phpt create mode 100644 ext/standard/tests/array/array_change_key_case_variation.phpt create mode 100644 ext/standard/tests/array/array_change_key_case_variation1.phpt create mode 100644 ext/standard/tests/array/array_change_key_case_variation2.phpt create mode 100644 ext/standard/tests/array/array_change_key_case_variation3.phpt create mode 100644 ext/standard/tests/array/array_change_key_case_variation4.phpt create mode 100644 ext/standard/tests/array/array_change_key_case_variation5.phpt create mode 100644 ext/standard/tests/array/array_change_key_case_variation6.phpt create mode 100644 ext/standard/tests/array/array_change_key_case_variation7.phpt create mode 100644 ext/standard/tests/array/array_change_key_case_variation8.phpt create mode 100644 ext/standard/tests/array/array_chunk.phpt create mode 100644 ext/standard/tests/array/array_chunk2.phpt create mode 100644 ext/standard/tests/array/array_chunk_basic1.phpt create mode 100644 ext/standard/tests/array/array_chunk_basic2.phpt create mode 100644 ext/standard/tests/array/array_chunk_error.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation1.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation10.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation11.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation12.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation13.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation14.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation15.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation16.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation17.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation18.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation19.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation2.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation20.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation21.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation22.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation23.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation24.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation25.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation26.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation27.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation28.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation29.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation3.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation30.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation31.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation32.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation4.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation5.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation6.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation7.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation8.phpt create mode 100644 ext/standard/tests/array/array_chunk_variation9.phpt create mode 100644 ext/standard/tests/array/array_combine.phpt create mode 100644 ext/standard/tests/array/array_combine_basic.phpt create mode 100644 ext/standard/tests/array/array_combine_error1.phpt create mode 100644 ext/standard/tests/array/array_combine_error2.phpt create mode 100644 ext/standard/tests/array/array_combine_variation1.phpt create mode 100644 ext/standard/tests/array/array_combine_variation2.phpt create mode 100644 ext/standard/tests/array/array_combine_variation3.phpt create mode 100644 ext/standard/tests/array/array_combine_variation4.phpt create mode 100644 ext/standard/tests/array/array_combine_variation5.phpt create mode 100644 ext/standard/tests/array/array_combine_variation6.phpt create mode 100644 ext/standard/tests/array/array_count_values.phpt create mode 100644 ext/standard/tests/array/array_count_values2.phpt create mode 100644 ext/standard/tests/array/array_count_values_error.phpt create mode 100644 ext/standard/tests/array/array_count_values_variation.phpt create mode 100644 ext/standard/tests/array/array_diff_1.phpt create mode 100644 ext/standard/tests/array/array_diff_assoc.phpt create mode 100644 ext/standard/tests/array/array_diff_assoc_basic.phpt create mode 100644 ext/standard/tests/array/array_diff_assoc_error.phpt create mode 100644 ext/standard/tests/array/array_diff_assoc_variation1.phpt create mode 100644 ext/standard/tests/array/array_diff_assoc_variation10.phpt create mode 100644 ext/standard/tests/array/array_diff_assoc_variation2.phpt create mode 100644 ext/standard/tests/array/array_diff_assoc_variation3.phpt create mode 100644 ext/standard/tests/array/array_diff_assoc_variation4.phpt create mode 100644 ext/standard/tests/array/array_diff_assoc_variation5.phpt create mode 100644 ext/standard/tests/array/array_diff_assoc_variation6.phpt create mode 100644 ext/standard/tests/array/array_diff_assoc_variation7.phpt create mode 100644 ext/standard/tests/array/array_diff_assoc_variation8.phpt create mode 100644 ext/standard/tests/array/array_diff_assoc_variation9.phpt create mode 100644 ext/standard/tests/array/array_diff_basic.phpt create mode 100644 ext/standard/tests/array/array_diff_error.phpt create mode 100644 ext/standard/tests/array/array_diff_key.phpt create mode 100644 ext/standard/tests/array/array_diff_key2.phpt create mode 100644 ext/standard/tests/array/array_diff_key_basic.phpt create mode 100644 ext/standard/tests/array/array_diff_key_error.phpt create mode 100644 ext/standard/tests/array/array_diff_key_variation1.phpt create mode 100644 ext/standard/tests/array/array_diff_key_variation2.phpt create mode 100644 ext/standard/tests/array/array_diff_key_variation3.phpt create mode 100644 ext/standard/tests/array/array_diff_key_variation4.phpt create mode 100644 ext/standard/tests/array/array_diff_key_variation5.phpt create mode 100644 ext/standard/tests/array/array_diff_key_variation6.phpt create mode 100644 ext/standard/tests/array/array_diff_key_variation7.phpt create mode 100644 ext/standard/tests/array/array_diff_key_variation8.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_basic.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_error.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_variation1.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_variation10.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_variation11.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_variation12.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_variation13.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_variation14.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_variation2.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_variation3.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_variation4.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_variation5.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_variation6.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_variation7.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_variation8.phpt create mode 100644 ext/standard/tests/array/array_diff_uassoc_variation9.phpt create mode 100644 ext/standard/tests/array/array_diff_ukey_basic.phpt create mode 100644 ext/standard/tests/array/array_diff_ukey_error.phpt create mode 100644 ext/standard/tests/array/array_diff_ukey_variation1.phpt create mode 100644 ext/standard/tests/array/array_diff_ukey_variation10.phpt create mode 100644 ext/standard/tests/array/array_diff_ukey_variation11.phpt create mode 100644 ext/standard/tests/array/array_diff_ukey_variation2.phpt create mode 100644 ext/standard/tests/array/array_diff_ukey_variation3.phpt create mode 100644 ext/standard/tests/array/array_diff_ukey_variation4.phpt create mode 100644 ext/standard/tests/array/array_diff_ukey_variation5.phpt create mode 100644 ext/standard/tests/array/array_diff_ukey_variation6.phpt create mode 100644 ext/standard/tests/array/array_diff_ukey_variation7.phpt create mode 100644 ext/standard/tests/array/array_diff_ukey_variation8.phpt create mode 100644 ext/standard/tests/array/array_diff_ukey_variation9.phpt create mode 100644 ext/standard/tests/array/array_diff_variation1.phpt create mode 100644 ext/standard/tests/array/array_diff_variation10.phpt create mode 100644 ext/standard/tests/array/array_diff_variation2.phpt create mode 100644 ext/standard/tests/array/array_diff_variation3.phpt create mode 100644 ext/standard/tests/array/array_diff_variation4.phpt create mode 100644 ext/standard/tests/array/array_diff_variation5.phpt create mode 100644 ext/standard/tests/array/array_diff_variation6.phpt create mode 100644 ext/standard/tests/array/array_diff_variation7.phpt create mode 100644 ext/standard/tests/array/array_diff_variation8.phpt create mode 100644 ext/standard/tests/array/array_diff_variation9.phpt create mode 100644 ext/standard/tests/array/array_fill.phpt create mode 100644 ext/standard/tests/array/array_fill_basic.phpt create mode 100644 ext/standard/tests/array/array_fill_error.phpt create mode 100644 ext/standard/tests/array/array_fill_keys.phpt create mode 100644 ext/standard/tests/array/array_fill_keys_error.phpt create mode 100644 ext/standard/tests/array/array_fill_keys_variation1.phpt create mode 100644 ext/standard/tests/array/array_fill_keys_variation2.phpt create mode 100644 ext/standard/tests/array/array_fill_keys_variation3.phpt create mode 100644 ext/standard/tests/array/array_fill_keys_variation4.phpt create mode 100644 ext/standard/tests/array/array_fill_object.phpt create mode 100644 ext/standard/tests/array/array_fill_object_2_4.phpt create mode 100644 ext/standard/tests/array/array_fill_variation1.phpt create mode 100644 ext/standard/tests/array/array_fill_variation1_64bit.phpt create mode 100644 ext/standard/tests/array/array_fill_variation2.phpt create mode 100644 ext/standard/tests/array/array_fill_variation3.phpt create mode 100644 ext/standard/tests/array/array_fill_variation4.phpt create mode 100644 ext/standard/tests/array/array_fill_variation5.phpt create mode 100644 ext/standard/tests/array/array_filter.phpt create mode 100644 ext/standard/tests/array/array_filter_basic.phpt create mode 100644 ext/standard/tests/array/array_filter_error.phpt create mode 100644 ext/standard/tests/array/array_filter_object.phpt create mode 100644 ext/standard/tests/array/array_filter_variation1.phpt create mode 100644 ext/standard/tests/array/array_filter_variation2.phpt create mode 100644 ext/standard/tests/array/array_filter_variation3.phpt create mode 100644 ext/standard/tests/array/array_filter_variation4.phpt create mode 100644 ext/standard/tests/array/array_filter_variation5.phpt create mode 100644 ext/standard/tests/array/array_filter_variation6.phpt create mode 100644 ext/standard/tests/array/array_filter_variation7.phpt create mode 100644 ext/standard/tests/array/array_filter_variation8.phpt create mode 100644 ext/standard/tests/array/array_filter_variation9.phpt create mode 100644 ext/standard/tests/array/array_flip.phpt create mode 100644 ext/standard/tests/array/array_flip_basic.phpt create mode 100644 ext/standard/tests/array/array_flip_error.phpt create mode 100644 ext/standard/tests/array/array_flip_variation1.phpt create mode 100644 ext/standard/tests/array/array_flip_variation2.phpt create mode 100644 ext/standard/tests/array/array_flip_variation3.phpt create mode 100644 ext/standard/tests/array/array_flip_variation4.phpt create mode 100644 ext/standard/tests/array/array_flip_variation5.phpt create mode 100644 ext/standard/tests/array/array_intersect_1.phpt create mode 100644 ext/standard/tests/array/array_intersect_assoc_basic.phpt create mode 100644 ext/standard/tests/array/array_intersect_assoc_error.phpt create mode 100644 ext/standard/tests/array/array_intersect_assoc_variation1.phpt create mode 100644 ext/standard/tests/array/array_intersect_assoc_variation10.phpt create mode 100644 ext/standard/tests/array/array_intersect_assoc_variation2.phpt create mode 100644 ext/standard/tests/array/array_intersect_assoc_variation3.phpt create mode 100644 ext/standard/tests/array/array_intersect_assoc_variation4.phpt create mode 100644 ext/standard/tests/array/array_intersect_assoc_variation5.phpt create mode 100644 ext/standard/tests/array/array_intersect_assoc_variation6.phpt create mode 100644 ext/standard/tests/array/array_intersect_assoc_variation7.phpt create mode 100644 ext/standard/tests/array/array_intersect_assoc_variation8.phpt create mode 100644 ext/standard/tests/array/array_intersect_assoc_variation9.phpt create mode 100644 ext/standard/tests/array/array_intersect_basic.phpt create mode 100644 ext/standard/tests/array/array_intersect_error.phpt create mode 100644 ext/standard/tests/array/array_intersect_key.phpt create mode 100644 ext/standard/tests/array/array_intersect_key_basic.phpt create mode 100644 ext/standard/tests/array/array_intersect_key_error.phpt create mode 100644 ext/standard/tests/array/array_intersect_key_variation1.phpt create mode 100644 ext/standard/tests/array/array_intersect_key_variation2.phpt create mode 100644 ext/standard/tests/array/array_intersect_key_variation3.phpt create mode 100644 ext/standard/tests/array/array_intersect_key_variation4.phpt create mode 100644 ext/standard/tests/array/array_intersect_key_variation5.phpt create mode 100644 ext/standard/tests/array/array_intersect_key_variation6.phpt create mode 100644 ext/standard/tests/array/array_intersect_key_variation7.phpt create mode 100644 ext/standard/tests/array/array_intersect_key_variation8.phpt create mode 100644 ext/standard/tests/array/array_intersect_uassoc_basic.phpt create mode 100644 ext/standard/tests/array/array_intersect_uassoc_error.phpt create mode 100644 ext/standard/tests/array/array_intersect_uassoc_variation1.phpt create mode 100644 ext/standard/tests/array/array_intersect_uassoc_variation10.phpt create mode 100644 ext/standard/tests/array/array_intersect_uassoc_variation11.phpt create mode 100644 ext/standard/tests/array/array_intersect_uassoc_variation2.phpt create mode 100644 ext/standard/tests/array/array_intersect_uassoc_variation3.phpt create mode 100644 ext/standard/tests/array/array_intersect_uassoc_variation4.phpt create mode 100644 ext/standard/tests/array/array_intersect_uassoc_variation5.phpt create mode 100644 ext/standard/tests/array/array_intersect_uassoc_variation6.phpt create mode 100644 ext/standard/tests/array/array_intersect_uassoc_variation7.phpt create mode 100644 ext/standard/tests/array/array_intersect_uassoc_variation8.phpt create mode 100644 ext/standard/tests/array/array_intersect_uassoc_variation9.phpt create mode 100644 ext/standard/tests/array/array_intersect_ukey_basic.phpt create mode 100644 ext/standard/tests/array/array_intersect_ukey_error.phpt create mode 100644 ext/standard/tests/array/array_intersect_ukey_variation1.phpt create mode 100644 ext/standard/tests/array/array_intersect_ukey_variation10.phpt create mode 100644 ext/standard/tests/array/array_intersect_ukey_variation2.phpt create mode 100644 ext/standard/tests/array/array_intersect_ukey_variation3.phpt create mode 100644 ext/standard/tests/array/array_intersect_ukey_variation4.phpt create mode 100644 ext/standard/tests/array/array_intersect_ukey_variation5.phpt create mode 100644 ext/standard/tests/array/array_intersect_ukey_variation6.phpt create mode 100644 ext/standard/tests/array/array_intersect_ukey_variation7.phpt create mode 100644 ext/standard/tests/array/array_intersect_ukey_variation8.phpt create mode 100644 ext/standard/tests/array/array_intersect_ukey_variation9.phpt create mode 100644 ext/standard/tests/array/array_intersect_variation1.phpt create mode 100644 ext/standard/tests/array/array_intersect_variation10.phpt create mode 100644 ext/standard/tests/array/array_intersect_variation2.phpt create mode 100644 ext/standard/tests/array/array_intersect_variation3.phpt create mode 100644 ext/standard/tests/array/array_intersect_variation4.phpt create mode 100644 ext/standard/tests/array/array_intersect_variation5.phpt create mode 100644 ext/standard/tests/array/array_intersect_variation6.phpt create mode 100644 ext/standard/tests/array/array_intersect_variation7.phpt create mode 100644 ext/standard/tests/array/array_intersect_variation8.phpt create mode 100644 ext/standard/tests/array/array_intersect_variation9.phpt create mode 100644 ext/standard/tests/array/array_key_exists.phpt create mode 100644 ext/standard/tests/array/array_key_exists_basic.phpt create mode 100644 ext/standard/tests/array/array_key_exists_error.phpt create mode 100644 ext/standard/tests/array/array_key_exists_object1.phpt create mode 100644 ext/standard/tests/array/array_key_exists_object2.phpt create mode 100644 ext/standard/tests/array/array_key_exists_variation1.phpt create mode 100644 ext/standard/tests/array/array_key_exists_variation2.phpt create mode 100644 ext/standard/tests/array/array_key_exists_variation3.phpt create mode 100644 ext/standard/tests/array/array_key_exists_variation4.phpt create mode 100644 ext/standard/tests/array/array_key_exists_variation5.phpt create mode 100644 ext/standard/tests/array/array_key_exists_variation6.phpt create mode 100644 ext/standard/tests/array/array_key_exists_variation7.phpt create mode 100644 ext/standard/tests/array/array_key_exists_variation8.phpt create mode 100644 ext/standard/tests/array/array_keys_basic.phpt create mode 100644 ext/standard/tests/array/array_keys_error.phpt create mode 100644 ext/standard/tests/array/array_keys_variation_001.phpt create mode 100644 ext/standard/tests/array/array_keys_variation_002.phpt create mode 100644 ext/standard/tests/array/array_keys_variation_002_64bit.phpt create mode 100644 ext/standard/tests/array/array_keys_variation_003.phpt create mode 100644 ext/standard/tests/array/array_keys_variation_004.phpt create mode 100644 ext/standard/tests/array/array_keys_variation_005.phpt create mode 100644 ext/standard/tests/array/array_map_001.phpt create mode 100644 ext/standard/tests/array/array_map_basic.phpt create mode 100644 ext/standard/tests/array/array_map_error.phpt create mode 100644 ext/standard/tests/array/array_map_object1.phpt create mode 100644 ext/standard/tests/array/array_map_object2.phpt create mode 100644 ext/standard/tests/array/array_map_object3.phpt create mode 100644 ext/standard/tests/array/array_map_variation1.phpt create mode 100644 ext/standard/tests/array/array_map_variation10.phpt create mode 100644 ext/standard/tests/array/array_map_variation11.phpt create mode 100644 ext/standard/tests/array/array_map_variation12.phpt create mode 100644 ext/standard/tests/array/array_map_variation13.phpt create mode 100644 ext/standard/tests/array/array_map_variation14.phpt create mode 100644 ext/standard/tests/array/array_map_variation15.phpt create mode 100644 ext/standard/tests/array/array_map_variation16.phpt create mode 100644 ext/standard/tests/array/array_map_variation17.phpt create mode 100644 ext/standard/tests/array/array_map_variation18.phpt create mode 100644 ext/standard/tests/array/array_map_variation19.phpt create mode 100644 ext/standard/tests/array/array_map_variation2.phpt create mode 100644 ext/standard/tests/array/array_map_variation3.phpt create mode 100644 ext/standard/tests/array/array_map_variation4.phpt create mode 100644 ext/standard/tests/array/array_map_variation5.phpt create mode 100644 ext/standard/tests/array/array_map_variation6.phpt create mode 100644 ext/standard/tests/array/array_map_variation7.phpt create mode 100644 ext/standard/tests/array/array_map_variation8.phpt create mode 100644 ext/standard/tests/array/array_map_variation9.phpt create mode 100644 ext/standard/tests/array/array_merge.phpt create mode 100644 ext/standard/tests/array/array_merge_basic.phpt create mode 100644 ext/standard/tests/array/array_merge_error.phpt create mode 100644 ext/standard/tests/array/array_merge_recursive_basic1.phpt create mode 100644 ext/standard/tests/array/array_merge_recursive_basic2.phpt create mode 100644 ext/standard/tests/array/array_merge_recursive_error.phpt create mode 100644 ext/standard/tests/array/array_merge_recursive_variation1.phpt create mode 100644 ext/standard/tests/array/array_merge_recursive_variation10.phpt create mode 100644 ext/standard/tests/array/array_merge_recursive_variation2.phpt create mode 100644 ext/standard/tests/array/array_merge_recursive_variation3.phpt create mode 100644 ext/standard/tests/array/array_merge_recursive_variation4.phpt create mode 100644 ext/standard/tests/array/array_merge_recursive_variation5.phpt create mode 100644 ext/standard/tests/array/array_merge_recursive_variation6.phpt create mode 100644 ext/standard/tests/array/array_merge_recursive_variation7.phpt create mode 100644 ext/standard/tests/array/array_merge_recursive_variation8.phpt create mode 100644 ext/standard/tests/array/array_merge_recursive_variation9.phpt create mode 100644 ext/standard/tests/array/array_merge_variation1.phpt create mode 100644 ext/standard/tests/array/array_merge_variation10.phpt create mode 100644 ext/standard/tests/array/array_merge_variation2.phpt create mode 100644 ext/standard/tests/array/array_merge_variation3.phpt create mode 100644 ext/standard/tests/array/array_merge_variation4.phpt create mode 100644 ext/standard/tests/array/array_merge_variation5.phpt create mode 100644 ext/standard/tests/array/array_merge_variation6.phpt create mode 100644 ext/standard/tests/array/array_merge_variation7.phpt create mode 100644 ext/standard/tests/array/array_merge_variation8.phpt create mode 100644 ext/standard/tests/array/array_merge_variation9.phpt create mode 100644 ext/standard/tests/array/array_multisort_basic1.phpt create mode 100644 ext/standard/tests/array/array_multisort_basic2.phpt create mode 100644 ext/standard/tests/array/array_multisort_case.phpt create mode 100644 ext/standard/tests/array/array_multisort_error.phpt create mode 100644 ext/standard/tests/array/array_multisort_incase.phpt create mode 100644 ext/standard/tests/array/array_multisort_natural.phpt create mode 100644 ext/standard/tests/array/array_multisort_natural_case.phpt create mode 100644 ext/standard/tests/array/array_multisort_natural_incase.phpt create mode 100644 ext/standard/tests/array/array_multisort_variation1.phpt create mode 100644 ext/standard/tests/array/array_multisort_variation10.phpt create mode 100644 ext/standard/tests/array/array_multisort_variation11.phpt create mode 100644 ext/standard/tests/array/array_multisort_variation2.phpt create mode 100644 ext/standard/tests/array/array_multisort_variation3.phpt create mode 100644 ext/standard/tests/array/array_multisort_variation4.phpt create mode 100644 ext/standard/tests/array/array_multisort_variation5.phpt create mode 100644 ext/standard/tests/array/array_multisort_variation6.phpt create mode 100644 ext/standard/tests/array/array_multisort_variation7.phpt create mode 100644 ext/standard/tests/array/array_multisort_variation8.phpt create mode 100644 ext/standard/tests/array/array_multisort_variation9.phpt create mode 100644 ext/standard/tests/array/array_next_error1.phpt create mode 100644 ext/standard/tests/array/array_next_error2.phpt create mode 100644 ext/standard/tests/array/array_pad.phpt create mode 100644 ext/standard/tests/array/array_pad_error.phpt create mode 100644 ext/standard/tests/array/array_pad_variation1.phpt create mode 100644 ext/standard/tests/array/array_pad_variation2.phpt create mode 100644 ext/standard/tests/array/array_pad_variation3.phpt create mode 100644 ext/standard/tests/array/array_pad_variation4.phpt create mode 100644 ext/standard/tests/array/array_pad_variation5.phpt create mode 100644 ext/standard/tests/array/array_pad_variation6.phpt create mode 100644 ext/standard/tests/array/array_pad_variation7.phpt create mode 100644 ext/standard/tests/array/array_pop.phpt create mode 100644 ext/standard/tests/array/array_pop_errors.phpt create mode 100644 ext/standard/tests/array/array_pop_variation.phpt create mode 100644 ext/standard/tests/array/array_product_error.phpt create mode 100644 ext/standard/tests/array/array_product_variation1.phpt create mode 100644 ext/standard/tests/array/array_product_variation2.phpt create mode 100644 ext/standard/tests/array/array_product_variation3.phpt create mode 100644 ext/standard/tests/array/array_product_variation4.phpt create mode 100644 ext/standard/tests/array/array_product_variation5.phpt create mode 100644 ext/standard/tests/array/array_push.phpt create mode 100644 ext/standard/tests/array/array_push_basic.phpt create mode 100644 ext/standard/tests/array/array_push_error1.phpt create mode 100644 ext/standard/tests/array/array_push_error2.phpt create mode 100644 ext/standard/tests/array/array_push_variation1.phpt create mode 100644 ext/standard/tests/array/array_push_variation2.phpt create mode 100644 ext/standard/tests/array/array_push_variation3.phpt create mode 100644 ext/standard/tests/array/array_push_variation5.phpt create mode 100644 ext/standard/tests/array/array_push_variation6.phpt create mode 100644 ext/standard/tests/array/array_rand.phpt create mode 100644 ext/standard/tests/array/array_rand_basic1.phpt create mode 100644 ext/standard/tests/array/array_rand_basic2.phpt create mode 100644 ext/standard/tests/array/array_rand_error.phpt create mode 100644 ext/standard/tests/array/array_rand_variation1.phpt create mode 100644 ext/standard/tests/array/array_rand_variation2.phpt create mode 100644 ext/standard/tests/array/array_rand_variation3.phpt create mode 100644 ext/standard/tests/array/array_rand_variation4.phpt create mode 100644 ext/standard/tests/array/array_rand_variation5.phpt create mode 100644 ext/standard/tests/array/array_rand_variation6.phpt create mode 100644 ext/standard/tests/array/array_reduce.phpt create mode 100644 ext/standard/tests/array/array_reduce_error.phpt create mode 100644 ext/standard/tests/array/array_reduce_variation1.phpt create mode 100644 ext/standard/tests/array/array_reduce_variation2.phpt create mode 100644 ext/standard/tests/array/array_reduce_variation3.phpt create mode 100644 ext/standard/tests/array/array_replace.phpt create mode 100644 ext/standard/tests/array/array_reverse_basic1.phpt create mode 100644 ext/standard/tests/array/array_reverse_basic2.phpt create mode 100644 ext/standard/tests/array/array_reverse_error.phpt create mode 100644 ext/standard/tests/array/array_reverse_variation1.phpt create mode 100644 ext/standard/tests/array/array_reverse_variation2.phpt create mode 100644 ext/standard/tests/array/array_reverse_variation3.phpt create mode 100644 ext/standard/tests/array/array_reverse_variation4.phpt create mode 100644 ext/standard/tests/array/array_reverse_variation5.phpt create mode 100644 ext/standard/tests/array/array_reverse_variation6.phpt create mode 100644 ext/standard/tests/array/array_search.phpt create mode 100644 ext/standard/tests/array/array_search1.phpt create mode 100644 ext/standard/tests/array/array_search_errors.phpt create mode 100644 ext/standard/tests/array/array_search_variation1.phpt create mode 100644 ext/standard/tests/array/array_search_variation2.phpt create mode 100644 ext/standard/tests/array/array_search_variation3.phpt create mode 100644 ext/standard/tests/array/array_search_variation4.phpt create mode 100644 ext/standard/tests/array/array_shift_basic.phpt create mode 100644 ext/standard/tests/array/array_shift_error.phpt create mode 100644 ext/standard/tests/array/array_shift_variation1.phpt create mode 100644 ext/standard/tests/array/array_shift_variation2.phpt create mode 100644 ext/standard/tests/array/array_shift_variation3.phpt create mode 100644 ext/standard/tests/array/array_shift_variation4.phpt create mode 100644 ext/standard/tests/array/array_shift_variation5.phpt create mode 100644 ext/standard/tests/array/array_shift_variation6.phpt create mode 100644 ext/standard/tests/array/array_shift_variation7.phpt create mode 100644 ext/standard/tests/array/array_shift_variation8.phpt create mode 100644 ext/standard/tests/array/array_shuffle_basic.phpt create mode 100644 ext/standard/tests/array/array_slice.phpt create mode 100644 ext/standard/tests/array/array_slice_basic.phpt create mode 100644 ext/standard/tests/array/array_slice_error.phpt create mode 100644 ext/standard/tests/array/array_slice_variation1.phpt create mode 100644 ext/standard/tests/array/array_slice_variation10.phpt create mode 100644 ext/standard/tests/array/array_slice_variation11.phpt create mode 100644 ext/standard/tests/array/array_slice_variation2.phpt create mode 100644 ext/standard/tests/array/array_slice_variation3.phpt create mode 100644 ext/standard/tests/array/array_slice_variation4.phpt create mode 100644 ext/standard/tests/array/array_slice_variation5.phpt create mode 100644 ext/standard/tests/array/array_slice_variation6.phpt create mode 100644 ext/standard/tests/array/array_slice_variation7.phpt create mode 100644 ext/standard/tests/array/array_slice_variation8.phpt create mode 100644 ext/standard/tests/array/array_slice_variation9.phpt create mode 100644 ext/standard/tests/array/array_splice_basic.phpt create mode 100644 ext/standard/tests/array/array_splice_errors.phpt create mode 100644 ext/standard/tests/array/array_splice_variation1.phpt create mode 100644 ext/standard/tests/array/array_splice_variation2.phpt create mode 100644 ext/standard/tests/array/array_splice_variation3.phpt create mode 100644 ext/standard/tests/array/array_splice_variation4.phpt create mode 100644 ext/standard/tests/array/array_sum.phpt create mode 100644 ext/standard/tests/array/array_sum_basic.phpt create mode 100644 ext/standard/tests/array/array_sum_error.phpt create mode 100644 ext/standard/tests/array/array_sum_variation1.phpt create mode 100644 ext/standard/tests/array/array_sum_variation2.phpt create mode 100644 ext/standard/tests/array/array_sum_variation3.phpt create mode 100644 ext/standard/tests/array/array_sum_variation4.phpt create mode 100644 ext/standard/tests/array/array_sum_variation5.phpt create mode 100644 ext/standard/tests/array/array_sum_variation6.phpt create mode 100644 ext/standard/tests/array/array_sum_variation7.phpt create mode 100644 ext/standard/tests/array/array_udiff_assoc_basic.phpt create mode 100644 ext/standard/tests/array/array_udiff_assoc_error.phpt create mode 100644 ext/standard/tests/array/array_udiff_assoc_variation.phpt create mode 100644 ext/standard/tests/array/array_udiff_assoc_variation1.phpt create mode 100644 ext/standard/tests/array/array_udiff_assoc_variation2.phpt create mode 100644 ext/standard/tests/array/array_udiff_assoc_variation3.phpt create mode 100644 ext/standard/tests/array/array_udiff_assoc_variation4.phpt create mode 100644 ext/standard/tests/array/array_udiff_assoc_variation5.phpt create mode 100644 ext/standard/tests/array/array_udiff_basic.phpt create mode 100644 ext/standard/tests/array/array_udiff_error.phpt create mode 100644 ext/standard/tests/array/array_udiff_uassoc_basic.phpt create mode 100644 ext/standard/tests/array/array_udiff_uassoc_error.phpt create mode 100644 ext/standard/tests/array/array_udiff_uassoc_variation1.phpt create mode 100644 ext/standard/tests/array/array_udiff_uassoc_variation2.phpt create mode 100644 ext/standard/tests/array/array_udiff_uassoc_variation3.phpt create mode 100644 ext/standard/tests/array/array_udiff_uassoc_variation4.phpt create mode 100644 ext/standard/tests/array/array_udiff_uassoc_variation5.phpt create mode 100644 ext/standard/tests/array/array_udiff_uassoc_variation6.phpt create mode 100644 ext/standard/tests/array/array_udiff_variation1.phpt create mode 100644 ext/standard/tests/array/array_udiff_variation2.phpt create mode 100644 ext/standard/tests/array/array_udiff_variation3.phpt create mode 100644 ext/standard/tests/array/array_udiff_variation4.phpt create mode 100644 ext/standard/tests/array/array_udiff_variation5.phpt create mode 100644 ext/standard/tests/array/array_uintersect_assoc_basic.phpt create mode 100644 ext/standard/tests/array/array_uintersect_assoc_basic2.phpt create mode 100644 ext/standard/tests/array/array_uintersect_assoc_error.phpt create mode 100644 ext/standard/tests/array/array_uintersect_assoc_variation1.phpt create mode 100644 ext/standard/tests/array/array_uintersect_assoc_variation2.phpt create mode 100644 ext/standard/tests/array/array_uintersect_assoc_variation3.phpt create mode 100644 ext/standard/tests/array/array_uintersect_assoc_variation4.phpt create mode 100644 ext/standard/tests/array/array_uintersect_assoc_variation5.phpt create mode 100644 ext/standard/tests/array/array_uintersect_basic.phpt create mode 100644 ext/standard/tests/array/array_uintersect_error.phpt create mode 100644 ext/standard/tests/array/array_uintersect_uassoc_basic.phpt create mode 100644 ext/standard/tests/array/array_uintersect_uassoc_error.phpt create mode 100644 ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt create mode 100644 ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt create mode 100644 ext/standard/tests/array/array_uintersect_uassoc_variation3.phpt create mode 100644 ext/standard/tests/array/array_uintersect_uassoc_variation4.phpt create mode 100644 ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt create mode 100644 ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt create mode 100644 ext/standard/tests/array/array_uintersect_variation1.phpt create mode 100644 ext/standard/tests/array/array_uintersect_variation2.phpt create mode 100644 ext/standard/tests/array/array_uintersect_variation3.phpt create mode 100644 ext/standard/tests/array/array_uintersect_variation4.phpt create mode 100644 ext/standard/tests/array/array_uintersect_variation5.phpt create mode 100644 ext/standard/tests/array/array_unique_basic.phpt create mode 100644 ext/standard/tests/array/array_unique_error.phpt create mode 100644 ext/standard/tests/array/array_unique_variation1.phpt create mode 100644 ext/standard/tests/array/array_unique_variation2.phpt create mode 100644 ext/standard/tests/array/array_unique_variation3.phpt create mode 100644 ext/standard/tests/array/array_unique_variation4.phpt create mode 100644 ext/standard/tests/array/array_unique_variation5.phpt create mode 100644 ext/standard/tests/array/array_unique_variation6.phpt create mode 100644 ext/standard/tests/array/array_unique_variation7.phpt create mode 100644 ext/standard/tests/array/array_unique_variation8.phpt create mode 100644 ext/standard/tests/array/array_unshift.phpt create mode 100644 ext/standard/tests/array/array_unshift_basic1.phpt create mode 100644 ext/standard/tests/array/array_unshift_basic2.phpt create mode 100644 ext/standard/tests/array/array_unshift_error.phpt create mode 100644 ext/standard/tests/array/array_unshift_object.phpt create mode 100644 ext/standard/tests/array/array_unshift_variation1.phpt create mode 100644 ext/standard/tests/array/array_unshift_variation2.phpt create mode 100644 ext/standard/tests/array/array_unshift_variation3.phpt create mode 100644 ext/standard/tests/array/array_unshift_variation4.phpt create mode 100644 ext/standard/tests/array/array_unshift_variation5.phpt create mode 100644 ext/standard/tests/array/array_unshift_variation6.phpt create mode 100644 ext/standard/tests/array/array_unshift_variation7.phpt create mode 100644 ext/standard/tests/array/array_unshift_variation8.phpt create mode 100644 ext/standard/tests/array/array_unshift_variation9.phpt create mode 100644 ext/standard/tests/array/array_user_key_compare.phpt create mode 100644 ext/standard/tests/array/array_values.phpt create mode 100644 ext/standard/tests/array/array_values_basic.phpt create mode 100644 ext/standard/tests/array/array_values_error.phpt create mode 100644 ext/standard/tests/array/array_values_errors.phpt create mode 100644 ext/standard/tests/array/array_values_variation.phpt create mode 100644 ext/standard/tests/array/array_values_variation1.phpt create mode 100644 ext/standard/tests/array/array_values_variation2.phpt create mode 100644 ext/standard/tests/array/array_values_variation3.phpt create mode 100644 ext/standard/tests/array/array_values_variation4.phpt create mode 100644 ext/standard/tests/array/array_values_variation5.phpt create mode 100644 ext/standard/tests/array/array_values_variation6.phpt create mode 100644 ext/standard/tests/array/array_values_variation7.phpt create mode 100644 ext/standard/tests/array/array_values_variation_64bit.phpt create mode 100644 ext/standard/tests/array/array_walk.phpt create mode 100644 ext/standard/tests/array/array_walk_basic1.phpt create mode 100644 ext/standard/tests/array/array_walk_basic2.phpt create mode 100644 ext/standard/tests/array/array_walk_error1.phpt create mode 100644 ext/standard/tests/array/array_walk_error2.phpt create mode 100644 ext/standard/tests/array/array_walk_object1.phpt create mode 100644 ext/standard/tests/array/array_walk_object2.phpt create mode 100644 ext/standard/tests/array/array_walk_objects.phpt create mode 100644 ext/standard/tests/array/array_walk_rec_objects.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive1.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_basic1.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_basic2.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_error1.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_error2.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_object1.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_object2.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_variation1.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_variation2.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_variation3.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_variation4.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_variation5.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_variation6.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_variation7.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_variation8.phpt create mode 100644 ext/standard/tests/array/array_walk_recursive_variation9.phpt create mode 100644 ext/standard/tests/array/array_walk_variation1.phpt create mode 100644 ext/standard/tests/array/array_walk_variation2.phpt create mode 100644 ext/standard/tests/array/array_walk_variation3.phpt create mode 100644 ext/standard/tests/array/array_walk_variation4.phpt create mode 100644 ext/standard/tests/array/array_walk_variation5.phpt create mode 100644 ext/standard/tests/array/array_walk_variation6.phpt create mode 100644 ext/standard/tests/array/array_walk_variation7.phpt create mode 100644 ext/standard/tests/array/array_walk_variation8.phpt create mode 100644 ext/standard/tests/array/array_walk_variation9.phpt create mode 100644 ext/standard/tests/array/arsort_basic.phpt create mode 100644 ext/standard/tests/array/arsort_error.phpt create mode 100644 ext/standard/tests/array/arsort_object1.phpt create mode 100644 ext/standard/tests/array/arsort_object2.phpt create mode 100644 ext/standard/tests/array/arsort_variation1.phpt create mode 100644 ext/standard/tests/array/arsort_variation10.phpt create mode 100644 ext/standard/tests/array/arsort_variation11.phpt create mode 100644 ext/standard/tests/array/arsort_variation2.phpt create mode 100644 ext/standard/tests/array/arsort_variation3.phpt create mode 100644 ext/standard/tests/array/arsort_variation4.phpt create mode 100644 ext/standard/tests/array/arsort_variation5.phpt create mode 100644 ext/standard/tests/array/arsort_variation6.phpt create mode 100644 ext/standard/tests/array/arsort_variation7.phpt create mode 100644 ext/standard/tests/array/arsort_variation8.phpt create mode 100644 ext/standard/tests/array/arsort_variation9.phpt create mode 100644 ext/standard/tests/array/asort_basic.phpt create mode 100644 ext/standard/tests/array/asort_error.phpt create mode 100644 ext/standard/tests/array/asort_object1.phpt create mode 100644 ext/standard/tests/array/asort_object2.phpt create mode 100644 ext/standard/tests/array/asort_variation1.phpt create mode 100644 ext/standard/tests/array/asort_variation10.phpt create mode 100644 ext/standard/tests/array/asort_variation11.phpt create mode 100644 ext/standard/tests/array/asort_variation2.phpt create mode 100644 ext/standard/tests/array/asort_variation3.phpt create mode 100644 ext/standard/tests/array/asort_variation4.phpt create mode 100644 ext/standard/tests/array/asort_variation5.phpt create mode 100644 ext/standard/tests/array/asort_variation6.phpt create mode 100644 ext/standard/tests/array/asort_variation7.phpt create mode 100644 ext/standard/tests/array/asort_variation8.phpt create mode 100644 ext/standard/tests/array/asort_variation9.phpt create mode 100644 ext/standard/tests/array/bug12776.phpt create mode 100644 ext/standard/tests/array/bug14580.phpt create mode 100644 ext/standard/tests/array/bug20381.phpt create mode 100644 ext/standard/tests/array/bug20865.phpt create mode 100644 ext/standard/tests/array/bug21182.phpt create mode 100644 ext/standard/tests/array/bug21918.phpt create mode 100644 ext/standard/tests/array/bug21998.phpt create mode 100644 ext/standard/tests/array/bug22088.phpt create mode 100644 ext/standard/tests/array/bug22463.phpt create mode 100644 ext/standard/tests/array/bug23581.phpt create mode 100644 ext/standard/tests/array/bug23788.phpt create mode 100644 ext/standard/tests/array/bug24198.phpt create mode 100644 ext/standard/tests/array/bug24220.phpt create mode 100644 ext/standard/tests/array/bug24766.phpt create mode 100644 ext/standard/tests/array/bug24897.phpt create mode 100644 ext/standard/tests/array/bug24980.phpt create mode 100644 ext/standard/tests/array/bug25359.phpt create mode 100644 ext/standard/tests/array/bug25708.phpt create mode 100644 ext/standard/tests/array/bug25758.phpt create mode 100644 ext/standard/tests/array/bug26458.phpt create mode 100644 ext/standard/tests/array/bug28739.phpt create mode 100644 ext/standard/tests/array/bug28974.phpt create mode 100644 ext/standard/tests/array/bug29253.phpt create mode 100644 ext/standard/tests/array/bug29493.phpt create mode 100644 ext/standard/tests/array/bug30074.phpt create mode 100644 ext/standard/tests/array/bug30266.phpt create mode 100644 ext/standard/tests/array/bug30833.phpt create mode 100644 ext/standard/tests/array/bug31158.phpt create mode 100644 ext/standard/tests/array/bug31213.phpt create mode 100644 ext/standard/tests/array/bug32021.phpt create mode 100644 ext/standard/tests/array/bug33382.phpt create mode 100644 ext/standard/tests/array/bug33989.phpt create mode 100644 ext/standard/tests/array/bug34066.phpt create mode 100644 ext/standard/tests/array/bug34066_1.phpt create mode 100644 ext/standard/tests/array/bug34227.phpt create mode 100644 ext/standard/tests/array/bug34982.phpt create mode 100644 ext/standard/tests/array/bug35014.phpt create mode 100644 ext/standard/tests/array/bug35014_64bit.phpt create mode 100644 ext/standard/tests/array/bug35022.phpt create mode 100644 ext/standard/tests/array/bug35821.phpt create mode 100644 ext/standard/tests/array/bug36975.phpt create mode 100644 ext/standard/tests/array/bug38464.phpt create mode 100644 ext/standard/tests/array/bug39576.phpt create mode 100644 ext/standard/tests/array/bug40191.phpt create mode 100644 ext/standard/tests/array/bug40709.phpt create mode 100644 ext/standard/tests/array/bug41121.phpt create mode 100644 ext/standard/tests/array/bug41686.phpt create mode 100644 ext/standard/tests/array/bug42177.phpt create mode 100644 ext/standard/tests/array/bug42233.phpt create mode 100644 ext/standard/tests/array/bug42838.phpt create mode 100644 ext/standard/tests/array/bug42850.phpt create mode 100644 ext/standard/tests/array/bug43495.phpt create mode 100644 ext/standard/tests/array/bug43505.phpt create mode 100644 ext/standard/tests/array/bug43541.phpt create mode 100644 ext/standard/tests/array/bug44181.phpt create mode 100644 ext/standard/tests/array/bug44182.phpt create mode 100644 ext/standard/tests/array/bug44929.phpt create mode 100644 ext/standard/tests/array/bug45312.phpt create mode 100644 ext/standard/tests/array/bug46873.phpt create mode 100644 ext/standard/tests/array/bug48224.phpt create mode 100644 ext/standard/tests/array/bug48484.phpt create mode 100644 ext/standard/tests/array/bug48854.phpt create mode 100644 ext/standard/tests/array/bug50006.phpt create mode 100644 ext/standard/tests/array/bug50006_1.phpt create mode 100644 ext/standard/tests/array/bug50006_2.phpt create mode 100644 ext/standard/tests/array/bug51552.phpt create mode 100644 ext/standard/tests/array/bug52534.phpt create mode 100644 ext/standard/tests/array/bug52719.phpt create mode 100644 ext/standard/tests/array/bug54459.phpt create mode 100644 ext/standard/tests/array/bug61058.phpt create mode 100644 ext/standard/tests/array/bug61730.phpt create mode 100644 ext/standard/tests/array/compact.phpt create mode 100644 ext/standard/tests/array/compact_basic.phpt create mode 100644 ext/standard/tests/array/compact_error.phpt create mode 100644 ext/standard/tests/array/compact_variation1.phpt create mode 100644 ext/standard/tests/array/compact_variation2.phpt create mode 100644 ext/standard/tests/array/compare_function.inc create mode 100644 ext/standard/tests/array/count_basic.phpt create mode 100644 ext/standard/tests/array/count_error.phpt create mode 100644 ext/standard/tests/array/count_recursive.phpt create mode 100644 ext/standard/tests/array/count_variation1.phpt create mode 100644 ext/standard/tests/array/count_variation2.phpt create mode 100644 ext/standard/tests/array/count_variation3.phpt create mode 100644 ext/standard/tests/array/current_basic.phpt create mode 100644 ext/standard/tests/array/current_error.phpt create mode 100644 ext/standard/tests/array/current_variation1.phpt create mode 100644 ext/standard/tests/array/current_variation2.phpt create mode 100644 ext/standard/tests/array/current_variation3.phpt create mode 100644 ext/standard/tests/array/current_variation4.phpt create mode 100644 ext/standard/tests/array/current_variation5.phpt create mode 100644 ext/standard/tests/array/data.inc create mode 100644 ext/standard/tests/array/each.phpt create mode 100644 ext/standard/tests/array/each_basic.phpt create mode 100644 ext/standard/tests/array/each_error.phpt create mode 100644 ext/standard/tests/array/each_variation1.phpt create mode 100644 ext/standard/tests/array/each_variation2.phpt create mode 100644 ext/standard/tests/array/each_variation3.phpt create mode 100644 ext/standard/tests/array/each_variation4.phpt create mode 100644 ext/standard/tests/array/each_variation5.phpt create mode 100644 ext/standard/tests/array/each_variation6.phpt create mode 100644 ext/standard/tests/array/end.phpt create mode 100644 ext/standard/tests/array/end_64bit.phpt create mode 100644 ext/standard/tests/array/end_basic.phpt create mode 100644 ext/standard/tests/array/end_error.phpt create mode 100644 ext/standard/tests/array/end_variation1.phpt create mode 100644 ext/standard/tests/array/end_variation2.phpt create mode 100644 ext/standard/tests/array/end_variation3.phpt create mode 100644 ext/standard/tests/array/extract_error.phpt create mode 100644 ext/standard/tests/array/extract_safety.phpt create mode 100644 ext/standard/tests/array/extract_variation1.phpt create mode 100644 ext/standard/tests/array/extract_variation10.phpt create mode 100644 ext/standard/tests/array/extract_variation11.phpt create mode 100644 ext/standard/tests/array/extract_variation2.phpt create mode 100644 ext/standard/tests/array/extract_variation3.phpt create mode 100644 ext/standard/tests/array/extract_variation4.phpt create mode 100644 ext/standard/tests/array/extract_variation5.phpt create mode 100644 ext/standard/tests/array/extract_variation6.phpt create mode 100644 ext/standard/tests/array/extract_variation7.phpt create mode 100644 ext/standard/tests/array/extract_variation8.phpt create mode 100644 ext/standard/tests/array/extract_variation9.phpt create mode 100644 ext/standard/tests/array/in_array_errors.phpt create mode 100644 ext/standard/tests/array/in_array_variation1.phpt create mode 100644 ext/standard/tests/array/in_array_variation2.phpt create mode 100644 ext/standard/tests/array/in_array_variation3.phpt create mode 100644 ext/standard/tests/array/in_array_variation4.phpt create mode 100644 ext/standard/tests/array/key_basic.phpt create mode 100644 ext/standard/tests/array/key_error.phpt create mode 100644 ext/standard/tests/array/key_exists_basic.phpt create mode 100644 ext/standard/tests/array/key_exists_error.phpt create mode 100644 ext/standard/tests/array/key_exists_variation1.phpt create mode 100644 ext/standard/tests/array/key_exists_variation2.phpt create mode 100644 ext/standard/tests/array/key_variation1.phpt create mode 100644 ext/standard/tests/array/key_variation2.phpt create mode 100644 ext/standard/tests/array/key_variation3.phpt create mode 100644 ext/standard/tests/array/key_variation4.phpt create mode 100644 ext/standard/tests/array/krsort_basic.phpt create mode 100644 ext/standard/tests/array/krsort_error.phpt create mode 100644 ext/standard/tests/array/krsort_object.phpt create mode 100644 ext/standard/tests/array/krsort_variation1.phpt create mode 100644 ext/standard/tests/array/krsort_variation10.phpt create mode 100644 ext/standard/tests/array/krsort_variation11.phpt create mode 100644 ext/standard/tests/array/krsort_variation2.phpt create mode 100644 ext/standard/tests/array/krsort_variation3.phpt create mode 100644 ext/standard/tests/array/krsort_variation4.phpt create mode 100644 ext/standard/tests/array/krsort_variation5.phpt create mode 100644 ext/standard/tests/array/krsort_variation6.phpt create mode 100644 ext/standard/tests/array/krsort_variation7.phpt create mode 100644 ext/standard/tests/array/krsort_variation8.phpt create mode 100644 ext/standard/tests/array/krsort_variation9.phpt create mode 100644 ext/standard/tests/array/ksort_basic.phpt create mode 100644 ext/standard/tests/array/ksort_error.phpt create mode 100644 ext/standard/tests/array/ksort_object.phpt create mode 100644 ext/standard/tests/array/ksort_variation1.phpt create mode 100644 ext/standard/tests/array/ksort_variation10.phpt create mode 100644 ext/standard/tests/array/ksort_variation11.phpt create mode 100644 ext/standard/tests/array/ksort_variation2.phpt create mode 100644 ext/standard/tests/array/ksort_variation3.phpt create mode 100644 ext/standard/tests/array/ksort_variation4.phpt create mode 100644 ext/standard/tests/array/ksort_variation5.phpt create mode 100644 ext/standard/tests/array/ksort_variation6.phpt create mode 100644 ext/standard/tests/array/ksort_variation7.phpt create mode 100644 ext/standard/tests/array/ksort_variation8.phpt create mode 100644 ext/standard/tests/array/ksort_variation9.phpt create mode 100644 ext/standard/tests/array/locale_sort.phpt create mode 100644 ext/standard/tests/array/max.phpt create mode 100644 ext/standard/tests/array/max_basic.phpt create mode 100644 ext/standard/tests/array/max_basiclong_64bit.phpt create mode 100644 ext/standard/tests/array/max_error.phpt create mode 100644 ext/standard/tests/array/max_variation1.phpt create mode 100644 ext/standard/tests/array/max_variation2.phpt create mode 100644 ext/standard/tests/array/min.phpt create mode 100644 ext/standard/tests/array/min_basic.phpt create mode 100644 ext/standard/tests/array/min_basiclong_64bit.phpt create mode 100644 ext/standard/tests/array/min_error.phpt create mode 100644 ext/standard/tests/array/min_variation1.phpt create mode 100644 ext/standard/tests/array/min_variation2.phpt create mode 100644 ext/standard/tests/array/natcasesort_basic.phpt create mode 100644 ext/standard/tests/array/natcasesort_error.phpt create mode 100644 ext/standard/tests/array/natcasesort_object1.phpt create mode 100644 ext/standard/tests/array/natcasesort_object2.phpt create mode 100644 ext/standard/tests/array/natcasesort_variation1.phpt create mode 100644 ext/standard/tests/array/natcasesort_variation10.phpt create mode 100644 ext/standard/tests/array/natcasesort_variation11.phpt create mode 100644 ext/standard/tests/array/natcasesort_variation2.phpt create mode 100644 ext/standard/tests/array/natcasesort_variation3.phpt create mode 100644 ext/standard/tests/array/natcasesort_variation4.phpt create mode 100644 ext/standard/tests/array/natcasesort_variation5.phpt create mode 100644 ext/standard/tests/array/natcasesort_variation6.phpt create mode 100644 ext/standard/tests/array/natcasesort_variation7.phpt create mode 100644 ext/standard/tests/array/natcasesort_variation8.phpt create mode 100644 ext/standard/tests/array/natcasesort_variation9.phpt create mode 100644 ext/standard/tests/array/natsort_basic.phpt create mode 100644 ext/standard/tests/array/next_basic.phpt create mode 100644 ext/standard/tests/array/next_error.phpt create mode 100644 ext/standard/tests/array/next_variation1.phpt create mode 100644 ext/standard/tests/array/next_variation2.phpt create mode 100644 ext/standard/tests/array/prev_basic.phpt create mode 100644 ext/standard/tests/array/prev_error1.phpt create mode 100644 ext/standard/tests/array/prev_error2.phpt create mode 100644 ext/standard/tests/array/prev_error3.phpt create mode 100644 ext/standard/tests/array/prev_variation1.phpt create mode 100644 ext/standard/tests/array/prev_variation2.phpt create mode 100644 ext/standard/tests/array/range.phpt create mode 100644 ext/standard/tests/array/range_errors.phpt create mode 100644 ext/standard/tests/array/range_variation.phpt create mode 100644 ext/standard/tests/array/range_variation1.phpt create mode 100644 ext/standard/tests/array/range_variation1_64bit.phpt create mode 100644 ext/standard/tests/array/reset_basic.phpt create mode 100644 ext/standard/tests/array/reset_error.phpt create mode 100644 ext/standard/tests/array/reset_variation1.phpt create mode 100644 ext/standard/tests/array/reset_variation2.phpt create mode 100644 ext/standard/tests/array/reset_variation3.phpt create mode 100644 ext/standard/tests/array/rsort_basic.phpt create mode 100644 ext/standard/tests/array/rsort_error.phpt create mode 100644 ext/standard/tests/array/rsort_object1.phpt create mode 100644 ext/standard/tests/array/rsort_object2.phpt create mode 100644 ext/standard/tests/array/rsort_variation1.phpt create mode 100644 ext/standard/tests/array/rsort_variation10.phpt create mode 100644 ext/standard/tests/array/rsort_variation11.phpt create mode 100644 ext/standard/tests/array/rsort_variation2.phpt create mode 100644 ext/standard/tests/array/rsort_variation3.phpt create mode 100644 ext/standard/tests/array/rsort_variation4.phpt create mode 100644 ext/standard/tests/array/rsort_variation5.phpt create mode 100644 ext/standard/tests/array/rsort_variation6.phpt create mode 100644 ext/standard/tests/array/rsort_variation7.phpt create mode 100644 ext/standard/tests/array/rsort_variation8.phpt create mode 100644 ext/standard/tests/array/rsort_variation9.phpt create mode 100644 ext/standard/tests/array/shuffle_basic1.phpt create mode 100644 ext/standard/tests/array/shuffle_basic2.phpt create mode 100644 ext/standard/tests/array/shuffle_error.phpt create mode 100644 ext/standard/tests/array/shuffle_variation1.phpt create mode 100644 ext/standard/tests/array/shuffle_variation2.phpt create mode 100644 ext/standard/tests/array/shuffle_variation3.phpt create mode 100644 ext/standard/tests/array/shuffle_variation4.phpt create mode 100644 ext/standard/tests/array/shuffle_variation5.phpt create mode 100644 ext/standard/tests/array/sizeof_basic1.phpt create mode 100644 ext/standard/tests/array/sizeof_basic2.phpt create mode 100644 ext/standard/tests/array/sizeof_error.phpt create mode 100644 ext/standard/tests/array/sizeof_object1.phpt create mode 100644 ext/standard/tests/array/sizeof_object2.phpt create mode 100644 ext/standard/tests/array/sizeof_variation1.phpt create mode 100644 ext/standard/tests/array/sizeof_variation2.phpt create mode 100644 ext/standard/tests/array/sizeof_variation3.phpt create mode 100644 ext/standard/tests/array/sizeof_variation4.phpt create mode 100644 ext/standard/tests/array/sizeof_variation5.phpt create mode 100644 ext/standard/tests/array/sort_basic.phpt create mode 100644 ext/standard/tests/array/sort_error.phpt create mode 100644 ext/standard/tests/array/sort_object1.phpt create mode 100644 ext/standard/tests/array/sort_object2.phpt create mode 100644 ext/standard/tests/array/sort_variation1.phpt create mode 100644 ext/standard/tests/array/sort_variation10.phpt create mode 100644 ext/standard/tests/array/sort_variation11.phpt create mode 100644 ext/standard/tests/array/sort_variation2.phpt create mode 100644 ext/standard/tests/array/sort_variation3.phpt create mode 100644 ext/standard/tests/array/sort_variation4.phpt create mode 100644 ext/standard/tests/array/sort_variation5.phpt create mode 100644 ext/standard/tests/array/sort_variation6.phpt create mode 100644 ext/standard/tests/array/sort_variation7.phpt create mode 100644 ext/standard/tests/array/sort_variation8.phpt create mode 100644 ext/standard/tests/array/sort_variation9.phpt create mode 100644 ext/standard/tests/array/uasort_basic1.phpt create mode 100644 ext/standard/tests/array/uasort_basic2.phpt create mode 100644 ext/standard/tests/array/uasort_error.phpt create mode 100644 ext/standard/tests/array/uasort_object1.phpt create mode 100644 ext/standard/tests/array/uasort_object2.phpt create mode 100644 ext/standard/tests/array/uasort_variation1.phpt create mode 100644 ext/standard/tests/array/uasort_variation10.phpt create mode 100644 ext/standard/tests/array/uasort_variation11.phpt create mode 100644 ext/standard/tests/array/uasort_variation2.phpt create mode 100644 ext/standard/tests/array/uasort_variation3.phpt create mode 100644 ext/standard/tests/array/uasort_variation4.phpt create mode 100644 ext/standard/tests/array/uasort_variation5.phpt create mode 100644 ext/standard/tests/array/uasort_variation6.phpt create mode 100644 ext/standard/tests/array/uasort_variation7.phpt create mode 100644 ext/standard/tests/array/uasort_variation8.phpt create mode 100644 ext/standard/tests/array/uasort_variation9.phpt create mode 100644 ext/standard/tests/array/uksort_basic.phpt create mode 100644 ext/standard/tests/array/uksort_error.phpt create mode 100644 ext/standard/tests/array/uksort_variation1.phpt create mode 100644 ext/standard/tests/array/uksort_variation2.phpt create mode 100644 ext/standard/tests/array/unexpected_array_mod_bug.phpt create mode 100644 ext/standard/tests/array/usort_basic.phpt create mode 100644 ext/standard/tests/array/usort_error1.phpt create mode 100644 ext/standard/tests/array/usort_error2.phpt create mode 100644 ext/standard/tests/array/usort_object1.phpt create mode 100644 ext/standard/tests/array/usort_object2.phpt create mode 100644 ext/standard/tests/array/usort_variation1.phpt create mode 100644 ext/standard/tests/array/usort_variation10.phpt create mode 100644 ext/standard/tests/array/usort_variation2.phpt create mode 100644 ext/standard/tests/array/usort_variation3.phpt create mode 100644 ext/standard/tests/array/usort_variation4.phpt create mode 100644 ext/standard/tests/array/usort_variation5.phpt create mode 100644 ext/standard/tests/array/usort_variation6.phpt create mode 100644 ext/standard/tests/array/usort_variation7.phpt create mode 100644 ext/standard/tests/array/usort_variation8.phpt create mode 100644 ext/standard/tests/array/usort_variation9.phpt create mode 100644 ext/standard/tests/array/var_export.phpt create mode 100644 ext/standard/tests/array/var_export2.phpt create mode 100644 ext/standard/tests/array/var_export3.phpt create mode 100644 ext/standard/tests/assert/assert.phpt create mode 100644 ext/standard/tests/assert/assert02.phpt create mode 100644 ext/standard/tests/assert/assert03.phpt create mode 100644 ext/standard/tests/assert/assert04.phpt create mode 100644 ext/standard/tests/assert/assert_basic.phpt create mode 100644 ext/standard/tests/assert/assert_basic1.phpt create mode 100644 ext/standard/tests/assert/assert_basic2.phpt create mode 100644 ext/standard/tests/assert/assert_basic3.phpt create mode 100644 ext/standard/tests/assert/assert_basic4.phpt create mode 100644 ext/standard/tests/assert/assert_basic5.phpt create mode 100644 ext/standard/tests/assert/assert_basic6.phpt create mode 100644 ext/standard/tests/assert/assert_closures.phpt create mode 100644 ext/standard/tests/assert/assert_error.phpt create mode 100644 ext/standard/tests/assert/assert_error1.phpt create mode 100644 ext/standard/tests/assert/assert_error2.phpt create mode 100644 ext/standard/tests/assert/assert_error3.phpt create mode 100644 ext/standard/tests/assert/assert_error4.phpt create mode 100644 ext/standard/tests/assert/assert_variation.phpt create mode 100644 ext/standard/tests/bug49244.phpt create mode 100644 ext/standard/tests/class_object/AutoInterface.inc create mode 100644 ext/standard/tests/class_object/AutoLoaded.inc create mode 100644 ext/standard/tests/class_object/AutoTest.inc create mode 100644 ext/standard/tests/class_object/AutoTrait.inc create mode 100644 ext/standard/tests/class_object/class_exists_basic_001.phpt create mode 100644 ext/standard/tests/class_object/class_exists_error_001.phpt create mode 100644 ext/standard/tests/class_object/class_exists_variation_001.phpt create mode 100644 ext/standard/tests/class_object/class_exists_variation_002.phpt create mode 100644 ext/standard/tests/class_object/class_exists_variation_003.phpt create mode 100644 ext/standard/tests/class_object/forward_static_call_001.phpt create mode 100644 ext/standard/tests/class_object/forward_static_call_002.phpt create mode 100644 ext/standard/tests/class_object/forward_static_call_003.phpt create mode 100644 ext/standard/tests/class_object/get_class_error_001.phpt create mode 100644 ext/standard/tests/class_object/get_class_methods_basic_001.phpt create mode 100644 ext/standard/tests/class_object/get_class_methods_basic_002.phpt create mode 100644 ext/standard/tests/class_object/get_class_methods_basic_003.phpt create mode 100644 ext/standard/tests/class_object/get_class_methods_error_001.phpt create mode 100644 ext/standard/tests/class_object/get_class_methods_variation_001.phpt create mode 100644 ext/standard/tests/class_object/get_class_methods_variation_002.phpt create mode 100644 ext/standard/tests/class_object/get_class_variation_001.phpt create mode 100644 ext/standard/tests/class_object/get_class_variation_002.phpt create mode 100644 ext/standard/tests/class_object/get_class_vars_error.phpt create mode 100644 ext/standard/tests/class_object/get_class_vars_variation1.phpt create mode 100644 ext/standard/tests/class_object/get_class_vars_variation2.phpt create mode 100644 ext/standard/tests/class_object/get_declared_classes_basic_001.phpt create mode 100644 ext/standard/tests/class_object/get_declared_classes_error_001.phpt create mode 100644 ext/standard/tests/class_object/get_declared_classes_variation1.phpt create mode 100644 ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt create mode 100644 ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt create mode 100644 ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt create mode 100644 ext/standard/tests/class_object/get_declared_traits_basic_001.phpt create mode 100644 ext/standard/tests/class_object/get_declared_traits_error_001.phpt create mode 100644 ext/standard/tests/class_object/get_declared_traits_variation1.phpt create mode 100644 ext/standard/tests/class_object/get_object_vars_basic_001.phpt create mode 100644 ext/standard/tests/class_object/get_object_vars_basic_002.phpt create mode 100644 ext/standard/tests/class_object/get_object_vars_error_001.phpt create mode 100644 ext/standard/tests/class_object/get_object_vars_variation_001.phpt create mode 100644 ext/standard/tests/class_object/get_object_vars_variation_002.phpt create mode 100644 ext/standard/tests/class_object/get_object_vars_variation_003.phpt create mode 100644 ext/standard/tests/class_object/get_parent_class_error_001.phpt create mode 100644 ext/standard/tests/class_object/get_parent_class_variation_001.phpt create mode 100644 ext/standard/tests/class_object/get_parent_class_variation_002.phpt create mode 100644 ext/standard/tests/class_object/interface_exists_error.phpt create mode 100644 ext/standard/tests/class_object/interface_exists_variation1.phpt create mode 100644 ext/standard/tests/class_object/interface_exists_variation2.phpt create mode 100644 ext/standard/tests/class_object/interface_exists_variation3.phpt create mode 100644 ext/standard/tests/class_object/interface_exists_variation4.phpt create mode 100644 ext/standard/tests/class_object/is_a.phpt create mode 100644 ext/standard/tests/class_object/is_a_error_001.phpt create mode 100644 ext/standard/tests/class_object/is_a_variation_001.phpt create mode 100644 ext/standard/tests/class_object/is_a_variation_002.phpt create mode 100644 ext/standard/tests/class_object/is_a_variation_003.phpt create mode 100644 ext/standard/tests/class_object/is_subclass_of_error_001.phpt create mode 100644 ext/standard/tests/class_object/is_subclass_of_variation_001.phpt create mode 100644 ext/standard/tests/class_object/is_subclass_of_variation_002.phpt create mode 100644 ext/standard/tests/class_object/is_subclass_of_variation_003.phpt create mode 100644 ext/standard/tests/class_object/is_subclass_of_variation_004.phpt create mode 100644 ext/standard/tests/class_object/method_exists_basic_001.phpt create mode 100644 ext/standard/tests/class_object/method_exists_basic_002.phpt create mode 100644 ext/standard/tests/class_object/method_exists_basic_003.phpt create mode 100644 ext/standard/tests/class_object/method_exists_error_001.phpt create mode 100644 ext/standard/tests/class_object/method_exists_variation_001.phpt create mode 100644 ext/standard/tests/class_object/method_exists_variation_002.phpt create mode 100644 ext/standard/tests/class_object/method_exists_variation_003.phpt create mode 100644 ext/standard/tests/class_object/property_exists_error.phpt create mode 100644 ext/standard/tests/class_object/property_exists_variation1.phpt create mode 100644 ext/standard/tests/class_object/trait_class_exists_variation_003.phpt create mode 100644 ext/standard/tests/class_object/trait_exists_basic_001.phpt create mode 100644 ext/standard/tests/class_object/trait_exists_error_001.phpt create mode 100644 ext/standard/tests/class_object/trait_exists_variation_001.phpt create mode 100644 ext/standard/tests/class_object/trait_exists_variation_002.phpt create mode 100644 ext/standard/tests/dir/chdir_basic.phpt create mode 100644 ext/standard/tests/dir/chdir_error1.phpt create mode 100644 ext/standard/tests/dir/chdir_error2.phpt create mode 100644 ext/standard/tests/dir/chdir_variation1.phpt create mode 100644 ext/standard/tests/dir/chdir_variation2.phpt create mode 100644 ext/standard/tests/dir/closedir_basic.phpt create mode 100644 ext/standard/tests/dir/closedir_error.phpt create mode 100644 ext/standard/tests/dir/closedir_variation1.phpt create mode 100644 ext/standard/tests/dir/closedir_variation2.phpt create mode 100644 ext/standard/tests/dir/closedir_variation3.phpt create mode 100644 ext/standard/tests/dir/dir_basic.phpt create mode 100644 ext/standard/tests/dir/dir_error.phpt create mode 100644 ext/standard/tests/dir/dir_variation1-win32.phpt create mode 100644 ext/standard/tests/dir/dir_variation1.phpt create mode 100644 ext/standard/tests/dir/dir_variation2.phpt create mode 100644 ext/standard/tests/dir/dir_variation3.phpt create mode 100644 ext/standard/tests/dir/dir_variation4.phpt create mode 100644 ext/standard/tests/dir/dir_variation5-win32.phpt create mode 100644 ext/standard/tests/dir/dir_variation5.phpt create mode 100644 ext/standard/tests/dir/dir_variation6-win32.phpt create mode 100644 ext/standard/tests/dir/dir_variation6.phpt create mode 100644 ext/standard/tests/dir/dir_variation7.phpt create mode 100644 ext/standard/tests/dir/dir_variation8-win32.phpt create mode 100644 ext/standard/tests/dir/dir_variation8.phpt create mode 100644 ext/standard/tests/dir/dir_variation9-win32.phpt create mode 100644 ext/standard/tests/dir/dir_variation9.phpt create mode 100644 ext/standard/tests/dir/getcwd_basic.phpt create mode 100644 ext/standard/tests/dir/getcwd_error.phpt create mode 100644 ext/standard/tests/dir/opendir_basic.phpt create mode 100644 ext/standard/tests/dir/opendir_error1.phpt create mode 100644 ext/standard/tests/dir/opendir_error2-win32.phpt create mode 100644 ext/standard/tests/dir/opendir_error2.phpt create mode 100644 ext/standard/tests/dir/opendir_variation1-win32.phpt create mode 100644 ext/standard/tests/dir/opendir_variation1.phpt create mode 100644 ext/standard/tests/dir/opendir_variation2.phpt create mode 100644 ext/standard/tests/dir/opendir_variation3.phpt create mode 100644 ext/standard/tests/dir/opendir_variation4.phpt create mode 100644 ext/standard/tests/dir/opendir_variation5.phpt create mode 100644 ext/standard/tests/dir/opendir_variation6-win32.phpt create mode 100644 ext/standard/tests/dir/opendir_variation6.phpt create mode 100644 ext/standard/tests/dir/opendir_variation7.phpt create mode 100644 ext/standard/tests/dir/readdir_basic.phpt create mode 100644 ext/standard/tests/dir/readdir_error.phpt create mode 100644 ext/standard/tests/dir/readdir_variation1.phpt create mode 100644 ext/standard/tests/dir/readdir_variation2.phpt create mode 100644 ext/standard/tests/dir/readdir_variation3.phpt create mode 100644 ext/standard/tests/dir/readdir_variation4.phpt create mode 100644 ext/standard/tests/dir/readdir_variation5.phpt create mode 100644 ext/standard/tests/dir/readdir_variation6.phpt create mode 100644 ext/standard/tests/dir/readdir_variation7.phpt create mode 100644 ext/standard/tests/dir/rewinddir_basic.phpt create mode 100644 ext/standard/tests/dir/rewinddir_error.phpt create mode 100644 ext/standard/tests/dir/rewinddir_variation1.phpt create mode 100644 ext/standard/tests/dir/rewinddir_variation2.phpt create mode 100644 ext/standard/tests/dir/rewinddir_variation3.phpt create mode 100644 ext/standard/tests/dir/scandir_basic.phpt create mode 100644 ext/standard/tests/dir/scandir_error1.phpt create mode 100644 ext/standard/tests/dir/scandir_error2-win32.phpt create mode 100644 ext/standard/tests/dir/scandir_error2.phpt create mode 100644 ext/standard/tests/dir/scandir_variation1-win32.phpt create mode 100644 ext/standard/tests/dir/scandir_variation1.phpt create mode 100644 ext/standard/tests/dir/scandir_variation10.phpt create mode 100644 ext/standard/tests/dir/scandir_variation2.phpt create mode 100644 ext/standard/tests/dir/scandir_variation3.phpt create mode 100644 ext/standard/tests/dir/scandir_variation4.phpt create mode 100644 ext/standard/tests/dir/scandir_variation5.phpt create mode 100644 ext/standard/tests/dir/scandir_variation6-win32.phpt create mode 100644 ext/standard/tests/dir/scandir_variation6.phpt create mode 100644 ext/standard/tests/dir/scandir_variation7.phpt create mode 100644 ext/standard/tests/dir/scandir_variation8.phpt create mode 100644 ext/standard/tests/dir/scandir_variation9.phpt create mode 100644 ext/standard/tests/directory/DirectoryClass_basic_001.phpt create mode 100644 ext/standard/tests/directory/DirectoryClass_error_001.phpt create mode 100644 ext/standard/tests/directory/directory_constants-win32.phpt create mode 100644 ext/standard/tests/directory/directory_constants.phpt create mode 100644 ext/standard/tests/file/001-win32.phpt create mode 100644 ext/standard/tests/file/001.phpt create mode 100644 ext/standard/tests/file/002.phpt create mode 100644 ext/standard/tests/file/003.phpt create mode 100644 ext/standard/tests/file/004.phpt create mode 100644 ext/standard/tests/file/005_basic.phpt create mode 100644 ext/standard/tests/file/005_error.phpt create mode 100644 ext/standard/tests/file/005_variation-win32.phpt create mode 100644 ext/standard/tests/file/005_variation.phpt create mode 100644 ext/standard/tests/file/005_variation2-win32.phpt create mode 100644 ext/standard/tests/file/005_variation2.phpt create mode 100644 ext/standard/tests/file/006_basic.phpt create mode 100644 ext/standard/tests/file/006_error.phpt create mode 100644 ext/standard/tests/file/006_variation1.phpt create mode 100644 ext/standard/tests/file/006_variation2.phpt create mode 100644 ext/standard/tests/file/007_basic.phpt create mode 100644 ext/standard/tests/file/007_error.phpt create mode 100644 ext/standard/tests/file/007_variation1.phpt create mode 100644 ext/standard/tests/file/007_variation10.phpt create mode 100644 ext/standard/tests/file/007_variation11-win32.phpt create mode 100644 ext/standard/tests/file/007_variation11.phpt create mode 100644 ext/standard/tests/file/007_variation12-win32.phpt create mode 100644 ext/standard/tests/file/007_variation12.phpt create mode 100644 ext/standard/tests/file/007_variation13-win32.phpt create mode 100644 ext/standard/tests/file/007_variation13.phpt create mode 100644 ext/standard/tests/file/007_variation14.phpt create mode 100644 ext/standard/tests/file/007_variation15.phpt create mode 100644 ext/standard/tests/file/007_variation16.phpt create mode 100644 ext/standard/tests/file/007_variation17.phpt create mode 100644 ext/standard/tests/file/007_variation18.phpt create mode 100644 ext/standard/tests/file/007_variation19.phpt create mode 100644 ext/standard/tests/file/007_variation2.phpt create mode 100644 ext/standard/tests/file/007_variation20.phpt create mode 100644 ext/standard/tests/file/007_variation21.phpt create mode 100644 ext/standard/tests/file/007_variation22.phpt create mode 100644 ext/standard/tests/file/007_variation23.phpt create mode 100644 ext/standard/tests/file/007_variation24.phpt create mode 100644 ext/standard/tests/file/007_variation3.phpt create mode 100644 ext/standard/tests/file/007_variation4.phpt create mode 100644 ext/standard/tests/file/007_variation5.phpt create mode 100644 ext/standard/tests/file/007_variation6.phpt create mode 100644 ext/standard/tests/file/007_variation7.phpt create mode 100644 ext/standard/tests/file/007_variation8.phpt create mode 100644 ext/standard/tests/file/007_variation9.phpt create mode 100644 ext/standard/tests/file/basename-win32.phpt create mode 100644 ext/standard/tests/file/basename.phpt create mode 100644 ext/standard/tests/file/basename_basic-win32.phpt create mode 100644 ext/standard/tests/file/basename_basic.phpt create mode 100644 ext/standard/tests/file/basename_error.phpt create mode 100644 ext/standard/tests/file/basename_variation1-win32.phpt create mode 100644 ext/standard/tests/file/basename_variation1.phpt create mode 100644 ext/standard/tests/file/basename_variation2-win32.phpt create mode 100644 ext/standard/tests/file/basename_variation2.phpt create mode 100644 ext/standard/tests/file/basename_variation3.phpt create mode 100644 ext/standard/tests/file/basename_variation4.phpt create mode 100644 ext/standard/tests/file/bug12556.phpt create mode 100644 ext/standard/tests/file/bug20424.phpt create mode 100644 ext/standard/tests/file/bug22382.phpt create mode 100644 ext/standard/tests/file/bug22414.phpt create mode 100644 ext/standard/tests/file/bug24313.phpt create mode 100644 ext/standard/tests/file/bug24482.phpt create mode 100644 ext/standard/tests/file/bug26003.phpt create mode 100644 ext/standard/tests/file/bug26615.phpt create mode 100644 ext/standard/tests/file/bug26938.phpt create mode 100644 ext/standard/tests/file/bug27508.phpt create mode 100644 ext/standard/tests/file/bug27619.phpt create mode 100644 ext/standard/tests/file/bug30362.phpt create mode 100644 ext/standard/tests/file/bug30362.txt create mode 100644 ext/standard/tests/file/bug32160.phpt create mode 100644 ext/standard/tests/file/bug32160.txt create mode 100644 ext/standard/tests/file/bug35740.phpt create mode 100644 ext/standard/tests/file/bug35781.phpt create mode 100644 ext/standard/tests/file/bug37158.phpt create mode 100644 ext/standard/tests/file/bug37864.phpt create mode 100644 ext/standard/tests/file/bug38086.phpt create mode 100644 ext/standard/tests/file/bug38086.txt create mode 100644 ext/standard/tests/file/bug38450.phpt create mode 100644 ext/standard/tests/file/bug38450_1.phpt create mode 100644 ext/standard/tests/file/bug38450_2.phpt create mode 100644 ext/standard/tests/file/bug38450_3.phpt create mode 100644 ext/standard/tests/file/bug39367.phpt create mode 100644 ext/standard/tests/file/bug39538.phpt create mode 100644 ext/standard/tests/file/bug39551.phpt create mode 100644 ext/standard/tests/file/bug39673.phpt create mode 100644 ext/standard/tests/file/bug39863.phpt create mode 100644 ext/standard/tests/file/bug40374.phpt create mode 100644 ext/standard/tests/file/bug40501.csv create mode 100644 ext/standard/tests/file/bug40501.phpt create mode 100644 ext/standard/tests/file/bug41655_1.phpt create mode 100644 ext/standard/tests/file/bug41655_2.phpt create mode 100644 ext/standard/tests/file/bug41693.phpt create mode 100644 ext/standard/tests/file/bug41815.phpt create mode 100644 ext/standard/tests/file/bug41874.phpt create mode 100644 ext/standard/tests/file/bug41874_1.phpt create mode 100644 ext/standard/tests/file/bug41874_2.phpt create mode 100644 ext/standard/tests/file/bug41874_3.phpt create mode 100644 ext/standard/tests/file/bug43008.phpt create mode 100644 ext/standard/tests/file/bug43137.phpt create mode 100644 ext/standard/tests/file/bug43216.phpt create mode 100644 ext/standard/tests/file/bug43248.phpt create mode 100644 ext/standard/tests/file/bug43353-win32.phpt create mode 100644 ext/standard/tests/file/bug43353.phpt create mode 100644 ext/standard/tests/file/bug43522.phpt create mode 100644 ext/standard/tests/file/bug44034.phpt create mode 100644 ext/standard/tests/file/bug44607.phpt create mode 100644 ext/standard/tests/file/bug44805.phpt create mode 100644 ext/standard/tests/file/bug45181.phpt create mode 100644 ext/standard/tests/file/bug45303.phpt create mode 100644 ext/standard/tests/file/bug45985.phpt create mode 100644 ext/standard/tests/file/bug46347.phpt create mode 100644 ext/standard/tests/file/bug47767.phpt create mode 100644 ext/standard/tests/file/bug49047.phpt create mode 100644 ext/standard/tests/file/bug51094.phpt create mode 100644 ext/standard/tests/file/bug52624.phpt create mode 100644 ext/standard/tests/file/bug52820.phpt create mode 100644 ext/standard/tests/file/bug53241.phpt create mode 100644 ext/standard/tests/file/bug53848.phpt create mode 100644 ext/standard/tests/file/bug55124.phpt create mode 100644 ext/standard/tests/file/bug60120.phpt create mode 100644 ext/standard/tests/file/bug61961.phpt create mode 100644 ext/standard/tests/file/bug63512.phpt create mode 100644 ext/standard/tests/file/chgrp.phpt create mode 100644 ext/standard/tests/file/chmod_basic-win32.phpt create mode 100644 ext/standard/tests/file/chmod_basic.phpt create mode 100644 ext/standard/tests/file/chmod_error.phpt create mode 100644 ext/standard/tests/file/chmod_variation1.phpt create mode 100644 ext/standard/tests/file/chmod_variation2-win32.phpt create mode 100644 ext/standard/tests/file/chmod_variation2.phpt create mode 100644 ext/standard/tests/file/chmod_variation3.phpt create mode 100644 ext/standard/tests/file/chmod_variation4.phpt create mode 100644 ext/standard/tests/file/chown.phpt create mode 100644 ext/standard/tests/file/chroot_001.phpt create mode 100644 ext/standard/tests/file/clearstatcache_001.phpt create mode 100644 ext/standard/tests/file/clearstatcache_error.phpt create mode 100644 ext/standard/tests/file/copy_basic.phpt create mode 100644 ext/standard/tests/file/copy_error.phpt create mode 100644 ext/standard/tests/file/copy_variation1.phpt create mode 100644 ext/standard/tests/file/copy_variation10.phpt create mode 100644 ext/standard/tests/file/copy_variation11.phpt create mode 100644 ext/standard/tests/file/copy_variation12-win32.phpt create mode 100644 ext/standard/tests/file/copy_variation12.phpt create mode 100644 ext/standard/tests/file/copy_variation13.phpt create mode 100644 ext/standard/tests/file/copy_variation14.phpt create mode 100644 ext/standard/tests/file/copy_variation15.phpt create mode 100644 ext/standard/tests/file/copy_variation16-win32.phpt create mode 100644 ext/standard/tests/file/copy_variation16.phpt create mode 100644 ext/standard/tests/file/copy_variation17.phpt create mode 100644 ext/standard/tests/file/copy_variation18.phpt create mode 100644 ext/standard/tests/file/copy_variation2-win32.phpt create mode 100644 ext/standard/tests/file/copy_variation2.phpt create mode 100644 ext/standard/tests/file/copy_variation3-win32.phpt create mode 100644 ext/standard/tests/file/copy_variation3.phpt create mode 100644 ext/standard/tests/file/copy_variation4.phpt create mode 100644 ext/standard/tests/file/copy_variation5-win32.phpt create mode 100644 ext/standard/tests/file/copy_variation5.phpt create mode 100644 ext/standard/tests/file/copy_variation6-win32.phpt create mode 100644 ext/standard/tests/file/copy_variation6.phpt create mode 100644 ext/standard/tests/file/copy_variation7.phpt create mode 100644 ext/standard/tests/file/copy_variation8.phpt create mode 100644 ext/standard/tests/file/copy_variation9.phpt create mode 100644 ext/standard/tests/file/directory_wrapper_fstat_basic.phpt create mode 100644 ext/standard/tests/file/dirname_basic-win32.phpt create mode 100644 ext/standard/tests/file/dirname_basic.phpt create mode 100644 ext/standard/tests/file/dirname_error.phpt create mode 100644 ext/standard/tests/file/dirname_variation1.phpt create mode 100644 ext/standard/tests/file/disk.phpt create mode 100644 ext/standard/tests/file/disk_free_space_basic.phpt create mode 100644 ext/standard/tests/file/disk_free_space_error-win32.phpt create mode 100644 ext/standard/tests/file/disk_free_space_error.phpt create mode 100644 ext/standard/tests/file/disk_free_space_variation.phpt create mode 100644 ext/standard/tests/file/disk_total_space_basic.phpt create mode 100644 ext/standard/tests/file/disk_total_space_error-win32.phpt create mode 100644 ext/standard/tests/file/disk_total_space_error.phpt create mode 100644 ext/standard/tests/file/disk_total_space_variation.phpt create mode 100644 ext/standard/tests/file/fclose_variation1.phpt create mode 100644 ext/standard/tests/file/feof_basic.phpt create mode 100644 ext/standard/tests/file/fflush_basic.phpt create mode 100644 ext/standard/tests/file/fflush_error.phpt create mode 100644 ext/standard/tests/file/fflush_variation1-win32.phpt create mode 100644 ext/standard/tests/file/fflush_variation1.phpt create mode 100644 ext/standard/tests/file/fflush_variation2.phpt create mode 100644 ext/standard/tests/file/fflush_variation3.phpt create mode 100644 ext/standard/tests/file/fflush_variation4.phpt create mode 100644 ext/standard/tests/file/fgetc_basic.phpt create mode 100644 ext/standard/tests/file/fgetc_error.phpt create mode 100644 ext/standard/tests/file/fgetc_variation1.phpt create mode 100644 ext/standard/tests/file/fgetc_variation2.phpt create mode 100644 ext/standard/tests/file/fgetc_variation3.phpt create mode 100644 ext/standard/tests/file/fgetc_variation4.phpt create mode 100644 ext/standard/tests/file/fgetcsv.phpt create mode 100644 ext/standard/tests/file/fgetcsv_error.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation1.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation10.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation11.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation12.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation13.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation14.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation15.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation16.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation17.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation18.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation19.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation2.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation20.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation21.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation22.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation23.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation24.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation25.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation26.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation27.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation28.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation29.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation3.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation30.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation31.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation4.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation5.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation6.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation7.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation8.phpt create mode 100644 ext/standard/tests/file/fgetcsv_variation9.phpt create mode 100644 ext/standard/tests/file/fgets_basic.phpt create mode 100644 ext/standard/tests/file/fgets_error.phpt create mode 100644 ext/standard/tests/file/fgets_socket_variation1.phpt create mode 100644 ext/standard/tests/file/fgets_socket_variation2.phpt create mode 100644 ext/standard/tests/file/fgets_variation1.phpt create mode 100644 ext/standard/tests/file/fgets_variation2.phpt create mode 100644 ext/standard/tests/file/fgets_variation3.phpt create mode 100644 ext/standard/tests/file/fgets_variation4-win32.phpt create mode 100644 ext/standard/tests/file/fgets_variation4.phpt create mode 100644 ext/standard/tests/file/fgets_variation5.phpt create mode 100644 ext/standard/tests/file/fgets_variation6-win32.phpt create mode 100644 ext/standard/tests/file/fgets_variation6.phpt create mode 100644 ext/standard/tests/file/fgetss.phpt create mode 100644 ext/standard/tests/file/fgetss1.phpt create mode 100644 ext/standard/tests/file/fgetss_basic1.phpt create mode 100644 ext/standard/tests/file/fgetss_basic2-win32.phpt create mode 100644 ext/standard/tests/file/fgetss_basic2.phpt create mode 100644 ext/standard/tests/file/fgetss_error.phpt create mode 100644 ext/standard/tests/file/fgetss_variation1-win32.phpt create mode 100644 ext/standard/tests/file/fgetss_variation1.phpt create mode 100644 ext/standard/tests/file/fgetss_variation2.phpt create mode 100644 ext/standard/tests/file/fgetss_variation3-win32.phpt create mode 100644 ext/standard/tests/file/fgetss_variation3.phpt create mode 100644 ext/standard/tests/file/fgetss_variation4.phpt create mode 100644 ext/standard/tests/file/fgetss_variation5-win32.phpt create mode 100644 ext/standard/tests/file/fgetss_variation5.phpt create mode 100644 ext/standard/tests/file/file.inc create mode 100644 ext/standard/tests/file/file_basic.phpt create mode 100644 ext/standard/tests/file/file_error.phpt create mode 100644 ext/standard/tests/file/file_exists_error.phpt create mode 100644 ext/standard/tests/file/file_exists_variation1.phpt create mode 100644 ext/standard/tests/file/file_get_contents_basic.phpt create mode 100644 ext/standard/tests/file/file_get_contents_basic001.phpt create mode 100644 ext/standard/tests/file/file_get_contents_error.phpt create mode 100644 ext/standard/tests/file/file_get_contents_error001.phpt create mode 100644 ext/standard/tests/file/file_get_contents_error002.phpt create mode 100644 ext/standard/tests/file/file_get_contents_file_put_contents_basic.phpt create mode 100644 ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt create mode 100644 ext/standard/tests/file/file_get_contents_file_put_contents_variation1.phpt create mode 100644 ext/standard/tests/file/file_get_contents_file_put_contents_variation2.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation1.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation2.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation3.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation4.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation5.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation6.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation7-win32.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation7.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation8-win32.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation8.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation9.phpt create mode 100644 ext/standard/tests/file/file_put_contents.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation1.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation2.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation3.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation4.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation5.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation6.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation7-win32.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation7.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation8-win32.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation8.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation9.phpt create mode 100644 ext/standard/tests/file/file_variation.phpt create mode 100644 ext/standard/tests/file/file_variation2.phpt create mode 100644 ext/standard/tests/file/file_variation3.phpt create mode 100644 ext/standard/tests/file/file_variation4.phpt create mode 100644 ext/standard/tests/file/file_variation5-win32.phpt create mode 100644 ext/standard/tests/file/file_variation5.phpt create mode 100644 ext/standard/tests/file/file_variation6.phpt create mode 100644 ext/standard/tests/file/file_variation7.phpt create mode 100644 ext/standard/tests/file/file_variation8-win32.phpt create mode 100644 ext/standard/tests/file/file_variation8.phpt create mode 100644 ext/standard/tests/file/file_variation9.phpt create mode 100644 ext/standard/tests/file/filegroup_basic.phpt create mode 100644 ext/standard/tests/file/filegroup_error.phpt create mode 100644 ext/standard/tests/file/filegroup_variation1.phpt create mode 100644 ext/standard/tests/file/filegroup_variation2.phpt create mode 100644 ext/standard/tests/file/filegroup_variation3.phpt create mode 100644 ext/standard/tests/file/fileinode_basic.phpt create mode 100644 ext/standard/tests/file/fileinode_error.phpt create mode 100644 ext/standard/tests/file/fileinode_variation.phpt create mode 100644 ext/standard/tests/file/fileinode_variation1.phpt create mode 100644 ext/standard/tests/file/fileinode_variation2.phpt create mode 100644 ext/standard/tests/file/fileinode_variation3.phpt create mode 100644 ext/standard/tests/file/fileowner_basic.phpt create mode 100644 ext/standard/tests/file/fileowner_error.phpt create mode 100644 ext/standard/tests/file/fileowner_variation1.phpt create mode 100644 ext/standard/tests/file/fileowner_variation2.phpt create mode 100644 ext/standard/tests/file/fileowner_variation3.phpt create mode 100644 ext/standard/tests/file/fileperms_variation1.phpt create mode 100644 ext/standard/tests/file/fileperms_variation2.phpt create mode 100644 ext/standard/tests/file/fileperms_variation3.phpt create mode 100644 ext/standard/tests/file/filesize_basic.phpt create mode 100644 ext/standard/tests/file/filesize_error.phpt create mode 100644 ext/standard/tests/file/filesize_variation1-win32.phpt create mode 100644 ext/standard/tests/file/filesize_variation1.phpt create mode 100644 ext/standard/tests/file/filesize_variation2-win32.phpt create mode 100644 ext/standard/tests/file/filesize_variation2.phpt create mode 100644 ext/standard/tests/file/filesize_variation3-win32.phpt create mode 100644 ext/standard/tests/file/filesize_variation3.phpt create mode 100644 ext/standard/tests/file/filesize_variation4-win32.phpt create mode 100644 ext/standard/tests/file/filesize_variation4.phpt create mode 100644 ext/standard/tests/file/filesize_variation5.phpt create mode 100644 ext/standard/tests/file/filestat.phpt create mode 100644 ext/standard/tests/file/filetype_basic.phpt create mode 100644 ext/standard/tests/file/filetype_error.phpt create mode 100644 ext/standard/tests/file/filetype_variation.phpt create mode 100644 ext/standard/tests/file/filetype_variation2.phpt create mode 100644 ext/standard/tests/file/filetype_variation3.phpt create mode 100644 ext/standard/tests/file/flock.phpt create mode 100644 ext/standard/tests/file/flock_basic.phpt create mode 100644 ext/standard/tests/file/flock_error.phpt create mode 100644 ext/standard/tests/file/flock_variation.phpt create mode 100644 ext/standard/tests/file/fnmatch_basic.phpt create mode 100644 ext/standard/tests/file/fnmatch_error.phpt create mode 100644 ext/standard/tests/file/fnmatch_variation.phpt create mode 100644 ext/standard/tests/file/fopen_include_path.inc create mode 100644 ext/standard/tests/file/fopen_variation1.phpt create mode 100644 ext/standard/tests/file/fopen_variation10-win32.phpt create mode 100644 ext/standard/tests/file/fopen_variation11-win32.phpt create mode 100644 ext/standard/tests/file/fopen_variation12.phpt create mode 100644 ext/standard/tests/file/fopen_variation13.phpt create mode 100644 ext/standard/tests/file/fopen_variation14-win32.phpt create mode 100644 ext/standard/tests/file/fopen_variation14.phpt create mode 100644 ext/standard/tests/file/fopen_variation15-win32.phpt create mode 100644 ext/standard/tests/file/fopen_variation15.phpt create mode 100644 ext/standard/tests/file/fopen_variation16.phpt create mode 100644 ext/standard/tests/file/fopen_variation17.phpt create mode 100644 ext/standard/tests/file/fopen_variation19.phpt create mode 100644 ext/standard/tests/file/fopen_variation3.phpt create mode 100644 ext/standard/tests/file/fopen_variation4.phpt create mode 100644 ext/standard/tests/file/fopen_variation5.phpt create mode 100644 ext/standard/tests/file/fopen_variation6.phpt create mode 100644 ext/standard/tests/file/fopen_variation7.phpt create mode 100644 ext/standard/tests/file/fopen_variation8.phpt create mode 100644 ext/standard/tests/file/fopen_variation9.phpt create mode 100644 ext/standard/tests/file/fopencookie.phpt create mode 100644 ext/standard/tests/file/fpassthru_basic.phpt create mode 100644 ext/standard/tests/file/fpassthru_error.phpt create mode 100644 ext/standard/tests/file/fpassthru_variation.phpt create mode 100644 ext/standard/tests/file/fpassthru_variation1.phpt create mode 100644 ext/standard/tests/file/fputcsv.phpt create mode 100644 ext/standard/tests/file/fputcsv_002.phpt create mode 100644 ext/standard/tests/file/fputcsv_error.phpt create mode 100644 ext/standard/tests/file/fputcsv_variation1.phpt create mode 100644 ext/standard/tests/file/fputcsv_variation10.phpt create mode 100644 ext/standard/tests/file/fputcsv_variation11.phpt create mode 100644 ext/standard/tests/file/fputcsv_variation12.phpt create mode 100644 ext/standard/tests/file/fputcsv_variation13.phpt create mode 100644 ext/standard/tests/file/fputcsv_variation14.phpt create mode 100644 ext/standard/tests/file/fputcsv_variation2.phpt create mode 100644 ext/standard/tests/file/fputcsv_variation3.phpt create mode 100644 ext/standard/tests/file/fputcsv_variation4.phpt create mode 100644 ext/standard/tests/file/fputcsv_variation5.phpt create mode 100644 ext/standard/tests/file/fputcsv_variation6.phpt create mode 100644 ext/standard/tests/file/fputcsv_variation7.phpt create mode 100644 ext/standard/tests/file/fputcsv_variation8.phpt create mode 100644 ext/standard/tests/file/fputcsv_variation9.phpt create mode 100644 ext/standard/tests/file/fread_basic.phpt create mode 100644 ext/standard/tests/file/fread_error.phpt create mode 100644 ext/standard/tests/file/fread_fwrite_basic.phpt create mode 100644 ext/standard/tests/file/fread_socket_variation1.phpt create mode 100644 ext/standard/tests/file/fread_variation1.phpt create mode 100644 ext/standard/tests/file/fread_variation2.phpt create mode 100644 ext/standard/tests/file/fread_variation3-win32.phpt create mode 100644 ext/standard/tests/file/fread_variation3.phpt create mode 100644 ext/standard/tests/file/fread_variation4-win32.phpt create mode 100644 ext/standard/tests/file/fread_variation4.phpt create mode 100644 ext/standard/tests/file/fscanf.phpt create mode 100644 ext/standard/tests/file/fscanf_error.phpt create mode 100644 ext/standard/tests/file/fscanf_variation1.phpt create mode 100644 ext/standard/tests/file/fscanf_variation10.phpt create mode 100644 ext/standard/tests/file/fscanf_variation11.phpt create mode 100644 ext/standard/tests/file/fscanf_variation12.phpt create mode 100644 ext/standard/tests/file/fscanf_variation13.phpt create mode 100644 ext/standard/tests/file/fscanf_variation14.phpt create mode 100644 ext/standard/tests/file/fscanf_variation15.phpt create mode 100644 ext/standard/tests/file/fscanf_variation16.phpt create mode 100644 ext/standard/tests/file/fscanf_variation17.phpt create mode 100644 ext/standard/tests/file/fscanf_variation18.phpt create mode 100644 ext/standard/tests/file/fscanf_variation19.phpt create mode 100644 ext/standard/tests/file/fscanf_variation2.phpt create mode 100644 ext/standard/tests/file/fscanf_variation20.phpt create mode 100644 ext/standard/tests/file/fscanf_variation21.phpt create mode 100644 ext/standard/tests/file/fscanf_variation22.phpt create mode 100644 ext/standard/tests/file/fscanf_variation23.phpt create mode 100644 ext/standard/tests/file/fscanf_variation24.phpt create mode 100644 ext/standard/tests/file/fscanf_variation25.phpt create mode 100644 ext/standard/tests/file/fscanf_variation26.phpt create mode 100644 ext/standard/tests/file/fscanf_variation27.phpt create mode 100644 ext/standard/tests/file/fscanf_variation28.phpt create mode 100644 ext/standard/tests/file/fscanf_variation29.phpt create mode 100644 ext/standard/tests/file/fscanf_variation3.phpt create mode 100644 ext/standard/tests/file/fscanf_variation30.phpt create mode 100644 ext/standard/tests/file/fscanf_variation31.phpt create mode 100644 ext/standard/tests/file/fscanf_variation32.phpt create mode 100644 ext/standard/tests/file/fscanf_variation33.phpt create mode 100644 ext/standard/tests/file/fscanf_variation34.phpt create mode 100644 ext/standard/tests/file/fscanf_variation35.phpt create mode 100644 ext/standard/tests/file/fscanf_variation36.phpt create mode 100644 ext/standard/tests/file/fscanf_variation37.phpt create mode 100644 ext/standard/tests/file/fscanf_variation38.phpt create mode 100644 ext/standard/tests/file/fscanf_variation39.phpt create mode 100644 ext/standard/tests/file/fscanf_variation4.phpt create mode 100644 ext/standard/tests/file/fscanf_variation40.phpt create mode 100644 ext/standard/tests/file/fscanf_variation41.phpt create mode 100644 ext/standard/tests/file/fscanf_variation42.phpt create mode 100644 ext/standard/tests/file/fscanf_variation43.phpt create mode 100644 ext/standard/tests/file/fscanf_variation44.phpt create mode 100644 ext/standard/tests/file/fscanf_variation45.phpt create mode 100644 ext/standard/tests/file/fscanf_variation46.phpt create mode 100644 ext/standard/tests/file/fscanf_variation47.phpt create mode 100644 ext/standard/tests/file/fscanf_variation48.phpt create mode 100644 ext/standard/tests/file/fscanf_variation49.phpt create mode 100644 ext/standard/tests/file/fscanf_variation5.phpt create mode 100644 ext/standard/tests/file/fscanf_variation50.phpt create mode 100644 ext/standard/tests/file/fscanf_variation51.phpt create mode 100644 ext/standard/tests/file/fscanf_variation52.phpt create mode 100644 ext/standard/tests/file/fscanf_variation53.phpt create mode 100644 ext/standard/tests/file/fscanf_variation54.phpt create mode 100644 ext/standard/tests/file/fscanf_variation55.phpt create mode 100644 ext/standard/tests/file/fscanf_variation6.phpt create mode 100644 ext/standard/tests/file/fscanf_variation7.phpt create mode 100644 ext/standard/tests/file/fscanf_variation8.phpt create mode 100644 ext/standard/tests/file/fscanf_variation9.phpt create mode 100644 ext/standard/tests/file/fseek_dir_basic.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_basic1.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_basic2-win32.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_basic2.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_error1.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_error2.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_error3.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_variation1.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_variation2.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_variation3.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_variation4-win32.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_variation4.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_variation5.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_variation6-win32.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_variation6.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_variation7.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_variation8-win32.phpt create mode 100644 ext/standard/tests/file/fseek_ftell_rewind_variation8.phpt create mode 100644 ext/standard/tests/file/fseek_variation1.phpt create mode 100644 ext/standard/tests/file/fseek_variation2.phpt create mode 100644 ext/standard/tests/file/fseek_variation3.phpt create mode 100644 ext/standard/tests/file/fstat.phpt create mode 100644 ext/standard/tests/file/fstat_basic.phpt create mode 100644 ext/standard/tests/file/fstat_error.phpt create mode 100644 ext/standard/tests/file/fstat_variation1.phpt create mode 100644 ext/standard/tests/file/fstat_variation2.phpt create mode 100644 ext/standard/tests/file/fstat_variation3.phpt create mode 100644 ext/standard/tests/file/fstat_variation4.phpt create mode 100644 ext/standard/tests/file/fstat_variation5.phpt create mode 100644 ext/standard/tests/file/fstat_variation6.phpt create mode 100644 ext/standard/tests/file/fstat_variation7.phpt create mode 100644 ext/standard/tests/file/fstat_variation8.phpt create mode 100644 ext/standard/tests/file/ftruncate.phpt create mode 100644 ext/standard/tests/file/ftruncate_error.phpt create mode 100644 ext/standard/tests/file/ftruncate_variation1-win32.phpt create mode 100644 ext/standard/tests/file/ftruncate_variation1.phpt create mode 100644 ext/standard/tests/file/ftruncate_variation2-win32.phpt create mode 100644 ext/standard/tests/file/ftruncate_variation2.phpt create mode 100644 ext/standard/tests/file/ftruncate_variation3-win32.phpt create mode 100644 ext/standard/tests/file/ftruncate_variation3.phpt create mode 100644 ext/standard/tests/file/ftruncate_variation4-win32.phpt create mode 100644 ext/standard/tests/file/ftruncate_variation4.phpt create mode 100644 ext/standard/tests/file/ftruncate_variation5-win32.phpt create mode 100644 ext/standard/tests/file/ftruncate_variation5.phpt create mode 100644 ext/standard/tests/file/ftruncate_variation6-win32.phpt create mode 100644 ext/standard/tests/file/ftruncate_variation6.phpt create mode 100644 ext/standard/tests/file/ftruncate_variation7-win32.phpt create mode 100644 ext/standard/tests/file/ftruncate_variation7.phpt create mode 100644 ext/standard/tests/file/fwrite.phpt create mode 100644 ext/standard/tests/file/fwrite_basic-win32.phpt create mode 100644 ext/standard/tests/file/fwrite_basic.phpt create mode 100644 ext/standard/tests/file/fwrite_error.phpt create mode 100644 ext/standard/tests/file/fwrite_variation1-win32.phpt create mode 100644 ext/standard/tests/file/fwrite_variation1.phpt create mode 100644 ext/standard/tests/file/fwrite_variation2-win32.phpt create mode 100644 ext/standard/tests/file/fwrite_variation2.phpt create mode 100644 ext/standard/tests/file/fwrite_variation3-win32.phpt create mode 100644 ext/standard/tests/file/fwrite_variation3.phpt create mode 100644 ext/standard/tests/file/fwrite_variation4-win32.phpt create mode 100644 ext/standard/tests/file/fwrite_variation4.phpt create mode 100644 ext/standard/tests/file/fwrite_variation5.phpt create mode 100644 ext/standard/tests/file/get_current_user.phpt create mode 100644 ext/standard/tests/file/glob_basic.phpt create mode 100644 ext/standard/tests/file/glob_error.phpt create mode 100644 ext/standard/tests/file/glob_error_002-win32.phpt create mode 100644 ext/standard/tests/file/glob_variation-win32.phpt create mode 100644 ext/standard/tests/file/glob_variation.phpt create mode 100644 ext/standard/tests/file/glob_variation2.phpt create mode 100644 ext/standard/tests/file/include_streams.phpt create mode 100644 ext/standard/tests/file/include_userstream_001.phpt create mode 100644 ext/standard/tests/file/include_userstream_002.phpt create mode 100644 ext/standard/tests/file/include_userstream_003.phpt create mode 100644 ext/standard/tests/file/is_dir_basic.phpt create mode 100644 ext/standard/tests/file/is_dir_error.phpt create mode 100644 ext/standard/tests/file/is_dir_variation1.phpt create mode 100644 ext/standard/tests/file/is_dir_variation2.phpt create mode 100644 ext/standard/tests/file/is_dir_variation3.phpt create mode 100644 ext/standard/tests/file/is_dir_variation4.phpt create mode 100644 ext/standard/tests/file/is_executable_basic-win32.phpt create mode 100644 ext/standard/tests/file/is_executable_basic.phpt create mode 100644 ext/standard/tests/file/is_executable_error.phpt create mode 100644 ext/standard/tests/file/is_executable_variation1.phpt create mode 100644 ext/standard/tests/file/is_executable_variation2.phpt create mode 100644 ext/standard/tests/file/is_executable_variation3.phpt create mode 100644 ext/standard/tests/file/is_file_basic.phpt create mode 100644 ext/standard/tests/file/is_file_error.phpt create mode 100644 ext/standard/tests/file/is_file_variation1.phpt create mode 100644 ext/standard/tests/file/is_file_variation2.phpt create mode 100644 ext/standard/tests/file/is_file_variation3.phpt create mode 100644 ext/standard/tests/file/is_file_variation4.phpt create mode 100644 ext/standard/tests/file/is_readable_basic-win32.phpt create mode 100644 ext/standard/tests/file/is_readable_basic.phpt create mode 100644 ext/standard/tests/file/is_readable_error.phpt create mode 100644 ext/standard/tests/file/is_readable_variation1.phpt create mode 100644 ext/standard/tests/file/is_readable_variation2.phpt create mode 100644 ext/standard/tests/file/is_readable_variation3.phpt create mode 100644 ext/standard/tests/file/is_uploaded_file_basic.phpt create mode 100644 ext/standard/tests/file/is_writable_basic.phpt create mode 100644 ext/standard/tests/file/is_writable_error.phpt create mode 100644 ext/standard/tests/file/is_writable_variation1.phpt create mode 100644 ext/standard/tests/file/is_writable_variation2.phpt create mode 100644 ext/standard/tests/file/is_writable_variation3.phpt create mode 100644 ext/standard/tests/file/lchgrp_basic.phpt create mode 100644 ext/standard/tests/file/lchown_basic.phpt create mode 100644 ext/standard/tests/file/lchown_error.phpt create mode 100644 ext/standard/tests/file/link_win32.phpt create mode 100644 ext/standard/tests/file/lstat_stat_basic.phpt create mode 100644 ext/standard/tests/file/lstat_stat_error.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation1.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation10.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation11.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation12.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation13.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation14.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation15.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation16.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation17.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation18.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation19.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation2.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation20.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation21.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation22.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation3.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation4.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation5.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation6.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation7.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation8.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation9.phpt create mode 100644 ext/standard/tests/file/mkdir-001.phpt create mode 100644 ext/standard/tests/file/mkdir-002.phpt create mode 100644 ext/standard/tests/file/mkdir-003.phpt create mode 100644 ext/standard/tests/file/mkdir-004.phpt create mode 100644 ext/standard/tests/file/mkdir-005.phpt create mode 100644 ext/standard/tests/file/mkdir-006.phpt create mode 100644 ext/standard/tests/file/mkdir_rmdir_error.phpt create mode 100644 ext/standard/tests/file/mkdir_rmdir_variation-win32.phpt create mode 100644 ext/standard/tests/file/mkdir_rmdir_variation1.phpt create mode 100644 ext/standard/tests/file/mkdir_rmdir_variation2.phpt create mode 100644 ext/standard/tests/file/mkdir_variation1-win32.phpt create mode 100644 ext/standard/tests/file/mkdir_variation1.phpt create mode 100644 ext/standard/tests/file/mkdir_variation2.phpt create mode 100644 ext/standard/tests/file/mkdir_variation3.phpt create mode 100644 ext/standard/tests/file/mkdir_variation4.phpt create mode 100644 ext/standard/tests/file/mkdir_variation5-win32.phpt create mode 100644 ext/standard/tests/file/mkdir_variation5.phpt create mode 100644 ext/standard/tests/file/move_uploaded_file_basic.phpt create mode 100644 ext/standard/tests/file/parse_ini_file.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_error.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_variation1.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_variation2.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_variation3.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_variation4.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_variation5.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_variation6-win32.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_variation6.phpt create mode 100644 ext/standard/tests/file/pathinfo_basic.phpt create mode 100644 ext/standard/tests/file/pathinfo_basic1-win32.phpt create mode 100644 ext/standard/tests/file/pathinfo_basic1.phpt create mode 100644 ext/standard/tests/file/pathinfo_basic2-win32.phpt create mode 100644 ext/standard/tests/file/pathinfo_basic2.phpt create mode 100644 ext/standard/tests/file/pathinfo_error.phpt create mode 100644 ext/standard/tests/file/pathinfo_variation1.phpt create mode 100644 ext/standard/tests/file/pathinfo_variation2.phpt create mode 100644 ext/standard/tests/file/pathinfo_variation3.phpt create mode 100644 ext/standard/tests/file/pathinfo_variaton.phpt create mode 100644 ext/standard/tests/file/pclose_variation1.phpt create mode 100644 ext/standard/tests/file/php_fd_wrapper_01.phpt create mode 100644 ext/standard/tests/file/php_fd_wrapper_02.phpt create mode 100644 ext/standard/tests/file/php_fd_wrapper_03.phpt create mode 100644 ext/standard/tests/file/php_fd_wrapper_04.phpt create mode 100644 ext/standard/tests/file/popen_pclose_basic-win32.phpt create mode 100644 ext/standard/tests/file/popen_pclose_basic.phpt create mode 100644 ext/standard/tests/file/popen_pclose_error-sunos.phpt create mode 100644 ext/standard/tests/file/popen_pclose_error-win32-debug.phpt create mode 100644 ext/standard/tests/file/popen_pclose_error-win32.phpt create mode 100644 ext/standard/tests/file/popen_pclose_error.phpt create mode 100644 ext/standard/tests/file/proc_open01.phpt create mode 100644 ext/standard/tests/file/readfile_basic-win32.phpt create mode 100644 ext/standard/tests/file/readfile_basic.phpt create mode 100644 ext/standard/tests/file/readfile_error.phpt create mode 100644 ext/standard/tests/file/readfile_variation1.phpt create mode 100644 ext/standard/tests/file/readfile_variation10-win32.phpt create mode 100644 ext/standard/tests/file/readfile_variation10.phpt create mode 100644 ext/standard/tests/file/readfile_variation2.phpt create mode 100644 ext/standard/tests/file/readfile_variation3.phpt create mode 100644 ext/standard/tests/file/readfile_variation4.phpt create mode 100644 ext/standard/tests/file/readfile_variation5.phpt create mode 100644 ext/standard/tests/file/readfile_variation6.phpt create mode 100644 ext/standard/tests/file/readfile_variation7.phpt create mode 100644 ext/standard/tests/file/readfile_variation8-win32.phpt create mode 100644 ext/standard/tests/file/readfile_variation9.phpt create mode 100644 ext/standard/tests/file/readlink_realpath_basic1.phpt create mode 100644 ext/standard/tests/file/readlink_realpath_basic2.phpt create mode 100644 ext/standard/tests/file/readlink_realpath_error.phpt create mode 100644 ext/standard/tests/file/readlink_realpath_variation1.phpt create mode 100644 ext/standard/tests/file/readlink_realpath_variation2.phpt create mode 100644 ext/standard/tests/file/readlink_realpath_variation3.phpt create mode 100644 ext/standard/tests/file/readlink_variation1.phpt create mode 100644 ext/standard/tests/file/realpath_basic-win32.phpt create mode 100644 ext/standard/tests/file/realpath_basic2.phpt create mode 100644 ext/standard/tests/file/realpath_basic3.phpt create mode 100644 ext/standard/tests/file/realpath_basic4.phpt create mode 100644 ext/standard/tests/file/realpath_cache.phpt create mode 100644 ext/standard/tests/file/realpath_cache_win32.phpt create mode 100644 ext/standard/tests/file/realpath_error-win32.phpt create mode 100644 ext/standard/tests/file/realpath_variation-win32.phpt create mode 100644 ext/standard/tests/file/realpath_variation2.phpt create mode 100644 ext/standard/tests/file/rename_basic.phpt create mode 100644 ext/standard/tests/file/rename_error.phpt create mode 100644 ext/standard/tests/file/rename_variation-win32.phpt create mode 100644 ext/standard/tests/file/rename_variation.phpt create mode 100644 ext/standard/tests/file/rename_variation1-win32.phpt create mode 100644 ext/standard/tests/file/rename_variation1.phpt create mode 100644 ext/standard/tests/file/rename_variation10.phpt create mode 100644 ext/standard/tests/file/rename_variation11-win32.phpt create mode 100644 ext/standard/tests/file/rename_variation12-win32.phpt create mode 100644 ext/standard/tests/file/rename_variation12.phpt create mode 100644 ext/standard/tests/file/rename_variation13-win32.phpt create mode 100644 ext/standard/tests/file/rename_variation13.phpt create mode 100644 ext/standard/tests/file/rename_variation2-win32.phpt create mode 100644 ext/standard/tests/file/rename_variation2.phpt create mode 100644 ext/standard/tests/file/rename_variation3-win32.phpt create mode 100644 ext/standard/tests/file/rename_variation3.phpt create mode 100644 ext/standard/tests/file/rename_variation4.phpt create mode 100644 ext/standard/tests/file/rename_variation5.phpt create mode 100644 ext/standard/tests/file/rename_variation6-win32.phpt create mode 100644 ext/standard/tests/file/rename_variation6.phpt create mode 100644 ext/standard/tests/file/rename_variation7-win32.phpt create mode 100644 ext/standard/tests/file/rename_variation7.phpt create mode 100644 ext/standard/tests/file/rename_variation8-win32.phpt create mode 100644 ext/standard/tests/file/rename_variation8.phpt create mode 100644 ext/standard/tests/file/rename_variation9.phpt create mode 100644 ext/standard/tests/file/rmdir_variation1-win32.phpt create mode 100644 ext/standard/tests/file/rmdir_variation1.phpt create mode 100644 ext/standard/tests/file/rmdir_variation2.phpt create mode 100644 ext/standard/tests/file/rmdir_variation3-win32.phpt create mode 100644 ext/standard/tests/file/rmdir_variation3.phpt create mode 100644 ext/standard/tests/file/stat_basic-win32.phpt create mode 100644 ext/standard/tests/file/stat_error-win32.phpt create mode 100644 ext/standard/tests/file/stat_variation1-win32.phpt create mode 100644 ext/standard/tests/file/stat_variation2-win32.phpt create mode 100644 ext/standard/tests/file/stat_variation3-win32.phpt create mode 100644 ext/standard/tests/file/stat_variation4-win32.phpt create mode 100644 ext/standard/tests/file/stat_variation5-win32.phpt create mode 100644 ext/standard/tests/file/stat_variation6-win32.phpt create mode 100644 ext/standard/tests/file/stat_variation7-win32.phpt create mode 100644 ext/standard/tests/file/stat_variation8-win32.phpt create mode 100644 ext/standard/tests/file/statcache-corruption.phpt create mode 100644 ext/standard/tests/file/statpage.phpt create mode 100644 ext/standard/tests/file/stream_001.phpt create mode 100644 ext/standard/tests/file/stream_002.phpt create mode 100644 ext/standard/tests/file/stream_copy_to_stream.phpt create mode 100644 ext/standard/tests/file/stream_enclosed.phpt create mode 100644 ext/standard/tests/file/stream_get_line.phpt create mode 100644 ext/standard/tests/file/stream_rfc2397_001.phpt create mode 100644 ext/standard/tests/file/stream_rfc2397_002.phpt create mode 100755 ext/standard/tests/file/stream_rfc2397_003.gif create mode 100644 ext/standard/tests/file/stream_rfc2397_003.phpt create mode 100644 ext/standard/tests/file/stream_rfc2397_004.phpt create mode 100644 ext/standard/tests/file/stream_rfc2397_005.phpt create mode 100644 ext/standard/tests/file/stream_rfc2397_006.phpt create mode 100644 ext/standard/tests/file/stream_rfc2397_007.phpt create mode 100644 ext/standard/tests/file/stream_supports_lock.phpt create mode 100644 ext/standard/tests/file/symlink.phpt create mode 100644 ext/standard/tests/file/symlink_link_linkinfo_is_link_basic1.phpt create mode 100644 ext/standard/tests/file/symlink_link_linkinfo_is_link_basic2.phpt create mode 100644 ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt create mode 100644 ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt create mode 100644 ext/standard/tests/file/symlink_link_linkinfo_is_link_variation1.phpt create mode 100644 ext/standard/tests/file/symlink_link_linkinfo_is_link_variation2.phpt create mode 100644 ext/standard/tests/file/symlink_link_linkinfo_is_link_variation3.phpt create mode 100644 ext/standard/tests/file/symlink_link_linkinfo_is_link_variation4.phpt create mode 100644 ext/standard/tests/file/symlink_link_linkinfo_is_link_variation5.phpt create mode 100644 ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt create mode 100644 ext/standard/tests/file/symlink_link_linkinfo_is_link_variation7.phpt create mode 100644 ext/standard/tests/file/symlink_link_linkinfo_is_link_variation8.phpt create mode 100644 ext/standard/tests/file/symlink_link_linkinfo_is_link_variation9.phpt create mode 100644 ext/standard/tests/file/symlink_to_symlink.phpt create mode 100644 ext/standard/tests/file/tempnam_error.phpt create mode 100644 ext/standard/tests/file/tempnam_variation1-win32.phpt create mode 100644 ext/standard/tests/file/tempnam_variation1.phpt create mode 100644 ext/standard/tests/file/tempnam_variation2-win32.phpt create mode 100644 ext/standard/tests/file/tempnam_variation2.phpt create mode 100644 ext/standard/tests/file/tempnam_variation3-win32.phpt create mode 100644 ext/standard/tests/file/tempnam_variation3.phpt create mode 100644 ext/standard/tests/file/tempnam_variation4.phpt create mode 100644 ext/standard/tests/file/tempnam_variation5-win32.phpt create mode 100644 ext/standard/tests/file/tempnam_variation5.phpt create mode 100644 ext/standard/tests/file/tempnam_variation6-win32.phpt create mode 100644 ext/standard/tests/file/tempnam_variation6.phpt create mode 100644 ext/standard/tests/file/tempnam_variation7-win32.phpt create mode 100644 ext/standard/tests/file/tempnam_variation7.phpt create mode 100644 ext/standard/tests/file/tempnam_variation8-win32.phpt create mode 100644 ext/standard/tests/file/test.csv create mode 100644 ext/standard/tests/file/test2.csv create mode 100644 ext/standard/tests/file/test3.csv create mode 100644 ext/standard/tests/file/touch.phpt create mode 100644 ext/standard/tests/file/touch_basic-win32.phpt create mode 100644 ext/standard/tests/file/touch_basic.phpt create mode 100644 ext/standard/tests/file/touch_error.phpt create mode 100644 ext/standard/tests/file/touch_variation1.phpt create mode 100644 ext/standard/tests/file/touch_variation2.phpt create mode 100644 ext/standard/tests/file/touch_variation3-win32.phpt create mode 100644 ext/standard/tests/file/touch_variation3.phpt create mode 100644 ext/standard/tests/file/touch_variation4-win32.phpt create mode 100644 ext/standard/tests/file/touch_variation4.phpt create mode 100644 ext/standard/tests/file/touch_variation5-win32.phpt create mode 100644 ext/standard/tests/file/touch_variation5.phpt create mode 100644 ext/standard/tests/file/touch_variation6-win32.phpt create mode 100644 ext/standard/tests/file/umask_basic.phpt create mode 100644 ext/standard/tests/file/umask_error.phpt create mode 100644 ext/standard/tests/file/umask_variation1.phpt create mode 100644 ext/standard/tests/file/umask_variation2.phpt create mode 100644 ext/standard/tests/file/umask_variation3.phpt create mode 100644 ext/standard/tests/file/unlink_basic.phpt create mode 100644 ext/standard/tests/file/unlink_error-win32.phpt create mode 100644 ext/standard/tests/file/unlink_error.phpt create mode 100644 ext/standard/tests/file/unlink_variation1-win32.phpt create mode 100644 ext/standard/tests/file/unlink_variation1.phpt create mode 100644 ext/standard/tests/file/unlink_variation10.phpt create mode 100644 ext/standard/tests/file/unlink_variation2-win32.phpt create mode 100644 ext/standard/tests/file/unlink_variation2.phpt create mode 100644 ext/standard/tests/file/unlink_variation3.phpt create mode 100644 ext/standard/tests/file/unlink_variation4.phpt create mode 100644 ext/standard/tests/file/unlink_variation5.phpt create mode 100644 ext/standard/tests/file/unlink_variation6.phpt create mode 100644 ext/standard/tests/file/unlink_variation7.phpt create mode 100644 ext/standard/tests/file/unlink_variation8-win32.phpt create mode 100644 ext/standard/tests/file/unlink_variation8.phpt create mode 100644 ext/standard/tests/file/unlink_variation9-win32.phpt create mode 100644 ext/standard/tests/file/userdirstream.phpt create mode 100644 ext/standard/tests/file/userfilters.phpt create mode 100644 ext/standard/tests/file/userstreams.phpt create mode 100644 ext/standard/tests/file/userstreams_002.phpt create mode 100644 ext/standard/tests/file/userstreams_003.phpt create mode 100644 ext/standard/tests/file/userstreams_004.phpt create mode 100644 ext/standard/tests/file/userstreams_005.phpt create mode 100644 ext/standard/tests/file/userstreams_006.phpt create mode 100644 ext/standard/tests/file/userstreams_007.phpt create mode 100644 ext/standard/tests/file/userwrapper.phpt create mode 100644 ext/standard/tests/file/windows_acls/bug44859.phpt create mode 100644 ext/standard/tests/file/windows_acls/bug44859_2.phpt create mode 100644 ext/standard/tests/file/windows_acls/bug44859_3.phpt create mode 100644 ext/standard/tests/file/windows_acls/bug44859_4.phpt create mode 100644 ext/standard/tests/file/windows_acls/common.inc create mode 100644 ext/standard/tests/file/windows_acls/tiny.bat create mode 100644 ext/standard/tests/file/windows_acls/tiny.exe create mode 100644 ext/standard/tests/file/windows_links/bug48746.phpt create mode 100644 ext/standard/tests/file/windows_links/bug48746_1.phpt create mode 100644 ext/standard/tests/file/windows_links/bug48746_2.phpt create mode 100644 ext/standard/tests/file/windows_links/bug48746_3.phpt create mode 100644 ext/standard/tests/file/windows_links/common.inc create mode 100644 ext/standard/tests/filters/001.phpt create mode 100644 ext/standard/tests/filters/basic.phpt create mode 100644 ext/standard/tests/filters/bug22538.phpt create mode 100644 ext/standard/tests/filters/bug35916.phpt create mode 100644 ext/standard/tests/filters/bug46164-1.phpt create mode 100644 ext/standard/tests/filters/bug46164-2.phpt create mode 100644 ext/standard/tests/filters/bug50363.phpt create mode 100644 ext/standard/tests/filters/chunked_001.phpt create mode 100644 ext/standard/tests/filters/filter_errors.inc create mode 100644 ext/standard/tests/filters/filter_errors_convert_base64_decode.phpt create mode 100644 ext/standard/tests/filters/filter_errors_user.phpt create mode 100644 ext/standard/tests/filters/filter_errors_zlib_inflate.phpt create mode 100644 ext/standard/tests/filters/php_user_filter_01.phpt create mode 100644 ext/standard/tests/filters/php_user_filter_02.phpt create mode 100644 ext/standard/tests/filters/php_user_filter_03.phpt create mode 100644 ext/standard/tests/filters/read.phpt create mode 100644 ext/standard/tests/filters/stream_filter_remove_basic.phpt create mode 100644 ext/standard/tests/filters/stream_filter_remove_error.phpt create mode 100644 ext/standard/tests/general_functions/001.phpt create mode 100644 ext/standard/tests/general_functions/002.phpt create mode 100644 ext/standard/tests/general_functions/003.phpt create mode 100644 ext/standard/tests/general_functions/004.data create mode 100644 ext/standard/tests/general_functions/004.phpt create mode 100644 ext/standard/tests/general_functions/005.phpt create mode 100644 ext/standard/tests/general_functions/006.phpt create mode 100644 ext/standard/tests/general_functions/007.phpt create mode 100644 ext/standard/tests/general_functions/008.phpt create mode 100644 ext/standard/tests/general_functions/009.phpt create mode 100644 ext/standard/tests/general_functions/010.phpt create mode 100644 ext/standard/tests/general_functions/bug25038.phpt create mode 100644 ext/standard/tests/general_functions/bug27678.phpt create mode 100644 ext/standard/tests/general_functions/bug29038.phpt create mode 100644 ext/standard/tests/general_functions/bug31190.phpt create mode 100644 ext/standard/tests/general_functions/bug32647.phpt create mode 100644 ext/standard/tests/general_functions/bug34794.phpt create mode 100644 ext/standard/tests/general_functions/bug35229.phpt create mode 100644 ext/standard/tests/general_functions/bug36011.phpt create mode 100644 ext/standard/tests/general_functions/bug39322.phpt create mode 100644 ext/standard/tests/general_functions/bug40398.phpt create mode 100644 ext/standard/tests/general_functions/bug40752.phpt create mode 100644 ext/standard/tests/general_functions/bug41037.phpt create mode 100644 ext/standard/tests/general_functions/bug41445.phpt create mode 100644 ext/standard/tests/general_functions/bug41445_1.phpt create mode 100644 ext/standard/tests/general_functions/bug41518.phpt create mode 100644 ext/standard/tests/general_functions/bug41970.phpt create mode 100644 ext/standard/tests/general_functions/bug42272.phpt create mode 100644 ext/standard/tests/general_functions/bug43293_1.phpt create mode 100644 ext/standard/tests/general_functions/bug43293_2.phpt create mode 100644 ext/standard/tests/general_functions/bug43293_3.phpt create mode 100644 ext/standard/tests/general_functions/bug44295-win.phpt create mode 100644 ext/standard/tests/general_functions/bug44295.phpt create mode 100644 ext/standard/tests/general_functions/bug44394.phpt create mode 100644 ext/standard/tests/general_functions/bug44394_2.phpt create mode 100644 ext/standard/tests/general_functions/bug44461.phpt create mode 100644 ext/standard/tests/general_functions/bug44487.phpt create mode 100644 ext/standard/tests/general_functions/bug44667.phpt create mode 100644 ext/standard/tests/general_functions/bug46587.phpt create mode 100644 ext/standard/tests/general_functions/bug47027.phpt create mode 100644 ext/standard/tests/general_functions/bug47857.phpt create mode 100644 ext/standard/tests/general_functions/bug47859.phpt create mode 100644 ext/standard/tests/general_functions/bug48660.phpt create mode 100644 ext/standard/tests/general_functions/bug48768.phpt create mode 100644 ext/standard/tests/general_functions/bug49056.phpt create mode 100644 ext/standard/tests/general_functions/bug49692.ini create mode 100644 ext/standard/tests/general_functions/bug49692.phpt create mode 100644 ext/standard/tests/general_functions/bug49847.phpt create mode 100644 ext/standard/tests/general_functions/bug50690.phpt create mode 100644 ext/standard/tests/general_functions/bug50732.phpt create mode 100644 ext/standard/tests/general_functions/bug52138.data create mode 100644 ext/standard/tests/general_functions/bug52138.phpt create mode 100644 ext/standard/tests/general_functions/bug55371.phpt create mode 100644 ext/standard/tests/general_functions/bug60227_1.phpt create mode 100644 ext/standard/tests/general_functions/bug60227_2.phpt create mode 100644 ext/standard/tests/general_functions/bug60227_3.phpt create mode 100644 ext/standard/tests/general_functions/bug60227_4.phpt create mode 100644 ext/standard/tests/general_functions/bug60723.phpt create mode 100644 ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt create mode 100644 ext/standard/tests/general_functions/call_user_func_array_variation_002.phpt create mode 100644 ext/standard/tests/general_functions/call_user_func_array_variation_003.phpt create mode 100644 ext/standard/tests/general_functions/call_user_func_return.phpt create mode 100644 ext/standard/tests/general_functions/call_user_method.phpt create mode 100644 ext/standard/tests/general_functions/call_user_method_002.phpt create mode 100644 ext/standard/tests/general_functions/callbacks_001.phpt create mode 100644 ext/standard/tests/general_functions/callbacks_002.phpt create mode 100644 ext/standard/tests/general_functions/closures_001.phpt create mode 100644 ext/standard/tests/general_functions/closures_002.phpt create mode 100644 ext/standard/tests/general_functions/debug_zval_dump_b.phpt create mode 100644 ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt create mode 100644 ext/standard/tests/general_functions/debug_zval_dump_e.phpt create mode 100644 ext/standard/tests/general_functions/debug_zval_dump_o.phpt create mode 100644 ext/standard/tests/general_functions/debug_zval_dump_v.phpt create mode 100644 ext/standard/tests/general_functions/dl-cve-2007-4887.phpt create mode 100644 ext/standard/tests/general_functions/error_get_last.phpt create mode 100644 ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt create mode 100644 ext/standard/tests/general_functions/escapeshellarg_basic.phpt create mode 100644 ext/standard/tests/general_functions/escapeshellarg_error.phpt create mode 100644 ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt create mode 100644 ext/standard/tests/general_functions/escapeshellarg_variation1.phpt create mode 100644 ext/standard/tests/general_functions/escapeshellcmd-win32.phpt create mode 100644 ext/standard/tests/general_functions/floatval.phpt create mode 100644 ext/standard/tests/general_functions/floatval_basic.phpt create mode 100644 ext/standard/tests/general_functions/floatval_error.phpt create mode 100644 ext/standard/tests/general_functions/floatval_variation1.phpt create mode 100644 ext/standard/tests/general_functions/get_cfg_var_basic.phpt create mode 100644 ext/standard/tests/general_functions/get_cfg_var_error.phpt create mode 100644 ext/standard/tests/general_functions/get_cfg_var_variation1.phpt create mode 100644 ext/standard/tests/general_functions/get_cfg_var_variation2.phpt create mode 100644 ext/standard/tests/general_functions/get_cfg_var_variation3.phpt create mode 100644 ext/standard/tests/general_functions/get_cfg_var_variation4.phpt create mode 100644 ext/standard/tests/general_functions/get_cfg_var_variation5.phpt create mode 100644 ext/standard/tests/general_functions/get_cfg_var_variation6.phpt create mode 100644 ext/standard/tests/general_functions/get_cfg_var_variation7.phpt create mode 100644 ext/standard/tests/general_functions/get_cfg_var_variation8.phpt create mode 100644 ext/standard/tests/general_functions/get_cfg_var_variation9.phpt create mode 100644 ext/standard/tests/general_functions/get_defined_constants_basic.phpt create mode 100644 ext/standard/tests/general_functions/get_defined_constants_error.phpt create mode 100644 ext/standard/tests/general_functions/get_defined_vars_basic.phpt create mode 100644 ext/standard/tests/general_functions/get_extension_funcs_basic.phpt create mode 100644 ext/standard/tests/general_functions/get_extension_funcs_error.phpt create mode 100644 ext/standard/tests/general_functions/get_extension_funcs_variation.phpt create mode 100644 ext/standard/tests/general_functions/get_include_path_basic.phpt create mode 100644 ext/standard/tests/general_functions/get_included_files.phpt create mode 100644 ext/standard/tests/general_functions/get_included_files_inc1.inc create mode 100644 ext/standard/tests/general_functions/get_included_files_inc2.inc create mode 100644 ext/standard/tests/general_functions/get_included_files_inc3.inc create mode 100644 ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt create mode 100644 ext/standard/tests/general_functions/get_loaded_extensions_error.phpt create mode 100644 ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt create mode 100644 ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt create mode 100644 ext/standard/tests/general_functions/get_resource_type_basic.phpt create mode 100644 ext/standard/tests/general_functions/get_resource_type_error.phpt create mode 100644 ext/standard/tests/general_functions/get_resource_type_variation1.phpt create mode 100644 ext/standard/tests/general_functions/getmypid_basic.phpt create mode 100644 ext/standard/tests/general_functions/getopt.phpt create mode 100644 ext/standard/tests/general_functions/getopt_002.phpt create mode 100644 ext/standard/tests/general_functions/getopt_003.phpt create mode 100644 ext/standard/tests/general_functions/getopt_004.phpt create mode 100644 ext/standard/tests/general_functions/getopt_005.phpt create mode 100644 ext/standard/tests/general_functions/getrusage.phpt create mode 100644 ext/standard/tests/general_functions/getrusage_basic.phpt create mode 100644 ext/standard/tests/general_functions/getrusage_error.phpt create mode 100644 ext/standard/tests/general_functions/getrusage_variation1.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_basic.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_error.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_variation1.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_variation10.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_variation11.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_variation12.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_variation13.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_variation14.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_variation2.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_variation3.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_variation4.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_variation5.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_variation6.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_variation7.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_variation8.phpt create mode 100644 ext/standard/tests/general_functions/getservbyname_variation9.phpt create mode 100644 ext/standard/tests/general_functions/getservbyport_basic.phpt create mode 100644 ext/standard/tests/general_functions/getservbyport_error.phpt create mode 100644 ext/standard/tests/general_functions/getservbyport_variation1.phpt create mode 100644 ext/standard/tests/general_functions/gettype_settype_basic.phpt create mode 100644 ext/standard/tests/general_functions/gettype_settype_error.phpt create mode 100644 ext/standard/tests/general_functions/gettype_settype_variation1.phpt create mode 100644 ext/standard/tests/general_functions/gettype_settype_variation2.phpt create mode 100644 ext/standard/tests/general_functions/gettype_settype_variation3.phpt create mode 100644 ext/standard/tests/general_functions/gettype_settype_variation4.phpt create mode 100644 ext/standard/tests/general_functions/gettype_settype_variation5.phpt create mode 100644 ext/standard/tests/general_functions/gettype_settype_variation6.phpt create mode 100644 ext/standard/tests/general_functions/gettype_settype_variation7.phpt create mode 100644 ext/standard/tests/general_functions/gettype_settype_variation8.phpt create mode 100644 ext/standard/tests/general_functions/head.phpt create mode 100644 ext/standard/tests/general_functions/highlight_heredoc.phpt create mode 100644 ext/standard/tests/general_functions/import_request.phpt create mode 100644 ext/standard/tests/general_functions/import_request1.phpt create mode 100644 ext/standard/tests/general_functions/import_request2.phpt create mode 100644 ext/standard/tests/general_functions/import_request3.phpt create mode 100644 ext/standard/tests/general_functions/include_path.phpt create mode 100644 ext/standard/tests/general_functions/ini_get_all.phpt create mode 100644 ext/standard/tests/general_functions/intval.phpt create mode 100644 ext/standard/tests/general_functions/intval_variation1.phpt create mode 100644 ext/standard/tests/general_functions/intval_variation2.phpt create mode 100644 ext/standard/tests/general_functions/is_array.phpt create mode 100644 ext/standard/tests/general_functions/is_bool.phpt create mode 100644 ext/standard/tests/general_functions/is_callable_basic1.phpt create mode 100644 ext/standard/tests/general_functions/is_callable_basic2.phpt create mode 100644 ext/standard/tests/general_functions/is_callable_error.phpt create mode 100644 ext/standard/tests/general_functions/is_callable_variation1.phpt create mode 100644 ext/standard/tests/general_functions/is_callable_variation2.phpt create mode 100644 ext/standard/tests/general_functions/is_float.phpt create mode 100644 ext/standard/tests/general_functions/is_float_64bit.phpt create mode 100644 ext/standard/tests/general_functions/is_int.phpt create mode 100644 ext/standard/tests/general_functions/is_int_64bit.phpt create mode 100644 ext/standard/tests/general_functions/is_null.phpt create mode 100644 ext/standard/tests/general_functions/is_numeric.phpt create mode 100644 ext/standard/tests/general_functions/is_object.phpt create mode 100644 ext/standard/tests/general_functions/is_resource.phpt create mode 100644 ext/standard/tests/general_functions/is_resource_basic.phpt create mode 100644 ext/standard/tests/general_functions/is_resource_error.phpt create mode 100644 ext/standard/tests/general_functions/is_scalar.phpt create mode 100644 ext/standard/tests/general_functions/is_string.phpt create mode 100644 ext/standard/tests/general_functions/isset_basic1.phpt create mode 100644 ext/standard/tests/general_functions/isset_basic2.phpt create mode 100644 ext/standard/tests/general_functions/ob_get_flush_basic.phpt create mode 100644 ext/standard/tests/general_functions/ob_get_flush_error.phpt create mode 100644 ext/standard/tests/general_functions/ob_get_length_basic.phpt create mode 100644 ext/standard/tests/general_functions/ob_start_closures.phpt create mode 100644 ext/standard/tests/general_functions/parse_ini_basic.data create mode 100644 ext/standard/tests/general_functions/parse_ini_basic.phpt create mode 100644 ext/standard/tests/general_functions/parse_ini_booleans.data create mode 100644 ext/standard/tests/general_functions/parse_ini_booleans.phpt create mode 100644 ext/standard/tests/general_functions/parse_ini_file.phpt create mode 100644 ext/standard/tests/general_functions/parse_ini_string_001.phpt create mode 100644 ext/standard/tests/general_functions/parse_ini_string_002.phpt create mode 100644 ext/standard/tests/general_functions/php_uname_basic.phpt create mode 100644 ext/standard/tests/general_functions/php_uname_error.phpt create mode 100644 ext/standard/tests/general_functions/php_uname_variation1.phpt create mode 100644 ext/standard/tests/general_functions/phpcredits.phpt create mode 100644 ext/standard/tests/general_functions/phpcredits2.phpt create mode 100644 ext/standard/tests/general_functions/phpinfo.phpt create mode 100644 ext/standard/tests/general_functions/phpinfo2.phpt create mode 100644 ext/standard/tests/general_functions/print_r.phpt create mode 100644 ext/standard/tests/general_functions/print_r_64bit.phpt create mode 100644 ext/standard/tests/general_functions/proc_nice_basic.phpt create mode 100644 ext/standard/tests/general_functions/proc_nice_error.phpt create mode 100644 ext/standard/tests/general_functions/proc_nice_variation1.phpt create mode 100644 ext/standard/tests/general_functions/proc_nice_variation2.phpt create mode 100644 ext/standard/tests/general_functions/proc_nice_variation3.phpt create mode 100644 ext/standard/tests/general_functions/proc_nice_variation5.phpt create mode 100644 ext/standard/tests/general_functions/proc_nice_variation6.phpt create mode 100644 ext/standard/tests/general_functions/proc_nice_variation7.phpt create mode 100644 ext/standard/tests/general_functions/proc_open.phpt create mode 100644 ext/standard/tests/general_functions/proc_open02.phpt create mode 100644 ext/standard/tests/general_functions/putenv.phpt create mode 100644 ext/standard/tests/general_functions/rand.phpt create mode 100644 ext/standard/tests/general_functions/set_magic_quotes_runtime_basic.phpt create mode 100644 ext/standard/tests/general_functions/set_magic_quotes_runtime_error.phpt create mode 100644 ext/standard/tests/general_functions/sleep_basic.phpt create mode 100644 ext/standard/tests/general_functions/sleep_error.phpt create mode 100644 ext/standard/tests/general_functions/strval.phpt create mode 100644 ext/standard/tests/general_functions/sys_getloadavg.phpt create mode 100644 ext/standard/tests/general_functions/type.phpt create mode 100644 ext/standard/tests/general_functions/uniqid_basic.phpt create mode 100644 ext/standard/tests/general_functions/uniqid_error.phpt create mode 100644 ext/standard/tests/general_functions/usleep_basic.phpt create mode 100644 ext/standard/tests/general_functions/usleep_error.phpt create mode 100644 ext/standard/tests/general_functions/var_dump.phpt create mode 100644 ext/standard/tests/general_functions/var_dump_64bit.phpt create mode 100644 ext/standard/tests/general_functions/var_export-locale.phpt create mode 100644 ext/standard/tests/general_functions/var_export_basic1.phpt create mode 100644 ext/standard/tests/general_functions/var_export_basic2.phpt create mode 100644 ext/standard/tests/general_functions/var_export_basic3.phpt create mode 100644 ext/standard/tests/general_functions/var_export_basic4.phpt create mode 100644 ext/standard/tests/general_functions/var_export_basic5.phpt create mode 100644 ext/standard/tests/general_functions/var_export_basic6.phpt create mode 100644 ext/standard/tests/general_functions/var_export_basic7.phpt create mode 100644 ext/standard/tests/general_functions/var_export_basic8.phpt create mode 100644 ext/standard/tests/general_functions/var_export_basic9.phpt create mode 100644 ext/standard/tests/general_functions/var_export_error1.phpt create mode 100644 ext/standard/tests/general_functions/var_export_error2.phpt create mode 100644 ext/standard/tests/general_functions/var_export_error3.phpt create mode 100644 ext/standard/tests/http/bug38802.phpt create mode 100644 ext/standard/tests/http/bug43510.phpt create mode 100644 ext/standard/tests/http/bug48929.phpt create mode 100644 ext/standard/tests/http/bug53198.phpt create mode 100644 ext/standard/tests/http/bug60570.phpt create mode 100644 ext/standard/tests/http/ignore_errors.phpt create mode 100644 ext/standard/tests/http/server.inc create mode 100644 ext/standard/tests/image/200x100.bmp create mode 100644 ext/standard/tests/image/200x100.gif create mode 100644 ext/standard/tests/image/200x100.jpg create mode 100644 ext/standard/tests/image/200x100.png create mode 100644 ext/standard/tests/image/200x100.swf create mode 100644 ext/standard/tests/image/200x100.tif create mode 100644 ext/standard/tests/image/200x100_unknown.unknown create mode 100644 ext/standard/tests/image/246x247.png create mode 100644 ext/standard/tests/image/2x2mm.tif create mode 100644 ext/standard/tests/image/384x385.png create mode 100644 ext/standard/tests/image/75x50.wbmp create mode 100644 ext/standard/tests/image/75x50.xbm create mode 100644 ext/standard/tests/image/blank_file.bmp create mode 100644 ext/standard/tests/image/bug13213.jpg create mode 100644 ext/standard/tests/image/bug13213.phpt create mode 100644 ext/standard/tests/image/getimagesize.phpt create mode 100644 ext/standard/tests/image/getimagesize_246x247.phpt create mode 100644 ext/standard/tests/image/getimagesize_384x385.phpt create mode 100644 ext/standard/tests/image/getimagesize_basic.phpt create mode 100644 ext/standard/tests/image/getimagesize_error1.phpt create mode 100644 ext/standard/tests/image/getimagesize_jpgapp.phpt create mode 100644 ext/standard/tests/image/getimagesize_swc.phpt create mode 100644 ext/standard/tests/image/getimagesize_tif_mm.phpt create mode 100644 ext/standard/tests/image/getimagesize_variation1.phpt create mode 100644 ext/standard/tests/image/getimagesize_variation2.phpt create mode 100644 ext/standard/tests/image/getimagesize_variation3.phpt create mode 100644 ext/standard/tests/image/getimagesize_variation4.phpt create mode 100644 ext/standard/tests/image/getimagesize_variation_003.phpt create mode 100644 ext/standard/tests/image/getimagesize_variation_005.phpt create mode 100644 ext/standard/tests/image/getimagesize_wbmp.phpt create mode 100644 ext/standard/tests/image/getimagesize_xbm.phpt create mode 100644 ext/standard/tests/image/getimagesizefromstring1.phpt create mode 100644 ext/standard/tests/image/image_type_to_extension.phpt create mode 100644 ext/standard/tests/image/image_type_to_mime_type.phpt create mode 100644 ext/standard/tests/image/image_type_to_mime_type_basic.phpt create mode 100644 ext/standard/tests/image/image_type_to_mime_type_error.phpt create mode 100644 ext/standard/tests/image/image_type_to_mime_type_variation1.phpt create mode 100644 ext/standard/tests/image/image_type_to_mime_type_variation2.phpt create mode 100644 ext/standard/tests/image/image_type_to_mime_type_variation3.phpt create mode 100644 ext/standard/tests/image/image_type_to_mime_type_variation4.phpt create mode 100644 ext/standard/tests/image/iptcembed_001.phpt create mode 100644 ext/standard/tests/image/skipif_imagetype.inc create mode 100644 ext/standard/tests/image/test.gif create mode 100644 ext/standard/tests/image/test.txt create mode 100755 ext/standard/tests/image/test13pix.swf create mode 100644 ext/standard/tests/image/test1bpix.bmp create mode 100644 ext/standard/tests/image/test1pix.bmp create mode 100644 ext/standard/tests/image/test1pix.jp2 create mode 100644 ext/standard/tests/image/test1pix.jpc create mode 100644 ext/standard/tests/image/test1pix.jpg create mode 100644 ext/standard/tests/image/test2pix.gif create mode 100644 ext/standard/tests/image/test4pix.gif create mode 100644 ext/standard/tests/image/test4pix.iff create mode 100644 ext/standard/tests/image/test4pix.png create mode 100644 ext/standard/tests/image/test4pix.psd create mode 100755 ext/standard/tests/image/test4pix.swf create mode 100644 ext/standard/tests/image/test4pix.tif create mode 100644 ext/standard/tests/image/testAPP.jpg create mode 100644 ext/standard/tests/mail/bug51604.phpt create mode 100644 ext/standard/tests/mail/ezmlm_hash_basic.phpt create mode 100644 ext/standard/tests/mail/ezmlm_hash_basic_64bit.phpt create mode 100644 ext/standard/tests/mail/ezmlm_hash_error.phpt create mode 100644 ext/standard/tests/mail/ezmlm_hash_variation1.phpt create mode 100644 ext/standard/tests/mail/mail_basic.phpt create mode 100644 ext/standard/tests/mail/mail_basic2.phpt create mode 100644 ext/standard/tests/mail/mail_basic3.phpt create mode 100644 ext/standard/tests/mail/mail_basic4.phpt create mode 100644 ext/standard/tests/mail/mail_basic5.phpt create mode 100644 ext/standard/tests/mail/mail_basic_alt1-win32.phpt create mode 100644 ext/standard/tests/mail/mail_basic_alt2-win32.phpt create mode 100644 ext/standard/tests/mail/mail_basic_alt3-win32.phpt create mode 100644 ext/standard/tests/mail/mail_basic_alt4-win32.phpt create mode 100644 ext/standard/tests/mail/mail_error.phpt create mode 100644 ext/standard/tests/mail/mail_include.inc create mode 100644 ext/standard/tests/mail/mail_skipif.inc create mode 100644 ext/standard/tests/mail/mail_variation1.phpt create mode 100644 ext/standard/tests/mail/mail_variation2.phpt create mode 100644 ext/standard/tests/mail/mail_variation_alt1-win32.phpt create mode 100644 ext/standard/tests/mail/mail_variation_alt2-win32.phpt create mode 100644 ext/standard/tests/mail/mail_variation_alt3-win32.phpt create mode 100644 ext/standard/tests/math/abs.phpt create mode 100644 ext/standard/tests/math/abs_basic.phpt create mode 100644 ext/standard/tests/math/abs_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/abs_error.phpt create mode 100644 ext/standard/tests/math/abs_variation.phpt create mode 100644 ext/standard/tests/math/acos_basic.phpt create mode 100644 ext/standard/tests/math/acos_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/acos_error.phpt create mode 100644 ext/standard/tests/math/acos_variation.phpt create mode 100644 ext/standard/tests/math/acosh_basic.phpt create mode 100644 ext/standard/tests/math/acosh_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/acosh_error.phpt create mode 100644 ext/standard/tests/math/acosh_variation.phpt create mode 100644 ext/standard/tests/math/allowed_rounding_error.inc create mode 100644 ext/standard/tests/math/asin_basic.phpt create mode 100644 ext/standard/tests/math/asin_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/asin_error.phpt create mode 100644 ext/standard/tests/math/asin_variation.phpt create mode 100644 ext/standard/tests/math/asinh_basic.phpt create mode 100644 ext/standard/tests/math/asinh_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/asinh_error.phpt create mode 100644 ext/standard/tests/math/asinh_variation.phpt create mode 100644 ext/standard/tests/math/atan2_basic.phpt create mode 100644 ext/standard/tests/math/atan2_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/atan2_error.phpt create mode 100644 ext/standard/tests/math/atan2_variation1.phpt create mode 100644 ext/standard/tests/math/atan2_variation2.phpt create mode 100644 ext/standard/tests/math/atan_basic.phpt create mode 100644 ext/standard/tests/math/atan_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/atan_error.phpt create mode 100644 ext/standard/tests/math/atan_variation.phpt create mode 100644 ext/standard/tests/math/atanh_basic.phpt create mode 100644 ext/standard/tests/math/atanh_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/atanh_error.phpt create mode 100644 ext/standard/tests/math/atanh_variation.phpt create mode 100644 ext/standard/tests/math/base_convert_basic.phpt create mode 100644 ext/standard/tests/math/base_convert_error.phpt create mode 100644 ext/standard/tests/math/base_convert_variation1.phpt create mode 100644 ext/standard/tests/math/base_convert_variation2.phpt create mode 100644 ext/standard/tests/math/base_convert_variation3.phpt create mode 100644 ext/standard/tests/math/bindec_basic.phpt create mode 100644 ext/standard/tests/math/bindec_basic_64bit.phpt create mode 100644 ext/standard/tests/math/bindec_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/bindec_error.phpt create mode 100644 ext/standard/tests/math/bindec_variation1.phpt create mode 100644 ext/standard/tests/math/bindec_variation1_64bit.phpt create mode 100644 ext/standard/tests/math/bug21523.phpt create mode 100644 ext/standard/tests/math/bug24142.phpt create mode 100644 ext/standard/tests/math/bug25665.phpt create mode 100644 ext/standard/tests/math/bug25694.phpt create mode 100644 ext/standard/tests/math/bug27646.phpt create mode 100644 ext/standard/tests/math/bug28228.phpt create mode 100644 ext/standard/tests/math/bug30069.phpt create mode 100644 ext/standard/tests/math/bug30695.phpt create mode 100644 ext/standard/tests/math/bug45712.phpt create mode 100644 ext/standard/tests/math/bug62112.phpt create mode 100644 ext/standard/tests/math/ceil_basic.phpt create mode 100644 ext/standard/tests/math/ceil_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/ceil_error.phpt create mode 100644 ext/standard/tests/math/ceil_variation1.phpt create mode 100644 ext/standard/tests/math/constants.phpt create mode 100644 ext/standard/tests/math/constants_basic.phpt create mode 100644 ext/standard/tests/math/cos_basic.phpt create mode 100644 ext/standard/tests/math/cos_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/cos_error.phpt create mode 100644 ext/standard/tests/math/cos_variation.phpt create mode 100644 ext/standard/tests/math/cosh_basic.phpt create mode 100644 ext/standard/tests/math/cosh_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/cosh_error.phpt create mode 100644 ext/standard/tests/math/cosh_variation.phpt create mode 100644 ext/standard/tests/math/decbin_basic.phpt create mode 100644 ext/standard/tests/math/decbin_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/decbin_error.phpt create mode 100644 ext/standard/tests/math/decbin_variation1.phpt create mode 100644 ext/standard/tests/math/decbin_variation1_64bit.phpt create mode 100644 ext/standard/tests/math/dechex_basic.phpt create mode 100644 ext/standard/tests/math/dechex_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/dechex_error.phpt create mode 100644 ext/standard/tests/math/dechex_variation1.phpt create mode 100644 ext/standard/tests/math/dechex_variation1_64bit.phpt create mode 100644 ext/standard/tests/math/decoct_basic.phpt create mode 100644 ext/standard/tests/math/decoct_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/decoct_error.phpt create mode 100644 ext/standard/tests/math/decoct_variation1.phpt create mode 100644 ext/standard/tests/math/decoct_variation1_64bit.phpt create mode 100644 ext/standard/tests/math/deg2rad_basic.phpt create mode 100644 ext/standard/tests/math/deg2rad_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/deg2rad_error.phpt create mode 100644 ext/standard/tests/math/deg2rad_variation.phpt create mode 100644 ext/standard/tests/math/exp_basic.phpt create mode 100644 ext/standard/tests/math/exp_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/exp_error.phpt create mode 100644 ext/standard/tests/math/exp_variation1.phpt create mode 100644 ext/standard/tests/math/expm1_basic.phpt create mode 100644 ext/standard/tests/math/expm1_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/expm1_error.phpt create mode 100644 ext/standard/tests/math/expm1_variation1.phpt create mode 100644 ext/standard/tests/math/floor_basic.phpt create mode 100644 ext/standard/tests/math/floor_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/floor_error.phpt create mode 100644 ext/standard/tests/math/floor_variation1.phpt create mode 100644 ext/standard/tests/math/floorceil.phpt create mode 100644 ext/standard/tests/math/fmod_basic.phpt create mode 100644 ext/standard/tests/math/fmod_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/fmod_error.phpt create mode 100644 ext/standard/tests/math/fmod_variation1.phpt create mode 100644 ext/standard/tests/math/fmod_variation2.phpt create mode 100644 ext/standard/tests/math/getrandmax_basic.phpt create mode 100644 ext/standard/tests/math/getrandmax_error.phpt create mode 100644 ext/standard/tests/math/hexdec.phpt create mode 100644 ext/standard/tests/math/hexdec_basic.phpt create mode 100644 ext/standard/tests/math/hexdec_basic_64bit.phpt create mode 100644 ext/standard/tests/math/hexdec_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/hexdec_error.phpt create mode 100644 ext/standard/tests/math/hexdec_variation1.phpt create mode 100644 ext/standard/tests/math/hexdec_variation1_64bit.phpt create mode 100644 ext/standard/tests/math/hypot_basic.phpt create mode 100644 ext/standard/tests/math/hypot_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/hypot_error.phpt create mode 100644 ext/standard/tests/math/hypot_variation1.phpt create mode 100644 ext/standard/tests/math/hypot_variation2.phpt create mode 100644 ext/standard/tests/math/is_finite_basic.phpt create mode 100644 ext/standard/tests/math/is_finite_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/is_finite_error.phpt create mode 100644 ext/standard/tests/math/is_finite_variation1.phpt create mode 100644 ext/standard/tests/math/is_infinite_basic.phpt create mode 100644 ext/standard/tests/math/is_infinite_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/is_infinite_error.phpt create mode 100644 ext/standard/tests/math/is_infinite_variation1.phpt create mode 100644 ext/standard/tests/math/is_nan_basic.phpt create mode 100644 ext/standard/tests/math/is_nan_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/is_nan_error.phpt create mode 100644 ext/standard/tests/math/is_nan_variation1.phpt create mode 100644 ext/standard/tests/math/lcg_value_basic.phpt create mode 100644 ext/standard/tests/math/log.phpt create mode 100644 ext/standard/tests/math/log10_basic.phpt create mode 100644 ext/standard/tests/math/log10_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/log10_error.phpt create mode 100644 ext/standard/tests/math/log10_variation.phpt create mode 100644 ext/standard/tests/math/log1p_basic.phpt create mode 100644 ext/standard/tests/math/log1p_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/log1p_error.phpt create mode 100644 ext/standard/tests/math/log1p_variation1.phpt create mode 100644 ext/standard/tests/math/log_basic.phpt create mode 100644 ext/standard/tests/math/log_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/log_error.phpt create mode 100644 ext/standard/tests/math/log_variation1.phpt create mode 100644 ext/standard/tests/math/log_variation2.phpt create mode 100644 ext/standard/tests/math/mt_getrandmax_basic.phpt create mode 100644 ext/standard/tests/math/mt_getrandmax_error.phpt create mode 100644 ext/standard/tests/math/mt_rand_basic.phpt create mode 100644 ext/standard/tests/math/mt_rand_error.phpt create mode 100644 ext/standard/tests/math/mt_rand_variation1.phpt create mode 100644 ext/standard/tests/math/mt_rand_variation2.phpt create mode 100644 ext/standard/tests/math/mt_srand_basic.phpt create mode 100644 ext/standard/tests/math/mt_srand_error.phpt create mode 100644 ext/standard/tests/math/mt_srand_variation1.phpt create mode 100644 ext/standard/tests/math/number_format_basic.phpt create mode 100644 ext/standard/tests/math/number_format_multichar.phpt create mode 100644 ext/standard/tests/math/octdec_basic.phpt create mode 100644 ext/standard/tests/math/octdec_basic_64bit.phpt create mode 100644 ext/standard/tests/math/octdec_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/octdec_error.phpt create mode 100644 ext/standard/tests/math/octdec_variation1.phpt create mode 100644 ext/standard/tests/math/pi_basic.phpt create mode 100644 ext/standard/tests/math/pow.phpt create mode 100644 ext/standard/tests/math/pow_basic.phpt create mode 100644 ext/standard/tests/math/pow_basic2.phpt create mode 100644 ext/standard/tests/math/pow_basic_64bit.phpt create mode 100644 ext/standard/tests/math/pow_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/pow_error.phpt create mode 100644 ext/standard/tests/math/pow_variation1.phpt create mode 100644 ext/standard/tests/math/pow_variation1_64bit.phpt create mode 100644 ext/standard/tests/math/pow_variation2.phpt create mode 100644 ext/standard/tests/math/rad2deg_basic.phpt create mode 100644 ext/standard/tests/math/rad2deg_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/rad2deg_error.phpt create mode 100644 ext/standard/tests/math/rad2deg_variation.phpt create mode 100644 ext/standard/tests/math/rand_basic.phpt create mode 100644 ext/standard/tests/math/rand_error.phpt create mode 100644 ext/standard/tests/math/rand_variation1.phpt create mode 100644 ext/standard/tests/math/rand_variation2.phpt create mode 100644 ext/standard/tests/math/round.phpt create mode 100644 ext/standard/tests/math/round_basic.phpt create mode 100644 ext/standard/tests/math/round_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/round_error.phpt create mode 100644 ext/standard/tests/math/round_large_exp.phpt create mode 100644 ext/standard/tests/math/round_modes.phpt create mode 100644 ext/standard/tests/math/round_prerounding.phpt create mode 100644 ext/standard/tests/math/round_variation1.phpt create mode 100644 ext/standard/tests/math/round_variation2.phpt create mode 100644 ext/standard/tests/math/sin_basic.phpt create mode 100644 ext/standard/tests/math/sin_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/sin_error.phpt create mode 100644 ext/standard/tests/math/sin_variation.phpt create mode 100644 ext/standard/tests/math/sinh_basic.phpt create mode 100644 ext/standard/tests/math/sinh_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/sinh_error.phpt create mode 100644 ext/standard/tests/math/sinh_variation.phpt create mode 100644 ext/standard/tests/math/sqrt_basic.phpt create mode 100644 ext/standard/tests/math/sqrt_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/sqrt_error.phpt create mode 100644 ext/standard/tests/math/sqrt_variation.phpt create mode 100644 ext/standard/tests/math/srand_basic.phpt create mode 100644 ext/standard/tests/math/srand_error.phpt create mode 100644 ext/standard/tests/math/srand_variation1.phpt create mode 100644 ext/standard/tests/math/tan_basic.phpt create mode 100644 ext/standard/tests/math/tan_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/tan_error.phpt create mode 100644 ext/standard/tests/math/tan_variation.phpt create mode 100644 ext/standard/tests/math/tanh_basic.phpt create mode 100644 ext/standard/tests/math/tanh_basiclong_64bit.phpt create mode 100644 ext/standard/tests/math/tanh_error.phpt create mode 100644 ext/standard/tests/math/tanh_variation.phpt create mode 100644 ext/standard/tests/misc/browscap.ini create mode 100644 ext/standard/tests/misc/browsernames.inc create mode 100644 ext/standard/tests/misc/get_browser_basic.phpt create mode 100644 ext/standard/tests/misc/get_browser_error.phpt create mode 100644 ext/standard/tests/misc/get_browser_variation1.phpt create mode 100644 ext/standard/tests/misc/syslog_basic.phpt create mode 100644 ext/standard/tests/misc/syslog_parameters.phpt create mode 100644 ext/standard/tests/misc/time_nanosleep_basic.phpt create mode 100644 ext/standard/tests/misc/time_nanosleep_error1.phpt create mode 100644 ext/standard/tests/misc/time_nanosleep_error2.phpt create mode 100644 ext/standard/tests/misc/time_nanosleep_error3.phpt create mode 100644 ext/standard/tests/misc/time_nanosleep_error4.phpt create mode 100644 ext/standard/tests/misc/time_nanosleep_error5.phpt create mode 100644 ext/standard/tests/misc/time_sleep_until_basic.phpt create mode 100644 ext/standard/tests/misc/time_sleep_until_error1.phpt create mode 100644 ext/standard/tests/misc/time_sleep_until_error2.phpt create mode 100644 ext/standard/tests/misc/time_sleep_until_error3.phpt create mode 100644 ext/standard/tests/network/bug20134.phpt create mode 100644 ext/standard/tests/network/bug41347.phpt create mode 100644 ext/standard/tests/network/closelog_basic.phpt create mode 100644 ext/standard/tests/network/closelog_error.phpt create mode 100644 ext/standard/tests/network/fsockopen_basic.phpt create mode 100644 ext/standard/tests/network/fsockopen_error.phpt create mode 100644 ext/standard/tests/network/fsockopen_variation1.phpt create mode 100644 ext/standard/tests/network/fsockopen_variation2.phpt create mode 100644 ext/standard/tests/network/gethostbyaddr_basic1.phpt create mode 100644 ext/standard/tests/network/gethostbyaddr_error.phpt create mode 100644 ext/standard/tests/network/gethostbyname_basic001.phpt create mode 100644 ext/standard/tests/network/gethostbyname_basic003.phpt create mode 100644 ext/standard/tests/network/gethostbyname_error001.phpt create mode 100644 ext/standard/tests/network/gethostbyname_error002.phpt create mode 100644 ext/standard/tests/network/gethostbyname_error003.phpt create mode 100644 ext/standard/tests/network/gethostbyname_error004.phpt create mode 100644 ext/standard/tests/network/gethostbyname_error005.phpt create mode 100644 ext/standard/tests/network/gethostbyname_error006.phpt create mode 100644 ext/standard/tests/network/gethostbynamel_basic1.phpt create mode 100644 ext/standard/tests/network/gethostbynamel_error.phpt create mode 100644 ext/standard/tests/network/getmxrr.phpt create mode 100644 ext/standard/tests/network/http-stream.phpt create mode 100644 ext/standard/tests/network/inet.phpt create mode 100644 ext/standard/tests/network/inet_ipv6.phpt create mode 100644 ext/standard/tests/network/ip.phpt create mode 100644 ext/standard/tests/network/ip2long_error.phpt create mode 100644 ext/standard/tests/network/ip2long_variation1.phpt create mode 100644 ext/standard/tests/network/ip_x86_64.phpt create mode 100644 ext/standard/tests/network/long2ip_error.phpt create mode 100644 ext/standard/tests/network/long2ip_variation1.phpt create mode 100644 ext/standard/tests/network/shutdown.phpt create mode 100644 ext/standard/tests/network/socket_get_status_basic.phpt create mode 100644 ext/standard/tests/network/syslog_basic-win32.phpt create mode 100644 ext/standard/tests/network/syslog_error.phpt create mode 100644 ext/standard/tests/network/tcp4loop.phpt create mode 100644 ext/standard/tests/network/tcp6loop.phpt create mode 100644 ext/standard/tests/network/udgloop.phpt create mode 100644 ext/standard/tests/network/udp4loop.phpt create mode 100644 ext/standard/tests/network/udp6loop.phpt create mode 100644 ext/standard/tests/network/unixloop.phpt create mode 100644 ext/standard/tests/php_ini_loaded_file.phpt create mode 100644 ext/standard/tests/php_logo_guid.phpt create mode 100644 ext/standard/tests/php_real_logo_guid.phpt create mode 100644 ext/standard/tests/serialize/001.phpt create mode 100644 ext/standard/tests/serialize/002.phpt create mode 100644 ext/standard/tests/serialize/003.phpt create mode 100644 ext/standard/tests/serialize/004.phpt create mode 100644 ext/standard/tests/serialize/005.phpt create mode 100644 ext/standard/tests/serialize/006.phpt create mode 100755 ext/standard/tests/serialize/autoload_implements.p5c create mode 100755 ext/standard/tests/serialize/autoload_interface.p5c create mode 100644 ext/standard/tests/serialize/bug14293.phpt create mode 100644 ext/standard/tests/serialize/bug21957.phpt create mode 100644 ext/standard/tests/serialize/bug23298.phpt create mode 100644 ext/standard/tests/serialize/bug24063.phpt create mode 100644 ext/standard/tests/serialize/bug25378.phpt create mode 100644 ext/standard/tests/serialize/bug26762.phpt create mode 100644 ext/standard/tests/serialize/bug27469.phpt create mode 100644 ext/standard/tests/serialize/bug28325.phpt create mode 100644 ext/standard/tests/serialize/bug30234.phpt create mode 100644 ext/standard/tests/serialize/bug31402.phpt create mode 100644 ext/standard/tests/serialize/bug31442.phpt create mode 100644 ext/standard/tests/serialize/bug35895.phpt create mode 100644 ext/standard/tests/serialize/bug36424.phpt create mode 100644 ext/standard/tests/serialize/bug37947.phpt create mode 100644 ext/standard/tests/serialize/bug42919.phpt create mode 100644 ext/standard/tests/serialize/bug43614.phpt create mode 100644 ext/standard/tests/serialize/bug45706.phpt create mode 100644 ext/standard/tests/serialize/bug46882.phpt create mode 100644 ext/standard/tests/serialize/bug55798.phpt create mode 100644 ext/standard/tests/serialize/bug62373.phpt create mode 100644 ext/standard/tests/serialize/bug62836_1.phpt create mode 100644 ext/standard/tests/serialize/bug62836_2.phpt create mode 100644 ext/standard/tests/serialize/incomplete_class.phpt create mode 100644 ext/standard/tests/serialize/precision.phpt create mode 100644 ext/standard/tests/serialize/serialization_arrays_001.phpt create mode 100644 ext/standard/tests/serialize/serialization_arrays_002.phpt create mode 100644 ext/standard/tests/serialize/serialization_arrays_003.phpt create mode 100644 ext/standard/tests/serialize/serialization_arrays_004.phpt create mode 100644 ext/standard/tests/serialize/serialization_arrays_005.phpt create mode 100644 ext/standard/tests/serialize/serialization_error_001.phpt create mode 100644 ext/standard/tests/serialize/serialization_miscTypes_001.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_001.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_002.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_003.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_004.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_005.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_006.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_007.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_008.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_009.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_010.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_011.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_012.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_013.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_014.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_015.phpt create mode 100644 ext/standard/tests/serialize/serialization_precision_001.phpt create mode 100644 ext/standard/tests/serialize/serialization_precision_002.phpt create mode 100644 ext/standard/tests/serialize/serialization_resources_001.phpt create mode 100644 ext/standard/tests/serialize/unserializeS.phpt create mode 100644 ext/standard/tests/streams/bug40459.phpt create mode 100644 ext/standard/tests/streams/bug44712.phpt create mode 100644 ext/standard/tests/streams/bug44818.phpt create mode 100644 ext/standard/tests/streams/bug46024.phpt create mode 100644 ext/standard/tests/streams/bug46426.phpt create mode 100644 ext/standard/tests/streams/bug47997.phpt create mode 100644 ext/standard/tests/streams/bug48309.phpt create mode 100644 ext/standard/tests/streams/bug49936.phpt create mode 100644 ext/standard/tests/streams/bug49936_win32.phpt create mode 100644 ext/standard/tests/streams/bug53427.phpt create mode 100644 ext/standard/tests/streams/bug53903.phpt create mode 100644 ext/standard/tests/streams/bug54623.phpt create mode 100644 ext/standard/tests/streams/bug54946.phpt create mode 100644 ext/standard/tests/streams/bug60106.phpt create mode 100644 ext/standard/tests/streams/bug60455_01.phpt create mode 100644 ext/standard/tests/streams/bug60455_02.phpt create mode 100644 ext/standard/tests/streams/bug60455_03.phpt create mode 100644 ext/standard/tests/streams/bug60455_04.phpt create mode 100644 ext/standard/tests/streams/bug60817.phpt create mode 100644 ext/standard/tests/streams/bug61115-1.phpt create mode 100644 ext/standard/tests/streams/bug61115-2.phpt create mode 100644 ext/standard/tests/streams/bug61115.phpt create mode 100644 ext/standard/tests/streams/bug61371-win.phpt create mode 100644 ext/standard/tests/streams/bug61371.phpt create mode 100644 ext/standard/tests/streams/bug63240.phpt create mode 100644 ext/standard/tests/streams/stream_context_get_params_001.phpt create mode 100644 ext/standard/tests/streams/stream_context_set_option_basic.phpt create mode 100644 ext/standard/tests/streams/stream_context_set_option_error_001.phpt create mode 100644 ext/standard/tests/streams/stream_context_set_option_error_002.phpt create mode 100644 ext/standard/tests/streams/stream_copy_to_stream_socket.phpt create mode 100644 ext/standard/tests/streams/stream_get_contents_001.phpt create mode 100644 ext/standard/tests/streams/stream_get_contents_002.phpt create mode 100644 ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt create mode 100644 ext/standard/tests/streams/stream_get_line_nb.phpt create mode 100644 ext/standard/tests/streams/stream_get_meta_data_dir_basic.phpt create mode 100644 ext/standard/tests/streams/stream_get_meta_data_file_basic.phpt create mode 100644 ext/standard/tests/streams/stream_get_meta_data_file_error.phpt create mode 100644 ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt create mode 100644 ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt create mode 100644 ext/standard/tests/streams/stream_get_meta_data_file_variation4.phpt create mode 100644 ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt create mode 100644 ext/standard/tests/streams/stream_get_meta_data_process_basic.phpt create mode 100644 ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt create mode 100644 ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt create mode 100644 ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt create mode 100644 ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt create mode 100644 ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt create mode 100644 ext/standard/tests/streams/stream_is_local.phpt create mode 100644 ext/standard/tests/streams/stream_resolve_include_path.phpt create mode 100644 ext/standard/tests/streams/stream_set_chunk_size.phpt create mode 100644 ext/standard/tests/streams/stream_set_timeout_error.phpt create mode 100644 ext/standard/tests/streams/stream_socket_pair.phpt create mode 100644 ext/standard/tests/strings/004.phpt create mode 100644 ext/standard/tests/strings/005.phpt create mode 100644 ext/standard/tests/strings/006.phpt create mode 100644 ext/standard/tests/strings/007-win32.phpt create mode 100644 ext/standard/tests/strings/007.phpt create mode 100644 ext/standard/tests/strings/add-and-stripcslashes.phpt create mode 100644 ext/standard/tests/strings/add-and-stripslashes.phpt create mode 100644 ext/standard/tests/strings/addcslashes_001.phpt create mode 100644 ext/standard/tests/strings/addcslashes_002.phpt create mode 100644 ext/standard/tests/strings/addcslashes_003.phpt create mode 100644 ext/standard/tests/strings/addcslashes_004.phpt create mode 100644 ext/standard/tests/strings/addslashes_basic.phpt create mode 100644 ext/standard/tests/strings/addslashes_error.phpt create mode 100644 ext/standard/tests/strings/addslashes_variation1.phpt create mode 100644 ext/standard/tests/strings/addslashes_variation2.phpt create mode 100644 ext/standard/tests/strings/basename.phpt create mode 100644 ext/standard/tests/strings/basename_basic.phpt create mode 100644 ext/standard/tests/strings/basename_error.phpt create mode 100644 ext/standard/tests/strings/basename_variation.phpt create mode 100644 ext/standard/tests/strings/bin2hex.phpt create mode 100644 ext/standard/tests/strings/bin2hex_basic.phpt create mode 100644 ext/standard/tests/strings/bin2hex_error.phpt create mode 100644 ext/standard/tests/strings/bin2hex_variation1.phpt create mode 100644 ext/standard/tests/strings/bug20108.phpt create mode 100644 ext/standard/tests/strings/bug20169.phpt create mode 100644 ext/standard/tests/strings/bug20261.phpt create mode 100644 ext/standard/tests/strings/bug20927.phpt create mode 100644 ext/standard/tests/strings/bug20934.phpt create mode 100644 ext/standard/tests/strings/bug21338.phpt create mode 100644 ext/standard/tests/strings/bug21453.phpt create mode 100644 ext/standard/tests/strings/bug21730.phpt create mode 100644 ext/standard/tests/strings/bug21744.phpt create mode 100644 ext/standard/tests/strings/bug22008.phpt create mode 100644 ext/standard/tests/strings/bug22187.phpt create mode 100644 ext/standard/tests/strings/bug22207.phpt create mode 100644 ext/standard/tests/strings/bug22224.phpt create mode 100644 ext/standard/tests/strings/bug22227.phpt create mode 100644 ext/standard/tests/strings/bug23650.phpt create mode 100644 ext/standard/tests/strings/bug23894.phpt create mode 100644 ext/standard/tests/strings/bug24098.phpt create mode 100644 ext/standard/tests/strings/bug24208.phpt create mode 100644 ext/standard/tests/strings/bug24281.phpt create mode 100644 ext/standard/tests/strings/bug24312.phpt create mode 100644 ext/standard/tests/strings/bug25671.phpt create mode 100644 ext/standard/tests/strings/bug25707.phpt create mode 100644 ext/standard/tests/strings/bug26817.phpt create mode 100644 ext/standard/tests/strings/bug26819.phpt create mode 100644 ext/standard/tests/strings/bug26878.phpt create mode 100644 ext/standard/tests/strings/bug26973.phpt create mode 100644 ext/standard/tests/strings/bug27276.phpt create mode 100644 ext/standard/tests/strings/bug27278.phpt create mode 100644 ext/standard/tests/strings/bug27295.phpt create mode 100644 ext/standard/tests/strings/bug27457.phpt create mode 100644 ext/standard/tests/strings/bug27675.phpt create mode 100644 ext/standard/tests/strings/bug28386.phpt create mode 100644 ext/standard/tests/strings/bug28633.phpt create mode 100644 ext/standard/tests/strings/bug29075.phpt create mode 100644 ext/standard/tests/strings/bug29119.phpt create mode 100644 ext/standard/tests/strings/bug29538.phpt create mode 100644 ext/standard/tests/strings/bug33076.phpt create mode 100644 ext/standard/tests/strings/bug33605.phpt create mode 100644 ext/standard/tests/strings/bug34214.phpt create mode 100644 ext/standard/tests/strings/bug35817.phpt create mode 100644 ext/standard/tests/strings/bug36148.phpt create mode 100644 ext/standard/tests/strings/bug36306.phpt create mode 100644 ext/standard/tests/strings/bug36392.phpt create mode 100644 ext/standard/tests/strings/bug36944.phpt create mode 100644 ext/standard/tests/strings/bug37244.phpt create mode 100644 ext/standard/tests/strings/bug37262.phpt create mode 100644 ext/standard/tests/strings/bug38322.phpt create mode 100644 ext/standard/tests/strings/bug38770.phpt create mode 100644 ext/standard/tests/strings/bug39032.phpt create mode 100644 ext/standard/tests/strings/bug39350.phpt create mode 100644 ext/standard/tests/strings/bug39621.phpt create mode 100644 ext/standard/tests/strings/bug39873.phpt create mode 100644 ext/standard/tests/strings/bug40432.phpt create mode 100644 ext/standard/tests/strings/bug40637.phpt create mode 100644 ext/standard/tests/strings/bug40704.phpt create mode 100644 ext/standard/tests/strings/bug40754.phpt create mode 100644 ext/standard/tests/strings/bug40915.phpt create mode 100644 ext/standard/tests/strings/bug42107.phpt create mode 100644 ext/standard/tests/strings/bug42208.phpt create mode 100644 ext/standard/tests/strings/bug43927.phpt create mode 100644 ext/standard/tests/strings/bug44242.phpt create mode 100644 ext/standard/tests/strings/bug44703.phpt create mode 100644 ext/standard/tests/strings/bug45166.phpt create mode 100644 ext/standard/tests/strings/bug45485.phpt create mode 100644 ext/standard/tests/strings/bug46578.phpt create mode 100644 ext/standard/tests/strings/bug47168.phpt create mode 100644 ext/standard/tests/strings/bug47322.phpt create mode 100644 ext/standard/tests/strings/bug47443.phpt create mode 100644 ext/standard/tests/strings/bug47481.phpt create mode 100644 ext/standard/tests/strings/bug47842.phpt create mode 100644 ext/standard/tests/strings/bug48709.phpt create mode 100644 ext/standard/tests/strings/bug49785.phpt create mode 100644 ext/standard/tests/strings/bug50052.phpt create mode 100644 ext/standard/tests/strings/bug50847.phpt create mode 100644 ext/standard/tests/strings/bug51059.phpt create mode 100644 ext/standard/tests/strings/bug51899.phpt create mode 100644 ext/standard/tests/strings/bug53021.phpt create mode 100644 ext/standard/tests/strings/bug53319.phpt create mode 100644 ext/standard/tests/strings/bug54055.phpt create mode 100644 ext/standard/tests/strings/bug54238.phpt create mode 100644 ext/standard/tests/strings/bug54322.phpt create mode 100644 ext/standard/tests/strings/bug54332.phpt create mode 100644 ext/standard/tests/strings/bug54454.phpt create mode 100644 ext/standard/tests/strings/bug54721.phpt create mode 100644 ext/standard/tests/strings/bug55674.phpt create mode 100644 ext/standard/tests/strings/bug55871.phpt create mode 100644 ext/standard/tests/strings/bug60801.phpt create mode 100644 ext/standard/tests/strings/bug60965.phpt create mode 100644 ext/standard/tests/strings/bug61374.phpt create mode 100644 ext/standard/tests/strings/bug61660.phpt create mode 100644 ext/standard/tests/strings/bug61764.phpt create mode 100644 ext/standard/tests/strings/bug62443.phpt create mode 100644 ext/standard/tests/strings/bug62462.phpt create mode 100644 ext/standard/tests/strings/bug63943.phpt create mode 100644 ext/standard/tests/strings/chop_basic.phpt create mode 100644 ext/standard/tests/strings/chop_error.phpt create mode 100644 ext/standard/tests/strings/chop_variation1.phpt create mode 100644 ext/standard/tests/strings/chop_variation2.phpt create mode 100644 ext/standard/tests/strings/chop_variation3.phpt create mode 100644 ext/standard/tests/strings/chop_variation4.phpt create mode 100644 ext/standard/tests/strings/chop_variation5.phpt create mode 100644 ext/standard/tests/strings/chr_basic.phpt create mode 100644 ext/standard/tests/strings/chr_error.phpt create mode 100644 ext/standard/tests/strings/chr_ord.phpt create mode 100644 ext/standard/tests/strings/chr_variation1.phpt create mode 100644 ext/standard/tests/strings/chunk_split.phpt create mode 100644 ext/standard/tests/strings/chunk_split_basic.phpt create mode 100644 ext/standard/tests/strings/chunk_split_error.phpt create mode 100644 ext/standard/tests/strings/chunk_split_variation1.phpt create mode 100644 ext/standard/tests/strings/chunk_split_variation10.phpt create mode 100644 ext/standard/tests/strings/chunk_split_variation11.phpt create mode 100644 ext/standard/tests/strings/chunk_split_variation12.phpt create mode 100644 ext/standard/tests/strings/chunk_split_variation13.phpt create mode 100644 ext/standard/tests/strings/chunk_split_variation2.phpt create mode 100644 ext/standard/tests/strings/chunk_split_variation3.phpt create mode 100644 ext/standard/tests/strings/chunk_split_variation4.phpt create mode 100644 ext/standard/tests/strings/chunk_split_variation5.phpt create mode 100644 ext/standard/tests/strings/chunk_split_variation6.phpt create mode 100644 ext/standard/tests/strings/chunk_split_variation7.phpt create mode 100644 ext/standard/tests/strings/chunk_split_variation8.phpt create mode 100644 ext/standard/tests/strings/chunk_split_variation9.phpt create mode 100644 ext/standard/tests/strings/convert_cyr_string.phpt create mode 100644 ext/standard/tests/strings/convert_cyr_string_basic.phpt create mode 100644 ext/standard/tests/strings/convert_cyr_string_error.phpt create mode 100644 ext/standard/tests/strings/convert_cyr_string_variation1.phpt create mode 100644 ext/standard/tests/strings/convert_uudecode_basic.phpt create mode 100644 ext/standard/tests/strings/convert_uudecode_error.phpt create mode 100644 ext/standard/tests/strings/convert_uudecode_variation1.phpt create mode 100644 ext/standard/tests/strings/convert_uuencode_basic.phpt create mode 100644 ext/standard/tests/strings/convert_uuencode_error.phpt create mode 100644 ext/standard/tests/strings/convert_uuencode_variation1.phpt create mode 100644 ext/standard/tests/strings/count_chars.phpt create mode 100644 ext/standard/tests/strings/count_chars_basic.phpt create mode 100644 ext/standard/tests/strings/count_chars_error.phpt create mode 100644 ext/standard/tests/strings/count_chars_variation1.phpt create mode 100644 ext/standard/tests/strings/count_chars_variation2.phpt create mode 100644 ext/standard/tests/strings/crc32.phpt create mode 100644 ext/standard/tests/strings/crc32_basic.phpt create mode 100644 ext/standard/tests/strings/crc32_error.phpt create mode 100644 ext/standard/tests/strings/crc32_variation1.phpt create mode 100644 ext/standard/tests/strings/crc32_variation2.phpt create mode 100644 ext/standard/tests/strings/crc32_variation3.phpt create mode 100644 ext/standard/tests/strings/crc32_variation4.phpt create mode 100644 ext/standard/tests/strings/crypt.phpt create mode 100644 ext/standard/tests/strings/crypt_blowfish.phpt create mode 100644 ext/standard/tests/strings/crypt_blowfish_variation1.phpt create mode 100644 ext/standard/tests/strings/crypt_blowfish_variation2.phpt create mode 100644 ext/standard/tests/strings/crypt_chars.phpt create mode 100644 ext/standard/tests/strings/crypt_sha256.phpt create mode 100644 ext/standard/tests/strings/crypt_sha512.phpt create mode 100644 ext/standard/tests/strings/crypt_variation1.phpt create mode 100644 ext/standard/tests/strings/dirname_basic.phpt create mode 100644 ext/standard/tests/strings/dirname_error.phpt create mode 100644 ext/standard/tests/strings/dirname_variation.phpt create mode 100644 ext/standard/tests/strings/explode.phpt create mode 100644 ext/standard/tests/strings/explode1.phpt create mode 100644 ext/standard/tests/strings/explode_bug.phpt create mode 100644 ext/standard/tests/strings/explode_error.phpt create mode 100644 ext/standard/tests/strings/explode_variation1.phpt create mode 100644 ext/standard/tests/strings/explode_variation2.phpt create mode 100644 ext/standard/tests/strings/explode_variation3.phpt create mode 100644 ext/standard/tests/strings/explode_variation4.phpt create mode 100644 ext/standard/tests/strings/explode_variation5.phpt create mode 100644 ext/standard/tests/strings/explode_variation6.phpt create mode 100644 ext/standard/tests/strings/fprintf_error.phpt create mode 100644 ext/standard/tests/strings/fprintf_variation_001.phpt create mode 100644 ext/standard/tests/strings/fprintf_variation_002.phpt create mode 100644 ext/standard/tests/strings/fprintf_variation_003.phpt create mode 100644 ext/standard/tests/strings/fprintf_variation_003_64bit.phpt create mode 100644 ext/standard/tests/strings/fprintf_variation_004.phpt create mode 100644 ext/standard/tests/strings/fprintf_variation_005.phpt create mode 100644 ext/standard/tests/strings/fprintf_variation_006.phpt create mode 100644 ext/standard/tests/strings/fprintf_variation_006_64bit.phpt create mode 100644 ext/standard/tests/strings/fprintf_variation_007.phpt create mode 100644 ext/standard/tests/strings/fprintf_variation_007_64bit.phpt create mode 100644 ext/standard/tests/strings/fprintf_variation_008.phpt create mode 100644 ext/standard/tests/strings/fprintf_variation_008_64bit.phpt create mode 100644 ext/standard/tests/strings/fprintf_variation_009.phpt create mode 100644 ext/standard/tests/strings/get_html_translation_table_basic1.phpt create mode 100644 ext/standard/tests/strings/get_html_translation_table_basic10.phpt create mode 100644 ext/standard/tests/strings/get_html_translation_table_basic2.phpt create mode 100644 ext/standard/tests/strings/get_html_translation_table_basic3.phpt create mode 100644 ext/standard/tests/strings/get_html_translation_table_basic4.phpt create mode 100644 ext/standard/tests/strings/get_html_translation_table_basic5.phpt create mode 100644 ext/standard/tests/strings/get_html_translation_table_basic6.phpt create mode 100644 ext/standard/tests/strings/get_html_translation_table_basic7.phpt create mode 100644 ext/standard/tests/strings/get_html_translation_table_basic8.phpt create mode 100644 ext/standard/tests/strings/get_html_translation_table_basic9.phpt create mode 100644 ext/standard/tests/strings/get_html_translation_table_error.phpt create mode 100644 ext/standard/tests/strings/get_html_translation_table_variation1.phpt create mode 100644 ext/standard/tests/strings/get_html_translation_table_variation2.phpt create mode 100644 ext/standard/tests/strings/get_meta_tags.phpt create mode 100644 ext/standard/tests/strings/hebrev_basic.phpt create mode 100644 ext/standard/tests/strings/hebrev_error.phpt create mode 100644 ext/standard/tests/strings/hebrev_variation1.phpt create mode 100644 ext/standard/tests/strings/hebrev_variation2.phpt create mode 100644 ext/standard/tests/strings/hebrevc_basic.phpt create mode 100644 ext/standard/tests/strings/hebrevc_error.phpt create mode 100644 ext/standard/tests/strings/hebrevc_variation1.phpt create mode 100644 ext/standard/tests/strings/hebrevc_variation2.phpt create mode 100644 ext/standard/tests/strings/highlight_file.phpt create mode 100644 ext/standard/tests/strings/html_entity_decode1.phpt create mode 100644 ext/standard/tests/strings/html_entity_decode2.phpt create mode 100644 ext/standard/tests/strings/html_entity_decode3.phpt create mode 100644 ext/standard/tests/strings/html_entity_decode_cp866.phpt create mode 100644 ext/standard/tests/strings/html_entity_decode_html4.phpt create mode 100644 ext/standard/tests/strings/html_entity_decode_html5.phpt create mode 100644 ext/standard/tests/strings/html_entity_decode_iso8859-15.phpt create mode 100644 ext/standard/tests/strings/html_entity_decode_iso8859-5.phpt create mode 100644 ext/standard/tests/strings/html_entity_decode_koi8-r.phpt create mode 100644 ext/standard/tests/strings/html_entity_decode_macroman.phpt create mode 100644 ext/standard/tests/strings/html_entity_decode_win1251.phpt create mode 100644 ext/standard/tests/strings/html_entity_decode_win1252.phpt create mode 100644 ext/standard/tests/strings/htmlentities-utf-2.phpt create mode 100644 ext/standard/tests/strings/htmlentities-utf-3.phpt create mode 100644 ext/standard/tests/strings/htmlentities-utf.phpt create mode 100644 ext/standard/tests/strings/htmlentities.phpt create mode 100644 ext/standard/tests/strings/htmlentities01.phpt create mode 100644 ext/standard/tests/strings/htmlentities02.phpt create mode 100644 ext/standard/tests/strings/htmlentities03.phpt create mode 100644 ext/standard/tests/strings/htmlentities04.phpt create mode 100644 ext/standard/tests/strings/htmlentities05.phpt create mode 100644 ext/standard/tests/strings/htmlentities06.phpt create mode 100644 ext/standard/tests/strings/htmlentities07.phpt create mode 100644 ext/standard/tests/strings/htmlentities08.phpt create mode 100644 ext/standard/tests/strings/htmlentities09.phpt create mode 100644 ext/standard/tests/strings/htmlentities10.phpt create mode 100644 ext/standard/tests/strings/htmlentities11.phpt create mode 100644 ext/standard/tests/strings/htmlentities12.phpt create mode 100644 ext/standard/tests/strings/htmlentities13.phpt create mode 100644 ext/standard/tests/strings/htmlentities14.phpt create mode 100644 ext/standard/tests/strings/htmlentities15.phpt create mode 100644 ext/standard/tests/strings/htmlentities16.phpt create mode 100644 ext/standard/tests/strings/htmlentities17.phpt create mode 100644 ext/standard/tests/strings/htmlentities18.phpt create mode 100644 ext/standard/tests/strings/htmlentities19.phpt create mode 100644 ext/standard/tests/strings/htmlentities20.phpt create mode 100644 ext/standard/tests/strings/htmlentities21.phpt create mode 100644 ext/standard/tests/strings/htmlentities22.phpt create mode 100644 ext/standard/tests/strings/htmlentities23.phpt create mode 100644 ext/standard/tests/strings/htmlentities24.phpt create mode 100644 ext/standard/tests/strings/htmlentities_html4.phpt create mode 100644 ext/standard/tests/strings/htmlentities_html5.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_basic.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_error.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_variation7.phpt create mode 100644 ext/standard/tests/strings/http_build_query.phpt create mode 100644 ext/standard/tests/strings/http_build_query_error.phpt create mode 100644 ext/standard/tests/strings/http_build_query_variation1.phpt create mode 100644 ext/standard/tests/strings/http_build_query_variation2.phpt create mode 100644 ext/standard/tests/strings/http_build_query_variation3.phpt create mode 100644 ext/standard/tests/strings/implode.phpt create mode 100644 ext/standard/tests/strings/implode1.phpt create mode 100644 ext/standard/tests/strings/join_basic.phpt create mode 100644 ext/standard/tests/strings/join_error.phpt create mode 100644 ext/standard/tests/strings/join_variation1.phpt create mode 100644 ext/standard/tests/strings/join_variation2.phpt create mode 100644 ext/standard/tests/strings/join_variation3.phpt create mode 100644 ext/standard/tests/strings/join_variation4.phpt create mode 100644 ext/standard/tests/strings/join_variation5.phpt create mode 100644 ext/standard/tests/strings/join_variation6.phpt create mode 100644 ext/standard/tests/strings/lcfirst.phpt create mode 100644 ext/standard/tests/strings/levenshtein.phpt create mode 100644 ext/standard/tests/strings/ltrim.phpt create mode 100644 ext/standard/tests/strings/ltrim_basic.phpt create mode 100644 ext/standard/tests/strings/ltrim_error.phpt create mode 100644 ext/standard/tests/strings/ltrim_variation1.phpt create mode 100644 ext/standard/tests/strings/ltrim_variation2.phpt create mode 100644 ext/standard/tests/strings/md5.phpt create mode 100644 ext/standard/tests/strings/md5_basic1.phpt create mode 100644 ext/standard/tests/strings/md5_basic2.phpt create mode 100644 ext/standard/tests/strings/md5_error.phpt create mode 100644 ext/standard/tests/strings/md5_file.phpt create mode 100644 ext/standard/tests/strings/md5raw.phpt create mode 100644 ext/standard/tests/strings/metaphone.phpt create mode 100644 ext/standard/tests/strings/money_format_basic1.phpt create mode 100644 ext/standard/tests/strings/money_format_error.phpt create mode 100644 ext/standard/tests/strings/money_format_variation1.phpt create mode 100644 ext/standard/tests/strings/money_format_variation2.phpt create mode 100644 ext/standard/tests/strings/moneyformat.phpt create mode 100644 ext/standard/tests/strings/nl2br.phpt create mode 100644 ext/standard/tests/strings/nl2br_error.phpt create mode 100644 ext/standard/tests/strings/nl2br_variation1.phpt create mode 100644 ext/standard/tests/strings/nl2br_variation2.phpt create mode 100644 ext/standard/tests/strings/nl2br_variation3.phpt create mode 100644 ext/standard/tests/strings/nl2br_variation4.phpt create mode 100644 ext/standard/tests/strings/nl2br_variation5.phpt create mode 100644 ext/standard/tests/strings/nl_langinfo_basic.phpt create mode 100644 ext/standard/tests/strings/nl_langinfo_error1.phpt create mode 100644 ext/standard/tests/strings/nl_langinfo_variation1.phpt create mode 100644 ext/standard/tests/strings/number_format_basic.phpt create mode 100644 ext/standard/tests/strings/number_format_error.phpt create mode 100644 ext/standard/tests/strings/ord_basic.phpt create mode 100644 ext/standard/tests/strings/ord_error.phpt create mode 100644 ext/standard/tests/strings/ord_variation1.phpt create mode 100644 ext/standard/tests/strings/pack.phpt create mode 100644 ext/standard/tests/strings/parse_str_basic1.phpt create mode 100644 ext/standard/tests/strings/parse_str_basic2.phpt create mode 100644 ext/standard/tests/strings/parse_str_basic3.phpt create mode 100644 ext/standard/tests/strings/parse_str_basic4.phpt create mode 100644 ext/standard/tests/strings/parse_str_error1.phpt create mode 100644 ext/standard/tests/strings/pathinfo.phpt create mode 100644 ext/standard/tests/strings/php_strip_whitespace.phpt create mode 100644 ext/standard/tests/strings/print_basic.phpt create mode 100644 ext/standard/tests/strings/print_variation1.phpt create mode 100644 ext/standard/tests/strings/printf.phpt create mode 100644 ext/standard/tests/strings/printf_64bit.phpt create mode 100644 ext/standard/tests/strings/printf_basic1.phpt create mode 100644 ext/standard/tests/strings/printf_basic2.phpt create mode 100644 ext/standard/tests/strings/printf_basic3.phpt create mode 100644 ext/standard/tests/strings/printf_basic4.phpt create mode 100644 ext/standard/tests/strings/printf_basic5.phpt create mode 100644 ext/standard/tests/strings/printf_basic6.phpt create mode 100644 ext/standard/tests/strings/printf_basic7.phpt create mode 100644 ext/standard/tests/strings/printf_basic8.phpt create mode 100644 ext/standard/tests/strings/printf_basic9.phpt create mode 100644 ext/standard/tests/strings/printf_error.phpt create mode 100644 ext/standard/tests/strings/printf_variation1.phpt create mode 100644 ext/standard/tests/strings/printf_variation2.phpt create mode 100644 ext/standard/tests/strings/quoted_printable_decode_basic.phpt create mode 100644 ext/standard/tests/strings/quoted_printable_decode_error.phpt create mode 100644 ext/standard/tests/strings/quoted_printable_decode_variation1.phpt create mode 100644 ext/standard/tests/strings/quoted_printable_encode_001.phpt create mode 100644 ext/standard/tests/strings/quoted_printable_encode_002.phpt create mode 100644 ext/standard/tests/strings/quotemeta_basic.phpt create mode 100644 ext/standard/tests/strings/quotemeta_error.phpt create mode 100644 ext/standard/tests/strings/rtrim.phpt create mode 100644 ext/standard/tests/strings/rtrim_basic.phpt create mode 100644 ext/standard/tests/strings/rtrim_error.phpt create mode 100644 ext/standard/tests/strings/rtrim_variation1.phpt create mode 100644 ext/standard/tests/strings/rtrim_variation2.phpt create mode 100644 ext/standard/tests/strings/setlocale_basic1.phpt create mode 100644 ext/standard/tests/strings/setlocale_basic2.phpt create mode 100644 ext/standard/tests/strings/setlocale_basic3.phpt create mode 100644 ext/standard/tests/strings/setlocale_error.phpt create mode 100644 ext/standard/tests/strings/setlocale_variation1.phpt create mode 100644 ext/standard/tests/strings/setlocale_variation2.phpt create mode 100644 ext/standard/tests/strings/setlocale_variation3.phpt create mode 100644 ext/standard/tests/strings/setlocale_variation4.phpt create mode 100644 ext/standard/tests/strings/setlocale_variation5.phpt create mode 100644 ext/standard/tests/strings/sha1.phpt create mode 100644 ext/standard/tests/strings/sha1_basic.phpt create mode 100644 ext/standard/tests/strings/sha1_error.phpt create mode 100644 ext/standard/tests/strings/sha1_file.phpt create mode 100644 ext/standard/tests/strings/sha1_variation1.phpt create mode 100644 ext/standard/tests/strings/sha1_variation2.phpt create mode 100644 ext/standard/tests/strings/sha1raw.phpt create mode 100644 ext/standard/tests/strings/show_source_basic.phpt create mode 100644 ext/standard/tests/strings/show_source_variation1.phpt create mode 100644 ext/standard/tests/strings/show_source_variation2.phpt create mode 100644 ext/standard/tests/strings/similar_text_basic.phpt create mode 100644 ext/standard/tests/strings/similar_text_error.phpt create mode 100644 ext/standard/tests/strings/soundex.phpt create mode 100644 ext/standard/tests/strings/soundex_basic.phpt create mode 100644 ext/standard/tests/strings/soundex_error.phpt create mode 100644 ext/standard/tests/strings/sprintf_basic1.phpt create mode 100644 ext/standard/tests/strings/sprintf_basic2.phpt create mode 100644 ext/standard/tests/strings/sprintf_basic3.phpt create mode 100644 ext/standard/tests/strings/sprintf_basic4.phpt create mode 100644 ext/standard/tests/strings/sprintf_basic5.phpt create mode 100644 ext/standard/tests/strings/sprintf_basic6.phpt create mode 100644 ext/standard/tests/strings/sprintf_basic7.phpt create mode 100644 ext/standard/tests/strings/sprintf_basic7_64bit.phpt create mode 100644 ext/standard/tests/strings/sprintf_basic8.phpt create mode 100644 ext/standard/tests/strings/sprintf_basic8_64bit.phpt create mode 100644 ext/standard/tests/strings/sprintf_basic9.phpt create mode 100644 ext/standard/tests/strings/sprintf_error.phpt create mode 100644 ext/standard/tests/strings/sprintf_f.phpt create mode 100644 ext/standard/tests/strings/sprintf_f_2.phpt create mode 100644 ext/standard/tests/strings/sprintf_f_3.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation1.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation10.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation11.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation12.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation13.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation14.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation15.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation16.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation17.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation18.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation19.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation2.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation20.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation21.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation22.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation23.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation24.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation25.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation26.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation27.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation28.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation28_64bit.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation29.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation29_64bit.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation3.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation30.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation31.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation32.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation33.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation34.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation34_64bit.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation35.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation35_64bit.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation36.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation37.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation38.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation39.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation4.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation40.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation40_64bit.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation41.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation41_64bit.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation42.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation43.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation44.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation44_64bit.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation45.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation46.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation47.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation48.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation49.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation4_64bit.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation5.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation50.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation51.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation52.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation53.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation6.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation7.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation8.phpt create mode 100644 ext/standard/tests/strings/sprintf_variation9.phpt create mode 100644 ext/standard/tests/strings/sscanf_basic1.phpt create mode 100644 ext/standard/tests/strings/sscanf_basic2.phpt create mode 100644 ext/standard/tests/strings/sscanf_basic3.phpt create mode 100644 ext/standard/tests/strings/sscanf_basic4.phpt create mode 100644 ext/standard/tests/strings/sscanf_basic5.phpt create mode 100644 ext/standard/tests/strings/sscanf_basic6.phpt create mode 100644 ext/standard/tests/strings/sscanf_basic7.phpt create mode 100644 ext/standard/tests/strings/sscanf_basic8.phpt create mode 100644 ext/standard/tests/strings/sscanf_error.phpt create mode 100644 ext/standard/tests/strings/sscanf_variation1.phpt create mode 100644 ext/standard/tests/strings/sscanf_variation2.phpt create mode 100644 ext/standard/tests/strings/str_getcsv_001.phpt create mode 100644 ext/standard/tests/strings/str_ireplace.phpt create mode 100644 ext/standard/tests/strings/str_pad.phpt create mode 100644 ext/standard/tests/strings/str_pad_variation1.phpt create mode 100644 ext/standard/tests/strings/str_pad_variation2.phpt create mode 100644 ext/standard/tests/strings/str_pad_variation3.phpt create mode 100644 ext/standard/tests/strings/str_pad_variation4.phpt create mode 100644 ext/standard/tests/strings/str_pad_variation5.phpt create mode 100644 ext/standard/tests/strings/str_repeat.phpt create mode 100644 ext/standard/tests/strings/str_replace.phpt create mode 100644 ext/standard/tests/strings/str_replace_basic.phpt create mode 100644 ext/standard/tests/strings/str_replace_error.phpt create mode 100644 ext/standard/tests/strings/str_replace_variation1.phpt create mode 100644 ext/standard/tests/strings/str_replace_variation2.phpt create mode 100644 ext/standard/tests/strings/str_replace_variation3.phpt create mode 100644 ext/standard/tests/strings/str_rot13_basic.phpt create mode 100644 ext/standard/tests/strings/str_rot13_error.phpt create mode 100644 ext/standard/tests/strings/str_shuffle.phpt create mode 100644 ext/standard/tests/strings/str_shuffle_basic.phpt create mode 100644 ext/standard/tests/strings/str_shuffle_error.phpt create mode 100644 ext/standard/tests/strings/str_shuffle_variation1.phpt create mode 100644 ext/standard/tests/strings/str_split_basic.phpt create mode 100644 ext/standard/tests/strings/str_split_error.phpt create mode 100644 ext/standard/tests/strings/str_split_variation1.phpt create mode 100644 ext/standard/tests/strings/str_split_variation2.phpt create mode 100644 ext/standard/tests/strings/str_split_variation2_64bit.phpt create mode 100644 ext/standard/tests/strings/str_split_variation3.phpt create mode 100644 ext/standard/tests/strings/str_split_variation4.phpt create mode 100644 ext/standard/tests/strings/str_split_variation5.phpt create mode 100644 ext/standard/tests/strings/str_split_variation6.phpt create mode 100644 ext/standard/tests/strings/str_split_variation6_64bit.phpt create mode 100644 ext/standard/tests/strings/str_split_variation7.phpt create mode 100644 ext/standard/tests/strings/str_split_variation7_64bit.phpt create mode 100644 ext/standard/tests/strings/str_word_count.phpt create mode 100644 ext/standard/tests/strings/str_word_count1.phpt create mode 100644 ext/standard/tests/strings/strcasecmp.phpt create mode 100644 ext/standard/tests/strings/strcmp.phpt create mode 100644 ext/standard/tests/strings/strcoll.phpt create mode 100644 ext/standard/tests/strings/strcoll_error.phpt create mode 100644 ext/standard/tests/strings/strcspn.phpt create mode 100644 ext/standard/tests/strings/strcspn_basic.phpt create mode 100644 ext/standard/tests/strings/strcspn_error.phpt create mode 100644 ext/standard/tests/strings/strcspn_variation1.phpt create mode 100644 ext/standard/tests/strings/strcspn_variation10.phpt create mode 100644 ext/standard/tests/strings/strcspn_variation11.phpt create mode 100644 ext/standard/tests/strings/strcspn_variation12.phpt create mode 100644 ext/standard/tests/strings/strcspn_variation2.phpt create mode 100644 ext/standard/tests/strings/strcspn_variation3.phpt create mode 100644 ext/standard/tests/strings/strcspn_variation4.phpt create mode 100644 ext/standard/tests/strings/strcspn_variation5.phpt create mode 100644 ext/standard/tests/strings/strcspn_variation6.phpt create mode 100644 ext/standard/tests/strings/strcspn_variation7.phpt create mode 100644 ext/standard/tests/strings/strcspn_variation8.phpt create mode 100644 ext/standard/tests/strings/strcspn_variation9.phpt create mode 100644 ext/standard/tests/strings/strings001.phpt create mode 100644 ext/standard/tests/strings/strip_tags.phpt create mode 100644 ext/standard/tests/strings/strip_tags_basic1.phpt create mode 100644 ext/standard/tests/strings/strip_tags_basic2.phpt create mode 100644 ext/standard/tests/strings/strip_tags_error.phpt create mode 100644 ext/standard/tests/strings/strip_tags_variation1.phpt create mode 100644 ext/standard/tests/strings/strip_tags_variation10.phpt create mode 100644 ext/standard/tests/strings/strip_tags_variation11.phpt create mode 100644 ext/standard/tests/strings/strip_tags_variation2.phpt create mode 100644 ext/standard/tests/strings/strip_tags_variation3.phpt create mode 100644 ext/standard/tests/strings/strip_tags_variation4.phpt create mode 100644 ext/standard/tests/strings/strip_tags_variation5.phpt create mode 100644 ext/standard/tests/strings/strip_tags_variation6.phpt create mode 100644 ext/standard/tests/strings/strip_tags_variation7.phpt create mode 100644 ext/standard/tests/strings/strip_tags_variation8.phpt create mode 100644 ext/standard/tests/strings/strip_tags_variation9.phpt create mode 100644 ext/standard/tests/strings/stripcslashes_basic.phpt create mode 100644 ext/standard/tests/strings/stripcslashes_error.phpt create mode 100644 ext/standard/tests/strings/stripcslashes_variation1.phpt create mode 100644 ext/standard/tests/strings/stripos.phpt create mode 100644 ext/standard/tests/strings/stripos_basic1.phpt create mode 100644 ext/standard/tests/strings/stripos_basic2.phpt create mode 100644 ext/standard/tests/strings/stripos_error.phpt create mode 100644 ext/standard/tests/strings/stripos_variation1.phpt create mode 100644 ext/standard/tests/strings/stripos_variation10.phpt create mode 100644 ext/standard/tests/strings/stripos_variation11.phpt create mode 100644 ext/standard/tests/strings/stripos_variation12.phpt create mode 100644 ext/standard/tests/strings/stripos_variation13.phpt create mode 100644 ext/standard/tests/strings/stripos_variation14.phpt create mode 100644 ext/standard/tests/strings/stripos_variation15.phpt create mode 100644 ext/standard/tests/strings/stripos_variation2.phpt create mode 100644 ext/standard/tests/strings/stripos_variation3.phpt create mode 100644 ext/standard/tests/strings/stripos_variation4.phpt create mode 100644 ext/standard/tests/strings/stripos_variation5.phpt create mode 100644 ext/standard/tests/strings/stripos_variation6.phpt create mode 100644 ext/standard/tests/strings/stripos_variation7.phpt create mode 100644 ext/standard/tests/strings/stripos_variation8.phpt create mode 100644 ext/standard/tests/strings/stripos_variation9.phpt create mode 100644 ext/standard/tests/strings/stripslashes_basic.phpt create mode 100644 ext/standard/tests/strings/stripslashes_error.phpt create mode 100644 ext/standard/tests/strings/stripslashes_variation1.phpt create mode 100644 ext/standard/tests/strings/stripslashes_variation2.phpt create mode 100644 ext/standard/tests/strings/stripslashes_variation3.phpt create mode 100644 ext/standard/tests/strings/stripslashes_variation4.phpt create mode 100644 ext/standard/tests/strings/stristr.phpt create mode 100644 ext/standard/tests/strings/stristr2.phpt create mode 100644 ext/standard/tests/strings/stristr_basic.phpt create mode 100644 ext/standard/tests/strings/stristr_error.phpt create mode 100644 ext/standard/tests/strings/stristr_variation1.phpt create mode 100644 ext/standard/tests/strings/stristr_variation2.phpt create mode 100644 ext/standard/tests/strings/strlen.phpt create mode 100644 ext/standard/tests/strings/strlen_basic.phpt create mode 100644 ext/standard/tests/strings/strlen_error.phpt create mode 100644 ext/standard/tests/strings/strlen_variation1.phpt create mode 100644 ext/standard/tests/strings/strnatcasecmp_basic.phpt create mode 100644 ext/standard/tests/strings/strnatcasecmp_error.phpt create mode 100644 ext/standard/tests/strings/strnatcasecmp_variation1.phpt create mode 100644 ext/standard/tests/strings/strnatcmp_basic.phpt create mode 100644 ext/standard/tests/strings/strnatcmp_error.phpt create mode 100644 ext/standard/tests/strings/strncasecmp_basic.phpt create mode 100644 ext/standard/tests/strings/strncasecmp_error.phpt create mode 100644 ext/standard/tests/strings/strncasecmp_variation1.phpt create mode 100644 ext/standard/tests/strings/strncasecmp_variation10.phpt create mode 100644 ext/standard/tests/strings/strncasecmp_variation11.phpt create mode 100644 ext/standard/tests/strings/strncasecmp_variation2.phpt create mode 100644 ext/standard/tests/strings/strncasecmp_variation3.phpt create mode 100644 ext/standard/tests/strings/strncasecmp_variation4.phpt create mode 100644 ext/standard/tests/strings/strncasecmp_variation5.phpt create mode 100644 ext/standard/tests/strings/strncasecmp_variation6.phpt create mode 100644 ext/standard/tests/strings/strncasecmp_variation7.phpt create mode 100644 ext/standard/tests/strings/strncasecmp_variation8.phpt create mode 100644 ext/standard/tests/strings/strncasecmp_variation9.phpt create mode 100644 ext/standard/tests/strings/strncmp_basic.phpt create mode 100644 ext/standard/tests/strings/strncmp_error.phpt create mode 100644 ext/standard/tests/strings/strncmp_variation1.phpt create mode 100644 ext/standard/tests/strings/strncmp_variation2.phpt create mode 100644 ext/standard/tests/strings/strncmp_variation3.phpt create mode 100644 ext/standard/tests/strings/strncmp_variation4.phpt create mode 100644 ext/standard/tests/strings/strncmp_variation5.phpt create mode 100644 ext/standard/tests/strings/strncmp_variation6.phpt create mode 100644 ext/standard/tests/strings/strncmp_variation7.phpt create mode 100644 ext/standard/tests/strings/strncmp_variation8.phpt create mode 100644 ext/standard/tests/strings/strncmp_variation9.phpt create mode 100644 ext/standard/tests/strings/strpbrk_basic.phpt create mode 100644 ext/standard/tests/strings/strpbrk_error.phpt create mode 100644 ext/standard/tests/strings/strpos.phpt create mode 100644 ext/standard/tests/strings/strpos_number.phpt create mode 100644 ext/standard/tests/strings/strrchr.phpt create mode 100644 ext/standard/tests/strings/strrchr_basic.phpt create mode 100644 ext/standard/tests/strings/strrchr_error.phpt create mode 100644 ext/standard/tests/strings/strrchr_variation1.phpt create mode 100644 ext/standard/tests/strings/strrchr_variation10.phpt create mode 100644 ext/standard/tests/strings/strrchr_variation11.phpt create mode 100644 ext/standard/tests/strings/strrchr_variation12.phpt create mode 100644 ext/standard/tests/strings/strrchr_variation2.phpt create mode 100644 ext/standard/tests/strings/strrchr_variation3.phpt create mode 100644 ext/standard/tests/strings/strrchr_variation4.phpt create mode 100644 ext/standard/tests/strings/strrchr_variation5.phpt create mode 100644 ext/standard/tests/strings/strrchr_variation6.phpt create mode 100644 ext/standard/tests/strings/strrchr_variation7.phpt create mode 100644 ext/standard/tests/strings/strrchr_variation8.phpt create mode 100644 ext/standard/tests/strings/strrchr_variation9.phpt create mode 100644 ext/standard/tests/strings/strrev.phpt create mode 100644 ext/standard/tests/strings/strrev_basic.phpt create mode 100644 ext/standard/tests/strings/strrev_error.phpt create mode 100644 ext/standard/tests/strings/strrev_variation1.phpt create mode 100644 ext/standard/tests/strings/strrev_variation2.phpt create mode 100644 ext/standard/tests/strings/strrev_variation3.phpt create mode 100644 ext/standard/tests/strings/strrev_variation4.phpt create mode 100644 ext/standard/tests/strings/strripos.phpt create mode 100644 ext/standard/tests/strings/strripos_basic1.phpt create mode 100644 ext/standard/tests/strings/strripos_basic2.phpt create mode 100644 ext/standard/tests/strings/strripos_error.phpt create mode 100644 ext/standard/tests/strings/strripos_offset.phpt create mode 100644 ext/standard/tests/strings/strripos_variation1.phpt create mode 100644 ext/standard/tests/strings/strripos_variation2.phpt create mode 100644 ext/standard/tests/strings/strripos_variation3.phpt create mode 100644 ext/standard/tests/strings/strripos_variation4.phpt create mode 100644 ext/standard/tests/strings/strripos_variation5.phpt create mode 100644 ext/standard/tests/strings/strrpos.phpt create mode 100644 ext/standard/tests/strings/strrpos_basic1.phpt create mode 100644 ext/standard/tests/strings/strrpos_basic2.phpt create mode 100644 ext/standard/tests/strings/strrpos_error.phpt create mode 100644 ext/standard/tests/strings/strrpos_offset.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation1.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation10.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation11.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation12.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation13.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation14.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation15.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation2.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation3.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation4.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation5.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation6.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation7.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation8.phpt create mode 100644 ext/standard/tests/strings/strrpos_variation9.phpt create mode 100644 ext/standard/tests/strings/strspn.phpt create mode 100644 ext/standard/tests/strings/strspn_basic.phpt create mode 100644 ext/standard/tests/strings/strspn_error.phpt create mode 100644 ext/standard/tests/strings/strspn_variation1.phpt create mode 100644 ext/standard/tests/strings/strspn_variation10.phpt create mode 100644 ext/standard/tests/strings/strspn_variation11.phpt create mode 100644 ext/standard/tests/strings/strspn_variation12.phpt create mode 100644 ext/standard/tests/strings/strspn_variation2.phpt create mode 100644 ext/standard/tests/strings/strspn_variation3.phpt create mode 100644 ext/standard/tests/strings/strspn_variation4.phpt create mode 100644 ext/standard/tests/strings/strspn_variation5.phpt create mode 100644 ext/standard/tests/strings/strspn_variation6.phpt create mode 100644 ext/standard/tests/strings/strspn_variation7.phpt create mode 100644 ext/standard/tests/strings/strspn_variation8.phpt create mode 100644 ext/standard/tests/strings/strspn_variation9.phpt create mode 100644 ext/standard/tests/strings/strstr.phpt create mode 100644 ext/standard/tests/strings/strstr2.phpt create mode 100644 ext/standard/tests/strings/strtok_basic.phpt create mode 100644 ext/standard/tests/strings/strtok_error.phpt create mode 100644 ext/standard/tests/strings/strtok_variation1.phpt create mode 100644 ext/standard/tests/strings/strtok_variation2.phpt create mode 100644 ext/standard/tests/strings/strtok_variation3.phpt create mode 100644 ext/standard/tests/strings/strtok_variation4.phpt create mode 100644 ext/standard/tests/strings/strtok_variation5.phpt create mode 100644 ext/standard/tests/strings/strtok_variation6.phpt create mode 100644 ext/standard/tests/strings/strtok_variation7.phpt create mode 100644 ext/standard/tests/strings/strtolower-win32.phpt create mode 100644 ext/standard/tests/strings/strtolower.phpt create mode 100644 ext/standard/tests/strings/strtoupper.phpt create mode 100644 ext/standard/tests/strings/strtoupper1-win32.phpt create mode 100644 ext/standard/tests/strings/strtoupper1.phpt create mode 100644 ext/standard/tests/strings/strtr.phpt create mode 100644 ext/standard/tests/strings/strtr_basic.phpt create mode 100644 ext/standard/tests/strings/strtr_error.phpt create mode 100644 ext/standard/tests/strings/strtr_variation1.phpt create mode 100644 ext/standard/tests/strings/strtr_variation2.phpt create mode 100644 ext/standard/tests/strings/strtr_variation3.phpt create mode 100644 ext/standard/tests/strings/strtr_variation4.phpt create mode 100644 ext/standard/tests/strings/strtr_variation5.phpt create mode 100644 ext/standard/tests/strings/strtr_variation6.phpt create mode 100644 ext/standard/tests/strings/strtr_variation7.phpt create mode 100644 ext/standard/tests/strings/strtr_variation8.phpt create mode 100644 ext/standard/tests/strings/strtr_variation9.phpt create mode 100644 ext/standard/tests/strings/strval.phpt create mode 100644 ext/standard/tests/strings/strval_basic.phpt create mode 100644 ext/standard/tests/strings/strval_error.phpt create mode 100644 ext/standard/tests/strings/strval_variation1.phpt create mode 100644 ext/standard/tests/strings/strval_variation2.phpt create mode 100644 ext/standard/tests/strings/substr.phpt create mode 100644 ext/standard/tests/strings/substr_compare.phpt create mode 100644 ext/standard/tests/strings/substr_count_basic.phpt create mode 100644 ext/standard/tests/strings/substr_count_error.phpt create mode 100644 ext/standard/tests/strings/substr_count_variation_001.phpt create mode 100644 ext/standard/tests/strings/substr_count_variation_002.phpt create mode 100644 ext/standard/tests/strings/substr_replace.phpt create mode 100644 ext/standard/tests/strings/substr_replace_array.phpt create mode 100644 ext/standard/tests/strings/substr_replace_error.phpt create mode 100644 ext/standard/tests/strings/trim.phpt create mode 100644 ext/standard/tests/strings/trim1.phpt create mode 100644 ext/standard/tests/strings/trim_basic.phpt create mode 100644 ext/standard/tests/strings/trim_error.phpt create mode 100644 ext/standard/tests/strings/trim_variation1.phpt create mode 100644 ext/standard/tests/strings/trim_variation2.phpt create mode 100644 ext/standard/tests/strings/ucfirst.phpt create mode 100644 ext/standard/tests/strings/ucwords_basic.phpt create mode 100644 ext/standard/tests/strings/ucwords_error.phpt create mode 100644 ext/standard/tests/strings/ucwords_variation1.phpt create mode 100644 ext/standard/tests/strings/ucwords_variation2.phpt create mode 100644 ext/standard/tests/strings/ucwords_variation3.phpt create mode 100644 ext/standard/tests/strings/ucwords_variation4.phpt create mode 100644 ext/standard/tests/strings/unpack.phpt create mode 100644 ext/standard/tests/strings/unpack_error.phpt create mode 100644 ext/standard/tests/strings/url_t.phpt create mode 100644 ext/standard/tests/strings/uuencode.phpt create mode 100644 ext/standard/tests/strings/vfprintf_basic.phpt create mode 100644 ext/standard/tests/strings/vfprintf_basic1.phpt create mode 100644 ext/standard/tests/strings/vfprintf_basic2.phpt create mode 100644 ext/standard/tests/strings/vfprintf_basic3.phpt create mode 100644 ext/standard/tests/strings/vfprintf_basic4.phpt create mode 100644 ext/standard/tests/strings/vfprintf_basic5.phpt create mode 100644 ext/standard/tests/strings/vfprintf_basic6.phpt create mode 100644 ext/standard/tests/strings/vfprintf_basic7.phpt create mode 100644 ext/standard/tests/strings/vfprintf_basic7_64bit.phpt create mode 100644 ext/standard/tests/strings/vfprintf_basic8.phpt create mode 100644 ext/standard/tests/strings/vfprintf_basic9.phpt create mode 100644 ext/standard/tests/strings/vfprintf_error1.phpt create mode 100644 ext/standard/tests/strings/vfprintf_error2.phpt create mode 100644 ext/standard/tests/strings/vfprintf_error3.phpt create mode 100644 ext/standard/tests/strings/vfprintf_error4.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation1.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation10.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation11.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation11_64bit.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation12.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation12_64bit.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation13.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation13_64bit.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation14.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation14_64bit.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation15.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation15_64bit.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation16.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation16_64bit.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation17.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation18.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation19.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation19_64bit.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation20.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation21.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation3.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation4.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation4_64bit.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation5.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation6.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation7.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation8.phpt create mode 100644 ext/standard/tests/strings/vfprintf_variation9.phpt create mode 100644 ext/standard/tests/strings/vprintf_basic1.phpt create mode 100644 ext/standard/tests/strings/vprintf_basic2.phpt create mode 100644 ext/standard/tests/strings/vprintf_basic3.phpt create mode 100644 ext/standard/tests/strings/vprintf_basic4.phpt create mode 100644 ext/standard/tests/strings/vprintf_basic5.phpt create mode 100644 ext/standard/tests/strings/vprintf_basic6.phpt create mode 100644 ext/standard/tests/strings/vprintf_basic7.phpt create mode 100644 ext/standard/tests/strings/vprintf_basic7_64bit.phpt create mode 100644 ext/standard/tests/strings/vprintf_basic8.phpt create mode 100644 ext/standard/tests/strings/vprintf_basic9.phpt create mode 100644 ext/standard/tests/strings/vprintf_error.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation1.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation10.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation11.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation11_64bit.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation12.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation12_64bit.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation13.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation13_64bit.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation14.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation14_64bit.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation15.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation15_64bit.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation16.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation16_64bit.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation17.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation18.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation19.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation19_64bit.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation2.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation3.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation4.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation4_64bit.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation5.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation6.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation7.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation8.phpt create mode 100644 ext/standard/tests/strings/vprintf_variation9.phpt create mode 100644 ext/standard/tests/strings/vsprintf_basic1.phpt create mode 100644 ext/standard/tests/strings/vsprintf_basic2.phpt create mode 100644 ext/standard/tests/strings/vsprintf_basic3.phpt create mode 100644 ext/standard/tests/strings/vsprintf_basic4.phpt create mode 100644 ext/standard/tests/strings/vsprintf_basic5.phpt create mode 100644 ext/standard/tests/strings/vsprintf_basic6.phpt create mode 100644 ext/standard/tests/strings/vsprintf_basic7.phpt create mode 100644 ext/standard/tests/strings/vsprintf_basic7_64bit.phpt create mode 100644 ext/standard/tests/strings/vsprintf_basic8.phpt create mode 100644 ext/standard/tests/strings/vsprintf_basic9.phpt create mode 100644 ext/standard/tests/strings/vsprintf_error.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation1.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation10.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation11.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation11_64bit.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation12.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation12_64bit.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation13.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation13_64bit.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation14.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation14_64bit.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation15.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation15_64bit.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation16.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation16_64bit.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation17.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation18.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation19.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation19_64bit.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation2.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation3.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation4.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation4_64bit.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation5.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation6.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation7.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation8.phpt create mode 100644 ext/standard/tests/strings/vsprintf_variation9.phpt create mode 100644 ext/standard/tests/strings/wordwrap.phpt create mode 100644 ext/standard/tests/strings/wordwrap_basic.phpt create mode 100644 ext/standard/tests/strings/wordwrap_error.phpt create mode 100644 ext/standard/tests/strings/wordwrap_variation1.phpt create mode 100644 ext/standard/tests/strings/wordwrap_variation2.phpt create mode 100644 ext/standard/tests/strings/wordwrap_variation3.phpt create mode 100644 ext/standard/tests/strings/wordwrap_variation4.phpt create mode 100644 ext/standard/tests/strings/wordwrap_variation5.phpt create mode 100644 ext/standard/tests/time/001.phpt create mode 100644 ext/standard/tests/time/bug38524.phpt create mode 100644 ext/standard/tests/time/bug60222.phpt create mode 100644 ext/standard/tests/time/idate.phpt create mode 100644 ext/standard/tests/time/strptime_basic.phpt create mode 100644 ext/standard/tests/time/strptime_error.phpt create mode 100644 ext/standard/tests/time/strptime_parts.phpt create mode 100644 ext/standard/tests/url/base64_decode_basic_001.phpt create mode 100644 ext/standard/tests/url/base64_decode_basic_002.phpt create mode 100644 ext/standard/tests/url/base64_decode_error_001.phpt create mode 100644 ext/standard/tests/url/base64_decode_variation_001.phpt create mode 100644 ext/standard/tests/url/base64_decode_variation_002.phpt create mode 100644 ext/standard/tests/url/base64_encode_basic_001.phpt create mode 100644 ext/standard/tests/url/base64_encode_basic_002.phpt create mode 100644 ext/standard/tests/url/base64_encode_error_001.phpt create mode 100644 ext/standard/tests/url/base64_encode_variation_001.phpt create mode 100644 ext/standard/tests/url/bug47174.phpt create mode 100644 ext/standard/tests/url/bug52327.phpt create mode 100644 ext/standard/tests/url/bug53248.phpt create mode 100644 ext/standard/tests/url/bug54180.phpt create mode 100644 ext/standard/tests/url/bug55273.phpt create mode 100644 ext/standard/tests/url/bug55399.phpt create mode 100644 ext/standard/tests/url/bug63162.phpt create mode 100644 ext/standard/tests/url/get_headers_error_001.phpt create mode 100644 ext/standard/tests/url/get_headers_error_002.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_001.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_002.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_003.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_004.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_005.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_006.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_007.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_008.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_009.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_010.phpt create mode 100644 ext/standard/tests/url/parse_url_error_001.phpt create mode 100644 ext/standard/tests/url/parse_url_error_002.phpt create mode 100644 ext/standard/tests/url/parse_url_relative_scheme.phpt create mode 100644 ext/standard/tests/url/parse_url_variation_001.phpt create mode 100644 ext/standard/tests/url/parse_url_variation_002_32bit.phpt create mode 100644 ext/standard/tests/url/parse_url_variation_002_64bit.phpt create mode 100644 ext/standard/tests/url/rawurldecode_error_001.phpt create mode 100644 ext/standard/tests/url/rawurldecode_variation_001.phpt create mode 100644 ext/standard/tests/url/rawurlencode_error_001.phpt create mode 100644 ext/standard/tests/url/rawurlencode_variation_001.phpt create mode 100644 ext/standard/tests/url/urldecode_error_001.phpt create mode 100644 ext/standard/tests/url/urldecode_variation_001.phpt create mode 100644 ext/standard/tests/url/urlencode_error_001.phpt create mode 100644 ext/standard/tests/url/urlencode_variation_001.phpt create mode 100644 ext/standard/tests/url/urls.inc create mode 100644 ext/standard/tests/versioning/php_sapi_name.phpt create mode 100644 ext/standard/tests/versioning/php_sapi_name_variation001.phpt create mode 100644 ext/standard/tests/versioning/version_compare.phpt create mode 100644 ext/standard/tests/zend_logo_guid.phpt create mode 100644 ext/standard/type.c create mode 100644 ext/standard/uniqid.c create mode 100644 ext/standard/uniqid.h create mode 100644 ext/standard/url.c create mode 100644 ext/standard/url.h create mode 100644 ext/standard/url_scanner_ex.c create mode 100644 ext/standard/url_scanner_ex.h create mode 100644 ext/standard/url_scanner_ex.re create mode 100644 ext/standard/user_filters.c create mode 100644 ext/standard/uuencode.c create mode 100644 ext/standard/var.c create mode 100644 ext/standard/var_unserializer.c create mode 100644 ext/standard/var_unserializer.re create mode 100644 ext/standard/versioning.c create mode 100644 ext/standard/winver.h (limited to 'ext/standard') diff --git a/ext/standard/Makefile.frag b/ext/standard/Makefile.frag new file mode 100644 index 0000000..4e94962 --- /dev/null +++ b/ext/standard/Makefile.frag @@ -0,0 +1,10 @@ + +$(srcdir)/var_unserializer.c: $(srcdir)/var_unserializer.re + @(cd $(top_srcdir); $(RE2C) -b -o ext/standard/var_unserializer.c ext/standard/var_unserializer.re) + +$(srcdir)/url_scanner_ex.c: $(srcdir)/url_scanner_ex.re + @(cd $(top_srcdir); $(RE2C) -b -o ext/standard/url_scanner_ex.c ext/standard/url_scanner_ex.re) + +$(builddir)/info.lo: $(builddir)/../../main/build-defs.h + +$(builddir)/basic_functions.lo: $(top_srcdir)/Zend/zend_language_parser.h diff --git a/ext/standard/array.c b/ext/standard/array.c new file mode 100644 index 0000000..40a27c0 --- /dev/null +++ b/ext/standard/array.c @@ -0,0 +1,4543 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Andi Gutmans | + | Zeev Suraski | + | Rasmus Lerdorf | + | Andrei Zmievski | + | Stig Venaas | + | Jason Greene | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "php_ini.h" +#include +#include +#include +#include +#include +#if HAVE_STRING_H +#include +#else +#include +#endif +#ifdef PHP_WIN32 +#include "win32/unistd.h" +#endif +#include "zend_globals.h" +#include "zend_interfaces.h" +#include "php_globals.h" +#include "php_array.h" +#include "basic_functions.h" +#include "php_string.h" +#include "php_rand.h" +#include "php_smart_str.h" +#ifdef HAVE_SPL +#include "ext/spl/spl_array.h" +#endif + +/* {{{ defines */ +#define EXTR_OVERWRITE 0 +#define EXTR_SKIP 1 +#define EXTR_PREFIX_SAME 2 +#define EXTR_PREFIX_ALL 3 +#define EXTR_PREFIX_INVALID 4 +#define EXTR_PREFIX_IF_EXISTS 5 +#define EXTR_IF_EXISTS 6 + +#define EXTR_REFS 0x100 + +#define CASE_LOWER 0 +#define CASE_UPPER 1 + +#define COUNT_NORMAL 0 +#define COUNT_RECURSIVE 1 + +#define DIFF_NORMAL 1 +#define DIFF_KEY 2 +#define DIFF_ASSOC 6 +#define DIFF_COMP_DATA_NONE -1 +#define DIFF_COMP_DATA_INTERNAL 0 +#define DIFF_COMP_DATA_USER 1 +#define DIFF_COMP_KEY_INTERNAL 0 +#define DIFF_COMP_KEY_USER 1 + +#define INTERSECT_NORMAL 1 +#define INTERSECT_KEY 2 +#define INTERSECT_ASSOC 6 +#define INTERSECT_COMP_DATA_NONE -1 +#define INTERSECT_COMP_DATA_INTERNAL 0 +#define INTERSECT_COMP_DATA_USER 1 +#define INTERSECT_COMP_KEY_INTERNAL 0 +#define INTERSECT_COMP_KEY_USER 1 + +#define DOUBLE_DRIFT_FIX 0.000000000000001 +/* }}} */ + +ZEND_DECLARE_MODULE_GLOBALS(array) + +/* {{{ php_array_init_globals +*/ +static void php_array_init_globals(zend_array_globals *array_globals) +{ + memset(array_globals, 0, sizeof(zend_array_globals)); +} +/* }}} */ + +PHP_MINIT_FUNCTION(array) /* {{{ */ +{ + ZEND_INIT_MODULE_GLOBALS(array, php_array_init_globals, NULL); + + REGISTER_LONG_CONSTANT("EXTR_OVERWRITE", EXTR_OVERWRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_SKIP", EXTR_SKIP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_PREFIX_SAME", EXTR_PREFIX_SAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_PREFIX_ALL", EXTR_PREFIX_ALL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_PREFIX_INVALID", EXTR_PREFIX_INVALID, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_PREFIX_IF_EXISTS", EXTR_PREFIX_IF_EXISTS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_IF_EXISTS", EXTR_IF_EXISTS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_REFS", EXTR_REFS, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SORT_ASC", PHP_SORT_ASC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SORT_DESC", PHP_SORT_DESC, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SORT_REGULAR", PHP_SORT_REGULAR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SORT_NUMERIC", PHP_SORT_NUMERIC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SORT_STRING", PHP_SORT_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SORT_LOCALE_STRING", PHP_SORT_LOCALE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SORT_NATURAL", PHP_SORT_NATURAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SORT_FLAG_CASE", PHP_SORT_FLAG_CASE, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("CASE_LOWER", CASE_LOWER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CASE_UPPER", CASE_UPPER, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("COUNT_NORMAL", COUNT_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("COUNT_RECURSIVE", COUNT_RECURSIVE, CONST_CS | CONST_PERSISTENT); + + return SUCCESS; +} +/* }}} */ + +PHP_MSHUTDOWN_FUNCTION(array) /* {{{ */ +{ +#ifdef ZTS + ts_free_id(array_globals_id); +#endif + + return SUCCESS; +} +/* }}} */ + +static void php_set_compare_func(int sort_type TSRMLS_DC) /* {{{ */ +{ + switch (sort_type & ~PHP_SORT_FLAG_CASE) { + case PHP_SORT_NUMERIC: + ARRAYG(compare_func) = numeric_compare_function; + break; + + case PHP_SORT_STRING: + ARRAYG(compare_func) = sort_type & PHP_SORT_FLAG_CASE ? string_case_compare_function : string_compare_function; + break; + + case PHP_SORT_NATURAL: + ARRAYG(compare_func) = sort_type & PHP_SORT_FLAG_CASE ? string_natural_case_compare_function : string_natural_compare_function; + break; + +#if HAVE_STRCOLL + case PHP_SORT_LOCALE_STRING: + ARRAYG(compare_func) = string_locale_compare_function; + break; +#endif + + case PHP_SORT_REGULAR: + default: + ARRAYG(compare_func) = compare_function; + break; + } +} +/* }}} */ + +static int php_array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ +{ + Bucket *f; + Bucket *s; + zval result; + zval first; + zval second; + + f = *((Bucket **) a); + s = *((Bucket **) b); + + if (f->nKeyLength == 0) { + Z_TYPE(first) = IS_LONG; + Z_LVAL(first) = f->h; + } else { + Z_TYPE(first) = IS_STRING; + Z_STRVAL(first) = (char*)f->arKey; + Z_STRLEN(first) = f->nKeyLength - 1; + } + + if (s->nKeyLength == 0) { + Z_TYPE(second) = IS_LONG; + Z_LVAL(second) = s->h; + } else { + Z_TYPE(second) = IS_STRING; + Z_STRVAL(second) = (char*)s->arKey; + Z_STRLEN(second) = s->nKeyLength - 1; + } + + if (ARRAYG(compare_func)(&result, &first, &second TSRMLS_CC) == FAILURE) { + return 0; + } + + if (Z_TYPE(result) == IS_DOUBLE) { + if (Z_DVAL(result) < 0) { + return -1; + } else if (Z_DVAL(result) > 0) { + return 1; + } else { + return 0; + } + } + + convert_to_long(&result); + + if (Z_LVAL(result) < 0) { + return -1; + } else if (Z_LVAL(result) > 0) { + return 1; + } + + return 0; +} +/* }}} */ + +static int php_array_reverse_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ +{ + return php_array_key_compare(a, b TSRMLS_CC) * -1; +} +/* }}} */ + +/* {{{ proto bool krsort(array &array_arg [, int sort_flags]) + Sort an array by key value in reverse order */ +PHP_FUNCTION(krsort) +{ + zval *array; + long sort_type = PHP_SORT_REGULAR; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) { + RETURN_FALSE; + } + + php_set_compare_func(sort_type TSRMLS_CC); + + if (zend_hash_sort(Z_ARRVAL_P(array), zend_qsort, php_array_reverse_key_compare, 0 TSRMLS_CC) == FAILURE) { + RETURN_FALSE; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ksort(array &array_arg [, int sort_flags]) + Sort an array by key */ +PHP_FUNCTION(ksort) +{ + zval *array; + long sort_type = PHP_SORT_REGULAR; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) { + RETURN_FALSE; + } + + php_set_compare_func(sort_type TSRMLS_CC); + + if (zend_hash_sort(Z_ARRVAL_P(array), zend_qsort, php_array_key_compare, 0 TSRMLS_CC) == FAILURE) { + RETURN_FALSE; + } + RETURN_TRUE; +} +/* }}} */ + +static int php_count_recursive(zval *array, long mode TSRMLS_DC) /* {{{ */ +{ + long cnt = 0; + zval **element; + + if (Z_TYPE_P(array) == IS_ARRAY) { + if (Z_ARRVAL_P(array)->nApplyCount > 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); + return 0; + } + + cnt = zend_hash_num_elements(Z_ARRVAL_P(array)); + if (mode == COUNT_RECURSIVE) { + HashPosition pos; + + for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos); + zend_hash_get_current_data_ex(Z_ARRVAL_P(array), (void **) &element, &pos) == SUCCESS; + zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos) + ) { + Z_ARRVAL_P(array)->nApplyCount++; + cnt += php_count_recursive(*element, COUNT_RECURSIVE TSRMLS_CC); + Z_ARRVAL_P(array)->nApplyCount--; + } + } + } + + return cnt; +} +/* }}} */ + +/* {{{ proto int count(mixed var [, int mode]) + Count the number of elements in a variable (usually an array) */ +PHP_FUNCTION(count) +{ + zval *array; + long mode = COUNT_NORMAL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &array, &mode) == FAILURE) { + return; + } + + switch (Z_TYPE_P(array)) { + case IS_NULL: + RETURN_LONG(0); + break; + case IS_ARRAY: + RETURN_LONG (php_count_recursive (array, mode TSRMLS_CC)); + break; + case IS_OBJECT: { +#ifdef HAVE_SPL + zval *retval; +#endif + /* first, we check if the handler is defined */ + if (Z_OBJ_HT_P(array)->count_elements) { + RETVAL_LONG(1); + if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_LVAL_P(return_value) TSRMLS_CC)) { + return; + } + } +#ifdef HAVE_SPL + /* if not and the object implements Countable we call its count() method */ + if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) { + zend_call_method_with_0_params(&array, NULL, NULL, "count", &retval); + if (retval) { + convert_to_long_ex(&retval); + RETVAL_LONG(Z_LVAL_P(retval)); + zval_ptr_dtor(&retval); + } + return; + } +#endif + } + default: + RETURN_LONG(1); + break; + } +} +/* }}} */ + +/* Numbers are always smaller than strings int this function as it + * anyway doesn't make much sense to compare two different data types. + * This keeps it consistant and simple. + * + * This is not correct any more, depends on what compare_func is set to. + */ +static int php_array_data_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ +{ + Bucket *f; + Bucket *s; + zval result; + zval *first; + zval *second; + + f = *((Bucket **) a); + s = *((Bucket **) b); + + first = *((zval **) f->pData); + second = *((zval **) s->pData); + + if (ARRAYG(compare_func)(&result, first, second TSRMLS_CC) == FAILURE) { + return 0; + } + + if (Z_TYPE(result) == IS_DOUBLE) { + if (Z_DVAL(result) < 0) { + return -1; + } else if (Z_DVAL(result) > 0) { + return 1; + } else { + return 0; + } + } + + convert_to_long(&result); + + if (Z_LVAL(result) < 0) { + return -1; + } else if (Z_LVAL(result) > 0) { + return 1; + } + + return 0; +} +/* }}} */ + +static int php_array_reverse_data_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ +{ + return php_array_data_compare(a, b TSRMLS_CC) * -1; +} +/* }}} */ + +static int php_array_natural_general_compare(const void *a, const void *b, int fold_case) /* {{{ */ +{ + Bucket *f, *s; + zval *fval, *sval; + zval first, second; + int result; + + f = *((Bucket **) a); + s = *((Bucket **) b); + + fval = *((zval **) f->pData); + sval = *((zval **) s->pData); + first = *fval; + second = *sval; + + if (Z_TYPE_P(fval) != IS_STRING) { + zval_copy_ctor(&first); + convert_to_string(&first); + } + + if (Z_TYPE_P(sval) != IS_STRING) { + zval_copy_ctor(&second); + convert_to_string(&second); + } + + result = strnatcmp_ex(Z_STRVAL(first), Z_STRLEN(first), Z_STRVAL(second), Z_STRLEN(second), fold_case); + + if (Z_TYPE_P(fval) != IS_STRING) { + zval_dtor(&first); + } + + if (Z_TYPE_P(sval) != IS_STRING) { + zval_dtor(&second); + } + + return result; +} +/* }}} */ + +static int php_array_natural_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ +{ + return php_array_natural_general_compare(a, b, 0); +} +/* }}} */ + +static int php_array_natural_case_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ +{ + return php_array_natural_general_compare(a, b, 1); +} +/* }}} */ + +static void php_natsort(INTERNAL_FUNCTION_PARAMETERS, int fold_case) /* {{{ */ +{ + zval *array; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) { + return; + } + + if (fold_case) { + if (zend_hash_sort(Z_ARRVAL_P(array), zend_qsort, php_array_natural_case_compare, 0 TSRMLS_CC) == FAILURE) { + return; + } + } else { + if (zend_hash_sort(Z_ARRVAL_P(array), zend_qsort, php_array_natural_compare, 0 TSRMLS_CC) == FAILURE) { + return; + } + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto void natsort(array &array_arg) + Sort an array using natural sort */ +PHP_FUNCTION(natsort) +{ + php_natsort(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* {{{ proto void natcasesort(array &array_arg) + Sort an array using case-insensitive natural sort */ +PHP_FUNCTION(natcasesort) +{ + php_natsort(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +/* {{{ proto bool asort(array &array_arg [, int sort_flags]) + Sort an array and maintain index association */ +PHP_FUNCTION(asort) +{ + zval *array; + long sort_type = PHP_SORT_REGULAR; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) { + RETURN_FALSE; + } + + php_set_compare_func(sort_type TSRMLS_CC); + + if (zend_hash_sort(Z_ARRVAL_P(array), zend_qsort, php_array_data_compare, 0 TSRMLS_CC) == FAILURE) { + RETURN_FALSE; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool arsort(array &array_arg [, int sort_flags]) + Sort an array in reverse order and maintain index association */ +PHP_FUNCTION(arsort) +{ + zval *array; + long sort_type = PHP_SORT_REGULAR; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) { + RETURN_FALSE; + } + + php_set_compare_func(sort_type TSRMLS_CC); + + if (zend_hash_sort(Z_ARRVAL_P(array), zend_qsort, php_array_reverse_data_compare, 0 TSRMLS_CC) == FAILURE) { + RETURN_FALSE; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool sort(array &array_arg [, int sort_flags]) + Sort an array */ +PHP_FUNCTION(sort) +{ + zval *array; + long sort_type = PHP_SORT_REGULAR; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) { + RETURN_FALSE; + } + + php_set_compare_func(sort_type TSRMLS_CC); + + if (zend_hash_sort(Z_ARRVAL_P(array), zend_qsort, php_array_data_compare, 1 TSRMLS_CC) == FAILURE) { + RETURN_FALSE; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool rsort(array &array_arg [, int sort_flags]) + Sort an array in reverse order */ +PHP_FUNCTION(rsort) +{ + zval *array; + long sort_type = PHP_SORT_REGULAR; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) { + RETURN_FALSE; + } + + php_set_compare_func(sort_type TSRMLS_CC); + + if (zend_hash_sort(Z_ARRVAL_P(array), zend_qsort, php_array_reverse_data_compare, 1 TSRMLS_CC) == FAILURE) { + RETURN_FALSE; + } + RETURN_TRUE; +} +/* }}} */ + +static int php_array_user_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ +{ + Bucket *f; + Bucket *s; + zval **args[2]; + zval *retval_ptr = NULL; + + f = *((Bucket **) a); + s = *((Bucket **) b); + + args[0] = (zval **) f->pData; + args[1] = (zval **) s->pData; + + BG(user_compare_fci).param_count = 2; + BG(user_compare_fci).params = args; + BG(user_compare_fci).retval_ptr_ptr = &retval_ptr; + BG(user_compare_fci).no_separation = 0; + if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache) TSRMLS_CC) == SUCCESS && retval_ptr) { + long retval; + + convert_to_long_ex(&retval_ptr); + retval = Z_LVAL_P(retval_ptr); + zval_ptr_dtor(&retval_ptr); + return retval < 0 ? -1 : retval > 0 ? 1 : 0; + } else { + return 0; + } +} +/* }}} */ + +/* check if comparison function is valid */ +#define PHP_ARRAY_CMP_FUNC_CHECK(func_name) \ + if (!zend_is_callable(*func_name, 0, NULL TSRMLS_CC)) { \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid comparison function"); \ + BG(user_compare_fci) = old_user_compare_fci; \ + BG(user_compare_fci_cache) = old_user_compare_fci_cache; \ + RETURN_FALSE; \ + } \ + + /* Clear FCI cache otherwise : for example the same or other array with + * (partly) the same key values has been sorted with uasort() or + * other sorting function the comparison is cached, however the name + * of the function for comparison is not respected. see bug #28739 AND #33295 + * + * Following defines will assist in backup / restore values. */ + +#define PHP_ARRAY_CMP_FUNC_VARS \ + zend_fcall_info old_user_compare_fci; \ + zend_fcall_info_cache old_user_compare_fci_cache \ + +#define PHP_ARRAY_CMP_FUNC_BACKUP() \ + old_user_compare_fci = BG(user_compare_fci); \ + old_user_compare_fci_cache = BG(user_compare_fci_cache); \ + BG(user_compare_fci_cache) = empty_fcall_info_cache; \ + +#define PHP_ARRAY_CMP_FUNC_RESTORE() \ + BG(user_compare_fci) = old_user_compare_fci; \ + BG(user_compare_fci_cache) = old_user_compare_fci_cache; \ + +/* {{{ proto bool usort(array array_arg, string cmp_function) + Sort an array by values using a user-defined comparison function */ +PHP_FUNCTION(usort) +{ + zval *array; + unsigned int refcount; + PHP_ARRAY_CMP_FUNC_VARS; + + PHP_ARRAY_CMP_FUNC_BACKUP(); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "af", &array, &BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE) { + PHP_ARRAY_CMP_FUNC_RESTORE(); + return; + } + + /* Clear the is_ref flag, so the attemts to modify the array in user + * comparison function will create a copy of array and won't affect the + * original array. The fact of modification is detected using refcount + * comparison. The result of sorting in such case is undefined and the + * function returns FALSE. + */ + Z_UNSET_ISREF_P(array); + refcount = Z_REFCOUNT_P(array); + + if (zend_hash_sort(Z_ARRVAL_P(array), zend_qsort, php_array_user_compare, 1 TSRMLS_CC) == FAILURE) { + RETVAL_FALSE; + } else { + if (refcount > Z_REFCOUNT_P(array)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array was modified by the user comparison function"); + RETVAL_FALSE; + } else { + RETVAL_TRUE; + } + } + + if (Z_REFCOUNT_P(array) > 1) { + Z_SET_ISREF_P(array); + } + + PHP_ARRAY_CMP_FUNC_RESTORE(); +} +/* }}} */ + +/* {{{ proto bool uasort(array array_arg, string cmp_function) + Sort an array with a user-defined comparison function and maintain index association */ +PHP_FUNCTION(uasort) +{ + zval *array; + unsigned int refcount; + PHP_ARRAY_CMP_FUNC_VARS; + + PHP_ARRAY_CMP_FUNC_BACKUP(); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "af", &array, &BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE) { + PHP_ARRAY_CMP_FUNC_RESTORE(); + return; + } + + /* Clear the is_ref flag, so the attemts to modify the array in user + * comaprison function will create a copy of array and won't affect the + * original array. The fact of modification is detected using refcount + * comparison. The result of sorting in such case is undefined and the + * function returns FALSE. + */ + Z_UNSET_ISREF_P(array); + refcount = Z_REFCOUNT_P(array); + + if (zend_hash_sort(Z_ARRVAL_P(array), zend_qsort, php_array_user_compare, 0 TSRMLS_CC) == FAILURE) { + RETVAL_FALSE; + } else { + if (refcount > Z_REFCOUNT_P(array)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array was modified by the user comparison function"); + RETVAL_FALSE; + } else { + RETVAL_TRUE; + } + } + + if (Z_REFCOUNT_P(array) > 1) { + Z_SET_ISREF_P(array); + } + + PHP_ARRAY_CMP_FUNC_RESTORE(); +} +/* }}} */ + +static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ +{ + Bucket *f; + Bucket *s; + zval *key1, *key2; + zval **args[2]; + zval *retval_ptr = NULL; + long result; + + ALLOC_INIT_ZVAL(key1); + ALLOC_INIT_ZVAL(key2); + args[0] = &key1; + args[1] = &key2; + + f = *((Bucket **) a); + s = *((Bucket **) b); + + if (f->nKeyLength == 0) { + Z_LVAL_P(key1) = f->h; + Z_TYPE_P(key1) = IS_LONG; + } else { + Z_STRVAL_P(key1) = estrndup(f->arKey, f->nKeyLength - 1); + Z_STRLEN_P(key1) = f->nKeyLength - 1; + Z_TYPE_P(key1) = IS_STRING; + } + if (s->nKeyLength == 0) { + Z_LVAL_P(key2) = s->h; + Z_TYPE_P(key2) = IS_LONG; + } else { + Z_STRVAL_P(key2) = estrndup(s->arKey, s->nKeyLength - 1); + Z_STRLEN_P(key2) = s->nKeyLength - 1; + Z_TYPE_P(key2) = IS_STRING; + } + + BG(user_compare_fci).param_count = 2; + BG(user_compare_fci).params = args; + BG(user_compare_fci).retval_ptr_ptr = &retval_ptr; + BG(user_compare_fci).no_separation = 0; + if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache) TSRMLS_CC) == SUCCESS && retval_ptr) { + convert_to_long_ex(&retval_ptr); + result = Z_LVAL_P(retval_ptr); + zval_ptr_dtor(&retval_ptr); + } else { + result = 0; + } + + zval_ptr_dtor(&key1); + zval_ptr_dtor(&key2); + + return result; +} +/* }}} */ + +/* {{{ proto bool uksort(array array_arg, string cmp_function) + Sort an array by keys using a user-defined comparison function */ +PHP_FUNCTION(uksort) +{ + zval *array; + unsigned int refcount; + PHP_ARRAY_CMP_FUNC_VARS; + + PHP_ARRAY_CMP_FUNC_BACKUP(); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "af", &array, &BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE) { + PHP_ARRAY_CMP_FUNC_RESTORE(); + return; + } + + /* Clear the is_ref flag, so the attemts to modify the array in user + * comaprison function will create a copy of array and won't affect the + * original array. The fact of modification is detected using refcount + * comparison. The result of sorting in such case is undefined and the + * function returns FALSE. + */ + Z_UNSET_ISREF_P(array); + refcount = Z_REFCOUNT_P(array); + + if (zend_hash_sort(Z_ARRVAL_P(array), zend_qsort, php_array_user_key_compare, 0 TSRMLS_CC) == FAILURE) { + RETVAL_FALSE; + } else { + if (refcount > Z_REFCOUNT_P(array)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array was modified by the user comparison function"); + RETVAL_FALSE; + } else { + RETVAL_TRUE; + } + } + + if (Z_REFCOUNT_P(array) > 1) { + Z_SET_ISREF_P(array); + } + + PHP_ARRAY_CMP_FUNC_RESTORE(); +} +/* }}} */ + +/* {{{ proto mixed end(array array_arg) + Advances array argument's internal pointer to the last element and return it */ +PHP_FUNCTION(end) +{ + HashTable *array; + zval **entry; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &array) == FAILURE) { + return; + } + + zend_hash_internal_pointer_end(array); + + if (return_value_used) { + if (zend_hash_get_current_data(array, (void **) &entry) == FAILURE) { + RETURN_FALSE; + } + + RETURN_ZVAL(*entry, 1, 0); + } +} +/* }}} */ + +/* {{{ proto mixed prev(array array_arg) + Move array argument's internal pointer to the previous element and return it */ +PHP_FUNCTION(prev) +{ + HashTable *array; + zval **entry; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &array) == FAILURE) { + return; + } + + zend_hash_move_backwards(array); + + if (return_value_used) { + if (zend_hash_get_current_data(array, (void **) &entry) == FAILURE) { + RETURN_FALSE; + } + + RETURN_ZVAL(*entry, 1, 0); + } +} +/* }}} */ + +/* {{{ proto mixed next(array array_arg) + Move array argument's internal pointer to the next element and return it */ +PHP_FUNCTION(next) +{ + HashTable *array; + zval **entry; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &array) == FAILURE) { + return; + } + + zend_hash_move_forward(array); + + if (return_value_used) { + if (zend_hash_get_current_data(array, (void **) &entry) == FAILURE) { + RETURN_FALSE; + } + + RETURN_ZVAL(*entry, 1, 0); + } +} +/* }}} */ + +/* {{{ proto mixed reset(array array_arg) + Set array argument's internal pointer to the first element and return it */ +PHP_FUNCTION(reset) +{ + HashTable *array; + zval **entry; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &array) == FAILURE) { + return; + } + + zend_hash_internal_pointer_reset(array); + + if (return_value_used) { + if (zend_hash_get_current_data(array, (void **) &entry) == FAILURE) { + RETURN_FALSE; + } + + RETURN_ZVAL(*entry, 1, 0); + } +} +/* }}} */ + +/* {{{ proto mixed current(array array_arg) + Return the element currently pointed to by the internal array pointer */ +PHP_FUNCTION(current) +{ + HashTable *array; + zval **entry; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &array) == FAILURE) { + return; + } + + if (zend_hash_get_current_data(array, (void **) &entry) == FAILURE) { + RETURN_FALSE; + } + RETURN_ZVAL(*entry, 1, 0); +} +/* }}} */ + +/* {{{ proto mixed key(array array_arg) + Return the key of the element currently pointed to by the internal array pointer */ +PHP_FUNCTION(key) +{ + HashTable *array; + char *string_key; + uint string_length; + ulong num_key; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &array) == FAILURE) { + return; + } + + switch (zend_hash_get_current_key_ex(array, &string_key, &string_length, &num_key, 0, NULL)) { + case HASH_KEY_IS_STRING: + RETVAL_STRINGL(string_key, string_length - 1, 1); + break; + case HASH_KEY_IS_LONG: + RETVAL_LONG(num_key); + break; + case HASH_KEY_NON_EXISTANT: + return; + } +} +/* }}} */ + +/* {{{ proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]]) + Return the lowest value in an array or a series of arguments */ +PHP_FUNCTION(min) +{ + int argc; + zval ***args = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) { + return; + } + + php_set_compare_func(PHP_SORT_REGULAR TSRMLS_CC); + + /* mixed min ( array $values ) */ + if (argc == 1) { + zval **result; + + if (Z_TYPE_PP(args[0]) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "When only one parameter is given, it must be an array"); + RETVAL_NULL(); + } else { + if (zend_hash_minmax(Z_ARRVAL_PP(args[0]), php_array_data_compare, 0, (void **) &result TSRMLS_CC) == SUCCESS) { + RETVAL_ZVAL(*result, 1, 0); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain at least one element"); + RETVAL_FALSE; + } + } + } else { + /* mixed min ( mixed $value1 , mixed $value2 [, mixed $value3... ] ) */ + zval **min, result; + int i; + + min = args[0]; + + for (i = 1; i < argc; i++) { + is_smaller_function(&result, *args[i], *min TSRMLS_CC); + if (Z_LVAL(result) == 1) { + min = args[i]; + } + } + + RETVAL_ZVAL(*min, 1, 0); + } + + if (args) { + efree(args); + } +} +/* }}} */ + +/* {{{ proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]]) + Return the highest value in an array or a series of arguments */ +PHP_FUNCTION(max) +{ + zval ***args = NULL; + int argc; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) { + return; + } + + php_set_compare_func(PHP_SORT_REGULAR TSRMLS_CC); + + /* mixed max ( array $values ) */ + if (argc == 1) { + zval **result; + + if (Z_TYPE_PP(args[0]) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "When only one parameter is given, it must be an array"); + RETVAL_NULL(); + } else { + if (zend_hash_minmax(Z_ARRVAL_PP(args[0]), php_array_data_compare, 1, (void **) &result TSRMLS_CC) == SUCCESS) { + RETVAL_ZVAL(*result, 1, 0); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain at least one element"); + RETVAL_FALSE; + } + } + } else { + /* mixed max ( mixed $value1 , mixed $value2 [, mixed $value3... ] ) */ + zval **max, result; + int i; + + max = args[0]; + + for (i = 1; i < argc; i++) { + is_smaller_or_equal_function(&result, *args[i], *max TSRMLS_CC); + if (Z_LVAL(result) == 0) { + max = args[i]; + } + } + + RETVAL_ZVAL(*max, 1, 0); + } + + if (args) { + efree(args); + } +} +/* }}} */ + +static int php_array_walk(HashTable *target_hash, zval *userdata, int recursive TSRMLS_DC) /* {{{ */ +{ + zval **args[3], /* Arguments to userland function */ + *retval_ptr, /* Return value - unused */ + *key=NULL; /* Entry key */ + char *string_key; + uint string_key_len; + ulong num_key; + + /* Set up known arguments */ + args[1] = &key; + args[2] = &userdata; + if (userdata) { + Z_ADDREF_P(userdata); + } + + BG(array_walk_fci).retval_ptr_ptr = &retval_ptr; + BG(array_walk_fci).param_count = userdata ? 3 : 2; + BG(array_walk_fci).params = args; + BG(array_walk_fci).no_separation = 0; + + /* Iterate through hash */ + zend_hash_internal_pointer_reset(target_hash); + while (!EG(exception) && zend_hash_get_current_data(target_hash, (void **)&args[0]) == SUCCESS) { + if (recursive && Z_TYPE_PP(args[0]) == IS_ARRAY) { + HashTable *thash; + zend_fcall_info orig_array_walk_fci; + zend_fcall_info_cache orig_array_walk_fci_cache; + + SEPARATE_ZVAL_IF_NOT_REF(args[0]); + thash = Z_ARRVAL_PP(args[0]); + if (thash->nApplyCount > 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); + if (userdata) { + zval_ptr_dtor(&userdata); + } + return 0; + } + + /* backup the fcall info and cache */ + orig_array_walk_fci = BG(array_walk_fci); + orig_array_walk_fci_cache = BG(array_walk_fci_cache); + + thash->nApplyCount++; + php_array_walk(thash, userdata, recursive TSRMLS_CC); + thash->nApplyCount--; + + /* restore the fcall info and cache */ + BG(array_walk_fci) = orig_array_walk_fci; + BG(array_walk_fci_cache) = orig_array_walk_fci_cache; + } else { + /* Allocate space for key */ + MAKE_STD_ZVAL(key); + + /* Set up the key */ + switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_key_len, &num_key, 0, NULL)) { + case HASH_KEY_IS_LONG: + Z_TYPE_P(key) = IS_LONG; + Z_LVAL_P(key) = num_key; + break; + case HASH_KEY_IS_STRING: + ZVAL_STRINGL(key, string_key, string_key_len - 1, 1); + break; + } + + /* Call the userland function */ + if (zend_call_function(&BG(array_walk_fci), &BG(array_walk_fci_cache) TSRMLS_CC) == SUCCESS) { + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + } else { + if (key) { + zval_ptr_dtor(&key); + key = NULL; + } + break; + } + } + + if (key) { + zval_ptr_dtor(&key); + key = NULL; + } + zend_hash_move_forward(target_hash); + } + + if (userdata) { + zval_ptr_dtor(&userdata); + } + return 0; +} +/* }}} */ + +/* {{{ proto bool array_walk(array input, string funcname [, mixed userdata]) + Apply a user function to every member of an array */ +PHP_FUNCTION(array_walk) +{ + HashTable *array; + zval *userdata = NULL; + zend_fcall_info orig_array_walk_fci; + zend_fcall_info_cache orig_array_walk_fci_cache; + + 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() TSRMLS_CC, "Hf|z/", &array, &BG(array_walk_fci), &BG(array_walk_fci_cache), &userdata) == FAILURE) { + BG(array_walk_fci) = orig_array_walk_fci; + BG(array_walk_fci_cache) = orig_array_walk_fci_cache; + return; + } + + php_array_walk(array, userdata, 0 TSRMLS_CC); + BG(array_walk_fci) = orig_array_walk_fci; + BG(array_walk_fci_cache) = orig_array_walk_fci_cache; + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool array_walk_recursive(array input, string funcname [, mixed userdata]) + Apply a user function recursively to every member of an array */ +PHP_FUNCTION(array_walk_recursive) +{ + HashTable *array; + zval *userdata = NULL; + zend_fcall_info orig_array_walk_fci; + zend_fcall_info_cache orig_array_walk_fci_cache; + + 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() TSRMLS_CC, "Hf|z/", &array, &BG(array_walk_fci), &BG(array_walk_fci_cache), &userdata) == FAILURE) { + BG(array_walk_fci) = orig_array_walk_fci; + BG(array_walk_fci_cache) = orig_array_walk_fci_cache; + return; + } + + php_array_walk(array, userdata, 1 TSRMLS_CC); + BG(array_walk_fci) = orig_array_walk_fci; + BG(array_walk_fci_cache) = orig_array_walk_fci_cache; + RETURN_TRUE; +} +/* }}} */ + +/* void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) + * 0 = return boolean + * 1 = return key + */ +static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ */ +{ + zval *value, /* value to check for */ + *array, /* array to check in */ + **entry, /* pointer to array entry */ + res; /* comparison result */ + HashPosition pos; /* hash iterator */ + zend_bool strict = 0; /* strict comparison or not */ + ulong num_key; + uint str_key_len; + char *string_key; + int (*is_equal_func)(zval *, zval *, zval * TSRMLS_DC) = is_equal_function; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "za|b", &value, &array, &strict) == FAILURE) { + return; + } + + if (strict) { + is_equal_func = is_identical_function; + } + + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(array), (void **)&entry, &pos) == SUCCESS) { + is_equal_func(&res, value, *entry TSRMLS_CC); + if (Z_LVAL(res)) { + if (behavior == 0) { + RETURN_TRUE; + } else { + /* Return current key */ + switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(array), &string_key, &str_key_len, &num_key, 0, &pos)) { + case HASH_KEY_IS_STRING: + RETURN_STRINGL(string_key, str_key_len - 1, 1); + break; + case HASH_KEY_IS_LONG: + RETURN_LONG(num_key); + break; + } + } + } + zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos); + } + + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto bool in_array(mixed needle, array haystack [, bool strict]) + Checks if the given value exists in the array */ +PHP_FUNCTION(in_array) +{ + php_search_array(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* {{{ proto mixed array_search(mixed needle, array haystack [, bool strict]) + Searches the array for a given value and returns the corresponding key if successful */ +PHP_FUNCTION(array_search) +{ + php_search_array(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +static int php_valid_var_name(char *var_name, int var_name_len) /* {{{ */ +{ + int i, ch; + + if (!var_name || !var_name_len) { + return 0; + } + + /* These are allowed as first char: [a-zA-Z_\x7f-\xff] */ + ch = (int)((unsigned char *)var_name)[0]; + if (var_name[0] != '_' && + (ch < 65 /* A */ || /* Z */ ch > 90) && + (ch < 97 /* a */ || /* z */ ch > 122) && + (ch < 127 /* 0x7f */ || /* 0xff */ ch > 255) + ) { + return 0; + } + + /* And these as the rest: [a-zA-Z0-9_\x7f-\xff] */ + if (var_name_len > 1) { + for (i = 1; i < var_name_len; i++) { + ch = (int)((unsigned char *)var_name)[i]; + if (var_name[i] != '_' && + (ch < 48 /* 0 */ || /* 9 */ ch > 57) && + (ch < 65 /* A */ || /* Z */ ch > 90) && + (ch < 97 /* a */ || /* z */ ch > 122) && + (ch < 127 /* 0x7f */ || /* 0xff */ ch > 255) + ) { + return 0; + } + } + } + return 1; +} +/* }}} */ + +PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC) /* {{{ */ +{ + Z_STRLEN_P(result) = Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len; + Z_TYPE_P(result) = IS_STRING; + Z_STRVAL_P(result) = emalloc(Z_STRLEN_P(result) + 1); + memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix)); + + if (add_underscore) { + Z_STRVAL_P(result)[Z_STRLEN_P(prefix)] = '_'; + } + + memcpy(Z_STRVAL_P(result) + Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); + + return SUCCESS; +} +/* }}} */ + +/* {{{ proto int extract(array var_array [, int extract_type [, string prefix]]) + Imports variables into symbol table from an array */ +PHP_FUNCTION(extract) +{ + zval *var_array, *prefix = NULL; + long extract_type = EXTR_OVERWRITE; + zval **entry, *data; + char *var_name; + ulong num_key; + uint var_name_len; + int var_exists, key_type, count = 0; + int extract_refs = 0; + HashPosition pos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|lz/", &var_array, &extract_type, &prefix) == FAILURE) { + return; + } + + extract_refs = (extract_type & EXTR_REFS); + extract_type &= 0xff; + + if (extract_type < EXTR_OVERWRITE || extract_type > EXTR_IF_EXISTS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid extract type"); + return; + } + + if (extract_type > EXTR_SKIP && extract_type <= EXTR_PREFIX_IF_EXISTS && ZEND_NUM_ARGS() < 3) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "specified extract type requires the prefix parameter"); + return; + } + + if (prefix) { + convert_to_string(prefix); + if (Z_STRLEN_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRLEN_P(prefix))) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "prefix is not a valid identifier"); + return; + } + } + + if (!EG(active_symbol_table)) { + zend_rebuild_symbol_table(TSRMLS_C); + } + + /* var_array is passed by ref for the needs of EXTR_REFS (needs to + * work on the original array to create refs to its members) + * simulate pass_by_value if EXTR_REFS is not used */ + if (!extract_refs) { + SEPARATE_ARG_IF_REF(var_array); + } + + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(var_array), &pos); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(var_array), (void **)&entry, &pos) == SUCCESS) { + zval final_name; + + ZVAL_NULL(&final_name); + + key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(var_array), &var_name, &var_name_len, &num_key, 0, &pos); + var_exists = 0; + + if (key_type == HASH_KEY_IS_STRING) { + var_name_len--; + var_exists = zend_hash_exists(EG(active_symbol_table), var_name, var_name_len + 1); + } else if (key_type == HASH_KEY_IS_LONG && (extract_type == EXTR_PREFIX_ALL || extract_type == EXTR_PREFIX_INVALID)) { + zval num; + + ZVAL_LONG(&num, num_key); + convert_to_string(&num); + php_prefix_varname(&final_name, prefix, Z_STRVAL(num), Z_STRLEN(num), 1 TSRMLS_CC); + zval_dtor(&num); + } else { + zend_hash_move_forward_ex(Z_ARRVAL_P(var_array), &pos); + continue; + } + + switch (extract_type) { + case EXTR_IF_EXISTS: + if (!var_exists) break; + /* break omitted intentionally */ + + case EXTR_OVERWRITE: + /* GLOBALS protection */ + if (var_exists && var_name_len == sizeof("GLOBALS")-1 && !strcmp(var_name, "GLOBALS")) { + break; + } + if (var_exists && var_name_len == sizeof("this")-1 && !strcmp(var_name, "this") && EG(scope) && EG(scope)->name_length != 0) { + break; + } + ZVAL_STRINGL(&final_name, var_name, var_name_len, 1); + break; + + case EXTR_PREFIX_IF_EXISTS: + if (var_exists) { + php_prefix_varname(&final_name, prefix, var_name, var_name_len, 1 TSRMLS_CC); + } + break; + + case EXTR_PREFIX_SAME: + if (!var_exists && var_name_len != 0) { + ZVAL_STRINGL(&final_name, var_name, var_name_len, 1); + } + /* break omitted intentionally */ + + case EXTR_PREFIX_ALL: + if (Z_TYPE(final_name) == IS_NULL && var_name_len != 0) { + php_prefix_varname(&final_name, prefix, var_name, var_name_len, 1 TSRMLS_CC); + } + break; + + case EXTR_PREFIX_INVALID: + if (Z_TYPE(final_name) == IS_NULL) { + if (!php_valid_var_name(var_name, var_name_len)) { + php_prefix_varname(&final_name, prefix, var_name, var_name_len, 1 TSRMLS_CC); + } else { + ZVAL_STRINGL(&final_name, var_name, var_name_len, 1); + } + } + break; + + default: + if (!var_exists) { + ZVAL_STRINGL(&final_name, var_name, var_name_len, 1); + } + break; + } + + if (Z_TYPE(final_name) != IS_NULL && php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) { + if (extract_refs) { + zval **orig_var; + + SEPARATE_ZVAL_TO_MAKE_IS_REF(entry); + zval_add_ref(entry); + + if (zend_hash_find(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRLEN(final_name) + 1, (void **) &orig_var) == SUCCESS) { + zval_ptr_dtor(orig_var); + *orig_var = *entry; + } else { + zend_hash_update(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRLEN(final_name) + 1, (void **) entry, sizeof(zval *), NULL); + } + } else { + MAKE_STD_ZVAL(data); + *data = **entry; + zval_copy_ctor(data); + + ZEND_SET_SYMBOL_WITH_LENGTH(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRLEN(final_name) + 1, data, 1, 0); + } + count++; + } + zval_dtor(&final_name); + + zend_hash_move_forward_ex(Z_ARRVAL_P(var_array), &pos); + } + + if (!extract_refs) { + zval_ptr_dtor(&var_array); + } + + RETURN_LONG(count); +} +/* }}} */ + +static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_value, zval *entry TSRMLS_DC) /* {{{ */ +{ + zval **value_ptr, *value, *data; + + if (Z_TYPE_P(entry) == IS_STRING) { + if (zend_hash_find(eg_active_symbol_table, Z_STRVAL_P(entry), Z_STRLEN_P(entry) + 1, (void **)&value_ptr) != FAILURE) { + value = *value_ptr; + ALLOC_ZVAL(data); + MAKE_COPY_ZVAL(&value, data); + + zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(entry), Z_STRLEN_P(entry) + 1, &data, sizeof(zval *), NULL); + } + } + else if (Z_TYPE_P(entry) == IS_ARRAY) { + HashPosition pos; + + if ((Z_ARRVAL_P(entry)->nApplyCount > 1)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); + return; + } + + Z_ARRVAL_P(entry)->nApplyCount++; + + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(entry), &pos); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(entry), (void**)&value_ptr, &pos) == SUCCESS) { + value = *value_ptr; + + php_compact_var(eg_active_symbol_table, return_value, value TSRMLS_CC); + zend_hash_move_forward_ex(Z_ARRVAL_P(entry), &pos); + } + Z_ARRVAL_P(entry)->nApplyCount--; + } +} +/* }}} */ + +/* {{{ proto array compact(mixed var_names [, mixed ...]) + Creates a hash containing variables and their values */ +PHP_FUNCTION(compact) +{ + zval ***args = NULL; /* function arguments array */ + int num_args, i; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &num_args) == FAILURE) { + return; + } + + if (!EG(active_symbol_table)) { + zend_rebuild_symbol_table(TSRMLS_C); + } + + /* 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_PP(args[0]) == IS_ARRAY) { + array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_PP(args[0]))); + } else { + array_init_size(return_value, ZEND_NUM_ARGS()); + } + + for (i=0; i= 1 && Z_STRLEN_P(zhigh) >= 1) { + int type1, type2; + unsigned char *low, *high; + long lstep = (long) step; + + type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRLEN_P(zlow), NULL, NULL, 0); + type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRLEN_P(zhigh), NULL, NULL, 0); + + if (type1 == IS_DOUBLE || type2 == IS_DOUBLE || is_step_double) { + goto double_str; + } else if (type1 == IS_LONG || type2 == IS_LONG) { + goto long_str; + } + + convert_to_string(zlow); + convert_to_string(zhigh); + low = (unsigned char *)Z_STRVAL_P(zlow); + high = (unsigned char *)Z_STRVAL_P(zhigh); + + if (*low > *high) { /* Negative Steps */ + unsigned char ch = *low; + + if (lstep <= 0) { + err = 1; + goto err; + } + for (; ch >= *high; ch -= (unsigned int)lstep) { + add_next_index_stringl(return_value, (const char *)&ch, 1, 1); + if (((signed int)ch - lstep) < 0) { + break; + } + } + } else if (*high > *low) { /* Positive Steps */ + unsigned char ch = *low; + + if (lstep <= 0) { + err = 1; + goto err; + } + for (; ch <= *high; ch += (unsigned int)lstep) { + add_next_index_stringl(return_value, (const char *)&ch, 1, 1); + if (((signed int)ch + lstep) > 255) { + break; + } + } + } else { + add_next_index_stringl(return_value, (const char *)low, 1, 1); + } + + } else if (Z_TYPE_P(zlow) == IS_DOUBLE || Z_TYPE_P(zhigh) == IS_DOUBLE || is_step_double) { + double low, high, value; + long i; +double_str: + convert_to_double(zlow); + convert_to_double(zhigh); + low = Z_DVAL_P(zlow); + high = Z_DVAL_P(zhigh); + i = 0; + + if (low > high) { /* Negative steps */ + if (low - high < step || step <= 0) { + err = 1; + goto err; + } + + for (value = low; value >= (high - DOUBLE_DRIFT_FIX); value = low - (++i * step)) { + add_next_index_double(return_value, value); + } + } else if (high > low) { /* Positive steps */ + if (high - low < step || step <= 0) { + err = 1; + goto err; + } + + for (value = low; value <= (high + DOUBLE_DRIFT_FIX); value = low + (++i * step)) { + add_next_index_double(return_value, value); + } + } else { + add_next_index_double(return_value, low); + } + } else { + double low, high; + long lstep; +long_str: + convert_to_double(zlow); + convert_to_double(zhigh); + low = Z_DVAL_P(zlow); + high = Z_DVAL_P(zhigh); + lstep = (long) step; + + if (low > high) { /* Negative steps */ + if (low - high < lstep || lstep <= 0) { + err = 1; + goto err; + } + for (; low >= high; low -= lstep) { + add_next_index_long(return_value, (long)low); + } + } else if (high > low) { /* Positive steps */ + if (high - low < lstep || lstep <= 0) { + err = 1; + goto err; + } + for (; low <= high; low += lstep) { + add_next_index_long(return_value, (long)low); + } + } else { + add_next_index_long(return_value, (long)low); + } + } +err: + if (err) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "step exceeds the specified range"); + zval_dtor(return_value); + RETURN_FALSE; + } +} +/* }}} */ + +static void php_array_data_shuffle(zval *array TSRMLS_DC) /* {{{ */ +{ + Bucket **elems, *temp; + HashTable *hash; + int j, n_elems, rnd_idx, n_left; + + n_elems = zend_hash_num_elements(Z_ARRVAL_P(array)); + + if (n_elems < 1) { + return; + } + + elems = (Bucket **)safe_emalloc(n_elems, sizeof(Bucket *), 0); + hash = Z_ARRVAL_P(array); + n_left = n_elems; + + for (j = 0, temp = hash->pListHead; temp; temp = temp->pListNext) + elems[j++] = temp; + while (--n_left) { + rnd_idx = php_rand(TSRMLS_C); + RAND_RANGE(rnd_idx, 0, n_left, PHP_RAND_MAX); + if (rnd_idx != n_left) { + temp = elems[n_left]; + elems[n_left] = elems[rnd_idx]; + elems[rnd_idx] = temp; + } + } + + HANDLE_BLOCK_INTERRUPTIONS(); + hash->pListHead = elems[0]; + hash->pListTail = NULL; + hash->pInternalPointer = hash->pListHead; + + for (j = 0; j < n_elems; j++) { + if (hash->pListTail) { + hash->pListTail->pListNext = elems[j]; + } + elems[j]->pListLast = hash->pListTail; + elems[j]->pListNext = NULL; + hash->pListTail = elems[j]; + } + temp = hash->pListHead; + j = 0; + while (temp != NULL) { + temp->nKeyLength = 0; + temp->h = j++; + temp = temp->pListNext; + } + hash->nNextFreeElement = n_elems; + zend_hash_rehash(hash); + HANDLE_UNBLOCK_INTERRUPTIONS(); + + efree(elems); +} +/* }}} */ + +/* {{{ proto bool shuffle(array array_arg) + Randomly shuffle the contents of an array */ +PHP_FUNCTION(shuffle) +{ + zval *array; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) { + RETURN_FALSE; + } + + php_array_data_shuffle(array TSRMLS_CC); + + RETURN_TRUE; +} +/* }}} */ + +PHPAPI HashTable* php_splice(HashTable *in_hash, int offset, int length, zval ***list, int list_count, HashTable **removed) /* {{{ */ +{ + HashTable *out_hash = NULL; /* Output hashtable */ + int num_in, /* Number of entries in the input hashtable */ + pos, /* Current position in the hashtable */ + i; /* Loop counter */ + Bucket *p; /* Pointer to hash bucket */ + zval *entry; /* Hash entry */ + + /* If input hash doesn't exist, we have nothing to do */ + if (!in_hash) { + return NULL; + } + + /* Get number of entries in the input hash */ + num_in = zend_hash_num_elements(in_hash); + + /* Clamp the offset.. */ + if (offset > num_in) { + offset = num_in; + } else if (offset < 0 && (offset = (num_in + offset)) < 0) { + offset = 0; + } + + /* ..and the length */ + if (length < 0) { + length = num_in - offset + length; + } else if (((unsigned)offset + (unsigned)length) > (unsigned)num_in) { + length = num_in - offset; + } + + /* Create and initialize output hash */ + ALLOC_HASHTABLE(out_hash); + zend_hash_init(out_hash, (length > 0 ? num_in - length : 0) + list_count, NULL, ZVAL_PTR_DTOR, 0); + + /* Start at the beginning of the input hash and copy entries to output hash until offset is reached */ + for (pos = 0, p = in_hash->pListHead; pos < offset && p ; pos++, p = p->pListNext) { + /* Get entry and increase reference count */ + entry = *((zval **)p->pData); + Z_ADDREF_P(entry); + + /* Update output hash depending on key type */ + if (p->nKeyLength == 0) { + zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL); + } else { + zend_hash_quick_update(out_hash, p->arKey, p->nKeyLength, p->h, &entry, sizeof(zval *), NULL); + } + } + + /* If hash for removed entries exists, go until offset+length and copy the entries to it */ + if (removed != NULL) { + for ( ; pos < offset + length && p; pos++, p = p->pListNext) { + entry = *((zval **)p->pData); + Z_ADDREF_P(entry); + if (p->nKeyLength == 0) { + zend_hash_next_index_insert(*removed, &entry, sizeof(zval *), NULL); + } else { + zend_hash_quick_update(*removed, p->arKey, p->nKeyLength, p->h, &entry, sizeof(zval *), NULL); + } + } + } else { /* otherwise just skip those entries */ + for ( ; pos < offset + length && p; pos++, p = p->pListNext); + } + + /* If there are entries to insert.. */ + if (list != NULL) { + /* ..for each one, create a new zval, copy entry into it and copy it into the output hash */ + for (i = 0; i < list_count; i++) { + entry = *list[i]; + Z_ADDREF_P(entry); + zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL); + } + } + + /* Copy the remaining input hash entries to the output hash */ + for ( ; p ; p = p->pListNext) { + entry = *((zval **)p->pData); + Z_ADDREF_P(entry); + if (p->nKeyLength == 0) { + zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL); + } else { + zend_hash_quick_update(out_hash, p->arKey, p->nKeyLength, p->h, &entry, sizeof(zval *), NULL); + } + } + + zend_hash_internal_pointer_reset(out_hash); + return out_hash; +} +/* }}} */ + +/* {{{ proto int array_push(array stack, mixed var [, mixed ...]) + Pushes elements onto the end of the array */ +PHP_FUNCTION(array_push) +{ + zval ***args, /* Function arguments array */ + *stack, /* Input array */ + *new_var; /* Variable to be pushed */ + int i, /* Loop counter */ + argc; /* Number of function arguments */ + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a+", &stack, &args, &argc) == FAILURE) { + return; + } + + /* 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++) { + new_var = *args[i]; + Z_ADDREF_P(new_var); + + if (zend_hash_next_index_insert(Z_ARRVAL_P(stack), &new_var, sizeof(zval *), NULL) == FAILURE) { + Z_DELREF_P(new_var); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element to the array as the next element is already occupied"); + efree(args); + RETURN_FALSE; + } + } + + /* Clean up and return the number of values in the stack */ + efree(args); + RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack))); +} +/* }}} */ + +/* {{{ void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) */ +static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) +{ + zval *stack, /* Input stack */ + **val; /* Value to be popped */ + char *key = NULL; + uint key_len = 0; + ulong index; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &stack) == FAILURE) { + return; + } + + if (zend_hash_num_elements(Z_ARRVAL_P(stack)) == 0) { + return; + } + + /* Get the first or last value and copy it into the return value */ + if (off_the_end) { + zend_hash_internal_pointer_end(Z_ARRVAL_P(stack)); + } else { + zend_hash_internal_pointer_reset(Z_ARRVAL_P(stack)); + } + zend_hash_get_current_data(Z_ARRVAL_P(stack), (void **)&val); + RETVAL_ZVAL(*val, 1, 0); + + /* Delete the first or last value */ + zend_hash_get_current_key_ex(Z_ARRVAL_P(stack), &key, &key_len, &index, 0, NULL); + if (key && Z_ARRVAL_P(stack) == &EG(symbol_table)) { + zend_delete_global_variable(key, key_len - 1 TSRMLS_CC); + } else { + zend_hash_del_key_or_index(Z_ARRVAL_P(stack), key, key_len, index, (key) ? HASH_DEL_KEY : HASH_DEL_INDEX); + } + + /* If we did a shift... re-index like it did before */ + if (!off_the_end) { + unsigned int k = 0; + int should_rehash = 0; + Bucket *p = Z_ARRVAL_P(stack)->pListHead; + while (p != NULL) { + if (p->nKeyLength == 0) { + if (p->h != k) { + p->h = k++; + should_rehash = 1; + } else { + k++; + } + } + p = p->pListNext; + } + Z_ARRVAL_P(stack)->nNextFreeElement = k; + if (should_rehash) { + zend_hash_rehash(Z_ARRVAL_P(stack)); + } + } else if (!key_len && index >= Z_ARRVAL_P(stack)->nNextFreeElement - 1) { + Z_ARRVAL_P(stack)->nNextFreeElement = Z_ARRVAL_P(stack)->nNextFreeElement - 1; + } + + zend_hash_internal_pointer_reset(Z_ARRVAL_P(stack)); +} +/* }}} */ + +/* {{{ proto mixed array_pop(array stack) + Pops an element off the end of the array */ +PHP_FUNCTION(array_pop) +{ + _phpi_pop(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +/* {{{ proto mixed array_shift(array stack) + Pops an element off the beginning of the array */ +PHP_FUNCTION(array_shift) +{ + _phpi_pop(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* {{{ proto int array_unshift(array stack, mixed var [, mixed ...]) + Pushes elements onto the beginning of the array */ +PHP_FUNCTION(array_unshift) +{ + zval ***args, /* Function arguments array */ + *stack; /* Input stack */ + HashTable *new_hash; /* New hashtable for the stack */ + HashTable old_hash; + int argc; /* Number of function arguments */ + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a+", &stack, &args, &argc) == FAILURE) { + return; + } + + /* Use splice to insert the elements at the beginning. Destroy old + * hashtable and replace it with new one */ + new_hash = php_splice(Z_ARRVAL_P(stack), 0, 0, &args[0], argc, NULL); + old_hash = *Z_ARRVAL_P(stack); + if (Z_ARRVAL_P(stack) == &EG(symbol_table)) { + zend_reset_all_cv(&EG(symbol_table) TSRMLS_CC); + } + *Z_ARRVAL_P(stack) = *new_hash; + FREE_HASHTABLE(new_hash); + zend_hash_destroy(&old_hash); + + /* Clean up and return the number of elements in the stack */ + efree(args); + RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack))); +} +/* }}} */ + +/* {{{ proto array array_splice(array input, int offset [, int length [, array replacement]]) + Removes the elements designated by offset and length and replace them with supplied array */ +PHP_FUNCTION(array_splice) +{ + zval *array, /* Input array */ + *repl_array = NULL, /* Replacement array */ + ***repl = NULL; /* Replacement elements */ + HashTable *new_hash = NULL, /* Output array's hash */ + **rem_hash = NULL; /* Removed elements' hash */ + HashTable old_hash; + Bucket *p; /* Bucket used for traversing hash */ + long i, + offset, + length = 0, + repl_num = 0; /* Number of replacement elements */ + int num_in; /* Number of elements in the input array */ + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|lz/", &array, &offset, &length, &repl_array) == FAILURE) { + return; + } + + num_in = zend_hash_num_elements(Z_ARRVAL_P(array)); + + if (ZEND_NUM_ARGS() < 3) { + length = num_in; + } + + if (ZEND_NUM_ARGS() == 4) { + /* Make sure the last argument, if passed, is an array */ + convert_to_array(repl_array); + + /* Create the array of replacement elements */ + repl_num = zend_hash_num_elements(Z_ARRVAL_P(repl_array)); + repl = (zval ***)safe_emalloc(repl_num, sizeof(zval **), 0); + for (p = Z_ARRVAL_P(repl_array)->pListHead, i = 0; p; p = p->pListNext, i++) { + repl[i] = ((zval **)p->pData); + } + } + + /* Don't create the array of removed elements if it's not going + * to be used; e.g. only removing and/or replacing elements */ + if (return_value_used) { + int size = length; + + /* Clamp the offset.. */ + if (offset > num_in) { + offset = num_in; + } else if (offset < 0 && (offset = (num_in + offset)) < 0) { + offset = 0; + } + + /* ..and the length */ + if (length < 0) { + size = num_in - offset + length; + } else if (((unsigned long) offset + (unsigned long) length) > (unsigned) num_in) { + size = num_in - offset; + } + + /* Initialize return value */ + array_init_size(return_value, size > 0 ? size : 0); + rem_hash = &Z_ARRVAL_P(return_value); + } + + /* Perform splice */ + new_hash = php_splice(Z_ARRVAL_P(array), offset, length, repl, repl_num, rem_hash); + + /* Replace input array's hashtable with the new one */ + old_hash = *Z_ARRVAL_P(array); + if (Z_ARRVAL_P(array) == &EG(symbol_table)) { + zend_reset_all_cv(&EG(symbol_table) TSRMLS_CC); + } + *Z_ARRVAL_P(array) = *new_hash; + FREE_HASHTABLE(new_hash); + zend_hash_destroy(&old_hash); + + /* Clean up */ + if (ZEND_NUM_ARGS() == 4) { + efree(repl); + } +} +/* }}} */ + +/* {{{ proto array array_slice(array input, int offset [, int length [, bool preserve_keys]]) + Returns elements specified by offset and length */ +PHP_FUNCTION(array_slice) +{ + zval *input, /* Input array */ + **z_length = NULL, /* How many elements to get */ + **entry; /* An array entry */ + long offset, /* Offset to get elements from */ + length = 0; + zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array or not */ + int num_in, /* Number of elements in the input array */ + pos; /* Current position in the array */ + char *string_key; + uint string_key_len; + ulong num_key; + HashPosition hpos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|Zb", &input, &offset, &z_length, &preserve_keys) == FAILURE) { + return; + } + + /* Get number of entries in the input hash */ + num_in = zend_hash_num_elements(Z_ARRVAL_P(input)); + + /* We want all entries from offset to the end if length is not passed or is null */ + if (ZEND_NUM_ARGS() < 3 || Z_TYPE_PP(z_length) == IS_NULL) { + length = num_in; + } else { + convert_to_long_ex(z_length); + length = Z_LVAL_PP(z_length); + } + + /* Clamp the offset.. */ + if (offset > num_in) { + array_init(return_value); + return; + } else if (offset < 0 && (offset = (num_in + offset)) < 0) { + offset = 0; + } + + /* ..and the length */ + if (length < 0) { + length = num_in - offset + length; + } else if (((unsigned long) offset + (unsigned long) length) > (unsigned) num_in) { + length = num_in - offset; + } + + /* Initialize returned array */ + array_init_size(return_value, length > 0 ? length : 0); + + if (length <= 0) { + return; + } + + /* Start at the beginning and go until we hit offset */ + pos = 0; + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &hpos); + while (pos < offset && zend_hash_get_current_data_ex(Z_ARRVAL_P(input), (void **)&entry, &hpos) == SUCCESS) { + pos++; + zend_hash_move_forward_ex(Z_ARRVAL_P(input), &hpos); + } + + /* Copy elements from input array to the one that's returned */ + while (pos < offset + length && zend_hash_get_current_data_ex(Z_ARRVAL_P(input), (void **)&entry, &hpos) == SUCCESS) { + + zval_add_ref(entry); + + switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &string_key, &string_key_len, &num_key, 0, &hpos)) { + case HASH_KEY_IS_STRING: + zend_hash_update(Z_ARRVAL_P(return_value), string_key, string_key_len, entry, sizeof(zval *), NULL); + break; + + case HASH_KEY_IS_LONG: + if (preserve_keys) { + zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry, sizeof(zval *), NULL); + } else { + zend_hash_next_index_insert(Z_ARRVAL_P(return_value), entry, sizeof(zval *), NULL); + } + break; + } + pos++; + zend_hash_move_forward_ex(Z_ARRVAL_P(input), &hpos); + } +} +/* }}} */ + +PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS_DC) /* {{{ */ +{ + zval **src_entry, **dest_entry; + char *string_key; + uint string_key_len; + ulong num_key; + HashPosition pos; + + zend_hash_internal_pointer_reset_ex(src, &pos); + while (zend_hash_get_current_data_ex(src, (void **)&src_entry, &pos) == SUCCESS) { + switch (zend_hash_get_current_key_ex(src, &string_key, &string_key_len, &num_key, 0, &pos)) { + case HASH_KEY_IS_STRING: + if (recursive && zend_hash_find(dest, string_key, string_key_len, (void **)&dest_entry) == SUCCESS) { + HashTable *thash = Z_TYPE_PP(dest_entry) == IS_ARRAY ? Z_ARRVAL_PP(dest_entry) : NULL; + + if ((thash && thash->nApplyCount > 1) || (*src_entry == *dest_entry && Z_ISREF_PP(dest_entry) && (Z_REFCOUNT_PP(dest_entry) % 2))) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); + return 0; + } + SEPARATE_ZVAL(dest_entry); + SEPARATE_ZVAL(src_entry); + + if (Z_TYPE_PP(dest_entry) == IS_NULL) { + convert_to_array_ex(dest_entry); + add_next_index_null(*dest_entry); + } else { + convert_to_array_ex(dest_entry); + } + if (Z_TYPE_PP(src_entry) == IS_NULL) { + convert_to_array_ex(src_entry); + add_next_index_null(*src_entry); + } else { + convert_to_array_ex(src_entry); + } + if (thash) { + thash->nApplyCount++; + } + if (!php_array_merge(Z_ARRVAL_PP(dest_entry), Z_ARRVAL_PP(src_entry), recursive TSRMLS_CC)) { + if (thash) { + thash->nApplyCount--; + } + return 0; + } + if (thash) { + thash->nApplyCount--; + } + } else { + Z_ADDREF_PP(src_entry); + zend_hash_update(dest, string_key, string_key_len, src_entry, sizeof(zval *), NULL); + } + break; + + case HASH_KEY_IS_LONG: + Z_ADDREF_PP(src_entry); + zend_hash_next_index_insert(dest, src_entry, sizeof(zval *), NULL); + break; + } + zend_hash_move_forward_ex(src, &pos); + } + return 1; +} +/* }}} */ + +PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC) /* {{{ */ +{ + zval **src_entry, **dest_entry; + char *string_key; + uint string_key_len; + ulong num_key; + HashPosition pos; + + for (zend_hash_internal_pointer_reset_ex(src, &pos); + zend_hash_get_current_data_ex(src, (void **)&src_entry, &pos) == SUCCESS; + zend_hash_move_forward_ex(src, &pos)) { + switch (zend_hash_get_current_key_ex(src, &string_key, &string_key_len, &num_key, 0, &pos)) { + case HASH_KEY_IS_STRING: + if (Z_TYPE_PP(src_entry) != IS_ARRAY || + zend_hash_find(dest, string_key, string_key_len, (void **)&dest_entry) == FAILURE || + Z_TYPE_PP(dest_entry) != IS_ARRAY) { + + Z_ADDREF_PP(src_entry); + zend_hash_update(dest, string_key, string_key_len, src_entry, sizeof(zval *), NULL); + + continue; + } + break; + + case HASH_KEY_IS_LONG: + if (Z_TYPE_PP(src_entry) != IS_ARRAY || + zend_hash_index_find(dest, num_key, (void **)&dest_entry) == FAILURE || + Z_TYPE_PP(dest_entry) != IS_ARRAY) { + + Z_ADDREF_PP(src_entry); + zend_hash_index_update(dest, num_key, src_entry, sizeof(zval *), NULL); + + continue; + } + break; + } + + if (Z_ARRVAL_PP(dest_entry)->nApplyCount > 1 || Z_ARRVAL_PP(src_entry)->nApplyCount > 1 || (*src_entry == *dest_entry && Z_ISREF_PP(dest_entry) && (Z_REFCOUNT_PP(dest_entry) % 2))) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); + return 0; + } + SEPARATE_ZVAL(dest_entry); + Z_ARRVAL_PP(dest_entry)->nApplyCount++; + Z_ARRVAL_PP(src_entry)->nApplyCount++; + + + if (!php_array_replace_recursive(Z_ARRVAL_PP(dest_entry), Z_ARRVAL_PP(src_entry) TSRMLS_CC)) { + Z_ARRVAL_PP(dest_entry)->nApplyCount--; + Z_ARRVAL_PP(src_entry)->nApplyCount--; + return 0; + } + Z_ARRVAL_PP(dest_entry)->nApplyCount--; + Z_ARRVAL_PP(src_entry)->nApplyCount--; + } + + return 1; +} +/* }}} */ + +static void php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAMETERS, int recursive, int replace) /* {{{ */ +{ + zval ***args = NULL; + int argc, i, init_size = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) { + return; + } + + for (i = 0; i < argc; i++) { + if (Z_TYPE_PP(args[i]) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is not an array", i + 1); + efree(args); + RETURN_NULL(); + } else { + int num = zend_hash_num_elements(Z_ARRVAL_PP(args[i])); + + if (num > init_size) { + init_size = num; + } + } + } + + array_init_size(return_value, init_size); + + for (i = 0; i < argc; i++) { + SEPARATE_ZVAL(args[i]); + if (!replace) { + php_array_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(args[i]), recursive TSRMLS_CC); + } else if (recursive && i > 0) { /* First array will be copied directly instead */ + php_array_replace_recursive(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(args[i]) TSRMLS_CC); + } else { + zend_hash_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(args[i]), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *), 1); + } + } + + efree(args); +} +/* }}} */ + +/* {{{ proto array array_merge(array arr1, array arr2 [, array ...]) + Merges elements from passed arrays into one array */ +PHP_FUNCTION(array_merge) +{ + php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0, 0); +} +/* }}} */ + +/* {{{ proto array array_merge_recursive(array arr1, array arr2 [, array ...]) + Recursively merges elements from passed arrays into one array */ +PHP_FUNCTION(array_merge_recursive) +{ + php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1, 0); +} +/* }}} */ + +/* {{{ proto array array_replace(array arr1, array arr2 [, array ...]) + Replaces elements from passed arrays into one array */ +PHP_FUNCTION(array_replace) +{ + php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0, 1); +} +/* }}} */ + +/* {{{ proto array array_replace_recursive(array arr1, array arr2 [, array ...]) + Recursively replaces elements from passed arrays into one array */ +PHP_FUNCTION(array_replace_recursive) +{ + php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1, 1); +} +/* }}} */ + +/* {{{ proto array array_keys(array input [, mixed search_value[, bool strict]]) + Return just the keys from the input array, optionally only for the specified search_value */ +PHP_FUNCTION(array_keys) +{ + zval *input, /* Input array */ + *search_value = NULL, /* Value to search for */ + **entry, /* An entry in the input array */ + res, /* Result of comparison */ + *new_val; /* New value */ + int add_key; /* Flag to indicate whether a key should be added */ + char *string_key; /* String key */ + uint string_key_len; + ulong num_key; /* Numeric key */ + zend_bool strict = 0; /* do strict comparison */ + HashPosition pos; + int (*is_equal_func)(zval *, zval *, zval * TSRMLS_DC) = is_equal_function; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|zb", &input, &search_value, &strict) == FAILURE) { + return; + } + + if (strict) { + is_equal_func = is_identical_function; + } + + /* Initialize return array */ + if (search_value != NULL) { + array_init(return_value); + } else { + array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(input))); + } + add_key = 1; + + /* Go through input array and add keys to the return array */ + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(input), (void **)&entry, &pos) == SUCCESS) { + if (search_value != NULL) { + is_equal_func(&res, search_value, *entry TSRMLS_CC); + add_key = zval_is_true(&res); + } + + if (add_key) { + MAKE_STD_ZVAL(new_val); + + switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &string_key, &string_key_len, &num_key, 1, &pos)) { + case HASH_KEY_IS_STRING: + ZVAL_STRINGL(new_val, string_key, string_key_len - 1, 0); + zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &new_val, sizeof(zval *), NULL); + break; + + case HASH_KEY_IS_LONG: + Z_TYPE_P(new_val) = IS_LONG; + Z_LVAL_P(new_val) = num_key; + zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &new_val, sizeof(zval *), NULL); + break; + } + } + + zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos); + } +} +/* }}} */ + +/* {{{ proto array array_values(array input) + Return just the values from the input array */ +PHP_FUNCTION(array_values) +{ + zval *input, /* Input array */ + **entry; /* An entry in the input array */ + HashPosition pos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &input) == FAILURE) { + return; + } + + /* Initialize return array */ + array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(input))); + + /* Go through input array and add values to the return array */ + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(input), (void **)&entry, &pos) == SUCCESS) { + zval_add_ref(entry); + zend_hash_next_index_insert(Z_ARRVAL_P(return_value), entry, sizeof(zval *), NULL); + zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos); + } +} +/* }}} */ + +/* {{{ proto array array_count_values(array input) + Return the value as key and the frequency of that value in input as value */ +PHP_FUNCTION(array_count_values) +{ + zval *input, /* Input array */ + **entry, /* An entry in the input array */ + **tmp; + HashTable *myht; + HashPosition pos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &input) == FAILURE) { + return; + } + + /* Initialize return array */ + array_init(return_value); + + /* Go through input array and add values to the return array */ + myht = Z_ARRVAL_P(input); + zend_hash_internal_pointer_reset_ex(myht, &pos); + while (zend_hash_get_current_data_ex(myht, (void **)&entry, &pos) == SUCCESS) { + if (Z_TYPE_PP(entry) == IS_LONG) { + if (zend_hash_index_find(Z_ARRVAL_P(return_value), Z_LVAL_PP(entry), (void **)&tmp) == FAILURE) { + zval *data; + MAKE_STD_ZVAL(data); + ZVAL_LONG(data, 1); + zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_PP(entry), &data, sizeof(data), NULL); + } else { + Z_LVAL_PP(tmp)++; + } + } else if (Z_TYPE_PP(entry) == IS_STRING) { + if (zend_symtable_find(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, (void**)&tmp) == FAILURE) { + zval *data; + MAKE_STD_ZVAL(data); + ZVAL_LONG(data, 1); + zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL); + } else { + Z_LVAL_PP(tmp)++; + } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only count STRING and INTEGER values!"); + } + + zend_hash_move_forward_ex(myht, &pos); + } +} +/* }}} */ + +/* {{{ proto array array_reverse(array input [, bool preserve keys]) + Return input as a new array with the order of the entries reversed */ +PHP_FUNCTION(array_reverse) +{ + zval *input, /* Input array */ + **entry; /* An entry in the input array */ + char *string_key; + uint string_key_len; + ulong num_key; + zend_bool preserve_keys = 0; /* whether to preserve keys */ + HashPosition pos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|b", &input, &preserve_keys) == FAILURE) { + return; + } + + /* Initialize return array */ + array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(input))); + + zend_hash_internal_pointer_end_ex(Z_ARRVAL_P(input), &pos); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(input), (void **)&entry, &pos) == SUCCESS) { + zval_add_ref(entry); + + switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &string_key, &string_key_len, &num_key, 0, &pos)) { + case HASH_KEY_IS_STRING: + zend_hash_update(Z_ARRVAL_P(return_value), string_key, string_key_len, entry, sizeof(zval *), NULL); + break; + + case HASH_KEY_IS_LONG: + if (preserve_keys) { + zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry, sizeof(zval *), NULL); + } else { + zend_hash_next_index_insert(Z_ARRVAL_P(return_value), entry, sizeof(zval *), NULL); + } + break; + } + + zend_hash_move_backwards_ex(Z_ARRVAL_P(input), &pos); + } +} +/* }}} */ + +/* {{{ proto array array_pad(array input, int pad_size, mixed pad_value) + Returns a copy of input array padded with pad_value to size pad_size */ +PHP_FUNCTION(array_pad) +{ + zval *input; /* Input array */ + zval *pad_value; /* Padding value obviously */ + zval ***pads; /* Array to pass to splice */ + HashTable *new_hash;/* Return value from splice */ + HashTable old_hash; + long pad_size; /* Size to pad to */ + long pad_size_abs; /* Absolute value of pad_size */ + int input_size; /* Size of the input array */ + int num_pads; /* How many pads do we need */ + int do_pad; /* Whether we should do padding at all */ + int i; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "alz", &input, &pad_size, &pad_value) == FAILURE) { + return; + } + + /* Do some initial calculations */ + input_size = zend_hash_num_elements(Z_ARRVAL_P(input)); + pad_size_abs = abs(pad_size); + if (pad_size_abs < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad up to 1048576 elements at a time"); + zval_dtor(return_value); + RETURN_FALSE; + } + do_pad = (input_size >= pad_size_abs) ? 0 : 1; + + /* Copy the original array */ + RETVAL_ZVAL(input, 1, 0); + + /* If no need to pad, no need to continue */ + if (!do_pad) { + return; + } + + /* Populate the pads array */ + num_pads = pad_size_abs - input_size; + if (num_pads > 1048576) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad up to 1048576 elements at a time"); + zval_dtor(return_value); + RETURN_FALSE; + } + pads = (zval ***)safe_emalloc(num_pads, sizeof(zval **), 0); + for (i = 0; i < num_pads; i++) { + pads[i] = &pad_value; + } + + /* Pad on the right or on the left */ + if (pad_size > 0) { + new_hash = php_splice(Z_ARRVAL_P(return_value), input_size, 0, pads, num_pads, NULL); + } else { + new_hash = php_splice(Z_ARRVAL_P(return_value), 0, 0, pads, num_pads, NULL); + } + + /* Copy the result hash into return value */ + old_hash = *Z_ARRVAL_P(return_value); + if (Z_ARRVAL_P(return_value) == &EG(symbol_table)) { + zend_reset_all_cv(&EG(symbol_table) TSRMLS_CC); + } + *Z_ARRVAL_P(return_value) = *new_hash; + FREE_HASHTABLE(new_hash); + zend_hash_destroy(&old_hash); + + /* Clean up */ + efree(pads); +} +/* }}} */ + +/* {{{ proto array array_flip(array input) + Return array with key <-> value flipped */ +PHP_FUNCTION(array_flip) +{ + zval *array, **entry, *data; + char *string_key; + uint str_key_len; + ulong num_key; + HashPosition pos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) { + return; + } + + array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(array))); + + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(array), (void **)&entry, &pos) == SUCCESS) { + MAKE_STD_ZVAL(data); + switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(array), &string_key, &str_key_len, &num_key, 1, &pos)) { + case HASH_KEY_IS_STRING: + ZVAL_STRINGL(data, string_key, str_key_len - 1, 0); + break; + case HASH_KEY_IS_LONG: + Z_TYPE_P(data) = IS_LONG; + Z_LVAL_P(data) = num_key; + break; + } + + if (Z_TYPE_PP(entry) == IS_LONG) { + zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_PP(entry), &data, sizeof(data), NULL); + } else if (Z_TYPE_PP(entry) == IS_STRING) { + zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL); + } else { + zval_ptr_dtor(&data); /* will free also zval structure */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only flip STRING and INTEGER values!"); + } + + zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos); + } +} +/* }}} */ + +/* {{{ proto array array_change_key_case(array input [, int case=CASE_LOWER]) + Retuns an array with all string keys lowercased [or uppercased] */ +PHP_FUNCTION(array_change_key_case) +{ + zval *array, **entry; + char *string_key; + char *new_key; + uint str_key_len; + ulong num_key; + long change_to_upper=0; + HashPosition pos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &change_to_upper) == FAILURE) { + return; + } + + array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(array))); + + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(array), (void **)&entry, &pos) == SUCCESS) { + zval_add_ref(entry); + + switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(array), &string_key, &str_key_len, &num_key, 0, &pos)) { + case HASH_KEY_IS_LONG: + zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry, sizeof(entry), NULL); + break; + case HASH_KEY_IS_STRING: + new_key = estrndup(string_key, str_key_len - 1); + if (change_to_upper) { + php_strtoupper(new_key, str_key_len - 1); + } else { + php_strtolower(new_key, str_key_len - 1); + } + zend_hash_update(Z_ARRVAL_P(return_value), new_key, str_key_len, entry, sizeof(entry), NULL); + efree(new_key); + break; + } + + zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos); + } +} +/* }}} */ + +/* {{{ proto array array_unique(array input [, int sort_flags]) + Removes duplicate values from array */ +PHP_FUNCTION(array_unique) +{ + zval *array, *tmp; + Bucket *p; + struct bucketindex { + Bucket *b; + unsigned int i; + }; + struct bucketindex *arTmp, *cmpdata, *lastkept; + unsigned int i; + long sort_type = PHP_SORT_STRING; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) { + return; + } + + php_set_compare_func(sort_type TSRMLS_CC); + + array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(array))); + zend_hash_copy(Z_ARRVAL_P(return_value), Z_ARRVAL_P(array), (copy_ctor_func_t) zval_add_ref, (void *)&tmp, sizeof(zval*)); + + if (Z_ARRVAL_P(array)->nNumOfElements <= 1) { /* nothing to do */ + return; + } + + /* create and sort array with pointers to the target_hash buckets */ + arTmp = (struct bucketindex *) pemalloc((Z_ARRVAL_P(array)->nNumOfElements + 1) * sizeof(struct bucketindex), Z_ARRVAL_P(array)->persistent); + if (!arTmp) { + zval_dtor(return_value); + RETURN_FALSE; + } + for (i = 0, p = Z_ARRVAL_P(array)->pListHead; p; i++, p = p->pListNext) { + arTmp[i].b = p; + arTmp[i].i = i; + } + arTmp[i].b = NULL; + zend_qsort((void *) arTmp, i, sizeof(struct bucketindex), php_array_data_compare TSRMLS_CC); + + /* go through the sorted array and delete duplicates from the copy */ + lastkept = arTmp; + for (cmpdata = arTmp + 1; cmpdata->b; cmpdata++) { + if (php_array_data_compare(lastkept, cmpdata TSRMLS_CC)) { + lastkept = cmpdata; + } else { + if (lastkept->i > cmpdata->i) { + p = lastkept->b; + lastkept = cmpdata; + } else { + p = cmpdata->b; + } + if (p->nKeyLength == 0) { + zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); + } else { + if (Z_ARRVAL_P(return_value) == &EG(symbol_table)) { + zend_delete_global_variable(p->arKey, p->nKeyLength - 1 TSRMLS_CC); + } else { + zend_hash_quick_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength, p->h); + } + } + } + } + pefree(arTmp, Z_ARRVAL_P(array)->persistent); +} +/* }}} */ + +static int zval_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */ +{ + zval result; + zval *first; + zval *second; + + first = *((zval **) a); + second = *((zval **) b); + + if (string_compare_function(&result, first, second TSRMLS_CC) == FAILURE) { + return 0; + } + + if (Z_TYPE(result) == IS_DOUBLE) { + if (Z_DVAL(result) < 0) { + return -1; + } else if (Z_DVAL(result) > 0) { + return 1; + } else { + return 0; + } + } + + convert_to_long(&result); + + if (Z_LVAL(result) < 0) { + return -1; + } else if (Z_LVAL(result) > 0) { + return 1; + } + + return 0; +} +/* }}} */ + +static int zval_user_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */ +{ + zval **args[2]; + zval *retval_ptr; + + args[0] = (zval **) a; + args[1] = (zval **) b; + + BG(user_compare_fci).param_count = 2; + BG(user_compare_fci).params = args; + BG(user_compare_fci).retval_ptr_ptr = &retval_ptr; + BG(user_compare_fci).no_separation = 0; + + if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache) TSRMLS_CC) == SUCCESS && retval_ptr) { + long retval; + + convert_to_long_ex(&retval_ptr); + retval = Z_LVAL_P(retval_ptr); + zval_ptr_dtor(&retval_ptr); + return retval < 0 ? -1 : retval > 0 ? 1 : 0;; + } else { + return 0; + } +} +/* }}} */ + +static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_type) /* {{{ */ +{ + Bucket *p; + int argc, i; + zval ***args; + int (*intersect_data_compare_func)(zval **, zval ** TSRMLS_DC) = NULL; + zend_bool ok; + zval **data; + int req_args; + char *param_spec; + + /* Get the argument count */ + argc = ZEND_NUM_ARGS(); + if (data_compare_type == INTERSECT_COMP_DATA_USER) { + /* INTERSECT_COMP_DATA_USER - array_uintersect_assoc() */ + req_args = 3; + param_spec = "+f"; + intersect_data_compare_func = zval_user_compare; + } else { + /* INTERSECT_COMP_DATA_NONE - array_intersect_key() + INTERSECT_COMP_DATA_INTERNAL - array_intersect_assoc() */ + req_args = 2; + param_spec = "+"; + + if (data_compare_type == INTERSECT_COMP_DATA_INTERNAL) { + intersect_data_compare_func = zval_compare; + } + } + + if (argc < req_args) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "at least %d parameters are required, %d given", req_args, argc); + return; + } + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, param_spec, &args, &argc, &BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE) { + return; + } + + for (i = 0; i < argc; i++) { + if (Z_TYPE_PP(args[i]) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is not an array", i + 1); + RETVAL_NULL(); + goto out; + } + } + + array_init(return_value); + + for (p = Z_ARRVAL_PP(args[0])->pListHead; p != NULL; p = p->pListNext) { + if (p->nKeyLength == 0) { + ok = 1; + for (i = 1; i < argc; i++) { + if (zend_hash_index_find(Z_ARRVAL_PP(args[i]), p->h, (void**)&data) == FAILURE || + (intersect_data_compare_func && + intersect_data_compare_func((zval**)p->pData, data TSRMLS_CC) != 0) + ) { + ok = 0; + break; + } + } + if (ok) { + Z_ADDREF_PP((zval**)p->pData); + zend_hash_index_update(Z_ARRVAL_P(return_value), p->h, p->pData, sizeof(zval*), NULL); + } + } else { + ok = 1; + for (i = 1; i < argc; i++) { + if (zend_hash_quick_find(Z_ARRVAL_PP(args[i]), p->arKey, p->nKeyLength, p->h, (void**)&data) == FAILURE || + (intersect_data_compare_func && + intersect_data_compare_func((zval**)p->pData, data TSRMLS_CC) != 0) + ) { + ok = 0; + break; + } + } + if (ok) { + Z_ADDREF_PP((zval**)p->pData); + zend_hash_quick_update(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength, p->h, p->pData, sizeof(zval*), NULL); + } + } + } +out: + efree(args); +} +/* }}} */ + +static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_compare_type, int key_compare_type) /* {{{ */ +{ + zval ***args = NULL; + HashTable *hash; + int arr_argc, i, c = 0; + Bucket ***lists, **list, ***ptrs, *p; + int req_args; + char *param_spec; + zend_fcall_info fci1, fci2; + zend_fcall_info_cache fci1_cache = empty_fcall_info_cache, fci2_cache = empty_fcall_info_cache; + zend_fcall_info *fci_key, *fci_data; + zend_fcall_info_cache *fci_key_cache, *fci_data_cache; + PHP_ARRAY_CMP_FUNC_VARS; + + int (*intersect_key_compare_func)(const void *, const void * TSRMLS_DC); + int (*intersect_data_compare_func)(const void *, const void * TSRMLS_DC); + + if (behavior == INTERSECT_NORMAL) { + intersect_key_compare_func = php_array_key_compare; + + if (data_compare_type == INTERSECT_COMP_DATA_INTERNAL) { + /* array_intersect() */ + req_args = 2; + param_spec = "+"; + intersect_data_compare_func = php_array_data_compare; + } else if (data_compare_type == INTERSECT_COMP_DATA_USER) { + /* array_uintersect() */ + req_args = 3; + param_spec = "+f"; + intersect_data_compare_func = php_array_user_compare; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_compare_type is %d. This should never happen. Please report as a bug", data_compare_type); + return; + } + + if (ZEND_NUM_ARGS() < req_args) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); + return; + } + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, param_spec, &args, &arr_argc, &fci1, &fci1_cache) == FAILURE) { + return; + } + fci_data = &fci1; + fci_data_cache = &fci1_cache; + + } else if (behavior & INTERSECT_ASSOC) { /* triggered also when INTERSECT_KEY */ + /* INTERSECT_KEY is subset of INTERSECT_ASSOC. When having the former + * no comparison of the data is done (part of INTERSECT_ASSOC) */ + intersect_key_compare_func = php_array_key_compare; + + if (data_compare_type == INTERSECT_COMP_DATA_INTERNAL && key_compare_type == INTERSECT_COMP_KEY_INTERNAL) { + /* array_intersect_assoc() or array_intersect_key() */ + req_args = 2; + param_spec = "+"; + intersect_key_compare_func = php_array_key_compare; + intersect_data_compare_func = php_array_data_compare; + } else if (data_compare_type == INTERSECT_COMP_DATA_USER && key_compare_type == INTERSECT_COMP_KEY_INTERNAL) { + /* array_uintersect_assoc() */ + req_args = 3; + param_spec = "+f"; + intersect_key_compare_func = php_array_key_compare; + intersect_data_compare_func = php_array_user_compare; + fci_data = &fci1; + fci_data_cache = &fci1_cache; + } else if (data_compare_type == INTERSECT_COMP_DATA_INTERNAL && key_compare_type == INTERSECT_COMP_KEY_USER) { + /* array_intersect_uassoc() or array_intersect_ukey() */ + req_args = 3; + param_spec = "+f"; + intersect_key_compare_func = php_array_user_key_compare; + intersect_data_compare_func = php_array_data_compare; + fci_key = &fci1; + fci_key_cache = &fci1_cache; + } else if (data_compare_type == INTERSECT_COMP_DATA_USER && key_compare_type == INTERSECT_COMP_KEY_USER) { + /* array_uintersect_uassoc() */ + req_args = 4; + param_spec = "+ff"; + intersect_key_compare_func = php_array_user_key_compare; + intersect_data_compare_func = php_array_user_compare; + fci_data = &fci1; + fci_data_cache = &fci1_cache; + fci_key = &fci2; + fci_key_cache = &fci2_cache; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_compare_type is %d. key_compare_type is %d. This should never happen. Please report as a bug", data_compare_type, key_compare_type); + return; + } + + if (ZEND_NUM_ARGS() < req_args) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); + return; + } + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, param_spec, &args, &arr_argc, &fci1, &fci1_cache, &fci2, &fci2_cache) == FAILURE) { + return; + } + + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "behavior is %d. This should never happen. Please report as a bug", behavior); + return; + } + + PHP_ARRAY_CMP_FUNC_BACKUP(); + + /* for each argument, create and sort list with pointers to the hash buckets */ + lists = (Bucket ***)safe_emalloc(arr_argc, sizeof(Bucket **), 0); + ptrs = (Bucket ***)safe_emalloc(arr_argc, sizeof(Bucket **), 0); + php_set_compare_func(PHP_SORT_STRING TSRMLS_CC); + + if (behavior == INTERSECT_NORMAL && data_compare_type == INTERSECT_COMP_DATA_USER) { + BG(user_compare_fci) = *fci_data; + BG(user_compare_fci_cache) = *fci_data_cache; + } else if (behavior & INTERSECT_ASSOC && key_compare_type == INTERSECT_COMP_KEY_USER) { + BG(user_compare_fci) = *fci_key; + BG(user_compare_fci_cache) = *fci_key_cache; + } + + for (i = 0; i < arr_argc; i++) { + if (Z_TYPE_PP(args[i]) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is not an array", i + 1); + arr_argc = i; /* only free up to i - 1 */ + goto out; + } + hash = Z_ARRVAL_PP(args[i]); + list = (Bucket **) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket *), hash->persistent); + if (!list) { + PHP_ARRAY_CMP_FUNC_RESTORE(); + + efree(ptrs); + efree(lists); + efree(args); + RETURN_FALSE; + } + lists[i] = list; + ptrs[i] = list; + for (p = hash->pListHead; p; p = p->pListNext) { + *list++ = p; + } + *list = NULL; + if (behavior == INTERSECT_NORMAL) { + zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), intersect_data_compare_func TSRMLS_CC); + } else if (behavior & INTERSECT_ASSOC) { /* triggered also when INTERSECT_KEY */ + zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), intersect_key_compare_func TSRMLS_CC); + } + } + + /* copy the argument array */ + RETVAL_ZVAL(*args[0], 1, 0); + if (return_value->value.ht == &EG(symbol_table)) { + HashTable *ht; + zval *tmp; + + ALLOC_HASHTABLE(ht); + zend_hash_init(ht, zend_hash_num_elements(return_value->value.ht), NULL, ZVAL_PTR_DTOR, 0); + zend_hash_copy(ht, return_value->value.ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + return_value->value.ht = ht; + } + + /* go through the lists and look for common values */ + while (*ptrs[0]) { + if ((behavior & INTERSECT_ASSOC) /* triggered also when INTERSECT_KEY */ + && + key_compare_type == INTERSECT_COMP_KEY_USER) { + + BG(user_compare_fci) = *fci_key; + BG(user_compare_fci_cache) = *fci_key_cache; + } + + for (i = 1; i < arr_argc; i++) { + if (behavior & INTERSECT_NORMAL) { + while (*ptrs[i] && (0 < (c = intersect_data_compare_func(ptrs[0], ptrs[i] TSRMLS_CC)))) { + ptrs[i]++; + } + } else if (behavior & INTERSECT_ASSOC) { /* triggered also when INTERSECT_KEY */ + while (*ptrs[i] && (0 < (c = intersect_key_compare_func(ptrs[0], ptrs[i] TSRMLS_CC)))) { + ptrs[i]++; + } + if ((!c && *ptrs[i]) && (behavior == INTERSECT_ASSOC)) { /* only when INTERSECT_ASSOC */ + /* this means that ptrs[i] is not NULL so we can compare + * and "c==0" is from last operation + * in this branch of code we enter only when INTERSECT_ASSOC + * since when we have INTERSECT_KEY compare of data is not wanted. */ + if (data_compare_type == INTERSECT_COMP_DATA_USER) { + BG(user_compare_fci) = *fci_data; + BG(user_compare_fci_cache) = *fci_data_cache; + } + if (intersect_data_compare_func(ptrs[0], ptrs[i] TSRMLS_CC) != 0) { + c = 1; + if (key_compare_type == INTERSECT_COMP_KEY_USER) { + BG(user_compare_fci) = *fci_key; + BG(user_compare_fci_cache) = *fci_key_cache; + /* When KEY_USER, the last parameter is always the callback */ + } + /* we are going to the break */ + } else { + /* continue looping */ + } + } + } + if (!*ptrs[i]) { + /* delete any values corresponding to remains of ptrs[0] */ + /* and exit because they do not present in at least one of */ + /* the other arguments */ + for (;;) { + p = *ptrs[0]++; + if (!p) { + goto out; + } + if (p->nKeyLength == 0) { + zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); + } else { + zend_hash_quick_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength, p->h); + } + } + } + if (c) /* here we get if not all are equal */ + break; + ptrs[i]++; + } + if (c) { + /* Value of ptrs[0] not in all arguments, delete all entries */ + /* with value < value of ptrs[i] */ + for (;;) { + p = *ptrs[0]; + if (p->nKeyLength == 0) { + zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); + } else { + zend_hash_quick_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength, p->h); + } + if (!*++ptrs[0]) { + goto out; + } + if (behavior == INTERSECT_NORMAL) { + if (0 <= intersect_data_compare_func(ptrs[0], ptrs[i] TSRMLS_CC)) { + break; + } + } else if (behavior & INTERSECT_ASSOC) { /* triggered also when INTERSECT_KEY */ + /* no need of looping because indexes are unique */ + break; + } + } + } else { + /* ptrs[0] is present in all the arguments */ + /* Skip all entries with same value as ptrs[0] */ + for (;;) { + if (!*++ptrs[0]) { + goto out; + } + if (behavior == INTERSECT_NORMAL) { + if (intersect_data_compare_func(ptrs[0] - 1, ptrs[0] TSRMLS_CC)) { + break; + } + } else if (behavior & INTERSECT_ASSOC) { /* triggered also when INTERSECT_KEY */ + /* no need of looping because indexes are unique */ + break; + } + } + } + } +out: + for (i = 0; i < arr_argc; i++) { + hash = Z_ARRVAL_PP(args[i]); + pefree(lists[i], hash->persistent); + } + + PHP_ARRAY_CMP_FUNC_RESTORE(); + + efree(ptrs); + efree(lists); + efree(args); +} +/* }}} */ + +/* {{{ proto array array_intersect_key(array arr1, array arr2 [, array ...]) + Returns the entries of arr1 that have keys which are present in all the other arguments. Kind of equivalent to array_diff(array_keys($arr1), array_keys($arr2)[,array_keys(...)]). Equivalent of array_intersect_assoc() but does not do compare of the data. */ +PHP_FUNCTION(array_intersect_key) +{ + php_array_intersect_key(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_COMP_DATA_NONE); +} +/* }}} */ + +/* {{{ proto array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func) + Returns the entries of arr1 that have keys which are present in all the other arguments. Kind of equivalent to array_diff(array_keys($arr1), array_keys($arr2)[,array_keys(...)]). The comparison of the keys is performed by a user supplied function. Equivalent of array_intersect_uassoc() but does not do compare of the data. */ +PHP_FUNCTION(array_intersect_ukey) +{ + php_array_intersect(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_KEY, INTERSECT_COMP_DATA_INTERNAL, INTERSECT_COMP_KEY_USER); +} +/* }}} */ + +/* {{{ proto array array_intersect(array arr1, array arr2 [, array ...]) + Returns the entries of arr1 that have values which are present in all the other arguments */ +PHP_FUNCTION(array_intersect) +{ + php_array_intersect(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_NORMAL, INTERSECT_COMP_DATA_INTERNAL, INTERSECT_COMP_KEY_INTERNAL); +} +/* }}} */ + +/* {{{ proto array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func) + Returns the entries of arr1 that have values which are present in all the other arguments. Data is compared by using an user-supplied callback. */ +PHP_FUNCTION(array_uintersect) +{ + php_array_intersect(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_NORMAL, INTERSECT_COMP_DATA_USER, INTERSECT_COMP_KEY_INTERNAL); +} +/* }}} */ + +/* {{{ proto array array_intersect_assoc(array arr1, array arr2 [, array ...]) + Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check */ +PHP_FUNCTION(array_intersect_assoc) +{ + php_array_intersect_key(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_COMP_DATA_INTERNAL); +} +/* }}} */ + +/* {{{ proto array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func) U + Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check and they are compared by using an user-supplied callback. */ +PHP_FUNCTION(array_intersect_uassoc) +{ + php_array_intersect(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_ASSOC, INTERSECT_COMP_DATA_INTERNAL, INTERSECT_COMP_KEY_USER); +} +/* }}} */ + +/* {{{ proto array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func) U + Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Data is compared by using an user-supplied callback. */ +PHP_FUNCTION(array_uintersect_assoc) +{ + php_array_intersect_key(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_COMP_DATA_USER); +} +/* }}} */ + +/* {{{ proto array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func) + Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks. */ +PHP_FUNCTION(array_uintersect_uassoc) +{ + php_array_intersect(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_ASSOC, INTERSECT_COMP_DATA_USER, INTERSECT_COMP_KEY_USER); +} +/* }}} */ + +static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_type) /* {{{ */ +{ + Bucket *p; + int argc, i; + zval ***args; + int (*diff_data_compare_func)(zval **, zval ** TSRMLS_DC) = NULL; + zend_bool ok; + zval **data; + + /* Get the argument count */ + argc = ZEND_NUM_ARGS(); + if (data_compare_type == DIFF_COMP_DATA_USER) { + if (argc < 3) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "at least 3 parameters are required, %d given", ZEND_NUM_ARGS()); + return; + } + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+f", &args, &argc, &BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE) { + return; + } + diff_data_compare_func = zval_user_compare; + } else { + if (argc < 2) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "at least 2 parameters are required, %d given", ZEND_NUM_ARGS()); + return; + } + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) { + return; + } + if (data_compare_type == DIFF_COMP_DATA_INTERNAL) { + diff_data_compare_func = zval_compare; + } + } + + for (i = 0; i < argc; i++) { + if (Z_TYPE_PP(args[i]) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is not an array", i + 1); + RETVAL_NULL(); + goto out; + } + } + + array_init(return_value); + + for (p = Z_ARRVAL_PP(args[0])->pListHead; p != NULL; p = p->pListNext) { + if (p->nKeyLength == 0) { + ok = 1; + for (i = 1; i < argc; i++) { + if (zend_hash_index_find(Z_ARRVAL_PP(args[i]), p->h, (void**)&data) == SUCCESS && + (!diff_data_compare_func || + diff_data_compare_func((zval**)p->pData, data TSRMLS_CC) == 0) + ) { + ok = 0; + break; + } + } + if (ok) { + Z_ADDREF_PP((zval**)p->pData); + zend_hash_index_update(Z_ARRVAL_P(return_value), p->h, p->pData, sizeof(zval*), NULL); + } + } else { + ok = 1; + for (i = 1; i < argc; i++) { + if (zend_hash_quick_find(Z_ARRVAL_PP(args[i]), p->arKey, p->nKeyLength, p->h, (void**)&data) == SUCCESS && + (!diff_data_compare_func || + diff_data_compare_func((zval**)p->pData, data TSRMLS_CC) == 0) + ) { + ok = 0; + break; + } + } + if (ok) { + Z_ADDREF_PP((zval**)p->pData); + zend_hash_quick_update(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength, p->h, p->pData, sizeof(zval*), NULL); + } + } + } +out: + efree(args); +} +/* }}} */ + +static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_compare_type, int key_compare_type) /* {{{ */ +{ + zval ***args = NULL; + HashTable *hash; + int arr_argc, i, c; + Bucket ***lists, **list, ***ptrs, *p; + int req_args; + char *param_spec; + zend_fcall_info fci1, fci2; + zend_fcall_info_cache fci1_cache = empty_fcall_info_cache, fci2_cache = empty_fcall_info_cache; + zend_fcall_info *fci_key, *fci_data; + zend_fcall_info_cache *fci_key_cache, *fci_data_cache; + PHP_ARRAY_CMP_FUNC_VARS; + + int (*diff_key_compare_func)(const void *, const void * TSRMLS_DC); + int (*diff_data_compare_func)(const void *, const void * TSRMLS_DC); + + if (behavior == DIFF_NORMAL) { + diff_key_compare_func = php_array_key_compare; + + if (data_compare_type == DIFF_COMP_DATA_INTERNAL) { + /* array_diff */ + req_args = 2; + param_spec = "+"; + diff_data_compare_func = php_array_data_compare; + } else if (data_compare_type == DIFF_COMP_DATA_USER) { + /* array_udiff */ + req_args = 3; + param_spec = "+f"; + diff_data_compare_func = php_array_user_compare; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_compare_type is %d. This should never happen. Please report as a bug", data_compare_type); + return; + } + + if (ZEND_NUM_ARGS() < req_args) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); + return; + } + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, param_spec, &args, &arr_argc, &fci1, &fci1_cache) == FAILURE) { + return; + } + fci_data = &fci1; + fci_data_cache = &fci1_cache; + + } else if (behavior & DIFF_ASSOC) { /* triggered also if DIFF_KEY */ + /* DIFF_KEY is subset of DIFF_ASSOC. When having the former + * no comparison of the data is done (part of DIFF_ASSOC) */ + + if (data_compare_type == DIFF_COMP_DATA_INTERNAL && key_compare_type == DIFF_COMP_KEY_INTERNAL) { + /* array_diff_assoc() or array_diff_key() */ + req_args = 2; + param_spec = "+"; + diff_key_compare_func = php_array_key_compare; + diff_data_compare_func = php_array_data_compare; + } else if (data_compare_type == DIFF_COMP_DATA_USER && key_compare_type == DIFF_COMP_KEY_INTERNAL) { + /* array_udiff_assoc() */ + req_args = 3; + param_spec = "+f"; + diff_key_compare_func = php_array_key_compare; + diff_data_compare_func = php_array_user_compare; + fci_data = &fci1; + fci_data_cache = &fci1_cache; + } else if (data_compare_type == DIFF_COMP_DATA_INTERNAL && key_compare_type == DIFF_COMP_KEY_USER) { + /* array_diff_uassoc() or array_diff_ukey() */ + req_args = 3; + param_spec = "+f"; + diff_key_compare_func = php_array_user_key_compare; + diff_data_compare_func = php_array_data_compare; + fci_key = &fci1; + fci_key_cache = &fci1_cache; + } else if (data_compare_type == DIFF_COMP_DATA_USER && key_compare_type == DIFF_COMP_KEY_USER) { + /* array_udiff_uassoc() */ + req_args = 4; + param_spec = "+ff"; + diff_key_compare_func = php_array_user_key_compare; + diff_data_compare_func = php_array_user_compare; + fci_data = &fci1; + fci_data_cache = &fci1_cache; + fci_key = &fci2; + fci_key_cache = &fci2_cache; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_compare_type is %d. key_compare_type is %d. This should never happen. Please report as a bug", data_compare_type, key_compare_type); + return; + } + + if (ZEND_NUM_ARGS() < req_args) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); + return; + } + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, param_spec, &args, &arr_argc, &fci1, &fci1_cache, &fci2, &fci2_cache) == FAILURE) { + return; + } + + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "behavior is %d. This should never happen. Please report as a bug", behavior); + return; + } + + PHP_ARRAY_CMP_FUNC_BACKUP(); + + /* for each argument, create and sort list with pointers to the hash buckets */ + lists = (Bucket ***)safe_emalloc(arr_argc, sizeof(Bucket **), 0); + ptrs = (Bucket ***)safe_emalloc(arr_argc, sizeof(Bucket **), 0); + php_set_compare_func(PHP_SORT_STRING TSRMLS_CC); + + if (behavior == DIFF_NORMAL && data_compare_type == DIFF_COMP_DATA_USER) { + BG(user_compare_fci) = *fci_data; + BG(user_compare_fci_cache) = *fci_data_cache; + } else if (behavior & DIFF_ASSOC && key_compare_type == DIFF_COMP_KEY_USER) { + BG(user_compare_fci) = *fci_key; + BG(user_compare_fci_cache) = *fci_key_cache; + } + + for (i = 0; i < arr_argc; i++) { + if (Z_TYPE_PP(args[i]) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is not an array", i + 1); + arr_argc = i; /* only free up to i - 1 */ + goto out; + } + hash = Z_ARRVAL_PP(args[i]); + list = (Bucket **) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket *), hash->persistent); + if (!list) { + PHP_ARRAY_CMP_FUNC_RESTORE(); + + efree(ptrs); + efree(lists); + efree(args); + RETURN_FALSE; + } + lists[i] = list; + ptrs[i] = list; + for (p = hash->pListHead; p; p = p->pListNext) { + *list++ = p; + } + *list = NULL; + if (behavior == DIFF_NORMAL) { + zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), diff_data_compare_func TSRMLS_CC); + } else if (behavior & DIFF_ASSOC) { /* triggered also when DIFF_KEY */ + zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), diff_key_compare_func TSRMLS_CC); + } + } + + /* copy the argument array */ + RETVAL_ZVAL(*args[0], 1, 0); + if (return_value->value.ht == &EG(symbol_table)) { + HashTable *ht; + zval *tmp; + + ALLOC_HASHTABLE(ht); + zend_hash_init(ht, zend_hash_num_elements(return_value->value.ht), NULL, ZVAL_PTR_DTOR, 0); + zend_hash_copy(ht, return_value->value.ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + return_value->value.ht = ht; + } + + /* go through the lists and look for values of ptr[0] that are not in the others */ + while (*ptrs[0]) { + if ((behavior & DIFF_ASSOC) /* triggered also when DIFF_KEY */ + && + key_compare_type == DIFF_COMP_KEY_USER + ) { + BG(user_compare_fci) = *fci_key; + BG(user_compare_fci_cache) = *fci_key_cache; + } + c = 1; + for (i = 1; i < arr_argc; i++) { + Bucket **ptr = ptrs[i]; + if (behavior == DIFF_NORMAL) { + while (*ptrs[i] && (0 < (c = diff_data_compare_func(ptrs[0], ptrs[i] TSRMLS_CC)))) { + ptrs[i]++; + } + } else if (behavior & DIFF_ASSOC) { /* triggered also when DIFF_KEY */ + while (*ptr && (0 != (c = diff_key_compare_func(ptrs[0], ptr TSRMLS_CC)))) { + ptr++; + } + } + if (!c) { + if (behavior == DIFF_NORMAL) { + if (*ptrs[i]) { + ptrs[i]++; + } + break; + } else if (behavior == DIFF_ASSOC) { /* only when DIFF_ASSOC */ + /* In this branch is execute only when DIFF_ASSOC. If behavior == DIFF_KEY + * data comparison is not needed - skipped. */ + if (*ptr) { + if (data_compare_type == DIFF_COMP_DATA_USER) { + BG(user_compare_fci) = *fci_data; + BG(user_compare_fci_cache) = *fci_data_cache; + } + if (diff_data_compare_func(ptrs[0], ptr TSRMLS_CC) != 0) { + /* the data is not the same */ + c = -1; + if (key_compare_type == DIFF_COMP_KEY_USER) { + BG(user_compare_fci) = *fci_key; + BG(user_compare_fci_cache) = *fci_key_cache; + } + } else { + break; + /* we have found the element in other arrays thus we don't want it + * in the return_value -> delete from there */ + } + } + } else if (behavior == DIFF_KEY) { /* only when DIFF_KEY */ + /* the behavior here differs from INTERSECT_KEY in php_intersect + * since in the "diff" case we have to remove the entry from + * return_value while when doing intersection the entry must not + * be deleted. */ + break; /* remove the key */ + } + } + } + if (!c) { + /* ptrs[0] in one of the other arguments */ + /* delete all entries with value as ptrs[0] */ + for (;;) { + p = *ptrs[0]; + if (p->nKeyLength == 0) { + zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); + } else { + zend_hash_quick_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength, p->h); + } + if (!*++ptrs[0]) { + goto out; + } + if (behavior == DIFF_NORMAL) { + if (diff_data_compare_func(ptrs[0] - 1, ptrs[0] TSRMLS_CC)) { + break; + } + } else if (behavior & DIFF_ASSOC) { /* triggered also when DIFF_KEY */ + /* in this case no array_key_compare is needed */ + break; + } + } + } else { + /* ptrs[0] in none of the other arguments */ + /* skip all entries with value as ptrs[0] */ + for (;;) { + if (!*++ptrs[0]) { + goto out; + } + if (behavior == DIFF_NORMAL) { + if (diff_data_compare_func(ptrs[0] - 1, ptrs[0] TSRMLS_CC)) { + break; + } + } else if (behavior & DIFF_ASSOC) { /* triggered also when DIFF_KEY */ + /* in this case no array_key_compare is needed */ + break; + } + } + } + } +out: + for (i = 0; i < arr_argc; i++) { + hash = Z_ARRVAL_PP(args[i]); + pefree(lists[i], hash->persistent); + } + + PHP_ARRAY_CMP_FUNC_RESTORE(); + + efree(ptrs); + efree(lists); + efree(args); +} +/* }}} */ + +/* {{{ proto array array_diff_key(array arr1, array arr2 [, array ...]) + Returns the entries of arr1 that have keys which are not present in any of the others arguments. This function is like array_diff() but works on the keys instead of the values. The associativity is preserved. */ +PHP_FUNCTION(array_diff_key) +{ + php_array_diff_key(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_COMP_DATA_NONE); +} +/* }}} */ + +/* {{{ proto array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func) + Returns the entries of arr1 that have keys which are not present in any of the others arguments. User supplied function is used for comparing the keys. This function is like array_udiff() but works on the keys instead of the values. The associativity is preserved. */ +PHP_FUNCTION(array_diff_ukey) +{ + php_array_diff(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_KEY, DIFF_COMP_DATA_INTERNAL, DIFF_COMP_KEY_USER); +} +/* }}} */ + +/* {{{ proto array array_diff(array arr1, array arr2 [, array ...]) + Returns the entries of arr1 that have values which are not present in any of the others arguments. */ +PHP_FUNCTION(array_diff) +{ + php_array_diff(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_NORMAL, DIFF_COMP_DATA_INTERNAL, DIFF_COMP_KEY_INTERNAL); +} +/* }}} */ + +/* {{{ proto array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func) + Returns the entries of arr1 that have values which are not present in any of the others arguments. Elements are compared by user supplied function. */ +PHP_FUNCTION(array_udiff) +{ + php_array_diff(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_NORMAL, DIFF_COMP_DATA_USER, DIFF_COMP_KEY_INTERNAL); +} +/* }}} */ + +/* {{{ proto array array_diff_assoc(array arr1, array arr2 [, array ...]) + Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal */ +PHP_FUNCTION(array_diff_assoc) +{ + php_array_diff_key(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_COMP_DATA_INTERNAL); +} +/* }}} */ + +/* {{{ proto array array_diff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func) + Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Elements are compared by user supplied function. */ +PHP_FUNCTION(array_diff_uassoc) +{ + php_array_diff(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_ASSOC, DIFF_COMP_DATA_INTERNAL, DIFF_COMP_KEY_USER); +} +/* }}} */ + +/* {{{ proto array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func) + Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function. */ +PHP_FUNCTION(array_udiff_assoc) +{ + php_array_diff_key(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_COMP_DATA_USER); +} +/* }}} */ + +/* {{{ proto array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func) + Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions. */ +PHP_FUNCTION(array_udiff_uassoc) +{ + php_array_diff(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_ASSOC, DIFF_COMP_DATA_USER, DIFF_COMP_KEY_USER); +} +/* }}} */ + +#define MULTISORT_ORDER 0 +#define MULTISORT_TYPE 1 +#define MULTISORT_LAST 2 + +PHPAPI int php_multisort_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ +{ + Bucket **ab = *(Bucket ***)a; + Bucket **bb = *(Bucket ***)b; + int r; + int result = 0; + zval temp; + + r = 0; + do { + php_set_compare_func(ARRAYG(multisort_flags)[MULTISORT_TYPE][r] TSRMLS_CC); + + ARRAYG(compare_func)(&temp, *((zval **)ab[r]->pData), *((zval **)bb[r]->pData) TSRMLS_CC); + result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * Z_LVAL(temp); + if (result != 0) { + return result; + } + r++; + } while (ab[r] != NULL); + + return result; +} +/* }}} */ + +#define MULTISORT_ABORT \ + for (k = 0; k < MULTISORT_LAST; k++) \ + efree(ARRAYG(multisort_flags)[k]); \ + efree(arrays); \ + efree(args); \ + RETURN_FALSE; + +/* {{{ proto bool array_multisort(array ar1 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_NATURAL|SORT_FLAG_CASE]] [, array ar2 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_NATURAL|SORT_FLAG_CASE]], ...]) + Sort multiple arrays at once similar to how ORDER BY clause works in SQL */ +PHP_FUNCTION(array_multisort) +{ + zval*** args; + zval*** arrays; + Bucket*** indirect; + Bucket* p; + HashTable* hash; + int argc; + int array_size; + int num_arrays = 0; + int parse_state[MULTISORT_LAST]; /* 0 - flag not allowed 1 - flag allowed */ + int sort_order = PHP_SORT_ASC; + int sort_type = PHP_SORT_REGULAR; + int i, k; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) { + return; + } + + /* Allocate space for storing pointers to input arrays and sort flags. */ + arrays = (zval ***)ecalloc(argc, sizeof(zval **)); + for (i = 0; i < MULTISORT_LAST; i++) { + parse_state[i] = 0; + ARRAYG(multisort_flags)[i] = (int *)ecalloc(argc, sizeof(int)); + } + + /* Here we go through the input arguments and parse them. Each one can + * be either an array or a sort flag which follows an array. If not + * specified, the sort flags defaults to PHP_SORT_ASC and PHP_SORT_REGULAR + * accordingly. There can't be two sort flags of the same type after an + * array, and the very first argument has to be an array. */ + for (i = 0; i < argc; i++) { + if (Z_TYPE_PP(args[i]) == IS_ARRAY) { + /* We see the next array, so we update the sort flags of + * the previous array and reset the sort flags. */ + if (i > 0) { + ARRAYG(multisort_flags)[MULTISORT_ORDER][num_arrays - 1] = sort_order; + ARRAYG(multisort_flags)[MULTISORT_TYPE][num_arrays - 1] = sort_type; + sort_order = PHP_SORT_ASC; + sort_type = PHP_SORT_REGULAR; + } + arrays[num_arrays++] = args[i]; + + /* Next one may be an array or a list of sort flags. */ + for (k = 0; k < MULTISORT_LAST; k++) { + parse_state[k] = 1; + } + } else if (Z_TYPE_PP(args[i]) == IS_LONG) { + switch (Z_LVAL_PP(args[i]) & ~PHP_SORT_FLAG_CASE) { + case PHP_SORT_ASC: + case PHP_SORT_DESC: + /* flag allowed here */ + if (parse_state[MULTISORT_ORDER] == 1) { + /* Save the flag and make sure then next arg is not the current flag. */ + sort_order = Z_LVAL_PP(args[i]) == PHP_SORT_DESC ? -1 : 1; + parse_state[MULTISORT_ORDER] = 0; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1); + MULTISORT_ABORT; + } + break; + + case PHP_SORT_REGULAR: + case PHP_SORT_NUMERIC: + case PHP_SORT_STRING: + case PHP_SORT_NATURAL: +#if HAVE_STRCOLL + case PHP_SORT_LOCALE_STRING: +#endif + /* flag allowed here */ + if (parse_state[MULTISORT_TYPE] == 1) { + /* Save the flag and make sure then next arg is not the current flag. */ + sort_type = Z_LVAL_PP(args[i]); + parse_state[MULTISORT_TYPE] = 0; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1); + MULTISORT_ABORT; + } + break; + + default: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is an unknown sort flag", i + 1); + MULTISORT_ABORT; + break; + + } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or a sort flag", i + 1); + MULTISORT_ABORT; + } + } + /* Take care of the last array sort flags. */ + ARRAYG(multisort_flags)[MULTISORT_ORDER][num_arrays - 1] = sort_order; + ARRAYG(multisort_flags)[MULTISORT_TYPE][num_arrays - 1] = sort_type; + + /* Make sure the arrays are of the same size. */ + array_size = zend_hash_num_elements(Z_ARRVAL_PP(arrays[0])); + for (i = 0; i < num_arrays; i++) { + if (zend_hash_num_elements(Z_ARRVAL_PP(arrays[i])) != array_size) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array sizes are inconsistent"); + MULTISORT_ABORT; + } + } + + /* If all arrays are empty we don't need to do anything. */ + if (array_size < 1) { + for (k = 0; k < MULTISORT_LAST; k++) { + efree(ARRAYG(multisort_flags)[k]); + } + efree(arrays); + efree(args); + RETURN_TRUE; + } + + /* Create the indirection array. This array is of size MxN, where + * M is the number of entries in each input array and N is the number + * of the input arrays + 1. The last column is NULL to indicate the end + * of the row. */ + indirect = (Bucket ***)safe_emalloc(array_size, sizeof(Bucket **), 0); + for (i = 0; i < array_size; i++) { + indirect[i] = (Bucket **)safe_emalloc((num_arrays + 1), sizeof(Bucket *), 0); + } + for (i = 0; i < num_arrays; i++) { + k = 0; + for (p = Z_ARRVAL_PP(arrays[i])->pListHead; p; p = p->pListNext, k++) { + indirect[k][i] = p; + } + } + for (k = 0; k < array_size; k++) { + indirect[k][num_arrays] = NULL; + } + + /* Do the actual sort magic - bada-bim, bada-boom. */ + zend_qsort(indirect, array_size, sizeof(Bucket **), php_multisort_compare TSRMLS_CC); + + /* Restructure the arrays based on sorted indirect - this is mostly taken from zend_hash_sort() function. */ + HANDLE_BLOCK_INTERRUPTIONS(); + for (i = 0; i < num_arrays; i++) { + hash = Z_ARRVAL_PP(arrays[i]); + hash->pListHead = indirect[0][i];; + hash->pListTail = NULL; + hash->pInternalPointer = hash->pListHead; + + for (k = 0; k < array_size; k++) { + if (hash->pListTail) { + hash->pListTail->pListNext = indirect[k][i]; + } + indirect[k][i]->pListLast = hash->pListTail; + indirect[k][i]->pListNext = NULL; + hash->pListTail = indirect[k][i]; + } + + p = hash->pListHead; + k = 0; + while (p != NULL) { + if (p->nKeyLength == 0) + p->h = k++; + p = p->pListNext; + } + hash->nNextFreeElement = array_size; + zend_hash_rehash(hash); + } + HANDLE_UNBLOCK_INTERRUPTIONS(); + + /* Clean up. */ + for (i = 0; i < array_size; i++) { + efree(indirect[i]); + } + efree(indirect); + for (k = 0; k < MULTISORT_LAST; k++) { + efree(ARRAYG(multisort_flags)[k]); + } + efree(arrays); + efree(args); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto mixed array_rand(array input [, int num_req]) + Return key/keys for random entry/entries in the array */ +PHP_FUNCTION(array_rand) +{ + zval *input; + long randval, num_req = 1; + int num_avail, key_type; + char *string_key; + uint string_key_len; + ulong num_key; + HashPosition pos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &input, &num_req) == FAILURE) { + return; + } + + num_avail = zend_hash_num_elements(Z_ARRVAL_P(input)); + + if (ZEND_NUM_ARGS() > 1) { + if (num_req <= 0 || num_req > num_avail) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument has to be between 1 and the number of elements in the array"); + return; + } + } + + /* Make the return value an array only if we need to pass back more than one result. */ + if (num_req > 1) { + array_init_size(return_value, num_req); + } + + /* We can't use zend_hash_index_find() because the array may have string keys or gaps. */ + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos); + while (num_req && (key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &string_key, &string_key_len, &num_key, 0, &pos)) != HASH_KEY_NON_EXISTANT) { + + randval = php_rand(TSRMLS_C); + + if ((double) (randval / (PHP_RAND_MAX + 1.0)) < (double) num_req / (double) num_avail) { + /* If we are returning a single result, just do it. */ + if (Z_TYPE_P(return_value) != IS_ARRAY) { + if (key_type == HASH_KEY_IS_STRING) { + RETURN_STRINGL(string_key, string_key_len - 1, 1); + } else { + RETURN_LONG(num_key); + } + } else { + /* Append the result to the return value. */ + if (key_type == HASH_KEY_IS_STRING) { + add_next_index_stringl(return_value, string_key, string_key_len - 1, 1); + } else { + add_next_index_long(return_value, num_key); + } + } + num_req--; + } + num_avail--; + zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos); + } +} +/* }}} */ + +/* {{{ proto mixed array_sum(array input) + Returns the sum of the array entries */ +PHP_FUNCTION(array_sum) +{ + zval *input, + **entry, + entry_n; + HashPosition pos; + double dval; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &input) == FAILURE) { + return; + } + + ZVAL_LONG(return_value, 0); + + for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos); + zend_hash_get_current_data_ex(Z_ARRVAL_P(input), (void **)&entry, &pos) == SUCCESS; + zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos) + ) { + if (Z_TYPE_PP(entry) == IS_ARRAY || Z_TYPE_PP(entry) == IS_OBJECT) { + continue; + } + entry_n = **entry; + zval_copy_ctor(&entry_n); + convert_scalar_to_number(&entry_n TSRMLS_CC); + + if (Z_TYPE(entry_n) == IS_LONG && Z_TYPE_P(return_value) == IS_LONG) { + dval = (double)Z_LVAL_P(return_value) + (double)Z_LVAL(entry_n); + if ( (double)LONG_MIN <= dval && dval <= (double)LONG_MAX ) { + Z_LVAL_P(return_value) += Z_LVAL(entry_n); + continue; + } + } + convert_to_double(return_value); + convert_to_double(&entry_n); + Z_DVAL_P(return_value) += Z_DVAL(entry_n); + } +} +/* }}} */ + +/* {{{ proto mixed array_product(array input) + Returns the product of the array entries */ +PHP_FUNCTION(array_product) +{ + zval *input, + **entry, + entry_n; + HashPosition pos; + double dval; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &input) == FAILURE) { + return; + } + + ZVAL_LONG(return_value, 1); + if (!zend_hash_num_elements(Z_ARRVAL_P(input))) { + return; + } + + for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos); + zend_hash_get_current_data_ex(Z_ARRVAL_P(input), (void **)&entry, &pos) == SUCCESS; + zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos) + ) { + if (Z_TYPE_PP(entry) == IS_ARRAY || Z_TYPE_PP(entry) == IS_OBJECT) { + continue; + } + entry_n = **entry; + zval_copy_ctor(&entry_n); + convert_scalar_to_number(&entry_n TSRMLS_CC); + + if (Z_TYPE(entry_n) == IS_LONG && Z_TYPE_P(return_value) == IS_LONG) { + dval = (double)Z_LVAL_P(return_value) * (double)Z_LVAL(entry_n); + if ( (double)LONG_MIN <= dval && dval <= (double)LONG_MAX ) { + Z_LVAL_P(return_value) *= Z_LVAL(entry_n); + continue; + } + } + convert_to_double(return_value); + convert_to_double(&entry_n); + Z_DVAL_P(return_value) *= Z_DVAL(entry_n); + } +} +/* }}} */ + +/* {{{ proto mixed array_reduce(array input, mixed callback [, mixed initial]) + Iteratively reduce the array to a single value via the callback. */ +PHP_FUNCTION(array_reduce) +{ + zval *input; + zval **args[2]; + zval **operand; + zval *result = NULL; + zval *retval; + zend_fcall_info fci; + zend_fcall_info_cache fci_cache = empty_fcall_info_cache; + zval *initial = NULL; + HashPosition pos; + HashTable *htbl; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "af|z", &input, &fci, &fci_cache, &initial) == FAILURE) { + return; + } + + if (ZEND_NUM_ARGS() > 2) { + ALLOC_ZVAL(result); + MAKE_COPY_ZVAL(&initial, result); + } else { + MAKE_STD_ZVAL(result); + ZVAL_NULL(result); + } + + /* (zval **)input points to an element of argument stack + * the base pointer of which is subject to change. + * thus we need to keep the pointer to the hashtable for safety */ + htbl = Z_ARRVAL_P(input); + + if (zend_hash_num_elements(htbl) == 0) { + if (result) { + RETVAL_ZVAL(result, 1, 1); + } + return; + } + + fci.retval_ptr_ptr = &retval; + fci.param_count = 2; + fci.no_separation = 0; + + zend_hash_internal_pointer_reset_ex(htbl, &pos); + while (zend_hash_get_current_data_ex(htbl, (void **)&operand, &pos) == SUCCESS) { + + if (result) { + args[0] = &result; + args[1] = operand; + fci.params = args; + + if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && retval) { + zval_ptr_dtor(&result); + result = retval; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the reduction callback"); + return; + } + } else { + result = *operand; + zval_add_ref(&result); + } + zend_hash_move_forward_ex(htbl, &pos); + } + RETVAL_ZVAL(result, 1, 1); +} +/* }}} */ + +/* {{{ proto array array_filter(array input [, mixed callback]) + Filters elements from the array via the callback. */ +PHP_FUNCTION(array_filter) +{ + zval *array; + zval **operand; + zval **args[1]; + zval *retval = NULL; + zend_bool have_callback = 0; + char *string_key; + zend_fcall_info fci = empty_fcall_info; + zend_fcall_info_cache fci_cache = empty_fcall_info_cache; + uint string_key_len; + ulong num_key; + HashPosition pos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|f", &array, &fci, &fci_cache) == FAILURE) { + return; + } + + array_init(return_value); + if (zend_hash_num_elements(Z_ARRVAL_P(array)) == 0) { + return; + } + + if (ZEND_NUM_ARGS() > 1) { + have_callback = 1; + fci.no_separation = 0; + fci.retval_ptr_ptr = &retval; + fci.param_count = 1; + } + + for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos); + zend_hash_get_current_data_ex(Z_ARRVAL_P(array), (void **)&operand, &pos) == SUCCESS; + zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos) + ) { + if (have_callback) { + args[0] = operand; + fci.params = args; + + if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && retval) { + if (!zend_is_true(retval)) { + zval_ptr_dtor(&retval); + continue; + } else { + zval_ptr_dtor(&retval); + } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the filter callback"); + return; + } + } else if (!zend_is_true(*operand)) { + continue; + } + + zval_add_ref(operand); + switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(array), &string_key, &string_key_len, &num_key, 0, &pos)) { + case HASH_KEY_IS_STRING: + zend_hash_update(Z_ARRVAL_P(return_value), string_key, string_key_len, operand, sizeof(zval *), NULL); + break; + + case HASH_KEY_IS_LONG: + zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, operand, sizeof(zval *), NULL); + break; + } + } +} +/* }}} */ + +/* {{{ proto array array_map(mixed callback, array input1 [, array input2 ,...]) + Applies the callback to the elements in given arrays. */ +PHP_FUNCTION(array_map) +{ + zval ***arrays = NULL; + int n_arrays = 0; + zval ***params; + zval *result, *null; + HashPosition *array_pos; + zval **args; + zend_fcall_info fci = empty_fcall_info; + zend_fcall_info_cache fci_cache = empty_fcall_info_cache; + int i, k, maxlen = 0; + int *array_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f!+", &fci, &fci_cache, &arrays, &n_arrays) == FAILURE) { + return; + } + + RETVAL_NULL(); + + args = (zval **)safe_emalloc(n_arrays, sizeof(zval *), 0); + array_len = (int *)safe_emalloc(n_arrays, sizeof(int), 0); + array_pos = (HashPosition *)safe_emalloc(n_arrays, sizeof(HashPosition), 0); + + for (i = 0; i < n_arrays; i++) { + if (Z_TYPE_PP(arrays[i]) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d should be an array", i + 2); + efree(arrays); + efree(args); + efree(array_len); + efree(array_pos); + return; + } + SEPARATE_ZVAL_IF_NOT_REF(arrays[i]); + args[i] = *arrays[i]; + array_len[i] = zend_hash_num_elements(Z_ARRVAL_PP(arrays[i])); + if (array_len[i] > maxlen) { + maxlen = array_len[i]; + } + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(arrays[i]), &array_pos[i]); + } + + efree(arrays); + + /* Short-circuit: if no callback and only one array, just return it. */ + if (!ZEND_FCI_INITIALIZED(fci) && n_arrays == 1) { + RETVAL_ZVAL(args[0], 1, 0); + efree(array_len); + efree(array_pos); + efree(args); + return; + } + + array_init_size(return_value, maxlen); + params = (zval ***)safe_emalloc(n_arrays, sizeof(zval **), 0); + MAKE_STD_ZVAL(null); + ZVAL_NULL(null); + + /* We iterate through all the arrays at once. */ + for (k = 0; k < maxlen; k++) { + uint str_key_len; + ulong num_key; + char *str_key; + int key_type = 0; + + /* If no callback, the result will be an array, consisting of current + * entries from all arrays. */ + if (!ZEND_FCI_INITIALIZED(fci)) { + MAKE_STD_ZVAL(result); + array_init_size(result, n_arrays); + } + + for (i = 0; i < n_arrays; i++) { + /* If this array still has elements, add the current one to the + * parameter list, otherwise use null value. */ + if (k < array_len[i]) { + zend_hash_get_current_data_ex(Z_ARRVAL_P(args[i]), (void **)¶ms[i], &array_pos[i]); + + /* It is safe to store only last value of key type, because + * this loop will run just once if there is only 1 array. */ + if (n_arrays == 1) { + key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(args[0]), &str_key, &str_key_len, &num_key, 0, &array_pos[i]); + } + zend_hash_move_forward_ex(Z_ARRVAL_P(args[i]), &array_pos[i]); + } else { + params[i] = &null; + } + + if (!ZEND_FCI_INITIALIZED(fci)) { + zval_add_ref(params[i]); + add_next_index_zval(result, *params[i]); + } + } + + if (ZEND_FCI_INITIALIZED(fci)) { + fci.retval_ptr_ptr = &result; + fci.param_count = n_arrays; + fci.params = params; + fci.no_separation = 0; + + if (zend_call_function(&fci, &fci_cache TSRMLS_CC) != SUCCESS || !result) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the map callback"); + efree(array_len); + efree(args); + efree(array_pos); + zval_dtor(return_value); + zval_ptr_dtor(&null); + efree(params); + RETURN_NULL(); + } + } + + if (n_arrays > 1) { + add_next_index_zval(return_value, result); + } else { + if (key_type == HASH_KEY_IS_STRING) { + add_assoc_zval_ex(return_value, str_key, str_key_len, result); + } else { + add_index_zval(return_value, num_key, result); + } + } + } + + zval_ptr_dtor(&null); + efree(params); + efree(array_len); + efree(array_pos); + efree(args); +} +/* }}} */ + +/* {{{ proto bool array_key_exists(mixed key, array search) + Checks if the given key or index exists in the array */ +PHP_FUNCTION(array_key_exists) +{ + zval *key; /* key to check for */ + HashTable *array; /* array to check in */ + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zH", &key, &array) == FAILURE) { + return; + } + + switch (Z_TYPE_P(key)) { + case IS_STRING: + if (zend_symtable_exists(array, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1)) { + RETURN_TRUE; + } + RETURN_FALSE; + case IS_LONG: + if (zend_hash_index_exists(array, Z_LVAL_P(key))) { + RETURN_TRUE; + } + RETURN_FALSE; + case IS_NULL: + if (zend_hash_exists(array, "", 1)) { + RETURN_TRUE; + } + RETURN_FALSE; + + default: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument should be either a string or an integer"); + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto array array_chunk(array input, int size [, bool preserve_keys]) + Split array into chunks */ +PHP_FUNCTION(array_chunk) +{ + int argc = ZEND_NUM_ARGS(), key_type, num_in; + long size, current = 0; + char *str_key; + uint str_key_len; + ulong num_key; + zend_bool preserve_keys = 0; + zval *input = NULL; + zval *chunk = NULL; + zval **entry; + HashPosition pos; + + if (zend_parse_parameters(argc TSRMLS_CC, "al|b", &input, &size, &preserve_keys) == FAILURE) { + return; + } + /* Do bounds checking for size parameter. */ + if (size < 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Size parameter expected to be greater than 0"); + return; + } + + num_in = zend_hash_num_elements(Z_ARRVAL_P(input)); + + if (size > num_in) { + size = num_in > 0 ? num_in : 1; + } + + array_init_size(return_value, ((num_in - 1) / size) + 1); + + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(input), (void**)&entry, &pos) == SUCCESS) { + /* If new chunk, create and initialize it. */ + if (!chunk) { + MAKE_STD_ZVAL(chunk); + array_init_size(chunk, size); + } + + /* Add entry to the chunk, preserving keys if necessary. */ + zval_add_ref(entry); + + if (preserve_keys) { + key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &str_key, &str_key_len, &num_key, 0, &pos); + switch (key_type) { + case HASH_KEY_IS_STRING: + add_assoc_zval_ex(chunk, str_key, str_key_len, *entry); + break; + default: + add_index_zval(chunk, num_key, *entry); + break; + } + } else { + add_next_index_zval(chunk, *entry); + } + + /* If reached the chunk size, add it to the result array, and reset the + * pointer. */ + if (!(++current % size)) { + add_next_index_zval(return_value, chunk); + chunk = NULL; + } + + zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos); + } + + /* Add the final chunk if there is one. */ + if (chunk) { + add_next_index_zval(return_value, chunk); + } +} +/* }}} */ + +/* {{{ proto array array_combine(array keys, array values) + Creates an array by using the elements of the first parameter as keys and the elements of the second as the corresponding values */ +PHP_FUNCTION(array_combine) +{ + zval *values, *keys; + HashPosition pos_values, pos_keys; + zval **entry_keys, **entry_values; + int num_keys, num_values; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "aa", &keys, &values) == FAILURE) { + return; + } + + num_keys = zend_hash_num_elements(Z_ARRVAL_P(keys)); + num_values = zend_hash_num_elements(Z_ARRVAL_P(values)); + + if (num_keys != num_values) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Both parameters should have an equal number of elements"); + RETURN_FALSE; + } + + array_init_size(return_value, num_keys); + + if (!num_keys) { + return; + } + + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(keys), &pos_keys); + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(values), &pos_values); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(keys), (void **)&entry_keys, &pos_keys) == SUCCESS && + zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void **)&entry_values, &pos_values) == SUCCESS + ) { + if (Z_TYPE_PP(entry_keys) == IS_LONG) { + zval_add_ref(entry_values); + add_index_zval(return_value, Z_LVAL_PP(entry_keys), *entry_values); + } else { + zval key, *key_ptr = *entry_keys; + + if (Z_TYPE_PP(entry_keys) != IS_STRING) { + key = **entry_keys; + zval_copy_ctor(&key); + convert_to_string(&key); + key_ptr = &key; + } + + zval_add_ref(entry_values); + add_assoc_zval_ex(return_value, Z_STRVAL_P(key_ptr), Z_STRLEN_P(key_ptr) + 1, *entry_values); + + if (key_ptr != *entry_keys) { + zval_dtor(&key); + } + } + + zend_hash_move_forward_ex(Z_ARRVAL_P(keys), &pos_keys); + zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos_values); + } +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/ext/standard/assert.c b/ext/standard/assert.c new file mode 100644 index 0000000..631834c --- /dev/null +++ b/ext/standard/assert.c @@ -0,0 +1,347 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Thies C. Arntzen | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +/* {{{ includes */ +#include "php.h" +#include "php_assert.h" +#include "php_ini.h" +/* }}} */ + +ZEND_BEGIN_MODULE_GLOBALS(assert) + long active; + long bail; + long warning; + long quiet_eval; + zval *callback; + char *cb; +ZEND_END_MODULE_GLOBALS(assert) + +ZEND_DECLARE_MODULE_GLOBALS(assert) + +#ifdef ZTS +#define ASSERTG(v) TSRMG(assert_globals_id, zend_assert_globals *, v) +#else +#define ASSERTG(v) (assert_globals.v) +#endif + +#define SAFE_STRING(s) ((s)?(s):"") + +enum { + ASSERT_ACTIVE=1, + ASSERT_CALLBACK, + ASSERT_BAIL, + ASSERT_WARNING, + ASSERT_QUIET_EVAL +}; + +static PHP_INI_MH(OnChangeCallback) /* {{{ */ +{ + if (EG(in_execution)) { + if (ASSERTG(callback)) { + zval_ptr_dtor(&ASSERTG(callback)); + ASSERTG(callback) = NULL; + } + if (new_value && (ASSERTG(callback) || new_value_length)) { + MAKE_STD_ZVAL(ASSERTG(callback)); + ZVAL_STRINGL(ASSERTG(callback), new_value, new_value_length, 1); + } + } else { + if (ASSERTG(cb)) { + pefree(ASSERTG(cb), 1); + } + if (new_value && new_value_length) { + ASSERTG(cb) = pemalloc(new_value_length + 1, 1); + memcpy(ASSERTG(cb), new_value, new_value_length); + ASSERTG(cb)[new_value_length] = '\0'; + } else { + ASSERTG(cb) = NULL; + } + } + return SUCCESS; +} +/* }}} */ + +PHP_INI_BEGIN() + STD_PHP_INI_ENTRY("assert.active", "1", PHP_INI_ALL, OnUpdateLong, active, zend_assert_globals, assert_globals) + STD_PHP_INI_ENTRY("assert.bail", "0", PHP_INI_ALL, OnUpdateLong, bail, zend_assert_globals, assert_globals) + STD_PHP_INI_ENTRY("assert.warning", "1", PHP_INI_ALL, OnUpdateLong, warning, zend_assert_globals, assert_globals) + PHP_INI_ENTRY("assert.callback", NULL, PHP_INI_ALL, OnChangeCallback) + STD_PHP_INI_ENTRY("assert.quiet_eval", "0", PHP_INI_ALL, OnUpdateLong, quiet_eval, zend_assert_globals, assert_globals) +PHP_INI_END() + +static void php_assert_init_globals(zend_assert_globals *assert_globals_p TSRMLS_DC) /* {{{ */ +{ + assert_globals_p->callback = NULL; + assert_globals_p->cb = NULL; +} +/* }}} */ + +PHP_MINIT_FUNCTION(assert) /* {{{ */ +{ + ZEND_INIT_MODULE_GLOBALS(assert, php_assert_init_globals, NULL); + + REGISTER_INI_ENTRIES(); + + REGISTER_LONG_CONSTANT("ASSERT_ACTIVE", ASSERT_ACTIVE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT); + + return SUCCESS; +} +/* }}} */ + +PHP_MSHUTDOWN_FUNCTION(assert) /* {{{ */ +{ + if (ASSERTG(cb)) { + pefree(ASSERTG(cb), 1); + ASSERTG(cb) = NULL; + } + return SUCCESS; +} +/* }}} */ + +PHP_RSHUTDOWN_FUNCTION(assert) /* {{{ */ +{ + if (ASSERTG(callback)) { + zval_ptr_dtor(&ASSERTG(callback)); + ASSERTG(callback) = NULL; + } + + return SUCCESS; +} +/* }}} */ + +PHP_MINFO_FUNCTION(assert) /* {{{ */ +{ + DISPLAY_INI_ENTRIES(); +} +/* }}} */ + +/* {{{ proto int assert(string|bool assertion[, string description]) + Checks if assertion is false */ +PHP_FUNCTION(assert) +{ + zval **assertion; + int val, description_len = 0; + char *myeval = NULL; + char *compiled_string_description, *description = NULL; + + if (! ASSERTG(active)) { + RETURN_TRUE; + } + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|s", &assertion, &description, &description_len) == FAILURE) { + return; + } + + if (Z_TYPE_PP(assertion) == IS_STRING) { + zval retval; + int old_error_reporting = 0; /* shut up gcc! */ + + myeval = Z_STRVAL_PP(assertion); + + if (ASSERTG(quiet_eval)) { + old_error_reporting = EG(error_reporting); + EG(error_reporting) = 0; + } + + compiled_string_description = zend_make_compiled_string_description("assert code" TSRMLS_CC); + if (zend_eval_stringl(myeval, Z_STRLEN_PP(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) { + efree(compiled_string_description); + if (description_len == 0) { + php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval); + } else { + php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, description, myeval); + } + if (ASSERTG(bail)) { + zend_bailout(); + } + RETURN_FALSE; + } + efree(compiled_string_description); + + if (ASSERTG(quiet_eval)) { + EG(error_reporting) = old_error_reporting; + } + + convert_to_boolean(&retval); + val = Z_LVAL(retval); + } else { + convert_to_boolean_ex(assertion); + val = Z_LVAL_PP(assertion); + } + + if (val) { + RETURN_TRUE; + } + + if (!ASSERTG(callback) && ASSERTG(cb)) { + MAKE_STD_ZVAL(ASSERTG(callback)); + ZVAL_STRING(ASSERTG(callback), ASSERTG(cb), 1); + } + + if (ASSERTG(callback)) { + zval **args = safe_emalloc(description_len == 0 ? 3 : 4, sizeof(zval **), 0); + zval *retval; + int i; + uint lineno = zend_get_executed_lineno(TSRMLS_C); + const char *filename = zend_get_executed_filename(TSRMLS_C); + + MAKE_STD_ZVAL(args[0]); + MAKE_STD_ZVAL(args[1]); + MAKE_STD_ZVAL(args[2]); + + ZVAL_STRING(args[0], SAFE_STRING(filename), 1); + ZVAL_LONG (args[1], lineno); + ZVAL_STRING(args[2], SAFE_STRING(myeval), 1); + + MAKE_STD_ZVAL(retval); + ZVAL_FALSE(retval); + + /* XXX do we want to check for error here? */ + if (description_len == 0) { + call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 3, args TSRMLS_CC); + for (i = 0; i <= 2; i++) { + zval_ptr_dtor(&(args[i])); + } + } else { + MAKE_STD_ZVAL(args[3]); + ZVAL_STRINGL(args[3], SAFE_STRING(description), description_len, 1); + + call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 4, args TSRMLS_CC); + for (i = 0; i <= 3; i++) { + zval_ptr_dtor(&(args[i])); + } + } + + efree(args); + zval_ptr_dtor(&retval); + } + + if (ASSERTG(warning)) { + if (description_len == 0) { + if (myeval) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion \"%s\" failed", myeval); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion failed"); + } + } else { + if (myeval) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: \"%s\" failed", description, myeval); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s failed", description); + } + } + } + + if (ASSERTG(bail)) { + zend_bailout(); + } +} +/* }}} */ + +/* {{{ proto mixed assert_options(int what [, mixed value]) + Set/get the various assert flags */ +PHP_FUNCTION(assert_options) +{ + zval **value = NULL; + long what; + int oldint; + int ac = ZEND_NUM_ARGS(); + + if (zend_parse_parameters(ac TSRMLS_CC, "l|Z", &what, &value) == FAILURE) { + return; + } + + switch (what) { + case ASSERT_ACTIVE: + oldint = ASSERTG(active); + if (ac == 2) { + convert_to_string_ex(value); + zend_alter_ini_entry_ex("assert.active", sizeof("assert.active"), Z_STRVAL_PP(value), Z_STRLEN_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); + } + RETURN_LONG(oldint); + break; + + case ASSERT_BAIL: + oldint = ASSERTG(bail); + if (ac == 2) { + convert_to_string_ex(value); + zend_alter_ini_entry_ex("assert.bail", sizeof("assert.bail"), Z_STRVAL_PP(value), Z_STRLEN_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); + } + RETURN_LONG(oldint); + break; + + case ASSERT_QUIET_EVAL: + oldint = ASSERTG(quiet_eval); + if (ac == 2) { + convert_to_string_ex(value); + zend_alter_ini_entry_ex("assert.quiet_eval", sizeof("assert.quiet_eval"), Z_STRVAL_PP(value), Z_STRLEN_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); + } + RETURN_LONG(oldint); + break; + + case ASSERT_WARNING: + oldint = ASSERTG(warning); + if (ac == 2) { + convert_to_string_ex(value); + zend_alter_ini_entry_ex("assert.warning", sizeof("assert.warning"), Z_STRVAL_PP(value), Z_STRLEN_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); + } + RETURN_LONG(oldint); + break; + + case ASSERT_CALLBACK: + if (ASSERTG(callback) != NULL) { + RETVAL_ZVAL(ASSERTG(callback), 1, 0); + } else if (ASSERTG(cb)) { + RETVAL_STRING(ASSERTG(cb), 1); + } else { + RETVAL_NULL(); + } + if (ac == 2) { + if (ASSERTG(callback)) { + zval_ptr_dtor(&ASSERTG(callback)); + } + ASSERTG(callback) = *value; + zval_add_ref(value); + } + return; + break; + + default: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown value %ld", what); + break; + } + + RETURN_FALSE; +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ + diff --git a/ext/standard/base64.c b/ext/standard/base64.c new file mode 100644 index 0000000..7534c8f --- /dev/null +++ b/ext/standard/base64.c @@ -0,0 +1,266 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Jim Winstead | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#include + +#include "php.h" +#include "base64.h" + +/* {{{ base64 tables */ +static const char base64_table[] = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '\0' +}; + +static const char base64_pad = '='; + +static const short base64_reverse_table[256] = { + -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -2, -2, -1, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 62, -2, -2, -2, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -2, -2, -2, -2, -2, -2, + -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -2, -2, -2, -2, -2, + -2, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2 +}; +/* }}} */ + +PHPAPI unsigned char *php_base64_encode(const unsigned char *str, int length, int *ret_length) /* {{{ */ +{ + const unsigned char *current = str; + unsigned char *p; + unsigned char *result; + + if (length < 0) { + if (ret_length != NULL) { + *ret_length = 0; + } + return NULL; + } + + result = (unsigned char *) safe_emalloc((length + 2) / 3, 4 * sizeof(char), 1); + p = result; + + while (length > 2) { /* keep going until we have less than 24 bits */ + *p++ = base64_table[current[0] >> 2]; + *p++ = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)]; + *p++ = base64_table[((current[1] & 0x0f) << 2) + (current[2] >> 6)]; + *p++ = base64_table[current[2] & 0x3f]; + + current += 3; + length -= 3; /* we just handle 3 octets of data */ + } + + /* now deal with the tail end of things */ + if (length != 0) { + *p++ = base64_table[current[0] >> 2]; + if (length > 1) { + *p++ = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)]; + *p++ = base64_table[(current[1] & 0x0f) << 2]; + *p++ = base64_pad; + } else { + *p++ = base64_table[(current[0] & 0x03) << 4]; + *p++ = base64_pad; + *p++ = base64_pad; + } + } + if (ret_length != NULL) { + *ret_length = (int)(p - result); + } + *p = '\0'; + return result; +} +/* }}} */ + +/* {{{ */ +/* generate reverse table (do not set index 0 to 64) +static unsigned short base64_reverse_table[256]; +#define rt base64_reverse_table +void php_base64_init(void) +{ + char *s = emalloc(10240), *sp; + char *chp; + short idx; + + for(ch = 0; ch < 256; ch++) { + chp = strchr(base64_table, ch); + if(ch && chp) { + idx = chp - base64_table; + if (idx >= 64) idx = -1; + rt[ch] = idx; + } else { + rt[ch] = -1; + } + } + sp = s; + sprintf(sp, "static const short base64_reverse_table[256] = {\n"); + for(ch =0; ch < 256;) { + sp = s+strlen(s); + sprintf(sp, "\t% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,% 3d,\n", rt[ch+0], rt[ch+1], rt[ch+2], rt[ch+3], rt[ch+4], rt[ch+5], rt[ch+6], rt[ch+7], rt[ch+8], rt[ch+9], rt[ch+10], rt[ch+11], rt[ch+12], rt[ch+13], rt[ch+14], rt[ch+15]); + ch += 16; + } + sprintf(sp, "};"); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Reverse_table:\n%s", s); + efree(s); +} +*/ +/* }}} */ + +PHPAPI unsigned char *php_base64_decode(const unsigned char *str, int length, int *ret_length) /* {{{ */ +{ + return php_base64_decode_ex(str, length, ret_length, 0); +} +/* }}} */ + +PHPAPI unsigned char *php_base64_decode_ex(const unsigned char *str, int length, int *ret_length, zend_bool strict) /* {{{ */ +{ + const unsigned char *current = str; + int ch, i = 0, j = 0, k; + /* this sucks for threaded environments */ + unsigned char *result; + + result = (unsigned char *)safe_emalloc(length, 1, 1); + + /* run through the whole string, converting as we go */ + while ((ch = *current++) != '\0' && length-- > 0) { + if (ch == base64_pad) { + if (*current != '=' && ((i % 4) == 1 || (strict && length > 0))) { + if ((i % 4) != 1) { + while (isspace(*(++current))) { + continue; + } + if (*current == '\0') { + continue; + } + } + efree(result); + return NULL; + } + continue; + } + + ch = base64_reverse_table[ch]; + if ((!strict && ch < 0) || ch == -1) { /* a space or some other separator character, we simply skip over */ + continue; + } else if (ch == -2) { + efree(result); + return NULL; + } + + switch(i % 4) { + case 0: + result[j] = ch << 2; + break; + case 1: + result[j++] |= ch >> 4; + result[j] = (ch & 0x0f) << 4; + break; + case 2: + result[j++] |= ch >>2; + result[j] = (ch & 0x03) << 6; + break; + case 3: + result[j++] |= ch; + break; + } + i++; + } + + k = j; + /* mop things up if we ended on a boundary */ + if (ch == base64_pad) { + switch(i % 4) { + case 1: + efree(result); + return NULL; + case 2: + k++; + case 3: + result[k] = 0; + } + } + if(ret_length) { + *ret_length = j; + } + result[j] = '\0'; + return result; +} +/* }}} */ + +/* {{{ proto string base64_encode(string str) + Encodes string using MIME base64 algorithm */ +PHP_FUNCTION(base64_encode) +{ + char *str; + unsigned char *result; + int str_len, ret_length; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + return; + } + result = php_base64_encode((unsigned char*)str, str_len, &ret_length); + if (result != NULL) { + RETVAL_STRINGL((char*)result, ret_length, 0); + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto string base64_decode(string str[, bool strict]) + Decodes string using MIME base64 algorithm */ +PHP_FUNCTION(base64_decode) +{ + char *str; + unsigned char *result; + zend_bool strict = 0; + int str_len, ret_length; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &str, &str_len, &strict) == FAILURE) { + return; + } + result = php_base64_decode_ex((unsigned char*)str, str_len, &ret_length, strict); + if (result != NULL) { + RETVAL_STRINGL((char*)result, ret_length, 0); + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/base64.h b/ext/standard/base64.h new file mode 100644 index 0000000..3f9d818 --- /dev/null +++ b/ext/standard/base64.h @@ -0,0 +1,38 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Jim Winstead | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef BASE64_H +#define BASE64_H + +PHP_FUNCTION(base64_decode); +PHP_FUNCTION(base64_encode); + +PHPAPI extern unsigned char *php_base64_encode(const unsigned char *, int, int *); +PHPAPI extern unsigned char *php_base64_decode_ex(const unsigned char *, int, int *, zend_bool); +PHPAPI extern unsigned char *php_base64_decode(const unsigned char *, int, int *); + +#endif /* BASE64_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c new file mode 100644 index 0000000..a9ce7de --- /dev/null +++ b/ext/standard/basic_functions.c @@ -0,0 +1,6038 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Andi Gutmans | + | Zeev Suraski | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#include "php.h" +#include "php_streams.h" +#include "php_main.h" +#include "php_globals.h" +#include "php_ini.h" +#include "php_standard.h" +#include "php_math.h" +#include "php_http.h" +#include "php_incomplete_class.h" +#include "php_getopt.h" +#include "ext/standard/info.h" +#include "ext/session/php_session.h" +#include "zend_operators.h" +#include "ext/standard/php_dns.h" +#include "ext/standard/php_uuencode.h" + +#ifdef PHP_WIN32 +#include "win32/php_win32_globals.h" +#include "win32/time.h" +#endif + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +#include "zend.h" +#include "zend_ini_scanner.h" +#include "zend_language_scanner.h" +#include + +#include +#include +#include +#include +#include + +#ifndef PHP_WIN32 +#include +#include +#endif + +#ifdef NETWARE +#include +#endif + +#ifndef PHP_WIN32 +# include +#else +#include "win32/inet.h" +#endif + +#if HAVE_ARPA_INET_H +# include +#endif + +#if HAVE_UNISTD_H +# include +#endif + +#if HAVE_STRING_H +# include +#else +# include +#endif + +#if HAVE_LOCALE_H +# include +#endif + +#if HAVE_SYS_MMAN_H +# include +#endif + +#if HAVE_SYS_LOADAVG_H +# include +#endif + +#ifdef PHP_WIN32 +# include "win32/unistd.h" +#endif + +#ifndef INADDR_NONE +#define INADDR_NONE ((unsigned long int) -1) +#endif + +#include "zend_globals.h" +#include "php_globals.h" +#include "SAPI.h" +#include "php_ticks.h" + +#ifdef ZTS +PHPAPI int basic_globals_id; +#else +PHPAPI php_basic_globals basic_globals; +#endif + +#include "php_fopen_wrappers.h" +#include "streamsfuncs.h" + +static zend_class_entry *incomplete_class_entry = NULL; + +typedef struct _user_tick_function_entry { + zval **arguments; + int arg_count; + int calling; +} user_tick_function_entry; + +/* some prototypes for local functions */ +static void user_shutdown_function_dtor(php_shutdown_function_entry *shutdown_function_entry); +static void user_tick_function_dtor(user_tick_function_entry *tick_function_entry); + +#undef sprintf + +/* {{{ arginfo */ +/* {{{ main/main.c */ +ZEND_BEGIN_ARG_INFO(arginfo_set_time_limit, 0) + ZEND_ARG_INFO(0, seconds) +ZEND_END_ARG_INFO() +/* }}} */ + +/* {{{ main/sapi.c */ +ZEND_BEGIN_ARG_INFO(arginfo_header_register_callback, 0) + ZEND_ARG_INFO(0, callback) +ZEND_END_ARG_INFO() +/* }}} */ + +/* {{{ main/output.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_start, 0, 0, 0) + ZEND_ARG_INFO(0, user_function) + ZEND_ARG_INFO(0, chunk_size) + ZEND_ARG_INFO(0, flags) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ob_flush, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ob_clean, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ob_end_flush, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ob_end_clean, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ob_get_flush, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ob_get_clean, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ob_get_contents, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ob_get_level, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ob_get_length, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ob_list_handlers, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_get_status, 0, 0, 0) + ZEND_ARG_INFO(0, full_status) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_implicit_flush, 0, 0, 0) + ZEND_ARG_INFO(0, flag) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_output_reset_rewrite_vars, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_output_add_rewrite_var, 0) + ZEND_ARG_INFO(0, name) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ main/streams/userspace.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_wrapper_register, 0, 0, 2) + ZEND_ARG_INFO(0, protocol) + ZEND_ARG_INFO(0, classname) + ZEND_ARG_INFO(0, flags) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_wrapper_unregister, 0) + ZEND_ARG_INFO(0, protocol) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_wrapper_restore, 0) + ZEND_ARG_INFO(0, protocol) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ array.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_krsort, 0, 0, 1) + ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ + ZEND_ARG_INFO(0, sort_flags) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ksort, 0, 0, 1) + ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ + ZEND_ARG_INFO(0, sort_flags) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_count, 0, 0, 1) + ZEND_ARG_INFO(0, var) + ZEND_ARG_INFO(0, mode) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_natsort, 0) + ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_natcasesort, 0) + ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_asort, 0, 0, 1) + ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ + ZEND_ARG_INFO(0, sort_flags) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_arsort, 0, 0, 1) + ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ + ZEND_ARG_INFO(0, sort_flags) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_sort, 0, 0, 1) + ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ + ZEND_ARG_INFO(0, sort_flags) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_rsort, 0, 0, 1) + ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ + ZEND_ARG_INFO(0, sort_flags) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_usort, 0) + ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ + ZEND_ARG_INFO(0, cmp_function) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_uasort, 0) + ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ + ZEND_ARG_INFO(0, cmp_function) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_uksort, 0) + ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ + ZEND_ARG_INFO(0, cmp_function) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_end, 0) + ZEND_ARG_INFO(1, arg) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_prev, 0) + ZEND_ARG_INFO(1, arg) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_next, 0) + ZEND_ARG_INFO(1, arg) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_reset, 0) + ZEND_ARG_INFO(1, arg) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_current, ZEND_SEND_PREFER_REF) + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arg) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_key, ZEND_SEND_PREFER_REF) + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arg) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_min, 0, 0, 1) + ZEND_ARG_INFO(0, arg1) + ZEND_ARG_INFO(0, arg2) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_max, 0, 0, 1) + ZEND_ARG_INFO(0, arg1) + ZEND_ARG_INFO(0, arg2) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_walk, 0, 0, 2) + ZEND_ARG_INFO(1, input) /* ARRAY_INFO(1, arg, 0) */ + ZEND_ARG_INFO(0, funcname) + ZEND_ARG_INFO(0, userdata) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_walk_recursive, 0, 0, 2) + ZEND_ARG_INFO(1, input) /* ARRAY_INFO(1, arg, 0) */ + ZEND_ARG_INFO(0, funcname) + ZEND_ARG_INFO(0, userdata) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_in_array, 0, 0, 2) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, haystack) /* ARRAY_INFO(0, haystack, 0) */ + ZEND_ARG_INFO(0, strict) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_search, 0, 0, 2) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, haystack) /* ARRAY_INFO(0, haystack, 0) */ + ZEND_ARG_INFO(0, strict) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_extract, 0, 0, 1) + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arg) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, extract_type) + ZEND_ARG_INFO(0, prefix) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_compact, 0, 0, 1) + ZEND_ARG_INFO(0, var_names) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_fill, 0) + ZEND_ARG_INFO(0, start_key) + ZEND_ARG_INFO(0, num) + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_fill_keys, 0) + ZEND_ARG_INFO(0, keys) /* ARRAY_INFO(0, keys, 0) */ + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_range, 0, 0, 2) + ZEND_ARG_INFO(0, low) + ZEND_ARG_INFO(0, high) + ZEND_ARG_INFO(0, step) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_shuffle, 0) + ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_push, 0, 0, 2) + ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */ + ZEND_ARG_INFO(0, var) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_pop, 0) + ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_shift, 0) + ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_unshift, 0, 0, 2) + ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */ + ZEND_ARG_INFO(0, var) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_splice, 0, 0, 2) + ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, length) + ZEND_ARG_INFO(0, replacement) /* ARRAY_INFO(0, arg, 1) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_slice, 0, 0, 2) + ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(1, arg, 0) */ + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, length) + ZEND_ARG_INFO(0, preserve_keys) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_merge, 0, 0, 2) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, ...) /* ARRAY_INFO(0, ..., 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_merge_recursive, 0, 0, 2) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, ...) /* ARRAY_INFO(0, arg, 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_replace, 0, 0, 2) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, ...) /* ARRAY_INFO(0, ..., 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_replace_recursive, 0, 0, 2) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, ...) /* ARRAY_INFO(0, arg, 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_keys, 0, 0, 1) + ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, search_value) + ZEND_ARG_INFO(0, strict) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_values, 0) + ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_count_values, 0) + ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reverse, 0, 0, 1) + ZEND_ARG_INFO(0, input) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, preserve_keys) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_pad, 0) + ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, pad_size) + ZEND_ARG_INFO(0, pad_value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_flip, 0) + ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_change_key_case, 0, 0, 1) + ZEND_ARG_INFO(0, input) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, case) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_unique, 0) + ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect_key, 0, 0, 2) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, ...) /* ARRAY_INFO(0, ..., 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_intersect_ukey, 0) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, callback_key_compare_func) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect, 0, 0, 2) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, ...) /* ARRAY_INFO(0, ..., 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect, 0) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, callback_data_compare_func) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect_assoc, 0, 0, 2) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, ...) /* ARRAY_INFO(0, ..., 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect_assoc, 0) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, callback_data_compare_func) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_intersect_uassoc, 0) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, callback_key_compare_func) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect_uassoc, 0) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, callback_data_compare_func) + ZEND_ARG_INFO(0, callback_key_compare_func) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff_key, 0, 0, 2) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, ...) /* ARRAY_INFO(0, ..., 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_diff_ukey, 0) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, callback_key_comp_func) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff, 0, 0, 2) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, ...) /* ARRAY_INFO(0, ..., 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_udiff, 0) + ZEND_ARG_INFO(0, arr1) + ZEND_ARG_INFO(0, arr2) + ZEND_ARG_INFO(0, callback_data_comp_func) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff_assoc, 0, 0, 2) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, ...) /* ARRAY_INFO(0, ..., 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_diff_uassoc, 0) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, callback_data_comp_func) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_udiff_assoc, 0) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, callback_key_comp_func) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_udiff_uassoc, 0) + ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ + ZEND_ARG_INFO(0, callback_data_comp_func) + ZEND_ARG_INFO(0, callback_key_comp_func) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_multisort, ZEND_SEND_PREFER_REF, 0, 1) + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr1) /* ARRAY_INFO(0, arg1, 0) */ + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_ASC_or_SORT_DESC) + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING) + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr2) + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_ASC_or_SORT_DESC) + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_rand, 0, 0, 1) + ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, num_req) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_sum, 0) + ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_product, 0) + ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reduce, 0, 0, 2) + ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, callback) + ZEND_ARG_INFO(0, initial) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_filter, 0, 0, 1) + ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, callback) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_map, 0, 0, 2) + ZEND_ARG_INFO(0, callback) + ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_key_exists, 0) + ZEND_ARG_INFO(0, key) + ZEND_ARG_INFO(0, search) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_chunk, 0, 0, 2) + ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ + ZEND_ARG_INFO(0, size) + ZEND_ARG_INFO(0, preserve_keys) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_array_combine, 0) + ZEND_ARG_INFO(0, keys) /* ARRAY_INFO(0, keys, 0) */ + ZEND_ARG_INFO(0, values) /* ARRAY_INFO(0, values, 0) */ +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ basic_functions.c */ +ZEND_BEGIN_ARG_INFO(arginfo_get_magic_quotes_gpc, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_get_magic_quotes_runtime, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_set_magic_quotes_runtime, 0, 0, 1) + ZEND_ARG_INFO(0, new_setting) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_constant, 0) + ZEND_ARG_INFO(0, const_name) +ZEND_END_ARG_INFO() + +#ifdef HAVE_INET_NTOP +ZEND_BEGIN_ARG_INFO(arginfo_inet_ntop, 0) + ZEND_ARG_INFO(0, in_addr) +ZEND_END_ARG_INFO() +#endif + +#ifdef HAVE_INET_PTON +ZEND_BEGIN_ARG_INFO(arginfo_inet_pton, 0) + ZEND_ARG_INFO(0, ip_address) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO(arginfo_ip2long, 0) + ZEND_ARG_INFO(0, ip_address) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_long2ip, 0) + ZEND_ARG_INFO(0, proper_address) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_getenv, 0) + ZEND_ARG_INFO(0, varname) +ZEND_END_ARG_INFO() + +#ifdef HAVE_PUTENV +ZEND_BEGIN_ARG_INFO(arginfo_putenv, 0) + ZEND_ARG_INFO(0, setting) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO_EX(arginfo_getopt, 0, 0, 1) + ZEND_ARG_INFO(0, options) + ZEND_ARG_INFO(0, opts) /* ARRAY_INFO(0, opts, 1) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_flush, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_sleep, 0) + ZEND_ARG_INFO(0, seconds) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_usleep, 0) + ZEND_ARG_INFO(0, micro_seconds) +ZEND_END_ARG_INFO() + +#if HAVE_NANOSLEEP +ZEND_BEGIN_ARG_INFO(arginfo_time_nanosleep, 0) + ZEND_ARG_INFO(0, seconds) + ZEND_ARG_INFO(0, nanoseconds) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_time_sleep_until, 0) + ZEND_ARG_INFO(0, timestamp) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO(arginfo_get_current_user, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_get_cfg_var, 0) + ZEND_ARG_INFO(0, option_name) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_error_log, 0, 0, 1) + ZEND_ARG_INFO(0, message) + ZEND_ARG_INFO(0, message_type) + ZEND_ARG_INFO(0, destination) + ZEND_ARG_INFO(0, extra_headers) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_error_get_last, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_call_user_func, 0, 0, 1) + ZEND_ARG_INFO(0, function_name) + ZEND_ARG_INFO(0, parmeter) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_call_user_func_array, 0, 0, 2) + ZEND_ARG_INFO(0, function_name) + ZEND_ARG_INFO(0, parameters) /* ARRAY_INFO(0, parameters, 1) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_call_user_method, 0, 0, 2) + ZEND_ARG_INFO(0, method_name) + ZEND_ARG_INFO(1, object) + ZEND_ARG_INFO(0, parameter) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_call_user_method_array, 0) + ZEND_ARG_INFO(0, method_name) + ZEND_ARG_INFO(1, object) + ZEND_ARG_INFO(0, params) /* ARRAY_INFO(0, params, 1) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_forward_static_call, 0, 0, 1) + ZEND_ARG_INFO(0, function_name) + ZEND_ARG_INFO(0, parameter) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_forward_static_call_array, 0, 0, 2) + ZEND_ARG_INFO(0, function_name) + ZEND_ARG_INFO(0, parameters) /* ARRAY_INFO(0, parameters, 1) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_register_shutdown_function, 0) + ZEND_ARG_INFO(0, function_name) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_highlight_file, 0, 0, 1) + ZEND_ARG_INFO(0, file_name) + ZEND_ARG_INFO(0, return) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_php_strip_whitespace, 0) + ZEND_ARG_INFO(0, file_name) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_highlight_string, 0, 0, 1) + ZEND_ARG_INFO(0, string) + ZEND_ARG_INFO(0, return) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ini_get, 0) + ZEND_ARG_INFO(0, varname) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ini_get_all, 0, 0, 0) + ZEND_ARG_INFO(0, extension) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ini_set, 0) + ZEND_ARG_INFO(0, varname) + ZEND_ARG_INFO(0, newvalue) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ini_restore, 0) + ZEND_ARG_INFO(0, varname) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_set_include_path, 0) + ZEND_ARG_INFO(0, new_include_path) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_get_include_path, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_restore_include_path, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_print_r, 0, 0, 1) + ZEND_ARG_INFO(0, var) + ZEND_ARG_INFO(0, return) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_connection_aborted, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_connection_status, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ignore_user_abort, 0, 0, 0) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + +#if HAVE_GETSERVBYNAME +ZEND_BEGIN_ARG_INFO(arginfo_getservbyname, 0) + ZEND_ARG_INFO(0, service) + ZEND_ARG_INFO(0, protocol) +ZEND_END_ARG_INFO() +#endif + +#if HAVE_GETSERVBYPORT +ZEND_BEGIN_ARG_INFO(arginfo_getservbyport, 0) + ZEND_ARG_INFO(0, port) + ZEND_ARG_INFO(0, protocol) +ZEND_END_ARG_INFO() +#endif + +#if HAVE_GETPROTOBYNAME +ZEND_BEGIN_ARG_INFO(arginfo_getprotobyname, 0) + ZEND_ARG_INFO(0, name) +ZEND_END_ARG_INFO() +#endif + +#if HAVE_GETPROTOBYNUMBER +ZEND_BEGIN_ARG_INFO(arginfo_getprotobynumber, 0) + ZEND_ARG_INFO(0, proto) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO_EX(arginfo_register_tick_function, 0, 0, 1) + ZEND_ARG_INFO(0, function_name) + ZEND_ARG_INFO(0, arg) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_unregister_tick_function, 0) + ZEND_ARG_INFO(0, function_name) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_uploaded_file, 0) + ZEND_ARG_INFO(0, path) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_move_uploaded_file, 0) + ZEND_ARG_INFO(0, path) + ZEND_ARG_INFO(0, new_path) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_ini_file, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, process_sections) + ZEND_ARG_INFO(0, scanner_mode) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_ini_string, 0, 0, 1) + ZEND_ARG_INFO(0, ini_string) + ZEND_ARG_INFO(0, process_sections) + ZEND_ARG_INFO(0, scanner_mode) +ZEND_END_ARG_INFO() + +#if ZEND_DEBUG +ZEND_BEGIN_ARG_INFO(arginfo_config_get_hash, 0) +ZEND_END_ARG_INFO() +#endif + +#ifdef HAVE_GETLOADAVG +ZEND_BEGIN_ARG_INFO(arginfo_sys_getloadavg, 0) +ZEND_END_ARG_INFO() +#endif +/* }}} */ +/* {{{ assert.c */ +ZEND_BEGIN_ARG_INFO(arginfo_assert, 0) + ZEND_ARG_INFO(0, assertion) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_assert_options, 0, 0, 1) + ZEND_ARG_INFO(0, what) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ base64.c */ +ZEND_BEGIN_ARG_INFO(arginfo_base64_encode, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_base64_decode, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, strict) +ZEND_END_ARG_INFO() + +/* }}} */ +/* {{{ browscap.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_get_browser, 0, 0, 0) + ZEND_ARG_INFO(0, browser_name) + ZEND_ARG_INFO(0, return_array) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ crc32.c */ +ZEND_BEGIN_ARG_INFO(arginfo_crc32, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +/* }}} */ +/* {{{ crypt.c */ +#if HAVE_CRYPT +ZEND_BEGIN_ARG_INFO_EX(arginfo_crypt, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, salt) +ZEND_END_ARG_INFO() +#endif +/* }}} */ +/* {{{ cyr_convert.c */ +ZEND_BEGIN_ARG_INFO(arginfo_convert_cyr_string, 0) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, from) + ZEND_ARG_INFO(0, to) +ZEND_END_ARG_INFO() + +/* }}} */ +/* {{{ datetime.c */ +#if HAVE_STRPTIME +ZEND_BEGIN_ARG_INFO(arginfo_strptime, 0) + ZEND_ARG_INFO(0, timestamp) + ZEND_ARG_INFO(0, format) +ZEND_END_ARG_INFO() +#endif +/* }}} */ +/* {{{ dir.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_opendir, 0, 0, 1) + ZEND_ARG_INFO(0, path) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_dir, 0, 0, 1) + ZEND_ARG_INFO(0, directory) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_closedir, 0, 0, 0) + ZEND_ARG_INFO(0, dir_handle) +ZEND_END_ARG_INFO() + +#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC +ZEND_BEGIN_ARG_INFO(arginfo_chroot, 0) + ZEND_ARG_INFO(0, directory) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO(arginfo_chdir, 0) + ZEND_ARG_INFO(0, directory) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_getcwd, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_rewinddir, 0, 0, 0) + ZEND_ARG_INFO(0, dir_handle) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_readdir, 0, 0, 0) + ZEND_ARG_INFO(0, dir_handle) +ZEND_END_ARG_INFO() + +#ifdef HAVE_GLOB +ZEND_BEGIN_ARG_INFO_EX(arginfo_glob, 0, 0, 1) + ZEND_ARG_INFO(0, pattern) + ZEND_ARG_INFO(0, flags) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO_EX(arginfo_scandir, 0, 0, 1) + ZEND_ARG_INFO(0, dir) + ZEND_ARG_INFO(0, sorting_order) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ arginfo ext/standard/dl.c */ +ZEND_BEGIN_ARG_INFO(arginfo_dl, 0) + ZEND_ARG_INFO(0, extension_filename) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ dns.c */ +ZEND_BEGIN_ARG_INFO(arginfo_gethostbyaddr, 0) + ZEND_ARG_INFO(0, ip_address) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_gethostbyname, 0) + ZEND_ARG_INFO(0, hostname) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_gethostbynamel, 0) + ZEND_ARG_INFO(0, hostname) +ZEND_END_ARG_INFO() + +#ifdef HAVE_GETHOSTNAME +ZEND_BEGIN_ARG_INFO(arginfo_gethostname, 0) +ZEND_END_ARG_INFO() +#endif + +#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE))) +ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_check_record, 0, 0, 1) + ZEND_ARG_INFO(0, host) + ZEND_ARG_INFO(0, type) +ZEND_END_ARG_INFO() + +# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS +ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_get_record, 0, 0, 1) + ZEND_ARG_INFO(0, hostname) + ZEND_ARG_INFO(0, type) + ZEND_ARG_ARRAY_INFO(1, authns, 1) + ZEND_ARG_ARRAY_INFO(1, addtl, 1) + ZEND_ARG_INFO(0, raw) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_get_mx, 0, 0, 2) + ZEND_ARG_INFO(0, hostname) + ZEND_ARG_INFO(1, mxhosts) /* ARRAY_INFO(1, mxhosts, 1) */ + ZEND_ARG_INFO(1, weight) /* ARRAY_INFO(1, weight, 1) */ +ZEND_END_ARG_INFO() +# endif + +#endif /* defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE))) */ +/* }}} */ + +/* {{{ exec.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_exec, 0, 0, 1) + ZEND_ARG_INFO(0, command) + ZEND_ARG_INFO(1, output) /* ARRAY_INFO(1, output, 1) */ + ZEND_ARG_INFO(1, return_value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_system, 0, 0, 1) + ZEND_ARG_INFO(0, command) + ZEND_ARG_INFO(1, return_value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_passthru, 0, 0, 1) + ZEND_ARG_INFO(0, command) + ZEND_ARG_INFO(1, return_value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_escapeshellcmd, 0) + ZEND_ARG_INFO(0, command) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_escapeshellarg, 0) + ZEND_ARG_INFO(0, arg) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_shell_exec, 0) + ZEND_ARG_INFO(0, cmd) +ZEND_END_ARG_INFO() + +#ifdef HAVE_NICE +ZEND_BEGIN_ARG_INFO(arginfo_proc_nice, 0) + ZEND_ARG_INFO(0, priority) +ZEND_END_ARG_INFO() +#endif +/* }}} */ +/* {{{ file.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_flock, 0, 0, 2) + ZEND_ARG_INFO(0, fp) + ZEND_ARG_INFO(0, operation) + ZEND_ARG_INFO(1, wouldblock) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_get_meta_tags, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, use_include_path) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_file_get_contents, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, flags) + ZEND_ARG_INFO(0, context) + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, maxlen) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_file_put_contents, 0, 0, 2) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, data) + ZEND_ARG_INFO(0, flags) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_file, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, flags) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_tempnam, 0) + ZEND_ARG_INFO(0, dir) + ZEND_ARG_INFO(0, prefix) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_tmpfile, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_fopen, 0, 0, 2) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, mode) + ZEND_ARG_INFO(0, use_include_path) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_fclose, 0) + ZEND_ARG_INFO(0, fp) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_popen, 0) + ZEND_ARG_INFO(0, command) + ZEND_ARG_INFO(0, mode) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_pclose, 0) + ZEND_ARG_INFO(0, fp) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_feof, 0) + ZEND_ARG_INFO(0, fp) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_fgets, 0, 0, 1) + ZEND_ARG_INFO(0, fp) + ZEND_ARG_INFO(0, length) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_fgetc, 0) + ZEND_ARG_INFO(0, fp) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetss, 0, 0, 1) + ZEND_ARG_INFO(0, fp) + ZEND_ARG_INFO(0, length) + ZEND_ARG_INFO(0, allowable_tags) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_fscanf, 1, 0, 2) + ZEND_ARG_INFO(0, stream) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(1, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_fwrite, 0, 0, 2) + ZEND_ARG_INFO(0, fp) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, length) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_fflush, 0) + ZEND_ARG_INFO(0, fp) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_rewind, 0) + ZEND_ARG_INFO(0, fp) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ftell, 0) + ZEND_ARG_INFO(0, fp) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_fseek, 0, 0, 2) + ZEND_ARG_INFO(0, fp) + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, whence) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_mkdir, 0, 0, 1) + ZEND_ARG_INFO(0, pathname) + ZEND_ARG_INFO(0, mode) + ZEND_ARG_INFO(0, recursive) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_rmdir, 0, 0, 1) + ZEND_ARG_INFO(0, dirname) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_readfile, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, flags) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_umask, 0, 0, 0) + ZEND_ARG_INFO(0, mask) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_fpassthru, 0) + ZEND_ARG_INFO(0, fp) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_rename, 0, 0, 2) + ZEND_ARG_INFO(0, old_name) + ZEND_ARG_INFO(0, new_name) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_unlink, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ftruncate, 0) + ZEND_ARG_INFO(0, fp) + ZEND_ARG_INFO(0, size) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_fstat, 0) + ZEND_ARG_INFO(0, fp) +ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO(arginfo_copy, 0) + ZEND_ARG_INFO(0, source_file) + ZEND_ARG_INFO(0, destination_file) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_fread, 0) + ZEND_ARG_INFO(0, fp) + ZEND_ARG_INFO(0, length) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_fputcsv, 0, 0, 2) + ZEND_ARG_INFO(0, fp) + ZEND_ARG_INFO(0, fields) /* ARRAY_INFO(0, fields, 1) */ + ZEND_ARG_INFO(0, delimiter) + ZEND_ARG_INFO(0, enclosure) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetcsv, 0, 0, 1) + ZEND_ARG_INFO(0, fp) + ZEND_ARG_INFO(0, length) + ZEND_ARG_INFO(0, delimiter) + ZEND_ARG_INFO(0, enclosure) + ZEND_ARG_INFO(0, escape) +ZEND_END_ARG_INFO() + +#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS) +ZEND_BEGIN_ARG_INFO(arginfo_realpath, 0) + ZEND_ARG_INFO(0, path) +ZEND_END_ARG_INFO() +#endif + +#ifdef HAVE_FNMATCH +ZEND_BEGIN_ARG_INFO_EX(arginfo_fnmatch, 0, 0, 2) + ZEND_ARG_INFO(0, pattern) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, flags) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO(arginfo_sys_get_temp_dir, 0) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ filestat.c */ +ZEND_BEGIN_ARG_INFO(arginfo_disk_total_space, 0) + ZEND_ARG_INFO(0, path) +ZEND_END_ARG_INFO() + +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) +ZEND_END_ARG_INFO() + +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) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, group) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_lchown, 0) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, user) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO(arginfo_chmod, 0) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, mode) +ZEND_END_ARG_INFO() + +#if HAVE_UTIME +ZEND_BEGIN_ARG_INFO_EX(arginfo_touch, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, time) + ZEND_ARG_INFO(0, atime) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO_EX(arginfo_clearstatcache, 0, 0, 0) + ZEND_ARG_INFO(0, clear_realpath_cache) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_realpath_cache_size, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_realpath_cache_get, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_fileperms, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_fileinode, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_filesize, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_fileowner, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_filegroup, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_fileatime, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_filemtime, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_filectime, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_filetype, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_writable, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_readable, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_executable, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_file, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_dir, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_link, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_file_exists, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_lstat, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stat, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ formatted_print.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_sprintf, 0, 0, 2) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, arg1) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_vsprintf, 0) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, args) /* ARRAY_INFO(0, args, 1) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_printf, 0, 0, 1) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, arg1) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_vprintf, 0) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, args) /* ARRAY_INFO(0, args, 1) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_fprintf, 0, 0, 2) + ZEND_ARG_INFO(0, stream) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, arg1) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_vfprintf, 0) + ZEND_ARG_INFO(0, stream) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, args) /* ARRAY_INFO(0, args, 1) */ +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ fsock.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_fsockopen, 0, 0, 2) + ZEND_ARG_INFO(0, hostname) + ZEND_ARG_INFO(0, port) + ZEND_ARG_INFO(1, errno) + ZEND_ARG_INFO(1, errstr) + ZEND_ARG_INFO(0, timeout) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_pfsockopen, 0, 0, 2) + ZEND_ARG_INFO(0, hostname) + ZEND_ARG_INFO(0, port) + ZEND_ARG_INFO(1, errno) + ZEND_ARG_INFO(1, errstr) + ZEND_ARG_INFO(0, timeout) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ ftok.c */ +#if HAVE_FTOK +ZEND_BEGIN_ARG_INFO(arginfo_ftok, 0) + ZEND_ARG_INFO(0, pathname) + ZEND_ARG_INFO(0, proj) +ZEND_END_ARG_INFO() +#endif +/* }}} */ +/* {{{ head.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_header, 0, 0, 1) + ZEND_ARG_INFO(0, header) + ZEND_ARG_INFO(0, replace) + ZEND_ARG_INFO(0, http_response_code) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_header_remove, 0, 0, 0) + ZEND_ARG_INFO(0, name) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_setcookie, 0, 0, 1) + ZEND_ARG_INFO(0, name) + ZEND_ARG_INFO(0, value) + ZEND_ARG_INFO(0, expires) + ZEND_ARG_INFO(0, path) + ZEND_ARG_INFO(0, domain) + ZEND_ARG_INFO(0, secure) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_setrawcookie, 0, 0, 1) + ZEND_ARG_INFO(0, name) + ZEND_ARG_INFO(0, value) + ZEND_ARG_INFO(0, expires) + ZEND_ARG_INFO(0, path) + ZEND_ARG_INFO(0, domain) + ZEND_ARG_INFO(0, secure) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_headers_sent, 0, 0, 0) + ZEND_ARG_INFO(1, file) + ZEND_ARG_INFO(1, line) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_headers_list, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_http_response_code, 0, 0, 0) + ZEND_ARG_INFO(0, response_code) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ html.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars, 0, 0, 1) + ZEND_ARG_INFO(0, string) + ZEND_ARG_INFO(0, quote_style) + ZEND_ARG_INFO(0, charset) + ZEND_ARG_INFO(0, double_encode) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars_decode, 0, 0, 1) + ZEND_ARG_INFO(0, string) + ZEND_ARG_INFO(0, quote_style) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_html_entity_decode, 0, 0, 1) + ZEND_ARG_INFO(0, string) + ZEND_ARG_INFO(0, quote_style) + ZEND_ARG_INFO(0, charset) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlentities, 0, 0, 1) + ZEND_ARG_INFO(0, string) + ZEND_ARG_INFO(0, quote_style) + ZEND_ARG_INFO(0, charset) + ZEND_ARG_INFO(0, double_encode) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_get_html_translation_table, 0, 0, 0) + ZEND_ARG_INFO(0, table) + ZEND_ARG_INFO(0, quote_style) +ZEND_END_ARG_INFO() + +/* }}} */ +/* {{{ http.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_http_build_query, 0, 0, 1) + ZEND_ARG_INFO(0, formdata) + ZEND_ARG_INFO(0, prefix) + ZEND_ARG_INFO(0, arg_separator) + ZEND_ARG_INFO(0, enc_type) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ image.c */ +ZEND_BEGIN_ARG_INFO(arginfo_image_type_to_mime_type, 0) + ZEND_ARG_INFO(0, imagetype) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_image_type_to_extension, 0, 0, 1) + ZEND_ARG_INFO(0, imagetype) + ZEND_ARG_INFO(0, include_dot) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_getimagesize, 0, 0, 1) + ZEND_ARG_INFO(0, imagefile) + ZEND_ARG_INFO(1, info) /* ARRAY_INFO(1, info, 1) */ +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ info.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_phpinfo, 0, 0, 0) + ZEND_ARG_INFO(0, what) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phpversion, 0, 0, 0) + ZEND_ARG_INFO(0, extension) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phpcredits, 0, 0, 0) + ZEND_ARG_INFO(0, flag) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_php_logo_guid, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_php_real_logo_guid, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_php_egg_logo_guid, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_zend_logo_guid, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_php_sapi_name, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_php_uname, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_php_ini_scanned_files, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_php_ini_loaded_file, 0) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ iptc.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_iptcembed, 0, 0, 2) + ZEND_ARG_INFO(0, iptcdata) + ZEND_ARG_INFO(0, jpeg_file_name) + ZEND_ARG_INFO(0, spool) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_iptcparse, 0) + ZEND_ARG_INFO(0, iptcdata) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ lcg.c */ +ZEND_BEGIN_ARG_INFO(arginfo_lcg_value, 0) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ levenshtein.c */ +ZEND_BEGIN_ARG_INFO(arginfo_levenshtein, 0) + ZEND_ARG_INFO(0, str1) + ZEND_ARG_INFO(0, str2) + ZEND_ARG_INFO(0, cost_ins) + ZEND_ARG_INFO(0, cost_rep) + ZEND_ARG_INFO(0, cost_del) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ link.c */ +#if defined(HAVE_SYMLINK) || defined(PHP_WIN32) +ZEND_BEGIN_ARG_INFO(arginfo_readlink, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_linkinfo, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_symlink, 0) + ZEND_ARG_INFO(0, target) + ZEND_ARG_INFO(0, link) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_link, 0) + ZEND_ARG_INFO(0, target) + ZEND_ARG_INFO(0, link) +ZEND_END_ARG_INFO() +#endif +/* }}} */ +/* {{{ mail.c */ +ZEND_BEGIN_ARG_INFO(arginfo_ezmlm_hash, 0) + ZEND_ARG_INFO(0, addr) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_mail, 0, 0, 3) + ZEND_ARG_INFO(0, to) + ZEND_ARG_INFO(0, subject) + ZEND_ARG_INFO(0, message) + ZEND_ARG_INFO(0, additional_headers) + ZEND_ARG_INFO(0, additional_parameters) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ math.c */ +ZEND_BEGIN_ARG_INFO(arginfo_abs, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ceil, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_floor, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_round, 0, 0, 1) + ZEND_ARG_INFO(0, number) + ZEND_ARG_INFO(0, precision) + ZEND_ARG_INFO(0, mode) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_sin, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_cos, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_tan, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_asin, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_acos, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_atan, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_atan2, 0) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, x) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_sinh, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_cosh, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_tanh, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_asinh, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_acosh, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_atanh, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_pi, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_finite, 0) + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_infinite, 0) + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_nan, 0) + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_pow, 0) + ZEND_ARG_INFO(0, base) + ZEND_ARG_INFO(0, exponent) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_exp, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_expm1, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_log1p, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_log, 0, 0, 1) + ZEND_ARG_INFO(0, number) + ZEND_ARG_INFO(0, base) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_log10, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_sqrt, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_hypot, 0) + ZEND_ARG_INFO(0, num1) + ZEND_ARG_INFO(0, num2) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_deg2rad, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_rad2deg, 0) + ZEND_ARG_INFO(0, number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_bindec, 0) + ZEND_ARG_INFO(0, binary_number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_hexdec, 0) + ZEND_ARG_INFO(0, hexadecimal_number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_octdec, 0) + ZEND_ARG_INFO(0, octal_number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_decbin, 0) + ZEND_ARG_INFO(0, decimal_number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_decoct, 0) + ZEND_ARG_INFO(0, decimal_number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_dechex, 0) + ZEND_ARG_INFO(0, decimal_number) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_base_convert, 0) + ZEND_ARG_INFO(0, number) + ZEND_ARG_INFO(0, frombase) + ZEND_ARG_INFO(0, tobase) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_number_format, 0, 0, 1) + ZEND_ARG_INFO(0, number) + ZEND_ARG_INFO(0, num_decimal_places) + ZEND_ARG_INFO(0, dec_seperator) + ZEND_ARG_INFO(0, thousands_seperator) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_fmod, 0) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ md5.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_md5, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, raw_output) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_md5_file, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, raw_output) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ metaphone.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_metaphone, 0, 0, 1) + ZEND_ARG_INFO(0, text) + ZEND_ARG_INFO(0, phones) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ microtime.c */ +#ifdef HAVE_GETTIMEOFDAY +ZEND_BEGIN_ARG_INFO_EX(arginfo_microtime, 0, 0, 0) + ZEND_ARG_INFO(0, get_as_float) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_gettimeofday, 0, 0, 0) + ZEND_ARG_INFO(0, get_as_float) +ZEND_END_ARG_INFO() +#endif + +#ifdef HAVE_GETRUSAGE +ZEND_BEGIN_ARG_INFO_EX(arginfo_getrusage, 0, 0, 0) + ZEND_ARG_INFO(0, who) +ZEND_END_ARG_INFO() +#endif +/* }}} */ +/* {{{ pack.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_pack, 0, 0, 2) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, arg1) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_unpack, 0) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, input) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ pageinfo.c */ +ZEND_BEGIN_ARG_INFO(arginfo_getmyuid, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_getmygid, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_getmypid, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_getmyinode, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_getlastmod, 0) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ proc_open.c */ +#ifdef PHP_CAN_SUPPORT_PROC_OPEN +ZEND_BEGIN_ARG_INFO_EX(arginfo_proc_terminate, 0, 0, 1) + ZEND_ARG_INFO(0, process) + ZEND_ARG_INFO(0, signal) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_proc_close, 0) + ZEND_ARG_INFO(0, process) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_proc_get_status, 0) + ZEND_ARG_INFO(0, process) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_proc_open, 0, 0, 3) + ZEND_ARG_INFO(0, command) + ZEND_ARG_INFO(0, descriptorspec) /* ARRAY_INFO(0, descriptorspec, 1) */ + ZEND_ARG_INFO(1, pipes) /* ARRAY_INFO(1, pipes, 1) */ + ZEND_ARG_INFO(0, cwd) + ZEND_ARG_INFO(0, env) /* ARRAY_INFO(0, env, 1) */ + ZEND_ARG_INFO(0, other_options) /* ARRAY_INFO(0, other_options, 1) */ +ZEND_END_ARG_INFO() +#endif +/* }}} */ +/* {{{ quot_print.c */ +ZEND_BEGIN_ARG_INFO(arginfo_quoted_printable_decode, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ quot_print.c */ +ZEND_BEGIN_ARG_INFO(arginfo_quoted_printable_encode, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ rand.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_srand, 0, 0, 0) + ZEND_ARG_INFO(0, seed) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_mt_srand, 0, 0, 0) + ZEND_ARG_INFO(0, seed) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_rand, 0, 0, 0) + ZEND_ARG_INFO(0, min) + ZEND_ARG_INFO(0, max) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_mt_rand, 0, 0, 0) + ZEND_ARG_INFO(0, min) + ZEND_ARG_INFO(0, max) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_getrandmax, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_mt_getrandmax, 0) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ sha1.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_sha1, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, raw_output) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_sha1_file, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, raw_output) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ soundex.c */ +ZEND_BEGIN_ARG_INFO(arginfo_soundex, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ streamsfuncs.c */ +#if HAVE_SOCKETPAIR +ZEND_BEGIN_ARG_INFO(arginfo_stream_socket_pair, 0) + ZEND_ARG_INFO(0, domain) + ZEND_ARG_INFO(0, type) + ZEND_ARG_INFO(0, protocol) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_client, 0, 0, 1) + ZEND_ARG_INFO(0, remoteaddress) + ZEND_ARG_INFO(1, errcode) + ZEND_ARG_INFO(1, errstring) + ZEND_ARG_INFO(0, timeout) + ZEND_ARG_INFO(0, flags) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_server, 0, 0, 1) + ZEND_ARG_INFO(0, localaddress) + ZEND_ARG_INFO(1, errcode) + ZEND_ARG_INFO(1, errstring) + ZEND_ARG_INFO(0, flags) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_accept, 0, 0, 1) + ZEND_ARG_INFO(0, serverstream) + ZEND_ARG_INFO(0, timeout) + ZEND_ARG_INFO(1, peername) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_socket_get_name, 0) + ZEND_ARG_INFO(0, stream) + ZEND_ARG_INFO(0, want_peer) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_sendto, 0, 0, 2) + ZEND_ARG_INFO(0, stream) + ZEND_ARG_INFO(0, data) + ZEND_ARG_INFO(0, flags) + ZEND_ARG_INFO(0, target_addr) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_recvfrom, 0, 0, 2) + ZEND_ARG_INFO(0, stream) + ZEND_ARG_INFO(0, amount) + ZEND_ARG_INFO(0, flags) + ZEND_ARG_INFO(1, remote_addr) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_get_contents, 0, 0, 1) + ZEND_ARG_INFO(0, source) + ZEND_ARG_INFO(0, maxlen) + ZEND_ARG_INFO(0, offset) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_copy_to_stream, 0, 0, 2) + ZEND_ARG_INFO(0, source) + ZEND_ARG_INFO(0, dest) + ZEND_ARG_INFO(0, maxlen) + ZEND_ARG_INFO(0, pos) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_get_meta_data, 0) + ZEND_ARG_INFO(0, fp) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_get_transports, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_get_wrappers, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_resolve_include_path, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_is_local, 0) + ZEND_ARG_INFO(0, stream) +ZEND_END_ARG_INFO() + +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_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) */ + ZEND_ARG_INFO(1, except_streams) /* ARRAY_INFO(1, except_streams, 1) */ + ZEND_ARG_INFO(0, tv_sec) + ZEND_ARG_INFO(0, tv_usec) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_context_get_options, 0) + ZEND_ARG_INFO(0, stream_or_context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_context_set_option, 0) + ZEND_ARG_INFO(0, stream_or_context) + ZEND_ARG_INFO(0, wrappername) + ZEND_ARG_INFO(0, optionname) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_context_set_params, 0) + ZEND_ARG_INFO(0, stream_or_context) + ZEND_ARG_INFO(0, options) /* ARRAY_INFO(0, options, 1) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_get_params, 0, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, stream_or_context) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_get_default, 0, 0, 0) + ZEND_ARG_INFO(0, options) /* ARRAY_INFO(0, options, 1) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_context_set_default, 0) + ZEND_ARG_INFO(0, options) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_create, 0, 0, 0) + ZEND_ARG_INFO(0, options) /* ARRAY_INFO(0, options, 1) */ + ZEND_ARG_INFO(0, params) /* ARRAY_INFO(0, params, 1) */ +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_filter_prepend, 0, 0, 2) + ZEND_ARG_INFO(0, stream) + ZEND_ARG_INFO(0, filtername) + ZEND_ARG_INFO(0, read_write) + ZEND_ARG_INFO(0, filterparams) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_filter_append, 0, 0, 2) + ZEND_ARG_INFO(0, stream) + ZEND_ARG_INFO(0, filtername) + ZEND_ARG_INFO(0, read_write) + ZEND_ARG_INFO(0, filterparams) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_filter_remove, 0) + ZEND_ARG_INFO(0, stream_filter) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_get_line, 0, 0, 2) + ZEND_ARG_INFO(0, stream) + ZEND_ARG_INFO(0, maxlen) + ZEND_ARG_INFO(0, ending) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_set_blocking, 0) + ZEND_ARG_INFO(0, socket) + ZEND_ARG_INFO(0, mode) +ZEND_END_ARG_INFO() + +#if HAVE_SYS_TIME_H || defined(PHP_WIN32) +ZEND_BEGIN_ARG_INFO(arginfo_stream_set_timeout, 0) + ZEND_ARG_INFO(0, stream) + ZEND_ARG_INFO(0, seconds) + ZEND_ARG_INFO(0, microseconds) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO(arginfo_stream_set_read_buffer, 0) + ZEND_ARG_INFO(0, fp) + ZEND_ARG_INFO(0, buffer) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_set_write_buffer, 0) + ZEND_ARG_INFO(0, fp) + ZEND_ARG_INFO(0, buffer) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_set_chunk_size, 0) + ZEND_ARG_INFO(0, fp) + ZEND_ARG_INFO(0, chunk_size) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_enable_crypto, 0, 0, 2) + ZEND_ARG_INFO(0, stream) + ZEND_ARG_INFO(0, enable) + ZEND_ARG_INFO(0, cryptokind) + ZEND_ARG_INFO(0, sessionstream) +ZEND_END_ARG_INFO() + +#ifdef HAVE_SHUTDOWN +ZEND_BEGIN_ARG_INFO(arginfo_stream_socket_shutdown, 0) + ZEND_ARG_INFO(0, stream) + ZEND_ARG_INFO(0, how) +ZEND_END_ARG_INFO() +#endif +/* }}} */ +/* {{{ string.c */ +ZEND_BEGIN_ARG_INFO(arginfo_bin2hex, 0) + ZEND_ARG_INFO(0, data) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_hex2bin, 0) + ZEND_ARG_INFO(0, data) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_strspn, 0, 0, 2) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, mask) + ZEND_ARG_INFO(0, start) + ZEND_ARG_INFO(0, len) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_strcspn, 0, 0, 2) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, mask) + ZEND_ARG_INFO(0, start) + ZEND_ARG_INFO(0, len) +ZEND_END_ARG_INFO() + +#if HAVE_NL_LANGINFO +ZEND_BEGIN_ARG_INFO(arginfo_nl_langinfo, 0) + ZEND_ARG_INFO(0, item) +ZEND_END_ARG_INFO() +#endif + +#ifdef HAVE_STRCOLL +ZEND_BEGIN_ARG_INFO(arginfo_strcoll, 0) + ZEND_ARG_INFO(0, str1) + ZEND_ARG_INFO(0, str2) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO_EX(arginfo_trim, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, character_mask) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_rtrim, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, character_mask) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ltrim, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, character_mask) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_wordwrap, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, break) + ZEND_ARG_INFO(0, cut) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_explode, 0, 0, 2) + ZEND_ARG_INFO(0, separator) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, limit) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_implode, 0) + ZEND_ARG_INFO(0, glue) + ZEND_ARG_INFO(0, pieces) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_strtok, 0) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, token) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_strtoupper, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_strtolower, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_basename, 0, 0, 1) + ZEND_ARG_INFO(0, path) + ZEND_ARG_INFO(0, suffix) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_dirname, 0) + ZEND_ARG_INFO(0, path) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_pathinfo, 0, 0, 1) + ZEND_ARG_INFO(0, path) + ZEND_ARG_INFO(0, options) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stristr, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, part) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_strstr, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, part) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_strpos, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, offset) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stripos, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, offset) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_strrpos, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, offset) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_strripos, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, offset) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_strrchr, 0) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_chunk_split, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, chunklen) + ZEND_ARG_INFO(0, ending) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_substr, 0, 0, 2) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, start) + ZEND_ARG_INFO(0, length) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_replace, 0, 0, 3) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, replace) + ZEND_ARG_INFO(0, start) + ZEND_ARG_INFO(0, length) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_quotemeta, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ord, 0) + ZEND_ARG_INFO(0, character) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_chr, 0) + ZEND_ARG_INFO(0, codepoint) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ucfirst, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_lcfirst, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_ucwords, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_strtr, 0, 0, 2) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, from) + ZEND_ARG_INFO(0, to) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_strrev, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_similar_text, 0, 0, 2) + ZEND_ARG_INFO(0, str1) + ZEND_ARG_INFO(0, str2) + ZEND_ARG_INFO(1, percent) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_addcslashes, 0) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, charlist) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_addslashes, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stripcslashes, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stripslashes, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_str_replace, 0, 0, 3) + ZEND_ARG_INFO(0, search) + ZEND_ARG_INFO(0, replace) + ZEND_ARG_INFO(0, subject) + ZEND_ARG_INFO(1, replace_count) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_str_ireplace, 0, 0, 3) + ZEND_ARG_INFO(0, search) + ZEND_ARG_INFO(0, replace) + ZEND_ARG_INFO(0, subject) + ZEND_ARG_INFO(1, replace_count) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_hebrev, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, max_chars_per_line) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_hebrevc, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, max_chars_per_line) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_nl2br, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, is_xhtml) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_strip_tags, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, allowable_tags) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_setlocale, 0, 0, 2) + ZEND_ARG_INFO(0, category) + ZEND_ARG_INFO(0, locale) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_str, 0, 0, 1) + ZEND_ARG_INFO(0, encoded_string) + ZEND_ARG_INFO(1, result) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_str_getcsv, 0, 0, 1) + ZEND_ARG_INFO(0, string) + ZEND_ARG_INFO(0, delimiter) + ZEND_ARG_INFO(0, enclosure) + ZEND_ARG_INFO(0, escape) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_str_repeat, 0) + ZEND_ARG_INFO(0, input) + ZEND_ARG_INFO(0, mult) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_count_chars, 0, 0, 1) + ZEND_ARG_INFO(0, input) + ZEND_ARG_INFO(0, mode) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_strnatcmp, 0) + ZEND_ARG_INFO(0, s1) + ZEND_ARG_INFO(0, s2) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_localeconv, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_strnatcasecmp, 0) + ZEND_ARG_INFO(0, s1) + ZEND_ARG_INFO(0, s2) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_count, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, length) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_str_pad, 0, 0, 2) + ZEND_ARG_INFO(0, input) + ZEND_ARG_INFO(0, pad_length) + ZEND_ARG_INFO(0, pad_string) + ZEND_ARG_INFO(0, pad_type) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_sscanf, 1, 0, 2) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(1, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_str_rot13, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_str_shuffle, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_str_word_count, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, charlist) +ZEND_END_ARG_INFO() + +#ifdef HAVE_STRFMON +ZEND_BEGIN_ARG_INFO(arginfo_money_format, 0) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO_EX(arginfo_str_split, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, split_length) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_strpbrk, 0, 0, 1) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, char_list) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_compare, 0, 0, 3) + ZEND_ARG_INFO(0, main_str) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, length) + ZEND_ARG_INFO(0, case_sensitivity) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ syslog.c */ +#ifdef HAVE_SYSLOG_H +ZEND_BEGIN_ARG_INFO(arginfo_openlog, 0) + ZEND_ARG_INFO(0, ident) + ZEND_ARG_INFO(0, option) + ZEND_ARG_INFO(0, facility) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_closelog, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_syslog, 0) + ZEND_ARG_INFO(0, priority) + ZEND_ARG_INFO(0, message) +ZEND_END_ARG_INFO() +#endif +/* }}} */ +/* {{{ type.c */ +ZEND_BEGIN_ARG_INFO(arginfo_gettype, 0) + ZEND_ARG_INFO(0, var) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_settype, 0) + ZEND_ARG_INFO(1, var) + ZEND_ARG_INFO(0, type) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_intval, 0, 0, 1) + ZEND_ARG_INFO(0, var) + ZEND_ARG_INFO(0, base) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_floatval, 0) + ZEND_ARG_INFO(0, var) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_strval, 0) + ZEND_ARG_INFO(0, var) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_null, 0) + ZEND_ARG_INFO(0, var) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_resource, 0) + ZEND_ARG_INFO(0, var) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_bool, 0) + ZEND_ARG_INFO(0, var) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_long, 0) + ZEND_ARG_INFO(0, var) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_float, 0) + ZEND_ARG_INFO(0, var) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_string, 0) + ZEND_ARG_INFO(0, var) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_array, 0) + ZEND_ARG_INFO(0, var) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_object, 0) + ZEND_ARG_INFO(0, var) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_numeric, 0) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_is_scalar, 0) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_is_callable, 0, 0, 1) + ZEND_ARG_INFO(0, var) + ZEND_ARG_INFO(0, syntax_only) + ZEND_ARG_INFO(1, callable_name) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ uniqid.c */ +#ifdef HAVE_GETTIMEOFDAY +ZEND_BEGIN_ARG_INFO_EX(arginfo_uniqid, 0, 0, 0) + ZEND_ARG_INFO(0, prefix) + ZEND_ARG_INFO(0, more_entropy) +ZEND_END_ARG_INFO() +#endif +/* }}} */ +/* {{{ url.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_url, 0, 0, 1) + ZEND_ARG_INFO(0, url) + ZEND_ARG_INFO(0, component) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_urlencode, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_urldecode, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_rawurlencode, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_rawurldecode, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_get_headers, 0, 0, 1) + ZEND_ARG_INFO(0, url) + ZEND_ARG_INFO(0, format) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ user_filters.c */ +ZEND_BEGIN_ARG_INFO(arginfo_stream_bucket_make_writeable, 0) + ZEND_ARG_INFO(0, brigade) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_bucket_prepend, 0) + ZEND_ARG_INFO(0, brigade) + ZEND_ARG_INFO(0, bucket) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_bucket_append, 0) + ZEND_ARG_INFO(0, brigade) + ZEND_ARG_INFO(0, bucket) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_bucket_new, 0) + ZEND_ARG_INFO(0, stream) + ZEND_ARG_INFO(0, buffer) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_get_filters, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_stream_filter_register, 0) + ZEND_ARG_INFO(0, filtername) + ZEND_ARG_INFO(0, classname) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ uuencode.c */ +ZEND_BEGIN_ARG_INFO(arginfo_convert_uuencode, 0) + ZEND_ARG_INFO(0, data) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_convert_uudecode, 0) + ZEND_ARG_INFO(0, data) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ var.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_var_dump, 0, 0, 1) + ZEND_ARG_INFO(0, var) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_debug_zval_dump, 0, 0, 1) + ZEND_ARG_INFO(0, var) + ZEND_ARG_INFO(0, ...) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_var_export, 0, 0, 1) + ZEND_ARG_INFO(0, var) + ZEND_ARG_INFO(0, return) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_serialize, 0) + ZEND_ARG_INFO(0, var) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_unserialize, 0) + ZEND_ARG_INFO(0, variable_representation) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_memory_get_usage, 0, 0, 0) + ZEND_ARG_INFO(0, real_usage) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_memory_get_peak_usage, 0, 0, 0) + ZEND_ARG_INFO(0, real_usage) +ZEND_END_ARG_INFO() +/* }}} */ +/* {{{ versioning.c */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_version_compare, 0, 0, 2) + ZEND_ARG_INFO(0, ver1) + ZEND_ARG_INFO(0, ver2) + ZEND_ARG_INFO(0, oper) +ZEND_END_ARG_INFO() +/* }}} */ +/* }}} */ + +const zend_function_entry basic_functions[] = { /* {{{ */ + PHP_FE(constant, arginfo_constant) + PHP_FE(bin2hex, arginfo_bin2hex) + PHP_FE(hex2bin, arginfo_hex2bin) + PHP_FE(sleep, arginfo_sleep) + PHP_FE(usleep, arginfo_usleep) +#if HAVE_NANOSLEEP + PHP_FE(time_nanosleep, arginfo_time_nanosleep) + PHP_FE(time_sleep_until, arginfo_time_sleep_until) +#endif + +#if HAVE_STRPTIME + PHP_FE(strptime, arginfo_strptime) +#endif + + PHP_FE(flush, arginfo_flush) + PHP_FE(wordwrap, arginfo_wordwrap) + PHP_FE(htmlspecialchars, arginfo_htmlspecialchars) + PHP_FE(htmlentities, arginfo_htmlentities) + PHP_FE(html_entity_decode, arginfo_html_entity_decode) + PHP_FE(htmlspecialchars_decode, arginfo_htmlspecialchars_decode) + PHP_FE(get_html_translation_table, arginfo_get_html_translation_table) + PHP_FE(sha1, arginfo_sha1) + PHP_FE(sha1_file, arginfo_sha1_file) + PHP_NAMED_FE(md5,php_if_md5, arginfo_md5) + PHP_NAMED_FE(md5_file,php_if_md5_file, arginfo_md5_file) + PHP_NAMED_FE(crc32,php_if_crc32, arginfo_crc32) + + PHP_FE(iptcparse, arginfo_iptcparse) + PHP_FE(iptcembed, arginfo_iptcembed) + PHP_FE(getimagesize, arginfo_getimagesize) + PHP_FE(getimagesizefromstring, arginfo_getimagesize) + PHP_FE(image_type_to_mime_type, arginfo_image_type_to_mime_type) + PHP_FE(image_type_to_extension, arginfo_image_type_to_extension) + + PHP_FE(phpinfo, arginfo_phpinfo) + PHP_FE(phpversion, arginfo_phpversion) + PHP_FE(phpcredits, arginfo_phpcredits) + PHP_FE(php_logo_guid, arginfo_php_logo_guid) + PHP_FE(php_real_logo_guid, arginfo_php_real_logo_guid) + PHP_FE(php_egg_logo_guid, arginfo_php_egg_logo_guid) + PHP_FE(zend_logo_guid, arginfo_zend_logo_guid) + PHP_FE(php_sapi_name, arginfo_php_sapi_name) + PHP_FE(php_uname, arginfo_php_uname) + PHP_FE(php_ini_scanned_files, arginfo_php_ini_scanned_files) + PHP_FE(php_ini_loaded_file, arginfo_php_ini_loaded_file) + + PHP_FE(strnatcmp, arginfo_strnatcmp) + PHP_FE(strnatcasecmp, arginfo_strnatcasecmp) + PHP_FE(substr_count, arginfo_substr_count) + PHP_FE(strspn, arginfo_strspn) + PHP_FE(strcspn, arginfo_strcspn) + PHP_FE(strtok, arginfo_strtok) + PHP_FE(strtoupper, arginfo_strtoupper) + PHP_FE(strtolower, arginfo_strtolower) + PHP_FE(strpos, arginfo_strpos) + PHP_FE(stripos, arginfo_stripos) + PHP_FE(strrpos, arginfo_strrpos) + PHP_FE(strripos, arginfo_strripos) + PHP_FE(strrev, arginfo_strrev) + PHP_FE(hebrev, arginfo_hebrev) + PHP_FE(hebrevc, arginfo_hebrevc) + PHP_FE(nl2br, arginfo_nl2br) + PHP_FE(basename, arginfo_basename) + PHP_FE(dirname, arginfo_dirname) + PHP_FE(pathinfo, arginfo_pathinfo) + PHP_FE(stripslashes, arginfo_stripslashes) + PHP_FE(stripcslashes, arginfo_stripcslashes) + PHP_FE(strstr, arginfo_strstr) + PHP_FE(stristr, arginfo_stristr) + PHP_FE(strrchr, arginfo_strrchr) + PHP_FE(str_shuffle, arginfo_str_shuffle) + PHP_FE(str_word_count, arginfo_str_word_count) + PHP_FE(str_split, arginfo_str_split) + PHP_FE(strpbrk, arginfo_strpbrk) + PHP_FE(substr_compare, arginfo_substr_compare) + +#ifdef HAVE_STRCOLL + PHP_FE(strcoll, arginfo_strcoll) +#endif + +#ifdef HAVE_STRFMON + PHP_FE(money_format, arginfo_money_format) +#endif + + PHP_FE(substr, arginfo_substr) + PHP_FE(substr_replace, arginfo_substr_replace) + PHP_FE(quotemeta, arginfo_quotemeta) + PHP_FE(ucfirst, arginfo_ucfirst) + PHP_FE(lcfirst, arginfo_lcfirst) + PHP_FE(ucwords, arginfo_ucwords) + PHP_FE(strtr, arginfo_strtr) + PHP_FE(addslashes, arginfo_addslashes) + PHP_FE(addcslashes, arginfo_addcslashes) + PHP_FE(rtrim, arginfo_rtrim) + PHP_FE(str_replace, arginfo_str_replace) + PHP_FE(str_ireplace, arginfo_str_ireplace) + PHP_FE(str_repeat, arginfo_str_repeat) + PHP_FE(count_chars, arginfo_count_chars) + PHP_FE(chunk_split, arginfo_chunk_split) + PHP_FE(trim, arginfo_trim) + PHP_FE(ltrim, arginfo_ltrim) + PHP_FE(strip_tags, arginfo_strip_tags) + PHP_FE(similar_text, arginfo_similar_text) + PHP_FE(explode, arginfo_explode) + PHP_FE(implode, arginfo_implode) + PHP_FALIAS(join, implode, arginfo_implode) + PHP_FE(setlocale, arginfo_setlocale) + PHP_FE(localeconv, arginfo_localeconv) + +#if HAVE_NL_LANGINFO + PHP_FE(nl_langinfo, arginfo_nl_langinfo) +#endif + + PHP_FE(soundex, arginfo_soundex) + PHP_FE(levenshtein, arginfo_levenshtein) + PHP_FE(chr, arginfo_chr) + PHP_FE(ord, arginfo_ord) + PHP_FE(parse_str, arginfo_parse_str) + PHP_FE(str_getcsv, arginfo_str_getcsv) + PHP_FE(str_pad, arginfo_str_pad) + PHP_FALIAS(chop, rtrim, arginfo_rtrim) + PHP_FALIAS(strchr, strstr, arginfo_strstr) + PHP_NAMED_FE(sprintf, PHP_FN(user_sprintf), arginfo_sprintf) + PHP_NAMED_FE(printf, PHP_FN(user_printf), arginfo_printf) + PHP_FE(vprintf, arginfo_vprintf) + PHP_FE(vsprintf, arginfo_vsprintf) + PHP_FE(fprintf, arginfo_fprintf) + PHP_FE(vfprintf, arginfo_vfprintf) + PHP_FE(sscanf, arginfo_sscanf) + PHP_FE(fscanf, arginfo_fscanf) + PHP_FE(parse_url, arginfo_parse_url) + PHP_FE(urlencode, arginfo_urlencode) + PHP_FE(urldecode, arginfo_urldecode) + PHP_FE(rawurlencode, arginfo_rawurlencode) + PHP_FE(rawurldecode, arginfo_rawurldecode) + PHP_FE(http_build_query, arginfo_http_build_query) + +#if defined(HAVE_SYMLINK) || defined(PHP_WIN32) + PHP_FE(readlink, arginfo_readlink) + PHP_FE(linkinfo, arginfo_linkinfo) + PHP_FE(symlink, arginfo_symlink) + PHP_FE(link, arginfo_link) +#endif + + PHP_FE(unlink, arginfo_unlink) + PHP_FE(exec, arginfo_exec) + PHP_FE(system, arginfo_system) + PHP_FE(escapeshellcmd, arginfo_escapeshellcmd) + PHP_FE(escapeshellarg, arginfo_escapeshellarg) + PHP_FE(passthru, arginfo_passthru) + PHP_FE(shell_exec, arginfo_shell_exec) +#ifdef PHP_CAN_SUPPORT_PROC_OPEN + PHP_FE(proc_open, arginfo_proc_open) + PHP_FE(proc_close, arginfo_proc_close) + PHP_FE(proc_terminate, arginfo_proc_terminate) + PHP_FE(proc_get_status, arginfo_proc_get_status) +#endif + +#ifdef HAVE_NICE + PHP_FE(proc_nice, arginfo_proc_nice) +#endif + + PHP_FE(rand, arginfo_rand) + PHP_FE(srand, arginfo_srand) + PHP_FE(getrandmax, arginfo_getrandmax) + PHP_FE(mt_rand, arginfo_mt_rand) + PHP_FE(mt_srand, arginfo_mt_srand) + PHP_FE(mt_getrandmax, arginfo_mt_getrandmax) + +#if HAVE_GETSERVBYNAME + PHP_FE(getservbyname, arginfo_getservbyname) +#endif + +#if HAVE_GETSERVBYPORT + PHP_FE(getservbyport, arginfo_getservbyport) +#endif + +#if HAVE_GETPROTOBYNAME + PHP_FE(getprotobyname, arginfo_getprotobyname) +#endif + +#if HAVE_GETPROTOBYNUMBER + PHP_FE(getprotobynumber, arginfo_getprotobynumber) +#endif + + PHP_FE(getmyuid, arginfo_getmyuid) + PHP_FE(getmygid, arginfo_getmygid) + PHP_FE(getmypid, arginfo_getmypid) + PHP_FE(getmyinode, arginfo_getmyinode) + PHP_FE(getlastmod, arginfo_getlastmod) + + PHP_FE(base64_decode, arginfo_base64_decode) + PHP_FE(base64_encode, arginfo_base64_encode) + + PHP_FE(convert_uuencode, arginfo_convert_uuencode) + PHP_FE(convert_uudecode, arginfo_convert_uudecode) + + PHP_FE(abs, arginfo_abs) + PHP_FE(ceil, arginfo_ceil) + PHP_FE(floor, arginfo_floor) + PHP_FE(round, arginfo_round) + PHP_FE(sin, arginfo_sin) + PHP_FE(cos, arginfo_cos) + PHP_FE(tan, arginfo_tan) + PHP_FE(asin, arginfo_asin) + PHP_FE(acos, arginfo_acos) + PHP_FE(atan, arginfo_atan) + PHP_FE(atanh, arginfo_atanh) + PHP_FE(atan2, arginfo_atan2) + PHP_FE(sinh, arginfo_sinh) + PHP_FE(cosh, arginfo_cosh) + PHP_FE(tanh, arginfo_tanh) + PHP_FE(asinh, arginfo_asinh) + PHP_FE(acosh, arginfo_acosh) + PHP_FE(expm1, arginfo_expm1) + PHP_FE(log1p, arginfo_log1p) + PHP_FE(pi, arginfo_pi) + PHP_FE(is_finite, arginfo_is_finite) + PHP_FE(is_nan, arginfo_is_nan) + PHP_FE(is_infinite, arginfo_is_infinite) + PHP_FE(pow, arginfo_pow) + PHP_FE(exp, arginfo_exp) + PHP_FE(log, arginfo_log) + PHP_FE(log10, arginfo_log10) + PHP_FE(sqrt, arginfo_sqrt) + PHP_FE(hypot, arginfo_hypot) + PHP_FE(deg2rad, arginfo_deg2rad) + PHP_FE(rad2deg, arginfo_rad2deg) + PHP_FE(bindec, arginfo_bindec) + PHP_FE(hexdec, arginfo_hexdec) + PHP_FE(octdec, arginfo_octdec) + PHP_FE(decbin, arginfo_decbin) + PHP_FE(decoct, arginfo_decoct) + PHP_FE(dechex, arginfo_dechex) + PHP_FE(base_convert, arginfo_base_convert) + PHP_FE(number_format, arginfo_number_format) + PHP_FE(fmod, arginfo_fmod) +#ifdef HAVE_INET_NTOP + PHP_RAW_NAMED_FE(inet_ntop, php_inet_ntop, arginfo_inet_ntop) +#endif +#ifdef HAVE_INET_PTON + PHP_RAW_NAMED_FE(inet_pton, php_inet_pton, arginfo_inet_pton) +#endif + PHP_FE(ip2long, arginfo_ip2long) + PHP_FE(long2ip, arginfo_long2ip) + + PHP_FE(getenv, arginfo_getenv) +#ifdef HAVE_PUTENV + PHP_FE(putenv, arginfo_putenv) +#endif + + PHP_FE(getopt, arginfo_getopt) + +#ifdef HAVE_GETLOADAVG + PHP_FE(sys_getloadavg, arginfo_sys_getloadavg) +#endif +#ifdef HAVE_GETTIMEOFDAY + PHP_FE(microtime, arginfo_microtime) + PHP_FE(gettimeofday, arginfo_gettimeofday) +#endif + +#ifdef HAVE_GETRUSAGE + PHP_FE(getrusage, arginfo_getrusage) +#endif + +#ifdef HAVE_GETTIMEOFDAY + PHP_FE(uniqid, arginfo_uniqid) +#endif + + PHP_FE(quoted_printable_decode, arginfo_quoted_printable_decode) + PHP_FE(quoted_printable_encode, arginfo_quoted_printable_encode) + PHP_FE(convert_cyr_string, arginfo_convert_cyr_string) + PHP_FE(get_current_user, arginfo_get_current_user) + PHP_FE(set_time_limit, arginfo_set_time_limit) + PHP_FE(header_register_callback, arginfo_header_register_callback) + PHP_FE(get_cfg_var, arginfo_get_cfg_var) + + PHP_DEP_FALIAS(magic_quotes_runtime, set_magic_quotes_runtime, arginfo_set_magic_quotes_runtime) + PHP_DEP_FE(set_magic_quotes_runtime, arginfo_set_magic_quotes_runtime) + PHP_FE(get_magic_quotes_gpc, arginfo_get_magic_quotes_gpc) + PHP_FE(get_magic_quotes_runtime, arginfo_get_magic_quotes_runtime) + + PHP_FE(error_log, arginfo_error_log) + PHP_FE(error_get_last, arginfo_error_get_last) + PHP_FE(call_user_func, arginfo_call_user_func) + PHP_FE(call_user_func_array, arginfo_call_user_func_array) + PHP_DEP_FE(call_user_method, arginfo_call_user_method) + PHP_DEP_FE(call_user_method_array, arginfo_call_user_method_array) + PHP_FE(forward_static_call, arginfo_forward_static_call) + PHP_FE(forward_static_call_array, arginfo_forward_static_call_array) + PHP_FE(serialize, arginfo_serialize) + PHP_FE(unserialize, arginfo_unserialize) + + PHP_FE(var_dump, arginfo_var_dump) + PHP_FE(var_export, arginfo_var_export) + PHP_FE(debug_zval_dump, arginfo_debug_zval_dump) + PHP_FE(print_r, arginfo_print_r) + PHP_FE(memory_get_usage, arginfo_memory_get_usage) + PHP_FE(memory_get_peak_usage, arginfo_memory_get_peak_usage) + + PHP_FE(register_shutdown_function, arginfo_register_shutdown_function) + PHP_FE(register_tick_function, arginfo_register_tick_function) + PHP_FE(unregister_tick_function, arginfo_unregister_tick_function) + + PHP_FE(highlight_file, arginfo_highlight_file) + PHP_FALIAS(show_source, highlight_file, arginfo_highlight_file) + PHP_FE(highlight_string, arginfo_highlight_string) + PHP_FE(php_strip_whitespace, arginfo_php_strip_whitespace) + + PHP_FE(ini_get, arginfo_ini_get) + PHP_FE(ini_get_all, arginfo_ini_get_all) + PHP_FE(ini_set, arginfo_ini_set) + PHP_FALIAS(ini_alter, ini_set, arginfo_ini_set) + PHP_FE(ini_restore, arginfo_ini_restore) + PHP_FE(get_include_path, arginfo_get_include_path) + PHP_FE(set_include_path, arginfo_set_include_path) + PHP_FE(restore_include_path, arginfo_restore_include_path) + + PHP_FE(setcookie, arginfo_setcookie) + PHP_FE(setrawcookie, arginfo_setrawcookie) + PHP_FE(header, arginfo_header) + PHP_FE(header_remove, arginfo_header_remove) + PHP_FE(headers_sent, arginfo_headers_sent) + PHP_FE(headers_list, arginfo_headers_list) + PHP_FE(http_response_code, arginfo_http_response_code) + + PHP_FE(connection_aborted, arginfo_connection_aborted) + PHP_FE(connection_status, arginfo_connection_status) + PHP_FE(ignore_user_abort, arginfo_ignore_user_abort) + PHP_FE(parse_ini_file, arginfo_parse_ini_file) + PHP_FE(parse_ini_string, arginfo_parse_ini_string) +#if ZEND_DEBUG + PHP_FE(config_get_hash, arginfo_config_get_hash) +#endif + PHP_FE(is_uploaded_file, arginfo_is_uploaded_file) + PHP_FE(move_uploaded_file, arginfo_move_uploaded_file) + + /* functions from dns.c */ + PHP_FE(gethostbyaddr, arginfo_gethostbyaddr) + PHP_FE(gethostbyname, arginfo_gethostbyname) + PHP_FE(gethostbynamel, arginfo_gethostbynamel) + +#ifdef HAVE_GETHOSTNAME + PHP_FE(gethostname, arginfo_gethostname) +#endif + +#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE))) + + PHP_FE(dns_check_record, arginfo_dns_check_record) + PHP_FALIAS(checkdnsrr, dns_check_record, arginfo_dns_check_record) + +# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS + PHP_FE(dns_get_mx, arginfo_dns_get_mx) + PHP_FALIAS(getmxrr, dns_get_mx, arginfo_dns_get_mx) + PHP_FE(dns_get_record, arginfo_dns_get_record) +# endif +#endif + + /* functions from type.c */ + PHP_FE(intval, arginfo_intval) + PHP_FE(floatval, arginfo_floatval) + PHP_FALIAS(doubleval, floatval, arginfo_floatval) + PHP_FE(strval, arginfo_strval) + PHP_FE(gettype, arginfo_gettype) + PHP_FE(settype, arginfo_settype) + PHP_FE(is_null, arginfo_is_null) + PHP_FE(is_resource, arginfo_is_resource) + PHP_FE(is_bool, arginfo_is_bool) + PHP_FE(is_long, arginfo_is_long) + PHP_FE(is_float, arginfo_is_float) + PHP_FALIAS(is_int, is_long, arginfo_is_long) + PHP_FALIAS(is_integer, is_long, arginfo_is_long) + PHP_FALIAS(is_double, is_float, arginfo_is_float) + PHP_FALIAS(is_real, is_float, arginfo_is_float) + PHP_FE(is_numeric, arginfo_is_numeric) + PHP_FE(is_string, arginfo_is_string) + PHP_FE(is_array, arginfo_is_array) + PHP_FE(is_object, arginfo_is_object) + PHP_FE(is_scalar, arginfo_is_scalar) + PHP_FE(is_callable, arginfo_is_callable) + + /* functions from file.c */ + PHP_FE(pclose, arginfo_pclose) + PHP_FE(popen, arginfo_popen) + PHP_FE(readfile, arginfo_readfile) + PHP_FE(rewind, arginfo_rewind) + PHP_FE(rmdir, arginfo_rmdir) + PHP_FE(umask, arginfo_umask) + PHP_FE(fclose, arginfo_fclose) + PHP_FE(feof, arginfo_feof) + PHP_FE(fgetc, arginfo_fgetc) + PHP_FE(fgets, arginfo_fgets) + PHP_FE(fgetss, arginfo_fgetss) + PHP_FE(fread, arginfo_fread) + PHP_NAMED_FE(fopen, php_if_fopen, arginfo_fopen) + PHP_FE(fpassthru, arginfo_fpassthru) + PHP_NAMED_FE(ftruncate, php_if_ftruncate, arginfo_ftruncate) + PHP_NAMED_FE(fstat, php_if_fstat, arginfo_fstat) + PHP_FE(fseek, arginfo_fseek) + PHP_FE(ftell, arginfo_ftell) + PHP_FE(fflush, arginfo_fflush) + PHP_FE(fwrite, arginfo_fwrite) + PHP_FALIAS(fputs, fwrite, arginfo_fwrite) + PHP_FE(mkdir, arginfo_mkdir) + PHP_FE(rename, arginfo_rename) + PHP_FE(copy, arginfo_copy) + PHP_FE(tempnam, arginfo_tempnam) + PHP_NAMED_FE(tmpfile, php_if_tmpfile, arginfo_tmpfile) + PHP_FE(file, arginfo_file) + PHP_FE(file_get_contents, arginfo_file_get_contents) + PHP_FE(file_put_contents, arginfo_file_put_contents) + PHP_FE(stream_select, arginfo_stream_select) + PHP_FE(stream_context_create, arginfo_stream_context_create) + PHP_FE(stream_context_set_params, arginfo_stream_context_set_params) + PHP_FE(stream_context_get_params, arginfo_stream_context_get_params) + PHP_FE(stream_context_set_option, arginfo_stream_context_set_option) + PHP_FE(stream_context_get_options, arginfo_stream_context_get_options) + PHP_FE(stream_context_get_default, arginfo_stream_context_get_default) + PHP_FE(stream_context_set_default, arginfo_stream_context_set_default) + PHP_FE(stream_filter_prepend, arginfo_stream_filter_prepend) + PHP_FE(stream_filter_append, arginfo_stream_filter_append) + PHP_FE(stream_filter_remove, arginfo_stream_filter_remove) + PHP_FE(stream_socket_client, arginfo_stream_socket_client) + PHP_FE(stream_socket_server, arginfo_stream_socket_server) + PHP_FE(stream_socket_accept, arginfo_stream_socket_accept) + PHP_FE(stream_socket_get_name, arginfo_stream_socket_get_name) + PHP_FE(stream_socket_recvfrom, arginfo_stream_socket_recvfrom) + PHP_FE(stream_socket_sendto, arginfo_stream_socket_sendto) + PHP_FE(stream_socket_enable_crypto, arginfo_stream_socket_enable_crypto) +#ifdef HAVE_SHUTDOWN + PHP_FE(stream_socket_shutdown, arginfo_stream_socket_shutdown) +#endif +#if HAVE_SOCKETPAIR + PHP_FE(stream_socket_pair, arginfo_stream_socket_pair) +#endif + 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(fgetcsv, arginfo_fgetcsv) + PHP_FE(fputcsv, arginfo_fputcsv) + PHP_FE(flock, arginfo_flock) + PHP_FE(get_meta_tags, arginfo_get_meta_tags) + PHP_FE(stream_set_read_buffer, arginfo_stream_set_read_buffer) + PHP_FE(stream_set_write_buffer, arginfo_stream_set_write_buffer) + PHP_FALIAS(set_file_buffer, stream_set_write_buffer, arginfo_stream_set_write_buffer) + PHP_FE(stream_set_chunk_size, arginfo_stream_set_chunk_size) + + PHP_DEP_FALIAS(set_socket_blocking, stream_set_blocking, arginfo_stream_set_blocking) + PHP_FE(stream_set_blocking, arginfo_stream_set_blocking) + PHP_FALIAS(socket_set_blocking, stream_set_blocking, arginfo_stream_set_blocking) + + PHP_FE(stream_get_meta_data, arginfo_stream_get_meta_data) + PHP_FE(stream_get_line, arginfo_stream_get_line) + PHP_FE(stream_wrapper_register, arginfo_stream_wrapper_register) + PHP_FALIAS(stream_register_wrapper, stream_wrapper_register, arginfo_stream_wrapper_register) + PHP_FE(stream_wrapper_unregister, arginfo_stream_wrapper_unregister) + PHP_FE(stream_wrapper_restore, arginfo_stream_wrapper_restore) + PHP_FE(stream_get_wrappers, arginfo_stream_get_wrappers) + PHP_FE(stream_get_transports, arginfo_stream_get_transports) + PHP_FE(stream_resolve_include_path, arginfo_stream_resolve_include_path) + PHP_FE(stream_is_local, arginfo_stream_is_local) + PHP_FE(get_headers, arginfo_get_headers) + +#if HAVE_SYS_TIME_H || defined(PHP_WIN32) + PHP_FE(stream_set_timeout, arginfo_stream_set_timeout) + PHP_FALIAS(socket_set_timeout, stream_set_timeout, arginfo_stream_set_timeout) +#endif + + PHP_FALIAS(socket_get_status, stream_get_meta_data, arginfo_stream_get_meta_data) + +#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS) + PHP_FE(realpath, arginfo_realpath) +#endif + +#ifdef HAVE_FNMATCH + PHP_FE(fnmatch, arginfo_fnmatch) +#endif + + /* functions from fsock.c */ + PHP_FE(fsockopen, arginfo_fsockopen) + PHP_FE(pfsockopen, arginfo_pfsockopen) + + /* functions from pack.c */ + PHP_FE(pack, arginfo_pack) + PHP_FE(unpack, arginfo_unpack) + + /* functions from browscap.c */ + PHP_FE(get_browser, arginfo_get_browser) + +#if HAVE_CRYPT + /* functions from crypt.c */ + PHP_FE(crypt, arginfo_crypt) +#endif + + /* functions from dir.c */ + PHP_FE(opendir, arginfo_opendir) + PHP_FE(closedir, arginfo_closedir) + PHP_FE(chdir, arginfo_chdir) + +#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC + PHP_FE(chroot, arginfo_chroot) +#endif + + PHP_FE(getcwd, arginfo_getcwd) + PHP_FE(rewinddir, arginfo_rewinddir) + PHP_NAMED_FE(readdir, php_if_readdir, arginfo_readdir) + PHP_FALIAS(dir, getdir, arginfo_dir) + PHP_FE(scandir, arginfo_scandir) +#ifdef HAVE_GLOB + PHP_FE(glob, arginfo_glob) +#endif + /* functions from filestat.c */ + PHP_FE(fileatime, arginfo_fileatime) + PHP_FE(filectime, arginfo_filectime) + PHP_FE(filegroup, arginfo_filegroup) + PHP_FE(fileinode, arginfo_fileinode) + PHP_FE(filemtime, arginfo_filemtime) + PHP_FE(fileowner, arginfo_fileowner) + PHP_FE(fileperms, arginfo_fileperms) + PHP_FE(filesize, arginfo_filesize) + PHP_FE(filetype, arginfo_filetype) + PHP_FE(file_exists, arginfo_file_exists) + PHP_FE(is_writable, arginfo_is_writable) + PHP_FALIAS(is_writeable, is_writable, arginfo_is_writable) + PHP_FE(is_readable, arginfo_is_readable) + PHP_FE(is_executable, arginfo_is_executable) + PHP_FE(is_file, arginfo_is_file) + PHP_FE(is_dir, arginfo_is_dir) + 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 +#if HAVE_LCHOWN + PHP_FE(lchgrp, arginfo_lchgrp) +#endif + PHP_FE(chmod, arginfo_chmod) +#if HAVE_UTIME + PHP_FE(touch, arginfo_touch) +#endif + PHP_FE(clearstatcache, arginfo_clearstatcache) + PHP_FE(disk_total_space, arginfo_disk_total_space) + PHP_FE(disk_free_space, arginfo_disk_free_space) + PHP_FALIAS(diskfreespace, disk_free_space, arginfo_disk_free_space) + PHP_FE(realpath_cache_size, arginfo_realpath_cache_size) + PHP_FE(realpath_cache_get, arginfo_realpath_cache_get) + + /* functions from mail.c */ + PHP_FE(mail, arginfo_mail) + PHP_FE(ezmlm_hash, arginfo_ezmlm_hash) + + /* functions from syslog.c */ +#ifdef HAVE_SYSLOG_H + PHP_FE(openlog, arginfo_openlog) + PHP_FE(syslog, arginfo_syslog) + PHP_FE(closelog, arginfo_closelog) +#endif + + /* functions from lcg.c */ + PHP_FE(lcg_value, arginfo_lcg_value) + + /* functions from metaphone.c */ + PHP_FE(metaphone, arginfo_metaphone) + + /* functions from output.c */ + PHP_FE(ob_start, arginfo_ob_start) + PHP_FE(ob_flush, arginfo_ob_flush) + PHP_FE(ob_clean, arginfo_ob_clean) + PHP_FE(ob_end_flush, arginfo_ob_end_flush) + PHP_FE(ob_end_clean, arginfo_ob_end_clean) + PHP_FE(ob_get_flush, arginfo_ob_get_flush) + PHP_FE(ob_get_clean, arginfo_ob_get_clean) + PHP_FE(ob_get_length, arginfo_ob_get_length) + PHP_FE(ob_get_level, arginfo_ob_get_level) + PHP_FE(ob_get_status, arginfo_ob_get_status) + PHP_FE(ob_get_contents, arginfo_ob_get_contents) + PHP_FE(ob_implicit_flush, arginfo_ob_implicit_flush) + PHP_FE(ob_list_handlers, arginfo_ob_list_handlers) + + /* functions from array.c */ + PHP_FE(ksort, arginfo_ksort) + PHP_FE(krsort, arginfo_krsort) + PHP_FE(natsort, arginfo_natsort) + PHP_FE(natcasesort, arginfo_natcasesort) + PHP_FE(asort, arginfo_asort) + PHP_FE(arsort, arginfo_arsort) + PHP_FE(sort, arginfo_sort) + PHP_FE(rsort, arginfo_rsort) + PHP_FE(usort, arginfo_usort) + PHP_FE(uasort, arginfo_uasort) + PHP_FE(uksort, arginfo_uksort) + PHP_FE(shuffle, arginfo_shuffle) + PHP_FE(array_walk, arginfo_array_walk) + PHP_FE(array_walk_recursive, arginfo_array_walk_recursive) + PHP_FE(count, arginfo_count) + PHP_FE(end, arginfo_end) + PHP_FE(prev, arginfo_prev) + PHP_FE(next, arginfo_next) + PHP_FE(reset, arginfo_reset) + PHP_FE(current, arginfo_current) + PHP_FE(key, arginfo_key) + PHP_FE(min, arginfo_min) + PHP_FE(max, arginfo_max) + PHP_FE(in_array, arginfo_in_array) + PHP_FE(array_search, arginfo_array_search) + PHP_FE(extract, arginfo_extract) + PHP_FE(compact, arginfo_compact) + PHP_FE(array_fill, arginfo_array_fill) + PHP_FE(array_fill_keys, arginfo_array_fill_keys) + PHP_FE(range, arginfo_range) + PHP_FE(array_multisort, arginfo_array_multisort) + PHP_FE(array_push, arginfo_array_push) + PHP_FE(array_pop, arginfo_array_pop) + PHP_FE(array_shift, arginfo_array_shift) + PHP_FE(array_unshift, arginfo_array_unshift) + PHP_FE(array_splice, arginfo_array_splice) + PHP_FE(array_slice, arginfo_array_slice) + PHP_FE(array_merge, arginfo_array_merge) + PHP_FE(array_merge_recursive, arginfo_array_merge_recursive) + PHP_FE(array_replace, arginfo_array_replace) + PHP_FE(array_replace_recursive, arginfo_array_replace_recursive) + PHP_FE(array_keys, arginfo_array_keys) + PHP_FE(array_values, arginfo_array_values) + PHP_FE(array_count_values, arginfo_array_count_values) + PHP_FE(array_reverse, arginfo_array_reverse) + PHP_FE(array_reduce, arginfo_array_reduce) + PHP_FE(array_pad, arginfo_array_pad) + PHP_FE(array_flip, arginfo_array_flip) + PHP_FE(array_change_key_case, arginfo_array_change_key_case) + PHP_FE(array_rand, arginfo_array_rand) + PHP_FE(array_unique, arginfo_array_unique) + PHP_FE(array_intersect, arginfo_array_intersect) + PHP_FE(array_intersect_key, arginfo_array_intersect_key) + PHP_FE(array_intersect_ukey, arginfo_array_intersect_ukey) + PHP_FE(array_uintersect, arginfo_array_uintersect) + PHP_FE(array_intersect_assoc, arginfo_array_intersect_assoc) + PHP_FE(array_uintersect_assoc, arginfo_array_uintersect_assoc) + PHP_FE(array_intersect_uassoc, arginfo_array_intersect_uassoc) + PHP_FE(array_uintersect_uassoc, arginfo_array_uintersect_uassoc) + PHP_FE(array_diff, arginfo_array_diff) + PHP_FE(array_diff_key, arginfo_array_diff_key) + PHP_FE(array_diff_ukey, arginfo_array_diff_ukey) + PHP_FE(array_udiff, arginfo_array_udiff) + PHP_FE(array_diff_assoc, arginfo_array_diff_assoc) + PHP_FE(array_udiff_assoc, arginfo_array_udiff_assoc) + PHP_FE(array_diff_uassoc, arginfo_array_diff_uassoc) + PHP_FE(array_udiff_uassoc, arginfo_array_udiff_uassoc) + PHP_FE(array_sum, arginfo_array_sum) + PHP_FE(array_product, arginfo_array_product) + PHP_FE(array_filter, arginfo_array_filter) + PHP_FE(array_map, arginfo_array_map) + PHP_FE(array_chunk, arginfo_array_chunk) + PHP_FE(array_combine, arginfo_array_combine) + PHP_FE(array_key_exists, arginfo_array_key_exists) + + /* aliases from array.c */ + PHP_FALIAS(pos, current, arginfo_current) + PHP_FALIAS(sizeof, count, arginfo_count) + PHP_FALIAS(key_exists, array_key_exists, arginfo_array_key_exists) + + /* functions from assert.c */ + PHP_FE(assert, arginfo_assert) + PHP_FE(assert_options, arginfo_assert_options) + + /* functions from versioning.c */ + PHP_FE(version_compare, arginfo_version_compare) + + /* functions from ftok.c*/ +#if HAVE_FTOK + PHP_FE(ftok, arginfo_ftok) +#endif + + PHP_FE(str_rot13, arginfo_str_rot13) + PHP_FE(stream_get_filters, arginfo_stream_get_filters) + PHP_FE(stream_filter_register, arginfo_stream_filter_register) + PHP_FE(stream_bucket_make_writeable, arginfo_stream_bucket_make_writeable) + PHP_FE(stream_bucket_prepend, arginfo_stream_bucket_prepend) + PHP_FE(stream_bucket_append, arginfo_stream_bucket_append) + PHP_FE(stream_bucket_new, arginfo_stream_bucket_new) + + PHP_FE(output_add_rewrite_var, arginfo_output_add_rewrite_var) + PHP_FE(output_reset_rewrite_vars, arginfo_output_reset_rewrite_vars) + + PHP_FE(sys_get_temp_dir, arginfo_sys_get_temp_dir) + + PHP_FE_END +}; +/* }}} */ + +static const zend_module_dep standard_deps[] = { /* {{{ */ + ZEND_MOD_OPTIONAL("session") + ZEND_MOD_END +}; +/* }}} */ + +zend_module_entry basic_functions_module = { /* {{{ */ + STANDARD_MODULE_HEADER_EX, + NULL, + standard_deps, + "standard", /* extension name */ + basic_functions, /* function list */ + PHP_MINIT(basic), /* process startup */ + PHP_MSHUTDOWN(basic), /* process shutdown */ + PHP_RINIT(basic), /* request startup */ + PHP_RSHUTDOWN(basic), /* request shutdown */ + PHP_MINFO(basic), /* extension info */ + PHP_VERSION, /* extension version */ + STANDARD_MODULE_PROPERTIES +}; +/* }}} */ + +#if defined(HAVE_PUTENV) +static void php_putenv_destructor(putenv_entry *pe) /* {{{ */ +{ + if (pe->previous_value) { +#if _MSC_VER >= 1300 + /* VS.Net has a bug in putenv() when setting a variable that + * is already set; if the SetEnvironmentVariable() API call + * fails, the Crt will double free() a string. + * We try to avoid this by setting our own value first */ + SetEnvironmentVariable(pe->key, "bugbug"); +#endif + putenv(pe->previous_value); +# if defined(PHP_WIN32) + efree(pe->previous_value); +# endif + } else { +# if HAVE_UNSETENV + unsetenv(pe->key); +# elif defined(PHP_WIN32) + SetEnvironmentVariable(pe->key, NULL); +# else + char **env; + + for (env = environ; env != NULL && *env != NULL; env++) { + if (!strncmp(*env, pe->key, pe->key_len) && (*env)[pe->key_len] == '=') { /* found it */ + *env = ""; + break; + } + } +# endif + } +#ifdef HAVE_TZSET + /* don't forget to reset the various libc globals that + * we might have changed by an earlier call to tzset(). */ + if (!strncmp(pe->key, "TZ", pe->key_len)) { + tzset(); + } +#endif + + efree(pe->putenv_string); + efree(pe->key); +} +/* }}} */ +#endif + +static void basic_globals_ctor(php_basic_globals *basic_globals_p TSRMLS_DC) /* {{{ */ +{ + BG(rand_is_seeded) = 0; + BG(mt_rand_is_seeded) = 0; + BG(umask) = -1; + BG(next) = NULL; + BG(left) = -1; + BG(user_tick_functions) = NULL; + BG(user_filter_map) = NULL; + BG(serialize_lock) = 0; + + memset(&BG(serialize), 0, sizeof(BG(serialize))); + memset(&BG(unserialize), 0, sizeof(BG(unserialize))); + + memset(&BG(url_adapt_state_ex), 0, sizeof(BG(url_adapt_state_ex))); + +#if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T) + memset(&BG(mblen_state), 0, sizeof(BG(mblen_state))); +#endif + + BG(incomplete_class) = incomplete_class_entry; + BG(page_uid) = -1; + BG(page_gid) = -1; +} +/* }}} */ + +static void basic_globals_dtor(php_basic_globals *basic_globals_p TSRMLS_DC) /* {{{ */ +{ + if (BG(url_adapt_state_ex).tags) { + zend_hash_destroy(BG(url_adapt_state_ex).tags); + free(BG(url_adapt_state_ex).tags); + } +} +/* }}} */ + +#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; + ((php_uint32*)&val)[1] = PHP_DOUBLE_QUIET_NAN_HIGH; + ((php_uint32*)&val)[0] = 0; + return val; +#elif HAVE_ATOF_ACCEPTS_NAN + return atof("NAN"); +#else + return 0.0/0.0; +#endif +} +/* }}} */ + +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; + ((php_uint32*)&val)[1] = PHP_DOUBLE_INFINITY_HIGH; + ((php_uint32*)&val)[0] = 0; + return val; +#elif HAVE_ATOF_ACCEPTS_INF + return atof("INF"); +#else + return 1.0/0.0; +#endif +} +/* }}} */ + +PHP_MINIT_FUNCTION(basic) /* {{{ */ +{ +#ifdef ZTS + ts_allocate_id(&basic_globals_id, sizeof(php_basic_globals), (ts_allocate_ctor) basic_globals_ctor, (ts_allocate_dtor) basic_globals_dtor); +#ifdef PHP_WIN32 + ts_allocate_id(&php_win32_core_globals_id, sizeof(php_win32_core_globals), (ts_allocate_ctor)php_win32_core_globals_ctor, (ts_allocate_dtor)php_win32_core_globals_dtor ); +#endif +#else + basic_globals_ctor(&basic_globals TSRMLS_CC); +#ifdef PHP_WIN32 + php_win32_core_globals_ctor(&the_php_win32_core_globals TSRMLS_CC); +#endif +#endif + + BG(incomplete_class) = incomplete_class_entry = php_create_incomplete_class(TSRMLS_C); + + REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CONNECTION_TIMEOUT", PHP_CONNECTION_TIMEOUT, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("INI_USER", ZEND_INI_USER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INI_PERDIR", ZEND_INI_PERDIR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INI_SYSTEM", ZEND_INI_SYSTEM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INI_ALL", ZEND_INI_ALL, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("INI_SCANNER_NORMAL", ZEND_INI_SCANNER_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INI_SCANNER_RAW", ZEND_INI_SCANNER_RAW, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("PHP_URL_SCHEME", PHP_URL_SCHEME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_URL_HOST", PHP_URL_HOST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_URL_PORT", PHP_URL_PORT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_URL_USER", PHP_URL_USER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_URL_PASS", PHP_URL_PASS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_URL_PATH", PHP_URL_PATH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_URL_QUERY", PHP_URL_QUERY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_URL_FRAGMENT", PHP_URL_FRAGMENT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_QUERY_RFC1738", PHP_QUERY_RFC1738, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_QUERY_RFC3986", PHP_QUERY_RFC3986, CONST_CS | CONST_PERSISTENT); + +#define REGISTER_MATH_CONSTANT(x) REGISTER_DOUBLE_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) + REGISTER_MATH_CONSTANT(M_E); + REGISTER_MATH_CONSTANT(M_LOG2E); + REGISTER_MATH_CONSTANT(M_LOG10E); + REGISTER_MATH_CONSTANT(M_LN2); + REGISTER_MATH_CONSTANT(M_LN10); + REGISTER_MATH_CONSTANT(M_PI); + REGISTER_MATH_CONSTANT(M_PI_2); + REGISTER_MATH_CONSTANT(M_PI_4); + REGISTER_MATH_CONSTANT(M_1_PI); + REGISTER_MATH_CONSTANT(M_2_PI); + REGISTER_MATH_CONSTANT(M_SQRTPI); + REGISTER_MATH_CONSTANT(M_2_SQRTPI); + REGISTER_MATH_CONSTANT(M_LNPI); + REGISTER_MATH_CONSTANT(M_EULER); + 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_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); + REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_EVEN", PHP_ROUND_HALF_EVEN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_ODD", PHP_ROUND_HALF_ODD, CONST_CS | CONST_PERSISTENT); + +#if ENABLE_TEST_CLASS + test_class_startup(); +#endif + + register_phpinfo_constants(INIT_FUNC_ARGS_PASSTHRU); + register_html_constants(INIT_FUNC_ARGS_PASSTHRU); + register_string_constants(INIT_FUNC_ARGS_PASSTHRU); + + PHP_MINIT(file)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(pack)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(browscap)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(standard_filters)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(user_filters)(INIT_FUNC_ARGS_PASSTHRU); + +#if defined(HAVE_LOCALECONV) && defined(ZTS) + PHP_MINIT(localeconv)(INIT_FUNC_ARGS_PASSTHRU); +#endif + +#if defined(HAVE_NL_LANGINFO) + PHP_MINIT(nl_langinfo)(INIT_FUNC_ARGS_PASSTHRU); +#endif + +#if HAVE_CRYPT + PHP_MINIT(crypt)(INIT_FUNC_ARGS_PASSTHRU); +#endif + + PHP_MINIT(lcg)(INIT_FUNC_ARGS_PASSTHRU); + + PHP_MINIT(dir)(INIT_FUNC_ARGS_PASSTHRU); +#ifdef HAVE_SYSLOG_H + PHP_MINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU); +#endif + PHP_MINIT(array)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(assert)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(url_scanner_ex)(INIT_FUNC_ARGS_PASSTHRU); +#ifdef PHP_CAN_SUPPORT_PROC_OPEN + PHP_MINIT(proc_open)(INIT_FUNC_ARGS_PASSTHRU); +#endif + + PHP_MINIT(user_streams)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(imagetypes)(INIT_FUNC_ARGS_PASSTHRU); + + php_register_url_stream_wrapper("php", &php_stream_php_wrapper TSRMLS_CC); + php_register_url_stream_wrapper("file", &php_plain_files_wrapper TSRMLS_CC); +#ifdef HAVE_GLOB + php_register_url_stream_wrapper("glob", &php_glob_stream_wrapper TSRMLS_CC); +#endif + php_register_url_stream_wrapper("data", &php_stream_rfc2397_wrapper TSRMLS_CC); +#ifndef PHP_CURL_URL_WRAPPERS + php_register_url_stream_wrapper("http", &php_stream_http_wrapper TSRMLS_CC); + php_register_url_stream_wrapper("ftp", &php_stream_ftp_wrapper TSRMLS_CC); +#endif + +#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE))) +# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS + PHP_MINIT(dns)(INIT_FUNC_ARGS_PASSTHRU); +# endif +#endif + + return SUCCESS; +} +/* }}} */ + +PHP_MSHUTDOWN_FUNCTION(basic) /* {{{ */ +{ +#ifdef HAVE_SYSLOG_H + PHP_MSHUTDOWN(syslog)(SHUTDOWN_FUNC_ARGS_PASSTHRU); +#endif +#ifdef ZTS + ts_free_id(basic_globals_id); +#ifdef PHP_WIN32 + ts_free_id(php_win32_core_globals_id); +#endif +#else + basic_globals_dtor(&basic_globals TSRMLS_CC); +#ifdef PHP_WIN32 + php_win32_core_globals_dtor(&the_php_win32_core_globals TSRMLS_CC); +#endif +#endif + + php_unregister_url_stream_wrapper("php" TSRMLS_CC); +#ifndef PHP_CURL_URL_WRAPPERS + php_unregister_url_stream_wrapper("http" TSRMLS_CC); + php_unregister_url_stream_wrapper("ftp" TSRMLS_CC); +#endif + + PHP_MSHUTDOWN(browscap)(SHUTDOWN_FUNC_ARGS_PASSTHRU); + PHP_MSHUTDOWN(array)(SHUTDOWN_FUNC_ARGS_PASSTHRU); + PHP_MSHUTDOWN(assert)(SHUTDOWN_FUNC_ARGS_PASSTHRU); + PHP_MSHUTDOWN(url_scanner_ex)(SHUTDOWN_FUNC_ARGS_PASSTHRU); + PHP_MSHUTDOWN(file)(SHUTDOWN_FUNC_ARGS_PASSTHRU); + PHP_MSHUTDOWN(standard_filters)(SHUTDOWN_FUNC_ARGS_PASSTHRU); +#if defined(HAVE_LOCALECONV) && defined(ZTS) + PHP_MSHUTDOWN(localeconv)(SHUTDOWN_FUNC_ARGS_PASSTHRU); +#endif +#if HAVE_CRYPT + PHP_MSHUTDOWN(crypt)(SHUTDOWN_FUNC_ARGS_PASSTHRU); +#endif + + return SUCCESS; +} +/* }}} */ + +PHP_RINIT_FUNCTION(basic) /* {{{ */ +{ + memset(BG(strtok_table), 0, 256); + + BG(serialize_lock) = 0; + memset(&BG(serialize), 0, sizeof(BG(serialize))); + memset(&BG(unserialize), 0, sizeof(BG(unserialize))); + + BG(strtok_string) = NULL; + BG(strtok_zval) = NULL; + BG(strtok_last) = NULL; + BG(locale_string) = NULL; + BG(array_walk_fci) = empty_fcall_info; + BG(array_walk_fci_cache) = empty_fcall_info_cache; + BG(user_compare_fci) = empty_fcall_info; + BG(user_compare_fci_cache) = empty_fcall_info_cache; + BG(page_uid) = -1; + BG(page_gid) = -1; + BG(page_inode) = -1; + BG(page_mtime) = -1; +#ifdef HAVE_PUTENV + if (zend_hash_init(&BG(putenv_ht), 1, NULL, (void (*)(void *)) php_putenv_destructor, 0) == FAILURE) { + return FAILURE; + } +#endif + BG(user_shutdown_function_names) = NULL; + + PHP_RINIT(filestat)(INIT_FUNC_ARGS_PASSTHRU); +#ifdef HAVE_SYSLOG_H + PHP_RINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU); +#endif + PHP_RINIT(dir)(INIT_FUNC_ARGS_PASSTHRU); + PHP_RINIT(url_scanner_ex)(INIT_FUNC_ARGS_PASSTHRU); + + /* Setup default context */ + FG(default_context) = NULL; + + /* Default to global wrappers only */ + FG(stream_wrappers) = NULL; + + /* Default to global filters only */ + FG(stream_filters) = NULL; + + return SUCCESS; +} +/* }}} */ + +PHP_RSHUTDOWN_FUNCTION(basic) /* {{{ */ +{ + if (BG(strtok_zval)) { + zval_ptr_dtor(&BG(strtok_zval)); + } + BG(strtok_string) = NULL; + BG(strtok_zval) = NULL; +#ifdef HAVE_PUTENV + zend_hash_destroy(&BG(putenv_ht)); +#endif + + if (BG(umask) != -1) { + umask(BG(umask)); + } + + /* Check if locale was changed and change it back + * to the value in startup environment */ + if (BG(locale_string) != NULL) { + setlocale(LC_ALL, "C"); + setlocale(LC_CTYPE, ""); + zend_update_current_locale(); + } + STR_FREE(BG(locale_string)); + BG(locale_string) = NULL; + + /* FG(stream_wrappers) and FG(stream_filters) are destroyed + * during php_request_shutdown() */ + + PHP_RSHUTDOWN(filestat)(SHUTDOWN_FUNC_ARGS_PASSTHRU); +#ifdef HAVE_SYSLOG_H +#ifdef PHP_WIN32 + PHP_RSHUTDOWN(syslog)(SHUTDOWN_FUNC_ARGS_PASSTHRU); +#endif +#endif + PHP_RSHUTDOWN(assert)(SHUTDOWN_FUNC_ARGS_PASSTHRU); + PHP_RSHUTDOWN(url_scanner_ex)(SHUTDOWN_FUNC_ARGS_PASSTHRU); + PHP_RSHUTDOWN(streams)(SHUTDOWN_FUNC_ARGS_PASSTHRU); +#ifdef PHP_WIN32 + PHP_RSHUTDOWN(win32_core_globals)(SHUTDOWN_FUNC_ARGS_PASSTHRU); +#endif + + if (BG(user_tick_functions)) { + zend_llist_destroy(BG(user_tick_functions)); + efree(BG(user_tick_functions)); + BG(user_tick_functions) = NULL; + } + + PHP_RSHUTDOWN(user_filters)(SHUTDOWN_FUNC_ARGS_PASSTHRU); + PHP_RSHUTDOWN(browscap)(SHUTDOWN_FUNC_ARGS_PASSTHRU); + + BG(page_uid) = -1; + BG(page_gid) = -1; + return SUCCESS; +} +/* }}} */ + +PHP_MINFO_FUNCTION(basic) /* {{{ */ +{ + php_info_print_table_start(); + PHP_MINFO(dl)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU); + PHP_MINFO(mail)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU); + php_info_print_table_end(); + PHP_MINFO(assert)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU); +} +/* }}} */ + +/* {{{ proto mixed constant(string const_name) + Given the name of a constant this function will return the constant's associated value */ +PHP_FUNCTION(constant) +{ + char *const_name; + int const_name_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &const_name, &const_name_len) == FAILURE) { + return; + } + + if (!zend_get_constant_ex(const_name, const_name_len, return_value, NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find constant %s", const_name); + RETURN_NULL(); + } +} +/* }}} */ + +#ifdef HAVE_INET_NTOP +/* {{{ proto string inet_ntop(string in_addr) + Converts a packed inet address to a human readable IP address string */ +PHP_NAMED_FUNCTION(php_inet_ntop) +{ + char *address; + int address_len, af = AF_INET; + char buffer[40]; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &address, &address_len) == FAILURE) { + RETURN_FALSE; + } + +#ifdef HAVE_IPV6 + if (address_len == 16) { + af = AF_INET6; + } else +#endif + if (address_len != 4) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid in_addr value"); + RETURN_FALSE; + } + + if (!inet_ntop(af, address, buffer, sizeof(buffer))) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "An unknown error occurred"); + RETURN_FALSE; + } + + RETURN_STRING(buffer, 1); +} +/* }}} */ +#endif /* HAVE_INET_NTOP */ + +#ifdef HAVE_INET_PTON +/* {{{ proto string inet_pton(string ip_address) + Converts a human readable IP address to a packed binary string */ +PHP_NAMED_FUNCTION(php_inet_pton) +{ + int ret, af = AF_INET; + char *address; + int address_len; + char buffer[17]; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &address, &address_len) == FAILURE) { + RETURN_FALSE; + } + + memset(buffer, 0, sizeof(buffer)); + +#ifdef HAVE_IPV6 + if (strchr(address, ':')) { + af = AF_INET6; + } else +#endif + if (!strchr(address, '.')) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized address %s", address); + RETURN_FALSE; + } + + ret = inet_pton(af, address, buffer); + + if (ret <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized address %s", address); + RETURN_FALSE; + } + + RETURN_STRINGL(buffer, af == AF_INET ? 4 : 16, 1); +} +/* }}} */ +#endif /* HAVE_INET_PTON */ + +/* {{{ proto int ip2long(string ip_address) + Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address */ +PHP_FUNCTION(ip2long) +{ + char *addr; + int addr_len; +#ifdef HAVE_INET_PTON + struct in_addr ip; +#else + unsigned long int ip; +#endif + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &addr, &addr_len) == FAILURE) { + return; + } + +#ifdef HAVE_INET_PTON + if (addr_len == 0 || inet_pton(AF_INET, addr, &ip) != 1) { + RETURN_FALSE; + } + RETURN_LONG(ntohl(ip.s_addr)); +#else + if (addr_len == 0 || (ip = inet_addr(addr)) == INADDR_NONE) { + /* The only special case when we should return -1 ourselves, + * because inet_addr() considers it wrong. We return 0xFFFFFFFF and + * not -1 or ~0 because of 32/64bit issues. */ + if (addr_len == sizeof("255.255.255.255") - 1 && + !memcmp(addr, "255.255.255.255", sizeof("255.255.255.255") - 1) + ) { + RETURN_LONG(0xFFFFFFFF); + } + RETURN_FALSE; + } + RETURN_LONG(ntohl(ip)); +#endif +} +/* }}} */ + +/* {{{ proto string long2ip(int proper_address) + Converts an (IPv4) Internet network address into a string in Internet standard dotted format */ +PHP_FUNCTION(long2ip) +{ + /* "It's a long but it's not, PHP ints are signed */ + char *ip; + int ip_len; + unsigned long n; + struct in_addr myaddr; +#ifdef HAVE_INET_PTON + char str[40]; +#endif + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &ip, &ip_len) == FAILURE) { + return; + } + + n = strtoul(ip, NULL, 0); + + myaddr.s_addr = htonl(n); +#ifdef HAVE_INET_PTON + if (inet_ntop(AF_INET, &myaddr, str, sizeof(str))) { + RETURN_STRING(str, 1); + } else { + RETURN_FALSE; + } +#else + RETURN_STRING(inet_ntoa(myaddr), 1); +#endif +} +/* }}} */ + +/******************** + * System Functions * + ********************/ + +/* {{{ proto string getenv(string varname) + Get the value of an environment variable */ +PHP_FUNCTION(getenv) +{ + char *ptr, *str; + int str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + RETURN_FALSE; + } + + /* SAPI method returns an emalloc()'d string */ + ptr = sapi_getenv(str, str_len TSRMLS_CC); + if (ptr) { + RETURN_STRING(ptr, 0); + } +#ifdef PHP_WIN32 + { + char dummybuf; + int size; + + SetLastError(0); + /*If the given bugger is not large enough to hold the data, the return value is + the buffer size, in characters, required to hold the string and its terminating + null character. We use this return value to alloc the final buffer. */ + size = GetEnvironmentVariableA(str, &dummybuf, 0); + if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) { + /* The environment variable doesn't exist. */ + RETURN_FALSE; + } + + if (size == 0) { + /* env exists, but it is empty */ + RETURN_EMPTY_STRING(); + } + + ptr = emalloc(size); + size = GetEnvironmentVariableA(str, ptr, size); + if (size == 0) { + /* has been removed between the two calls */ + efree(ptr); + RETURN_EMPTY_STRING(); + } else { + RETURN_STRING(ptr, 0); + } + } +#else + /* system method returns a const */ + ptr = getenv(str); + if (ptr) { + RETURN_STRING(ptr, 1); + } +#endif + RETURN_FALSE; +} +/* }}} */ + +#ifdef HAVE_PUTENV +/* {{{ proto bool putenv(string setting) + Set the value of an environment variable */ +PHP_FUNCTION(putenv) +{ + char *setting; + int setting_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &setting, &setting_len) == FAILURE) { + return; + } + + if (setting_len) { + char *p, **env; + putenv_entry pe; +#ifdef PHP_WIN32 + char *value = NULL; + int equals = 0; + int error_code; +#endif + + pe.putenv_string = estrndup(setting, setting_len); + pe.key = estrndup(setting, setting_len); + if ((p = strchr(pe.key, '='))) { /* nullify the '=' if there is one */ + *p = '\0'; +#ifdef PHP_WIN32 + equals = 1; +#endif + } + + pe.key_len = strlen(pe.key); +#ifdef PHP_WIN32 + if (equals) { + if (pe.key_len < setting_len - 1) { + value = p + 1; + } else { + /* empty string*/ + value = p; + } + } +#endif + + zend_hash_del(&BG(putenv_ht), pe.key, pe.key_len+1); + + /* find previous value */ + pe.previous_value = NULL; + for (env = environ; env != NULL && *env != NULL; env++) { + if (!strncmp(*env, pe.key, pe.key_len) && (*env)[pe.key_len] == '=') { /* found it */ +#if defined(PHP_WIN32) + /* must copy previous value because MSVCRT's putenv can free the string without notice */ + pe.previous_value = estrdup(*env); +#else + pe.previous_value = *env; +#endif + break; + } + } + +#if HAVE_UNSETENV + if (!p) { /* no '=' means we want to unset it */ + unsetenv(pe.putenv_string); + } + if (!p || putenv(pe.putenv_string) == 0) { /* success */ +#else +# ifndef PHP_WIN32 + if (putenv(pe.putenv_string) == 0) { /* success */ +# else + error_code = SetEnvironmentVariable(pe.key, value); +# if _MSC_VER < 1500 + /* Yet another VC6 bug, unset may return env not found */ + if (error_code != 0 || + (error_code == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND)) { +# else + if (error_code != 0) { /* success */ +# endif +# endif +#endif + zend_hash_add(&BG(putenv_ht), pe.key, pe.key_len + 1, (void **) &pe, sizeof(putenv_entry), NULL); +#ifdef HAVE_TZSET + if (!strncmp(pe.key, "TZ", pe.key_len)) { + tzset(); + } +#endif + RETURN_TRUE; + } else { + efree(pe.putenv_string); + efree(pe.key); + RETURN_FALSE; + } + } + + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter syntax"); + RETURN_FALSE; +} +/* }}} */ +#endif + +/* {{{ free_argv() + Free the memory allocated to an argv array. */ +static void free_argv(char **argv, int argc) +{ + int i; + + if (argv) { + for (i = 0; i < argc; i++) { + if (argv[i]) { + efree(argv[i]); + } + } + efree(argv); + } +} +/* }}} */ + +/* {{{ free_longopts() + Free the memory allocated to an longopt array. */ +static void free_longopts(opt_struct *longopts) +{ + opt_struct *p; + + if (longopts) { + for (p = longopts; p && p->opt_char != '-'; p++) { + if (p->opt_name != NULL) { + efree((char *)(p->opt_name)); + } + } + } +} +/* }}} */ + +/* {{{ parse_opts() + Convert the typical getopt input characters to the php_getopt struct array */ +static int parse_opts(char * opts, opt_struct ** result) +{ + opt_struct * paras = NULL; + unsigned int i, count = 0; + + for (i = 0; i < strlen(opts); i++) { + if ((opts[i] >= 48 && opts[i] <= 57) || + (opts[i] >= 65 && opts[i] <= 90) || + (opts[i] >= 97 && opts[i] <= 122) + ) { + count++; + } + } + + paras = safe_emalloc(sizeof(opt_struct), count, 0); + memset(paras, 0, sizeof(opt_struct) * count); + *result = paras; + while ( (*opts >= 48 && *opts <= 57) || /* 0 - 9 */ + (*opts >= 65 && *opts <= 90) || /* A - Z */ + (*opts >= 97 && *opts <= 122) /* a - z */ + ) { + paras->opt_char = *opts; + paras->need_param = (*(++opts) == ':') ? 1 : 0; + paras->opt_name = NULL; + if (paras->need_param == 1) { + opts++; + if (*opts == ':') { + paras->need_param++; + opts++; + } + } + paras++; + } + return count; +} +/* }}} */ + +/* {{{ proto array getopt(string options [, array longopts]) + Get options from the command line argument list */ +PHP_FUNCTION(getopt) +{ + char *options = NULL, **argv = NULL; + char opt[2] = { '\0' }; + char *optname; + int argc = 0, options_len = 0, len, o; + char *php_optarg = NULL; + int php_optind = 1; + zval *val, **args = NULL, *p_longopts = NULL; + int optname_len = 0; + opt_struct *opts, *orig_opts; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a", &options, &options_len, &p_longopts) == FAILURE) { + RETURN_FALSE; + } + + /* Get argv from the global symbol table. We calculate argc ourselves + * in order to be on the safe side, even though it is also available + * from the symbol table. */ + if (PG(http_globals)[TRACK_VARS_SERVER] && + (zend_hash_find(HASH_OF(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv"), (void **) &args) != FAILURE || + zend_hash_find(&EG(symbol_table), "argv", sizeof("argv"), (void **) &args) != FAILURE) && Z_TYPE_PP(args) == IS_ARRAY + ) { + int pos = 0; + zval **entry; + + argc = zend_hash_num_elements(Z_ARRVAL_PP(args)); + + /* Attempt to allocate enough memory to hold all of the arguments + * and a trailing NULL */ + argv = (char **) safe_emalloc(sizeof(char *), (argc + 1), 0); + + /* Reset the array indexes. */ + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(args)); + + /* Iterate over the hash to construct the argv array. */ + while (zend_hash_get_current_data(Z_ARRVAL_PP(args), (void **)&entry) == SUCCESS) { + zval arg, *arg_ptr = *entry; + + if (Z_TYPE_PP(entry) != IS_STRING) { + arg = **entry; + zval_copy_ctor(&arg); + convert_to_string(&arg); + arg_ptr = &arg; + } + + argv[pos++] = estrdup(Z_STRVAL_P(arg_ptr)); + + if (arg_ptr != *entry) { + zval_dtor(&arg); + } + + zend_hash_move_forward(Z_ARRVAL_PP(args)); + } + + /* The C Standard requires argv[argc] to be NULL - this might + * keep some getopt implementations happy. */ + argv[argc] = NULL; + } else { + /* Return false if we can't find argv. */ + RETURN_FALSE; + } + + len = parse_opts(options, &opts); + + if (p_longopts) { + int count; + zval **entry; + + count = zend_hash_num_elements(Z_ARRVAL_P(p_longopts)); + + /* the first slots are filled by the one short ops + * we now extend our array and jump to the new added structs */ + opts = (opt_struct *) erealloc(opts, sizeof(opt_struct) * (len + count + 1)); + orig_opts = opts; + opts += len; + + memset(opts, 0, count * sizeof(opt_struct)); + + /* Reset the array indexes. */ + zend_hash_internal_pointer_reset(Z_ARRVAL_P(p_longopts)); + + /* Iterate over the hash to construct the argv array. */ + while (zend_hash_get_current_data(Z_ARRVAL_P(p_longopts), (void **)&entry) == SUCCESS) { + zval arg, *arg_ptr = *entry; + + if (Z_TYPE_PP(entry) != IS_STRING) { + arg = **entry; + zval_copy_ctor(&arg); + convert_to_string(&arg); + arg_ptr = &arg; + } + + opts->need_param = 0; + opts->opt_name = estrdup(Z_STRVAL_P(arg_ptr)); + len = strlen(opts->opt_name); + if ((len > 0) && (opts->opt_name[len - 1] == ':')) { + opts->need_param++; + opts->opt_name[len - 1] = '\0'; + if ((len > 1) && (opts->opt_name[len - 2] == ':')) { + opts->need_param++; + opts->opt_name[len - 2] = '\0'; + } + } + opts->opt_char = 0; + opts++; + + if (arg_ptr != *entry) { + zval_dtor(&arg); + } + + zend_hash_move_forward(Z_ARRVAL_P(p_longopts)); + } + } else { + opts = (opt_struct*) erealloc(opts, sizeof(opt_struct) * (len + 1)); + orig_opts = opts; + opts += len; + } + + /* php_getopt want to identify the last param */ + opts->opt_char = '-'; + opts->need_param = 0; + opts->opt_name = NULL; + + /* Initialize the return value as an array. */ + array_init(return_value); + + /* after our pointer arithmetic jump back to the first element */ + opts = orig_opts; + + while ((o = php_getopt(argc, argv, opts, &php_optarg, &php_optind, 0, 1)) != -1) { + /* Skip unknown arguments. */ + if (o == '?') { + continue; + } + + /* Prepare the option character and the argument string. */ + if (o == 0) { + optname = opts[php_optidx].opt_name; + } else { + if (o == 1) { + o = '-'; + } + opt[0] = o; + optname = opt; + } + + MAKE_STD_ZVAL(val); + if (php_optarg != NULL) { + /* keep the arg as binary, since the encoding is not known */ + ZVAL_STRING(val, php_optarg, 1); + } else { + ZVAL_FALSE(val); + } + + /* Add this option / argument pair to the result hash. */ + optname_len = strlen(optname); + if (!(optname_len > 1 && optname[0] == '0') && is_numeric_string(optname, optname_len, NULL, NULL, 0) == IS_LONG) { + /* numeric string */ + int optname_int = atoi(optname); + if (zend_hash_index_find(HASH_OF(return_value), optname_int, (void **)&args) != FAILURE) { + if (Z_TYPE_PP(args) != IS_ARRAY) { + convert_to_array_ex(args); + } + zend_hash_next_index_insert(HASH_OF(*args), (void *)&val, sizeof(zval *), NULL); + } else { + zend_hash_index_update(HASH_OF(return_value), optname_int, &val, sizeof(zval *), NULL); + } + } else { + /* other strings */ + if (zend_hash_find(HASH_OF(return_value), optname, strlen(optname)+1, (void **)&args) != FAILURE) { + if (Z_TYPE_PP(args) != IS_ARRAY) { + convert_to_array_ex(args); + } + zend_hash_next_index_insert(HASH_OF(*args), (void *)&val, sizeof(zval *), NULL); + } else { + zend_hash_add(HASH_OF(return_value), optname, strlen(optname)+1, (void *)&val, sizeof(zval *), NULL); + } + } + + php_optarg = NULL; + } + + free_longopts(orig_opts); + efree(orig_opts); + free_argv(argv, argc); +} +/* }}} */ + +/* {{{ proto void flush(void) + Flush the output buffer */ +PHP_FUNCTION(flush) +{ + sapi_flush(TSRMLS_C); +} +/* }}} */ + +/* {{{ proto void sleep(int seconds) + Delay for a given number of seconds */ +PHP_FUNCTION(sleep) +{ + long num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) { + RETURN_FALSE; + } + if (num < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of seconds must be greater than or equal to 0"); + RETURN_FALSE; + } +#ifdef PHP_SLEEP_NON_VOID + RETURN_LONG(php_sleep(num)); +#else + php_sleep(num); +#endif + +} +/* }}} */ + +/* {{{ proto void usleep(int micro_seconds) + Delay for a given number of micro seconds */ +PHP_FUNCTION(usleep) +{ +#if HAVE_USLEEP + long num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) { + return; + } + if (num < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of microseconds must be greater than or equal to 0"); + RETURN_FALSE; + } + usleep(num); +#endif +} +/* }}} */ + +#if HAVE_NANOSLEEP +/* {{{ proto mixed time_nanosleep(long seconds, long nanoseconds) + Delay for a number of seconds and nano seconds */ +PHP_FUNCTION(time_nanosleep) +{ + long tv_sec, tv_nsec; + struct timespec php_req, php_rem; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &tv_sec, &tv_nsec) == FAILURE) { + return; + } + + if (tv_sec < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The seconds value must be greater than 0"); + RETURN_FALSE; + } + if (tv_nsec < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The nanoseconds value must be greater than 0"); + RETURN_FALSE; + } + + php_req.tv_sec = (time_t) tv_sec; + php_req.tv_nsec = tv_nsec; + if (!nanosleep(&php_req, &php_rem)) { + RETURN_TRUE; + } else if (errno == EINTR) { + array_init(return_value); + add_assoc_long_ex(return_value, "seconds", sizeof("seconds"), php_rem.tv_sec); + add_assoc_long_ex(return_value, "nanoseconds", sizeof("nanoseconds"), php_rem.tv_nsec); + return; + } else if (errno == EINVAL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "nanoseconds was not in the range 0 to 999 999 999 or seconds was negative"); + } + + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto mixed time_sleep_until(float timestamp) + Make the script sleep until the specified time */ +PHP_FUNCTION(time_sleep_until) +{ + double d_ts, c_ts; + struct timeval tm; + struct timespec php_req, php_rem; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &d_ts) == FAILURE) { + return; + } + + if (gettimeofday((struct timeval *) &tm, NULL) != 0) { + RETURN_FALSE; + } + + c_ts = (double)(d_ts - tm.tv_sec - tm.tv_usec / 1000000.00); + if (c_ts < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sleep until to time is less than current time"); + RETURN_FALSE; + } + + php_req.tv_sec = (time_t) c_ts; + if (php_req.tv_sec > c_ts) { /* rounding up occurred */ + php_req.tv_sec--; + } + /* 1sec = 1000000000 nanoseconds */ + php_req.tv_nsec = (long) ((c_ts - php_req.tv_sec) * 1000000000.00); + + while (nanosleep(&php_req, &php_rem)) { + if (errno == EINTR) { + php_req.tv_sec = php_rem.tv_sec; + php_req.tv_nsec = php_rem.tv_nsec; + } else { + RETURN_FALSE; + } + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +/* {{{ proto string get_current_user(void) + Get the name of the owner of the current PHP script */ +PHP_FUNCTION(get_current_user) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + RETURN_STRING(php_get_current_user(TSRMLS_C), 1); +} +/* }}} */ + +/* {{{ add_config_entry_cb + */ +static int add_config_entry_cb(zval *entry TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +{ + zval *retval = (zval *)va_arg(args, zval*); + zval *tmp; + + if (Z_TYPE_P(entry) == IS_STRING) { + if (hash_key->nKeyLength > 0) { + add_assoc_stringl_ex(retval, hash_key->arKey, hash_key->nKeyLength, Z_STRVAL_P(entry), Z_STRLEN_P(entry), 1); + } else { + add_index_stringl(retval, hash_key->h, Z_STRVAL_P(entry), Z_STRLEN_P(entry), 1); + } + } else if (Z_TYPE_P(entry) == IS_ARRAY) { + MAKE_STD_ZVAL(tmp); + array_init(tmp); + zend_hash_apply_with_arguments(Z_ARRVAL_P(entry) TSRMLS_CC, (apply_func_args_t) add_config_entry_cb, 1, tmp); + add_assoc_zval_ex(retval, hash_key->arKey, hash_key->nKeyLength, tmp); + } + return 0; +} +/* }}} */ + +/* {{{ proto mixed get_cfg_var(string option_name) + Get the value of a PHP configuration option */ +PHP_FUNCTION(get_cfg_var) +{ + char *varname; + int varname_len; + zval *retval; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &varname, &varname_len) == FAILURE) { + return; + } + + retval = cfg_get_entry(varname, varname_len + 1); + + if (retval) { + if (Z_TYPE_P(retval) == IS_ARRAY) { + array_init(return_value); + zend_hash_apply_with_arguments(Z_ARRVAL_P(retval) TSRMLS_CC, (apply_func_args_t) add_config_entry_cb, 1, return_value); + return; + } else { + RETURN_STRING(Z_STRVAL_P(retval), 1); + } + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto bool set_magic_quotes_runtime(int new_setting) + magic_quotes_runtime is not supported anymore */ +PHP_FUNCTION(set_magic_quotes_runtime) +{ + zend_bool new_setting; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &new_setting) == FAILURE) { + return; + } + + if (new_setting) { + php_error_docref(NULL TSRMLS_CC, E_CORE_ERROR, "magic_quotes_runtime is not supported anymore"); + } + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto int get_magic_quotes_runtime(void) + Get the current active configuration setting of magic_quotes_runtime */ +PHP_FUNCTION(get_magic_quotes_runtime) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto int get_magic_quotes_gpc(void) + Get the current active configuration setting of magic_quotes_gpc */ +PHP_FUNCTION(get_magic_quotes_gpc) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_FALSE; +} +/* }}} */ + +/* + 1st arg = error message + 2nd arg = error option + 3rd arg = optional parameters (email address or tcp address) + 4th arg = used for additional headers if email + +error options: + 0 = send to php_error_log (uses syslog or file depending on ini setting) + 1 = send via email to 3rd parameter 4th option = additional headers + 2 = send via tcp/ip to 3rd parameter (name or ip:port) + 3 = save to file in 3rd parameter + 4 = send to SAPI logger directly +*/ + +/* {{{ proto bool error_log(string message [, int message_type [, string destination [, string extra_headers]]]) + Send an error message somewhere */ +PHP_FUNCTION(error_log) +{ + char *message, *opt = NULL, *headers = NULL; + int message_len, opt_len = 0, headers_len = 0; + int opt_err = 0, argc = ZEND_NUM_ARGS(); + long erropt = 0; + + if (zend_parse_parameters(argc TSRMLS_CC, "s|lps", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) { + return; + } + + if (argc > 1) { + opt_err = erropt; + } + + if (_php_error_log_ex(opt_err, message, message_len, opt, headers TSRMLS_CC) == FAILURE) { + RETURN_FALSE; + } + + RETURN_TRUE; +} +/* }}} */ + +/* For BC (not binary-safe!) */ +PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers TSRMLS_DC) /* {{{ */ +{ + return _php_error_log_ex(opt_err, message, (opt_err == 3) ? strlen(message) : 0, opt, headers TSRMLS_CC); +} +/* }}} */ + +PHPAPI int _php_error_log_ex(int opt_err, char *message, int message_len, char *opt, char *headers TSRMLS_DC) /* {{{ */ +{ + php_stream *stream = NULL; + + switch (opt_err) + { + case 1: /*send an email */ + if (!php_mail(opt, "PHP error_log message", message, headers, NULL TSRMLS_CC)) { + return FAILURE; + } + break; + + case 2: /*send to an address */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "TCP/IP option not available!"); + return FAILURE; + break; + + case 3: /*save to a file */ + stream = php_stream_open_wrapper(opt, "a", IGNORE_URL_WIN | REPORT_ERRORS, NULL); + if (!stream) { + return FAILURE; + } + php_stream_write(stream, message, message_len); + php_stream_close(stream); + break; + + case 4: /* send to SAPI */ + if (sapi_module.log_message) { + sapi_module.log_message(message TSRMLS_CC); + } else { + return FAILURE; + } + break; + + default: + php_log_err(message TSRMLS_CC); + break; + } + return SUCCESS; +} +/* }}} */ + +/* {{{ proto array error_get_last() + Get the last occurred error as associative array. Returns NULL if there hasn't been an error yet. */ +PHP_FUNCTION(error_get_last) +{ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + return; + } + + if (PG(last_error_message)) { + array_init(return_value); + add_assoc_long_ex(return_value, "type", sizeof("type"), PG(last_error_type)); + add_assoc_string_ex(return_value, "message", sizeof("message"), PG(last_error_message), 1); + add_assoc_string_ex(return_value, "file", sizeof("file"), PG(last_error_file)?PG(last_error_file):"-", 1 ); + add_assoc_long_ex(return_value, "line", sizeof("line"), PG(last_error_lineno)); + } +} +/* }}} */ + +/* {{{ proto mixed call_user_func(mixed function_name [, mixed parmeter] [, mixed ...]) + Call a user function which is the first parameter */ +PHP_FUNCTION(call_user_func) +{ + zval *retval_ptr = NULL; + zend_fcall_info fci; + zend_fcall_info_cache fci_cache; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f*", &fci, &fci_cache, &fci.params, &fci.param_count) == FAILURE) { + return; + } + + fci.retval_ptr_ptr = &retval_ptr; + + if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && fci.retval_ptr_ptr && *fci.retval_ptr_ptr) { + COPY_PZVAL_TO_ZVAL(*return_value, *fci.retval_ptr_ptr); + } + + if (fci.params) { + efree(fci.params); + } +} +/* }}} */ + +/* {{{ proto mixed call_user_func_array(string function_name, array parameters) + Call a user function which is the first parameter with the arguments contained in array */ +PHP_FUNCTION(call_user_func_array) +{ + zval *params, *retval_ptr = NULL; + zend_fcall_info fci; + zend_fcall_info_cache fci_cache; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "fa/", &fci, &fci_cache, ¶ms) == FAILURE) { + return; + } + + zend_fcall_info_args(&fci, params TSRMLS_CC); + fci.retval_ptr_ptr = &retval_ptr; + + if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && fci.retval_ptr_ptr && *fci.retval_ptr_ptr) { + COPY_PZVAL_TO_ZVAL(*return_value, *fci.retval_ptr_ptr); + } + + zend_fcall_info_args_clear(&fci, 1); +} +/* }}} */ + +/* {{{ proto mixed call_user_method(string method_name, mixed object [, mixed parameter] [, mixed ...]) + Call a user method on a specific object or class */ +PHP_FUNCTION(call_user_method) +{ + zval ***params = NULL; + int n_params = 0; + zval *retval_ptr; + zval *callback, *object; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/z*", &callback, &object, ¶ms, &n_params) == FAILURE) { + return; + } + + if (Z_TYPE_P(object) != IS_OBJECT && + Z_TYPE_P(object) != IS_STRING + ) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument is not an object or class name"); + if (params) { + efree(params); + } + RETURN_FALSE; + } + + convert_to_string(callback); + + if (call_user_function_ex(EG(function_table), &object, callback, &retval_ptr, n_params, params, 0, NULL TSRMLS_CC) == SUCCESS) { + if (retval_ptr) { + COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); + } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", Z_STRVAL_P(callback)); + } + if (n_params) { + efree(params); + } +} +/* }}} */ + +/* {{{ proto mixed call_user_method_array(string method_name, mixed object, array params) + Call a user method on a specific object or class using a parameter array */ +PHP_FUNCTION(call_user_method_array) +{ + zval *params, ***method_args = NULL, *retval_ptr; + zval *callback, *object; + HashTable *params_ar; + int num_elems, element = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/zA/", &callback, &object, ¶ms) == FAILURE) { + return; + } + + if (Z_TYPE_P(object) != IS_OBJECT && + Z_TYPE_P(object) != IS_STRING + ) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument is not an object or class name"); + RETURN_FALSE; + } + + convert_to_string(callback); + + params_ar = HASH_OF(params); + num_elems = zend_hash_num_elements(params_ar); + method_args = (zval ***) safe_emalloc(sizeof(zval **), num_elems, 0); + + for (zend_hash_internal_pointer_reset(params_ar); + zend_hash_get_current_data(params_ar, (void **) &(method_args[element])) == SUCCESS; + zend_hash_move_forward(params_ar) + ) { + element++; + } + + if (call_user_function_ex(EG(function_table), &object, callback, &retval_ptr, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS) { + if (retval_ptr) { + COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); + } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", Z_STRVAL_P(callback)); + } + + efree(method_args); +} +/* }}} */ + +/* {{{ proto mixed forward_static_call(mixed function_name [, mixed parmeter] [, mixed ...]) U + Call a user function which is the first parameter */ +PHP_FUNCTION(forward_static_call) +{ + zval *retval_ptr = NULL; + zend_fcall_info fci; + zend_fcall_info_cache fci_cache; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f*", &fci, &fci_cache, &fci.params, &fci.param_count) == FAILURE) { + return; + } + + if (!EG(active_op_array)->scope) { + zend_error(E_ERROR, "Cannot call forward_static_call() when no class scope is active"); + } + + fci.retval_ptr_ptr = &retval_ptr; + + if (EG(called_scope) && + instanceof_function(EG(called_scope), fci_cache.calling_scope TSRMLS_CC)) { + fci_cache.called_scope = EG(called_scope); + } + + if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && fci.retval_ptr_ptr && *fci.retval_ptr_ptr) { + COPY_PZVAL_TO_ZVAL(*return_value, *fci.retval_ptr_ptr); + } + + if (fci.params) { + efree(fci.params); + } +} +/* }}} */ + +/* {{{ proto mixed call_user_func_array(string function_name, array parameters) U + Call a user function which is the first parameter with the arguments contained in array */ +PHP_FUNCTION(forward_static_call_array) +{ + zval *params, *retval_ptr = NULL; + zend_fcall_info fci; + zend_fcall_info_cache fci_cache; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "fa/", &fci, &fci_cache, ¶ms) == FAILURE) { + return; + } + + zend_fcall_info_args(&fci, params TSRMLS_CC); + fci.retval_ptr_ptr = &retval_ptr; + + if (EG(called_scope) && + instanceof_function(EG(called_scope), fci_cache.calling_scope TSRMLS_CC)) { + fci_cache.called_scope = EG(called_scope); + } + + if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && fci.retval_ptr_ptr && *fci.retval_ptr_ptr) { + COPY_PZVAL_TO_ZVAL(*return_value, *fci.retval_ptr_ptr); + } + + zend_fcall_info_args_clear(&fci, 1); +} +/* }}} */ + +void user_shutdown_function_dtor(php_shutdown_function_entry *shutdown_function_entry) /* {{{ */ +{ + int i; + + for (i = 0; i < shutdown_function_entry->arg_count; i++) { + zval_ptr_dtor(&shutdown_function_entry->arguments[i]); + } + efree(shutdown_function_entry->arguments); +} +/* }}} */ + +void user_tick_function_dtor(user_tick_function_entry *tick_function_entry) /* {{{ */ +{ + int i; + + for (i = 0; i < tick_function_entry->arg_count; i++) { + zval_ptr_dtor(&tick_function_entry->arguments[i]); + } + efree(tick_function_entry->arguments); +} +/* }}} */ + +static int user_shutdown_function_call(php_shutdown_function_entry *shutdown_function_entry TSRMLS_DC) /* {{{ */ +{ + zval retval; + char *function_name; + + if (!zend_is_callable(shutdown_function_entry->arguments[0], 0, &function_name TSRMLS_CC)) { + php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", function_name); + if (function_name) { + efree(function_name); + } + return 0; + } + if (function_name) { + efree(function_name); + } + + if (call_user_function(EG(function_table), NULL, + shutdown_function_entry->arguments[0], + &retval, + shutdown_function_entry->arg_count - 1, + shutdown_function_entry->arguments + 1 + TSRMLS_CC ) == SUCCESS) + { + zval_dtor(&retval); + } + return 0; +} +/* }}} */ + +static void user_tick_function_call(user_tick_function_entry *tick_fe TSRMLS_DC) /* {{{ */ +{ + zval retval; + zval *function = tick_fe->arguments[0]; + + /* Prevent reentrant calls to the same user ticks function */ + if (! tick_fe->calling) { + tick_fe->calling = 1; + + if (call_user_function( EG(function_table), NULL, + function, + &retval, + tick_fe->arg_count - 1, + tick_fe->arguments + 1 + TSRMLS_CC) == SUCCESS) { + zval_dtor(&retval); + + } else { + zval **obj, **method; + + if (Z_TYPE_P(function) == IS_STRING) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s() - function does not exist", Z_STRVAL_P(function)); + } else if ( Z_TYPE_P(function) == IS_ARRAY + && zend_hash_index_find(Z_ARRVAL_P(function), 0, (void **) &obj) == SUCCESS + && zend_hash_index_find(Z_ARRVAL_P(function), 1, (void **) &method) == SUCCESS + && Z_TYPE_PP(obj) == IS_OBJECT + && Z_TYPE_PP(method) == IS_STRING) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s::%s() - function does not exist", Z_OBJCE_PP(obj)->name, Z_STRVAL_PP(method)); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call tick function"); + } + } + + tick_fe->calling = 0; + } +} +/* }}} */ + +static void run_user_tick_functions(int tick_count) /* {{{ */ +{ + TSRMLS_FETCH(); + + zend_llist_apply(BG(user_tick_functions), (llist_apply_func_t) user_tick_function_call TSRMLS_CC); +} +/* }}} */ + +static int user_tick_function_compare(user_tick_function_entry * tick_fe1, user_tick_function_entry * tick_fe2) /* {{{ */ +{ + zval *func1 = tick_fe1->arguments[0]; + zval *func2 = tick_fe2->arguments[0]; + int ret; + TSRMLS_FETCH(); + + if (Z_TYPE_P(func1) == IS_STRING && Z_TYPE_P(func2) == IS_STRING) { + ret = (zend_binary_zval_strcmp(func1, func2) == 0); + } else if (Z_TYPE_P(func1) == IS_ARRAY && Z_TYPE_P(func2) == IS_ARRAY) { + zval result; + zend_compare_arrays(&result, func1, func2 TSRMLS_CC); + ret = (Z_LVAL(result) == 0); + } else if (Z_TYPE_P(func1) == IS_OBJECT && Z_TYPE_P(func2) == IS_OBJECT) { + zval result; + zend_compare_objects(&result, func1, func2 TSRMLS_CC); + ret = (Z_LVAL(result) == 0); + } else { + ret = 0; + } + + if (ret && tick_fe1->calling) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to delete tick function executed at the moment"); + return 0; + } + return ret; +} +/* }}} */ + +void php_call_shutdown_functions(TSRMLS_D) /* {{{ */ +{ + if (BG(user_shutdown_function_names)) { + zend_try { + zend_hash_apply(BG(user_shutdown_function_names), (apply_func_t) user_shutdown_function_call TSRMLS_CC); + } + zend_end_try(); + php_free_shutdown_functions(TSRMLS_C); + } +} +/* }}} */ + +void php_free_shutdown_functions(TSRMLS_D) /* {{{ */ +{ + if (BG(user_shutdown_function_names)) + zend_try { + zend_hash_destroy(BG(user_shutdown_function_names)); + FREE_HASHTABLE(BG(user_shutdown_function_names)); + BG(user_shutdown_function_names) = NULL; + } zend_catch { + /* maybe shutdown method call exit, we just ignore it */ + FREE_HASHTABLE(BG(user_shutdown_function_names)); + BG(user_shutdown_function_names) = NULL; + } zend_end_try(); +} +/* }}} */ + +/* {{{ proto void register_shutdown_function(string function_name) U + Register a user-level function to be called on request termination */ +PHP_FUNCTION(register_shutdown_function) +{ + php_shutdown_function_entry shutdown_function_entry; + char *function_name = NULL; + int i; + + shutdown_function_entry.arg_count = ZEND_NUM_ARGS(); + + if (shutdown_function_entry.arg_count < 1) { + WRONG_PARAM_COUNT; + } + + shutdown_function_entry.arguments = (zval **) safe_emalloc(sizeof(zval *), shutdown_function_entry.arg_count, 0); + + if (zend_get_parameters_array(ht, shutdown_function_entry.arg_count, shutdown_function_entry.arguments) == FAILURE) { + efree(shutdown_function_entry.arguments); + RETURN_FALSE; + } + + /* Prevent entering of anything but valid callback (syntax check only!) */ + if (!zend_is_callable(shutdown_function_entry.arguments[0], 0, &function_name TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid shutdown callback '%s' passed", function_name); + efree(shutdown_function_entry.arguments); + RETVAL_FALSE; + } else { + if (!BG(user_shutdown_function_names)) { + ALLOC_HASHTABLE(BG(user_shutdown_function_names)); + zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void (*)(void *)) user_shutdown_function_dtor, 0); + } + + for (i = 0; i < shutdown_function_entry.arg_count; i++) { + Z_ADDREF_P(shutdown_function_entry.arguments[i]); + } + zend_hash_next_index_insert(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry), NULL); + } + if (function_name) { + efree(function_name); + } +} +/* }}} */ + +PHPAPI zend_bool register_user_shutdown_function(char *function_name, size_t function_len, php_shutdown_function_entry *shutdown_function_entry TSRMLS_DC) /* {{{ */ +{ + if (!BG(user_shutdown_function_names)) { + ALLOC_HASHTABLE(BG(user_shutdown_function_names)); + zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void (*)(void *)) user_shutdown_function_dtor, 0); + } + + return zend_hash_update(BG(user_shutdown_function_names), function_name, function_len, shutdown_function_entry, sizeof(php_shutdown_function_entry), NULL) != FAILURE; +} +/* }}} */ + +PHPAPI zend_bool remove_user_shutdown_function(char *function_name, size_t function_len TSRMLS_DC) /* {{{ */ +{ + if (BG(user_shutdown_function_names)) { + return zend_hash_del_key_or_index(BG(user_shutdown_function_names), function_name, function_len, 0, HASH_DEL_KEY) != FAILURE; + } + + return 0; +} +/* }}} */ + +PHPAPI zend_bool append_user_shutdown_function(php_shutdown_function_entry shutdown_function_entry TSRMLS_DC) /* {{{ */ +{ + if (!BG(user_shutdown_function_names)) { + ALLOC_HASHTABLE(BG(user_shutdown_function_names)); + zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void (*)(void *)) user_shutdown_function_dtor, 0); + } + + return zend_hash_next_index_insert(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry), NULL) != FAILURE; +} +/* }}} */ + +ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini) /* {{{ */ +{ + syntax_highlighter_ini->highlight_comment = INI_STR("highlight.comment"); + syntax_highlighter_ini->highlight_default = INI_STR("highlight.default"); + syntax_highlighter_ini->highlight_html = INI_STR("highlight.html"); + syntax_highlighter_ini->highlight_keyword = INI_STR("highlight.keyword"); + syntax_highlighter_ini->highlight_string = INI_STR("highlight.string"); +} +/* }}} */ + +/* {{{ proto bool highlight_file(string file_name [, bool return] ) + Syntax highlight a source file */ +PHP_FUNCTION(highlight_file) +{ + char *filename; + int filename_len, ret; + zend_syntax_highlighter_ini syntax_highlighter_ini; + zend_bool i = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &filename, &filename_len, &i) == FAILURE) { + RETURN_FALSE; + } + + if (php_check_open_basedir(filename TSRMLS_CC)) { + RETURN_FALSE; + } + + if (i) { + php_output_start_default(TSRMLS_C); + } + + php_get_highlight_struct(&syntax_highlighter_ini); + + ret = highlight_file(filename, &syntax_highlighter_ini TSRMLS_CC); + + if (ret == FAILURE) { + if (i) { + php_output_end(TSRMLS_C); + } + RETURN_FALSE; + } + + if (i) { + php_output_get_contents(return_value TSRMLS_CC); + php_output_discard(TSRMLS_C); + } else { + RETURN_TRUE; + } +} +/* }}} */ + +/* {{{ proto string php_strip_whitespace(string file_name) + Return source with stripped comments and whitespace */ +PHP_FUNCTION(php_strip_whitespace) +{ + char *filename; + int filename_len; + zend_lex_state original_lex_state; + zend_file_handle file_handle = {0}; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { + RETURN_FALSE; + } + + php_output_start_default(TSRMLS_C); + + file_handle.type = ZEND_HANDLE_FILENAME; + file_handle.filename = filename; + file_handle.free_filename = 0; + file_handle.opened_path = NULL; + zend_save_lexical_state(&original_lex_state TSRMLS_CC); + if (open_file_for_scanning(&file_handle TSRMLS_CC) == FAILURE) { + zend_restore_lexical_state(&original_lex_state TSRMLS_CC); + php_output_end(TSRMLS_C); + RETURN_EMPTY_STRING(); + } + + zend_strip(TSRMLS_C); + + zend_destroy_file_handle(&file_handle TSRMLS_CC); + zend_restore_lexical_state(&original_lex_state TSRMLS_CC); + + php_output_get_contents(return_value TSRMLS_CC); + php_output_discard(TSRMLS_C); +} +/* }}} */ + +/* {{{ proto bool highlight_string(string string [, bool return] ) + Syntax highlight a string or optionally return it */ +PHP_FUNCTION(highlight_string) +{ + zval **expr; + zend_syntax_highlighter_ini syntax_highlighter_ini; + char *hicompiled_string_description; + zend_bool i = 0; + int old_error_reporting = EG(error_reporting); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|b", &expr, &i) == FAILURE) { + RETURN_FALSE; + } + convert_to_string_ex(expr); + + if (i) { + php_output_start_default(TSRMLS_C); + } + + EG(error_reporting) = E_ERROR; + + php_get_highlight_struct(&syntax_highlighter_ini); + + hicompiled_string_description = zend_make_compiled_string_description("highlighted code" TSRMLS_CC); + + if (highlight_string(*expr, &syntax_highlighter_ini, hicompiled_string_description TSRMLS_CC) == FAILURE) { + efree(hicompiled_string_description); + EG(error_reporting) = old_error_reporting; + if (i) { + php_output_end(TSRMLS_C); + } + RETURN_FALSE; + } + efree(hicompiled_string_description); + + EG(error_reporting) = old_error_reporting; + + if (i) { + php_output_get_contents(return_value TSRMLS_CC); + php_output_discard(TSRMLS_C); + } else { + RETURN_TRUE; + } +} +/* }}} */ + +/* {{{ proto string ini_get(string varname) + Get a configuration option */ +PHP_FUNCTION(ini_get) +{ + char *varname, *str; + int varname_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &varname, &varname_len) == FAILURE) { + return; + } + + str = zend_ini_string(varname, varname_len + 1, 0); + + if (!str) { + RETURN_FALSE; + } + + RETURN_STRING(str, 1); +} +/* }}} */ + +static int php_ini_get_option(zend_ini_entry *ini_entry TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ +{ + zval *ini_array = va_arg(args, zval *); + int module_number = va_arg(args, int); + int details = va_arg(args, int); + zval *option; + + if (module_number != 0 && ini_entry->module_number != module_number) { + return 0; + } + + if (hash_key->nKeyLength == 0 || + hash_key->arKey[0] != 0 + ) { + if (details) { + MAKE_STD_ZVAL(option); + array_init(option); + + if (ini_entry->orig_value) { + add_assoc_stringl(option, "global_value", ini_entry->orig_value, ini_entry->orig_value_length, 1); + } else if (ini_entry->value) { + add_assoc_stringl(option, "global_value", ini_entry->value, ini_entry->value_length, 1); + } else { + add_assoc_null(option, "global_value"); + } + + if (ini_entry->value) { + add_assoc_stringl(option, "local_value", ini_entry->value, ini_entry->value_length, 1); + } else { + add_assoc_null(option, "local_value"); + } + + add_assoc_long(option, "access", ini_entry->modifiable); + + add_assoc_zval_ex(ini_array, ini_entry->name, ini_entry->name_length, option); + } else { + if (ini_entry->value) { + add_assoc_stringl(ini_array, ini_entry->name, ini_entry->value, ini_entry->value_length, 1); + } else { + add_assoc_null(ini_array, ini_entry->name); + } + } + } + return 0; +} +/* }}} */ + +/* {{{ proto array ini_get_all([string extension[, bool details = true]]) + Get all configuration options */ +PHP_FUNCTION(ini_get_all) +{ + char *extname = NULL; + int extname_len = 0, extnumber = 0; + zend_module_entry *module; + zend_bool details = 1; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!b", &extname, &extname_len, &details) == FAILURE) { + return; + } + + zend_ini_sort_entries(TSRMLS_C); + + if (extname) { + if (zend_hash_find(&module_registry, extname, extname_len+1, (void **) &module) == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find extension '%s'", extname); + RETURN_FALSE; + } + extnumber = module->module_number; + } + + array_init(return_value); + zend_hash_apply_with_arguments(EG(ini_directives) TSRMLS_CC, (apply_func_args_t) php_ini_get_option, 2, return_value, extnumber, details); +} +/* }}} */ + +static int php_ini_check_path(char *option_name, int option_len, char *new_option_name, int new_option_len) /* {{{ */ +{ + if (option_len != (new_option_len - 1)) { + return 0; + } + + return !strncmp(option_name, new_option_name, option_len); +} +/* }}} */ + +/* {{{ proto string ini_set(string varname, string newvalue) + Set a configuration option, returns false on error and the old value of the configuration option on success */ +PHP_FUNCTION(ini_set) +{ + char *varname, *new_value; + int varname_len, new_value_len; + char *old_value; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &varname, &varname_len, &new_value, &new_value_len) == FAILURE) { + return; + } + + old_value = zend_ini_string(varname, varname_len + 1, 0); + + /* copy to return here, because alter might free it! */ + if (old_value) { + RETVAL_STRING(old_value, 1); + } else { + RETVAL_FALSE; + } + +#define _CHECK_PATH(var, var_len, ini) php_ini_check_path(var, var_len, ini, sizeof(ini)) + /* open basedir check */ + if (PG(open_basedir)) { + if (_CHECK_PATH(varname, varname_len, "error_log") || + _CHECK_PATH(varname, varname_len, "java.class.path") || + _CHECK_PATH(varname, varname_len, "java.home") || + _CHECK_PATH(varname, varname_len, "mail.log") || + _CHECK_PATH(varname, varname_len, "java.library.path") || + _CHECK_PATH(varname, varname_len, "vpopmail.directory")) { + if (php_check_open_basedir(new_value TSRMLS_CC)) { + zval_dtor(return_value); + RETURN_FALSE; + } + } + } + + if (zend_alter_ini_entry_ex(varname, varname_len + 1, new_value, new_value_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) { + zval_dtor(return_value); + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto void ini_restore(string varname) + Restore the value of a configuration option specified by varname */ +PHP_FUNCTION(ini_restore) +{ + char *varname; + int varname_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &varname, &varname_len) == FAILURE) { + return; + } + + zend_restore_ini_entry(varname, varname_len+1, PHP_INI_STAGE_RUNTIME); +} +/* }}} */ + +/* {{{ proto string set_include_path(string new_include_path) + Sets the include_path configuration option */ +PHP_FUNCTION(set_include_path) +{ + char *new_value; + int new_value_len; + char *old_value; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &new_value, &new_value_len) == FAILURE) { + return; + } + + old_value = zend_ini_string("include_path", sizeof("include_path"), 0); + /* copy to return here, because alter might free it! */ + if (old_value) { + RETVAL_STRING(old_value, 1); + } else { + RETVAL_FALSE; + } + + if (zend_alter_ini_entry_ex("include_path", sizeof("include_path"), new_value, new_value_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) { + zval_dtor(return_value); + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto string get_include_path() + Get the current include_path configuration option */ +PHP_FUNCTION(get_include_path) +{ + char *str; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + return; + } + + str = zend_ini_string("include_path", sizeof("include_path"), 0); + + if (str == NULL) { + RETURN_FALSE; + } + + RETURN_STRING(str, 1); +} +/* }}} */ + +/* {{{ proto void restore_include_path() + Restore the value of the include_path configuration option */ +PHP_FUNCTION(restore_include_path) +{ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + return; + } + zend_restore_ini_entry("include_path", sizeof("include_path"), PHP_INI_STAGE_RUNTIME); +} +/* }}} */ + +/* {{{ proto mixed print_r(mixed var [, bool return]) + Prints out or returns information about the specified variable */ +PHP_FUNCTION(print_r) +{ + zval *var; + zend_bool do_return = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &var, &do_return) == FAILURE) { + RETURN_FALSE; + } + + if (do_return) { + php_output_start_default(TSRMLS_C); + } + + zend_print_zval_r(var, 0 TSRMLS_CC); + + if (do_return) { + php_output_get_contents(return_value TSRMLS_CC); + php_output_discard(TSRMLS_C); + } else { + RETURN_TRUE; + } +} +/* }}} */ + +/* {{{ proto int connection_aborted(void) + Returns true if client disconnected */ +PHP_FUNCTION(connection_aborted) +{ + RETURN_LONG(PG(connection_status) & PHP_CONNECTION_ABORTED); +} +/* }}} */ + +/* {{{ proto int connection_status(void) + Returns the connection status bitfield */ +PHP_FUNCTION(connection_status) +{ + RETURN_LONG(PG(connection_status)); +} +/* }}} */ + +/* {{{ proto int ignore_user_abort([string value]) + Set whether we want to ignore a user abort event or not */ +PHP_FUNCTION(ignore_user_abort) +{ + char *arg = NULL; + int arg_len = 0; + int old_setting; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, &arg_len) == FAILURE) { + return; + } + + old_setting = PG(ignore_user_abort); + + if (arg) { + zend_alter_ini_entry_ex("ignore_user_abort", sizeof("ignore_user_abort"), arg, arg_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); + } + + RETURN_LONG(old_setting); +} +/* }}} */ + +#if HAVE_GETSERVBYNAME +/* {{{ proto int getservbyname(string service, string protocol) + Returns port associated with service. Protocol must be "tcp" or "udp" */ +PHP_FUNCTION(getservbyname) +{ + char *name, *proto; + int name_len, proto_len; + struct servent *serv; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &proto, &proto_len) == FAILURE) { + return; + } + + +/* empty string behaves like NULL on windows implementation of + getservbyname. Let be portable instead. */ +#ifdef PHP_WIN32 + if (proto_len == 0) { + RETURN_FALSE; + } +#endif + + serv = getservbyname(name, proto); + + if (serv == NULL) { + RETURN_FALSE; + } + + RETURN_LONG(ntohs(serv->s_port)); +} +/* }}} */ +#endif + +#if HAVE_GETSERVBYPORT +/* {{{ proto string getservbyport(int port, string protocol) + Returns service name associated with port. Protocol must be "tcp" or "udp" */ +PHP_FUNCTION(getservbyport) +{ + char *proto; + int proto_len; + long port; + struct servent *serv; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &port, &proto, &proto_len) == FAILURE) { + return; + } + + serv = getservbyport(htons((unsigned short) port), proto); + + if (serv == NULL) { + RETURN_FALSE; + } + + RETURN_STRING(serv->s_name, 1); +} +/* }}} */ +#endif + +#if HAVE_GETPROTOBYNAME +/* {{{ proto int getprotobyname(string name) + Returns protocol number associated with name as per /etc/protocols */ +PHP_FUNCTION(getprotobyname) +{ + char *name; + int name_len; + struct protoent *ent; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + return; + } + + ent = getprotobyname(name); + + if (ent == NULL) { + RETURN_FALSE; + } + + RETURN_LONG(ent->p_proto); +} +/* }}} */ +#endif + +#if HAVE_GETPROTOBYNUMBER +/* {{{ proto string getprotobynumber(int proto) + Returns protocol name associated with protocol number proto */ +PHP_FUNCTION(getprotobynumber) +{ + long proto; + struct protoent *ent; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &proto) == FAILURE) { + return; + } + + ent = getprotobynumber(proto); + + if (ent == NULL) { + RETURN_FALSE; + } + + RETURN_STRING(ent->p_name, 1); +} +/* }}} */ +#endif + +/* {{{ proto bool register_tick_function(string function_name [, mixed arg [, mixed ... ]]) + Registers a tick callback function */ +PHP_FUNCTION(register_tick_function) +{ + user_tick_function_entry tick_fe; + int i; + char *function_name = NULL; + + tick_fe.calling = 0; + tick_fe.arg_count = ZEND_NUM_ARGS(); + + if (tick_fe.arg_count < 1) { + WRONG_PARAM_COUNT; + } + + tick_fe.arguments = (zval **) safe_emalloc(sizeof(zval *), tick_fe.arg_count, 0); + + if (zend_get_parameters_array(ht, tick_fe.arg_count, tick_fe.arguments) == FAILURE) { + efree(tick_fe.arguments); + RETURN_FALSE; + } + + if (!zend_is_callable(tick_fe.arguments[0], 0, &function_name TSRMLS_CC)) { + efree(tick_fe.arguments); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid tick callback '%s' passed", function_name); + efree(function_name); + RETURN_FALSE; + } else if (function_name) { + efree(function_name); + } + + if (Z_TYPE_P(tick_fe.arguments[0]) != IS_ARRAY && Z_TYPE_P(tick_fe.arguments[0]) != IS_OBJECT) { + convert_to_string_ex(&tick_fe.arguments[0]); + } + + if (!BG(user_tick_functions)) { + BG(user_tick_functions) = (zend_llist *) emalloc(sizeof(zend_llist)); + zend_llist_init(BG(user_tick_functions), + sizeof(user_tick_function_entry), + (llist_dtor_func_t) user_tick_function_dtor, 0); + php_add_tick_function(run_user_tick_functions); + } + + for (i = 0; i < tick_fe.arg_count; i++) { + Z_ADDREF_P(tick_fe.arguments[i]); + } + + zend_llist_add_element(BG(user_tick_functions), &tick_fe); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto void unregister_tick_function(string function_name) + Unregisters a tick callback function */ +PHP_FUNCTION(unregister_tick_function) +{ + zval *function; + user_tick_function_entry tick_fe; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/", &function) == FAILURE) { + return; + } + + if (!BG(user_tick_functions)) { + return; + } + + if (Z_TYPE_P(function) != IS_ARRAY) { + convert_to_string(function); + } + + tick_fe.arguments = (zval **) emalloc(sizeof(zval *)); + tick_fe.arguments[0] = function; + tick_fe.arg_count = 1; + zend_llist_del_element(BG(user_tick_functions), &tick_fe, (int (*)(void *, void *)) user_tick_function_compare); + efree(tick_fe.arguments); +} +/* }}} */ + +/* {{{ proto bool is_uploaded_file(string path) + Check if file was created by rfc1867 upload */ +PHP_FUNCTION(is_uploaded_file) +{ + char *path; + int path_len; + + if (!SG(rfc1867_uploaded_files)) { + RETURN_FALSE; + } + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &path_len) == FAILURE) { + return; + } + + if (zend_hash_exists(SG(rfc1867_uploaded_files), path, path_len + 1)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto bool move_uploaded_file(string path, string new_path) + Move a file if and only if it was created by an upload */ +PHP_FUNCTION(move_uploaded_file) +{ + char *path, *new_path; + int path_len, new_path_len; + zend_bool successful = 0; + +#ifndef PHP_WIN32 + int oldmask; int ret; +#endif + + if (!SG(rfc1867_uploaded_files)) { + RETURN_FALSE; + } + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &path, &path_len, &new_path, &new_path_len) == FAILURE) { + return; + } + + if (!zend_hash_exists(SG(rfc1867_uploaded_files), path, path_len + 1)) { + RETURN_FALSE; + } + + if (php_check_open_basedir(new_path TSRMLS_CC)) { + RETURN_FALSE; + } + + if (VCWD_RENAME(path, new_path) == 0) { + successful = 1; +#ifndef PHP_WIN32 + oldmask = umask(077); + umask(oldmask); + + ret = VCWD_CHMOD(new_path, 0666 & ~oldmask); + + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + } +#endif + } else if (php_copy_file_ex(path, new_path, STREAM_DISABLE_OPEN_BASEDIR TSRMLS_CC) == SUCCESS) { + VCWD_UNLINK(path); + successful = 1; + } + + if (successful) { + zend_hash_del(SG(rfc1867_uploaded_files), path, path_len + 1); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to move '%s' to '%s'", path, new_path); + } + + RETURN_BOOL(successful); +} +/* }}} */ + +/* {{{ php_simple_ini_parser_cb + */ +static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_type, zval *arr TSRMLS_DC) +{ + zval *element; + + switch (callback_type) { + + case ZEND_INI_PARSER_ENTRY: + if (!arg2) { + /* bare string - nothing to do */ + break; + } + ALLOC_ZVAL(element); + MAKE_COPY_ZVAL(&arg2, element); + zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, &element, sizeof(zval *), NULL); + break; + + case ZEND_INI_PARSER_POP_ENTRY: + { + zval *hash, **find_hash; + + if (!arg2) { + /* bare string - nothing to do */ + break; + } + + if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) { + ulong key = (ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); + if (zend_hash_index_find(Z_ARRVAL_P(arr), key, (void **) &find_hash) == FAILURE) { + ALLOC_ZVAL(hash); + INIT_PZVAL(hash); + array_init(hash); + + zend_hash_index_update(Z_ARRVAL_P(arr), key, &hash, sizeof(zval *), NULL); + } else { + hash = *find_hash; + } + } else { + if (zend_hash_find(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, (void **) &find_hash) == FAILURE) { + ALLOC_ZVAL(hash); + INIT_PZVAL(hash); + array_init(hash); + + zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, &hash, sizeof(zval *), NULL); + } else { + hash = *find_hash; + } + } + + if (Z_TYPE_P(hash) != IS_ARRAY) { + zval_dtor(hash); + INIT_PZVAL(hash); + array_init(hash); + } + + ALLOC_ZVAL(element); + MAKE_COPY_ZVAL(&arg2, element); + + if (arg3 && Z_STRLEN_P(arg3) > 0) { + add_assoc_zval_ex(hash, Z_STRVAL_P(arg3), Z_STRLEN_P(arg3) + 1, element); + } else { + add_next_index_zval(hash, element); + } + } + break; + + case ZEND_INI_PARSER_SECTION: + break; + } +} +/* }}} */ + +/* {{{ php_ini_parser_cb_with_sections + */ +static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, zval *arg3, int callback_type, zval *arr TSRMLS_DC) +{ + if (callback_type == ZEND_INI_PARSER_SECTION) { + MAKE_STD_ZVAL(BG(active_ini_file_section)); + array_init(BG(active_ini_file_section)); + zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, &BG(active_ini_file_section), sizeof(zval *), NULL); + } else if (arg2) { + zval *active_arr; + + if (BG(active_ini_file_section)) { + active_arr = BG(active_ini_file_section); + } else { + active_arr = arr; + } + + php_simple_ini_parser_cb(arg1, arg2, arg3, callback_type, active_arr TSRMLS_CC); + } +} +/* }}} */ + +/* {{{ proto array parse_ini_file(string filename [, bool process_sections [, int scanner_mode]]) + Parse configuration file */ +PHP_FUNCTION(parse_ini_file) +{ + char *filename = NULL; + int filename_len = 0; + zend_bool process_sections = 0; + long scanner_mode = ZEND_INI_SCANNER_NORMAL; + zend_file_handle fh; + zend_ini_parser_cb_t ini_parser_cb; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|bl", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) { + RETURN_FALSE; + } + + if (filename_len == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Filename cannot be empty!"); + RETURN_FALSE; + } + + /* Set callback function */ + if (process_sections) { + BG(active_ini_file_section) = NULL; + ini_parser_cb = (zend_ini_parser_cb_t) php_ini_parser_cb_with_sections; + } else { + ini_parser_cb = (zend_ini_parser_cb_t) php_simple_ini_parser_cb; + } + + /* Setup filehandle */ + memset(&fh, 0, sizeof(fh)); + fh.filename = filename; + fh.type = ZEND_HANDLE_FILENAME; + + array_init(return_value); + if (zend_parse_ini_file(&fh, 0, scanner_mode, ini_parser_cb, return_value TSRMLS_CC) == FAILURE) { + zend_hash_destroy(Z_ARRVAL_P(return_value)); + efree(Z_ARRVAL_P(return_value)); + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto array parse_ini_string(string ini_string [, bool process_sections [, int scanner_mode]]) + Parse configuration string */ +PHP_FUNCTION(parse_ini_string) +{ + char *string = NULL, *str = NULL; + int str_len = 0; + zend_bool process_sections = 0; + long scanner_mode = ZEND_INI_SCANNER_NORMAL; + zend_ini_parser_cb_t ini_parser_cb; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &str, &str_len, &process_sections, &scanner_mode) == FAILURE) { + RETURN_FALSE; + } + + if (INT_MAX - str_len < ZEND_MMAP_AHEAD) { + RETVAL_FALSE; + } + + /* Set callback function */ + if (process_sections) { + BG(active_ini_file_section) = NULL; + ini_parser_cb = (zend_ini_parser_cb_t) php_ini_parser_cb_with_sections; + } else { + ini_parser_cb = (zend_ini_parser_cb_t) php_simple_ini_parser_cb; + } + + /* Setup string */ + string = (char *) emalloc(str_len + ZEND_MMAP_AHEAD); + memcpy(string, str, str_len); + memset(string + str_len, 0, ZEND_MMAP_AHEAD); + + array_init(return_value); + if (zend_parse_ini_string(string, 0, scanner_mode, ini_parser_cb, return_value TSRMLS_CC) == FAILURE) { + zend_hash_destroy(Z_ARRVAL_P(return_value)); + efree(Z_ARRVAL_P(return_value)); + RETVAL_FALSE; + } + efree(string); +} +/* }}} */ + +#if ZEND_DEBUG +/* This function returns an array of ALL valid ini options with values and + * is not the same as ini_get_all() which returns only registered ini options. Only useful for devs to debug php.ini scanner/parser! */ +PHP_FUNCTION(config_get_hash) /* {{{ */ +{ + HashTable *hash = php_ini_get_configuration_hash(); + + array_init(return_value); + zend_hash_apply_with_arguments(hash TSRMLS_CC, (apply_func_args_t) add_config_entry_cb, 1, return_value); +} +/* }}} */ +#endif + +#ifdef HAVE_GETLOADAVG +/* {{{ proto array sys_getloadavg() +*/ +PHP_FUNCTION(sys_getloadavg) +{ + double load[3]; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + if (getloadavg(load, 3) == -1) { + RETURN_FALSE; + } else { + array_init(return_value); + add_index_double(return_value, 0, load[0]); + add_index_double(return_value, 1, load[1]); + add_index_double(return_value, 2, load[2]); + } +} +/* }}} */ +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: fdm=marker + * vim: noet sw=4 ts=4 + */ diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h new file mode 100644 index 0000000..7327f7d --- /dev/null +++ b/ext/standard/basic_functions.h @@ -0,0 +1,264 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Andi Gutmans | + | Zeev Suraski | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef BASIC_FUNCTIONS_H +#define BASIC_FUNCTIONS_H + +#include + +#ifdef HAVE_WCHAR_H +#include +#endif + +#include "php_filestat.h" + +#include "zend_highlight.h" + +#include "url_scanner_ex.h" + +extern zend_module_entry basic_functions_module; +#define basic_functions_module_ptr &basic_functions_module + +PHP_MINIT_FUNCTION(basic); +PHP_MSHUTDOWN_FUNCTION(basic); +PHP_RINIT_FUNCTION(basic); +PHP_RSHUTDOWN_FUNCTION(basic); +PHP_MINFO_FUNCTION(basic); + +PHP_FUNCTION(constant); +PHP_FUNCTION(sleep); +PHP_FUNCTION(usleep); +#if HAVE_NANOSLEEP +PHP_FUNCTION(time_nanosleep); +PHP_FUNCTION(time_sleep_until); +#endif +PHP_FUNCTION(flush); +#ifdef HAVE_INET_NTOP +PHP_NAMED_FUNCTION(php_inet_ntop); +#endif +#ifdef HAVE_INET_PTON +PHP_NAMED_FUNCTION(php_inet_pton); +#endif +PHP_FUNCTION(ip2long); +PHP_FUNCTION(long2ip); + +/* system functions */ +PHP_FUNCTION(getenv); +PHP_FUNCTION(putenv); + +PHP_FUNCTION(getopt); + +PHP_FUNCTION(get_current_user); +PHP_FUNCTION(set_time_limit); + +PHP_FUNCTION(header_register_callback); + +PHP_FUNCTION(get_cfg_var); +PHP_FUNCTION(set_magic_quotes_runtime); +PHP_FUNCTION(get_magic_quotes_runtime); +PHP_FUNCTION(get_magic_quotes_gpc); + +PHP_FUNCTION(error_log); +PHP_FUNCTION(error_get_last); + +PHP_FUNCTION(call_user_func); +PHP_FUNCTION(call_user_func_array); +PHP_FUNCTION(call_user_method); +PHP_FUNCTION(call_user_method_array); +PHP_FUNCTION(forward_static_call); +PHP_FUNCTION(forward_static_call_array); + +PHP_FUNCTION(register_shutdown_function); +PHP_FUNCTION(highlight_file); +PHP_FUNCTION(highlight_string); +PHP_FUNCTION(php_strip_whitespace); +ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini); + +PHP_FUNCTION(ini_get); +PHP_FUNCTION(ini_get_all); +PHP_FUNCTION(ini_set); +PHP_FUNCTION(ini_restore); +PHP_FUNCTION(get_include_path); +PHP_FUNCTION(set_include_path); +PHP_FUNCTION(restore_include_path); + +PHP_FUNCTION(print_r); +PHP_FUNCTION(fprintf); +PHP_FUNCTION(vfprintf); + +PHP_FUNCTION(connection_aborted); +PHP_FUNCTION(connection_status); +PHP_FUNCTION(ignore_user_abort); + +PHP_FUNCTION(getservbyname); +PHP_FUNCTION(getservbyport); +PHP_FUNCTION(getprotobyname); +PHP_FUNCTION(getprotobynumber); + +PHP_NAMED_FUNCTION(php_if_crc32); + +PHP_FUNCTION(register_tick_function); +PHP_FUNCTION(unregister_tick_function); +#ifdef HAVE_GETLOADAVG +PHP_FUNCTION(sys_getloadavg); +#endif + +PHP_FUNCTION(is_uploaded_file); +PHP_FUNCTION(move_uploaded_file); + +/* From the INI parser */ +PHP_FUNCTION(parse_ini_file); +PHP_FUNCTION(parse_ini_string); +#if ZEND_DEBUG +PHP_FUNCTION(config_get_hash); +#endif + +PHP_FUNCTION(str_rot13); +PHP_FUNCTION(stream_get_filters); +PHP_FUNCTION(stream_filter_register); +PHP_FUNCTION(stream_bucket_make_writeable); +PHP_FUNCTION(stream_bucket_prepend); +PHP_FUNCTION(stream_bucket_append); +PHP_FUNCTION(stream_bucket_new); +PHP_MINIT_FUNCTION(user_filters); +PHP_RSHUTDOWN_FUNCTION(user_filters); +PHP_RSHUTDOWN_FUNCTION(browscap); + +/* Left for BC (not binary safe!) */ +PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers TSRMLS_DC); +PHPAPI int _php_error_log_ex(int opt_err, char *message, int message_len, char *opt, char *headers TSRMLS_DC); +PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC); + +#if SIZEOF_INT == 4 +/* Most 32-bit and 64-bit systems have 32-bit ints */ +typedef unsigned int php_uint32; +typedef signed int php_int32; +#elif SIZEOF_LONG == 4 +/* 16-bit systems? */ +typedef unsigned long php_uint32; +typedef signed long php_int32; +#else +#error Need type which holds 32 bits +#endif + +#define MT_N (624) + +typedef struct _php_basic_globals { + HashTable *user_shutdown_function_names; + HashTable putenv_ht; + zval *strtok_zval; + char *strtok_string; + char *locale_string; + char *strtok_last; + char strtok_table[256]; + ulong strtok_len; + char str_ebuf[40]; + zend_fcall_info array_walk_fci; + zend_fcall_info_cache array_walk_fci_cache; + zend_fcall_info user_compare_fci; + zend_fcall_info_cache user_compare_fci_cache; + zend_llist *user_tick_functions; + + zval *active_ini_file_section; + + /* pageinfo.c */ + long page_uid; + long page_gid; + long page_inode; + time_t page_mtime; + + /* filestat.c && main/streams/streams.c */ + char *CurrentStatFile, *CurrentLStatFile; + php_stream_statbuf ssb, lssb; + + /* rand.c */ + php_uint32 state[MT_N+1]; /* state vector + 1 extra to not violate ANSI C */ + php_uint32 *next; /* next random value is computed from here */ + int left; /* can *next++ this many times before reloading */ + + unsigned int rand_seed; /* Seed for rand(), in ts version */ + + zend_bool rand_is_seeded; /* Whether rand() has been seeded */ + zend_bool mt_rand_is_seeded; /* Whether mt_rand() has been seeded */ + + /* syslog.c */ + char *syslog_device; + + /* var.c */ + zend_class_entry *incomplete_class; + unsigned serialize_lock; /* whether to use the locally supplied var_hash instead (__sleep/__wakeup) */ + struct { + void *var_hash; + unsigned level; + } serialize; + struct { + void *var_hash; + unsigned level; + } unserialize; + + /* url_scanner_ex.re */ + url_adapt_state_ex_t url_adapt_state_ex; + +#ifdef HAVE_MMAP + void *mmap_file; + size_t mmap_len; +#endif + + HashTable *user_filter_map; + + /* file.c */ +#if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T) + mbstate_t mblen_state; +#endif + + int umask; +} php_basic_globals; + +#ifdef ZTS +#define BG(v) TSRMG(basic_globals_id, php_basic_globals *, v) +PHPAPI extern int basic_globals_id; +#else +#define BG(v) (basic_globals.v) +PHPAPI extern php_basic_globals basic_globals; +#endif + +#if HAVE_PUTENV +typedef struct { + char *putenv_string; + char *previous_value; + char *key; + int key_len; +} putenv_entry; +#endif + +PHPAPI double php_get_nan(void); +PHPAPI double php_get_inf(void); + +typedef struct _php_shutdown_function_entry { + zval **arguments; + int arg_count; +} php_shutdown_function_entry; + +PHPAPI extern zend_bool register_user_shutdown_function(char *function_name, size_t function_len, php_shutdown_function_entry *shutdown_function_entry TSRMLS_DC); +PHPAPI extern zend_bool remove_user_shutdown_function(char *function_name, size_t function_len TSRMLS_DC); +PHPAPI extern zend_bool append_user_shutdown_function(php_shutdown_function_entry shutdown_function_entry TSRMLS_DC); + +#endif /* BASIC_FUNCTIONS_H */ diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c new file mode 100644 index 0000000..1e1252f --- /dev/null +++ b/ext/standard/browscap.c @@ -0,0 +1,545 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Zeev Suraski | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#include "php.h" +#include "php_browscap.h" +#include "php_ini.h" +#include "php_string.h" +#include "ext/pcre/php_pcre.h" + +#include "zend_ini_scanner.h" +#include "zend_globals.h" + +typedef struct { + HashTable *htab; + zval *current_section; + char *current_section_name; + char filename[MAXPATHLEN]; +} browser_data; + +/* browser data defined in startup phase, eagerly loaded in MINIT */ +static browser_data global_bdata = {0}; + +/* browser data defined in activation phase, lazily loaded in get_browser. + * Per request and per thread, if applicable */ +ZEND_BEGIN_MODULE_GLOBALS(browscap) + browser_data activation_bdata; +ZEND_END_MODULE_GLOBALS(browscap) + +ZEND_DECLARE_MODULE_GLOBALS(browscap) + +#ifdef ZTS +#define BROWSCAP_G(v) TSRMG(browscap_globals_id, zend_browscap_globals *, v) +#else +#define BROWSCAP_G(v) (browscap_globals.v) +#endif + +#define DEFAULT_SECTION_NAME "Default Browser Capability Settings" + +/* OBJECTS_FIXME: This whole extension needs going through. The use of objects looks pretty broken here */ + +static void browscap_entry_dtor_request(zval **zvalue) /* {{{ */ +{ + if (Z_TYPE_PP(zvalue) == IS_ARRAY) { + zend_hash_destroy(Z_ARRVAL_PP(zvalue)); + efree(Z_ARRVAL_PP(zvalue)); + } else if (Z_TYPE_PP(zvalue) == IS_STRING) { + if (Z_STRVAL_PP(zvalue)) { + efree(Z_STRVAL_PP(zvalue)); + } + } + efree(*zvalue); +} +/* }}} */ + +static void browscap_entry_dtor_persistent(zval **zvalue) /* {{{ */ { + if (Z_TYPE_PP(zvalue) == IS_ARRAY) { + zend_hash_destroy(Z_ARRVAL_PP(zvalue)); + free(Z_ARRVAL_PP(zvalue)); + } else if (Z_TYPE_PP(zvalue) == IS_STRING) { + if (Z_STRVAL_PP(zvalue)) { + free(Z_STRVAL_PP(zvalue)); + } + } + free(*zvalue); +} +/* }}} */ + +static void convert_browscap_pattern(zval *pattern, int persistent) /* {{{ */ +{ + int i, j=0; + char *t; + + php_strtolower(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern)); + + t = (char *) safe_pemalloc(Z_STRLEN_P(pattern), 2, 5, persistent); + + t[j++] = '\xA7'; /* section sign */ + t[j++] = '^'; + + for (i=0; ihtab->persistent; + + if (!arg1) { + return; + } + + switch (callback_type) { + case ZEND_INI_PARSER_ENTRY: + if (bdata->current_section && arg2) { + zval *new_property; + char *new_key; + + /* parent entry can not be same as current section -> causes infinite loop! */ + if (!strcasecmp(Z_STRVAL_P(arg1), "parent") && + bdata->current_section_name != NULL && + !strcasecmp(bdata->current_section_name, Z_STRVAL_P(arg2)) + ) { + zend_error(E_CORE_ERROR, "Invalid browscap ini file: " + "'Parent' value cannot be same as the section name: %s " + "(in file %s)", bdata->current_section_name, INI_STR("browscap")); + return; + } + + new_property = (zval *) pemalloc(sizeof(zval), persistent); + INIT_PZVAL(new_property); + Z_TYPE_P(new_property) = IS_STRING; + + /* Set proper value for true/false settings */ + if ((Z_STRLEN_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "on", sizeof("on") - 1)) || + (Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "yes", sizeof("yes") - 1)) || + (Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "true", sizeof("true") - 1)) + ) { + Z_STRVAL_P(new_property) = pestrndup("1", 1, persistent); + Z_STRLEN_P(new_property) = 1; + } else if ( + (Z_STRLEN_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "no", sizeof("no") - 1)) || + (Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "off", sizeof("off") - 1)) || + (Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "none", sizeof("none") - 1)) || + (Z_STRLEN_P(arg2) == 5 && !strncasecmp(Z_STRVAL_P(arg2), "false", sizeof("false") - 1)) + ) { + Z_STRVAL_P(new_property) = pestrndup("", 0, persistent); + Z_STRLEN_P(new_property) = 0; + } else { /* Other than true/false setting */ + Z_STRVAL_P(new_property) = pestrndup(Z_STRVAL_P(arg2), + Z_STRLEN_P(arg2), persistent); + Z_STRLEN_P(new_property) = Z_STRLEN_P(arg2); + } + new_key = pestrndup(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), persistent); + zend_str_tolower(new_key, Z_STRLEN_P(arg1)); + zend_hash_update(Z_ARRVAL_P(bdata->current_section), new_key, Z_STRLEN_P(arg1) + 1, &new_property, sizeof(zval *), NULL); + pefree(new_key, persistent); + } + break; + case ZEND_INI_PARSER_SECTION: { + zval *processed; + zval *unprocessed; + HashTable *section_properties; + + /*printf("'%s' (%d)\n",$1.value.str.val,$1.value.str.len + 1);*/ + bdata->current_section = (zval *) pemalloc(sizeof(zval), persistent); + INIT_PZVAL(bdata->current_section); + processed = (zval *) pemalloc(sizeof(zval), persistent); + INIT_PZVAL(processed); + unprocessed = (zval *) pemalloc(sizeof(zval), persistent); + INIT_PZVAL(unprocessed); + + section_properties = (HashTable *) pemalloc(sizeof(HashTable), persistent); + zend_hash_init(section_properties, 0, NULL, + (dtor_func_t) (persistent?browscap_entry_dtor_persistent + :browscap_entry_dtor_request), + persistent); + Z_ARRVAL_P(bdata->current_section) = section_properties; + Z_TYPE_P(bdata->current_section) = IS_ARRAY; + if (bdata->current_section_name) { + pefree(bdata->current_section_name, persistent); + } + bdata->current_section_name = pestrndup(Z_STRVAL_P(arg1), + Z_STRLEN_P(arg1), persistent); + + zend_hash_update(bdata->htab, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, (void *) &bdata->current_section, sizeof(zval *), NULL); + + Z_STRVAL_P(processed) = Z_STRVAL_P(arg1); + Z_STRLEN_P(processed) = Z_STRLEN_P(arg1); + Z_TYPE_P(processed) = IS_STRING; + Z_STRVAL_P(unprocessed) = Z_STRVAL_P(arg1); + Z_STRLEN_P(unprocessed) = Z_STRLEN_P(arg1); + Z_TYPE_P(unprocessed) = IS_STRING; + Z_STRVAL_P(unprocessed) = pestrndup(Z_STRVAL_P(unprocessed), Z_STRLEN_P(unprocessed), persistent); + + convert_browscap_pattern(processed, persistent); + zend_hash_update(section_properties, "browser_name_regex", sizeof("browser_name_regex"), (void *) &processed, sizeof(zval *), NULL); + zend_hash_update(section_properties, "browser_name_pattern", sizeof("browser_name_pattern"), (void *) &unprocessed, sizeof(zval *), NULL); + } + break; + } +} +/* }}} */ + +static int browscap_read_file(char *filename, browser_data *browdata, int persistent TSRMLS_DC) /* {{{ */ +{ + zend_file_handle fh = {0}; + + if (filename == NULL || filename[0] == '\0') { + return FAILURE; + } + + browdata->htab = pemalloc(sizeof *browdata->htab, persistent); + if (browdata->htab == NULL) { + return FAILURE; + } + + if (zend_hash_init_ex(browdata->htab, 0, NULL, + (dtor_func_t) (persistent?browscap_entry_dtor_persistent + :browscap_entry_dtor_request), + persistent, 0) == FAILURE) { + pefree(browdata->htab, persistent); + browdata->htab = NULL; + return FAILURE; + } + + fh.handle.fp = VCWD_FOPEN(filename, "r"); + fh.opened_path = NULL; + fh.free_filename = 0; + if (!fh.handle.fp) { + zend_hash_destroy(browdata->htab); + pefree(browdata->htab, persistent); + browdata->htab = NULL; + zend_error(E_CORE_WARNING, "Cannot open '%s' for reading", filename); + return FAILURE; + } + fh.filename = filename; + Z_TYPE(fh) = ZEND_HANDLE_FP; + browdata->current_section_name = NULL; + zend_parse_ini_file(&fh, 1, ZEND_INI_SCANNER_RAW, + (zend_ini_parser_cb_t) php_browscap_parser_cb, browdata TSRMLS_CC); + if (browdata->current_section_name != NULL) { + pefree(browdata->current_section_name, persistent); + browdata->current_section_name = NULL; + } + + return SUCCESS; +} +/* }}} */ + +#ifdef ZTS +static void browscap_globals_ctor(zend_browscap_globals *browscap_globals TSRMLS_DC) /* {{{ */ +{ + browscap_globals->activation_bdata.htab = NULL; + browscap_globals->activation_bdata.current_section = NULL; + browscap_globals->activation_bdata.current_section_name = NULL; + browscap_globals->activation_bdata.filename[0] = '\0'; +} +/* }}} */ +#endif + +static void browscap_bdata_dtor(browser_data *bdata, int persistent TSRMLS_DC) /* {{{ */ +{ + if (bdata->htab != NULL) { + zend_hash_destroy(bdata->htab); + pefree(bdata->htab, persistent); + bdata->htab = NULL; + } + bdata->filename[0] = '\0'; + /* current_section_* are only used during parsing */ +} +/* }}} */ + +/* {{{ PHP_INI_MH + */ +PHP_INI_MH(OnChangeBrowscap) +{ + if (stage == PHP_INI_STAGE_STARTUP) { + /* value handled in browscap.c's MINIT */ + return SUCCESS; + } else if (stage == PHP_INI_STAGE_ACTIVATE) { + browser_data *bdata = &BROWSCAP_G(activation_bdata); + if (bdata->filename[0] != '\0') { + browscap_bdata_dtor(bdata, 0 TSRMLS_CC); + } + if (VCWD_REALPATH(new_value, bdata->filename) == NULL) { + return FAILURE; + } + return SUCCESS; + } + + return FAILURE; +} +/* }}} */ + +PHP_MINIT_FUNCTION(browscap) /* {{{ */ +{ + char *browscap = INI_STR("browscap"); + +#ifdef ZTS + ts_allocate_id(&browscap_globals_id, sizeof(browser_data), + browscap_globals_ctor, NULL); +#endif + /* ctor call not really needed for non-ZTS */ + + if (browscap && browscap[0]) { + if (browscap_read_file(browscap, &global_bdata, 1 TSRMLS_CC) == FAILURE) { + return FAILURE; + } + } + + return SUCCESS; +} +/* }}} */ + +PHP_RSHUTDOWN_FUNCTION(browscap) /* {{{ */ +{ + browser_data *bdata = &BROWSCAP_G(activation_bdata); + if (bdata->filename[0] != '\0') { + browscap_bdata_dtor(bdata, 0 TSRMLS_CC); + } + + return SUCCESS; +} +/* }}} */ + +PHP_MSHUTDOWN_FUNCTION(browscap) /* {{{ */ +{ + browscap_bdata_dtor(&global_bdata, 1 TSRMLS_CC); + + return SUCCESS; +} +/* }}} */ + +static int browser_reg_compare(zval **browser TSRMLS_DC, int num_args, va_list args, zend_hash_key *key) /* {{{ */ +{ + zval **browser_regex, **previous_match; + pcre *re; + int re_options; + pcre_extra *re_extra; + char *lookup_browser_name = va_arg(args, char *); + int lookup_browser_length = va_arg(args, int); + zval **found_browser_entry = va_arg(args, zval **); + + /* See if we have an exact match, if so, we're done... */ + if (*found_browser_entry) { + if (zend_hash_find(Z_ARRVAL_PP(found_browser_entry), "browser_name_pattern", sizeof("browser_name_pattern"), (void**) &previous_match) == FAILURE) { + return 0; + } + else if (!strcasecmp(Z_STRVAL_PP(previous_match), lookup_browser_name)) { + return 0; + } + } + + if (zend_hash_find(Z_ARRVAL_PP(browser), "browser_name_regex", sizeof("browser_name_regex"), (void **) &browser_regex) == FAILURE) { + return 0; + } + + re = pcre_get_compiled_regex(Z_STRVAL_PP(browser_regex), &re_extra, &re_options TSRMLS_CC); + if (re == NULL) { + return 0; + } + + if (pcre_exec(re, re_extra, lookup_browser_name, lookup_browser_length, 0, re_options, NULL, 0) == 0) { + /* If we've found a possible browser, we need to do a comparison of the + number of characters changed in the user agent being checked versus + the previous match found and the current match. */ + if (*found_browser_entry) { + int i, prev_len = 0, curr_len = 0, ua_len; + zval **current_match; + + if (zend_hash_find(Z_ARRVAL_PP(browser), "browser_name_pattern", sizeof("browser_name_pattern"), (void**) ¤t_match) == FAILURE) { + return 0; + } + + ua_len = lookup_browser_length; + + for (i = 0; i < Z_STRLEN_PP(previous_match); i++) { + switch (Z_STRVAL_PP(previous_match)[i]) { + case '?': + case '*': + /* do nothing, ignore these characters in the count */ + break; + + default: + ++prev_len; + } + } + + for (i = 0; i < Z_STRLEN_PP(current_match); i++) { + switch (Z_STRVAL_PP(current_match)[i]) { + case '?': + case '*': + /* do nothing, ignore these characters in the count */ + break; + + default: + ++curr_len; + } + } + + /* Pick which browser pattern replaces the least amount of + characters when compared to the original user agent string... */ + if (ua_len - prev_len > ua_len - curr_len) { + *found_browser_entry = *browser; + } + } + else { + *found_browser_entry = *browser; + } + } + + return 0; +} +/* }}} */ + +/* {{{ proto mixed get_browser([string browser_name [, bool return_array]]) + Get information about the capabilities of a browser. If browser_name is omitted or null, HTTP_USER_AGENT is used. Returns an object by default; if return_array is true, returns an array. */ +PHP_FUNCTION(get_browser) +{ + char *agent_name = NULL; + int agent_name_len = 0; + zend_bool return_array = 0; + zval **agent, **z_agent_name, **http_user_agent; + zval *found_browser_entry, *tmp_copy; + char *lookup_browser_name; + browser_data *bdata; + + if (BROWSCAP_G(activation_bdata).filename[0] != '\0') { + bdata = &BROWSCAP_G(activation_bdata); + if (bdata->htab == NULL) { /* not initialized yet */ + if (browscap_read_file(bdata->filename, bdata, 0 TSRMLS_CC) == FAILURE) { + RETURN_FALSE; + } + } + } else { + if (!global_bdata.htab) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "browscap ini directive not set"); + RETURN_FALSE; + } + bdata = &global_bdata; + } + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!b", &agent_name, &agent_name_len, &return_array) == FAILURE) { + return; + } + + if (agent_name == NULL) { + zend_is_auto_global("_SERVER", sizeof("_SERVER") - 1 TSRMLS_CC); + if (!PG(http_globals)[TRACK_VARS_SERVER] || + zend_hash_find(HASH_OF(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT"), (void **) &http_user_agent) == FAILURE + ) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "HTTP_USER_AGENT variable is not set, cannot determine user agent name"); + RETURN_FALSE; + } + agent_name = Z_STRVAL_PP(http_user_agent); + agent_name_len = Z_STRLEN_PP(http_user_agent); + } + + lookup_browser_name = estrndup(agent_name, agent_name_len); + php_strtolower(lookup_browser_name, agent_name_len); + + if (zend_hash_find(bdata->htab, lookup_browser_name, agent_name_len + 1, (void **) &agent) == FAILURE) { + found_browser_entry = NULL; + zend_hash_apply_with_arguments(bdata->htab TSRMLS_CC, (apply_func_args_t) browser_reg_compare, 3, lookup_browser_name, agent_name_len, &found_browser_entry); + + if (found_browser_entry) { + agent = &found_browser_entry; + } else if (zend_hash_find(bdata->htab, DEFAULT_SECTION_NAME, sizeof(DEFAULT_SECTION_NAME), (void **) &agent) == FAILURE) { + efree(lookup_browser_name); + RETURN_FALSE; + } + } + + if (return_array) { + array_init(return_value); + zend_hash_copy(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *)); + } + else { + object_init(return_value); + zend_hash_copy(Z_OBJPROP_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *)); + } + + while (zend_hash_find(Z_ARRVAL_PP(agent), "parent", sizeof("parent"), (void **) &z_agent_name) == SUCCESS) { + if (zend_hash_find(bdata->htab, Z_STRVAL_PP(z_agent_name), Z_STRLEN_PP(z_agent_name) + 1, (void **)&agent) == FAILURE) { + break; + } + + if (return_array) { + zend_hash_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *), 0); + } + else { + zend_hash_merge(Z_OBJPROP_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *), 0); + } + } + + efree(lookup_browser_name); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 new file mode 100644 index 0000000..c33ae1e --- /dev/null +++ b/ext/standard/config.m4 @@ -0,0 +1,586 @@ +dnl $Id$ -*- autoconf -*- + +dnl +dnl Check if flush should be called explicitly after buffered io +dnl +AC_CACHE_CHECK([whether flush should be called explicitly after a buffered io], ac_cv_flush_io,[ +AC_TRY_RUN( [ +#include +#include + +int main(int argc, char **argv) +{ + char *filename = tmpnam(NULL); + char buffer[64]; + int result = 0; + + FILE *fp = fopen(filename, "wb"); + if (NULL == fp) + return 0; + fputs("line 1\n", fp); + fputs("line 2\n", fp); + fclose(fp); + + fp = fopen(filename, "rb+"); + if (NULL == fp) + return 0; + fgets(buffer, sizeof(buffer), fp); + fputs("line 3\n", fp); + rewind(fp); + fgets(buffer, sizeof(buffer), fp); + if (0 != strcmp(buffer, "line 1\n")) + result = 1; + fgets(buffer, sizeof(buffer), fp); + if (0 != strcmp(buffer, "line 3\n")) + result = 1; + fclose(fp); + unlink(filename); + + exit(result); +} +],[ + ac_cv_flush_io=no +],[ + ac_cv_flush_io=yes +],[ + ac_cv_flush_io=no +])]) +if test "$ac_cv_flush_io" = "yes"; then + AC_DEFINE(HAVE_FLUSHIO, 1, [Define if flush should be called explicitly after a buffered io.]) +fi + +dnl +dnl Check for crypt() capabilities +dnl +if test "$ac_cv_func_crypt" = "no"; then + AC_CHECK_LIB(crypt, crypt, [ + LIBS="-lcrypt $LIBS -lcrypt" + AC_DEFINE(HAVE_CRYPT, 1, [ ]) + ]) +fi + +AC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[ + AC_TRY_RUN([ +#if HAVE_UNISTD_H +#include +#endif + +#if HAVE_CRYPT_H +#include +#endif + +main() { +#if HAVE_CRYPT + exit (strcmp((char *)crypt("rasmuslerdorf","rl"),"rl.3StKT.4T8M")); +#else + exit(0); +#endif +}],[ + ac_cv_crypt_des=yes +],[ + ac_cv_crypt_des=no +],[ + ac_cv_crypt_des=yes +])]) + +AC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[ + AC_TRY_RUN([ +#if HAVE_UNISTD_H +#include +#endif + +#if HAVE_CRYPT_H +#include +#endif + +main() { +#if HAVE_CRYPT + exit (strcmp((char *)crypt("rasmuslerdorf","_J9..rasm"),"_J9..rasmBYk8r9AiWNc")); +#else + exit(0); +#endif +}],[ + ac_cv_crypt_ext_des=yes +],[ + ac_cv_crypt_ext_des=no +],[ + ac_cv_crypt_ext_des=no +])]) + +AC_CACHE_CHECK(for MD5 crypt, ac_cv_crypt_md5,[ +AC_TRY_RUN([ +#if HAVE_UNISTD_H +#include +#endif + +#if HAVE_CRYPT_H +#include +#endif + +main() { +#if HAVE_CRYPT + char salt[15], answer[40]; + + salt[0]='$'; salt[1]='1'; salt[2]='$'; + salt[3]='r'; salt[4]='a'; salt[5]='s'; + salt[6]='m'; salt[7]='u'; salt[8]='s'; + salt[9]='l'; salt[10]='e'; salt[11]='$'; + salt[12]='\0'; + strcpy(answer,salt); + strcat(answer,"rISCgZzpwk3UhDidwXvin0"); + exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer)); +#else + exit(0); +#endif +}],[ + ac_cv_crypt_md5=yes +],[ + ac_cv_crypt_md5=no +],[ + ac_cv_crypt_md5=no +])]) + +AC_CACHE_CHECK(for Blowfish crypt, ac_cv_crypt_blowfish,[ +AC_TRY_RUN([ +#if HAVE_UNISTD_H +#include +#endif + +#if HAVE_CRYPT_H +#include +#endif + +main() { +#if HAVE_CRYPT + char salt[30], answer[70]; + + salt[0]='$'; salt[1]='2'; salt[2]='a'; salt[3]='$'; salt[4]='0'; salt[5]='7'; salt[6]='$'; salt[7]='\0'; + strcat(salt,"rasmuslerd............"); + strcpy(answer,salt); + strcpy(&answer[29],"nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra"); + exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer)); +#else + exit(0); +#endif +}],[ + ac_cv_crypt_blowfish=yes +],[ + ac_cv_crypt_blowfish=no +],[ + ac_cv_crypt_blowfish=no +])]) + +AC_CACHE_CHECK(for SHA512 crypt, ac_cv_crypt_SHA512,[ +AC_TRY_RUN([ +#if HAVE_UNISTD_H +#include +#endif + +#if HAVE_CRYPT_H +#include +#endif + +main() { +#if HAVE_CRYPT + char salt[30], answer[80]; + + salt[0]='$'; salt[1]='6'; salt[2]='$'; salt[3]='$'; salt[4]='b'; salt[5]='a'; salt[6]='r'; salt[7]='\0'; + strcpy(answer, salt); + strcpy(&answer[29],"$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu."); + exit (strcmp((char *)crypt("foo",salt),answer)); +#else + exit(0); +#endif +}],[ + ac_cv_crypt_SHA512=yes +],[ + ac_cv_crypt_SHA512=no +],[ + ac_cv_crypt_SHA512=no +])]) + +AC_CACHE_CHECK(for SHA256 crypt, ac_cv_crypt_SHA256,[ +AC_TRY_RUN([ +#if HAVE_UNISTD_H +#include +#endif + +#if HAVE_CRYPT_H +#include +#endif + +main() { +#if HAVE_CRYPT + char salt[30], answer[80]; + salt[0]='$'; salt[1]='5'; salt[2]='$'; salt[3]='$'; salt[4]='s'; salt[5]='a'; salt[6]='l'; salt[7]='t'; salt[8]='s'; salt[9]='t'; salt[10]='r'; salt[11]='i'; salt[12]='n'; salt[13]='g'; salt[14]='\0'; + strcat(salt,""); + strcpy(answer, salt); + strcpy(&answer[29], "$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5"); + exit (strcmp((char *)crypt("foo",salt),answer)); +#else + exit(0); +#endif +}],[ + ac_cv_crypt_SHA256=yes +],[ + ac_cv_crypt_SHA256=no +],[ + ac_cv_crypt_SHA256=no +])]) + + +dnl +dnl If one of them is missing, use our own implementation, portable code is then possible +dnl +if test "$ac_cv_crypt_blowfish" = "no" || test "$ac_cv_crypt_des" = "no" || test "$ac_cv_crypt_ext_des" = "no" || test "x$php_crypt_r" = "x0"; then + + dnl + dnl Check for __alignof__ support in the compiler + dnl + AC_CACHE_CHECK(whether the compiler supports __alignof__, ac_cv_alignof_exists,[ + AC_TRY_COMPILE([ + ],[ + int align = __alignof__(int); + ],[ + ac_cv_alignof_exists=yes + ],[ + ac_cv_alignof_exists=no + ])]) + if test "$ac_cv_alignof_exists" = "yes"; then + AC_DEFINE([HAVE_ALIGNOF], 1, [whether the compiler supports __alignof__]) + fi + + dnl + dnl Check for __attribute__ ((__aligned__)) support in the compiler + dnl + AC_CACHE_CHECK(whether the compiler supports aligned attribute, ac_cv_attribute_aligned,[ + AC_TRY_COMPILE([ + ],[ + unsigned char test[32] __attribute__ ((__aligned__ (__alignof__ (int)))); + ],[ + ac_cv_attribute_aligned=yes + ],[ + ac_cv_attribute_aligned=no + ])]) + if test "$ac_cv_attribute_aligned" = "yes"; then + AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], 1, [whether the compiler supports __attribute__ ((__aligned__))]) + fi + + + AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 1, [Whether PHP has to use its own crypt_r for blowfish, des, ext des and md5]) + AC_DEFINE_UNQUOTED(PHP_STD_DES_CRYPT, 1, [Whether the system supports standard DES salt]) + AC_DEFINE_UNQUOTED(PHP_BLOWFISH_CRYPT, 1, [Whether the system supports BlowFish salt]) + AC_DEFINE_UNQUOTED(PHP_EXT_DES_CRYPT, 1, [Whether the system supports extended DES salt]) + AC_DEFINE_UNQUOTED(PHP_MD5_CRYPT, 1, [Whether the system supports MD5 salt]) + AC_DEFINE_UNQUOTED(PHP_SHA512_CRYPT, 1, [Whether the system supports SHA512 salt]) + AC_DEFINE_UNQUOTED(PHP_SHA256_CRYPT, 1, [Whether the system supports SHA256 salt]) + + PHP_ADD_SOURCES(PHP_EXT_DIR(standard), crypt_freesec.c crypt_blowfish.c crypt_sha512.c crypt_sha256.c php_crypt_r.c) +else + if test "$ac_cv_crypt_des" = "yes"; then + ac_result=1 + ac_crypt_des=1 + else + ac_result=0 + ac_crypt_des=0 + fi + AC_DEFINE_UNQUOTED(PHP_STD_DES_CRYPT, $ac_result, [Whether the system supports standard DES salt]) + + if test "$ac_cv_crypt_blowfish" = "yes"; then + ac_result=1 + ac_crypt_blowfish=1 + else + ac_result=0 + ac_crypt_blowfish=0 + fi + AC_DEFINE_UNQUOTED(PHP_BLOWFISH_CRYPT, $ac_result, [Whether the system supports BlowFish salt]) + + if test "$ac_cv_crypt_ext_des" = "yes"; then + ac_result=1 + ac_crypt_edes=1 + else + ac_result=0 + ac_crypt_edes=0 + fi + AC_DEFINE_UNQUOTED(PHP_EXT_DES_CRYPT, $ac_result, [Whether the system supports extended DES salt]) + + if test "$ac_cv_crypt_md5" = "yes"; then + ac_result=1 + ac_crypt_md5=1 + else + ac_result=0 + ac_crypt_md5=0 + fi + AC_DEFINE_UNQUOTED(PHP_MD5_CRYPT, $ac_result, [Whether the system supports MD5 salt]) + + if test "$ac_cv_crypt_sha512" = "yes"; then + ac_result=1 + ac_crypt_sha512=1 + else + ac_result=0 + ac_crypt_sha512=0 + fi + AC_DEFINE_UNQUOTED(PHP_SHA512_CRYPT, $ac_result, [Whether the system supports SHA512 salt]) + + if test "$ac_cv_crypt_sha256" = "yes"; then + ac_result=1 + ac_crypt_sha256=1 + else + ac_result=0 + ac_crypt_sha256=0 + fi + AC_DEFINE_UNQUOTED(PHP_SHA256_CRYPT, $ac_result, [Whether the system supports SHA256 salt]) + + AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 0, [Whether PHP has to use its own crypt_r for blowfish, des and ext des]) +fi + +dnl +dnl Check for available functions +dnl +AC_CHECK_FUNCS(getcwd getwd asinh acosh atanh log1p hypot glob strfmon nice fpclass isinf isnan mempcpy strpncpy) +AC_FUNC_FNMATCH + +dnl +dnl Check if there is a support means of creating a new process +dnl and defining which handles it receives +dnl +AC_CHECK_FUNCS(fork CreateProcess, [ + php_can_support_proc_open=yes + break +],[ + php_can_support_proc_open=no +]) +AC_MSG_CHECKING([if your OS can spawn processes with inherited handles]) +if test "$php_can_support_proc_open" = "yes"; then + AC_MSG_RESULT(yes) + AC_DEFINE(PHP_CAN_SUPPORT_PROC_OPEN,1, [Define if your system has fork/vfork/CreateProcess]) +else + AC_MSG_RESULT(no) +fi + +if test "$PHP_SAPI" = "cgi" || test "$PHP_SAPI" = "cli" || test "$PHP_SAPI" = "embed"; then + AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function]) +fi + +dnl +dnl Detect library functions needed by php dns_xxx functions +dnl ext/standard/php_dns.h will collect these in a single define: HAVE_FULL_DNS_FUNCS +dnl +PHP_CHECK_FUNC(res_nsearch, resolv, bind, socket) +PHP_CHECK_FUNC(dns_search, resolv, bind, socket) +PHP_CHECK_FUNC(dn_expand, resolv, bind, socket) +PHP_CHECK_FUNC(dn_skipname, resolv, bind, socket) + +dnl +dnl These are old deprecated functions +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 +#include + +#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 +#include + +#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 +#include + +#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 +#include + +#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,[ +AC_TRY_COMPILE([ +#include +],[ +#ifndef HAVE_STRPTIME +#error no strptime() on this platform +#else +/* use invalid strptime() declaration to see if it fails to compile */ +int strptime(const char *s, const char *format, struct tm *tm); +#endif +],[ + ac_cv_strptime_decl_fails=no +],[ + ac_cv_strptime_decl_fails=yes +])]) +if test "$ac_cv_strptime_decl_fails" = "yes"; then + AC_DEFINE([HAVE_STRPTIME_DECL_FAILS], 1, [whether strptime() declaration fails]) +fi + +dnl +dnl Check for i18n capabilities +dnl +AC_CHECK_HEADERS([wchar.h]) +AC_CHECK_FUNCS([mblen]) +AC_CHECK_FUNCS([mbrlen mbsinit],,,[ +#ifdef HAVE_WCHAR_H +# include +#endif +]) +AC_CACHE_CHECK([for mbstate_t], [ac_cv_type_mbstate_t],[ +AC_TRY_COMPILE([ +#ifdef HAVE_WCHAR_H +# include +#endif +],[ +int __tmp__() { mbstate_t a; } +],[ + ac_cv_type_mbstate_t=yes +],[ + ac_cv_type_mbstate_t=no +])]) +if test "$ac_cv_type_mbstate_t" = "yes"; then + AC_DEFINE([HAVE_MBSTATE_T], 1, [Define if your system has mbstate_t in wchar.h]) +fi + +dnl +dnl Check for atomic operation API availability in Solaris +dnl +AC_CHECK_HEADERS([atomic.h]) + +dnl +dnl Setup extension sources +dnl +PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.c crypt.c \ + cyr_convert.c datetime.c dir.c dl.c dns.c exec.c file.c filestat.c \ + flock_compat.c formatted_print.c fsock.c head.c html.c image.c \ + info.c iptc.c lcg.c link.c mail.c math.c md5.c metaphone.c \ + microtime.c pack.c pageinfo.c quot_print.c rand.c \ + soundex.c string.c scanf.c syslog.c type.c uniqid.c url.c \ + var.c versioning.c assert.c strnatcmp.c levenshtein.c \ + incomplete_class.c url_scanner_ex.c ftp_fopen_wrapper.c \ + http_fopen_wrapper.c php_fopen_wrapper.c credits.c css.c \ + var_unserializer.c ftok.c sha1.c user_filters.c uuencode.c \ + filters.c proc_open.c streamsfuncs.c http.c) + +PHP_ADD_MAKEFILE_FRAGMENT +PHP_INSTALL_HEADERS([ext/standard/]) diff --git a/ext/standard/config.w32 b/ext/standard/config.w32 new file mode 100644 index 0000000..d14b859 --- /dev/null +++ b/ext/standard/config.w32 @@ -0,0 +1,28 @@ +// vim:ft=javascript +// $Id$ + +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); +AC_DEFINE("PHP_USE_PHP_CRYPT_R", 1); + +CHECK_HEADER_ADD_INCLUDE("timelib_config.h", "CFLAGS_STANDARD", "ext/date/lib"); + +EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \ + crc32.c crypt.c crypt_freesec.c crypt_blowfish.c crypt_sha256.c \ + crypt_sha512.c php_crypt_r.c \ + cyr_convert.c datetime.c dir.c dl.c dns.c dns_win32.c exec.c \ + file.c filestat.c formatted_print.c fsock.c head.c html.c image.c \ + info.c iptc.c lcg.c link_win32.c mail.c math.c md5.c metaphone.c microtime.c \ + pack.c pageinfo.c quot_print.c rand.c soundex.c \ + string.c scanf.c syslog.c type.c uniqid.c url.c var.c \ + versioning.c assert.c strnatcmp.c levenshtein.c incomplete_class.c \ + url_scanner_ex.c ftp_fopen_wrapper.c http_fopen_wrapper.c \ + php_fopen_wrapper.c credits.c css.c var_unserializer.c ftok.c sha1.c \ + user_filters.c uuencode.c filters.c proc_open.c \ + streamsfuncs.c http.c flock_compat.c", false /* never shared */); + PHP_INSTALL_HEADERS("", "ext/standard"); +if (PHP_MBREGEX != "no") { + CHECK_HEADER_ADD_INCLUDE("oniguruma.h", "CFLAGS_STANDARD", PHP_MBREGEX + ";ext\\mbstring\\oniguruma") +} +PHP_INSTALL_HEADERS("", "ext/standard"); diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c new file mode 100644 index 0000000..e9c36d4 --- /dev/null +++ b/ext/standard/crc32.c @@ -0,0 +1,53 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Rasmus Lerdorf | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "basic_functions.h" +#include "crc32.h" + +/* {{{ proto string crc32(string str) + Calculate the crc32 polynomial of a string */ +PHP_NAMED_FUNCTION(php_if_crc32) +{ + char *p; + int len, nr; + php_uint32 crcinit = 0; + register php_uint32 crc; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &p, &nr) == FAILURE) { + return; + } + crc = crcinit^0xFFFFFFFF; + + for (len =+nr; nr--; ++p) { + crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32tab[(crc ^ (*p)) & 0xFF ]; + } + RETVAL_LONG(crc^0xFFFFFFFF); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/crc32.h b/ext/standard/crc32.h new file mode 100644 index 0000000..2c8ded4 --- /dev/null +++ b/ext/standard/crc32.h @@ -0,0 +1,109 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Rasmus Lerdorf | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +/* + * This code implements the AUTODIN II polynomial + * The variable corresponding to the macro argument "crc" should + * be an unsigned long. + * Oroginal code by Spencer Garrett + */ + +#define CRC32(crc, ch) (crc = (crc >> 8) ^ crc32tab[(crc ^ (ch)) & 0xff]) + +/* generated using the AUTODIN II polynomial + * x^32 + x^26 + x^23 + x^22 + x^16 + + * x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1 + */ + +static const unsigned int crc32tab[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, + 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, + 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, + 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, + 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, + 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, + 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, + 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, + 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, + 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, + 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, + 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, + 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, + 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, + 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, + 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, + 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, + 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, +}; + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/credits.c b/ext/standard/credits.c new file mode 100644 index 0000000..7ce0819 --- /dev/null +++ b/ext/standard/credits.c @@ -0,0 +1,140 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Zeev Suraski | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "info.h" +#include "SAPI.h" + +#define CREDIT_LINE(module, authors) php_info_print_table_row(2, module, authors) + +PHPAPI void php_print_credits(int flag TSRMLS_DC) /* {{{ */ +{ + if (!sapi_module.phpinfo_as_text && flag & PHP_CREDITS_FULLPAGE) { + php_print_info_htmlhead(TSRMLS_C); + } + + if (!sapi_module.phpinfo_as_text) { + PUTS("

PHP Credits

\n"); + } else { + PUTS("PHP Credits\n"); + } + + if (flag & PHP_CREDITS_GROUP) { + /* Group */ + + php_info_print_table_start(); + php_info_print_table_header(1, "PHP Group"); + php_info_print_table_row(1, "Thies C. Arntzen, Stig Bakken, Shane Caraveo, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski"); + php_info_print_table_end(); + } + + if (flag & PHP_CREDITS_GENERAL) { + /* Design & Concept */ + php_info_print_table_start(); + if (!sapi_module.phpinfo_as_text) { + php_info_print_table_header(1, "Language Design & Concept"); + } else { + php_info_print_table_header(1, "Language Design & Concept"); + } + php_info_print_table_row(1, "Andi Gutmans, Rasmus Lerdorf, Zeev Suraski, Marcus Boerger"); + php_info_print_table_end(); + + /* PHP Language */ + php_info_print_table_start(); + php_info_print_table_colspan_header(2, "PHP Authors"); + php_info_print_table_header(2, "Contribution", "Authors"); + CREDIT_LINE("Zend Scripting Language Engine", "Andi Gutmans, Zeev Suraski, Stanislav Malyshev, Marcus Boerger, Dmitry Stogov"); + CREDIT_LINE("Extension Module API", "Andi Gutmans, Zeev Suraski, Andrei Zmievski"); + CREDIT_LINE("UNIX Build and Modularization", "Stig Bakken, Sascha Schumann, Jani Taskinen"); + CREDIT_LINE("Windows Port", "Shane Caraveo, Zeev Suraski, Wez Furlong, Pierre-Alain Joye"); + CREDIT_LINE("Server API (SAPI) Abstraction Layer", "Andi Gutmans, Shane Caraveo, Zeev Suraski"); + CREDIT_LINE("Streams Abstraction Layer", "Wez Furlong, Sara Golemon"); + CREDIT_LINE("PHP Data Objects Layer", "Wez Furlong, Marcus Boerger, Sterling Hughes, George Schlossnagle, Ilia Alshanetsky"); + CREDIT_LINE("Output Handler", "Zeev Suraski, Thies C. Arntzen, Marcus Boerger, Michael Wallner"); + php_info_print_table_end(); + } + + if (flag & PHP_CREDITS_SAPI) { + /* SAPI Modules */ + + php_info_print_table_start(); + php_info_print_table_colspan_header(2, "SAPI Modules"); + php_info_print_table_header(2, "Contribution", "Authors"); +#include "credits_sapi.h" + php_info_print_table_end(); + } + + if (flag & PHP_CREDITS_MODULES) { + /* Modules */ + + php_info_print_table_start(); + php_info_print_table_colspan_header(2, "Module Authors"); + php_info_print_table_header(2, "Module", "Authors"); +#include "credits_ext.h" + php_info_print_table_end(); + } + + if (flag & PHP_CREDITS_DOCS) { + php_info_print_table_start(); + php_info_print_table_colspan_header(2, "PHP Documentation"); + CREDIT_LINE("Authors", "Mehdi Achour, Friedhelm Betz, Antony Dovgal, Nuno Lopes, Hannes Magnusson, Georg Richter, Damien Seguy, Jakub Vrana"); + CREDIT_LINE("Editor", "Philip Olson"); + CREDIT_LINE("User Note Maintainers", "Daniel P. Brown, Thiago Henrique Pojda"); + CREDIT_LINE("Other Contributors", "Previously active authors, editors and other contributors are listed in the manual."); + php_info_print_table_end(); + } + + if (flag & PHP_CREDITS_QA) { + php_info_print_table_start(); + php_info_print_table_header(1, "PHP Quality Assurance Team"); + php_info_print_table_row(1, "Ilia Alshanetsky, Joerg Behrens, Antony Dovgal, Stefan Esser, Moriyoshi Koizumi, Magnus Maatta, Sebastian Nohn, Derick Rethans, Melvyn Sopacua, Jani Taskinen, Pierre-Alain Joye, Dmitry Stogov, Felipe Pena"); + php_info_print_table_end(); + } + + if (flag & PHP_CREDITS_WEB) { + /* Websites and infrastructure */ + + php_info_print_table_start(); + php_info_print_table_colspan_header(2, "Websites and Infrastructure team"); + /* www., wiki., windows., master., and others, I guess pecl. too? */ + CREDIT_LINE("PHP Websites Team", "Rasmus Lerdorf, Hannes Magnusson, Philip Olson, Lukas Kahwe Smith, Pierre-Alain Joye, Kalle Sommer Nielsen"); + CREDIT_LINE("Event Maintainers", "Damien Seguy, Daniel P. Brown"); + /* Mirroring */ + CREDIT_LINE("Network Infrastructure", "Daniel P. Brown"); + /* Windows build boxes and such things */ + CREDIT_LINE("Windows Infrastructure", "Alex Schoenmaker"); + php_info_print_table_end(); + } + + if (!sapi_module.phpinfo_as_text && flag & PHP_CREDITS_FULLPAGE) { + PUTS("\n"); + } +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/credits.h b/ext/standard/credits.h new file mode 100644 index 0000000..7ad99d9 --- /dev/null +++ b/ext/standard/credits.h @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Zeev Suraski | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef CREDITS_H +#define CREDITS_H + +#ifndef HAVE_CREDITS_DEFS +#define HAVE_CREDITS_DEFS + +#define PHP_CREDITS_GROUP (1<<0) +#define PHP_CREDITS_GENERAL (1<<1) +#define PHP_CREDITS_SAPI (1<<2) +#define PHP_CREDITS_MODULES (1<<3) +#define PHP_CREDITS_DOCS (1<<4) +#define PHP_CREDITS_FULLPAGE (1<<5) +#define PHP_CREDITS_QA (1<<6) +#define PHP_CREDITS_WEB (1<<7) +#define PHP_CREDITS_ALL 0xFFFFFFFF + +#endif /* HAVE_CREDITS_DEFS */ + +PHPAPI void php_print_credits(int flag TSRMLS_DC); + +#endif diff --git a/ext/standard/credits_ext.h b/ext/standard/credits_ext.h new file mode 100644 index 0000000..7bdb41e --- /dev/null +++ b/ext/standard/credits_ext.h @@ -0,0 +1,86 @@ +/* + DO NOT EDIT THIS FILE! + + it has been automaticaly created by php5/scripts/credits from + the information found in the various php5/ext/.../CREDITS and + php5/sapi/.../CREDITS files + + if you want to change an entry you have to edit the appropriate + CREDITS file instead + +*/ + +CREDIT_LINE("BC Math", "Andi Gutmans"); +CREDIT_LINE("Bzip2", "Sterling Hughes"); +CREDIT_LINE("Calendar", "Shane Caraveo, Colin Viebrock, Hartmut Holzgraefe, Wez Furlong"); +CREDIT_LINE("COM and .Net", "Wez Furlong"); +CREDIT_LINE("ctype", "Hartmut Holzgraefe"); +CREDIT_LINE("cURL", "Sterling Hughes"); +CREDIT_LINE("Date/Time Support", "Derick Rethans"); +CREDIT_LINE("DB-LIB (MS SQL, Sybase)", "Wez Furlong, Frank M. Kromann"); +CREDIT_LINE("DBA", "Sascha Schumann, Marcus Boerger"); +CREDIT_LINE("DOM", "Christian Stocker, Rob Richards, Marcus Boerger"); +CREDIT_LINE("enchant", "Pierre-Alain Joye, Ilia Alshanetsky"); +CREDIT_LINE("ereg", "Rasmus Lerdorf, Jim Winstead, Jaakko HyvÀtti"); +CREDIT_LINE("EXIF", "Rasmus Lerdorf, Marcus Boerger"); +CREDIT_LINE("fileinfo", "Ilia Alshanetsky, Pierre Alain Joye, Scott MacVicar, Derick Rethans"); +CREDIT_LINE("Firebird/InterBase driver for PDO", "Ard Biesheuvel"); +CREDIT_LINE("FTP", "Stefan Esser, Andrew Skalski"); +CREDIT_LINE("GD imaging", "Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto, Ilia Alshanetsky, Pierre-Alain Joye, Marcus Boerger"); +CREDIT_LINE("GetText", "Alex Plotnick"); +CREDIT_LINE("GNU GMP support", "Stanislav Malyshev"); +CREDIT_LINE("Iconv", "Rui Hirokawa, Stig Bakken, Moriyoshi Koizumi "); +CREDIT_LINE("IMAP", "Rex Logan, Mark Musone, Brian Wang, Kaj-Michael Lang, Antoni Pamies Olive, Rasmus Lerdorf, Andrew Skalski, Chuck Hagenbuch, Daniel R Kalowsky"); +CREDIT_LINE("Input Filter", "Rasmus Lerdorf, Derick Rethans, Pierre-Alain Joye, Ilia Alshanetsky"); +CREDIT_LINE("InterBase", "Jouni Ahto, Andrew Avdeev, Ard Biesheuvel"); +CREDIT_LINE("Internationalization", "Ed Batutis, Vladimir Iordanov, Dmitry Lakhtyuk, Stanislav Malyshev, Vadim Savchuk, Kirti Velankar"); +CREDIT_LINE("JSON", "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("MS SQL", "Frank M. Kromann"); +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("MySQL", "Zeev Suraski, Zak Greant, Georg Richter"); +CREDIT_LINE("MySQLi", "Zak Greant, Georg Richter, Andrey Hristov, Ulf Wendel"); +CREDIT_LINE("MySQLnd", "Andrey Hristov, Ulf Wendel, Georg Richter"); +CREDIT_LINE("OCI8", "Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson, Maxim Maletsky, Harald Radi, Antony Dovgal, Andi Gutmans, Wez Furlong, Christopher Jones, Oracle Corporation"); +CREDIT_LINE("ODBC driver for PDO", "Wez Furlong"); +CREDIT_LINE("ODBC", "Stig Bakken, Andreas Karajannis, Frank M. Kromann, Daniel R. Kalowsky"); +CREDIT_LINE("OpenSSL", "Stig Venaas, Wez Furlong, Sascha Kettler"); +CREDIT_LINE("Oracle (OCI) driver for PDO", "Wez Furlong"); +CREDIT_LINE("pcntl", "Jason Greene, Arnaud Le Blanc"); +CREDIT_LINE("Perl Compatible Regexps", "Andrei Zmievski"); +CREDIT_LINE("PHP Archive", "Gregory Beaver, Marcus Boerger"); +CREDIT_LINE("PHP Data Objects", "Wez Furlong, Marcus Boerger, Sterling Hughes, George Schlossnagle, Ilia Alshanetsky"); +CREDIT_LINE("PHP hash", "Sara Golemon, Rasmus Lerdorf, Stefan Esser, Michael Wallner, Scott MacVicar"); +CREDIT_LINE("Posix", "Kristian Koehntopp"); +CREDIT_LINE("PostgreSQL driver for PDO", "Edin Kadribasic, Ilia Alshanetsky"); +CREDIT_LINE("PostgreSQL", "Jouni Ahto, Zeev Suraski, Yasuo Ohgaki, Chris Kings-Lynne"); +CREDIT_LINE("Pspell", "Vlad Krupin"); +CREDIT_LINE("Readline", "Thies C. Arntzen"); +CREDIT_LINE("Recode", "Kristian Koehntopp"); +CREDIT_LINE("Reflection", "Marcus Boerger, Timm Friebe, George Schlossnagle, Andrei Zmievski, Johannes Schlueter"); +CREDIT_LINE("Sessions", "Sascha Schumann, Andrei Zmievski"); +CREDIT_LINE("Shared Memory Operations", "Slava Poliakov, Ilia Alshanetsky"); +CREDIT_LINE("SimpleXML", "Sterling Hughes, Marcus Boerger, Rob Richards"); +CREDIT_LINE("SNMP", "Rasmus Lerdorf, Harrie Hazewinkel, Mike Jackson, Steven Lawrance, Johann Hanne, Boris Lytochkin"); +CREDIT_LINE("SOAP", "Brad Lafountain, Shane Caraveo, Dmitry Stogov"); +CREDIT_LINE("Sockets", "Chris Vandomelen, Sterling Hughes, Daniel Beulshausen, Jason Greene"); +CREDIT_LINE("SPL", "Marcus Boerger, Etienne Kneuss"); +CREDIT_LINE("SQLite 3.x driver for PDO", "Wez Furlong"); +CREDIT_LINE("SQLite3", "Scott MacVicar, Ilia Alshanetsky, Brad Dewar"); +CREDIT_LINE("Sybase-CT", "Zeev Suraski, Tom May, Timm Friebe"); +CREDIT_LINE("System V Message based IPC", "Wez Furlong"); +CREDIT_LINE("System V Semaphores", "Tom May"); +CREDIT_LINE("System V Shared Memory", "Christian Cartus"); +CREDIT_LINE("tidy", "John Coggeshall, Ilia Alshanetsky"); +CREDIT_LINE("tokenizer", "Andrei Zmievski, Johannes Schlueter"); +CREDIT_LINE("WDDX", "Andrei Zmievski"); +CREDIT_LINE("XML", "Stig Bakken, Thies C. Arntzen, Sterling Hughes"); +CREDIT_LINE("XMLReader", "Rob Richards"); +CREDIT_LINE("xmlrpc", "Dan Libby"); +CREDIT_LINE("XMLWriter", "Rob Richards, Pierre-Alain Joye"); +CREDIT_LINE("XSL", "Christian Stocker, Rob Richards"); +CREDIT_LINE("Zip", "Pierre-Alain Joye"); +CREDIT_LINE("Zlib", "Rasmus Lerdorf, Stefan Roehrich, Zeev Suraski, Jade Nicoletti, Michael Wallner"); diff --git a/ext/standard/credits_sapi.h b/ext/standard/credits_sapi.h new file mode 100644 index 0000000..9cc7e6e --- /dev/null +++ b/ext/standard/credits_sapi.h @@ -0,0 +1,32 @@ +/* + DO NOT EDIT THIS FILE! + + it has been automaticaly created by php5/scripts/credits from + the information found in the various php5/ext/.../CREDITS and + php5/sapi/.../CREDITS files + + if you want to change an entry you have to edit the appropriate + CREDITS file instead + +*/ + +CREDIT_LINE("AOLserver", "Sascha Schumann"); +CREDIT_LINE("Apache 1.3 (apache_hooks)", "Rasmus Lerdorf, Zeev Suraski, Stig Bakken, David Sklar, George Schlossnagle, Lukas Schroeder"); +CREDIT_LINE("Apache 1.3", "Rasmus Lerdorf, Zeev Suraski, Stig Bakken, David Sklar"); +CREDIT_LINE("Apache 2.0 Filter", "Sascha Schumann, Aaron Bannert"); +CREDIT_LINE("Apache 2.0 Handler", "Ian Holsman, Justin Erenkrantz (based on Apache 2.0 Filter code)"); +CREDIT_LINE("Caudium / Roxen", "David Hedbor"); +CREDIT_LINE("CGI / FastCGI", "Rasmus Lerdorf, Stig Bakken, Shane Caraveo, Dmitry Stogov"); +CREDIT_LINE("CLI", "Edin Kadribasic, Marcus Boerger, Johannes Schlueter"); +CREDIT_LINE("Continuity", "Alex Leigh (based on nsapi code)"); +CREDIT_LINE("Embed", "Edin Kadribasic"); +CREDIT_LINE("FastCGI Process Manager", "Andrei Nigmatulin, dreamcat4, Antony Dovgal, Jerome Loyet"); +CREDIT_LINE("ISAPI", "Andi Gutmans, Zeev Suraski"); +CREDIT_LINE("litespeed", "George Wang"); +CREDIT_LINE("NSAPI", "Jayakumar Muthukumarasamy, Uwe Schindler"); +CREDIT_LINE("phttpd", "Thies C. Arntzen"); +CREDIT_LINE("pi3web", "Holger Zimmermann"); +CREDIT_LINE("Sendmail Milter", "Harald Radi"); +CREDIT_LINE("thttpd", "Sascha Schumann"); +CREDIT_LINE("tux", "Sascha Schumann"); +CREDIT_LINE("WebJames", "Alex Waugh"); diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c new file mode 100644 index 0000000..c6e0351 --- /dev/null +++ b/ext/standard/crypt.c @@ -0,0 +1,318 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Stig Bakken | + | Zeev Suraski | + | Rasmus Lerdorf | + | Pierre Joye | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include + +#include "php.h" +#if HAVE_CRYPT + +#if HAVE_UNISTD_H +#include +#endif +#if PHP_USE_PHP_CRYPT_R +# include "php_crypt_r.h" +# include "crypt_freesec.h" +#else +# if HAVE_CRYPT_H +# if defined(CRYPT_R_GNU_SOURCE) && !defined(_GNU_SOURCE) +# define _GNU_SOURCE +# endif +# include +# endif +#endif +#if TM_IN_SYS_TIME +#include +#else +#include +#endif +#if HAVE_STRING_H +#include +#else +#include +#endif + +#ifdef PHP_WIN32 +#include +#endif + +#include "php_lcg.h" +#include "php_crypt.h" +#include "php_rand.h" + +/* The capabilities of the crypt() function is determined by the test programs + * run by configure from aclocal.m4. They will set PHP_STD_DES_CRYPT, + * PHP_EXT_DES_CRYPT, PHP_MD5_CRYPT and PHP_BLOWFISH_CRYPT as appropriate + * for the target platform. */ + +#if PHP_STD_DES_CRYPT +#define PHP_MAX_SALT_LEN 2 +#endif + +#if PHP_EXT_DES_CRYPT +#undef PHP_MAX_SALT_LEN +#define PHP_MAX_SALT_LEN 9 +#endif + +#if PHP_MD5_CRYPT +#undef PHP_MAX_SALT_LEN +#define PHP_MAX_SALT_LEN 12 +#endif + +#if PHP_BLOWFISH_CRYPT +#undef PHP_MAX_SALT_LEN +#define PHP_MAX_SALT_LEN 60 +#endif + +#if PHP_SHA512_CRYPT +#undef PHP_MAX_SALT_LEN +#define PHP_MAX_SALT_LEN 123 +#endif + + +/* If the configure-time checks fail, we provide DES. + * XXX: This is a hack. Fix the real problem! */ + +#ifndef PHP_MAX_SALT_LEN +#define PHP_MAX_SALT_LEN 2 +#undef PHP_STD_DES_CRYPT +#define PHP_STD_DES_CRYPT 1 +#endif + +#define PHP_CRYPT_RAND php_rand(TSRMLS_C) + +PHP_MINIT_FUNCTION(crypt) /* {{{ */ +{ + REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_STD_DES", PHP_STD_DES_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_EXT_DES", PHP_EXT_DES_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_MD5", PHP_MD5_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_BLOWFISH", PHP_BLOWFISH_CRYPT, CONST_CS | CONST_PERSISTENT); + +#ifdef PHP_SHA256_CRYPT + REGISTER_LONG_CONSTANT("CRYPT_SHA256", PHP_SHA256_CRYPT, CONST_CS | CONST_PERSISTENT); +#endif + +#ifdef PHP_SHA512_CRYPT + REGISTER_LONG_CONSTANT("CRYPT_SHA512", PHP_SHA512_CRYPT, CONST_CS | CONST_PERSISTENT); +#endif + +#if PHP_USE_PHP_CRYPT_R + php_init_crypt_r(); +#endif + + return SUCCESS; +} +/* }}} */ + +PHP_MSHUTDOWN_FUNCTION(crypt) /* {{{ */ +{ +#if PHP_USE_PHP_CRYPT_R + php_shutdown_crypt_r(); +#endif + + return SUCCESS; +} +/* }}} */ + +static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +static void php_to64(char *s, long v, int n) /* {{{ */ +{ + while (--n >= 0) { + *s++ = itoa64[v&0x3f]; + v >>= 6; + } +} +/* }}} */ + +/* {{{ proto string crypt(string str [, string salt]) + Hash a string */ +PHP_FUNCTION(crypt) +{ + char salt[PHP_MAX_SALT_LEN + 1]; + char *str, *salt_in = NULL; + int str_len, salt_in_len = 0; + char *crypt_res; + salt[0] = salt[PHP_MAX_SALT_LEN] = '\0'; + + /* This will produce suitable results if people depend on DES-encryption + * available (passing always 2-character salt). At least for glibc6.1 */ + memset(&salt[1], '$', PHP_MAX_SALT_LEN - 1); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &salt_in, &salt_in_len) == FAILURE) { + return; + } + + if (salt_in) { + memcpy(salt, salt_in, MIN(PHP_MAX_SALT_LEN, salt_in_len)); + } + + /* The automatic salt generation covers standard DES, md5-crypt and Blowfish (simple) */ + if (!*salt) { +#if PHP_MD5_CRYPT + strncpy(salt, "$1$", PHP_MAX_SALT_LEN); + php_to64(&salt[3], PHP_CRYPT_RAND, 4); + php_to64(&salt[7], PHP_CRYPT_RAND, 4); + strncpy(&salt[11], "$", PHP_MAX_SALT_LEN - 11); +#elif PHP_STD_DES_CRYPT + php_to64(&salt[0], PHP_CRYPT_RAND, 2); + salt[2] = '\0'; +#endif + salt_in_len = strlen(salt); + } else { + salt_in_len = MIN(PHP_MAX_SALT_LEN, salt_in_len); + } + +/* Windows (win32/crypt) has a stripped down version of libxcrypt and + a CryptoApi md5_crypt implementation */ +#if PHP_USE_PHP_CRYPT_R + { + struct php_crypt_extended_data buffer; + + if (salt[0]=='$' && salt[1]=='1' && salt[2]=='$') { + char output[MD5_HASH_MAX_LEN]; + + RETURN_STRING(php_md5_crypt_r(str, salt, output), 1); + } else if (salt[0]=='$' && salt[1]=='6' && salt[2]=='$') { + const char sha512_salt_prefix[] = "$6$"; + const char sha512_rounds_prefix[] = "rounds="; + char *output; + int needed = (sizeof(sha512_salt_prefix) - 1 + + sizeof(sha512_rounds_prefix) + 9 + 1 + + salt_in_len + 1 + 86 + 1); + output = emalloc(needed); + salt[salt_in_len] = '\0'; + + crypt_res = php_sha512_crypt_r(str, salt, output, needed); + if (!crypt_res) { + if (salt[0]=='*' && salt[1]=='0') { + RETVAL_STRING("*1", 1); + } else { + RETVAL_STRING("*0", 1); + } + } else { + RETVAL_STRING(output, 1); + } + + memset(output, 0, needed); + efree(output); + } else if (salt[0]=='$' && salt[1]=='5' && salt[2]=='$') { + const char sha256_salt_prefix[] = "$5$"; + const char sha256_rounds_prefix[] = "rounds="; + char *output; + int needed = (sizeof(sha256_salt_prefix) - 1 + + sizeof(sha256_rounds_prefix) + 9 + 1 + + salt_in_len + 1 + 43 + 1); + output = emalloc(needed); + salt[salt_in_len] = '\0'; + + crypt_res = php_sha256_crypt_r(str, salt, output, needed); + if (!crypt_res) { + if (salt[0]=='*' && salt[1]=='0') { + RETVAL_STRING("*1", 1); + } else { + RETVAL_STRING("*0", 1); + } + } else { + RETVAL_STRING(output, 1); + } + + memset(output, 0, needed); + efree(output); + } else if ( + salt[0] == '$' && + salt[1] == '2' && + salt[2] >= 'a' && salt[2] <= 'z' && + salt[3] == '$' && + salt[4] >= '0' && salt[4] <= '3' && + salt[5] >= '0' && salt[5] <= '9' && + salt[6] == '$') { + char output[PHP_MAX_SALT_LEN + 1]; + + memset(output, 0, PHP_MAX_SALT_LEN + 1); + + crypt_res = php_crypt_blowfish_rn(str, salt, output, sizeof(output)); + if (!crypt_res) { + if (salt[0]=='*' && salt[1]=='0') { + RETVAL_STRING("*1", 1); + } else { + RETVAL_STRING("*0", 1); + } + } else { + RETVAL_STRING(output, 1); + } + + memset(output, 0, PHP_MAX_SALT_LEN + 1); + } else { + memset(&buffer, 0, sizeof(buffer)); + _crypt_extended_init_r(); + + crypt_res = _crypt_extended_r(str, salt, &buffer); + if (!crypt_res) { + if (salt[0]=='*' && salt[1]=='0') { + RETURN_STRING("*1", 1); + } else { + RETURN_STRING("*0", 1); + } + } else { + RETURN_STRING(crypt_res, 1); + } + } + } +#else + +# if defined(HAVE_CRYPT_R) && (defined(_REENTRANT) || defined(_THREAD_SAFE)) + { +# if defined(CRYPT_R_STRUCT_CRYPT_DATA) + struct crypt_data buffer; + memset(&buffer, 0, sizeof(buffer)); +# elif defined(CRYPT_R_CRYPTD) + CRYPTD buffer; +# else +# error Data struct used by crypt_r() is unknown. Please report. +# endif + crypt_res = crypt_r(str, salt, &buffer); + if (!crypt_res) { + if (salt[0]=='*' && salt[1]=='0') { + RETURN_STRING("*1", 1); + } else { + RETURN_STRING("*0", 1); + } + } else { + RETURN_STRING(crypt_res, 1); + } + } +# endif +#endif +} +/* }}} */ +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/crypt_blowfish.c b/ext/standard/crypt_blowfish.c new file mode 100644 index 0000000..e010352 --- /dev/null +++ b/ext/standard/crypt_blowfish.c @@ -0,0 +1,909 @@ +/* $Id$ */ +/* + * The crypt_blowfish homepage is: + * + * http://www.openwall.com/crypt/ + * + * This code comes from John the Ripper password cracker, with reentrant + * and crypt(3) interfaces added, but optimizations specific to password + * cracking removed. + * + * Written by Solar Designer in 1998-2011. + * No copyright is claimed, and the software is hereby placed in the public + * domain. In case this attempt to disclaim copyright and place the software + * in the public domain is deemed null and void, then the software is + * Copyright (c) 1998-2011 Solar Designer and it is hereby released to the + * general public under the following terms: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted. + * + * There's ABSOLUTELY NO WARRANTY, express or implied. + * + * It is my intent that you should be able to use this on your system, + * as part of a software package, or anywhere else to improve security, + * ensure compatibility, or for any other purpose. I would appreciate + * it if you give credit where it is due and keep your modifications in + * the public domain as well, but I don't require that in order to let + * you place this code and any modifications you make under a license + * of your choice. + * + * This implementation is mostly compatible with OpenBSD's bcrypt.c (prefix + * "$2a$") by Niels Provos , and uses some of his + * ideas. The password hashing algorithm was designed by David Mazieres + * . For more information on the level of compatibility, + * please refer to the comments in BF_set_key() below and to the crypt(3) + * man page included in the crypt_blowfish tarball. + * + * There's a paper on the algorithm that explains its design decisions: + * + * http://www.usenix.org/events/usenix99/provos.html + * + * Some of the tricks in BF_ROUND might be inspired by Eric Young's + * Blowfish library (I can't be sure if I would think of something if I + * hadn't seen his code). + */ + +#include + +#include +#ifndef __set_errno +#define __set_errno(val) errno = (val) +#endif + +/* Just to make sure the prototypes match the actual definitions */ +#include "crypt_blowfish.h" + +#ifdef __i386__ +#define BF_ASM 0 +#define BF_SCALE 1 +#elif defined(__x86_64__) || defined(__alpha__) || defined(__hppa__) +#define BF_ASM 0 +#define BF_SCALE 1 +#else +#define BF_ASM 0 +#define BF_SCALE 0 +#endif + +typedef unsigned int BF_word; +typedef signed int BF_word_signed; + +/* Number of Blowfish rounds, this is also hardcoded into a few places */ +#define BF_N 16 + +typedef BF_word BF_key[BF_N + 2]; + +typedef struct { + BF_word S[4][0x100]; + BF_key P; +} BF_ctx; + +/* + * Magic IV for 64 Blowfish encryptions that we do at the end. + * The string is "OrpheanBeholderScryDoubt" on big-endian. + */ +static BF_word BF_magic_w[6] = { + 0x4F727068, 0x65616E42, 0x65686F6C, + 0x64657253, 0x63727944, 0x6F756274 +}; + +/* + * P-box and S-box tables initialized with digits of Pi. + */ +static BF_ctx BF_init_state = { + { + { + 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, + 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, + 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, + 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, + 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, + 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, + 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, + 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e, + 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, + 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, + 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, + 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, + 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, + 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677, + 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, + 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, + 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88, + 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, + 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, + 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0, + 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, + 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, + 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88, + 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, + 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, + 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, + 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, + 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, + 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba, + 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, + 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, + 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09, + 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, + 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, + 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279, + 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, + 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, + 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82, + 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, + 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, + 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, + 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, + 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, + 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8, + 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, + 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, + 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7, + 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, + 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, + 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1, + 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, + 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, + 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477, + 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, + 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, + 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, + 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, + 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, + 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, + 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, + 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, + 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, + 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, + 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a + }, { + 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, + 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, + 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, + 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, + 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, + 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, + 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, + 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1, + 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, + 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, + 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff, + 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, + 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, + 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7, + 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, + 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, + 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf, + 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, + 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, + 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87, + 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, + 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, + 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16, + 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, + 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, + 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509, + 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, + 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, + 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f, + 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, + 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, + 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, + 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, + 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, + 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802, + 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, + 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, + 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf, + 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, + 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, + 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50, + 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, + 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, + 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281, + 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, + 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, + 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128, + 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, + 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, + 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0, + 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, + 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, + 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, + 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, + 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, + 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061, + 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, + 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, + 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, + 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, + 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, + 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, + 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, + 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7 + }, { + 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, + 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, + 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, + 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, + 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, + 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, + 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, + 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb, + 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, + 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, + 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42, + 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, + 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, + 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb, + 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, + 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, + 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33, + 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, + 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, + 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc, + 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, + 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, + 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, + 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, + 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, + 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728, + 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, + 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, + 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37, + 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, + 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, + 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b, + 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, + 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, + 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d, + 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, + 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, + 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, + 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, + 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, + 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d, + 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, + 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, + 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61, + 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, + 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, + 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2, + 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, + 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, + 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633, + 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, + 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, + 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, + 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, + 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, + 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62, + 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, + 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, + 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, + 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, + 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, + 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, + 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, + 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0 + }, { + 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, + 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, + 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, + 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, + 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, + 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, + 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, + 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22, + 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, + 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, + 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9, + 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, + 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, + 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51, + 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, + 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, + 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b, + 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, + 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, + 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd, + 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, + 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, + 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb, + 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, + 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, + 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32, + 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, + 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, + 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, + 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, + 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, + 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47, + 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, + 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, + 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84, + 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, + 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, + 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd, + 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, + 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, + 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38, + 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, + 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, + 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525, + 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, + 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, + 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964, + 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, + 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, + 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d, + 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, + 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, + 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02, + 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, + 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, + 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a, + 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, + 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, + 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, + 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, + 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, + 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, + 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, + 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6 + } + }, { + 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, + 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, + 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, + 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, + 0x9216d5d9, 0x8979fb1b + } +}; + +static unsigned char BF_itoa64[64 + 1] = + "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + +static unsigned char BF_atoi64[0x60] = { + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 1, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 64, 64, 64, 64, 64, + 64, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 64, 64, 64, 64, 64, + 64, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 64, 64, 64, 64, 64 +}; + +#define BF_safe_atoi64(dst, src) \ +{ \ + tmp = (unsigned char)(src); \ + if (tmp == '$') break; /* PHP hack */ \ + if ((unsigned int)(tmp -= 0x20) >= 0x60) return -1; \ + tmp = BF_atoi64[tmp]; \ + if (tmp > 63) return -1; \ + (dst) = tmp; \ +} + +static int BF_decode(BF_word *dst, const char *src, int size) +{ + unsigned char *dptr = (unsigned char *)dst; + unsigned char *end = dptr + size; + const unsigned char *sptr = (const unsigned char *)src; + unsigned int tmp, c1, c2, c3, c4; + + do { + BF_safe_atoi64(c1, *sptr++); + BF_safe_atoi64(c2, *sptr++); + *dptr++ = (c1 << 2) | ((c2 & 0x30) >> 4); + if (dptr >= end) break; + + BF_safe_atoi64(c3, *sptr++); + *dptr++ = ((c2 & 0x0F) << 4) | ((c3 & 0x3C) >> 2); + if (dptr >= end) break; + + BF_safe_atoi64(c4, *sptr++); + *dptr++ = ((c3 & 0x03) << 6) | c4; + } while (dptr < end); + + while (dptr < end) /* PHP hack */ + *dptr++ = 0; + + return 0; +} + +static void BF_encode(char *dst, const BF_word *src, int size) +{ + const unsigned char *sptr = (const unsigned char *)src; + const unsigned char *end = sptr + size; + unsigned char *dptr = (unsigned char *)dst; + unsigned int c1, c2; + + do { + c1 = *sptr++; + *dptr++ = BF_itoa64[c1 >> 2]; + c1 = (c1 & 0x03) << 4; + if (sptr >= end) { + *dptr++ = BF_itoa64[c1]; + break; + } + + c2 = *sptr++; + c1 |= c2 >> 4; + *dptr++ = BF_itoa64[c1]; + c1 = (c2 & 0x0f) << 2; + if (sptr >= end) { + *dptr++ = BF_itoa64[c1]; + break; + } + + c2 = *sptr++; + c1 |= c2 >> 6; + *dptr++ = BF_itoa64[c1]; + *dptr++ = BF_itoa64[c2 & 0x3f]; + } while (sptr < end); +} + +static void BF_swap(BF_word *x, int count) +{ + static int endianness_check = 1; + char *is_little_endian = (char *)&endianness_check; + BF_word tmp; + + if (*is_little_endian) + do { + tmp = *x; + tmp = (tmp << 16) | (tmp >> 16); + *x++ = ((tmp & 0x00FF00FF) << 8) | ((tmp >> 8) & 0x00FF00FF); + } while (--count); +} + +#if BF_SCALE +/* Architectures which can shift addresses left by 2 bits with no extra cost */ +#define BF_ROUND(L, R, N) \ + tmp1 = L & 0xFF; \ + tmp2 = L >> 8; \ + tmp2 &= 0xFF; \ + tmp3 = L >> 16; \ + tmp3 &= 0xFF; \ + tmp4 = L >> 24; \ + tmp1 = data.ctx.S[3][tmp1]; \ + tmp2 = data.ctx.S[2][tmp2]; \ + tmp3 = data.ctx.S[1][tmp3]; \ + tmp3 += data.ctx.S[0][tmp4]; \ + tmp3 ^= tmp2; \ + R ^= data.ctx.P[N + 1]; \ + tmp3 += tmp1; \ + R ^= tmp3; +#else +/* Architectures with no complicated addressing modes supported */ +#define BF_INDEX(S, i) \ + (*((BF_word *)(((unsigned char *)S) + (i)))) +#define BF_ROUND(L, R, N) \ + tmp1 = L & 0xFF; \ + tmp1 <<= 2; \ + tmp2 = L >> 6; \ + tmp2 &= 0x3FC; \ + tmp3 = L >> 14; \ + tmp3 &= 0x3FC; \ + tmp4 = L >> 22; \ + tmp4 &= 0x3FC; \ + tmp1 = BF_INDEX(data.ctx.S[3], tmp1); \ + tmp2 = BF_INDEX(data.ctx.S[2], tmp2); \ + tmp3 = BF_INDEX(data.ctx.S[1], tmp3); \ + tmp3 += BF_INDEX(data.ctx.S[0], tmp4); \ + tmp3 ^= tmp2; \ + R ^= data.ctx.P[N + 1]; \ + tmp3 += tmp1; \ + R ^= tmp3; +#endif + +/* + * Encrypt one block, BF_N is hardcoded here. + */ +#define BF_ENCRYPT \ + L ^= data.ctx.P[0]; \ + BF_ROUND(L, R, 0); \ + BF_ROUND(R, L, 1); \ + BF_ROUND(L, R, 2); \ + BF_ROUND(R, L, 3); \ + BF_ROUND(L, R, 4); \ + BF_ROUND(R, L, 5); \ + BF_ROUND(L, R, 6); \ + BF_ROUND(R, L, 7); \ + BF_ROUND(L, R, 8); \ + BF_ROUND(R, L, 9); \ + BF_ROUND(L, R, 10); \ + BF_ROUND(R, L, 11); \ + BF_ROUND(L, R, 12); \ + BF_ROUND(R, L, 13); \ + BF_ROUND(L, R, 14); \ + BF_ROUND(R, L, 15); \ + tmp4 = R; \ + R = L; \ + L = tmp4 ^ data.ctx.P[BF_N + 1]; + +#if BF_ASM +#define BF_body() \ + _BF_body_r(&data.ctx); +#else +#define BF_body() \ + L = R = 0; \ + ptr = data.ctx.P; \ + do { \ + ptr += 2; \ + BF_ENCRYPT; \ + *(ptr - 2) = L; \ + *(ptr - 1) = R; \ + } while (ptr < &data.ctx.P[BF_N + 2]); \ +\ + ptr = data.ctx.S[0]; \ + do { \ + ptr += 2; \ + BF_ENCRYPT; \ + *(ptr - 2) = L; \ + *(ptr - 1) = R; \ + } while (ptr < &data.ctx.S[3][0xFF]); +#endif + +static void BF_set_key(const char *key, BF_key expanded, BF_key initial, + unsigned char flags) +{ + const char *ptr = key; + unsigned int bug, i, j; + BF_word safety, sign, diff, tmp[2]; + +/* + * There was a sign extension bug in older revisions of this function. While + * we would have liked to simply fix the bug and move on, we have to provide + * a backwards compatibility feature (essentially the bug) for some systems and + * a safety measure for some others. The latter is needed because for certain + * multiple inputs to the buggy algorithm there exist easily found inputs to + * the correct algorithm that produce the same hash. Thus, we optionally + * deviate from the correct algorithm just enough to avoid such collisions. + * While the bug itself affected the majority of passwords containing + * characters with the 8th bit set (although only a percentage of those in a + * collision-producing way), the anti-collision safety measure affects + * only a subset of passwords containing the '\xff' character (not even all of + * those passwords, just some of them). This character is not found in valid + * UTF-8 sequences and is rarely used in popular 8-bit character encodings. + * Thus, the safety measure is unlikely to cause much annoyance, and is a + * reasonable tradeoff to use when authenticating against existing hashes that + * are not reliably known to have been computed with the correct algorithm. + * + * We use an approach that tries to minimize side-channel leaks of password + * information - that is, we mostly use fixed-cost bitwise operations instead + * of branches or table lookups. (One conditional branch based on password + * length remains. It is not part of the bug aftermath, though, and is + * difficult and possibly unreasonable to avoid given the use of C strings by + * the caller, which results in similar timing leaks anyway.) + * + * For actual implementation, we set an array index in the variable "bug" + * (0 means no bug, 1 means sign extension bug emulation) and a flag in the + * variable "safety" (bit 16 is set when the safety measure is requested). + * Valid combinations of settings are: + * + * Prefix "$2a$": bug = 0, safety = 0x10000 + * Prefix "$2x$": bug = 1, safety = 0 + * Prefix "$2y$": bug = 0, safety = 0 + */ + bug = (unsigned int)flags & 1; + safety = ((BF_word)flags & 2) << 15; + + sign = diff = 0; + + for (i = 0; i < BF_N + 2; i++) { + tmp[0] = tmp[1] = 0; + for (j = 0; j < 4; j++) { + tmp[0] <<= 8; + tmp[0] |= (unsigned char)*ptr; /* correct */ + tmp[1] <<= 8; + tmp[1] |= (BF_word_signed)(signed char)*ptr; /* bug */ +/* + * Sign extension in the first char has no effect - nothing to overwrite yet, + * and those extra 24 bits will be fully shifted out of the 32-bit word. For + * chars 2, 3, 4 in each four-char block, we set bit 7 of "sign" if sign + * extension in tmp[1] occurs. Once this flag is set, it remains set. + */ + if (j) + sign |= tmp[1] & 0x80; + if (!*ptr) + ptr = key; + else + ptr++; + } + diff |= tmp[0] ^ tmp[1]; /* Non-zero on any differences */ + + expanded[i] = tmp[bug]; + initial[i] = BF_init_state.P[i] ^ tmp[bug]; + } + +/* + * At this point, "diff" is zero iff the correct and buggy algorithms produced + * exactly the same result. If so and if "sign" is non-zero, which indicates + * that there was a non-benign sign extension, this means that we have a + * collision between the correctly computed hash for this password and a set of + * passwords that could be supplied to the buggy algorithm. Our safety measure + * is meant to protect from such many-buggy to one-correct collisions, by + * deviating from the correct algorithm in such cases. Let's check for this. + */ + diff |= diff >> 16; /* still zero iff exact match */ + diff &= 0xffff; /* ditto */ + diff += 0xffff; /* bit 16 set iff "diff" was non-zero (on non-match) */ + sign <<= 9; /* move the non-benign sign extension flag to bit 16 */ + sign &= ~diff & safety; /* action needed? */ + +/* + * If we have determined that we need to deviate from the correct algorithm, + * flip bit 16 in initial expanded key. (The choice of 16 is arbitrary, but + * let's stick to it now. It came out of the approach we used above, and it's + * not any worse than any other choice we could make.) + * + * It is crucial that we don't do the same to the expanded key used in the main + * Eksblowfish loop. By doing it to only one of these two, we deviate from a + * state that could be directly specified by a password to the buggy algorithm + * (and to the fully correct one as well, but that's a side-effect). + */ + initial[0] ^= sign; +} + +static char *BF_crypt(const char *key, const char *setting, + char *output, int size, + BF_word min) +{ +#if BF_ASM + extern void _BF_body_r(BF_ctx *ctx); +#endif + static const unsigned char flags_by_subtype[26] = + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 0}; + struct { + BF_ctx ctx; + BF_key expanded_key; + union { + BF_word salt[4]; + BF_word output[6]; + } binary; + } data; + BF_word L, R; + BF_word tmp1, tmp2, tmp3, tmp4; + BF_word *ptr; + BF_word count; + int i; + + if (size < 7 + 22 + 31 + 1) { + __set_errno(ERANGE); + return NULL; + } + + if (setting[0] != '$' || + setting[1] != '2' || + setting[2] < 'a' || setting[2] > 'z' || + !flags_by_subtype[(unsigned int)(unsigned char)setting[2] - 'a'] || + setting[3] != '$' || + setting[4] < '0' || setting[4] > '3' || + setting[5] < '0' || setting[5] > '9' || + (setting[4] == '3' && setting[5] > '1') || + setting[6] != '$') { + __set_errno(EINVAL); + return NULL; + } + + count = (BF_word)1 << ((setting[4] - '0') * 10 + (setting[5] - '0')); + if (count < min || BF_decode(data.binary.salt, &setting[7], 16)) { + __set_errno(EINVAL); + return NULL; + } + BF_swap(data.binary.salt, 4); + + BF_set_key(key, data.expanded_key, data.ctx.P, + flags_by_subtype[(unsigned int)(unsigned char)setting[2] - 'a']); + + memcpy(data.ctx.S, BF_init_state.S, sizeof(data.ctx.S)); + + L = R = 0; + for (i = 0; i < BF_N + 2; i += 2) { + L ^= data.binary.salt[i & 2]; + R ^= data.binary.salt[(i & 2) + 1]; + BF_ENCRYPT; + data.ctx.P[i] = L; + data.ctx.P[i + 1] = R; + } + + ptr = data.ctx.S[0]; + do { + ptr += 4; + L ^= data.binary.salt[(BF_N + 2) & 3]; + R ^= data.binary.salt[(BF_N + 3) & 3]; + BF_ENCRYPT; + *(ptr - 4) = L; + *(ptr - 3) = R; + + L ^= data.binary.salt[(BF_N + 4) & 3]; + R ^= data.binary.salt[(BF_N + 5) & 3]; + BF_ENCRYPT; + *(ptr - 2) = L; + *(ptr - 1) = R; + } while (ptr < &data.ctx.S[3][0xFF]); + + do { + int done; + + for (i = 0; i < BF_N + 2; i += 2) { + data.ctx.P[i] ^= data.expanded_key[i]; + data.ctx.P[i + 1] ^= data.expanded_key[i + 1]; + } + + done = 0; + do { + BF_body(); + if (done) + break; + done = 1; + + tmp1 = data.binary.salt[0]; + tmp2 = data.binary.salt[1]; + tmp3 = data.binary.salt[2]; + tmp4 = data.binary.salt[3]; + for (i = 0; i < BF_N; i += 4) { + data.ctx.P[i] ^= tmp1; + data.ctx.P[i + 1] ^= tmp2; + data.ctx.P[i + 2] ^= tmp3; + data.ctx.P[i + 3] ^= tmp4; + } + data.ctx.P[16] ^= tmp1; + data.ctx.P[17] ^= tmp2; + } while (1); + } while (--count); + + for (i = 0; i < 6; i += 2) { + L = BF_magic_w[i]; + R = BF_magic_w[i + 1]; + + count = 64; + do { + BF_ENCRYPT; + } while (--count); + + data.binary.output[i] = L; + data.binary.output[i + 1] = R; + } + + memcpy(output, setting, 7 + 22 - 1); + output[7 + 22 - 1] = BF_itoa64[(int) + BF_atoi64[(int)setting[7 + 22 - 1] - 0x20] & 0x30]; + +/* This has to be bug-compatible with the original implementation, so + * only encode 23 of the 24 bytes. :-) */ + BF_swap(data.binary.output, 6); + BF_encode(&output[7 + 22], data.binary.output, 23); + output[7 + 22 + 31] = '\0'; + + return output; +} + +static int _crypt_output_magic(const char *setting, char *output, int size) +{ + if (size < 3) + return -1; + + output[0] = '*'; + output[1] = '0'; + output[2] = '\0'; + + if (setting[0] == '*' && setting[1] == '0') + output[1] = '1'; + + return 0; +} + +/* + * Please preserve the runtime self-test. It serves two purposes at once: + * + * 1. We really can't afford the risk of producing incompatible hashes e.g. + * when there's something like gcc bug 26587 again, whereas an application or + * library integrating this code might not also integrate our external tests or + * it might not run them after every build. Even if it does, the miscompile + * might only occur on the production build, but not on a testing build (such + * as because of different optimization settings). It is painful to recover + * from incorrectly-computed hashes - merely fixing whatever broke is not + * enough. Thus, a proactive measure like this self-test is needed. + * + * 2. We don't want to leave sensitive data from our actual password hash + * computation on the stack or in registers. Previous revisions of the code + * would do explicit cleanups, but simply running the self-test after hash + * computation is more reliable. + * + * The performance cost of this quick self-test is around 0.6% at the "$2a$08" + * setting. + */ +char *php_crypt_blowfish_rn(const char *key, const char *setting, + char *output, int size) +{ + const char *test_key = "8b \xd0\xc1\xd2\xcf\xcc\xd8"; + const char *test_setting = "$2a$00$abcdefghijklmnopqrstuu"; + static const char * const test_hash[2] = + {"VUrPmXD6q/nVSSp7pNDhCR9071IfIRe\0\x55", /* $2x$ */ + "i1D709vfamulimlGcq0qq3UvuUasvEa\0\x55"}; /* $2a$, $2y$ */ + char *retval; + const char *p; + int save_errno, ok; + struct { + char s[7 + 22 + 1]; + char o[7 + 22 + 31 + 1 + 1 + 1]; + } buf; + +/* Hash the supplied password */ + _crypt_output_magic(setting, output, size); + retval = BF_crypt(key, setting, output, size, 16); + save_errno = errno; + +/* + * Do a quick self-test. It is important that we make both calls to BF_crypt() + * from the same scope such that they likely use the same stack locations, + * which makes the second call overwrite the first call's sensitive data on the + * stack and makes it more likely that any alignment related issues would be + * detected by the self-test. + */ + memcpy(buf.s, test_setting, sizeof(buf.s)); + if (retval) + buf.s[2] = setting[2]; + memset(buf.o, 0x55, sizeof(buf.o)); + buf.o[sizeof(buf.o) - 1] = 0; + p = BF_crypt(test_key, buf.s, buf.o, sizeof(buf.o) - (1 + 1), 1); + + ok = (p == buf.o && + !memcmp(p, buf.s, 7 + 22) && + !memcmp(p + (7 + 22), + test_hash[(unsigned int)(unsigned char)buf.s[2] & 1], + 31 + 1 + 1 + 1)); + + { + const char *k = "\xff\xa3" "34" "\xff\xff\xff\xa3" "345"; + BF_key ae, ai, ye, yi; + BF_set_key(k, ae, ai, 2); /* $2a$ */ + BF_set_key(k, ye, yi, 4); /* $2y$ */ + ai[0] ^= 0x10000; /* undo the safety (for comparison) */ + ok = ok && ai[0] == 0xdb9c59bc && ye[17] == 0x33343500 && + !memcmp(ae, ye, sizeof(ae)) && + !memcmp(ai, yi, sizeof(ai)); + } + + __set_errno(save_errno); + if (ok) + return retval; + +/* Should not happen */ + _crypt_output_magic(setting, output, size); + __set_errno(EINVAL); /* pretend we don't support this hash type */ + return NULL; +} + +#if 0 +char *_crypt_gensalt_blowfish_rn(const char *prefix, unsigned long count, + const char *input, int size, char *output, int output_size) +{ + if (size < 16 || output_size < 7 + 22 + 1 || + (count && (count < 4 || count > 31)) || + prefix[0] != '$' || prefix[1] != '2' || + (prefix[2] != 'a' && prefix[2] != 'y')) { + if (output_size > 0) output[0] = '\0'; + __set_errno((output_size < 7 + 22 + 1) ? ERANGE : EINVAL); + return NULL; + } + + if (!count) count = 5; + + output[0] = '$'; + output[1] = '2'; + output[2] = prefix[2]; + output[3] = '$'; + output[4] = '0' + count / 10; + output[5] = '0' + count % 10; + output[6] = '$'; + + BF_encode(&output[7], (const BF_word *)input, 16); + output[7 + 22] = '\0'; + + return output; +} +#endif diff --git a/ext/standard/crypt_blowfish.h b/ext/standard/crypt_blowfish.h new file mode 100644 index 0000000..da37473 --- /dev/null +++ b/ext/standard/crypt_blowfish.h @@ -0,0 +1,32 @@ +/* $Id$ */ +/* + * Written by Solar Designer in 2000-2011. + * No copyright is claimed, and the software is hereby placed in the public + * domain. In case this attempt to disclaim copyright and place the software + * in the public domain is deemed null and void, then the software is + * Copyright (c) 2000-2011 Solar Designer and it is hereby released to the + * general public under the following terms: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted. + * + * There's ABSOLUTELY NO WARRANTY, express or implied. + * + * See crypt_blowfish.c for more information. + */ + +#ifndef _CRYPT_BLOWFISH_H +#define _CRYPT_BLOWFISH_H + +#if 0 +extern int _crypt_output_magic(const char *setting, char *output, int size); +#endif +extern char *php_crypt_blowfish_rn(const char *key, const char *setting, + char *output, int size); +#if 0 +extern char *_crypt_gensalt_blowfish_rn(const char *prefix, + unsigned long count, + const char *input, int size, char *output, int output_size); +#endif + +#endif diff --git a/ext/standard/crypt_freesec.c b/ext/standard/crypt_freesec.c new file mode 100644 index 0000000..0a5c3ba --- /dev/null +++ b/ext/standard/crypt_freesec.c @@ -0,0 +1,808 @@ +/* + $Id$ +*/ +/* + * This version is derived from the original implementation of FreeSec + * (release 1.1) by David Burren. I've reviewed the changes made in + * OpenBSD (as of 2.7) and modified the original code in a similar way + * where applicable. I've also made it reentrant and made a number of + * other changes. + * - Solar Designer + */ + +/* + * FreeSec: libcrypt for NetBSD + * + * Copyright (c) 1994 David Burren + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of other contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Owl: Owl/packages/glibc/crypt_freesec.c,v 1.4 2005/11/16 13:08:32 solar Exp $ + * $Id$ + * + * This is an original implementation of the DES and the crypt(3) interfaces + * by David Burren . + * + * An excellent reference on the underlying algorithm (and related + * algorithms) is: + * + * B. Schneier, Applied Cryptography: protocols, algorithms, + * and source code in C, John Wiley & Sons, 1994. + * + * Note that in that book's description of DES the lookups for the initial, + * pbox, and final permutations are inverted (this has been brought to the + * attention of the author). A list of errata for this book has been + * posted to the sci.crypt newsgroup by the author and is available for FTP. + * + * ARCHITECTURE ASSUMPTIONS: + * This code used to have some nasty ones, but these have been removed + * by now. The code requires a 32-bit integer type, though. + */ + +#include +#include + +#ifdef TEST +#include +#endif + +#include "crypt_freesec.h" + +#define _PASSWORD_EFMT1 '_' + +static u_char IP[64] = { + 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, + 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, + 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, + 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7 +}; + +static u_char key_perm[56] = { + 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, + 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, + 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, + 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 +}; + +static u_char key_shifts[16] = { + 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 +}; + +static u_char comp_perm[48] = { + 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, + 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, + 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, + 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32 +}; + +/* + * No E box is used, as it's replaced by some ANDs, shifts, and ORs. + */ + +static u_char sbox[8][64] = { + { + 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, + 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, + 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0, + 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13 + }, + { + 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10, + 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5, + 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15, + 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9 + }, + { + 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8, + 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1, + 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7, + 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12 + }, + { + 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15, + 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9, + 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4, + 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14 + }, + { + 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9, + 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6, + 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14, + 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3 + }, + { + 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11, + 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8, + 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6, + 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13 + }, + { + 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1, + 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6, + 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2, + 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12 + }, + { + 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7, + 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2, + 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8, + 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11 + } +}; + +static u_char pbox[32] = { + 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, + 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25 +}; + +static uint32_t bits32[32] = +{ + 0x80000000, 0x40000000, 0x20000000, 0x10000000, + 0x08000000, 0x04000000, 0x02000000, 0x01000000, + 0x00800000, 0x00400000, 0x00200000, 0x00100000, + 0x00080000, 0x00040000, 0x00020000, 0x00010000, + 0x00008000, 0x00004000, 0x00002000, 0x00001000, + 0x00000800, 0x00000400, 0x00000200, 0x00000100, + 0x00000080, 0x00000040, 0x00000020, 0x00000010, + 0x00000008, 0x00000004, 0x00000002, 0x00000001 +}; + +static u_char bits8[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; + +static unsigned char ascii64[] = + "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +/* 0000000000111111111122222222223333333333444444444455555555556666 */ +/* 0123456789012345678901234567890123456789012345678901234567890123 */ + +static u_char m_sbox[4][4096]; +static uint32_t psbox[4][256]; +static uint32_t ip_maskl[8][256], ip_maskr[8][256]; +static uint32_t fp_maskl[8][256], fp_maskr[8][256]; +static uint32_t key_perm_maskl[8][128], key_perm_maskr[8][128]; +static uint32_t comp_maskl[8][128], comp_maskr[8][128]; + +static inline int +ascii_to_bin(char ch) +{ + signed char sch = ch; + int retval; + + retval = sch - '.'; + if (sch >= 'A') { + retval = sch - ('A' - 12); + if (sch >= 'a') + retval = sch - ('a' - 38); + } + retval &= 0x3f; + + return(retval); +} + +/* + * When we choose to "support" invalid salts, nevertheless disallow those + * containing characters that would violate the passwd file format. + */ +static inline int +ascii_is_unsafe(char ch) +{ + return !ch || ch == '\n' || ch == ':'; +} + +void +_crypt_extended_init(void) +{ + int i, j, b, k, inbit, obit; + uint32_t *p, *il, *ir, *fl, *fr; + uint32_t *bits28, *bits24; + u_char inv_key_perm[64]; + u_char u_key_perm[56]; + u_char inv_comp_perm[56]; + u_char init_perm[64], final_perm[64]; + u_char u_sbox[8][64]; + u_char un_pbox[32]; + + bits24 = (bits28 = bits32 + 4) + 4; + + /* + * Invert the S-boxes, reordering the input bits. + */ + for (i = 0; i < 8; i++) + for (j = 0; j < 64; j++) { + b = (j & 0x20) | ((j & 1) << 4) | ((j >> 1) & 0xf); + u_sbox[i][j] = sbox[i][b]; + } + + /* + * Convert the inverted S-boxes into 4 arrays of 8 bits. + * Each will handle 12 bits of the S-box input. + */ + for (b = 0; b < 4; b++) + for (i = 0; i < 64; i++) + for (j = 0; j < 64; j++) + m_sbox[b][(i << 6) | j] = + (u_sbox[(b << 1)][i] << 4) | + u_sbox[(b << 1) + 1][j]; + + /* + * Set up the initial & final permutations into a useful form, and + * initialise the inverted key permutation. + */ + for (i = 0; i < 64; i++) { + init_perm[final_perm[i] = IP[i] - 1] = i; + inv_key_perm[i] = 255; + } + + /* + * Invert the key permutation and initialise the inverted key + * compression permutation. + */ + for (i = 0; i < 56; i++) { + u_key_perm[i] = key_perm[i] - 1; + inv_key_perm[key_perm[i] - 1] = i; + inv_comp_perm[i] = 255; + } + + /* + * Invert the key compression permutation. + */ + for (i = 0; i < 48; i++) { + inv_comp_perm[comp_perm[i] - 1] = i; + } + + /* + * Set up the OR-mask arrays for the initial and final permutations, + * and for the key initial and compression permutations. + */ + for (k = 0; k < 8; k++) { + for (i = 0; i < 256; i++) { + *(il = &ip_maskl[k][i]) = 0; + *(ir = &ip_maskr[k][i]) = 0; + *(fl = &fp_maskl[k][i]) = 0; + *(fr = &fp_maskr[k][i]) = 0; + for (j = 0; j < 8; j++) { + inbit = 8 * k + j; + if (i & bits8[j]) { + if ((obit = init_perm[inbit]) < 32) + *il |= bits32[obit]; + else + *ir |= bits32[obit-32]; + if ((obit = final_perm[inbit]) < 32) + *fl |= bits32[obit]; + else + *fr |= bits32[obit - 32]; + } + } + } + for (i = 0; i < 128; i++) { + *(il = &key_perm_maskl[k][i]) = 0; + *(ir = &key_perm_maskr[k][i]) = 0; + for (j = 0; j < 7; j++) { + inbit = 8 * k + j; + if (i & bits8[j + 1]) { + if ((obit = inv_key_perm[inbit]) == 255) + continue; + if (obit < 28) + *il |= bits28[obit]; + else + *ir |= bits28[obit - 28]; + } + } + *(il = &comp_maskl[k][i]) = 0; + *(ir = &comp_maskr[k][i]) = 0; + for (j = 0; j < 7; j++) { + inbit = 7 * k + j; + if (i & bits8[j + 1]) { + if ((obit=inv_comp_perm[inbit]) == 255) + continue; + if (obit < 24) + *il |= bits24[obit]; + else + *ir |= bits24[obit - 24]; + } + } + } + } + + /* + * Invert the P-box permutation, and convert into OR-masks for + * handling the output of the S-box arrays setup above. + */ + for (i = 0; i < 32; i++) + un_pbox[pbox[i] - 1] = i; + + for (b = 0; b < 4; b++) + for (i = 0; i < 256; i++) { + *(p = &psbox[b][i]) = 0; + for (j = 0; j < 8; j++) { + if (i & bits8[j]) + *p |= bits32[un_pbox[8 * b + j]]; + } + } +} + +static void +des_init_local(struct php_crypt_extended_data *data) +{ + data->old_rawkey0 = data->old_rawkey1 = 0; + data->saltbits = 0; + data->old_salt = 0; + + data->initialized = 1; +} + +static void +setup_salt(uint32_t salt, struct php_crypt_extended_data *data) +{ + uint32_t obit, saltbit, saltbits; + int i; + + if (salt == data->old_salt) + return; + data->old_salt = salt; + + saltbits = 0; + saltbit = 1; + obit = 0x800000; + for (i = 0; i < 24; i++) { + if (salt & saltbit) + saltbits |= obit; + saltbit <<= 1; + obit >>= 1; + } + data->saltbits = saltbits; +} + +static int +des_setkey(const char *key, struct php_crypt_extended_data *data) +{ + uint32_t k0, k1, rawkey0, rawkey1; + int shifts, round; + + rawkey0 = + (uint32_t)(u_char)key[3] | + ((uint32_t)(u_char)key[2] << 8) | + ((uint32_t)(u_char)key[1] << 16) | + ((uint32_t)(u_char)key[0] << 24); + rawkey1 = + (uint32_t)(u_char)key[7] | + ((uint32_t)(u_char)key[6] << 8) | + ((uint32_t)(u_char)key[5] << 16) | + ((uint32_t)(u_char)key[4] << 24); + + if ((rawkey0 | rawkey1) + && rawkey0 == data->old_rawkey0 + && rawkey1 == data->old_rawkey1) { + /* + * Already setup for this key. + * This optimisation fails on a zero key (which is weak and + * has bad parity anyway) in order to simplify the starting + * conditions. + */ + return(0); + } + data->old_rawkey0 = rawkey0; + data->old_rawkey1 = rawkey1; + + /* + * Do key permutation and split into two 28-bit subkeys. + */ + k0 = key_perm_maskl[0][rawkey0 >> 25] + | key_perm_maskl[1][(rawkey0 >> 17) & 0x7f] + | key_perm_maskl[2][(rawkey0 >> 9) & 0x7f] + | key_perm_maskl[3][(rawkey0 >> 1) & 0x7f] + | key_perm_maskl[4][rawkey1 >> 25] + | key_perm_maskl[5][(rawkey1 >> 17) & 0x7f] + | key_perm_maskl[6][(rawkey1 >> 9) & 0x7f] + | key_perm_maskl[7][(rawkey1 >> 1) & 0x7f]; + k1 = key_perm_maskr[0][rawkey0 >> 25] + | key_perm_maskr[1][(rawkey0 >> 17) & 0x7f] + | key_perm_maskr[2][(rawkey0 >> 9) & 0x7f] + | key_perm_maskr[3][(rawkey0 >> 1) & 0x7f] + | key_perm_maskr[4][rawkey1 >> 25] + | key_perm_maskr[5][(rawkey1 >> 17) & 0x7f] + | key_perm_maskr[6][(rawkey1 >> 9) & 0x7f] + | key_perm_maskr[7][(rawkey1 >> 1) & 0x7f]; + /* + * Rotate subkeys and do compression permutation. + */ + shifts = 0; + for (round = 0; round < 16; round++) { + uint32_t t0, t1; + + shifts += key_shifts[round]; + + t0 = (k0 << shifts) | (k0 >> (28 - shifts)); + t1 = (k1 << shifts) | (k1 >> (28 - shifts)); + + data->de_keysl[15 - round] = + data->en_keysl[round] = comp_maskl[0][(t0 >> 21) & 0x7f] + | comp_maskl[1][(t0 >> 14) & 0x7f] + | comp_maskl[2][(t0 >> 7) & 0x7f] + | comp_maskl[3][t0 & 0x7f] + | comp_maskl[4][(t1 >> 21) & 0x7f] + | comp_maskl[5][(t1 >> 14) & 0x7f] + | comp_maskl[6][(t1 >> 7) & 0x7f] + | comp_maskl[7][t1 & 0x7f]; + + data->de_keysr[15 - round] = + data->en_keysr[round] = comp_maskr[0][(t0 >> 21) & 0x7f] + | comp_maskr[1][(t0 >> 14) & 0x7f] + | comp_maskr[2][(t0 >> 7) & 0x7f] + | comp_maskr[3][t0 & 0x7f] + | comp_maskr[4][(t1 >> 21) & 0x7f] + | comp_maskr[5][(t1 >> 14) & 0x7f] + | comp_maskr[6][(t1 >> 7) & 0x7f] + | comp_maskr[7][t1 & 0x7f]; + } + return(0); +} + +static int +do_des(uint32_t l_in, uint32_t r_in, uint32_t *l_out, uint32_t *r_out, + int count, struct php_crypt_extended_data *data) +{ + /* + * l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format. + */ + uint32_t l, r, *kl, *kr, *kl1, *kr1; + uint32_t f, r48l, r48r, saltbits; + int round; + + if (count == 0) { + return(1); + } else if (count > 0) { + /* + * Encrypting + */ + kl1 = data->en_keysl; + kr1 = data->en_keysr; + } else { + /* + * Decrypting + */ + count = -count; + kl1 = data->de_keysl; + kr1 = data->de_keysr; + } + + /* + * Do initial permutation (IP). + */ + l = ip_maskl[0][l_in >> 24] + | ip_maskl[1][(l_in >> 16) & 0xff] + | ip_maskl[2][(l_in >> 8) & 0xff] + | ip_maskl[3][l_in & 0xff] + | ip_maskl[4][r_in >> 24] + | ip_maskl[5][(r_in >> 16) & 0xff] + | ip_maskl[6][(r_in >> 8) & 0xff] + | ip_maskl[7][r_in & 0xff]; + r = ip_maskr[0][l_in >> 24] + | ip_maskr[1][(l_in >> 16) & 0xff] + | ip_maskr[2][(l_in >> 8) & 0xff] + | ip_maskr[3][l_in & 0xff] + | ip_maskr[4][r_in >> 24] + | ip_maskr[5][(r_in >> 16) & 0xff] + | ip_maskr[6][(r_in >> 8) & 0xff] + | ip_maskr[7][r_in & 0xff]; + + saltbits = data->saltbits; + while (count--) { + /* + * Do each round. + */ + kl = kl1; + kr = kr1; + round = 16; + while (round--) { + /* + * Expand R to 48 bits (simulate the E-box). + */ + r48l = ((r & 0x00000001) << 23) + | ((r & 0xf8000000) >> 9) + | ((r & 0x1f800000) >> 11) + | ((r & 0x01f80000) >> 13) + | ((r & 0x001f8000) >> 15); + + r48r = ((r & 0x0001f800) << 7) + | ((r & 0x00001f80) << 5) + | ((r & 0x000001f8) << 3) + | ((r & 0x0000001f) << 1) + | ((r & 0x80000000) >> 31); + /* + * Do salting for crypt() and friends, and + * XOR with the permuted key. + */ + f = (r48l ^ r48r) & saltbits; + r48l ^= f ^ *kl++; + r48r ^= f ^ *kr++; + /* + * Do sbox lookups (which shrink it back to 32 bits) + * and do the pbox permutation at the same time. + */ + f = psbox[0][m_sbox[0][r48l >> 12]] + | psbox[1][m_sbox[1][r48l & 0xfff]] + | psbox[2][m_sbox[2][r48r >> 12]] + | psbox[3][m_sbox[3][r48r & 0xfff]]; + /* + * Now that we've permuted things, complete f(). + */ + f ^= l; + l = r; + r = f; + } + r = l; + l = f; + } + /* + * Do final permutation (inverse of IP). + */ + *l_out = fp_maskl[0][l >> 24] + | fp_maskl[1][(l >> 16) & 0xff] + | fp_maskl[2][(l >> 8) & 0xff] + | fp_maskl[3][l & 0xff] + | fp_maskl[4][r >> 24] + | fp_maskl[5][(r >> 16) & 0xff] + | fp_maskl[6][(r >> 8) & 0xff] + | fp_maskl[7][r & 0xff]; + *r_out = fp_maskr[0][l >> 24] + | fp_maskr[1][(l >> 16) & 0xff] + | fp_maskr[2][(l >> 8) & 0xff] + | fp_maskr[3][l & 0xff] + | fp_maskr[4][r >> 24] + | fp_maskr[5][(r >> 16) & 0xff] + | fp_maskr[6][(r >> 8) & 0xff] + | fp_maskr[7][r & 0xff]; + return(0); +} + +static int +des_cipher(const char *in, char *out, uint32_t salt, int count, + struct php_crypt_extended_data *data) +{ + uint32_t l_out, r_out, rawl, rawr; + int retval; + + setup_salt(salt, data); + + rawl = + (uint32_t)(u_char)in[3] | + ((uint32_t)(u_char)in[2] << 8) | + ((uint32_t)(u_char)in[1] << 16) | + ((uint32_t)(u_char)in[0] << 24); + rawr = + (uint32_t)(u_char)in[7] | + ((uint32_t)(u_char)in[6] << 8) | + ((uint32_t)(u_char)in[5] << 16) | + ((uint32_t)(u_char)in[4] << 24); + + retval = do_des(rawl, rawr, &l_out, &r_out, count, data); + + out[0] = l_out >> 24; + out[1] = l_out >> 16; + out[2] = l_out >> 8; + out[3] = l_out; + out[4] = r_out >> 24; + out[5] = r_out >> 16; + out[6] = r_out >> 8; + out[7] = r_out; + + return(retval); +} + +char * +_crypt_extended_r(const char *key, const char *setting, + struct php_crypt_extended_data *data) +{ + int i; + uint32_t count, salt, l, r0, r1, keybuf[2]; + u_char *p, *q; + + if (!data->initialized) + des_init_local(data); + + /* + * Copy the key, shifting each character up by one bit + * and padding with zeros. + */ + q = (u_char *) keybuf; + while (q - (u_char *) keybuf < sizeof(keybuf)) { + *q++ = *key << 1; + if (*key) + key++; + } + if (des_setkey((u_char *) keybuf, data)) + return(NULL); + + if (*setting == _PASSWORD_EFMT1) { + /* + * "new"-style: + * setting - underscore, 4 chars of count, 4 chars of salt + * key - unlimited characters + */ + for (i = 1, count = 0; i < 5; i++) { + int value = ascii_to_bin(setting[i]); + if (ascii64[value] != setting[i]) + return(NULL); + count |= value << (i - 1) * 6; + } + if (!count) + return(NULL); + + for (i = 5, salt = 0; i < 9; i++) { + int value = ascii_to_bin(setting[i]); + if (ascii64[value] != setting[i]) + return(NULL); + salt |= value << (i - 5) * 6; + } + + while (*key) { + /* + * Encrypt the key with itself. + */ + if (des_cipher((u_char *) keybuf, (u_char *) keybuf, + 0, 1, data)) + return(NULL); + /* + * And XOR with the next 8 characters of the key. + */ + q = (u_char *) keybuf; + while (q - (u_char *) keybuf < sizeof(keybuf) && *key) + *q++ ^= *key++ << 1; + + if (des_setkey((u_char *) keybuf, data)) + return(NULL); + } + memcpy(data->output, setting, 9); + data->output[9] = '\0'; + p = (u_char *) data->output + 9; + } else { + /* + * "old"-style: + * setting - 2 chars of salt + * key - up to 8 characters + */ + count = 25; + + if (ascii_is_unsafe(setting[0]) || ascii_is_unsafe(setting[1])) + return(NULL); + + salt = (ascii_to_bin(setting[1]) << 6) + | ascii_to_bin(setting[0]); + + data->output[0] = setting[0]; + data->output[1] = setting[1]; + p = (u_char *) data->output + 2; + } + setup_salt(salt, data); + /* + * Do it. + */ + if (do_des(0, 0, &r0, &r1, count, data)) + return(NULL); + /* + * Now encode the result... + */ + l = (r0 >> 8); + *p++ = ascii64[(l >> 18) & 0x3f]; + *p++ = ascii64[(l >> 12) & 0x3f]; + *p++ = ascii64[(l >> 6) & 0x3f]; + *p++ = ascii64[l & 0x3f]; + + l = (r0 << 16) | ((r1 >> 16) & 0xffff); + *p++ = ascii64[(l >> 18) & 0x3f]; + *p++ = ascii64[(l >> 12) & 0x3f]; + *p++ = ascii64[(l >> 6) & 0x3f]; + *p++ = ascii64[l & 0x3f]; + + l = r1 << 2; + *p++ = ascii64[(l >> 12) & 0x3f]; + *p++ = ascii64[(l >> 6) & 0x3f]; + *p++ = ascii64[l & 0x3f]; + *p = 0; + + return(data->output); +} + +#ifdef TEST +static char * +_crypt_extended(const char *key, const char *setting) +{ + static int initialized = 0; + static struct php_crypt_extended_data data; + + if (!initialized) { + _crypt_extended_init(); + initialized = 1; + data.initialized = 0; + } + return _crypt_extended_r(key, setting, &data); +} + +#define crypt _crypt_extended + +static struct { + char *hash; + char *pw; +} tests[] = { +/* "new"-style */ + {"_J9..CCCCXBrJUJV154M", "U*U*U*U*"}, + {"_J9..CCCCXUhOBTXzaiE", "U*U***U"}, + {"_J9..CCCC4gQ.mB/PffM", "U*U***U*"}, + {"_J9..XXXXvlzQGqpPPdk", "*U*U*U*U"}, + {"_J9..XXXXsqM/YSSP..Y", "*U*U*U*U*"}, + {"_J9..XXXXVL7qJCnku0I", "*U*U*U*U*U*U*U*U"}, + {"_J9..XXXXAj8cFbP5scI", "*U*U*U*U*U*U*U*U*"}, + {"_J9..SDizh.vll5VED9g", "ab1234567"}, + {"_J9..SDizRjWQ/zePPHc", "cr1234567"}, + {"_J9..SDizxmRI1GjnQuE", "zxyDPWgydbQjgq"}, + {"_K9..SaltNrQgIYUAeoY", "726 even"}, + {"_J9..SDSD5YGyRCr4W4c", ""}, +/* "old"-style, valid salts */ + {"CCNf8Sbh3HDfQ", "U*U*U*U*"}, + {"CCX.K.MFy4Ois", "U*U***U"}, + {"CC4rMpbg9AMZ.", "U*U***U*"}, + {"XXxzOu6maQKqQ", "*U*U*U*U"}, + {"SDbsugeBiC58A", ""}, + {"./xZjzHv5vzVE", "password"}, + {"0A2hXM1rXbYgo", "password"}, + {"A9RXdR23Y.cY6", "password"}, + {"ZziFATVXHo2.6", "password"}, + {"zZDDIZ0NOlPzw", "password"}, +/* "old"-style, "reasonable" invalid salts, UFC-crypt behavior expected */ + {"\001\002wyd0KZo65Jo", "password"}, + {"a_C10Dk/ExaG.", "password"}, + {"~\377.5OTsRVjwLo", "password"}, +/* The below are erroneous inputs, so NULL return is expected/required */ + {"", ""}, /* no salt */ + {" ", ""}, /* setting string is too short */ + {"a:", ""}, /* unsafe character */ + {"\na", ""}, /* unsafe character */ + {"_/......", ""}, /* setting string is too short for its type */ + {"_........", ""}, /* zero iteration count */ + {"_/!......", ""}, /* invalid character in count */ + {"_/......!", ""}, /* invalid character in salt */ + {NULL} +}; + +int main(void) +{ + int i; + + for (i = 0; tests[i].hash; i++) { + char *hash = crypt(tests[i].pw, tests[i].hash); + if (!hash && strlen(tests[i].hash) < 13) + continue; /* expected failure */ + if (!strcmp(hash, tests[i].hash)) + continue; /* expected success */ + puts("FAILED"); + return 1; + } + + puts("PASSED"); + + return 0; +} +#endif diff --git a/ext/standard/crypt_freesec.h b/ext/standard/crypt_freesec.h new file mode 100644 index 0000000..a87663d --- /dev/null +++ b/ext/standard/crypt_freesec.h @@ -0,0 +1,49 @@ +/* $Id$ */ + +#ifndef _CRYPT_FREESEC_H +#define _CRYPT_FREESEC_H + +#if PHP_WIN32 +# include "win32/php_stdint.h" +# ifndef inline +# define inline __inline +# endif +#else +# include "php_config.h" +# if HAVE_INTTYPES_H +# include +# elif HAVE_STDINT_H +# include +# endif +# ifndef HAVE_UINT32_T +# if SIZEOF_INT == 4 +typedef unsigned int uint32_t; +# elif SIZEOF_LONG == 4 +typedef unsigned long int uint32_t; +# endif +# endif +#endif + +#define MD5_HASH_MAX_LEN 120 + +struct php_crypt_extended_data { + int initialized; + uint32_t saltbits; + uint32_t old_salt; + uint32_t en_keysl[16], en_keysr[16]; + uint32_t de_keysl[16], de_keysr[16]; + uint32_t old_rawkey0, old_rawkey1; + char output[21]; +}; + +/* + * _crypt_extended_init() must be called explicitly before first use of + * _crypt_extended_r(). + */ + +void _crypt_extended_init(void); + +char *_crypt_extended_r(const char *key, const char *setting, + struct php_crypt_extended_data *data); + +#endif diff --git a/ext/standard/crypt_sha256.c b/ext/standard/crypt_sha256.c new file mode 100644 index 0000000..d334e3d --- /dev/null +++ b/ext/standard/crypt_sha256.c @@ -0,0 +1,759 @@ +/* SHA256-based Unix crypt implementation. + Released into the Public Domain by Ulrich Drepper . */ +/* Windows VC++ port by Pierre Joye */ + +#include "php.h" +#include "php_main.h" + +#include +#include + +#ifdef PHP_WIN32 +# include "win32/php_stdint.h" +# define __alignof__ __alignof +# define alloca _alloca +#else +# if HAVE_INTTYPES_H +# include +# elif HAVE_STDINT_H +# include +# endif +# ifndef HAVE_ALIGNOF +# include +# define __alignof__(type) offsetof (struct { char c; type member;}, member) +# endif +# if HAVE_ATTRIBUTE_ALIGNED +# define ALIGNED(size) __attribute__ ((__aligned__ (size))) +# else +# define ALIGNED(size) +# endif +#endif + +#include +#include + +#ifdef PHP_WIN32 +# include +#else +# include +# include +# if HAVE_STRING_H +# include +# else +# include +# endif +#endif + +char * __php_stpncpy(char *dst, const char *src, size_t len) +{ + size_t n = strlen(src); + if (n > len) { + n = len; + } + return strncpy(dst, src, len) + n; +} + +void * __php_mempcpy(void * dst, const void * src, size_t len) +{ + return (((char *)memcpy(dst, src, len)) + len); +} + +#ifndef MIN +# define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif +#ifndef MAX +# define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif + +/* Structure to save state of computation between the single steps. */ +struct sha256_ctx { + uint32_t H[8]; + + uint32_t total[2]; + uint32_t buflen; + char buffer[128]; /* NB: always correctly aligned for uint32_t. */ +}; + +#if PHP_WIN32 || (!defined(WORDS_BIGENDIAN)) +# define SWAP(n) \ + (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) +#else +# define SWAP(n) (n) +#endif + +/* This array contains the bytes used to pad the buffer to the next + 64-byte boundary. (FIPS 180-2:5.1.1) */ +static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; + + +/* Constants for SHA256 from FIPS 180-2:4.2.2. */ +static const uint32_t K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + + +/* Process LEN bytes of BUFFER, accumulating context into CTX. + It is assumed that LEN % 64 == 0. */ +static void sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx) { + const uint32_t *words = buffer; + size_t nwords = len / sizeof (uint32_t); + unsigned int t; + + uint32_t a = ctx->H[0]; + uint32_t b = ctx->H[1]; + uint32_t c = ctx->H[2]; + uint32_t d = ctx->H[3]; + uint32_t e = ctx->H[4]; + uint32_t f = ctx->H[5]; + uint32_t g = ctx->H[6]; + uint32_t h = ctx->H[7]; + + /* First increment the byte count. FIPS 180-2 specifies the possible + length of the file up to 2^64 bits. Here we only compute the + number of bytes. Do a double word increment. */ + ctx->total[0] += len; + if (ctx->total[0] < len) { + ++ctx->total[1]; + } + + /* Process all bytes in the buffer with 64 bytes in each round of + the loop. */ + while (nwords > 0) { + uint32_t W[64]; + uint32_t a_save = a; + uint32_t b_save = b; + uint32_t c_save = c; + uint32_t d_save = d; + uint32_t e_save = e; + uint32_t f_save = f; + uint32_t g_save = g; + uint32_t h_save = h; + + /* Operators defined in FIPS 180-2:4.1.2. */ +#define Ch(x, y, z) ((x & y) ^ (~x & z)) +#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z)) +#define S0(x) (CYCLIC (x, 2) ^ CYCLIC (x, 13) ^ CYCLIC (x, 22)) +#define S1(x) (CYCLIC (x, 6) ^ CYCLIC (x, 11) ^ CYCLIC (x, 25)) +#define R0(x) (CYCLIC (x, 7) ^ CYCLIC (x, 18) ^ (x >> 3)) +#define R1(x) (CYCLIC (x, 17) ^ CYCLIC (x, 19) ^ (x >> 10)) + + /* It is unfortunate that C does not provide an operator for + cyclic rotation. Hope the C compiler is smart enough. */ +#define CYCLIC(w, s) ((w >> s) | (w << (32 - s))) + + /* Compute the message schedule according to FIPS 180-2:6.2.2 step 2. */ + for (t = 0; t < 16; ++t) { + W[t] = SWAP (*words); + ++words; + } + for (t = 16; t < 64; ++t) + W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16]; + + /* The actual computation according to FIPS 180-2:6.2.2 step 3. */ + for (t = 0; t < 64; ++t) { + uint32_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t]; + uint32_t T2 = S0 (a) + Maj (a, b, c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + } + + /* Add the starting values of the context according to FIPS 180-2:6.2.2 + step 4. */ + a += a_save; + b += b_save; + c += c_save; + d += d_save; + e += e_save; + f += f_save; + g += g_save; + h += h_save; + + /* Prepare for the next round. */ + nwords -= 16; + } + + /* Put checksum in context given as argument. */ + ctx->H[0] = a; + ctx->H[1] = b; + ctx->H[2] = c; + ctx->H[3] = d; + ctx->H[4] = e; + ctx->H[5] = f; + ctx->H[6] = g; + ctx->H[7] = h; +} + + +/* Initialize structure containing state of computation. + (FIPS 180-2:5.3.2) */ +static void sha256_init_ctx(struct sha256_ctx *ctx) { + ctx->H[0] = 0x6a09e667; + ctx->H[1] = 0xbb67ae85; + ctx->H[2] = 0x3c6ef372; + ctx->H[3] = 0xa54ff53a; + ctx->H[4] = 0x510e527f; + ctx->H[5] = 0x9b05688c; + ctx->H[6] = 0x1f83d9ab; + ctx->H[7] = 0x5be0cd19; + + ctx->total[0] = ctx->total[1] = 0; + ctx->buflen = 0; +} + + +/* Process the remaining bytes in the internal buffer and the usual + prolog according to the standard and write the result to RESBUF. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +static void * sha256_finish_ctx(struct sha256_ctx *ctx, void *resbuf) { + /* Take yet unprocessed bytes into account. */ + uint32_t bytes = ctx->buflen; + size_t pad; + unsigned int i; + + /* Now count remaining bytes. */ + ctx->total[0] += bytes; + if (ctx->total[0] < bytes) { + ++ctx->total[1]; + } + + pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; + memcpy(&ctx->buffer[bytes], fillbuf, pad); + + /* Put the 64-bit file length in *bits* at the end of the buffer. */ + *(uint32_t *) &ctx->buffer[bytes + pad + 4] = SWAP (ctx->total[0] << 3); + *(uint32_t *) &ctx->buffer[bytes + pad] = SWAP ((ctx->total[1] << 3) | + (ctx->total[0] >> 29)); + + /* Process last bytes. */ + sha256_process_block(ctx->buffer, bytes + pad + 8, ctx); + + /* Put result from CTX in first 32 bytes following RESBUF. */ + for (i = 0; i < 8; ++i) { + ((uint32_t *) resbuf)[i] = SWAP(ctx->H[i]); + } + + return resbuf; +} + + +static void sha256_process_bytes(const void *buffer, size_t len, struct sha256_ctx *ctx) { + /* When we already have some bits in our internal buffer concatenate + both inputs first. */ + if (ctx->buflen != 0) { + size_t left_over = ctx->buflen; + size_t add = 128 - left_over > len ? len : 128 - left_over; + + memcpy(&ctx->buffer[left_over], buffer, add); + ctx->buflen += add; + + if (ctx->buflen > 64) { + sha256_process_block(ctx->buffer, ctx->buflen & ~63, ctx); + ctx->buflen &= 63; + /* The regions in the following copy operation cannot overlap. */ + memcpy(ctx->buffer, &ctx->buffer[(left_over + add) & ~63], ctx->buflen); + } + + buffer = (const char *) buffer + add; + len -= add; + } + + /* Process available complete blocks. */ + if (len >= 64) { +/* To check alignment gcc has an appropriate operator. Other +compilers don't. */ +#if __GNUC__ >= 2 +# define UNALIGNED_P(p) (((uintptr_t) p) % __alignof__ (uint32_t) != 0) +#else +# define UNALIGNED_P(p) (((uintptr_t) p) % sizeof (uint32_t) != 0) +#endif + if (UNALIGNED_P (buffer)) + while (len > 64) { + sha256_process_block(memcpy(ctx->buffer, buffer, 64), 64, ctx); + buffer = (const char *) buffer + 64; + len -= 64; + } else { + sha256_process_block(buffer, len & ~63, ctx); + buffer = (const char *) buffer + (len & ~63); + len &= 63; + } + } + + /* Move remaining bytes into internal buffer. */ + if (len > 0) { + size_t left_over = ctx->buflen; + + memcpy(&ctx->buffer[left_over], buffer, len); + left_over += len; + if (left_over >= 64) { + sha256_process_block(ctx->buffer, 64, ctx); + left_over -= 64; + memcpy(ctx->buffer, &ctx->buffer[64], left_over); + } + ctx->buflen = left_over; + } +} + + +/* Define our magic string to mark salt for SHA256 "encryption" + replacement. */ +static const char sha256_salt_prefix[] = "$5$"; + +/* Prefix for optional rounds specification. */ +static const char sha256_rounds_prefix[] = "rounds="; + +/* Maximum salt string length. */ +#define SALT_LEN_MAX 16 +/* Default number of rounds if not explicitly specified. */ +#define ROUNDS_DEFAULT 5000 +/* Minimum number of rounds. */ +#define ROUNDS_MIN 1000 +/* Maximum number of rounds. */ +#define ROUNDS_MAX 999999999 + +/* Table with characters for base64 transformation. */ +static const char b64t[64] = +"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int buflen) +{ +#ifdef PHP_WIN32 +# if _MSC <= 1300 +# pragma pack(push, 16) + unsigned char alt_result[32]; + unsigned char temp_result[32]; +# pragma pack(pop) +# else + __declspec(align(32)) unsigned char alt_result[32]; + __declspec(align(32)) unsigned char temp_result[32]; +# endif +#else + unsigned char alt_result[32] ALIGNED(__alignof__ (uint32_t)); + unsigned char temp_result[32] ALIGNED(__alignof__ (uint32_t)); +#endif + + struct sha256_ctx ctx; + struct sha256_ctx alt_ctx; + size_t salt_len; + size_t key_len; + size_t cnt; + char *cp; + char *copied_key = NULL; + char *copied_salt = NULL; + char *p_bytes; + char *s_bytes; + /* Default number of rounds. */ + size_t rounds = ROUNDS_DEFAULT; + zend_bool rounds_custom = 0; + + /* Find beginning of salt string. The prefix should normally always + be present. Just in case it is not. */ + if (strncmp(sha256_salt_prefix, salt, sizeof(sha256_salt_prefix) - 1) == 0) { + /* Skip salt prefix. */ + salt += sizeof(sha256_salt_prefix) - 1; + } + + if (strncmp(salt, sha256_rounds_prefix, sizeof(sha256_rounds_prefix) - 1) == 0) { + const char *num = salt + sizeof(sha256_rounds_prefix) - 1; + char *endp; + unsigned long int srounds = strtoul(num, &endp, 10); + if (*endp == '$') { + salt = endp + 1; + rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX)); + rounds_custom = 1; + } + } + + salt_len = MIN(strcspn(salt, "$"), SALT_LEN_MAX); + key_len = strlen(key); + + if ((key - (char *) 0) % __alignof__ (uint32_t) != 0) { + char *tmp = (char *) alloca(key_len + __alignof__(uint32_t)); + key = copied_key = memcpy(tmp + __alignof__(uint32_t) - (tmp - (char *) 0) % __alignof__(uint32_t), key, key_len); + } + + if ((salt - (char *) 0) % __alignof__(uint32_t) != 0) { + char *tmp = (char *) alloca(salt_len + 1 + __alignof__(uint32_t)); + salt = copied_salt = + memcpy(tmp + __alignof__(uint32_t) - (tmp - (char *) 0) % __alignof__ (uint32_t), salt, salt_len); + copied_salt[salt_len] = 0; + } + + /* Prepare for the real work. */ + sha256_init_ctx(&ctx); + + /* Add the key string. */ + sha256_process_bytes(key, key_len, &ctx); + + /* The last part is the salt string. This must be at most 16 + characters and it ends at the first `$' character (for + compatibility with existing implementations). */ + sha256_process_bytes(salt, salt_len, &ctx); + + + /* Compute alternate SHA256 sum with input KEY, SALT, and KEY. The + final result will be added to the first context. */ + sha256_init_ctx(&alt_ctx); + + /* Add key. */ + sha256_process_bytes(key, key_len, &alt_ctx); + + /* Add salt. */ + sha256_process_bytes(salt, salt_len, &alt_ctx); + + /* Add key again. */ + sha256_process_bytes(key, key_len, &alt_ctx); + + /* Now get result of this (32 bytes) and add it to the other + context. */ + sha256_finish_ctx(&alt_ctx, alt_result); + + /* Add for any character in the key one byte of the alternate sum. */ + for (cnt = key_len; cnt > 32; cnt -= 32) { + sha256_process_bytes(alt_result, 32, &ctx); + } + sha256_process_bytes(alt_result, cnt, &ctx); + + /* Take the binary representation of the length of the key and for every + 1 add the alternate sum, for every 0 the key. */ + for (cnt = key_len; cnt > 0; cnt >>= 1) { + if ((cnt & 1) != 0) { + sha256_process_bytes(alt_result, 32, &ctx); + } else { + sha256_process_bytes(key, key_len, &ctx); + } + } + + /* Create intermediate result. */ + sha256_finish_ctx(&ctx, alt_result); + + /* Start computation of P byte sequence. */ + sha256_init_ctx(&alt_ctx); + + /* For every character in the password add the entire password. */ + for (cnt = 0; cnt < key_len; ++cnt) { + sha256_process_bytes(key, key_len, &alt_ctx); + } + + /* Finish the digest. */ + sha256_finish_ctx(&alt_ctx, temp_result); + + /* Create byte sequence P. */ + cp = p_bytes = alloca(key_len); + for (cnt = key_len; cnt >= 32; cnt -= 32) { + cp = __php_mempcpy((void *)cp, (const void *)temp_result, 32); + } + memcpy(cp, temp_result, cnt); + + /* Start computation of S byte sequence. */ + sha256_init_ctx(&alt_ctx); + + /* For every character in the password add the entire password. */ + for (cnt = 0; cnt < (size_t) (16 + alt_result[0]); ++cnt) { + sha256_process_bytes(salt, salt_len, &alt_ctx); + } + + /* Finish the digest. */ + sha256_finish_ctx(&alt_ctx, temp_result); + + /* Create byte sequence S. */ + cp = s_bytes = alloca(salt_len); + for (cnt = salt_len; cnt >= 32; cnt -= 32) { + cp = __php_mempcpy(cp, temp_result, 32); + } + memcpy(cp, temp_result, cnt); + + /* Repeatedly run the collected hash value through SHA256 to burn + CPU cycles. */ + for (cnt = 0; cnt < rounds; ++cnt) { + /* New context. */ + sha256_init_ctx(&ctx); + + /* Add key or last result. */ + if ((cnt & 1) != 0) { + sha256_process_bytes(p_bytes, key_len, &ctx); + } else { + sha256_process_bytes(alt_result, 32, &ctx); + } + + /* Add salt for numbers not divisible by 3. */ + if (cnt % 3 != 0) { + sha256_process_bytes(s_bytes, salt_len, &ctx); + } + + /* Add key for numbers not divisible by 7. */ + if (cnt % 7 != 0) { + sha256_process_bytes(p_bytes, key_len, &ctx); + } + + /* Add key or last result. */ + if ((cnt & 1) != 0) { + sha256_process_bytes(alt_result, 32, &ctx); + } else { + sha256_process_bytes(p_bytes, key_len, &ctx); + } + + /* Create intermediate result. */ + sha256_finish_ctx(&ctx, alt_result); + } + + /* Now we can construct the result string. It consists of three + parts. */ + cp = __php_stpncpy(buffer, sha256_salt_prefix, MAX(0, buflen)); + buflen -= sizeof(sha256_salt_prefix) - 1; + + if (rounds_custom) { +#ifdef PHP_WIN32 + int n = _snprintf(cp, MAX(0, buflen), "%s%u$", sha256_rounds_prefix, rounds); +#else + int n = snprintf(cp, MAX(0, buflen), "%s%zu$", sha256_rounds_prefix, rounds); +#endif + cp += n; + buflen -= n; + } + + cp = __php_stpncpy(cp, salt, MIN ((size_t) MAX (0, buflen), salt_len)); + buflen -= MIN((size_t) MAX (0, buflen), salt_len); + + if (buflen > 0) { + *cp++ = '$'; + --buflen; + } + +#define b64_from_24bit(B2, B1, B0, N) \ + do { \ + unsigned int w = ((B2) << 16) | ((B1) << 8) | (B0); \ + int n = (N); \ + while (n-- > 0 && buflen > 0) \ + { \ + *cp++ = b64t[w & 0x3f]; \ + --buflen; \ + w >>= 6; \ + } \ + } while (0) + + b64_from_24bit(alt_result[0], alt_result[10], alt_result[20], 4); + b64_from_24bit(alt_result[21], alt_result[1], alt_result[11], 4); + b64_from_24bit(alt_result[12], alt_result[22], alt_result[2], 4); + b64_from_24bit(alt_result[3], alt_result[13], alt_result[23], 4); + b64_from_24bit(alt_result[24], alt_result[4], alt_result[14], 4); + b64_from_24bit(alt_result[15], alt_result[25], alt_result[5], 4); + b64_from_24bit(alt_result[6], alt_result[16], alt_result[26], 4); + b64_from_24bit(alt_result[27], alt_result[7], alt_result[17], 4); + b64_from_24bit(alt_result[18], alt_result[28], alt_result[8], 4); + b64_from_24bit(alt_result[9], alt_result[19], alt_result[29], 4); + b64_from_24bit(0, alt_result[31], alt_result[30], 3); + if (buflen <= 0) { + errno = ERANGE; + buffer = NULL; + } else + *cp = '\0'; /* Terminate the string. */ + + /* Clear the buffer for the intermediate result so that people + attaching to processes or reading core dumps cannot get any + information. We do it in this way to clear correct_words[] + inside the SHA256 implementation as well. */ + sha256_init_ctx(&ctx); + sha256_finish_ctx(&ctx, alt_result); + memset(temp_result, '\0', sizeof(temp_result)); + memset(p_bytes, '\0', key_len); + memset(s_bytes, '\0', salt_len); + memset(&ctx, '\0', sizeof(ctx)); + memset(&alt_ctx, '\0', sizeof(alt_ctx)); + + if (copied_key != NULL) { + memset(copied_key, '\0', key_len); + + } + if (copied_salt != NULL) { + memset(copied_salt, '\0', salt_len); + } + + return buffer; +} + + +/* This entry point is equivalent to the `crypt' function in Unix + libcs. */ +char * php_sha256_crypt(const char *key, const char *salt) +{ + /* We don't want to have an arbitrary limit in the size of the + password. We can compute an upper bound for the size of the + result in advance and so we can prepare the buffer we pass to + `sha256_crypt_r'. */ + static char *buffer; + static int buflen; + int needed = (sizeof(sha256_salt_prefix) - 1 + + sizeof(sha256_rounds_prefix) + 9 + 1 + + strlen(salt) + 1 + 43 + 1); + + if (buflen < needed) { + char *new_buffer = (char *) realloc(buffer, needed); + if (new_buffer == NULL) { + return NULL; + } + + buffer = new_buffer; + buflen = needed; + } + + return php_sha256_crypt_r(key, salt, buffer, buflen); +} + + +#ifdef TEST +static const struct +{ + const char *input; + const char result[32]; +} tests[] = + { + /* Test vectors from FIPS 180-2: appendix B.1. */ + { "abc", + "\xba\x78\x16\xbf\x8f\x01\xcf\xea\x41\x41\x40\xde\x5d\xae\x22\x23" + "\xb0\x03\x61\xa3\x96\x17\x7a\x9c\xb4\x10\xff\x61\xf2\x00\x15\xad" }, + /* Test vectors from FIPS 180-2: appendix B.2. */ + { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + "\x24\x8d\x6a\x61\xd2\x06\x38\xb8\xe5\xc0\x26\x93\x0c\x3e\x60\x39" + "\xa3\x3c\xe4\x59\x64\xff\x21\x67\xf6\xec\xed\xd4\x19\xdb\x06\xc1" }, + /* Test vectors from the NESSIE project. */ + { "", + "\xe3\xb0\xc4\x42\x98\xfc\x1c\x14\x9a\xfb\xf4\xc8\x99\x6f\xb9\x24" + "\x27\xae\x41\xe4\x64\x9b\x93\x4c\xa4\x95\x99\x1b\x78\x52\xb8\x55" }, + { "a", + "\xca\x97\x81\x12\xca\x1b\xbd\xca\xfa\xc2\x31\xb3\x9a\x23\xdc\x4d" + "\xa7\x86\xef\xf8\x14\x7c\x4e\x72\xb9\x80\x77\x85\xaf\xee\x48\xbb" }, + { "message digest", + "\xf7\x84\x6f\x55\xcf\x23\xe1\x4e\xeb\xea\xb5\xb4\xe1\x55\x0c\xad" + "\x5b\x50\x9e\x33\x48\xfb\xc4\xef\xa3\xa1\x41\x3d\x39\x3c\xb6\x50" }, + { "abcdefghijklmnopqrstuvwxyz", + "\x71\xc4\x80\xdf\x93\xd6\xae\x2f\x1e\xfa\xd1\x44\x7c\x66\xc9\x52" + "\x5e\x31\x62\x18\xcf\x51\xfc\x8d\x9e\xd8\x32\xf2\xda\xf1\x8b\x73" }, + { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + "\x24\x8d\x6a\x61\xd2\x06\x38\xb8\xe5\xc0\x26\x93\x0c\x3e\x60\x39" + "\xa3\x3c\xe4\x59\x64\xff\x21\x67\xf6\xec\xed\xd4\x19\xdb\x06\xc1" }, + { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + "\xdb\x4b\xfc\xbd\x4d\xa0\xcd\x85\xa6\x0c\x3c\x37\xd3\xfb\xd8\x80" + "\x5c\x77\xf1\x5f\xc6\xb1\xfd\xfe\x61\x4e\xe0\xa7\xc8\xfd\xb4\xc0" }, + { "123456789012345678901234567890123456789012345678901234567890" + "12345678901234567890", + "\xf3\x71\xbc\x4a\x31\x1f\x2b\x00\x9e\xef\x95\x2d\xd8\x3c\xa8\x0e" + "\x2b\x60\x02\x6c\x8e\x93\x55\x92\xd0\xf9\xc3\x08\x45\x3c\x81\x3e" } + }; +#define ntests (sizeof (tests) / sizeof (tests[0])) + + +static const struct +{ + const char *salt; + const char *input; + const char *expected; +} tests2[] = +{ + { "$5$saltstring", "Hello world!", + "$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5" }, + { "$5$rounds=10000$saltstringsaltstring", "Hello world!", + "$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2." + "opqey6IcA" }, + { "$5$rounds=5000$toolongsaltstring", "This is just a test", + "$5$rounds=5000$toolongsaltstrin$Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8" + "mGRcvxa5" }, + { "$5$rounds=1400$anotherlongsaltstring", + "a very much longer text to encrypt. This one even stretches over more" + "than one line.", + "$5$rounds=1400$anotherlongsalts$Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12" + "oP84Bnq1" }, + { "$5$rounds=77777$short", + "we have a short salt string but not a short password", + "$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/" }, + { "$5$rounds=123456$asaltof16chars..", "a short string", + "$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/" + "cZKmF/wJvD" }, + { "$5$rounds=10$roundstoolow", "the minimum number is still observed", + "$5$rounds=1000$roundstoolow$yfvwcWrQ8l/K0DAWyuPMDNHpIVlTQebY9l/gL97" + "2bIC" }, +}; +#define ntests2 (sizeof (tests2) / sizeof (tests2[0])) + + +int main(void) { + struct sha256_ctx ctx; + char sum[32]; + int result = 0; + int cnt, i; + char buf[1000]; + static const char expected[32] = + "\xcd\xc7\x6e\x5c\x99\x14\xfb\x92\x81\xa1\xc7\xe2\x84\xd7\x3e\x67" + "\xf1\x80\x9a\x48\xa4\x97\x20\x0e\x04\x6d\x39\xcc\xc7\x11\x2c\xd0"; + + for (cnt = 0; cnt < (int) ntests; ++cnt) { + sha256_init_ctx(&ctx); + sha256_process_bytes(tests[cnt].input, strlen(tests[cnt].input), &ctx); + sha256_finish_ctx(&ctx, sum); + if (memcmp(tests[cnt].result, sum, 32) != 0) { + printf("test %d run %d failed\n", cnt, 1); + result = 1; + } + + sha256_init_ctx(&ctx); + for (i = 0; tests[cnt].input[i] != '\0'; ++i) { + sha256_process_bytes(&tests[cnt].input[i], 1, &ctx); + } + sha256_finish_ctx(&ctx, sum); + if (memcmp(tests[cnt].result, sum, 32) != 0) { + printf("test %d run %d failed\n", cnt, 2); + result = 1; + } + } + + /* Test vector from FIPS 180-2: appendix B.3. */ + + memset(buf, 'a', sizeof(buf)); + sha256_init_ctx(&ctx); + for (i = 0; i < 1000; ++i) { + sha256_process_bytes (buf, sizeof (buf), &ctx); + } + + sha256_finish_ctx(&ctx, sum); + + if (memcmp(expected, sum, 32) != 0) { + printf("test %d failed\n", cnt); + result = 1; + } + + for (cnt = 0; cnt < ntests2; ++cnt) { + char *cp = php_sha256_crypt(tests2[cnt].input, tests2[cnt].salt); + if (strcmp(cp, tests2[cnt].expected) != 0) { + printf("test %d: expected \"%s\", got \"%s\"\n", cnt, tests2[cnt].expected, cp); + result = 1; + } + } + + if (result == 0) + puts("all tests OK"); + + return result; +} +#endif diff --git a/ext/standard/crypt_sha512.c b/ext/standard/crypt_sha512.c new file mode 100644 index 0000000..0955532 --- /dev/null +++ b/ext/standard/crypt_sha512.c @@ -0,0 +1,828 @@ +/* SHA512-based Unix crypt implementation. + Released into the Public Domain by Ulrich Drepper . */ +/* Windows VC++ port by Pierre Joye */ + +#include "php.h" +#include "php_main.h" + +#include +#include +#ifdef PHP_WIN32 +# include "win32/php_stdint.h" +# define __alignof__ __alignof +# define alloca _alloca +#else +# if HAVE_INTTYPES_H +# include +# elif HAVE_STDINT_H +# include +# endif +# ifndef HAVE_ALIGNOF +# include +# define __alignof__(type) offsetof (struct { char c; type member;}, member) +# endif +# if HAVE_ATTRIBUTE_ALIGNED +# define ALIGNED(size) __attribute__ ((__aligned__ (size))) +# else +# define ALIGNED(size) +# endif +#endif + +#include +#include + +#ifdef PHP_WIN32 +# include +#else +# include +# include +# if HAVE_STRING_H +# include +# else +# include +# endif +#endif + +extern void * __php_mempcpy(void * dst, const void * src, size_t len); +extern char * __php_stpncpy(char *dst, const char *src, size_t len); + +#ifndef MIN +# define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif +#ifndef MAX +# define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif + +/* See #51582 */ +#ifndef UINT64_C +# define UINT64_C(value) __CONCAT(value, ULL) +#endif + +/* Structure to save state of computation between the single steps. */ +struct sha512_ctx +{ + uint64_t H[8]; + + uint64_t total[2]; + uint64_t buflen; + char buffer[256]; /* NB: always correctly aligned for uint64_t. */ +}; + + +#if PHP_WIN32 || (!defined(WORDS_BIGENDIAN)) +# define SWAP(n) \ + (((n) << 56) \ + | (((n) & 0xff00) << 40) \ + | (((n) & 0xff0000) << 24) \ + | (((n) & 0xff000000) << 8) \ + | (((n) >> 8) & 0xff000000) \ + | (((n) >> 24) & 0xff0000) \ + | (((n) >> 40) & 0xff00) \ + | ((n) >> 56)) +#else +# define SWAP(n) (n) +#endif + +/* This array contains the bytes used to pad the buffer to the next + 64-byte boundary. (FIPS 180-2:5.1.2) */ +static const unsigned char fillbuf[128] = { 0x80, 0 /* , 0, 0, ... */ }; + +/* Constants for SHA512 from FIPS 180-2:4.2.3. */ +static const uint64_t K[80] = { + UINT64_C (0x428a2f98d728ae22), UINT64_C (0x7137449123ef65cd), + UINT64_C (0xb5c0fbcfec4d3b2f), UINT64_C (0xe9b5dba58189dbbc), + UINT64_C (0x3956c25bf348b538), UINT64_C (0x59f111f1b605d019), + UINT64_C (0x923f82a4af194f9b), UINT64_C (0xab1c5ed5da6d8118), + UINT64_C (0xd807aa98a3030242), UINT64_C (0x12835b0145706fbe), + UINT64_C (0x243185be4ee4b28c), UINT64_C (0x550c7dc3d5ffb4e2), + UINT64_C (0x72be5d74f27b896f), UINT64_C (0x80deb1fe3b1696b1), + UINT64_C (0x9bdc06a725c71235), UINT64_C (0xc19bf174cf692694), + UINT64_C (0xe49b69c19ef14ad2), UINT64_C (0xefbe4786384f25e3), + UINT64_C (0x0fc19dc68b8cd5b5), UINT64_C (0x240ca1cc77ac9c65), + UINT64_C (0x2de92c6f592b0275), UINT64_C (0x4a7484aa6ea6e483), + UINT64_C (0x5cb0a9dcbd41fbd4), UINT64_C (0x76f988da831153b5), + UINT64_C (0x983e5152ee66dfab), UINT64_C (0xa831c66d2db43210), + UINT64_C (0xb00327c898fb213f), UINT64_C (0xbf597fc7beef0ee4), + UINT64_C (0xc6e00bf33da88fc2), UINT64_C (0xd5a79147930aa725), + UINT64_C (0x06ca6351e003826f), UINT64_C (0x142929670a0e6e70), + UINT64_C (0x27b70a8546d22ffc), UINT64_C (0x2e1b21385c26c926), + UINT64_C (0x4d2c6dfc5ac42aed), UINT64_C (0x53380d139d95b3df), + UINT64_C (0x650a73548baf63de), UINT64_C (0x766a0abb3c77b2a8), + UINT64_C (0x81c2c92e47edaee6), UINT64_C (0x92722c851482353b), + UINT64_C (0xa2bfe8a14cf10364), UINT64_C (0xa81a664bbc423001), + UINT64_C (0xc24b8b70d0f89791), UINT64_C (0xc76c51a30654be30), + UINT64_C (0xd192e819d6ef5218), UINT64_C (0xd69906245565a910), + UINT64_C (0xf40e35855771202a), UINT64_C (0x106aa07032bbd1b8), + UINT64_C (0x19a4c116b8d2d0c8), UINT64_C (0x1e376c085141ab53), + UINT64_C (0x2748774cdf8eeb99), UINT64_C (0x34b0bcb5e19b48a8), + UINT64_C (0x391c0cb3c5c95a63), UINT64_C (0x4ed8aa4ae3418acb), + UINT64_C (0x5b9cca4f7763e373), UINT64_C (0x682e6ff3d6b2b8a3), + UINT64_C (0x748f82ee5defb2fc), UINT64_C (0x78a5636f43172f60), + UINT64_C (0x84c87814a1f0ab72), UINT64_C (0x8cc702081a6439ec), + UINT64_C (0x90befffa23631e28), UINT64_C (0xa4506cebde82bde9), + UINT64_C (0xbef9a3f7b2c67915), UINT64_C (0xc67178f2e372532b), + UINT64_C (0xca273eceea26619c), UINT64_C (0xd186b8c721c0c207), + UINT64_C (0xeada7dd6cde0eb1e), UINT64_C (0xf57d4f7fee6ed178), + UINT64_C (0x06f067aa72176fba), UINT64_C (0x0a637dc5a2c898a6), + UINT64_C (0x113f9804bef90dae), UINT64_C (0x1b710b35131c471b), + UINT64_C (0x28db77f523047d84), UINT64_C (0x32caab7b40c72493), + UINT64_C (0x3c9ebe0a15c9bebc), UINT64_C (0x431d67c49c100d4c), + UINT64_C (0x4cc5d4becb3e42b6), UINT64_C (0x597f299cfc657e2a), + UINT64_C (0x5fcb6fab3ad6faec), UINT64_C (0x6c44198c4a475817) + }; + + +/* Process LEN bytes of BUFFER, accumulating context into CTX. + It is assumed that LEN % 128 == 0. */ +static void +sha512_process_block(const void *buffer, size_t len, struct sha512_ctx *ctx) { + const uint64_t *words = buffer; + size_t nwords = len / sizeof(uint64_t); + uint64_t a = ctx->H[0]; + uint64_t b = ctx->H[1]; + uint64_t c = ctx->H[2]; + uint64_t d = ctx->H[3]; + uint64_t e = ctx->H[4]; + uint64_t f = ctx->H[5]; + uint64_t g = ctx->H[6]; + uint64_t h = ctx->H[7]; + + /* First increment the byte count. FIPS 180-2 specifies the possible + length of the file up to 2^128 bits. Here we only compute the + number of bytes. Do a double word increment. */ + ctx->total[0] += len; + if (ctx->total[0] < len) { + ++ctx->total[1]; + } + + /* Process all bytes in the buffer with 128 bytes in each round of + the loop. */ + while (nwords > 0) { + uint64_t W[80]; + uint64_t a_save = a; + uint64_t b_save = b; + uint64_t c_save = c; + uint64_t d_save = d; + uint64_t e_save = e; + uint64_t f_save = f; + uint64_t g_save = g; + uint64_t h_save = h; + unsigned int t; + +/* Operators defined in FIPS 180-2:4.1.2. */ +#define Ch(x, y, z) ((x & y) ^ (~x & z)) +#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z)) +#define S0(x) (CYCLIC (x, 28) ^ CYCLIC (x, 34) ^ CYCLIC (x, 39)) +#define S1(x) (CYCLIC (x, 14) ^ CYCLIC (x, 18) ^ CYCLIC (x, 41)) +#define R0(x) (CYCLIC (x, 1) ^ CYCLIC (x, 8) ^ (x >> 7)) +#define R1(x) (CYCLIC (x, 19) ^ CYCLIC (x, 61) ^ (x >> 6)) + + /* It is unfortunate that C does not provide an operator for + cyclic rotation. Hope the C compiler is smart enough. */ +#define CYCLIC(w, s) ((w >> s) | (w << (64 - s))) + + /* Compute the message schedule according to FIPS 180-2:6.3.2 step 2. */ + for (t = 0; t < 16; ++t) { + W[t] = SWAP (*words); + ++words; + } + + for (t = 16; t < 80; ++t) { + W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16]; + } + + /* The actual computation according to FIPS 180-2:6.3.2 step 3. */ + for (t = 0; t < 80; ++t) { + uint64_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t]; + uint64_t T2 = S0 (a) + Maj (a, b, c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + } + + /* Add the starting values of the context according to FIPS 180-2:6.3.2 + step 4. */ + a += a_save; + b += b_save; + c += c_save; + d += d_save; + e += e_save; + f += f_save; + g += g_save; + h += h_save; + + /* Prepare for the next round. */ + nwords -= 16; + } + + /* Put checksum in context given as argument. */ + ctx->H[0] = a; + ctx->H[1] = b; + ctx->H[2] = c; + ctx->H[3] = d; + ctx->H[4] = e; + ctx->H[5] = f; + ctx->H[6] = g; + ctx->H[7] = h; +} + + +/* Initialize structure containing state of computation. + (FIPS 180-2:5.3.3) */ +static void sha512_init_ctx (struct sha512_ctx *ctx) { + ctx->H[0] = UINT64_C (0x6a09e667f3bcc908); + ctx->H[1] = UINT64_C (0xbb67ae8584caa73b); + ctx->H[2] = UINT64_C (0x3c6ef372fe94f82b); + ctx->H[3] = UINT64_C (0xa54ff53a5f1d36f1); + ctx->H[4] = UINT64_C (0x510e527fade682d1); + ctx->H[5] = UINT64_C (0x9b05688c2b3e6c1f); + ctx->H[6] = UINT64_C (0x1f83d9abfb41bd6b); + ctx->H[7] = UINT64_C (0x5be0cd19137e2179); + + ctx->total[0] = ctx->total[1] = 0; + ctx->buflen = 0; +} + + +/* Process the remaining bytes in the internal buffer and the usual + prolog according to the standard and write the result to RESBUF. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +static void * sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf) { + /* Take yet unprocessed bytes into account. */ + uint64_t bytes = ctx->buflen; + size_t pad; + unsigned int i; + + /* Now count remaining bytes. */ + ctx->total[0] += bytes; + if (ctx->total[0] < bytes) { + ++ctx->total[1]; + } + + pad = bytes >= 112 ? 128 + 112 - (size_t)bytes : 112 - (size_t)bytes; + memcpy(&ctx->buffer[bytes], fillbuf, pad); + + /* Put the 128-bit file length in *bits* at the end of the buffer. */ + *(uint64_t *) &ctx->buffer[bytes + pad + 8] = SWAP(ctx->total[0] << 3); + *(uint64_t *) &ctx->buffer[bytes + pad] = SWAP((ctx->total[1] << 3) | + (ctx->total[0] >> 61)); + + /* Process last bytes. */ + sha512_process_block(ctx->buffer, (size_t)(bytes + pad + 16), ctx); + + /* Put result from CTX in first 64 bytes following RESBUF. */ + for (i = 0; i < 8; ++i) { + ((uint64_t *) resbuf)[i] = SWAP(ctx->H[i]); + } + + return resbuf; +} + +static void +sha512_process_bytes(const void *buffer, size_t len, struct sha512_ctx *ctx) { + /* When we already have some bits in our internal buffer concatenate + both inputs first. */ + if (ctx->buflen != 0) { + size_t left_over = (size_t)ctx->buflen; + size_t add = (size_t)(256 - left_over > len ? len : 256 - left_over); + + memcpy(&ctx->buffer[left_over], buffer, add); + ctx->buflen += add; + + if (ctx->buflen > 128) { + sha512_process_block(ctx->buffer, ctx->buflen & ~127, ctx); + + ctx->buflen &= 127; + /* The regions in the following copy operation cannot overlap. */ + memcpy(ctx->buffer, &ctx->buffer[(left_over + add) & ~127], + (size_t)ctx->buflen); + } + + buffer = (const char *) buffer + add; + len -= add; + } + + /* Process available complete blocks. */ + if (len >= 128) { +#if !_STRING_ARCH_unaligned +/* To check alignment gcc has an appropriate operator. Other + compilers don't. */ +# if __GNUC__ >= 2 +# define UNALIGNED_P(p) (((uintptr_t) p) % __alignof__ (uint64_t) != 0) +# else +# define UNALIGNED_P(p) (((uintptr_t) p) % sizeof(uint64_t) != 0) +# endif + if (UNALIGNED_P(buffer)) + while (len > 128) { + sha512_process_block(memcpy(ctx->buffer, buffer, 128), 128, ctx); + buffer = (const char *) buffer + 128; + len -= 128; + } + else +#endif + { + sha512_process_block(buffer, len & ~127, ctx); + buffer = (const char *) buffer + (len & ~127); + len &= 127; + } + } + + /* Move remaining bytes into internal buffer. */ + if (len > 0) { + size_t left_over = (size_t)ctx->buflen; + + memcpy(&ctx->buffer[left_over], buffer, len); + left_over += len; + if (left_over >= 128) { + sha512_process_block(ctx->buffer, 128, ctx); + left_over -= 128; + memcpy(ctx->buffer, &ctx->buffer[128], left_over); + } + ctx->buflen = left_over; + } +} + + +/* Define our magic string to mark salt for SHA512 "encryption" + replacement. */ +static const char sha512_salt_prefix[] = "$6$"; + +/* Prefix for optional rounds specification. */ +static const char sha512_rounds_prefix[] = "rounds="; + +/* Maximum salt string length. */ +#define SALT_LEN_MAX 16 +/* Default number of rounds if not explicitly specified. */ +#define ROUNDS_DEFAULT 5000 +/* Minimum number of rounds. */ +#define ROUNDS_MIN 1000 +/* Maximum number of rounds. */ +#define ROUNDS_MAX 999999999 + +/* Table with characters for base64 transformation. */ +static const char b64t[64] = +"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + +char * +php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen) { +#ifdef PHP_WIN32 +# if _MSC <= 1300 +# pragma pack(push, 16) + unsigned char alt_result[64]; + unsigned char temp_result[64]; +# pragma pack(pop) +# else + __declspec(align(64)) unsigned char alt_result[64]; + __declspec(align(64)) unsigned char temp_result[64]; +# endif +#else + unsigned char alt_result[64] ALIGNED(__alignof__ (uint64_t)); + unsigned char temp_result[64] ALIGNED(__alignof__ (uint64_t)); +#endif + struct sha512_ctx ctx; + struct sha512_ctx alt_ctx; + size_t salt_len; + size_t key_len; + size_t cnt; + char *cp; + char *copied_key = NULL; + char *copied_salt = NULL; + char *p_bytes; + char *s_bytes; + /* Default number of rounds. */ + size_t rounds = ROUNDS_DEFAULT; + zend_bool rounds_custom = 0; + + /* Find beginning of salt string. The prefix should normally always + be present. Just in case it is not. */ + if (strncmp(sha512_salt_prefix, salt, sizeof(sha512_salt_prefix) - 1) == 0) { + /* Skip salt prefix. */ + salt += sizeof(sha512_salt_prefix) - 1; + } + + if (strncmp(salt, sha512_rounds_prefix, sizeof(sha512_rounds_prefix) - 1) == 0) { + const char *num = salt + sizeof(sha512_rounds_prefix) - 1; + char *endp; + unsigned long int srounds = strtoul(num, &endp, 10); + + if (*endp == '$') { + salt = endp + 1; + rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX)); + rounds_custom = 1; + } + } + + salt_len = MIN(strcspn(salt, "$"), SALT_LEN_MAX); + key_len = strlen(key); + + if ((key - (char *) 0) % __alignof__ (uint64_t) != 0) { + char *tmp = (char *) alloca (key_len + __alignof__ (uint64_t)); + key = copied_key = + memcpy(tmp + __alignof__(uint64_t) - (tmp - (char *) 0) % __alignof__(uint64_t), key, key_len); + } + + if ((salt - (char *) 0) % __alignof__ (uint64_t) != 0) { + char *tmp = (char *) alloca(salt_len + 1 + __alignof__(uint64_t)); + salt = copied_salt = memcpy(tmp + __alignof__(uint64_t) - (tmp - (char *) 0) % __alignof__(uint64_t), salt, salt_len); + copied_salt[salt_len] = 0; + } + + /* Prepare for the real work. */ + sha512_init_ctx(&ctx); + + /* Add the key string. */ + sha512_process_bytes(key, key_len, &ctx); + + /* The last part is the salt string. This must be at most 16 + characters and it ends at the first `$' character (for + compatibility with existing implementations). */ + sha512_process_bytes(salt, salt_len, &ctx); + + + /* Compute alternate SHA512 sum with input KEY, SALT, and KEY. The + final result will be added to the first context. */ + sha512_init_ctx(&alt_ctx); + + /* Add key. */ + sha512_process_bytes(key, key_len, &alt_ctx); + + /* Add salt. */ + sha512_process_bytes(salt, salt_len, &alt_ctx); + + /* Add key again. */ + sha512_process_bytes(key, key_len, &alt_ctx); + + /* Now get result of this (64 bytes) and add it to the other + context. */ + sha512_finish_ctx(&alt_ctx, alt_result); + + /* Add for any character in the key one byte of the alternate sum. */ + for (cnt = key_len; cnt > 64; cnt -= 64) { + sha512_process_bytes(alt_result, 64, &ctx); + } + sha512_process_bytes(alt_result, cnt, &ctx); + + /* Take the binary representation of the length of the key and for every + 1 add the alternate sum, for every 0 the key. */ + for (cnt = key_len; cnt > 0; cnt >>= 1) { + if ((cnt & 1) != 0) { + sha512_process_bytes(alt_result, 64, &ctx); + } else { + sha512_process_bytes(key, key_len, &ctx); + } + } + + /* Create intermediate result. */ + sha512_finish_ctx(&ctx, alt_result); + + /* Start computation of P byte sequence. */ + sha512_init_ctx(&alt_ctx); + + /* For every character in the password add the entire password. */ + for (cnt = 0; cnt < key_len; ++cnt) { + sha512_process_bytes(key, key_len, &alt_ctx); + } + + /* Finish the digest. */ + sha512_finish_ctx(&alt_ctx, temp_result); + + /* Create byte sequence P. */ + cp = p_bytes = alloca(key_len); + for (cnt = key_len; cnt >= 64; cnt -= 64) { + cp = __php_mempcpy((void *) cp, (const void *)temp_result, 64); + } + + memcpy(cp, temp_result, cnt); + + /* Start computation of S byte sequence. */ + sha512_init_ctx(&alt_ctx); + + /* For every character in the password add the entire password. */ + for (cnt = 0; cnt < (size_t) (16 + alt_result[0]); ++cnt) { + sha512_process_bytes(salt, salt_len, &alt_ctx); + } + + /* Finish the digest. */ + sha512_finish_ctx(&alt_ctx, temp_result); + + /* Create byte sequence S. */ + cp = s_bytes = alloca(salt_len); + for (cnt = salt_len; cnt >= 64; cnt -= 64) { + cp = __php_mempcpy(cp, temp_result, 64); + } + memcpy(cp, temp_result, cnt); + + /* Repeatedly run the collected hash value through SHA512 to burn + CPU cycles. */ + for (cnt = 0; cnt < rounds; ++cnt) { + /* New context. */ + sha512_init_ctx(&ctx); + + /* Add key or last result. */ + if ((cnt & 1) != 0) { + sha512_process_bytes(p_bytes, key_len, &ctx); + } else { + sha512_process_bytes(alt_result, 64, &ctx); + } + + /* Add salt for numbers not divisible by 3. */ + if (cnt % 3 != 0) { + sha512_process_bytes(s_bytes, salt_len, &ctx); + } + + /* Add key for numbers not divisible by 7. */ + if (cnt % 7 != 0) { + sha512_process_bytes(p_bytes, key_len, &ctx); + } + + /* Add key or last result. */ + if ((cnt & 1) != 0) { + sha512_process_bytes(alt_result, 64, &ctx); + } else { + sha512_process_bytes(p_bytes, key_len, &ctx); + } + + /* Create intermediate result. */ + sha512_finish_ctx(&ctx, alt_result); + } + + /* Now we can construct the result string. It consists of three + parts. */ + cp = __php_stpncpy(buffer, sha512_salt_prefix, MAX(0, buflen)); + buflen -= sizeof(sha512_salt_prefix) - 1; + + if (rounds_custom) { +#ifdef PHP_WIN32 + int n = _snprintf(cp, MAX(0, buflen), "%s%u$", sha512_rounds_prefix, rounds); +#else + int n = snprintf(cp, MAX(0, buflen), "%s%zu$", sha512_rounds_prefix, rounds); +#endif + cp += n; + buflen -= n; + } + + cp = __php_stpncpy(cp, salt, MIN((size_t) MAX(0, buflen), salt_len)); + buflen -= (int) MIN((size_t) MAX(0, buflen), salt_len); + + if (buflen > 0) { + *cp++ = '$'; + --buflen; + } + +#define b64_from_24bit(B2, B1, B0, N) \ + do { \ + unsigned int w = ((B2) << 16) | ((B1) << 8) | (B0); \ + int n = (N); \ + while (n-- > 0 && buflen > 0) \ + { \ + *cp++ = b64t[w & 0x3f]; \ + --buflen; \ + w >>= 6; \ + } \ + } while (0) + + b64_from_24bit(alt_result[0], alt_result[21], alt_result[42], 4); + b64_from_24bit(alt_result[22], alt_result[43], alt_result[1], 4); + b64_from_24bit(alt_result[44], alt_result[2], alt_result[23], 4); + b64_from_24bit(alt_result[3], alt_result[24], alt_result[45], 4); + b64_from_24bit(alt_result[25], alt_result[46], alt_result[4], 4); + b64_from_24bit(alt_result[47], alt_result[5], alt_result[26], 4); + b64_from_24bit(alt_result[6], alt_result[27], alt_result[48], 4); + b64_from_24bit(alt_result[28], alt_result[49], alt_result[7], 4); + b64_from_24bit(alt_result[50], alt_result[8], alt_result[29], 4); + b64_from_24bit(alt_result[9], alt_result[30], alt_result[51], 4); + b64_from_24bit(alt_result[31], alt_result[52], alt_result[10], 4); + b64_from_24bit(alt_result[53], alt_result[11], alt_result[32], 4); + b64_from_24bit(alt_result[12], alt_result[33], alt_result[54], 4); + b64_from_24bit(alt_result[34], alt_result[55], alt_result[13], 4); + b64_from_24bit(alt_result[56], alt_result[14], alt_result[35], 4); + b64_from_24bit(alt_result[15], alt_result[36], alt_result[57], 4); + b64_from_24bit(alt_result[37], alt_result[58], alt_result[16], 4); + b64_from_24bit(alt_result[59], alt_result[17], alt_result[38], 4); + b64_from_24bit(alt_result[18], alt_result[39], alt_result[60], 4); + b64_from_24bit(alt_result[40], alt_result[61], alt_result[19], 4); + b64_from_24bit(alt_result[62], alt_result[20], alt_result[41], 4); + b64_from_24bit(0, 0, alt_result[63], 2); + + if (buflen <= 0) { + errno = ERANGE; + buffer = NULL; + } else { + *cp = '\0'; /* Terminate the string. */ + } + + /* Clear the buffer for the intermediate result so that people + attaching to processes or reading core dumps cannot get any + information. We do it in this way to clear correct_words[] + inside the SHA512 implementation as well. */ + sha512_init_ctx(&ctx); + sha512_finish_ctx(&ctx, alt_result); + memset(temp_result, '\0', sizeof(temp_result)); + memset(p_bytes, '\0', key_len); + memset(s_bytes, '\0', salt_len); + memset(&ctx, '\0', sizeof(ctx)); + memset(&alt_ctx, '\0', sizeof(alt_ctx)); + if (copied_key != NULL) { + memset(copied_key, '\0', key_len); + } + if (copied_salt != NULL) { + memset(copied_salt, '\0', salt_len); + } + + return buffer; +} + + +/* This entry point is equivalent to the `crypt' function in Unix + libcs. */ +char * +php_sha512_crypt(const char *key, const char *salt) { + /* We don't want to have an arbitrary limit in the size of the + password. We can compute an upper bound for the size of the + result in advance and so we can prepare the buffer we pass to + `sha512_crypt_r'. */ + static char *buffer; + static int buflen; + int needed = (int)(sizeof(sha512_salt_prefix) - 1 + + sizeof(sha512_rounds_prefix) + 9 + 1 + + strlen(salt) + 1 + 86 + 1); + + if (buflen < needed) { + char *new_buffer = (char *) realloc(buffer, needed); + if (new_buffer == NULL) { + return NULL; + } + + buffer = new_buffer; + buflen = needed; + } + + return php_sha512_crypt_r (key, salt, buffer, buflen); +} + +#ifdef TEST +static const struct { + const char *input; + const char result[64]; +} tests[] = + { + /* Test vectors from FIPS 180-2: appendix C.1. */ + { "abc", + "\xdd\xaf\x35\xa1\x93\x61\x7a\xba\xcc\x41\x73\x49\xae\x20\x41\x31" + "\x12\xe6\xfa\x4e\x89\xa9\x7e\xa2\x0a\x9e\xee\xe6\x4b\x55\xd3\x9a" + "\x21\x92\x99\x2a\x27\x4f\xc1\xa8\x36\xba\x3c\x23\xa3\xfe\xeb\xbd" + "\x45\x4d\x44\x23\x64\x3c\xe8\x0e\x2a\x9a\xc9\x4f\xa5\x4c\xa4\x9f" }, + /* Test vectors from FIPS 180-2: appendix C.2. */ + { "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn" + "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", + "\x8e\x95\x9b\x75\xda\xe3\x13\xda\x8c\xf4\xf7\x28\x14\xfc\x14\x3f" + "\x8f\x77\x79\xc6\xeb\x9f\x7f\xa1\x72\x99\xae\xad\xb6\x88\x90\x18" + "\x50\x1d\x28\x9e\x49\x00\xf7\xe4\x33\x1b\x99\xde\xc4\xb5\x43\x3a" + "\xc7\xd3\x29\xee\xb6\xdd\x26\x54\x5e\x96\xe5\x5b\x87\x4b\xe9\x09" }, + /* Test vectors from the NESSIE project. */ + { "", + "\xcf\x83\xe1\x35\x7e\xef\xb8\xbd\xf1\x54\x28\x50\xd6\x6d\x80\x07" + "\xd6\x20\xe4\x05\x0b\x57\x15\xdc\x83\xf4\xa9\x21\xd3\x6c\xe9\xce" + "\x47\xd0\xd1\x3c\x5d\x85\xf2\xb0\xff\x83\x18\xd2\x87\x7e\xec\x2f" + "\x63\xb9\x31\xbd\x47\x41\x7a\x81\xa5\x38\x32\x7a\xf9\x27\xda\x3e" }, + { "a", + "\x1f\x40\xfc\x92\xda\x24\x16\x94\x75\x09\x79\xee\x6c\xf5\x82\xf2" + "\xd5\xd7\xd2\x8e\x18\x33\x5d\xe0\x5a\xbc\x54\xd0\x56\x0e\x0f\x53" + "\x02\x86\x0c\x65\x2b\xf0\x8d\x56\x02\x52\xaa\x5e\x74\x21\x05\x46" + "\xf3\x69\xfb\xbb\xce\x8c\x12\xcf\xc7\x95\x7b\x26\x52\xfe\x9a\x75" }, + { "message digest", + "\x10\x7d\xbf\x38\x9d\x9e\x9f\x71\xa3\xa9\x5f\x6c\x05\x5b\x92\x51" + "\xbc\x52\x68\xc2\xbe\x16\xd6\xc1\x34\x92\xea\x45\xb0\x19\x9f\x33" + "\x09\xe1\x64\x55\xab\x1e\x96\x11\x8e\x8a\x90\x5d\x55\x97\xb7\x20" + "\x38\xdd\xb3\x72\xa8\x98\x26\x04\x6d\xe6\x66\x87\xbb\x42\x0e\x7c" }, + { "abcdefghijklmnopqrstuvwxyz", + "\x4d\xbf\xf8\x6c\xc2\xca\x1b\xae\x1e\x16\x46\x8a\x05\xcb\x98\x81" + "\xc9\x7f\x17\x53\xbc\xe3\x61\x90\x34\x89\x8f\xaa\x1a\xab\xe4\x29" + "\x95\x5a\x1b\xf8\xec\x48\x3d\x74\x21\xfe\x3c\x16\x46\x61\x3a\x59" + "\xed\x54\x41\xfb\x0f\x32\x13\x89\xf7\x7f\x48\xa8\x79\xc7\xb1\xf1" }, + { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + "\x20\x4a\x8f\xc6\xdd\xa8\x2f\x0a\x0c\xed\x7b\xeb\x8e\x08\xa4\x16" + "\x57\xc1\x6e\xf4\x68\xb2\x28\xa8\x27\x9b\xe3\x31\xa7\x03\xc3\x35" + "\x96\xfd\x15\xc1\x3b\x1b\x07\xf9\xaa\x1d\x3b\xea\x57\x78\x9c\xa0" + "\x31\xad\x85\xc7\xa7\x1d\xd7\x03\x54\xec\x63\x12\x38\xca\x34\x45" }, + { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + "\x1e\x07\xbe\x23\xc2\x6a\x86\xea\x37\xea\x81\x0c\x8e\xc7\x80\x93" + "\x52\x51\x5a\x97\x0e\x92\x53\xc2\x6f\x53\x6c\xfc\x7a\x99\x96\xc4" + "\x5c\x83\x70\x58\x3e\x0a\x78\xfa\x4a\x90\x04\x1d\x71\xa4\xce\xab" + "\x74\x23\xf1\x9c\x71\xb9\xd5\xa3\xe0\x12\x49\xf0\xbe\xbd\x58\x94" }, + { "123456789012345678901234567890123456789012345678901234567890" + "12345678901234567890", + "\x72\xec\x1e\xf1\x12\x4a\x45\xb0\x47\xe8\xb7\xc7\x5a\x93\x21\x95" + "\x13\x5b\xb6\x1d\xe2\x4e\xc0\xd1\x91\x40\x42\x24\x6e\x0a\xec\x3a" + "\x23\x54\xe0\x93\xd7\x6f\x30\x48\xb4\x56\x76\x43\x46\x90\x0c\xb1" + "\x30\xd2\xa4\xfd\x5d\xd1\x6a\xbb\x5e\x30\xbc\xb8\x50\xde\xe8\x43" } + }; +#define ntests (sizeof (tests) / sizeof (tests[0])) + + +static const struct +{ + const char *salt; + const char *input; + const char *expected; +} tests2[] = { + { "$6$saltstring", "Hello world!", + "$6$saltstring$svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3uBnIFNjnQJu" + "esI68u4OTLiBFdcbYEdFCoEOfaS35inz1"}, + { "$6$rounds=10000$saltstringsaltstring", "Hello world!", + "$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sb" + "HbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v." }, + { "$6$rounds=5000$toolongsaltstring", "This is just a test", + "$6$rounds=5000$toolongsaltstrin$lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQ" + "zQ3glMhwllF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0" }, + { "$6$rounds=1400$anotherlongsaltstring", + "a very much longer text to encrypt. This one even stretches over more" + "than one line.", + "$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wP" + "vMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1" }, + { "$6$rounds=77777$short", + "we have a short salt string but not a short password", + "$6$rounds=77777$short$WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr0g" + "ge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0" }, + { "$6$rounds=123456$asaltof16chars..", "a short string", + "$6$rounds=123456$asaltof16chars..$BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwc" + "elCjmw2kSYu.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1" }, + { "$6$rounds=10$roundstoolow", "the minimum number is still observed", + "$6$rounds=1000$roundstoolow$kUMsbe306n21p9R.FRkW3IGn.S9NPN0x50YhH1x" + "hLsPuWGsUSklZt58jaTfF4ZEQpyUNGc0dqbpBYYBaHHrsX." }, +}; +#define ntests2 (sizeof (tests2) / sizeof (tests2[0])) + + +int main (void) { + struct sha512_ctx ctx; + char sum[64]; + int result = 0; + int cnt; + int i; + char buf[1000]; + static const char expected[64] = + "\xe7\x18\x48\x3d\x0c\xe7\x69\x64\x4e\x2e\x42\xc7\xbc\x15\xb4\x63" + "\x8e\x1f\x98\xb1\x3b\x20\x44\x28\x56\x32\xa8\x03\xaf\xa9\x73\xeb" + "\xde\x0f\xf2\x44\x87\x7e\xa6\x0a\x4c\xb0\x43\x2c\xe5\x77\xc3\x1b" + "\xeb\x00\x9c\x5c\x2c\x49\xaa\x2e\x4e\xad\xb2\x17\xad\x8c\xc0\x9b"; + + for (cnt = 0; cnt < (int) ntests; ++cnt) { + sha512_init_ctx (&ctx); + sha512_process_bytes (tests[cnt].input, strlen (tests[cnt].input), &ctx); + sha512_finish_ctx (&ctx, sum); + if (memcmp (tests[cnt].result, sum, 64) != 0) { + printf ("test %d run %d failed\n", cnt, 1); + result = 1; + } + + sha512_init_ctx (&ctx); + for (i = 0; tests[cnt].input[i] != '\0'; ++i) { + sha512_process_bytes (&tests[cnt].input[i], 1, &ctx); + } + sha512_finish_ctx (&ctx, sum); + if (memcmp (tests[cnt].result, sum, 64) != 0) { + printf ("test %d run %d failed\n", cnt, 2); + result = 1; + } + } + + /* Test vector from FIPS 180-2: appendix C.3. */ + + memset (buf, 'a', sizeof (buf)); + sha512_init_ctx (&ctx); + for (i = 0; i < 1000; ++i) { + sha512_process_bytes (buf, sizeof (buf), &ctx); + } + + sha512_finish_ctx (&ctx, sum); + if (memcmp (expected, sum, 64) != 0) { + printf ("test %d failed\n", cnt); + result = 1; + } + + for (cnt = 0; cnt < ntests2; ++cnt) { + char *cp = php_sha512_crypt(tests2[cnt].input, tests2[cnt].salt); + + if (strcmp (cp, tests2[cnt].expected) != 0) { + printf ("test %d: expected \"%s\", got \"%s\"\n", + cnt, tests2[cnt].expected, cp); + result = 1; + } + } + + if (result == 0) { + puts ("all tests OK"); + } + + return result; +} +#endif diff --git a/ext/standard/css.c b/ext/standard/css.c new file mode 100644 index 0000000..d76f9ee --- /dev/null +++ b/ext/standard/css.c @@ -0,0 +1,55 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Colin Viebrock | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "info.h" + +PHPAPI void php_info_print_css(TSRMLS_D) /* {{{ */ +{ + PUTS("body {background-color: #ffffff; color: #000000;}\n"); + PUTS("body, td, th, h1, h2 {font-family: sans-serif;}\n"); + PUTS("pre {margin: 0px; font-family: monospace;}\n"); + PUTS("a:link {color: #000099; text-decoration: none; background-color: #ffffff;}\n"); + PUTS("a:hover {text-decoration: underline;}\n"); + PUTS("table {border-collapse: collapse;}\n"); + PUTS(".center {text-align: center;}\n"); + PUTS(".center table { margin-left: auto; margin-right: auto; text-align: left;}\n"); + PUTS(".center th { text-align: center !important; }\n"); + PUTS("td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}\n"); + PUTS("h1 {font-size: 150%;}\n"); + PUTS("h2 {font-size: 125%;}\n"); + PUTS(".p {text-align: left;}\n"); + PUTS(".e {background-color: #ccccff; font-weight: bold; color: #000000;}\n"); + PUTS(".h {background-color: #9999cc; font-weight: bold; color: #000000;}\n"); + PUTS(".v {background-color: #cccccc; color: #000000;}\n"); + PUTS(".vr {background-color: #cccccc; text-align: right; color: #000000;}\n"); + PUTS("img {float: right; border: 0px;}\n"); + PUTS("hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}\n"); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/css.h b/ext/standard/css.h new file mode 100644 index 0000000..d7275e0 --- /dev/null +++ b/ext/standard/css.h @@ -0,0 +1,26 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Colin Viebrock | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef CSS_H +#define CSS_H + +PHPAPI void php_info_print_css(TSRMLS_D); + +#endif diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c new file mode 100644 index 0000000..b29b493 --- /dev/null +++ b/ext/standard/cyr_convert.c @@ -0,0 +1,296 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Kirill Maximov | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#include + +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include + +#include "php.h" +#include "cyr_convert.h" + +#include + +/***************************************************************************** +* This is codetables for different Cyrillic charsets (relative to koi8-r). +* Each table contains data for 128-255 symbols from ASCII table. +* First 256 symbols are for conversion from koi8-r to corresponding charset, +* second 256 symbols are for reverse conversion, from charset to koi8-r. +* +* Here we have the following tables: +* _cyr_win1251 - for windows-1251 charset +* _cyr_iso88595 - for iso8859-5 charset +* _cyr_cp866 - for x-cp866 charset +* _cyr_mac - for x-mac-cyrillic charset +* +*****************************************************************************/ + +typedef unsigned char _cyr_charset_table[512]; + +/* {{{ static const _cyr_charset_table _cyr_win1251 + */ +static const _cyr_charset_table _cyr_win1251 = { +0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, +16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, +32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, +48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, +64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, +80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, +96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, +112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, +46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, +46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, +154,174,190,46,159,189,46,46,179,191,180,157,46,46,156,183, +46,46,182,166,173,46,46,158,163,152,164,155,46,46,46,167, +225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, +242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, +193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, +210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209, +0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, +16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, +32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, +48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, +64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, +80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, +96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, +112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,184,186,32,179,191,32,32,32,32,32,180,162,32, +32,32,32,168,170,32,178,175,32,32,32,32,32,165,161,169, +254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238, +239,255,240,241,242,243,230,226,252,251,231,248,253,249,247,250, +222,192,193,214,196,197,212,195,213,200,201,202,203,204,205,206, +207,223,208,209,210,211,198,194,220,219,199,216,221,217,215,218, +}, +_cyr_cp866 = { +0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, +16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, +32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, +48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, +64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, +80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, +96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, +112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, +225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, +242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, +193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, +35,35,35,124,124,124,124,43,43,124,124,43,43,43,43,43, +43,45,45,124,45,43,124,124,43,43,45,45,124,45,43,45, +45,45,45,43,43,43,43,43,43,43,43,35,35,124,124,35, +210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209, +179,163,180,164,183,167,190,174,32,149,158,32,152,159,148,154, +0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, +16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, +32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, +48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, +64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, +80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, +96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, +112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +205,186,213,241,243,201,32,245,187,212,211,200,190,32,247,198, +199,204,181,240,242,185,32,244,203,207,208,202,216,32,246,32, +238,160,161,230,164,165,228,163,229,168,169,170,171,172,173,174, +175,239,224,225,226,227,166,162,236,235,167,232,237,233,231,234, +158,128,129,150,132,133,148,131,149,136,137,138,139,140,141,142, +143,159,144,145,146,147,134,130,156,155,135,152,157,153,151,154, +}, +_cyr_iso88595 = { +0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, +16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, +32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, +48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, +64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, +80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, +96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, +112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,179,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, +242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, +193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, +210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209, +32,163,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, +16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, +32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, +48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, +64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, +80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, +96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, +112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,241,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,161,32,32,32,32,32,32,32,32,32,32,32,32, +238,208,209,230,212,213,228,211,229,216,217,218,219,220,221,222, +223,239,224,225,226,227,214,210,236,235,215,232,237,233,231,234, +206,176,177,198,180,181,196,179,197,184,185,186,187,188,189,190, +191,207,192,193,194,195,182,178,204,203,183,200,205,201,199,202, +}, +_cyr_mac = { +0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, +16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, +32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, +48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, +64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, +80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, +96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, +112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, +225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, +242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, +160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, +176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, +128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, +144,145,146,147,148,149,150,151,152,153,154,155,156,179,163,209, +193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, +210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,255, +0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, +16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, +32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, +48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, +64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, +80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, +96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, +112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, +192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, +208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, +160,161,162,222,164,165,166,167,168,169,170,171,172,173,174,175, +176,177,178,221,180,181,182,183,184,185,186,187,188,189,190,191, +254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238, +239,223,240,241,242,243,230,226,252,251,231,248,253,249,247,250, +158,128,129,150,132,133,148,131,149,136,137,138,139,140,141,142, +143,159,144,145,146,147,134,130,156,155,135,152,157,153,151,154, +}; +/* }}} */ + +/* {{{ static char * php_convert_cyr_string(unsigned char *str, int length, char from, char to TSRMLS_DC) +* This is the function that performs real in-place conversion of the string +* between charsets. +* Parameters: +* str - string to be converted +* from,to - one-symbol label of source and destination charset +* The following symbols are used as labels: +* k - koi8-r +* w - windows-1251 +* i - iso8859-5 +* a - x-cp866 +* d - x-cp866 +* m - x-mac-cyrillic +*****************************************************************************/ +static char * php_convert_cyr_string(unsigned char *str, int length, char from, char to TSRMLS_DC) +{ + const unsigned char *from_table, *to_table; + unsigned char tmp; + int i; + + from_table = NULL; + to_table = NULL; + + switch (toupper((int)(unsigned char)from)) + { + case 'W': + from_table = _cyr_win1251; + break; + case 'A': + case 'D': + from_table = _cyr_cp866; + break; + case 'I': + from_table = _cyr_iso88595; + break; + case 'M': + from_table = _cyr_mac; + break; + case 'K': + break; + default: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown source charset: %c", from); + break; + } + + switch (toupper((int)(unsigned char)to)) + { + case 'W': + to_table = _cyr_win1251; + break; + case 'A': + case 'D': + to_table = _cyr_cp866; + break; + case 'I': + to_table = _cyr_iso88595; + break; + case 'M': + to_table = _cyr_mac; + break; + case 'K': + break; + default: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown destination charset: %c", to); + break; + } + + + if (!str) + return (char *)str; + + for( i = 0; i | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef CYR_CONVERT_H +#define CYR_CONVERT_H + +PHP_FUNCTION(convert_cyr_string); + +#endif /* CYR_CONVERT_H */ + + + diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c new file mode 100644 index 0000000..3941532 --- /dev/null +++ b/ext/standard/datetime.c @@ -0,0 +1,128 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Andi Gutmans | + | Zeev Suraski | + | Rasmus Lerdorf | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#include "php.h" +#include "zend_operators.h" +#include "datetime.h" +#include "php_globals.h" + +#include +#ifdef HAVE_SYS_TIME_H +# include +#endif +#include + +char *mon_full_names[] = { + "January", "February", "March", "April", + "May", "June", "July", "August", + "September", "October", "November", "December" +}; + +char *mon_short_names[] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" +}; + +char *day_full_names[] = { + "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" +}; + +char *day_short_names[] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" +}; + +/* {{{ PHPAPI char *php_std_date(time_t t TSRMLS_DC) + Return date string in standard format for http headers */ +PHPAPI char *php_std_date(time_t t TSRMLS_DC) +{ + struct tm *tm1, tmbuf; + char *str; + + tm1 = php_gmtime_r(&t, &tmbuf); + str = emalloc(81); + str[0] = '\0'; + + if (!tm1) { + return str; + } + + snprintf(str, 80, "%s, %02d %s %04d %02d:%02d:%02d GMT", + day_short_names[tm1->tm_wday], + tm1->tm_mday, + mon_short_names[tm1->tm_mon], + tm1->tm_year + 1900, + tm1->tm_hour, tm1->tm_min, tm1->tm_sec); + + str[79] = 0; + return (str); +} +/* }}} */ + +#if HAVE_STRPTIME +#ifndef HAVE_STRPTIME_DECL_FAILS +char *strptime(const char *s, const char *format, struct tm *tm); +#endif + +/* {{{ proto string strptime(string timestamp, string format) + Parse a time/date generated with strftime() */ +PHP_FUNCTION(strptime) +{ + char *ts; + int ts_length; + char *format; + int format_length; + struct tm parsed_time; + char *unparsed_part; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &ts, &ts_length, &format, &format_length) == FAILURE) { + return; + } + + memset(&parsed_time, 0, sizeof(parsed_time)); + + unparsed_part = strptime(ts, format, &parsed_time); + if (unparsed_part == NULL) { + RETURN_FALSE; + } + + array_init(return_value); + add_assoc_long(return_value, "tm_sec", parsed_time.tm_sec); + add_assoc_long(return_value, "tm_min", parsed_time.tm_min); + add_assoc_long(return_value, "tm_hour", parsed_time.tm_hour); + add_assoc_long(return_value, "tm_mday", parsed_time.tm_mday); + add_assoc_long(return_value, "tm_mon", parsed_time.tm_mon); + add_assoc_long(return_value, "tm_year", parsed_time.tm_year); + add_assoc_long(return_value, "tm_wday", parsed_time.tm_wday); + add_assoc_long(return_value, "tm_yday", parsed_time.tm_yday); + add_assoc_string(return_value, "unparsed", unparsed_part, 1); +} +/* }}} */ + +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/datetime.h b/ext/standard/datetime.h new file mode 100644 index 0000000..3612faf --- /dev/null +++ b/ext/standard/datetime.h @@ -0,0 +1,31 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Andi Gutmans | + | Zeev Suraski | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef DATETIME_H +#define DATETIME_H + +#if HAVE_STRPTIME +PHP_FUNCTION(strptime); +#endif + +PHPAPI char *php_std_date(time_t t TSRMLS_DC); + +#endif /* DATETIME_H */ diff --git a/ext/standard/dir.c b/ext/standard/dir.c new file mode 100644 index 0000000..ef28e9f --- /dev/null +++ b/ext/standard/dir.c @@ -0,0 +1,601 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Thies C. Arntzen | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +/* {{{ includes/startup/misc */ + +#include "php.h" +#include "fopen_wrappers.h" +#include "file.h" +#include "php_dir.h" +#include "php_string.h" +#include "php_scandir.h" +#include "basic_functions.h" + +#ifdef HAVE_DIRENT_H +#include +#endif + +#if HAVE_UNISTD_H +#include +#endif + +#include + +#ifdef PHP_WIN32 +#include "win32/readdir.h" +#endif + + +#ifdef HAVE_GLOB +#ifndef PHP_WIN32 +#include +#else +#include "win32/glob.h" +#endif +#endif + +typedef struct { + int default_dir; +} php_dir_globals; + +#ifdef ZTS +#define DIRG(v) TSRMG(dir_globals_id, php_dir_globals *, v) +int dir_globals_id; +#else +#define DIRG(v) (dir_globals.v) +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() TSRMLS_CC, "|r", &id) == FAILURE) { \ + return; \ + } \ + if (ZEND_NUM_ARGS() == 0) { \ + myself = getThis(); \ + if (myself) { \ + if (zend_hash_find(Z_OBJPROP_P(myself), "handle", sizeof("handle"), (void **)&tmp) == FAILURE) { \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find my handle property"); \ + RETURN_FALSE; \ + } \ + ZEND_FETCH_RESOURCE(dirp, php_stream *, tmp, -1, "Directory", php_file_le_stream()); \ + } else { \ + ZEND_FETCH_RESOURCE(dirp, php_stream *, 0, DIRG(default_dir), "Directory", php_file_le_stream()); \ + } \ + } else { \ + dirp = (php_stream *) zend_fetch_resource(&id TSRMLS_CC, -1, "Directory", NULL, 1, php_file_le_stream()); \ + if (!dirp) \ + RETURN_FALSE; \ + } + +/* {{{ arginfo */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_dir, 0, 0, 0) + ZEND_ARG_INFO(0, dir_handle) +ZEND_END_ARG_INFO() +/* }}} */ + +static const zend_function_entry php_dir_class_functions[] = { + PHP_FALIAS(close, closedir, arginfo_dir) + PHP_FALIAS(rewind, rewinddir, arginfo_dir) + PHP_NAMED_FE(read, php_if_readdir, arginfo_dir) + {NULL, NULL, NULL} +}; + + +static void php_set_default_dir(int id TSRMLS_DC) +{ + if (DIRG(default_dir)!=-1) { + zend_list_delete(DIRG(default_dir)); + } + + if (id != -1) { + zend_list_addref(id); + } + + DIRG(default_dir) = id; +} + +PHP_RINIT_FUNCTION(dir) +{ + DIRG(default_dir) = -1; + return SUCCESS; +} + +PHP_MINIT_FUNCTION(dir) +{ + static char dirsep_str[2], pathsep_str[2]; + zend_class_entry dir_class_entry; + + INIT_CLASS_ENTRY(dir_class_entry, "Directory", php_dir_class_functions); + dir_class_entry_ptr = zend_register_internal_class(&dir_class_entry TSRMLS_CC); + +#ifdef ZTS + ts_allocate_id(&dir_globals_id, sizeof(php_dir_globals), NULL, NULL); +#endif + + dirsep_str[0] = DEFAULT_SLASH; + dirsep_str[1] = '\0'; + REGISTER_STRING_CONSTANT("DIRECTORY_SEPARATOR", dirsep_str, CONST_CS|CONST_PERSISTENT); + + pathsep_str[0] = ZEND_PATHS_SEPARATOR; + pathsep_str[1] = '\0'; + REGISTER_STRING_CONSTANT("PATH_SEPARATOR", pathsep_str, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SCANDIR_SORT_ASCENDING", PHP_SCANDIR_SORT_ASCENDING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SCANDIR_SORT_DESCENDING", PHP_SCANDIR_SORT_DESCENDING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SCANDIR_SORT_NONE", PHP_SCANDIR_SORT_NONE, CONST_CS | CONST_PERSISTENT); + +#ifdef HAVE_GLOB + +#ifdef GLOB_BRACE + REGISTER_LONG_CONSTANT("GLOB_BRACE", GLOB_BRACE, CONST_CS | CONST_PERSISTENT); +#else +# define GLOB_BRACE 0 +#endif + +#ifdef GLOB_MARK + REGISTER_LONG_CONSTANT("GLOB_MARK", GLOB_MARK, CONST_CS | CONST_PERSISTENT); +#else +# define GLOB_MARK 0 +#endif + +#ifdef GLOB_NOSORT + REGISTER_LONG_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_CS | CONST_PERSISTENT); +#else +# define GLOB_NOSORT 0 +#endif + +#ifdef GLOB_NOCHECK + REGISTER_LONG_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_CS | CONST_PERSISTENT); +#else +# define GLOB_NOCHECK 0 +#endif + +#ifdef GLOB_NOESCAPE + REGISTER_LONG_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_CS | CONST_PERSISTENT); +#else +# define GLOB_NOESCAPE 0 +#endif + +#ifdef GLOB_ERR + REGISTER_LONG_CONSTANT("GLOB_ERR", GLOB_ERR, CONST_CS | CONST_PERSISTENT); +#else +# define GLOB_ERR 0 +#endif + +#ifndef GLOB_ONLYDIR +# define GLOB_ONLYDIR (1<<30) +# define GLOB_EMULATE_ONLYDIR +# define GLOB_FLAGMASK (~GLOB_ONLYDIR) +#else +# define GLOB_FLAGMASK (~0) +#endif + +/* This is used for checking validity of passed flags (passing invalid flags causes segfault in glob()!! */ +#define GLOB_AVAILABLE_FLAGS (0 | GLOB_BRACE | GLOB_MARK | GLOB_NOSORT | GLOB_NOCHECK | GLOB_NOESCAPE | GLOB_ERR | GLOB_ONLYDIR) + + REGISTER_LONG_CONSTANT("GLOB_ONLYDIR", GLOB_ONLYDIR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GLOB_AVAILABLE_FLAGS", GLOB_AVAILABLE_FLAGS, CONST_CS | CONST_PERSISTENT); + +#endif /* HAVE_GLOB */ + + return SUCCESS; +} +/* }}} */ + +/* {{{ internal functions */ +static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) +{ + char *dirname; + int dir_len; + zval *zcontext = NULL; + php_stream_context *context = NULL; + php_stream *dirp; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &dirname, &dir_len, &zcontext) == FAILURE) { + RETURN_NULL(); + } + + context = php_stream_context_from_zval(zcontext, 0); + + dirp = php_stream_opendir(dirname, REPORT_ERRORS, context); + + if (dirp == NULL) { + RETURN_FALSE; + } + + dirp->flags |= PHP_STREAM_FLAG_NO_FCLOSE; + + php_set_default_dir(dirp->rsrc_id TSRMLS_CC); + + if (createobject) { + object_init_ex(return_value, dir_class_entry_ptr); + add_property_stringl(return_value, "path", dirname, dir_len, 1); + add_property_resource(return_value, "handle", dirp->rsrc_id); + php_stream_auto_cleanup(dirp); /* so we don't get warnings under debug */ + } else { + php_stream_to_zval(dirp, return_value); + } +} +/* }}} */ + +/* {{{ proto mixed opendir(string path[, resource context]) + Open a directory and return a dir_handle */ +PHP_FUNCTION(opendir) +{ + _php_do_opendir(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* {{{ proto object dir(string directory[, resource context]) + Directory class with properties, handle and class and methods read, rewind and close */ +PHP_FUNCTION(getdir) +{ + _php_do_opendir(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +/* {{{ proto void closedir([resource dir_handle]) + Close directory connection identified by the dir_handle */ +PHP_FUNCTION(closedir) +{ + zval *id = NULL, **tmp, *myself; + php_stream *dirp; + int rsrc_id; + + FETCH_DIRP(); + + if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a valid Directory resource", dirp->rsrc_id); + RETURN_FALSE; + } + + rsrc_id = dirp->rsrc_id; + zend_list_delete(dirp->rsrc_id); + + if (rsrc_id == DIRG(default_dir)) { + php_set_default_dir(-1 TSRMLS_CC); + } +} +/* }}} */ + +#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC +/* {{{ proto bool chroot(string directory) + Change root directory */ +PHP_FUNCTION(chroot) +{ + char *str; + int ret, str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + RETURN_FALSE; + } + + ret = chroot(str); + if (ret != 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno); + RETURN_FALSE; + } + + php_clear_stat_cache(1, NULL, 0 TSRMLS_CC); + + ret = chdir("/"); + + if (ret != 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno); + RETURN_FALSE; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +/* {{{ proto bool chdir(string directory) + Change the current directory */ +PHP_FUNCTION(chdir) +{ + char *str; + int ret, str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &str, &str_len) == FAILURE) { + RETURN_FALSE; + } + + if (php_check_open_basedir(str TSRMLS_CC)) { + RETURN_FALSE; + } + ret = VCWD_CHDIR(str); + + if (ret != 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno); + RETURN_FALSE; + } + + if (BG(CurrentStatFile) && !IS_ABSOLUTE_PATH(BG(CurrentStatFile), strlen(BG(CurrentStatFile)))) { + efree(BG(CurrentStatFile)); + BG(CurrentStatFile) = NULL; + } + if (BG(CurrentLStatFile) && !IS_ABSOLUTE_PATH(BG(CurrentLStatFile), strlen(BG(CurrentLStatFile)))) { + efree(BG(CurrentLStatFile)); + BG(CurrentLStatFile) = NULL; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto mixed getcwd(void) + Gets the current directory */ +PHP_FUNCTION(getcwd) +{ + char path[MAXPATHLEN]; + char *ret=NULL; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + +#if HAVE_GETCWD + ret = VCWD_GETCWD(path, MAXPATHLEN); +#elif HAVE_GETWD + ret = VCWD_GETWD(path); +#endif + + if (ret) { + RETURN_STRING(path, 1); + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto void rewinddir([resource dir_handle]) + Rewind dir_handle back to the start */ +PHP_FUNCTION(rewinddir) +{ + zval *id = NULL, **tmp, *myself; + php_stream *dirp; + + FETCH_DIRP(); + + if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a valid Directory resource", dirp->rsrc_id); + RETURN_FALSE; + } + + php_stream_rewinddir(dirp); +} +/* }}} */ + +/* {{{ proto string readdir([resource dir_handle]) + Read directory entry from dir_handle */ +PHP_NAMED_FUNCTION(php_if_readdir) +{ + zval *id = NULL, **tmp, *myself; + php_stream *dirp; + php_stream_dirent entry; + + FETCH_DIRP(); + + if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a valid Directory resource", dirp->rsrc_id); + RETURN_FALSE; + } + + if (php_stream_readdir(dirp, &entry)) { + RETURN_STRINGL(entry.d_name, strlen(entry.d_name), 1); + } + RETURN_FALSE; +} +/* }}} */ + +#ifdef HAVE_GLOB +/* {{{ proto array glob(string pattern [, int flags]) + Find pathnames matching a pattern */ +PHP_FUNCTION(glob) +{ + int cwd_skip = 0; +#ifdef ZTS + char cwd[MAXPATHLEN]; + char work_pattern[MAXPATHLEN]; + char *result; +#endif + char *pattern = NULL; + int pattern_len; + long flags = 0; + glob_t globbuf; + int n; + int ret; + zend_bool basedir_limit = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &pattern, &pattern_len, &flags) == FAILURE) { + return; + } + + if (pattern_len >= MAXPATHLEN) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Pattern exceeds the maximum allowed length of %d characters", MAXPATHLEN); + RETURN_FALSE; + } + + if ((GLOB_AVAILABLE_FLAGS & flags) != flags) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "At least one of the passed flags is invalid or not supported on this platform"); + RETURN_FALSE; + } + +#ifdef ZTS + if (!IS_ABSOLUTE_PATH(pattern, pattern_len)) { + result = VCWD_GETCWD(cwd, MAXPATHLEN); + if (!result) { + cwd[0] = '\0'; + } +#ifdef PHP_WIN32 + if (IS_SLASH(*pattern)) { + cwd[2] = '\0'; + } +#endif + cwd_skip = strlen(cwd)+1; + + snprintf(work_pattern, MAXPATHLEN, "%s%c%s", cwd, DEFAULT_SLASH, pattern); + pattern = work_pattern; + } +#endif + + + memset(&globbuf, 0, sizeof(glob_t)); + globbuf.gl_offs = 0; + if (0 != (ret = glob(pattern, flags & GLOB_FLAGMASK, NULL, &globbuf))) { +#ifdef GLOB_NOMATCH + if (GLOB_NOMATCH == ret) { + /* Some glob implementation simply return no data if no matches + were found, others return the GLOB_NOMATCH error code. + We don't want to treat GLOB_NOMATCH as an error condition + so that PHP glob() behaves the same on both types of + implementations and so that 'foreach (glob() as ...' + can be used for simple glob() calls without further error + checking. + */ + goto no_results; + } +#endif + RETURN_FALSE; + } + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +no_results: + if (PG(open_basedir) && *PG(open_basedir)) { + struct stat s; + + if (0 != VCWD_STAT(pattern, &s) || S_IFDIR != (s.st_mode & S_IFMT)) { + RETURN_FALSE; + } + } + array_init(return_value); + return; + } + + array_init(return_value); + for (n = 0; n < globbuf.gl_pathc; n++) { + if (PG(open_basedir) && *PG(open_basedir)) { + if (php_check_open_basedir_ex(globbuf.gl_pathv[n], 0 TSRMLS_CC)) { + basedir_limit = 1; + continue; + } + } + /* we need to do this everytime since GLOB_ONLYDIR does not guarantee that + * all directories will be filtered. GNU libc documentation states the + * following: + * If the information about the type of the file is easily available + * non-directories will be rejected but no extra work will be done to + * determine the information for each file. I.e., the caller must still be + * able to filter directories out. + */ + if (flags & GLOB_ONLYDIR) { + struct stat s; + + if (0 != VCWD_STAT(globbuf.gl_pathv[n], &s)) { + continue; + } + + if (S_IFDIR != (s.st_mode & S_IFMT)) { + continue; + } + } + add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1); + } + + globfree(&globbuf); + + if (basedir_limit && !zend_hash_num_elements(Z_ARRVAL_P(return_value))) { + zval_dtor(return_value); + RETURN_FALSE; + } +} +/* }}} */ +#endif + +/* {{{ proto array scandir(string dir [, int sorting_order [, resource context]]) + List files & directories inside the specified path */ +PHP_FUNCTION(scandir) +{ + char *dirn; + int dirn_len; + long flags = 0; + char **namelist; + int n, i; + zval *zcontext = NULL; + php_stream_context *context = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lr", &dirn, &dirn_len, &flags, &zcontext) == FAILURE) { + return; + } + + if (dirn_len < 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Directory name cannot be empty"); + RETURN_FALSE; + } + + if (zcontext) { + context = php_stream_context_from_zval(zcontext, 0); + } + + if (flags == PHP_SCANDIR_SORT_ASCENDING) { + n = php_stream_scandir(dirn, &namelist, context, (void *) php_stream_dirent_alphasort); + } else if (flags == PHP_SCANDIR_SORT_NONE) { + n = php_stream_scandir(dirn, &namelist, context, NULL); + } else { + n = php_stream_scandir(dirn, &namelist, context, (void *) php_stream_dirent_alphasortr); + } + if (n < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "(errno %d): %s", errno, strerror(errno)); + RETURN_FALSE; + } + + array_init(return_value); + + for (i = 0; i < n; i++) { + add_next_index_string(return_value, namelist[i], 0); + } + + if (n) { + efree(namelist); + } +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/dl.c b/ext/standard/dl.c new file mode 100644 index 0000000..4d6a947 --- /dev/null +++ b/ext/standard/dl.c @@ -0,0 +1,298 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Brian Schaffner | + | Shane Caraveo | + | Zeev Suraski | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "dl.h" +#include "php_globals.h" +#include "php_ini.h" +#include "ext/standard/info.h" + +#include "SAPI.h" + +#if defined(HAVE_LIBDL) +#include +#include +#ifdef HAVE_STRING_H +#include +#else +#include +#endif +#ifdef PHP_WIN32 +#include "win32/param.h" +#include "win32/winutil.h" +#define GET_DL_ERROR() php_win_err() +#elif defined(NETWARE) +#include +#define GET_DL_ERROR() dlerror() +#else +#include +#define GET_DL_ERROR() DL_ERROR() +#endif +#endif /* defined(HAVE_LIBDL) */ + +/* {{{ proto int dl(string extension_filename) + Load a PHP extension at runtime */ +PHPAPI PHP_FUNCTION(dl) +{ + char *filename; + int filename_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + return; + } + + if (!PG(enable_dl)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Dynamically loaded extensions aren't enabled"); + RETURN_FALSE; + } + + if (filename_len >= MAXPATHLEN) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "File name exceeds the maximum allowed length of %d characters", MAXPATHLEN); + RETURN_FALSE; + } + + if ((strncmp(sapi_module.name, "cgi", 3) != 0) && + (strcmp(sapi_module.name, "cli") != 0) && + (strncmp(sapi_module.name, "embed", 5) != 0) + ) { +#ifdef ZTS + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported in multithreaded Web servers - use extension=%s in your php.ini", filename); + RETURN_FALSE; +#else + php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "dl() is deprecated - use extension=%s in your php.ini", filename); +#endif + } + + php_dl(filename, MODULE_TEMPORARY, return_value, 0 TSRMLS_CC); + if (Z_LVAL_P(return_value) == 1) { + EG(full_tables_cleanup) = 1; + } +} +/* }}} */ + +#if defined(HAVE_LIBDL) + +#ifdef ZTS +#define USING_ZTS 1 +#else +#define USING_ZTS 0 +#endif + +/* {{{ php_dl + */ +PHPAPI int php_load_extension(char *filename, int type, int start_now TSRMLS_DC) /* {{{ */ +{ + void *handle; + char *libpath; + zend_module_entry *module_entry; + zend_module_entry *(*get_module)(void); + int error_type; + char *extension_dir; + + if (type == MODULE_PERSISTENT) { + extension_dir = INI_STR("extension_dir"); + } else { + extension_dir = PG(extension_dir); + } + + if (type == MODULE_TEMPORARY) { + error_type = E_WARNING; + } else { + error_type = E_CORE_WARNING; + } + + /* Check if passed filename contains directory separators */ + if (strchr(filename, '/') != NULL || strchr(filename, DEFAULT_SLASH) != NULL) { + /* Passing modules with full path is not supported for dynamically loaded extensions */ + if (type == MODULE_TEMPORARY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Temporary module name should contain only filename"); + return FAILURE; + } + libpath = estrdup(filename); + } else if (extension_dir && extension_dir[0]) { + int extension_dir_len = strlen(extension_dir); + + if (IS_SLASH(extension_dir[extension_dir_len-1])) { + spprintf(&libpath, 0, "%s%s", extension_dir, filename); /* SAFE */ + } else { + spprintf(&libpath, 0, "%s%c%s", extension_dir, DEFAULT_SLASH, filename); /* SAFE */ + } + } else { + return FAILURE; /* Not full path given or extension_dir is not set */ + } + + /* load dynamic symbol */ + handle = DL_LOAD(libpath); + if (!handle) { +#if PHP_WIN32 + char *err = GET_DL_ERROR(); + if (err && (*err != "")) { + php_error_docref(NULL TSRMLS_CC, error_type, "Unable to load dynamic library '%s' - %s", libpath, err); + LocalFree(err); + } else { + php_error_docref(NULL TSRMLS_CC, error_type, "Unable to load dynamic library '%s' - %s", libpath, "Unknown reason"); + } +#else + php_error_docref(NULL TSRMLS_CC, error_type, "Unable to load dynamic library '%s' - %s", libpath, GET_DL_ERROR()); + GET_DL_ERROR(); /* free the buffer storing the error */ +#endif + efree(libpath); + return FAILURE; + } + efree(libpath); + + get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module"); + + /* Some OS prepend _ to symbol names while their dynamic linker + * does not do that automatically. Thus we check manually for + * _get_module. */ + + if (!get_module) { + get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "_get_module"); + } + + if (!get_module) { + DL_UNLOAD(handle); + php_error_docref(NULL TSRMLS_CC, error_type, "Invalid library (maybe not a PHP library) '%s'", filename); + return FAILURE; + } + module_entry = get_module(); + if (module_entry->zend_api != ZEND_MODULE_API_NO) { + /* Check for pre-4.1.0 module which has a slightly different module_entry structure :( */ + struct pre_4_1_0_module_entry { + char *name; + zend_function_entry *functions; + int (*module_startup_func)(INIT_FUNC_ARGS); + int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS); + int (*request_startup_func)(INIT_FUNC_ARGS); + int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS); + void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS); + int (*global_startup_func)(void); + int (*global_shutdown_func)(void); + int globals_id; + int module_started; + unsigned char type; + void *handle; + int module_number; + unsigned char zend_debug; + unsigned char zts; + unsigned int zend_api; + }; + + const char *name; + int zend_api; + + if ((((struct pre_4_1_0_module_entry *)module_entry)->zend_api > 20000000) && + (((struct pre_4_1_0_module_entry *)module_entry)->zend_api < 20010901) + ) { + name = ((struct pre_4_1_0_module_entry *)module_entry)->name; + zend_api = ((struct pre_4_1_0_module_entry *)module_entry)->zend_api; + } else { + name = module_entry->name; + zend_api = module_entry->zend_api; + } + + php_error_docref(NULL TSRMLS_CC, error_type, + "%s: Unable to initialize module\n" + "Module compiled with module API=%d\n" + "PHP compiled with module API=%d\n" + "These options need to match\n", + name, zend_api, ZEND_MODULE_API_NO); + DL_UNLOAD(handle); + return FAILURE; + } + if(strcmp(module_entry->build_id, ZEND_MODULE_BUILD_ID)) { + php_error_docref(NULL TSRMLS_CC, error_type, + "%s: Unable to initialize module\n" + "Module compiled with build ID=%s\n" + "PHP compiled with build ID=%s\n" + "These options need to match\n", + module_entry->name, module_entry->build_id, ZEND_MODULE_BUILD_ID); + DL_UNLOAD(handle); + return FAILURE; + } + module_entry->type = type; + module_entry->module_number = zend_next_free_module(); + module_entry->handle = handle; + + if ((module_entry = zend_register_module_ex(module_entry TSRMLS_CC)) == NULL) { + DL_UNLOAD(handle); + return FAILURE; + } + + if ((type == MODULE_TEMPORARY || start_now) && zend_startup_module_ex(module_entry TSRMLS_CC) == FAILURE) { + DL_UNLOAD(handle); + return FAILURE; + } + + if ((type == MODULE_TEMPORARY || start_now) && module_entry->request_startup_func) { + if (module_entry->request_startup_func(type, module_entry->module_number TSRMLS_CC) == FAILURE) { + php_error_docref(NULL TSRMLS_CC, error_type, "Unable to initialize module '%s'", module_entry->name); + DL_UNLOAD(handle); + return FAILURE; + } + } + return SUCCESS; +} +/* }}} */ + +/* {{{ php_dl + */ +PHPAPI void php_dl(char *file, int type, zval *return_value, int start_now TSRMLS_DC) +{ + /* Load extension */ + if (php_load_extension(file, type, start_now TSRMLS_CC) == FAILURE) { + RETVAL_FALSE; + } else { + RETVAL_TRUE; + } +} +/* }}} */ + +PHP_MINFO_FUNCTION(dl) +{ + php_info_print_table_row(2, "Dynamic Library Support", "enabled"); +} + +#else + +PHPAPI void php_dl(char *file, int type, zval *return_value, int start_now TSRMLS_DC) +{ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot dynamically load %s - dynamic modules are not supported", file); + RETURN_FALSE; +} + +PHP_MINFO_FUNCTION(dl) +{ + PUTS("Dynamic Library support not available
.\n"); +} + +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/dl.h b/ext/standard/dl.h new file mode 100644 index 0000000..030f50e --- /dev/null +++ b/ext/standard/dl.h @@ -0,0 +1,34 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Brian Schaffner | + | Shane Caraveo | + | Zeev Suraski | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef DL_H +#define DL_H + +PHPAPI int php_load_extension(char *filename, int type, int start_now TSRMLS_DC); +PHPAPI void php_dl(char *file, int type, zval *return_value, int start_now TSRMLS_DC); + +/* dynamic loading functions */ +PHPAPI PHP_FUNCTION(dl); + +PHP_MINFO_FUNCTION(dl); + +#endif /* DL_H */ diff --git a/ext/standard/dns.c b/ext/standard/dns.c new file mode 100644 index 0000000..074c16e --- /dev/null +++ b/ext/standard/dns.c @@ -0,0 +1,1048 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: The typical suspects | + | Pollita | + | Marcus Boerger | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +/* {{{ includes */ +#include "php.h" +#include "php_network.h" + +#if HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef PHP_WIN32 +# include "win32/inet.h" +# include +# include +# include +#else /* This holds good for NetWare too, both for Winsock and Berkeley sockets */ +#include +#if HAVE_ARPA_INET_H +#include +#endif +#include +#ifdef _OSD_POSIX +#undef STATUS +#undef T_UNSPEC +#endif +#if HAVE_ARPA_NAMESER_H +#ifdef DARWIN +# define BIND_8_COMPAT 1 +#endif +#include +#endif +#if HAVE_RESOLV_H +#include +#endif +#ifdef HAVE_DNS_H +#include +#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 + +/* For the local hostname obtained via gethostname which is different from the + dns-related MAXHOSTNAMELEN constant above */ +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 255 +#endif + +#include "php_dns.h" + +/* type compat */ +#ifndef DNS_T_A +#define DNS_T_A 1 +#endif +#ifndef DNS_T_NS +#define DNS_T_NS 2 +#endif +#ifndef DNS_T_CNAME +#define DNS_T_CNAME 5 +#endif +#ifndef DNS_T_SOA +#define DNS_T_SOA 6 +#endif +#ifndef DNS_T_PTR +#define DNS_T_PTR 12 +#endif +#ifndef DNS_T_HINFO +#define DNS_T_HINFO 13 +#endif +#ifndef DNS_T_MINFO +#define DNS_T_MINFO 14 +#endif +#ifndef DNS_T_MX +#define DNS_T_MX 15 +#endif +#ifndef DNS_T_TXT +#define DNS_T_TXT 16 +#endif +#ifndef DNS_T_AAAA +#define DNS_T_AAAA 28 +#endif +#ifndef DNS_T_SRV +#define DNS_T_SRV 33 +#endif +#ifndef DNS_T_NAPTR +#define DNS_T_NAPTR 35 +#endif +#ifndef DNS_T_A6 +#define DNS_T_A6 38 +#endif + +#ifndef DNS_T_ANY +#define DNS_T_ANY 255 +#endif +/* }}} */ + +static char *php_gethostbyaddr(char *ip); +static char *php_gethostbyname(char *name); + +#ifdef HAVE_GETHOSTNAME +/* {{{ proto string gethostname() + Get the host name of the current machine */ +PHP_FUNCTION(gethostname) +{ + char buf[HOST_NAME_MAX]; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + if (gethostname(buf, sizeof(buf) - 1)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to fetch host [%d]: %s", errno, strerror(errno)); + RETURN_FALSE; + } + + RETURN_STRING(buf, 1); +} +/* }}} */ +#endif + +/* TODO: Reimplement the gethostby* functions using the new winxp+ API, in dns_win32.c, then + we can have a dns.c, dns_unix.c and dns_win32.c instead of a messy dns.c full of #ifdef +*/ + +/* {{{ proto string gethostbyaddr(string ip_address) + Get the Internet host name corresponding to a given IP address */ +PHP_FUNCTION(gethostbyaddr) +{ + char *addr; + int addr_len; + char *hostname; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &addr, &addr_len) == FAILURE) { + return; + } + + hostname = php_gethostbyaddr(addr); + + if (hostname == NULL) { +#if HAVE_IPV6 && HAVE_INET_PTON + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Address is not a valid IPv4 or IPv6 address"); +#else + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Address is not in a.b.c.d form"); +#endif + RETVAL_FALSE; + } else { + RETVAL_STRING(hostname, 0); + } +} +/* }}} */ + +/* {{{ php_gethostbyaddr */ +static char *php_gethostbyaddr(char *ip) +{ +#if HAVE_IPV6 && HAVE_INET_PTON + struct in6_addr addr6; +#endif + struct in_addr addr; + struct hostent *hp; + +#if HAVE_IPV6 && HAVE_INET_PTON + if (inet_pton(AF_INET6, ip, &addr6)) { + hp = gethostbyaddr((char *) &addr6, sizeof(addr6), AF_INET6); + } else if (inet_pton(AF_INET, ip, &addr)) { + hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET); + } else { + return NULL; + } +#else + addr.s_addr = inet_addr(ip); + + if (addr.s_addr == -1) { + return NULL; + } + + hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET); +#endif + + if (!hp || hp->h_name == NULL || hp->h_name[0] == '\0') { + return estrdup(ip); + } + + return estrdup(hp->h_name); +} +/* }}} */ + +/* {{{ proto string gethostbyname(string hostname) + Get the IP address corresponding to a given Internet host name */ +PHP_FUNCTION(gethostbyname) +{ + char *hostname; + int hostname_len; + char *addr; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &hostname_len) == FAILURE) { + return; + } + + addr = php_gethostbyname(hostname); + + RETVAL_STRING(addr, 0); +} +/* }}} */ + +/* {{{ proto array gethostbynamel(string hostname) + Return a list of IP addresses that a given hostname resolves to. */ +PHP_FUNCTION(gethostbynamel) +{ + char *hostname; + int hostname_len; + struct hostent *hp; + struct in_addr in; + int i; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &hostname_len) == FAILURE) { + return; + } + + hp = gethostbyname(hostname); + if (hp == NULL || hp->h_addr_list == NULL) { + RETURN_FALSE; + } + + array_init(return_value); + + for (i = 0 ; hp->h_addr_list[i] != 0 ; i++) { + in = *(struct in_addr *) hp->h_addr_list[i]; + add_next_index_string(return_value, inet_ntoa(in), 1); + } +} +/* }}} */ + +/* {{{ php_gethostbyname */ +static char *php_gethostbyname(char *name) +{ + struct hostent *hp; + struct in_addr in; + + hp = gethostbyname(name); + + if (!hp || !*(hp->h_addr_list)) { + return estrdup(name); + } + + memcpy(&in.s_addr, *(hp->h_addr_list), sizeof(in.s_addr)); + + return estrdup(inet_ntoa(in)); +} +/* }}} */ + +#if HAVE_FULL_DNS_FUNCS || defined(PHP_WIN32) +# define PHP_DNS_NUM_TYPES 12 /* Number of DNS Types Supported by PHP currently */ + +# define PHP_DNS_A 0x00000001 +# define PHP_DNS_NS 0x00000002 +# define PHP_DNS_CNAME 0x00000010 +# define PHP_DNS_SOA 0x00000020 +# define PHP_DNS_PTR 0x00000800 +# define PHP_DNS_HINFO 0x00001000 +# define PHP_DNS_MX 0x00004000 +# define PHP_DNS_TXT 0x00008000 +# define PHP_DNS_A6 0x01000000 +# define PHP_DNS_SRV 0x02000000 +# define PHP_DNS_NAPTR 0x04000000 +# define PHP_DNS_AAAA 0x08000000 +# define PHP_DNS_ANY 0x10000000 +# define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_A6|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_AAAA) +#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))) + +#ifndef HFIXEDSZ +#define HFIXEDSZ 12 /* fixed data in header */ +#endif /* HFIXEDSZ */ + +#ifndef QFIXEDSZ +#define QFIXEDSZ 4 /* fixed data in query */ +#endif /* QFIXEDSZ */ + +#undef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 1024 + +#ifndef MAXRESOURCERECORDS +#define MAXRESOURCERECORDS 64 +#endif /* MAXRESOURCERECORDS */ + +typedef union { + HEADER qb1; + u_char qb2[65536]; +} querybuf; + +/* just a hack to free resources allocated by glibc in __res_nsend() + * See also: + * res_thread_freeres() in glibc/resolv/res_init.c + * __libc_res_nsend() in resolv/res_send.c + * */ + +#if defined(__GLIBC__) && !defined(HAVE_DEPRECATED_DNS_FUNCS) +#define php_dns_free_res(__res__) _php_dns_free_res(__res__) +static void _php_dns_free_res(struct __res_state res) { /* {{{ */ + int ns; + for (ns = 0; ns < MAXNS; ns++) { + if (res._u._ext.nsaddrs[ns] != NULL) { + free (res._u._ext.nsaddrs[ns]); + res._u._ext.nsaddrs[ns] = NULL; + } + } +} /* }}} */ +#else +#define php_dns_free_res(__res__) +#endif + +/* {{{ proto bool dns_check_record(string host [, string type]) + Check DNS records corresponding to a given Internet host name or IP address */ +PHP_FUNCTION(dns_check_record) +{ +#ifndef MAXPACKET +#define MAXPACKET 8192 /* max packet size used internally by BIND */ +#endif + u_char ans[MAXPACKET]; + char *hostname, *rectype = NULL; + int hostname_len, rectype_len = 0; + int type = T_MX, i; +#if defined(HAVE_DNS_SEARCH) + struct sockaddr_storage from; + uint32_t fromsize = sizeof(from); + dns_handle_t handle; +#elif defined(HAVE_RES_NSEARCH) + struct __res_state state; + struct __res_state *handle = &state; +#endif + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &hostname, &hostname_len, &rectype, &rectype_len) == FAILURE) { + return; + } + + if (hostname_len == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host cannot be empty"); + RETURN_FALSE; + } + + if (rectype) { + if (!strcasecmp("A", rectype)) type = T_A; + else if (!strcasecmp("NS", rectype)) type = DNS_T_NS; + else if (!strcasecmp("MX", rectype)) type = DNS_T_MX; + else if (!strcasecmp("PTR", rectype)) type = DNS_T_PTR; + else if (!strcasecmp("ANY", rectype)) type = DNS_T_ANY; + else if (!strcasecmp("SOA", rectype)) type = DNS_T_SOA; + else if (!strcasecmp("TXT", rectype)) type = DNS_T_TXT; + else if (!strcasecmp("CNAME", rectype)) type = DNS_T_CNAME; + else if (!strcasecmp("AAAA", rectype)) type = DNS_T_AAAA; + else if (!strcasecmp("SRV", rectype)) type = DNS_T_SRV; + else if (!strcasecmp("NAPTR", rectype)) type = DNS_T_NAPTR; + else if (!strcasecmp("A6", rectype)) type = DNS_T_A6; + else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type '%s' not supported", rectype); + RETURN_FALSE; + } + } + +#if defined(HAVE_DNS_SEARCH) + handle = dns_open(NULL); + if (handle == NULL) { + RETURN_FALSE; + } +#elif defined(HAVE_RES_NSEARCH) + memset(&state, 0, sizeof(state)); + if (res_ninit(handle)) { + RETURN_FALSE; + } +#else + res_init(); +#endif + + RETVAL_TRUE; + i = php_dns_search(handle, hostname, C_IN, type, ans, sizeof(ans)); + + if (i < 0) { + RETVAL_FALSE; + } + + php_dns_free_handle(handle); +} +/* }}} */ + +#if HAVE_FULL_DNS_FUNCS + +/* {{{ php_parserr */ +static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int store, int raw, zval **subarray) +{ + u_short type, class, dlen; + u_long ttl; + long n, i; + u_short s; + u_char *tp, *p; + char name[MAXHOSTNAMELEN]; + int have_v6_break = 0, in_v6_break = 0; + + *subarray = NULL; + + n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, sizeof(name) - 2); + if (n < 0) { + return NULL; + } + cp += n; + + GETSHORT(type, cp); + GETSHORT(class, cp); + GETLONG(ttl, cp); + GETSHORT(dlen, cp); + if (type_to_fetch != T_ANY && type != type_to_fetch) { + cp += dlen; + return cp; + } + + if (!store) { + cp += dlen; + return cp; + } + + ALLOC_INIT_ZVAL(*subarray); + array_init(*subarray); + + add_assoc_string(*subarray, "host", name, 1); + add_assoc_string(*subarray, "class", "IN", 1); + add_assoc_long(*subarray, "ttl", ttl); + + if (raw) { + add_assoc_long(*subarray, "type", type); + add_assoc_stringl(*subarray, "data", (char*) cp, (uint) dlen, 1); + cp += dlen; + return cp; + } + + switch (type) { + case DNS_T_A: + add_assoc_string(*subarray, "type", "A", 1); + snprintf(name, sizeof(name), "%d.%d.%d.%d", cp[0], cp[1], cp[2], cp[3]); + add_assoc_string(*subarray, "ip", name, 1); + cp += dlen; + break; + case DNS_T_MX: + add_assoc_string(*subarray, "type", "MX", 1); + GETSHORT(n, cp); + add_assoc_long(*subarray, "pri", n); + /* no break; */ + case DNS_T_CNAME: + if (type == DNS_T_CNAME) { + add_assoc_string(*subarray, "type", "CNAME", 1); + } + /* no break; */ + case DNS_T_NS: + if (type == DNS_T_NS) { + add_assoc_string(*subarray, "type", "NS", 1); + } + /* no break; */ + case DNS_T_PTR: + if (type == DNS_T_PTR) { + add_assoc_string(*subarray, "type", "PTR", 1); + } + n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2); + if (n < 0) { + return NULL; + } + cp += n; + add_assoc_string(*subarray, "target", name, 1); + break; + case DNS_T_HINFO: + /* See RFC 1010 for values */ + add_assoc_string(*subarray, "type", "HINFO", 1); + n = *cp & 0xFF; + cp++; + add_assoc_stringl(*subarray, "cpu", (char*)cp, n, 1); + cp += n; + n = *cp & 0xFF; + cp++; + add_assoc_stringl(*subarray, "os", (char*)cp, n, 1); + cp += n; + break; + case DNS_T_TXT: + { + int ll = 0; + zval *entries = NULL; + + add_assoc_string(*subarray, "type", "TXT", 1); + tp = emalloc(dlen + 1); + + MAKE_STD_ZVAL(entries); + array_init(entries); + + while (ll < dlen) { + n = cp[ll]; + memcpy(tp + ll , cp + ll + 1, n); + add_next_index_stringl(entries, cp + ll + 1, n, 1); + ll = ll + n + 1; + } + tp[dlen] = '\0'; + cp += dlen; + + add_assoc_stringl(*subarray, "txt", tp, dlen - 1, 0); + add_assoc_zval(*subarray, "entries", entries); + } + break; + case DNS_T_SOA: + add_assoc_string(*subarray, "type", "SOA", 1); + n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) -2); + if (n < 0) { + return NULL; + } + cp += n; + add_assoc_string(*subarray, "mname", name, 1); + n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) -2); + if (n < 0) { + return NULL; + } + cp += n; + add_assoc_string(*subarray, "rname", name, 1); + GETLONG(n, cp); + add_assoc_long(*subarray, "serial", n); + GETLONG(n, cp); + add_assoc_long(*subarray, "refresh", n); + GETLONG(n, cp); + add_assoc_long(*subarray, "retry", n); + GETLONG(n, cp); + add_assoc_long(*subarray, "expire", n); + GETLONG(n, cp); + add_assoc_long(*subarray, "minimum-ttl", n); + break; + case DNS_T_AAAA: + tp = (u_char*)name; + for(i=0; i < 8; i++) { + GETSHORT(s, cp); + if (s != 0) { + if (tp > (u_char *)name) { + in_v6_break = 0; + tp[0] = ':'; + tp++; + } + tp += sprintf((char*)tp,"%x",s); + } else { + if (!have_v6_break) { + have_v6_break = 1; + in_v6_break = 1; + tp[0] = ':'; + tp++; + } else if (!in_v6_break) { + tp[0] = ':'; + tp++; + tp[0] = '0'; + tp++; + } + } + } + if (have_v6_break && in_v6_break) { + tp[0] = ':'; + tp++; + } + tp[0] = '\0'; + add_assoc_string(*subarray, "type", "AAAA", 1); + add_assoc_string(*subarray, "ipv6", name, 1); + break; + case DNS_T_A6: + p = cp; + add_assoc_string(*subarray, "type", "A6", 1); + n = ((int)cp[0]) & 0xFF; + cp++; + add_assoc_long(*subarray, "masklen", n); + tp = (u_char*)name; + if (n > 15) { + have_v6_break = 1; + in_v6_break = 1; + tp[0] = ':'; + tp++; + } + if (n % 16 > 8) { + /* Partial short */ + if (cp[0] != 0) { + if (tp > (u_char *)name) { + in_v6_break = 0; + tp[0] = ':'; + tp++; + } + sprintf((char*)tp, "%x", cp[0] & 0xFF); + } else { + if (!have_v6_break) { + have_v6_break = 1; + in_v6_break = 1; + tp[0] = ':'; + tp++; + } else if (!in_v6_break) { + tp[0] = ':'; + tp++; + tp[0] = '0'; + tp++; + } + } + cp++; + } + for (i = (n + 8) / 16; i < 8; i++) { + GETSHORT(s, cp); + if (s != 0) { + if (tp > (u_char *)name) { + in_v6_break = 0; + tp[0] = ':'; + tp++; + } + tp += sprintf((char*)tp,"%x",s); + } else { + if (!have_v6_break) { + have_v6_break = 1; + in_v6_break = 1; + tp[0] = ':'; + tp++; + } else if (!in_v6_break) { + tp[0] = ':'; + tp++; + tp[0] = '0'; + tp++; + } + } + } + if (have_v6_break && in_v6_break) { + tp[0] = ':'; + tp++; + } + tp[0] = '\0'; + add_assoc_string(*subarray, "ipv6", name, 1); + if (cp < p + dlen) { + n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2); + if (n < 0) { + return NULL; + } + cp += n; + add_assoc_string(*subarray, "chain", name, 1); + } + break; + case DNS_T_SRV: + add_assoc_string(*subarray, "type", "SRV", 1); + GETSHORT(n, cp); + add_assoc_long(*subarray, "pri", n); + GETSHORT(n, cp); + add_assoc_long(*subarray, "weight", n); + GETSHORT(n, cp); + add_assoc_long(*subarray, "port", n); + n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2); + if (n < 0) { + return NULL; + } + cp += n; + add_assoc_string(*subarray, "target", name, 1); + break; + case DNS_T_NAPTR: + add_assoc_string(*subarray, "type", "NAPTR", 1); + GETSHORT(n, cp); + add_assoc_long(*subarray, "order", n); + GETSHORT(n, cp); + add_assoc_long(*subarray, "pref", n); + n = (cp[0] & 0xFF); + add_assoc_stringl(*subarray, "flags", (char*)++cp, n, 1); + cp += n; + n = (cp[0] & 0xFF); + add_assoc_stringl(*subarray, "services", (char*)++cp, n, 1); + cp += n; + n = (cp[0] & 0xFF); + add_assoc_stringl(*subarray, "regex", (char*)++cp, n, 1); + cp += n; + n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2); + if (n < 0) { + return NULL; + } + cp += n; + add_assoc_string(*subarray, "replacement", name, 1); + break; + default: + zval_ptr_dtor(subarray); + *subarray = NULL; + cp += dlen; + break; + } + + return cp; +} +/* }}} */ + +/* {{{ proto array|false dns_get_record(string hostname [, int type[, array authns, array addtl]]) + Get any Resource Record corresponding to a given Internet host name */ +PHP_FUNCTION(dns_get_record) +{ + char *hostname; + int hostname_len; + long type_param = PHP_DNS_ANY; + zval *authns = NULL, *addtl = NULL; + int type_to_fetch; +#if defined(HAVE_DNS_SEARCH) + struct sockaddr_storage from; + uint32_t fromsize = sizeof(from); + dns_handle_t handle; +#elif defined(HAVE_RES_NSEARCH) + struct __res_state state; + struct __res_state *handle = &state; +#endif + HEADER *hp; + querybuf answer; + u_char *cp = NULL, *end = NULL; + int n, qd, an, ns = 0, ar = 0; + int type, first_query = 1, store_results = 1; + zend_bool raw = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz!z!b", + &hostname, &hostname_len, &type_param, &authns, &addtl, &raw) == FAILURE) { + return; + } + + if (authns) { + zval_dtor(authns); + array_init(authns); + } + if (addtl) { + zval_dtor(addtl); + array_init(addtl); + } + + if (!raw) { + if ((type_param & ~PHP_DNS_ALL) && (type_param != PHP_DNS_ANY)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type '%ld' not supported", type_param); + RETURN_FALSE; + } + } else { + if ((type_param < 1) || (type_param > 0xFFFF)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "Numeric DNS record type must be between 1 and 65535, '%ld' given", type_param); + RETURN_FALSE; + } + } + + /* Initialize the return array */ + array_init(return_value); + + /* - We emulate an or'ed type mask by querying type by type. (Steps 0 - NUMTYPES-1 ) + * If additional info is wanted we check again with DNS_T_ANY (step NUMTYPES / NUMTYPES+1 ) + * store_results is used to skip storing the results retrieved in step + * NUMTYPES+1 when results were already fetched. + * - In case of PHP_DNS_ANY we use the directly fetch DNS_T_ANY. (step NUMTYPES+1 ) + * - In case of raw mode, we query only the requestd type instead of looping type by type + * before going with the additional info stuff. + */ + + if (raw) { + type = -1; + } else if (type_param == PHP_DNS_ANY) { + type = PHP_DNS_NUM_TYPES + 1; + } else { + type = 0; + } + + for ( ; + type < (addtl ? (PHP_DNS_NUM_TYPES + 2) : PHP_DNS_NUM_TYPES) || first_query; + type++ + ) { + first_query = 0; + switch (type) { + case -1: /* raw */ + type_to_fetch = type_param; + /* skip over the rest and go directly to additional records */ + type = PHP_DNS_NUM_TYPES - 1; + break; + case 0: + type_to_fetch = type_param&PHP_DNS_A ? DNS_T_A : 0; + break; + case 1: + type_to_fetch = type_param&PHP_DNS_NS ? DNS_T_NS : 0; + break; + case 2: + type_to_fetch = type_param&PHP_DNS_CNAME ? DNS_T_CNAME : 0; + break; + case 3: + type_to_fetch = type_param&PHP_DNS_SOA ? DNS_T_SOA : 0; + break; + case 4: + type_to_fetch = type_param&PHP_DNS_PTR ? DNS_T_PTR : 0; + break; + case 5: + type_to_fetch = type_param&PHP_DNS_HINFO ? DNS_T_HINFO : 0; + break; + case 6: + type_to_fetch = type_param&PHP_DNS_MX ? DNS_T_MX : 0; + break; + case 7: + type_to_fetch = type_param&PHP_DNS_TXT ? DNS_T_TXT : 0; + break; + case 8: + type_to_fetch = type_param&PHP_DNS_AAAA ? DNS_T_AAAA : 0; + break; + case 9: + type_to_fetch = type_param&PHP_DNS_SRV ? DNS_T_SRV : 0; + break; + case 10: + type_to_fetch = type_param&PHP_DNS_NAPTR ? DNS_T_NAPTR : 0; + break; + case 11: + type_to_fetch = type_param&PHP_DNS_A6 ? DNS_T_A6 : 0; + break; + case PHP_DNS_NUM_TYPES: + store_results = 0; + continue; + default: + case (PHP_DNS_NUM_TYPES + 1): + type_to_fetch = DNS_T_ANY; + break; + } + + if (type_to_fetch) { +#if defined(HAVE_DNS_SEARCH) + handle = dns_open(NULL); + if (handle == NULL) { + zval_dtor(return_value); + RETURN_FALSE; + } +#elif defined(HAVE_RES_NSEARCH) + memset(&state, 0, sizeof(state)); + if (res_ninit(handle)) { + zval_dtor(return_value); + RETURN_FALSE; + } +#else + res_init(); +#endif + + n = php_dns_search(handle, hostname, C_IN, type_to_fetch, answer.qb2, sizeof answer); + + if (n < 0) { + php_dns_free_handle(handle); + continue; + } + + cp = answer.qb2 + HFIXEDSZ; + end = answer.qb2 + n; + hp = (HEADER *)&answer; + qd = ntohs(hp->qdcount); + an = ntohs(hp->ancount); + ns = ntohs(hp->nscount); + ar = ntohs(hp->arcount); + + /* Skip QD entries, they're only used by dn_expand later on */ + while (qd-- > 0) { + n = dn_skipname(cp, end); + if (n < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to parse DNS data received"); + zval_dtor(return_value); + php_dns_free_handle(handle); + RETURN_FALSE; + } + cp += n + QFIXEDSZ; + } + + /* YAY! Our real answers! */ + while (an-- && cp && cp < end) { + zval *retval; + + cp = php_parserr(cp, &answer, type_to_fetch, store_results, raw, &retval); + if (retval != NULL && store_results) { + add_next_index_zval(return_value, retval); + } + } + + if (authns || addtl) { + /* List of Authoritative Name Servers + * Process when only requesting addtl so that we can skip through the section + */ + while (ns-- > 0 && cp && cp < end) { + zval *retval = NULL; + + cp = php_parserr(cp, &answer, DNS_T_ANY, authns != NULL, raw, &retval); + if (retval != NULL) { + add_next_index_zval(authns, retval); + } + } + } + + if (addtl) { + /* Additional records associated with authoritative name servers */ + while (ar-- > 0 && cp && cp < end) { + zval *retval = NULL; + + cp = php_parserr(cp, &answer, DNS_T_ANY, 1, raw, &retval); + if (retval != NULL) { + add_next_index_zval(addtl, retval); + } + } + } + php_dns_free_handle(handle); + } + } +} +/* }}} */ + +/* {{{ proto bool dns_get_mx(string hostname, array mxhosts [, array weight]) + Get MX records corresponding to a given Internet host name */ +PHP_FUNCTION(dns_get_mx) +{ + char *hostname; + int hostname_len; + zval *mx_list, *weight_list = NULL; + int count, qdc; + u_short type, weight; + u_char ans[MAXPACKET]; + char buf[MAXHOSTNAMELEN]; + HEADER *hp; + u_char *cp, *end; + int i; +#if defined(HAVE_DNS_SEARCH) + struct sockaddr_storage from; + uint32_t fromsize = sizeof(from); + dns_handle_t handle; +#elif defined(HAVE_RES_NSEARCH) + struct __res_state state; + struct __res_state *handle = &state; +#endif + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|z", &hostname, &hostname_len, &mx_list, &weight_list) == FAILURE) { + return; + } + + zval_dtor(mx_list); + array_init(mx_list); + + if (weight_list) { + zval_dtor(weight_list); + array_init(weight_list); + } + +#if defined(HAVE_DNS_SEARCH) + handle = dns_open(NULL); + if (handle == NULL) { + RETURN_FALSE; + } +#elif defined(HAVE_RES_NSEARCH) + memset(&state, 0, sizeof(state)); + if (res_ninit(handle)) { + RETURN_FALSE; + } +#else + res_init(); +#endif + + i = php_dns_search(handle, hostname, C_IN, DNS_T_MX, (u_char *)&ans, sizeof(ans)); + if (i < 0) { + RETURN_FALSE; + } + if (i > (int)sizeof(ans)) { + i = sizeof(ans); + } + hp = (HEADER *)&ans; + cp = (u_char *)&ans + HFIXEDSZ; + end = (u_char *)&ans +i; + for (qdc = ntohs((unsigned short)hp->qdcount); qdc--; cp += i + QFIXEDSZ) { + if ((i = dn_skipname(cp, end)) < 0 ) { + php_dns_free_handle(handle); + RETURN_FALSE; + } + } + count = ntohs((unsigned short)hp->ancount); + while (--count >= 0 && cp < end) { + if ((i = dn_skipname(cp, end)) < 0 ) { + php_dns_free_handle(handle); + RETURN_FALSE; + } + cp += i; + GETSHORT(type, cp); + cp += INT16SZ + INT32SZ; + GETSHORT(i, cp); + if (type != DNS_T_MX) { + cp += i; + continue; + } + GETSHORT(weight, cp); + if ((i = dn_expand(ans, end, cp, buf, sizeof(buf)-1)) < 0) { + php_dns_free_handle(handle); + RETURN_FALSE; + } + cp += i; + add_next_index_string(mx_list, buf, 1); + if (weight_list) { + add_next_index_long(weight_list, weight); + } + } + php_dns_free_handle(handle); + RETURN_TRUE; +} +/* }}} */ +#endif /* HAVE_FULL_DNS_FUNCS */ +#endif /* !defined(PHP_WIN32) && (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE))) */ + +#if HAVE_FULL_DNS_FUNCS || defined(PHP_WIN32) +PHP_MINIT_FUNCTION(dns) { + REGISTER_LONG_CONSTANT("DNS_A", PHP_DNS_A, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_NS", PHP_DNS_NS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_CNAME", PHP_DNS_CNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_SOA", PHP_DNS_SOA, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_PTR", PHP_DNS_PTR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_HINFO", PHP_DNS_HINFO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_MX", PHP_DNS_MX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_TXT", PHP_DNS_TXT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_SRV", PHP_DNS_SRV, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_NAPTR", PHP_DNS_NAPTR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_AAAA", PHP_DNS_AAAA, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_A6", PHP_DNS_A6, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_ANY", PHP_DNS_ANY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_ALL", PHP_DNS_ALL, CONST_CS | CONST_PERSISTENT); + return SUCCESS; +} +#endif /* HAVE_FULL_DNS_FUNCS */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c new file mode 100644 index 0000000..2dbf3e2 --- /dev/null +++ b/ext/standard/dns_win32.c @@ -0,0 +1,506 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 2008-2009 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Pierre A. Joye | + +----------------------------------------------------------------------+ + */ + +#include "php.h" + +#include +#include +#include + +#include "php_dns.h" + +#define PHP_DNS_NUM_TYPES 12 /* Number of DNS Types Supported by PHP currently */ + +#define PHP_DNS_A 0x00000001 +#define PHP_DNS_NS 0x00000002 +#define PHP_DNS_CNAME 0x00000010 +#define PHP_DNS_SOA 0x00000020 +#define PHP_DNS_PTR 0x00000800 +#define PHP_DNS_HINFO 0x00001000 +#define PHP_DNS_MX 0x00004000 +#define PHP_DNS_TXT 0x00008000 +#define PHP_DNS_A6 0x01000000 +#define PHP_DNS_SRV 0x02000000 +#define PHP_DNS_NAPTR 0x04000000 +#define PHP_DNS_AAAA 0x08000000 +#define PHP_DNS_ANY 0x10000000 +#define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_A6|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_AAAA) + +PHP_FUNCTION(dns_get_mx) /* {{{ */ +{ + char *hostname; + int hostname_len; + zval *mx_list, *weight_list = NULL; + + DNS_STATUS status; /* Return value of DnsQuery_A() function */ + PDNS_RECORD pResult, pRec; /* Pointer to DNS_RECORD structure */ + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|z", &hostname, &hostname_len, &mx_list, &weight_list) == FAILURE) { + return; + } + + status = DnsQuery_A(hostname, DNS_TYPE_MX, DNS_QUERY_STANDARD, NULL, &pResult, NULL); + + if (status) { + RETURN_FALSE; + } + + zval_dtor(mx_list); + array_init(mx_list); + + if (weight_list) { + zval_dtor(weight_list); + array_init(weight_list); + } + + for (pRec = pResult; pRec; pRec = pRec->pNext) { + DNS_SRV_DATA *srv = &pRec->Data.Srv; + + if (pRec->wType != DNS_TYPE_MX) { + continue; + } + + add_next_index_string(mx_list, pRec->Data.MX.pNameExchange, 1); + if (weight_list) { + add_next_index_long(weight_list, srv->wPriority); + } + } + + /* Free memory allocated for DNS records. */ + DnsRecordListFree(pResult, DnsFreeRecordListDeep); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool dns_check_record(string host [, string type]) + Check DNS records corresponding to a given Internet host name or IP address */ +PHP_FUNCTION(dns_check_record) +{ + char *hostname, *rectype = NULL; + int hostname_len, rectype_len = 0; + int type = DNS_TYPE_MX; + + DNS_STATUS status; /* Return value of DnsQuery_A() function */ + PDNS_RECORD pResult; /* Pointer to DNS_RECORD structure */ + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &hostname, &hostname_len, &rectype, &rectype_len) == FAILURE) { + return; + } + + if (hostname_len == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host cannot be empty"); + RETURN_FALSE; + } + + if (rectype) { + if (!strcasecmp("A", rectype)) type = DNS_TYPE_A; + else if (!strcasecmp("NS", rectype)) type = DNS_TYPE_NS; + else if (!strcasecmp("MX", rectype)) type = DNS_TYPE_MX; + else if (!strcasecmp("PTR", rectype)) type = DNS_TYPE_PTR; + else if (!strcasecmp("ANY", rectype)) type = DNS_TYPE_ANY; + else if (!strcasecmp("SOA", rectype)) type = DNS_TYPE_SOA; + else if (!strcasecmp("TXT", rectype)) type = DNS_TYPE_TEXT; + else if (!strcasecmp("CNAME", rectype)) type = DNS_TYPE_CNAME; + else if (!strcasecmp("AAAA", rectype)) type = DNS_TYPE_AAAA; + else if (!strcasecmp("SRV", rectype)) type = DNS_TYPE_SRV; + else if (!strcasecmp("NAPTR", rectype)) type = DNS_TYPE_NAPTR; + else if (!strcasecmp("A6", rectype)) type = DNS_TYPE_A6; + else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type '%s' not supported", rectype); + RETURN_FALSE; + } + } + + status = DnsQuery_A(hostname, type, DNS_QUERY_STANDARD, NULL, &pResult, NULL); + + if (status) { + RETURN_FALSE; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ php_parserr */ +static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, zval **subarray) +{ + int type; + u_long ttl; + + type = pRec->wType; + ttl = pRec->dwTtl; + + if (type_to_fetch != DNS_TYPE_ANY && type != type_to_fetch) { + return; + } + + if (!store) { + return; + } + + ALLOC_INIT_ZVAL(*subarray); + array_init(*subarray); + + add_assoc_string(*subarray, "host", pRec->pName, 1); + add_assoc_string(*subarray, "class", "IN", 1); + add_assoc_long(*subarray, "ttl", ttl); + + if (raw) { + add_assoc_long(*subarray, "type", type); + add_assoc_stringl(*subarray, "data", (char*) &pRec->Data, (uint) pRec->wDataLength, 1); + return; + } + + switch (type) { + case DNS_TYPE_A: { + IN_ADDR ipaddr; + ipaddr.S_un.S_addr = (pRec->Data.A.IpAddress); + add_assoc_string(*subarray, "type", "A", 1); + add_assoc_string(*subarray, "ip", inet_ntoa(ipaddr), 1); + break; + } + + case DNS_TYPE_MX: + add_assoc_string(*subarray, "type", "MX", 1); + add_assoc_long(*subarray, "pri", pRec->Data.Srv.wPriority); + /* no break; */ + + case DNS_TYPE_CNAME: + if (type == DNS_TYPE_CNAME) { + add_assoc_string(*subarray, "type", "CNAME", 1); + } + /* no break; */ + + case DNS_TYPE_NS: + if (type == DNS_TYPE_NS) { + add_assoc_string(*subarray, "type", "NS", 1); + } + /* no break; */ + + case DNS_TYPE_PTR: + if (type == DNS_TYPE_PTR) { + add_assoc_string(*subarray, "type", "PTR", 1); + } + add_assoc_string(*subarray, "target", pRec->Data.MX.pNameExchange, 1); + break; + + /* Not available on windows, the query is possible but there is no DNS_HINFO_DATA structure */ + case DNS_TYPE_HINFO: + case DNS_TYPE_TEXT: + { + DWORD i = 0; + DNS_TXT_DATA *data_txt = &pRec->Data.TXT; + DWORD count = data_txt->dwStringCount; + char *txt, *txt_dst; + long txt_len = 0; + zval *entries; + + add_assoc_string(*subarray, "type", "TXT", 1); + + ALLOC_INIT_ZVAL(entries); + array_init(entries); + + for (i = 0; i < count; i++) { + txt_len += strlen(data_txt->pStringArray[i]) + 1; + } + + txt = ecalloc(txt_len * 2, 1); + txt_dst = txt; + for (i = 0; i < count; i++) { + int len = strlen(data_txt->pStringArray[i]); + memcpy(txt_dst, data_txt->pStringArray[i], len); + add_next_index_stringl(entries, data_txt->pStringArray[i], len, 1); + txt_dst += len; + } + + add_assoc_string(*subarray, "txt", txt, 0); + add_assoc_zval(*subarray, "entries", entries); + } + break; + + case DNS_TYPE_SOA: + { + DNS_SOA_DATA *data_soa = &pRec->Data.Soa; + + add_assoc_string(*subarray, "type", "SOA", 1); + + add_assoc_string(*subarray, "mname", data_soa->pNamePrimaryServer, 1); + add_assoc_string(*subarray, "rname", data_soa->pNameAdministrator, 1); + add_assoc_long(*subarray, "serial", data_soa->dwSerialNo); + add_assoc_long(*subarray, "refresh", data_soa->dwRefresh); + add_assoc_long(*subarray, "retry", data_soa->dwRetry); + add_assoc_long(*subarray, "expire", data_soa->dwExpire); + add_assoc_long(*subarray, "minimum-ttl", data_soa->dwDefaultTtl); + } + break; + + case DNS_TYPE_AAAA: + { + DNS_AAAA_DATA *data_aaaa = &pRec->Data.AAAA; + char buf[sizeof("AAAA:AAAA:AAAA:AAAA:AAAA:AAAA:AAAA:AAAA")]; + char *tp = buf; + int i; + unsigned short out[8]; + int have_v6_break = 0, in_v6_break = 0; + + for (i = 0; i < 4; ++i) { + DWORD chunk = data_aaaa->Ip6Address.IP6Dword[i]; + out[i * 2] = htons(LOWORD(chunk)); + out[i * 2 + 1] = htons(HIWORD(chunk)); + } + + for(i=0; i < 8; i++) { + if (out[i] != 0) { + if (tp > (u_char *)buf) { + in_v6_break = 0; + tp[0] = ':'; + tp++; + } + tp += sprintf((char*)tp,"%x", out[i]); + } else { + if (!have_v6_break) { + have_v6_break = 1; + in_v6_break = 1; + tp[0] = ':'; + tp++; + } else if (!in_v6_break) { + tp[0] = ':'; + tp++; + tp[0] = '0'; + tp++; + } + } + } + + if (have_v6_break && in_v6_break) { + tp[0] = ':'; + tp++; + } + tp[0] = '\0'; + + add_assoc_string(*subarray, "type", "AAAA", 1); + add_assoc_string(*subarray, "ipv6", buf, 1); + } + break; + +#if 0 + /* Won't be implemented. A6 is deprecated. (Pierre) */ + case DNS_TYPE_A6: + break; +#endif + + case DNS_TYPE_SRV: + { + DNS_SRV_DATA *data_srv = &pRec->Data.Srv; + + add_assoc_string(*subarray, "type", "SRV", 1); + add_assoc_long(*subarray, "pri", data_srv->wPriority); + add_assoc_long(*subarray, "weight", data_srv->wWeight); + add_assoc_long(*subarray, "port", data_srv->wPort); + add_assoc_string(*subarray, "target", data_srv->pNameTarget, 1); + } + break; + +#if _MSC_VER >= 1500 + case DNS_TYPE_NAPTR: + { + DNS_NAPTR_DATA * data_naptr = &pRec->Data.Naptr; + + add_assoc_string(*subarray, "type", "NAPTR", 1); + add_assoc_long(*subarray, "order", data_naptr->wOrder); + add_assoc_long(*subarray, "pref", data_naptr->wPreference); + add_assoc_string(*subarray, "flags", data_naptr->pFlags, 1); + add_assoc_string(*subarray, "services", data_naptr->pService, 1); + add_assoc_string(*subarray, "regex", data_naptr->pRegularExpression, 1); + add_assoc_string(*subarray, "replacement", data_naptr->pReplacement, 1); + } + break; +#endif + + default: + /* unkown type */ + zval_ptr_dtor(subarray); + *subarray = NULL; + return; + } + +} +/* }}} */ + +/* {{{ proto array|false dns_get_record(string hostname [, int type[, array authns, array addtl]]) + Get any Resource Record corresponding to a given Internet host name */ +PHP_FUNCTION(dns_get_record) +{ + char *hostname; + int hostname_len; + long type_param = PHP_DNS_ANY; + zval *authns = NULL, *addtl = NULL; + int type, type_to_fetch, first_query = 1, store_results = 1; + zend_bool raw = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz!z!b", + &hostname, &hostname_len, &type_param, &authns, &addtl, &raw) == FAILURE) { + return; + } + + if (authns) { + zval_dtor(authns); + array_init(authns); + } + if (addtl) { + zval_dtor(addtl); + array_init(addtl); + } + + if (!raw) { + if ((type_param & ~PHP_DNS_ALL) && (type_param != PHP_DNS_ANY)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type '%ld' not supported", type_param); + RETURN_FALSE; + } + } else { + if ((type_param < 1) || (type_param > 0xFFFF)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "Numeric DNS record type must be between 1 and 65535, '%ld' given", type_param); + RETURN_FALSE; + } + } + + /* Initialize the return array */ + array_init(return_value); + + if (raw) { + type = -1; + } else if (type_param == PHP_DNS_ANY) { + type = PHP_DNS_NUM_TYPES + 1; + } else { + type = 0; + } + + for ( ; + type < (addtl ? (PHP_DNS_NUM_TYPES + 2) : PHP_DNS_NUM_TYPES) || first_query; + type++ + ) { + DNS_STATUS status; /* Return value of DnsQuery_A() function */ + PDNS_RECORD pResult, pRec; /* Pointer to DNS_RECORD structure */ + + first_query = 0; + switch (type) { + case -1: /* raw */ + type_to_fetch = type_param; + /* skip over the rest and go directly to additional records */ + type = PHP_DNS_NUM_TYPES - 1; + break; + case 0: + type_to_fetch = type_param&PHP_DNS_A ? DNS_TYPE_A : 0; + break; + case 1: + type_to_fetch = type_param&PHP_DNS_NS ? DNS_TYPE_NS : 0; + break; + case 2: + type_to_fetch = type_param&PHP_DNS_CNAME ? DNS_TYPE_CNAME : 0; + break; + case 3: + type_to_fetch = type_param&PHP_DNS_SOA ? DNS_TYPE_SOA : 0; + break; + case 4: + type_to_fetch = type_param&PHP_DNS_PTR ? DNS_TYPE_PTR : 0; + break; + case 5: + type_to_fetch = type_param&PHP_DNS_HINFO ? DNS_TYPE_HINFO : 0; + break; + case 6: + type_to_fetch = type_param&PHP_DNS_MX ? DNS_TYPE_MX : 0; + break; + case 7: + type_to_fetch = type_param&PHP_DNS_TXT ? DNS_TYPE_TEXT : 0; + break; + case 8: + type_to_fetch = type_param&PHP_DNS_AAAA ? DNS_TYPE_AAAA : 0; + break; + case 9: + type_to_fetch = type_param&PHP_DNS_SRV ? DNS_TYPE_SRV : 0; + break; + case 10: + type_to_fetch = type_param&PHP_DNS_NAPTR ? DNS_TYPE_NAPTR : 0; + break; + case 11: + type_to_fetch = type_param&PHP_DNS_A6 ? DNS_TYPE_A6 : 0; + break; + case PHP_DNS_NUM_TYPES: + store_results = 0; + continue; + default: + case (PHP_DNS_NUM_TYPES + 1): + type_to_fetch = DNS_TYPE_ANY; + break; + } + + if (type_to_fetch) { + status = DnsQuery_A(hostname, type_to_fetch, DNS_QUERY_STANDARD, NULL, &pResult, NULL); + + if (status) { + if (status == DNS_INFO_NO_RECORDS || status == DNS_ERROR_RCODE_NAME_ERROR) { + continue; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Dns Query failed"); + zval_dtor(return_value); + RETURN_FALSE; + } + } + + for (pRec = pResult; pRec; pRec = pRec->pNext) { + DNS_SRV_DATA *srv = &pRec->Data.Srv; + zval *retval = NULL; + + if (pRec->Flags.S.Section == DnsSectionAnswer) { + php_parserr(pRec, type_to_fetch, store_results, raw, &retval); + if (retval != NULL && store_results) { + add_next_index_zval(return_value, retval); + } + } + + if (authns && pRec->Flags.S.Section == DnsSectionAuthority) { + + php_parserr(pRec, type_to_fetch, 1, raw, &retval); + if (retval != NULL) { + add_next_index_zval(authns, retval); + } + } + +/* Stupid typo in PSDK 6.1, WinDNS.h(1258)... */ +#ifndef DnsSectionAdditional +# ifdef DnsSectionAddtional +# define DnsSectionAdditional DnsSectionAddtional +# else +# define DnsSectionAdditional 3 +# endif +#endif + if (addtl && pRec->Flags.S.Section == DnsSectionAdditional) { + php_parserr(pRec, type_to_fetch, 1, raw, &retval); + if (retval != NULL) { + add_next_index_zval(addtl, retval); + } + } + } + /* Free memory allocated for DNS records. */ + DnsRecordListFree(pResult, DnsFreeRecordListDeep); + } + } +} +/* }}} */ diff --git a/ext/standard/exec.c b/ext/standard/exec.c new file mode 100644 index 0000000..7b783ca --- /dev/null +++ b/ext/standard/exec.c @@ -0,0 +1,498 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Rasmus Lerdorf | + | Ilia Alshanetsky | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#include +#include "php.h" +#include +#include "php_string.h" +#include "ext/standard/head.h" +#include "ext/standard/file.h" +#include "basic_functions.h" +#include "exec.h" +#include "php_globals.h" +#include "SAPI.h" + +#if HAVE_SYS_WAIT_H +#include +#endif +#if HAVE_SIGNAL_H +#include +#endif + +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_STAT_H +#include +#endif +#if HAVE_FCNTL_H +#include +#endif + +#if HAVE_NICE && HAVE_UNISTD_H +#include +#endif + +/* {{{ php_exec + * If type==0, only last line of output is returned (exec) + * If type==1, all lines will be printed and last lined returned (system) + * If type==2, all lines will be saved to given array (exec with &$array) + * If type==3, output will be printed binary, no lines will be saved or returned (passthru) + * + */ +PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC) +{ + FILE *fp; + char *buf; + int l = 0, pclose_return; + char *b, *d=NULL; + php_stream *stream; + size_t buflen, bufl = 0; +#if PHP_SIGCHILD + void (*sig_handler)() = NULL; +#endif + +#if PHP_SIGCHILD + sig_handler = signal (SIGCHLD, SIG_DFL); +#endif + +#ifdef PHP_WIN32 + fp = VCWD_POPEN(cmd, "rb"); +#else + fp = VCWD_POPEN(cmd, "r"); +#endif + if (!fp) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to fork [%s]", cmd); + goto err; + } + + stream = php_stream_fopen_from_pipe(fp, "rb"); + + buf = (char *) emalloc(EXEC_INPUT_BUF); + buflen = EXEC_INPUT_BUF; + + if (type != 3) { + b = buf; + + while (php_stream_get_line(stream, b, EXEC_INPUT_BUF, &bufl)) { + /* no new line found, let's read some more */ + if (b[bufl - 1] != '\n' && !php_stream_eof(stream)) { + if (buflen < (bufl + (b - buf) + EXEC_INPUT_BUF)) { + bufl += b - buf; + buflen = bufl + EXEC_INPUT_BUF; + buf = erealloc(buf, buflen); + b = buf + bufl; + } else { + b += bufl; + } + continue; + } else if (b != buf) { + bufl += b - buf; + } + + if (type == 1) { + PHPWRITE(buf, bufl); + if (php_output_get_level(TSRMLS_C) < 1) { + sapi_flush(TSRMLS_C); + } + } else if (type == 2) { + /* strip trailing whitespaces */ + l = bufl; + while (l-- && isspace(((unsigned char *)buf)[l])); + if (l != (int)(bufl - 1)) { + bufl = l + 1; + buf[bufl] = '\0'; + } + add_next_index_stringl(array, buf, bufl, 1); + } + b = buf; + } + if (bufl) { + /* strip trailing whitespaces if we have not done so already */ + if ((type == 2 && buf != b) || type != 2) { + l = bufl; + while (l-- && isspace(((unsigned char *)buf)[l])); + if (l != (int)(bufl - 1)) { + bufl = l + 1; + buf[bufl] = '\0'; + } + if (type == 2) { + add_next_index_stringl(array, buf, bufl, 1); + } + } + + /* Return last line from the shell command */ + RETVAL_STRINGL(buf, bufl, 1); + } else { /* should return NULL, but for BC we return "" */ + RETVAL_EMPTY_STRING(); + } + } else { + while((bufl = php_stream_read(stream, buf, EXEC_INPUT_BUF)) > 0) { + PHPWRITE(buf, bufl); + } + } + + pclose_return = php_stream_close(stream); + efree(buf); + +done: +#if PHP_SIGCHILD + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif + if (d) { + efree(d); + } + return pclose_return; +err: + pclose_return = -1; + goto done; +} +/* }}} */ + +static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ +{ + char *cmd; + int cmd_len; + zval *ret_code=NULL, *ret_array=NULL; + int ret; + + if (mode) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/", &cmd, &cmd_len, &ret_code) == FAILURE) { + RETURN_FALSE; + } + } else { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/", &cmd, &cmd_len, &ret_array, &ret_code) == FAILURE) { + RETURN_FALSE; + } + } + if (!cmd_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot execute a blank command"); + RETURN_FALSE; + } + + if (!ret_array) { + ret = php_exec(mode, cmd, NULL, return_value TSRMLS_CC); + } else { + if (Z_TYPE_P(ret_array) != IS_ARRAY) { + zval_dtor(ret_array); + array_init(ret_array); + } + ret = php_exec(2, cmd, ret_array, return_value TSRMLS_CC); + } + if (ret_code) { + zval_dtor(ret_code); + ZVAL_LONG(ret_code, ret); + } +} +/* }}} */ + +/* {{{ proto string exec(string command [, array &output [, int &return_value]]) + Execute an external program */ +PHP_FUNCTION(exec) +{ + php_exec_ex(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* {{{ proto int system(string command [, int &return_value]) + Execute an external program and display output */ +PHP_FUNCTION(system) +{ + php_exec_ex(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +/* {{{ proto void passthru(string command [, int &return_value]) + Execute an external program and display raw output */ +PHP_FUNCTION(passthru) +{ + php_exec_ex(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3); +} +/* }}} */ + +/* {{{ php_escape_shell_cmd + Escape all chars that could possibly be used to + break out of a shell command + + This function emalloc's a string and returns the pointer. + Remember to efree it when done with it. + + *NOT* safe for binary strings +*/ +PHPAPI char *php_escape_shell_cmd(char *str) +{ + register int x, y, l = strlen(str); + char *cmd; + char *p = NULL; + size_t estimate = (2 * l) + 1; + + TSRMLS_FETCH(); + + cmd = safe_emalloc(2, l, 1); + + for (x = 0, y = 0; x < l; x++) { + int mb_len = php_mblen(str + x, (l - x)); + + /* skip non-valid multibyte characters */ + if (mb_len < 0) { + continue; + } else if (mb_len > 1) { + memcpy(cmd + y, str + x, mb_len); + y += mb_len; + x += mb_len - 1; + continue; + } + + switch (str[x]) { +#ifndef PHP_WIN32 + case '"': + case '\'': + if (!p && (p = memchr(str + x + 1, str[x], l - x - 1))) { + /* noop */ + } else if (p && *p == str[x]) { + p = NULL; + } else { + cmd[y++] = '\\'; + } + cmd[y++] = str[x]; + break; +#else + /* % is Windows specific for enviromental variables, ^%PATH% will + output PATH whil ^%PATH^% not. escapeshellcmd will escape all %. + */ + case '%': + case '"': + case '\'': +#endif + case '#': /* This is character-set independent */ + case '&': + case ';': + case '`': + case '|': + case '*': + case '?': + case '~': + case '<': + case '>': + case '^': + case '(': + case ')': + case '[': + case ']': + case '{': + case '}': + case '$': + case '\\': + case '\x0A': /* excluding these two */ + case '\xFF': +#ifdef PHP_WIN32 + cmd[y++] = '^'; +#else + cmd[y++] = '\\'; +#endif + /* fall-through */ + default: + cmd[y++] = str[x]; + + } + } + cmd[y] = '\0'; + + if ((estimate - y) > 4096) { + /* realloc if the estimate was way overill + * Arbitrary cutoff point of 4096 */ + cmd = erealloc(cmd, y + 1); + } + + return cmd; +} +/* }}} */ + +/* {{{ php_escape_shell_arg + */ +PHPAPI char *php_escape_shell_arg(char *str) +{ + int x, y = 0, l = strlen(str); + char *cmd; + size_t estimate = (4 * l) + 3; + + TSRMLS_FETCH(); + + cmd = safe_emalloc(4, l, 3); /* worst case */ + +#ifdef PHP_WIN32 + cmd[y++] = '"'; +#else + cmd[y++] = '\''; +#endif + + for (x = 0; x < l; x++) { + int mb_len = php_mblen(str + x, (l - x)); + + /* skip non-valid multibyte characters */ + if (mb_len < 0) { + continue; + } else if (mb_len > 1) { + memcpy(cmd + y, str + x, mb_len); + y += mb_len; + x += mb_len - 1; + continue; + } + + switch (str[x]) { +#ifdef PHP_WIN32 + case '"': + case '%': + cmd[y++] = ' '; + break; +#else + case '\'': + cmd[y++] = '\''; + cmd[y++] = '\\'; + cmd[y++] = '\''; +#endif + /* fall-through */ + default: + cmd[y++] = str[x]; + } + } +#ifdef PHP_WIN32 + cmd[y++] = '"'; +#else + cmd[y++] = '\''; +#endif + cmd[y] = '\0'; + + if ((estimate - y) > 4096) { + /* realloc if the estimate was way overill + * Arbitrary cutoff point of 4096 */ + cmd = erealloc(cmd, y + 1); + } + return cmd; +} +/* }}} */ + +/* {{{ proto string escapeshellcmd(string command) + Escape shell metacharacters */ +PHP_FUNCTION(escapeshellcmd) +{ + char *command; + int command_len; + char *cmd = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &command, &command_len) == FAILURE) { + return; + } + + if (command_len) { + cmd = php_escape_shell_cmd(command); + RETVAL_STRING(cmd, 0); + } else { + RETVAL_EMPTY_STRING(); + } +} +/* }}} */ + +/* {{{ proto string escapeshellarg(string arg) + Quote and escape an argument for use in a shell command */ +PHP_FUNCTION(escapeshellarg) +{ + char *argument; + int argument_len; + char *cmd = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &argument, &argument_len) == FAILURE) { + return; + } + + if (argument) { + cmd = php_escape_shell_arg(argument); + RETVAL_STRING(cmd, 0); + } +} +/* }}} */ + +/* {{{ proto string shell_exec(string cmd) + Execute command via shell and return complete output as string */ +PHP_FUNCTION(shell_exec) +{ + FILE *in; + size_t total_readbytes; + char *command; + int command_len; + char *ret; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &command, &command_len) == FAILURE) { + return; + } + +#ifdef PHP_WIN32 + if ((in=VCWD_POPEN(command, "rt"))==NULL) { +#else + if ((in=VCWD_POPEN(command, "r"))==NULL) { +#endif + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to execute '%s'", command); + RETURN_FALSE; + } + + stream = php_stream_fopen_from_pipe(in, "rb"); + total_readbytes = php_stream_copy_to_mem(stream, &ret, PHP_STREAM_COPY_ALL, 0); + php_stream_close(stream); + + if (total_readbytes > 0) { + RETVAL_STRINGL(ret, total_readbytes, 0); + } +} +/* }}} */ + +#ifdef HAVE_NICE +/* {{{ proto bool proc_nice(int priority) + Change the priority of the current process */ +PHP_FUNCTION(proc_nice) +{ + long pri; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pri) == FAILURE) { + RETURN_FALSE; + } + + errno = 0; + php_ignore_value(nice(pri)); + if (errno) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only a super user may attempt to increase the priority of a process"); + RETURN_FALSE; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/exec.h b/ext/standard/exec.h new file mode 100644 index 0000000..14c98c5 --- /dev/null +++ b/ext/standard/exec.h @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Rasmus Lerdorf | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef EXEC_H +#define EXEC_H + +PHP_FUNCTION(system); +PHP_FUNCTION(exec); +PHP_FUNCTION(escapeshellcmd); +PHP_FUNCTION(escapeshellarg); +PHP_FUNCTION(passthru); +PHP_FUNCTION(shell_exec); +PHP_FUNCTION(proc_open); +PHP_FUNCTION(proc_get_status); +PHP_FUNCTION(proc_close); +PHP_FUNCTION(proc_terminate); +PHP_FUNCTION(proc_nice); +PHP_MINIT_FUNCTION(proc_open); + +PHPAPI char *php_escape_shell_cmd(char *); +PHPAPI char *php_escape_shell_arg(char *); +PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC); + +#endif /* EXEC_H */ diff --git a/ext/standard/file.c b/ext/standard/file.c new file mode 100644 index 0000000..f7af63b --- /dev/null +++ b/ext/standard/file.c @@ -0,0 +1,2459 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Stig Bakken | + | Andi Gutmans | + | Zeev Suraski | + | PHP 4.0 patches by Thies C. Arntzen (thies@thieso.net) | + | PHP streams by Wez Furlong (wez@thebrainroom.com) | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ + +/* {{{ includes */ + +#include "php.h" +#include "php_globals.h" +#include "ext/standard/flock_compat.h" +#include "ext/standard/exec.h" +#include "ext/standard/php_filestat.h" +#include "php_open_temporary_file.h" +#include "ext/standard/basic_functions.h" +#include "php_ini.h" +#include "php_smart_str.h" + +#include +#include +#include +#include +#include +#include + +#ifdef PHP_WIN32 +# include +# define O_RDONLY _O_RDONLY +# include "win32/param.h" +# include "win32/winutil.h" +# include "win32/fnmatch.h" +#else +# if HAVE_SYS_PARAM_H +# include +# endif +# if HAVE_SYS_SELECT_H +# include +# endif +# if defined(NETWARE) && defined(USE_WINSOCK) +# include +# else +# include +# include +# include +# endif +# if HAVE_ARPA_INET_H +# include +# endif +#endif + +#include "ext/standard/head.h" +#include "php_string.h" +#include "file.h" + +#if HAVE_PWD_H +# ifdef PHP_WIN32 +# include "win32/pwd.h" +# else +# include +# endif +#endif + +#ifdef HAVE_SYS_TIME_H +# include +#endif + +#include "fsock.h" +#include "fopen_wrappers.h" +#include "streamsfuncs.h" +#include "php_globals.h" + +#ifdef HAVE_SYS_FILE_H +# include +#endif + +#if MISSING_FCLOSE_DECL +extern int fclose(FILE *); +#endif + +#ifdef HAVE_SYS_MMAN_H +# include +#endif + +#include "scanf.h" +#include "zend_API.h" + +#ifdef ZTS +int file_globals_id; +#else +php_file_globals file_globals; +#endif + +#if defined(HAVE_FNMATCH) && !defined(PHP_WIN32) +# ifndef _GNU_SOURCE +# define _GNU_SOURCE +# endif +# include +#endif + +#ifdef HAVE_WCHAR_H +# include +#endif + +#ifndef S_ISDIR +# define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) +#endif +/* }}} */ + +#define PHP_STREAM_TO_ZVAL(stream, arg) \ + php_stream_from_zval_no_verify(stream, arg); \ + if (stream == NULL) { \ + RETURN_FALSE; \ + } + +/* {{{ ZTS-stuff / Globals / Prototypes */ + +/* sharing globals is *evil* */ +static int le_stream_context = FAILURE; + +PHPAPI int php_le_stream_context(TSRMLS_D) +{ + return le_stream_context; +} +/* }}} */ + +/* {{{ Module-Stuff +*/ +static ZEND_RSRC_DTOR_FUNC(file_context_dtor) +{ + php_stream_context *context = (php_stream_context*)rsrc->ptr; + if (context->options) { + zval_ptr_dtor(&context->options); + context->options = NULL; + } + php_stream_context_free(context); +} + +static void file_globals_ctor(php_file_globals *file_globals_p TSRMLS_DC) +{ + FG(pclose_ret) = 0; + FG(user_stream_current_filename) = NULL; + FG(def_chunk_size) = PHP_SOCK_CHUNK_SIZE; + FG(wrapper_errors) = NULL; +} + +static void file_globals_dtor(php_file_globals *file_globals_p TSRMLS_DC) +{ +} + +PHP_INI_BEGIN() + STD_PHP_INI_ENTRY("user_agent", NULL, PHP_INI_ALL, OnUpdateString, user_agent, php_file_globals, file_globals) + STD_PHP_INI_ENTRY("from", NULL, PHP_INI_ALL, OnUpdateString, from_address, php_file_globals, file_globals) + STD_PHP_INI_ENTRY("default_socket_timeout", "60", PHP_INI_ALL, OnUpdateLong, default_socket_timeout, php_file_globals, file_globals) + STD_PHP_INI_ENTRY("auto_detect_line_endings", "0", PHP_INI_ALL, OnUpdateLong, auto_detect_line_endings, php_file_globals, file_globals) +PHP_INI_END() + +PHP_MINIT_FUNCTION(file) +{ + le_stream_context = zend_register_list_destructors_ex(file_context_dtor, NULL, "stream-context", module_number); + +#ifdef ZTS + ts_allocate_id(&file_globals_id, sizeof(php_file_globals), (ts_allocate_ctor) file_globals_ctor, (ts_allocate_dtor) file_globals_dtor); +#else + file_globals_ctor(&file_globals TSRMLS_CC); +#endif + + REGISTER_INI_ENTRIES(); + + REGISTER_LONG_CONSTANT("SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOCK_SH", PHP_LOCK_SH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOCK_EX", PHP_LOCK_EX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOCK_UN", PHP_LOCK_UN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOCK_NB", PHP_LOCK_NB, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_CONNECT", PHP_STREAM_NOTIFY_CONNECT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_AUTH_REQUIRED", PHP_STREAM_NOTIFY_AUTH_REQUIRED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_AUTH_RESULT", PHP_STREAM_NOTIFY_AUTH_RESULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_MIME_TYPE_IS", PHP_STREAM_NOTIFY_MIME_TYPE_IS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_FILE_SIZE_IS", PHP_STREAM_NOTIFY_FILE_SIZE_IS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_REDIRECTED", PHP_STREAM_NOTIFY_REDIRECTED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_PROGRESS", PHP_STREAM_NOTIFY_PROGRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_FAILURE", PHP_STREAM_NOTIFY_FAILURE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_COMPLETED", PHP_STREAM_NOTIFY_COMPLETED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_RESOLVE", PHP_STREAM_NOTIFY_RESOLVE, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_INFO", PHP_STREAM_NOTIFY_SEVERITY_INFO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_WARN", PHP_STREAM_NOTIFY_SEVERITY_WARN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_ERR", PHP_STREAM_NOTIFY_SEVERITY_ERR, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_FILTER_READ", PHP_STREAM_FILTER_READ, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_FILTER_WRITE", PHP_STREAM_FILTER_WRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_FILTER_ALL", PHP_STREAM_FILTER_ALL, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_CLIENT_PERSISTENT", PHP_STREAM_CLIENT_PERSISTENT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CLIENT_ASYNC_CONNECT", PHP_STREAM_CLIENT_ASYNC_CONNECT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CLIENT_CONNECT", PHP_STREAM_CLIENT_CONNECT, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_CLIENT", STREAM_CRYPTO_METHOD_SSLv2_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_CLIENT", STREAM_CRYPTO_METHOD_SSLv3_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_CLIENT", STREAM_CRYPTO_METHOD_SSLv23_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLS_CLIENT", STREAM_CRYPTO_METHOD_TLS_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_SERVER", STREAM_CRYPTO_METHOD_SSLv2_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_SERVER", STREAM_CRYPTO_METHOD_SSLv3_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_SERVER", STREAM_CRYPTO_METHOD_SSLv23_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLS_SERVER", STREAM_CRYPTO_METHOD_TLS_SERVER, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_SHUT_RD", STREAM_SHUT_RD, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_SHUT_WR", STREAM_SHUT_WR, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_SHUT_RDWR", STREAM_SHUT_RDWR, CONST_CS|CONST_PERSISTENT); + +#ifdef PF_INET + REGISTER_LONG_CONSTANT("STREAM_PF_INET", PF_INET, CONST_CS|CONST_PERSISTENT); +#elif defined(AF_INET) + REGISTER_LONG_CONSTANT("STREAM_PF_INET", AF_INET, CONST_CS|CONST_PERSISTENT); +#endif + +#if HAVE_IPV6 +# ifdef PF_INET6 + REGISTER_LONG_CONSTANT("STREAM_PF_INET6", PF_INET6, CONST_CS|CONST_PERSISTENT); +# elif defined(AF_INET6) + REGISTER_LONG_CONSTANT("STREAM_PF_INET6", AF_INET6, CONST_CS|CONST_PERSISTENT); +# endif +#endif + +#ifdef PF_UNIX + REGISTER_LONG_CONSTANT("STREAM_PF_UNIX", PF_UNIX, CONST_CS|CONST_PERSISTENT); +#elif defined(AF_UNIX) + REGISTER_LONG_CONSTANT("STREAM_PF_UNIX", AF_UNIX, CONST_CS|CONST_PERSISTENT); +#endif + +#ifdef IPPROTO_IP + /* most people will use this one when calling socket() or socketpair() */ + REGISTER_LONG_CONSTANT("STREAM_IPPROTO_IP", IPPROTO_IP, CONST_CS|CONST_PERSISTENT); +#endif + +#ifdef IPPROTO_TCP + REGISTER_LONG_CONSTANT("STREAM_IPPROTO_TCP", IPPROTO_TCP, CONST_CS|CONST_PERSISTENT); +#endif + +#ifdef IPPROTO_UDP + REGISTER_LONG_CONSTANT("STREAM_IPPROTO_UDP", IPPROTO_UDP, CONST_CS|CONST_PERSISTENT); +#endif + +#ifdef IPPROTO_ICMP + REGISTER_LONG_CONSTANT("STREAM_IPPROTO_ICMP", IPPROTO_ICMP, CONST_CS|CONST_PERSISTENT); +#endif + +#ifdef IPPROTO_RAW + REGISTER_LONG_CONSTANT("STREAM_IPPROTO_RAW", IPPROTO_RAW, CONST_CS|CONST_PERSISTENT); +#endif + + REGISTER_LONG_CONSTANT("STREAM_SOCK_STREAM", SOCK_STREAM, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_SOCK_DGRAM", SOCK_DGRAM, CONST_CS|CONST_PERSISTENT); + +#ifdef SOCK_RAW + REGISTER_LONG_CONSTANT("STREAM_SOCK_RAW", SOCK_RAW, CONST_CS|CONST_PERSISTENT); +#endif + +#ifdef SOCK_SEQPACKET + REGISTER_LONG_CONSTANT("STREAM_SOCK_SEQPACKET", SOCK_SEQPACKET, CONST_CS|CONST_PERSISTENT); +#endif + +#ifdef SOCK_RDM + REGISTER_LONG_CONSTANT("STREAM_SOCK_RDM", SOCK_RDM, CONST_CS|CONST_PERSISTENT); +#endif + + REGISTER_LONG_CONSTANT("STREAM_PEEK", STREAM_PEEK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_OOB", STREAM_OOB, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_SERVER_BIND", STREAM_XPORT_BIND, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_SERVER_LISTEN", STREAM_XPORT_LISTEN, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("FILE_USE_INCLUDE_PATH", PHP_FILE_USE_INCLUDE_PATH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILE_IGNORE_NEW_LINES", PHP_FILE_IGNORE_NEW_LINES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILE_SKIP_EMPTY_LINES", PHP_FILE_SKIP_EMPTY_LINES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILE_APPEND", PHP_FILE_APPEND, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILE_NO_DEFAULT_CONTEXT", PHP_FILE_NO_DEFAULT_CONTEXT, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("FILE_TEXT", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILE_BINARY", 0, CONST_CS | CONST_PERSISTENT); + +#ifdef HAVE_FNMATCH + REGISTER_LONG_CONSTANT("FNM_NOESCAPE", FNM_NOESCAPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FNM_PATHNAME", FNM_PATHNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FNM_PERIOD", FNM_PERIOD, CONST_CS | CONST_PERSISTENT); +# ifdef FNM_CASEFOLD /* a GNU extension */ /* TODO emulate if not available */ + REGISTER_LONG_CONSTANT("FNM_CASEFOLD", FNM_CASEFOLD, CONST_CS | CONST_PERSISTENT); +# endif +#endif + + return SUCCESS; +} +/* }}} */ + +PHP_MSHUTDOWN_FUNCTION(file) /* {{{ */ +{ +#ifndef ZTS + file_globals_dtor(&file_globals TSRMLS_CC); +#endif + return SUCCESS; +} +/* }}} */ + +static int flock_values[] = { LOCK_SH, LOCK_EX, LOCK_UN }; + +/* {{{ proto bool flock(resource fp, int operation [, int &wouldblock]) + Portable file locking */ +PHP_FUNCTION(flock) +{ + zval *arg1, *arg3 = NULL; + int act; + php_stream *stream; + long operation = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &arg1, &operation, &arg3) == FAILURE) { + return; + } + + PHP_STREAM_TO_ZVAL(stream, &arg1); + + act = operation & 3; + if (act < 1 || act > 3) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal operation argument"); + RETURN_FALSE; + } + + if (arg3 && PZVAL_IS_REF(arg3)) { + convert_to_long_ex(&arg3); + Z_LVAL_P(arg3) = 0; + } + + /* flock_values contains all possible actions if (operation & 4) we won't block on the lock */ + act = flock_values[act - 1] | (operation & PHP_LOCK_NB ? LOCK_NB : 0); + if (php_stream_lock(stream, act)) { + if (operation && errno == EWOULDBLOCK && arg3 && PZVAL_IS_REF(arg3)) { + Z_LVAL_P(arg3) = 1; + } + RETURN_FALSE; + } + RETURN_TRUE; +} +/* }}} */ + +#define PHP_META_UNSAFE ".\\+*?[^]$() " + +/* {{{ proto array get_meta_tags(string filename [, bool use_include_path]) + Extracts all meta tag content attributes from a file and returns an array */ +PHP_FUNCTION(get_meta_tags) +{ + char *filename; + int filename_len; + zend_bool use_include_path = 0; + int in_tag = 0, done = 0; + int looking_for_val = 0, have_name = 0, have_content = 0; + int saw_name = 0, saw_content = 0; + char *name = NULL, *value = NULL, *temp = NULL; + php_meta_tags_token tok, tok_last; + php_meta_tags_data md; + + /* Initiailize our structure */ + memset(&md, 0, sizeof(md)); + + /* Parse arguments */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &filename, &filename_len, &use_include_path) == FAILURE) { + return; + } + + md.stream = php_stream_open_wrapper(filename, "rb", + (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, + NULL); + if (!md.stream) { + RETURN_FALSE; + } + + array_init(return_value); + + tok_last = TOK_EOF; + + while (!done && (tok = php_next_meta_token(&md TSRMLS_CC)) != TOK_EOF) { + if (tok == TOK_ID) { + if (tok_last == TOK_OPENTAG) { + md.in_meta = !strcasecmp("meta", md.token_data); + } else if (tok_last == TOK_SLASH && in_tag) { + if (strcasecmp("head", md.token_data) == 0) { + /* We are done here! */ + done = 1; + } + } else if (tok_last == TOK_EQUAL && looking_for_val) { + if (saw_name) { + STR_FREE(name); + /* Get the NAME attr (Single word attr, non-quoted) */ + temp = name = estrndup(md.token_data, md.token_len); + + while (temp && *temp) { + if (strchr(PHP_META_UNSAFE, *temp)) { + *temp = '_'; + } + temp++; + } + + have_name = 1; + } else if (saw_content) { + STR_FREE(value); + value = estrndup(md.token_data, md.token_len); + have_content = 1; + } + + looking_for_val = 0; + } else { + if (md.in_meta) { + if (strcasecmp("name", md.token_data) == 0) { + saw_name = 1; + saw_content = 0; + looking_for_val = 1; + } else if (strcasecmp("content", md.token_data) == 0) { + saw_name = 0; + saw_content = 1; + looking_for_val = 1; + } + } + } + } else if (tok == TOK_STRING && tok_last == TOK_EQUAL && looking_for_val) { + if (saw_name) { + STR_FREE(name); + /* Get the NAME attr (Quoted single/double) */ + temp = name = estrndup(md.token_data, md.token_len); + + while (temp && *temp) { + if (strchr(PHP_META_UNSAFE, *temp)) { + *temp = '_'; + } + temp++; + } + + have_name = 1; + } else if (saw_content) { + STR_FREE(value); + value = estrndup(md.token_data, md.token_len); + have_content = 1; + } + + looking_for_val = 0; + } else if (tok == TOK_OPENTAG) { + if (looking_for_val) { + looking_for_val = 0; + have_name = saw_name = 0; + have_content = saw_content = 0; + } + in_tag = 1; + } else if (tok == TOK_CLOSETAG) { + if (have_name) { + /* For BC */ + php_strtolower(name, strlen(name)); + if (have_content) { + add_assoc_string(return_value, name, value, 1); + } else { + add_assoc_string(return_value, name, "", 1); + } + + efree(name); + STR_FREE(value); + } else if (have_content) { + efree(value); + } + + name = value = NULL; + + /* Reset all of our flags */ + in_tag = looking_for_val = 0; + have_name = saw_name = 0; + have_content = saw_content = 0; + md.in_meta = 0; + } + + tok_last = tok; + + if (md.token_data) + efree(md.token_data); + + md.token_data = NULL; + } + + STR_FREE(value); + STR_FREE(name); + php_stream_close(md.stream); +} +/* }}} */ + +/* {{{ proto string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]]) + Read the entire file into a string */ +PHP_FUNCTION(file_get_contents) +{ + char *filename; + int filename_len; + char *contents; + zend_bool use_include_path = 0; + php_stream *stream; + int len; + long offset = -1; + long maxlen = PHP_STREAM_COPY_ALL; + zval *zcontext = NULL; + php_stream_context *context = NULL; + + /* Parse arguments */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) { + return; + } + + if (ZEND_NUM_ARGS() == 5 && maxlen < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater than or equal to zero"); + RETURN_FALSE; + } + + context = php_stream_context_from_zval(zcontext, 0); + + stream = php_stream_open_wrapper_ex(filename, "rb", + (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, + NULL, context); + if (!stream) { + RETURN_FALSE; + } + + if (offset > 0 && php_stream_seek(stream, offset, SEEK_SET) < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the stream", offset); + php_stream_close(stream); + RETURN_FALSE; + } + + if ((len = php_stream_copy_to_mem(stream, &contents, maxlen, 0)) > 0) { + RETVAL_STRINGL(contents, len, 0); + } else if (len == 0) { + RETVAL_EMPTY_STRING(); + } else { + RETVAL_FALSE; + } + + php_stream_close(stream); +} +/* }}} */ + +/* {{{ proto int file_put_contents(string file, mixed data [, int flags [, resource context]]) + Write/Create a file with contents data and return the number of bytes written */ +PHP_FUNCTION(file_put_contents) +{ + php_stream *stream; + char *filename; + int filename_len; + zval *data; + int numbytes = 0; + long flags = 0; + zval *zcontext = NULL; + php_stream_context *context = NULL; + php_stream *srcstream = NULL; + char mode[3] = "wb"; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/|lr!", &filename, &filename_len, &data, &flags, &zcontext) == FAILURE) { + return; + } + + if (Z_TYPE_P(data) == IS_RESOURCE) { + php_stream_from_zval(srcstream, &data); + } + + context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); + + if (flags & PHP_FILE_APPEND) { + mode[0] = 'a'; + } else if (flags & LOCK_EX) { + /* check to make sure we are dealing with a regular file */ + if (php_memnstr(filename, "://", sizeof("://") - 1, filename + filename_len)) { + if (strncasecmp(filename, "file://", sizeof("file://") - 1)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Exclusive locks may only be set for regular files"); + RETURN_FALSE; + } + } + mode[0] = 'c'; + } + mode[2] = '\0'; + + stream = php_stream_open_wrapper_ex(filename, mode, ((flags & PHP_FILE_USE_INCLUDE_PATH) ? USE_PATH : 0) | REPORT_ERRORS, NULL, context); + if (stream == NULL) { + RETURN_FALSE; + } + + if (flags & LOCK_EX && (!php_stream_supports_lock(stream) || php_stream_lock(stream, LOCK_EX))) { + php_stream_close(stream); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Exclusive locks are not supported for this stream"); + RETURN_FALSE; + } + + if (mode[0] == 'c') { + php_stream_truncate_set_size(stream, 0); + } + + switch (Z_TYPE_P(data)) { + case IS_RESOURCE: { + size_t len; + if (php_stream_copy_to_stream_ex(srcstream, stream, PHP_STREAM_COPY_ALL, &len) != SUCCESS) { + numbytes = -1; + } else { + numbytes = len; + } + break; + } + case IS_NULL: + case IS_LONG: + case IS_DOUBLE: + case IS_BOOL: + case IS_CONSTANT: + convert_to_string_ex(&data); + + case IS_STRING: + if (Z_STRLEN_P(data)) { + numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRLEN_P(data)); + if (numbytes != Z_STRLEN_P(data)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", numbytes, Z_STRLEN_P(data)); + numbytes = -1; + } + } + break; + + case IS_ARRAY: + if (zend_hash_num_elements(Z_ARRVAL_P(data))) { + int bytes_written; + zval **tmp; + HashPosition pos; + + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(data), &pos); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(data), (void **) &tmp, &pos) == SUCCESS) { + if (Z_TYPE_PP(tmp) != IS_STRING) { + SEPARATE_ZVAL(tmp); + convert_to_string(*tmp); + } + if (Z_STRLEN_PP(tmp)) { + numbytes += Z_STRLEN_PP(tmp); + bytes_written = php_stream_write(stream, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); + if (bytes_written < 0 || bytes_written != Z_STRLEN_PP(tmp)) { + if (bytes_written < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write %d bytes to %s", Z_STRLEN_PP(tmp), filename); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", bytes_written, Z_STRLEN_PP(tmp)); + } + numbytes = -1; + break; + } + } + zend_hash_move_forward_ex(Z_ARRVAL_P(data), &pos); + } + } + break; + + case IS_OBJECT: + if (Z_OBJ_HT_P(data) != NULL) { + zval out; + + if (zend_std_cast_object_tostring(data, &out, IS_STRING TSRMLS_CC) == SUCCESS) { + numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRLEN(out)); + if (numbytes != Z_STRLEN(out)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out)); + numbytes = -1; + } + zval_dtor(&out); + break; + } + } + default: + numbytes = -1; + break; + } + php_stream_close(stream); + + if (numbytes < 0) { + RETURN_FALSE; + } + + RETURN_LONG(numbytes); +} +/* }}} */ + +#define PHP_FILE_BUF_SIZE 80 + +/* {{{ proto array file(string filename [, int flags[, resource context]]) + Read entire file into an array */ +PHP_FUNCTION(file) +{ + char *filename; + int filename_len; + char *target_buf=NULL, *p, *s, *e; + register int i = 0; + int target_len; + char eol_marker = '\n'; + long flags = 0; + zend_bool use_include_path; + zend_bool include_new_line; + zend_bool skip_blank_lines; + php_stream *stream; + zval *zcontext = NULL; + php_stream_context *context = NULL; + + /* Parse arguments */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lr!", &filename, &filename_len, &flags, &zcontext) == FAILURE) { + return; + } + 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 TSRMLS_CC, E_WARNING, "'%ld' flag is not supported", flags); + RETURN_FALSE; + } + + use_include_path = flags & PHP_FILE_USE_INCLUDE_PATH; + include_new_line = !(flags & PHP_FILE_IGNORE_NEW_LINES); + skip_blank_lines = flags & PHP_FILE_SKIP_EMPTY_LINES; + + context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); + + stream = php_stream_open_wrapper_ex(filename, "rb", (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, NULL, context); + if (!stream) { + RETURN_FALSE; + } + + /* Initialize return array */ + array_init(return_value); + + if ((target_len = php_stream_copy_to_mem(stream, &target_buf, PHP_STREAM_COPY_ALL, 0))) { + s = target_buf; + e = target_buf + target_len; + + if (!(p = php_stream_locate_eol(stream, target_buf, target_len TSRMLS_CC))) { + p = e; + goto parse_eol; + } + + if (stream->flags & PHP_STREAM_FLAG_EOL_MAC) { + eol_marker = '\r'; + } + + /* for performance reasons the code is duplicated, so that the if (include_new_line) + * will not need to be done for every single line in the file. */ + if (include_new_line) { + do { + p++; +parse_eol: + add_index_stringl(return_value, i++, estrndup(s, p-s), p-s, 0); + s = p; + } while ((p = memchr(p, eol_marker, (e-p)))); + } else { + do { + int windows_eol = 0; + if (p != target_buf && eol_marker == '\n' && *(p - 1) == '\r') { + windows_eol++; + } + if (skip_blank_lines && !(p-s-windows_eol)) { + s = ++p; + continue; + } + add_index_stringl(return_value, i++, estrndup(s, p-s-windows_eol), p-s-windows_eol, 0); + s = ++p; + } while ((p = memchr(p, eol_marker, (e-p)))); + } + + /* handle any left overs of files without new lines */ + if (s != e) { + p = e; + goto parse_eol; + } + } + + if (target_buf) { + efree(target_buf); + } + php_stream_close(stream); +} +/* }}} */ + +/* {{{ proto string tempnam(string dir, string prefix) + Create a unique filename in a directory */ +PHP_FUNCTION(tempnam) +{ + char *dir, *prefix; + int dir_len, prefix_len; + size_t p_len; + char *opened_path; + char *p; + int fd; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &dir, &dir_len, &prefix, &prefix_len) == FAILURE) { + return; + } + + if (php_check_open_basedir(dir TSRMLS_CC)) { + RETURN_FALSE; + } + + php_basename(prefix, prefix_len, NULL, 0, &p, &p_len TSRMLS_CC); + if (p_len > 64) { + p[63] = '\0'; + } + + RETVAL_FALSE; + + if ((fd = php_open_temporary_fd_ex(dir, p, &opened_path, 1 TSRMLS_CC)) >= 0) { + close(fd); + RETVAL_STRING(opened_path, 0); + } + efree(p); +} +/* }}} */ + +/* {{{ proto resource tmpfile(void) + Create a temporary file that will be deleted automatically after use */ +PHP_NAMED_FUNCTION(php_if_tmpfile) +{ + php_stream *stream; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + stream = php_stream_fopen_tmpfile(); + + if (stream) { + php_stream_to_zval(stream, return_value); + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto resource fopen(string filename, string mode [, bool use_include_path [, resource context]]) + Open a file or a URL and return a file pointer */ +PHP_NAMED_FUNCTION(php_if_fopen) +{ + char *filename, *mode; + int filename_len, mode_len; + zend_bool use_include_path = 0; + zval *zcontext = NULL; + php_stream *stream; + php_stream_context *context = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps|br", &filename, &filename_len, &mode, &mode_len, &use_include_path, &zcontext) == FAILURE) { + RETURN_FALSE; + } + + context = php_stream_context_from_zval(zcontext, 0); + + stream = php_stream_open_wrapper_ex(filename, mode, (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, NULL, context); + + if (stream == NULL) { + RETURN_FALSE; + } + + php_stream_to_zval(stream, return_value); +} +/* }}} */ + +/* {{{ proto bool fclose(resource fp) + Close an open file pointer */ +PHPAPI PHP_FUNCTION(fclose) +{ + zval *arg1; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) { + RETURN_FALSE; + } + + PHP_STREAM_TO_ZVAL(stream, &arg1); + + if ((stream->flags & PHP_STREAM_FLAG_NO_FCLOSE) != 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a valid stream resource", stream->rsrc_id); + RETURN_FALSE; + } + + if (!stream->is_persistent) { + php_stream_close(stream); + } else { + php_stream_pclose(stream); + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto resource popen(string command, string mode) + Execute a command and open either a read or a write pipe to it */ +PHP_FUNCTION(popen) +{ + char *command, *mode; + int command_len, mode_len; + FILE *fp; + php_stream *stream; + char *posix_mode; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &command, &command_len, &mode, &mode_len) == FAILURE) { + return; + } + + posix_mode = estrndup(mode, mode_len); +#ifndef PHP_WIN32 + { + char *z = memchr(posix_mode, 'b', mode_len); + if (z) { + memmove(z, z + 1, mode_len - (z - posix_mode)); + } + } +#endif + + fp = VCWD_POPEN(command, posix_mode); + if (!fp) { + php_error_docref2(NULL TSRMLS_CC, command, posix_mode, E_WARNING, "%s", strerror(errno)); + efree(posix_mode); + RETURN_FALSE; + } + + stream = php_stream_fopen_from_pipe(fp, mode); + + if (stream == NULL) { + php_error_docref2(NULL TSRMLS_CC, command, mode, E_WARNING, "%s", strerror(errno)); + RETVAL_FALSE; + } else { + php_stream_to_zval(stream, return_value); + } + + efree(posix_mode); +} +/* }}} */ + +/* {{{ proto int pclose(resource fp) + Close a file pointer opened by popen() */ +PHP_FUNCTION(pclose) +{ + zval *arg1; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) { + RETURN_FALSE; + } + + PHP_STREAM_TO_ZVAL(stream, &arg1); + + zend_list_delete(stream->rsrc_id); + RETURN_LONG(FG(pclose_ret)); +} +/* }}} */ + +/* {{{ proto bool feof(resource fp) + Test for end-of-file on a file pointer */ +PHPAPI PHP_FUNCTION(feof) +{ + zval *arg1; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) { + RETURN_FALSE; + } + + PHP_STREAM_TO_ZVAL(stream, &arg1); + + if (php_stream_eof(stream)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto string fgets(resource fp[, int length]) + Get a line from file pointer */ +PHPAPI PHP_FUNCTION(fgets) +{ + zval *arg1; + long len = 1024; + char *buf = NULL; + int argc = ZEND_NUM_ARGS(); + size_t line_len = 0; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &len) == FAILURE) { + RETURN_FALSE; + } + + PHP_STREAM_TO_ZVAL(stream, &arg1); + + if (argc == 1) { + /* ask streams to give us a buffer of an appropriate size */ + buf = php_stream_get_line(stream, NULL, 0, &line_len); + if (buf == NULL) { + goto exit_failed; + } + } else if (argc > 1) { + if (len <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0"); + RETURN_FALSE; + } + + buf = ecalloc(len + 1, sizeof(char)); + if (php_stream_get_line(stream, buf, len, &line_len) == NULL) { + goto exit_failed; + } + } + + ZVAL_STRINGL(return_value, buf, line_len, 0); + /* resize buffer if it's much larger than the result. + * Only needed if the user requested a buffer size. */ + if (argc > 1 && Z_STRLEN_P(return_value) < len / 2) { + Z_STRVAL_P(return_value) = erealloc(buf, line_len + 1); + } + return; + +exit_failed: + RETVAL_FALSE; + if (buf) { + efree(buf); + } +} +/* }}} */ + +/* {{{ proto string fgetc(resource fp) + Get a character from file pointer */ +PHPAPI PHP_FUNCTION(fgetc) +{ + zval *arg1; + char buf[2]; + int result; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) { + RETURN_FALSE; + } + + PHP_STREAM_TO_ZVAL(stream, &arg1); + + result = php_stream_getc(stream); + + if (result == EOF) { + RETVAL_FALSE; + } else { + buf[0] = result; + buf[1] = '\0'; + + RETURN_STRINGL(buf, 1, 1); + } +} +/* }}} */ + +/* {{{ proto string fgetss(resource fp [, int length [, string allowable_tags]]) + Get a line from file pointer and strip HTML tags */ +PHPAPI PHP_FUNCTION(fgetss) +{ + zval *fd; + long bytes = 0; + size_t len = 0; + size_t actual_len, retval_len; + char *buf = NULL, *retval; + php_stream *stream; + char *allowed_tags=NULL; + int allowed_tags_len=0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ls", &fd, &bytes, &allowed_tags, &allowed_tags_len) == FAILURE) { + RETURN_FALSE; + } + + PHP_STREAM_TO_ZVAL(stream, &fd); + + if (ZEND_NUM_ARGS() >= 2) { + if (bytes <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0"); + RETURN_FALSE; + } + + len = (size_t) bytes; + buf = safe_emalloc(sizeof(char), (len + 1), 0); + /*needed because recv doesnt set null char at end*/ + memset(buf, 0, len + 1); + } + + if ((retval = php_stream_get_line(stream, buf, len, &actual_len)) == NULL) { + if (buf != NULL) { + efree(buf); + } + RETURN_FALSE; + } + + retval_len = php_strip_tags(retval, actual_len, &stream->fgetss_state, allowed_tags, allowed_tags_len); + + RETURN_STRINGL(retval, retval_len, 0); +} +/* }}} */ + +/* {{{ proto mixed fscanf(resource stream, string format [, string ...]) + Implements a mostly ANSI compatible fscanf() */ +PHP_FUNCTION(fscanf) +{ + int result, format_len, type, argc = 0; + zval ***args = NULL; + zval *file_handle; + char *buf, *format; + size_t len; + void *what; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs*", &file_handle, &format, &format_len, &args, &argc) == FAILURE) { + return; + } + + what = zend_fetch_resource(&file_handle TSRMLS_CC, -1, "File-Handle", &type, 2, php_file_le_stream(), php_file_le_pstream()); + + /* we can't do a ZEND_VERIFY_RESOURCE(what), otherwise we end up + * with a leak if we have an invalid filehandle. This needs changing + * if the code behind ZEND_VERIFY_RESOURCE changed. - cc */ + if (!what) { + if (args) { + efree(args); + } + RETURN_FALSE; + } + + buf = php_stream_get_line((php_stream *) what, NULL, 0, &len); + if (buf == NULL) { + if (args) { + efree(args); + } + RETURN_FALSE; + } + + result = php_sscanf_internal(buf, format, argc, args, 0, &return_value TSRMLS_CC); + + if (args) { + efree(args); + } + efree(buf); + + if (SCAN_ERROR_WRONG_PARAM_COUNT == result) { + WRONG_PARAM_COUNT; + } +} +/* }}} */ + +/* {{{ proto int fwrite(resource fp, string str [, int length]) + Binary-safe file write */ +PHPAPI PHP_FUNCTION(fwrite) +{ + zval *arg1; + char *arg2; + int arg2len; + int ret; + int num_bytes; + long arg3 = 0; + char *buffer = NULL; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &arg2, &arg2len, &arg3) == FAILURE) { + RETURN_FALSE; + } + + if (ZEND_NUM_ARGS() == 2) { + num_bytes = arg2len; + } else { + num_bytes = MAX(0, MIN((int)arg3, arg2len)); + } + + if (!num_bytes) { + RETURN_LONG(0); + } + + PHP_STREAM_TO_ZVAL(stream, &arg1); + + ret = php_stream_write(stream, buffer ? buffer : arg2, num_bytes); + if (buffer) { + efree(buffer); + } + + RETURN_LONG(ret); +} +/* }}} */ + +/* {{{ proto bool fflush(resource fp) + Flushes output */ +PHPAPI PHP_FUNCTION(fflush) +{ + zval *arg1; + int ret; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) { + RETURN_FALSE; + } + + PHP_STREAM_TO_ZVAL(stream, &arg1); + + ret = php_stream_flush(stream); + if (ret) { + RETURN_FALSE; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool rewind(resource fp) + Rewind the position of a file pointer */ +PHPAPI PHP_FUNCTION(rewind) +{ + zval *arg1; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) { + RETURN_FALSE; + } + + PHP_STREAM_TO_ZVAL(stream, &arg1); + + if (-1 == php_stream_rewind(stream)) { + RETURN_FALSE; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto int ftell(resource fp) + Get file pointer's read/write position */ +PHPAPI PHP_FUNCTION(ftell) +{ + zval *arg1; + long ret; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) { + RETURN_FALSE; + } + + PHP_STREAM_TO_ZVAL(stream, &arg1); + + ret = php_stream_tell(stream); + if (ret == -1) { + RETURN_FALSE; + } + RETURN_LONG(ret); +} +/* }}} */ + +/* {{{ proto int fseek(resource fp, int offset [, int whence]) + Seek on a file pointer */ +PHPAPI PHP_FUNCTION(fseek) +{ + zval *arg1; + long arg2, whence = SEEK_SET; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &arg1, &arg2, &whence) == FAILURE) { + RETURN_FALSE; + } + + PHP_STREAM_TO_ZVAL(stream, &arg1); + + RETURN_LONG(php_stream_seek(stream, arg2, whence)); +} +/* }}} */ + +/* {{{ php_mkdir +*/ + +/* DEPRECATED APIs: Use php_stream_mkdir() instead */ +PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC) +{ + int ret; + + if (php_check_open_basedir(dir TSRMLS_CC)) { + return -1; + } + + if ((ret = VCWD_MKDIR(dir, (mode_t)mode)) < 0 && (options & REPORT_ERRORS)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + } + + return ret; +} + +PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC) +{ + return php_mkdir_ex(dir, mode, REPORT_ERRORS TSRMLS_CC); +} +/* }}} */ + +/* {{{ proto bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]]) + Create a directory */ +PHP_FUNCTION(mkdir) +{ + char *dir; + int dir_len; + zval *zcontext = NULL; + long mode = 0777; + zend_bool recursive = 0; + php_stream_context *context; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lbr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) { + RETURN_FALSE; + } + + context = php_stream_context_from_zval(zcontext, 0); + + RETURN_BOOL(php_stream_mkdir(dir, mode, (recursive ? PHP_STREAM_MKDIR_RECURSIVE : 0) | REPORT_ERRORS, context)); +} +/* }}} */ + +/* {{{ proto bool rmdir(string dirname[, resource context]) + Remove a directory */ +PHP_FUNCTION(rmdir) +{ + char *dir; + int dir_len; + zval *zcontext = NULL; + php_stream_context *context; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &dir, &dir_len, &zcontext) == FAILURE) { + RETURN_FALSE; + } + + context = php_stream_context_from_zval(zcontext, 0); + + RETURN_BOOL(php_stream_rmdir(dir, REPORT_ERRORS, context)); +} +/* }}} */ + +/* {{{ proto int readfile(string filename [, bool use_include_path[, resource context]]) + Output a file or a URL */ +PHP_FUNCTION(readfile) +{ + char *filename; + int filename_len; + int size = 0; + zend_bool use_include_path = 0; + zval *zcontext = NULL; + php_stream *stream; + php_stream_context *context = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) { + RETURN_FALSE; + } + + context = php_stream_context_from_zval(zcontext, 0); + + stream = php_stream_open_wrapper_ex(filename, "rb", (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, NULL, context); + if (stream) { + size = php_stream_passthru(stream); + php_stream_close(stream); + RETURN_LONG(size); + } + + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto int umask([int mask]) + Return or change the umask */ +PHP_FUNCTION(umask) +{ + long arg1 = 0; + int oldumask; + + oldumask = umask(077); + + if (BG(umask) == -1) { + BG(umask) = oldumask; + } + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &arg1) == FAILURE) { + RETURN_FALSE; + } + + if (ZEND_NUM_ARGS() == 0) { + umask(oldumask); + } else { + umask(arg1); + } + + RETURN_LONG(oldumask); +} +/* }}} */ + +/* {{{ proto int fpassthru(resource fp) + Output all remaining data from a file pointer */ +PHPAPI PHP_FUNCTION(fpassthru) +{ + zval *arg1; + int size; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) { + RETURN_FALSE; + } + + PHP_STREAM_TO_ZVAL(stream, &arg1); + + size = php_stream_passthru(stream); + RETURN_LONG(size); +} +/* }}} */ + +/* {{{ proto bool rename(string old_name, string new_name[, resource context]) + Rename a file */ +PHP_FUNCTION(rename) +{ + char *old_name, *new_name; + int old_name_len, new_name_len; + zval *zcontext = NULL; + php_stream_wrapper *wrapper; + php_stream_context *context; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|r", &old_name, &old_name_len, &new_name, &new_name_len, &zcontext) == FAILURE) { + RETURN_FALSE; + } + + wrapper = php_stream_locate_url_wrapper(old_name, NULL, 0 TSRMLS_CC); + + if (!wrapper || !wrapper->wops) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate stream wrapper"); + RETURN_FALSE; + } + + if (!wrapper->wops->rename) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s wrapper does not support renaming", wrapper->wops->label ? wrapper->wops->label : "Source"); + RETURN_FALSE; + } + + if (wrapper != php_stream_locate_url_wrapper(new_name, NULL, 0 TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot rename a file across wrapper types"); + RETURN_FALSE; + } + + context = php_stream_context_from_zval(zcontext, 0); + + RETURN_BOOL(wrapper->wops->rename(wrapper, old_name, new_name, 0, context TSRMLS_CC)); +} +/* }}} */ + +/* {{{ proto bool unlink(string filename[, context context]) + Delete a file */ +PHP_FUNCTION(unlink) +{ + char *filename; + int filename_len; + php_stream_wrapper *wrapper; + zval *zcontext = NULL; + php_stream_context *context = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|r", &filename, &filename_len, &zcontext) == FAILURE) { + RETURN_FALSE; + } + + context = php_stream_context_from_zval(zcontext, 0); + + wrapper = php_stream_locate_url_wrapper(filename, NULL, 0 TSRMLS_CC); + + if (!wrapper || !wrapper->wops) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate stream wrapper"); + RETURN_FALSE; + } + + if (!wrapper->wops->unlink) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s does not allow unlinking", wrapper->wops->label ? wrapper->wops->label : "Wrapper"); + RETURN_FALSE; + } + RETURN_BOOL(wrapper->wops->unlink(wrapper, filename, REPORT_ERRORS, context TSRMLS_CC)); +} +/* }}} */ + +/* {{{ proto bool ftruncate(resource fp, int size) + Truncate file to 'size' length */ +PHP_NAMED_FUNCTION(php_if_ftruncate) +{ + zval *fp; + long size; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &fp, &size) == FAILURE) { + RETURN_FALSE; + } + + PHP_STREAM_TO_ZVAL(stream, &fp); + + if (!php_stream_truncate_supported(stream)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't truncate this stream!"); + RETURN_FALSE; + } + + RETURN_BOOL(0 == php_stream_truncate_set_size(stream, size)); +} +/* }}} */ + +/* {{{ proto array fstat(resource fp) + Stat() on a filehandle */ +PHP_NAMED_FUNCTION(php_if_fstat) +{ + zval *fp; + 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; + php_stream *stream; + php_stream_statbuf stat_ssb; + char *stat_sb_names[13] = { + "dev", "ino", "mode", "nlink", "uid", "gid", "rdev", + "size", "atime", "mtime", "ctime", "blksize", "blocks" + }; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &fp) == FAILURE) { + RETURN_FALSE; + } + + PHP_STREAM_TO_ZVAL(stream, &fp); + + if (php_stream_stat(stream, &stat_ssb)) { + RETURN_FALSE; + } + + array_init(return_value); + + MAKE_LONG_ZVAL_INCREF(stat_dev, stat_ssb.sb.st_dev); + MAKE_LONG_ZVAL_INCREF(stat_ino, stat_ssb.sb.st_ino); + MAKE_LONG_ZVAL_INCREF(stat_mode, stat_ssb.sb.st_mode); + MAKE_LONG_ZVAL_INCREF(stat_nlink, stat_ssb.sb.st_nlink); + MAKE_LONG_ZVAL_INCREF(stat_uid, stat_ssb.sb.st_uid); + MAKE_LONG_ZVAL_INCREF(stat_gid, stat_ssb.sb.st_gid); +#ifdef HAVE_ST_RDEV + MAKE_LONG_ZVAL_INCREF(stat_rdev, stat_ssb.sb.st_rdev); +#else + MAKE_LONG_ZVAL_INCREF(stat_rdev, -1); +#endif + MAKE_LONG_ZVAL_INCREF(stat_size, stat_ssb.sb.st_size); + MAKE_LONG_ZVAL_INCREF(stat_atime, stat_ssb.sb.st_atime); + MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_ssb.sb.st_mtime); + MAKE_LONG_ZVAL_INCREF(stat_ctime, stat_ssb.sb.st_ctime); +#ifdef HAVE_ST_BLKSIZE + MAKE_LONG_ZVAL_INCREF(stat_blksize, stat_ssb.sb.st_blksize); +#else + MAKE_LONG_ZVAL_INCREF(stat_blksize,-1); +#endif +#ifdef HAVE_ST_BLOCKS + MAKE_LONG_ZVAL_INCREF(stat_blocks, stat_ssb.sb.st_blocks); +#else + MAKE_LONG_ZVAL_INCREF(stat_blocks,-1); +#endif + /* Store numeric indexes in propper order */ + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_dev, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_ino, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_mode, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_nlink, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_uid, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_gid, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_rdev, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_size, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_atime, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_mtime, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_ctime, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_blksize, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_blocks, sizeof(zval *), NULL); + + /* Store string indexes referencing the same zval*/ + zend_hash_update(HASH_OF(return_value), stat_sb_names[0], strlen(stat_sb_names[0])+1, (void *)&stat_dev, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[1], strlen(stat_sb_names[1])+1, (void *)&stat_ino, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[2], strlen(stat_sb_names[2])+1, (void *)&stat_mode, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[3], strlen(stat_sb_names[3])+1, (void *)&stat_nlink, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[4], strlen(stat_sb_names[4])+1, (void *)&stat_uid, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[5], strlen(stat_sb_names[5])+1, (void *)&stat_gid, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[6], strlen(stat_sb_names[6])+1, (void *)&stat_rdev, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[7], strlen(stat_sb_names[7])+1, (void *)&stat_size, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[8], strlen(stat_sb_names[8])+1, (void *)&stat_atime, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[9], strlen(stat_sb_names[9])+1, (void *)&stat_mtime, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[10], strlen(stat_sb_names[10])+1, (void *)&stat_ctime, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[11], strlen(stat_sb_names[11])+1, (void *)&stat_blksize, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[12], strlen(stat_sb_names[12])+1, (void *)&stat_blocks, sizeof(zval *), NULL); +} +/* }}} */ + +/* {{{ proto bool copy(string source_file, string destination_file [, resource context]) + Copy a file */ +PHP_FUNCTION(copy) +{ + char *source, *target; + int source_len, target_len; + zval *zcontext = NULL; + php_stream_context *context; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|r", &source, &source_len, &target, &target_len, &zcontext) == FAILURE) { + return; + } + + if (php_check_open_basedir(source TSRMLS_CC)) { + RETURN_FALSE; + } + + context = php_stream_context_from_zval(zcontext, 0); + + if (php_copy_file_ctx(source, target, 0, context TSRMLS_CC) == SUCCESS) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ php_copy_file + */ +PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC) +{ + return php_copy_file_ctx(src, dest, 0, NULL TSRMLS_CC); +} +/* }}} */ + +/* {{{ php_copy_file_ex + */ +PHPAPI int php_copy_file_ex(char *src, char *dest, int src_flg TSRMLS_DC) +{ + return php_copy_file_ctx(src, dest, 0, NULL TSRMLS_CC); +} +/* }}} */ + +/* {{{ php_copy_file_ctx + */ +PHPAPI int php_copy_file_ctx(char *src, char *dest, int src_flg, php_stream_context *ctx TSRMLS_DC) +{ + php_stream *srcstream = NULL, *deststream = NULL; + int ret = FAILURE; + php_stream_statbuf src_s, dest_s; + + switch (php_stream_stat_path_ex(src, 0, &src_s, ctx)) { + case -1: + /* non-statable stream */ + goto safe_to_copy; + break; + case 0: + break; + default: /* failed to stat file, does not exist? */ + return ret; + } + if (S_ISDIR(src_s.sb.st_mode)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument to copy() function cannot be a directory"); + return FAILURE; + } + + switch (php_stream_stat_path_ex(dest, PHP_STREAM_URL_STAT_QUIET, &dest_s, ctx)) { + case -1: + /* non-statable stream */ + goto safe_to_copy; + break; + case 0: + break; + default: /* failed to stat file, does not exist? */ + return ret; + } + if (S_ISDIR(dest_s.sb.st_mode)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second argument to copy() function cannot be a directory"); + return FAILURE; + } + if (!src_s.sb.st_ino || !dest_s.sb.st_ino) { + goto no_stat; + } + if (src_s.sb.st_ino == dest_s.sb.st_ino && src_s.sb.st_dev == dest_s.sb.st_dev) { + return ret; + } else { + goto safe_to_copy; + } +no_stat: + { + char *sp, *dp; + int res; + + if ((sp = expand_filepath(src, NULL TSRMLS_CC)) == NULL) { + return ret; + } + if ((dp = expand_filepath(dest, NULL TSRMLS_CC)) == NULL) { + efree(sp); + goto safe_to_copy; + } + + res = +#ifndef PHP_WIN32 + !strcmp(sp, dp); +#else + !strcasecmp(sp, dp); +#endif + + efree(sp); + efree(dp); + if (res) { + return ret; + } + } +safe_to_copy: + + srcstream = php_stream_open_wrapper_ex(src, "rb", src_flg | REPORT_ERRORS, NULL, ctx); + + if (!srcstream) { + return ret; + } + + deststream = php_stream_open_wrapper_ex(dest, "wb", REPORT_ERRORS, NULL, ctx); + + if (srcstream && deststream) { + ret = php_stream_copy_to_stream_ex(srcstream, deststream, PHP_STREAM_COPY_ALL, NULL); + } + if (srcstream) { + php_stream_close(srcstream); + } + if (deststream) { + php_stream_close(deststream); + } + return ret; +} +/* }}} */ + +/* {{{ proto string fread(resource fp, int length) + Binary-safe file read */ +PHPAPI PHP_FUNCTION(fread) +{ + zval *arg1; + long len; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &len) == FAILURE) { + RETURN_FALSE; + } + + PHP_STREAM_TO_ZVAL(stream, &arg1); + + if (len <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0"); + RETURN_FALSE; + } + + Z_STRVAL_P(return_value) = emalloc(len + 1); + Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len); + + /* needed because recv/read/gzread doesnt put a null at the end*/ + Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0; + Z_TYPE_P(return_value) = IS_STRING; +} +/* }}} */ + +static const char *php_fgetcsv_lookup_trailing_spaces(const char *ptr, size_t len, const char delimiter TSRMLS_DC) /* {{{ */ +{ + int inc_len; + unsigned char last_chars[2] = { 0, 0 }; + + while (len > 0) { + inc_len = (*ptr == '\0' ? 1: php_mblen(ptr, len)); + switch (inc_len) { + case -2: + case -1: + inc_len = 1; + php_ignore_value(php_mblen(NULL, 0)); + break; + case 0: + goto quit_loop; + case 1: + default: + last_chars[0] = last_chars[1]; + last_chars[1] = *ptr; + break; + } + ptr += inc_len; + len -= inc_len; + } +quit_loop: + switch (last_chars[1]) { + case '\n': + if (last_chars[0] == '\r') { + return ptr - 2; + } + /* break is omitted intentionally */ + case '\r': + return ptr - 1; + } + return ptr; +} +/* }}} */ + +#define FPUTCSV_FLD_CHK(c) memchr(Z_STRVAL(field), c, Z_STRLEN(field)) + +/* {{{ proto int fputcsv(resource fp, array fields [, string delimiter [, string enclosure]]) + Format line as CSV and write to file pointer */ +PHP_FUNCTION(fputcsv) +{ + char delimiter = ','; /* allow this to be set as parameter */ + char enclosure = '"'; /* allow this to be set as parameter */ + const char escape_char = '\\'; + php_stream *stream; + zval *fp = NULL, *fields = NULL; + int ret; + char *delimiter_str = NULL, *enclosure_str = NULL; + int delimiter_str_len = 0, enclosure_str_len = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|ss", + &fp, &fields, &delimiter_str, &delimiter_str_len, + &enclosure_str, &enclosure_str_len) == FAILURE) { + return; + } + + if (delimiter_str != NULL) { + /* Make sure that there is at least one character in string */ + if (delimiter_str_len < 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "delimiter must be a character"); + RETURN_FALSE; + } else if (delimiter_str_len > 1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "delimiter must be a single character"); + } + + /* use first character from string */ + delimiter = *delimiter_str; + } + + if (enclosure_str != NULL) { + if (enclosure_str_len < 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "enclosure must be a character"); + RETURN_FALSE; + } else if (enclosure_str_len > 1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "enclosure must be a single character"); + } + /* use first character from string */ + enclosure = *enclosure_str; + } + + PHP_STREAM_TO_ZVAL(stream, &fp); + + ret = php_fputcsv(stream, fields, delimiter, enclosure, escape_char TSRMLS_CC); + RETURN_LONG(ret); +} +/* }}} */ + +/* {{{ PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) */ +PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) +{ + int count, i = 0, ret; + zval **field_tmp = NULL, field; + smart_str csvline = {0}; + HashPosition pos; + + count = zend_hash_num_elements(Z_ARRVAL_P(fields)); + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(fields), &pos); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(fields), (void **) &field_tmp, &pos) == SUCCESS) { + field = **field_tmp; + + if (Z_TYPE_PP(field_tmp) != IS_STRING) { + zval_copy_ctor(&field); + convert_to_string(&field); + } + + /* enclose a field that contains a delimiter, an enclosure character, or a newline */ + if (FPUTCSV_FLD_CHK(delimiter) || + FPUTCSV_FLD_CHK(enclosure) || + FPUTCSV_FLD_CHK(escape_char) || + FPUTCSV_FLD_CHK('\n') || + FPUTCSV_FLD_CHK('\r') || + FPUTCSV_FLD_CHK('\t') || + FPUTCSV_FLD_CHK(' ') + ) { + char *ch = Z_STRVAL(field); + char *end = ch + Z_STRLEN(field); + int escaped = 0; + + smart_str_appendc(&csvline, enclosure); + while (ch < end) { + if (*ch == escape_char) { + escaped = 1; + } else if (!escaped && *ch == enclosure) { + smart_str_appendc(&csvline, enclosure); + } else { + escaped = 0; + } + smart_str_appendc(&csvline, *ch); + ch++; + } + smart_str_appendc(&csvline, enclosure); + } else { + smart_str_appendl(&csvline, Z_STRVAL(field), Z_STRLEN(field)); + } + + if (++i != count) { + smart_str_appendl(&csvline, &delimiter, 1); + } + zend_hash_move_forward_ex(Z_ARRVAL_P(fields), &pos); + + if (Z_TYPE_PP(field_tmp) != IS_STRING) { + zval_dtor(&field); + } + } + + smart_str_appendc(&csvline, '\n'); + smart_str_0(&csvline); + + ret = php_stream_write(stream, csvline.c, csvline.len); + + smart_str_free(&csvline); + + return ret; +} +/* }}} */ + +/* {{{ proto array fgetcsv(resource fp [,int length [, string delimiter [, string enclosure [, string escape]]]]) + Get line from file pointer and parse for CSV fields */ +PHP_FUNCTION(fgetcsv) +{ + char delimiter = ','; /* allow this to be set as parameter */ + char enclosure = '"'; /* allow this to be set as parameter */ + char escape = '\\'; + + /* first section exactly as php_fgetss */ + + long len = 0; + size_t buf_len; + char *buf; + php_stream *stream; + + { + zval *fd, **len_zv = NULL; + char *delimiter_str = NULL; + int delimiter_str_len = 0; + char *enclosure_str = NULL; + int enclosure_str_len = 0; + char *escape_str = NULL; + int escape_str_len = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|Zsss", + &fd, &len_zv, &delimiter_str, &delimiter_str_len, + &enclosure_str, &enclosure_str_len, + &escape_str, &escape_str_len) == FAILURE + ) { + return; + } + + if (delimiter_str != NULL) { + /* Make sure that there is at least one character in string */ + if (delimiter_str_len < 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "delimiter must be a character"); + RETURN_FALSE; + } else if (delimiter_str_len > 1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "delimiter must be a single character"); + } + + /* use first character from string */ + delimiter = delimiter_str[0]; + } + + if (enclosure_str != NULL) { + if (enclosure_str_len < 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "enclosure must be a character"); + RETURN_FALSE; + } else if (enclosure_str_len > 1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "enclosure must be a single character"); + } + + /* use first character from string */ + enclosure = enclosure_str[0]; + } + + if (escape_str != NULL) { + if (escape_str_len < 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "escape must be character"); + RETURN_FALSE; + } else if (escape_str_len > 1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "escape must be a single character"); + } + + escape = escape_str[0]; + } + + if (len_zv != NULL && Z_TYPE_PP(len_zv) != IS_NULL) { + convert_to_long_ex(len_zv); + len = Z_LVAL_PP(len_zv); + if (len < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter may not be negative"); + RETURN_FALSE; + } else if (len == 0) { + len = -1; + } + } else { + len = -1; + } + + PHP_STREAM_TO_ZVAL(stream, &fd); + } + + if (len < 0) { + if ((buf = php_stream_get_line(stream, NULL, 0, &buf_len)) == NULL) { + RETURN_FALSE; + } + } else { + buf = emalloc(len + 1); + if (php_stream_get_line(stream, buf, len + 1, &buf_len) == NULL) { + efree(buf); + RETURN_FALSE; + } + } + + php_fgetcsv(stream, delimiter, enclosure, escape, buf_len, buf, return_value TSRMLS_CC); +} +/* }}} */ + +PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value TSRMLS_DC) /* {{{ */ +{ + char *temp, *tptr, *bptr, *line_end, *limit; + size_t temp_len, line_end_len; + int inc_len; + zend_bool first_field = 1; + + /* initialize internal state */ + php_ignore_value(php_mblen(NULL, 0)); + + /* Now into new section that parses buf for delimiter/enclosure fields */ + + /* Strip trailing space from buf, saving end of line in case required for enclosure field */ + + bptr = buf; + tptr = (char *)php_fgetcsv_lookup_trailing_spaces(buf, buf_len, delimiter TSRMLS_CC); + line_end_len = buf_len - (size_t)(tptr - buf); + line_end = limit = tptr; + + /* reserve workspace for building each individual field */ + temp_len = buf_len; + temp = emalloc(temp_len + line_end_len + 1); + + /* Initialize return array */ + array_init(return_value); + + /* Main loop to read CSV fields */ + /* NB this routine will return a single null entry for a blank line */ + + do { + char *comp_end, *hunk_begin; + + tptr = temp; + + inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0); + if (inc_len == 1) { + char *tmp = bptr; + while ((*tmp != delimiter) && isspace((int)*(unsigned char *)tmp)) { + tmp++; + } + if (*tmp == enclosure) { + bptr = tmp; + } + } + + if (first_field && bptr == line_end) { + add_next_index_null(return_value); + break; + } + first_field = 0; + /* 2. Read field, leaving bptr pointing at start of next field */ + if (inc_len != 0 && *bptr == enclosure) { + int state = 0; + + bptr++; /* move on to first character in field */ + hunk_begin = bptr; + + /* 2A. handle enclosure delimited field */ + for (;;) { + switch (inc_len) { + case 0: + switch (state) { + case 2: + memcpy(tptr, hunk_begin, bptr - hunk_begin - 1); + tptr += (bptr - hunk_begin - 1); + hunk_begin = bptr; + goto quit_loop_2; + + case 1: + memcpy(tptr, hunk_begin, bptr - hunk_begin); + tptr += (bptr - hunk_begin); + hunk_begin = bptr; + /* break is omitted intentionally */ + + case 0: { + char *new_buf; + size_t new_len; + char *new_temp; + + if (hunk_begin != line_end) { + memcpy(tptr, hunk_begin, bptr - hunk_begin); + tptr += (bptr - hunk_begin); + hunk_begin = bptr; + } + + /* add the embedded line end to the field */ + memcpy(tptr, line_end, line_end_len); + tptr += line_end_len; + + if (stream == NULL) { + goto quit_loop_2; + } else if ((new_buf = php_stream_get_line(stream, NULL, 0, &new_len)) == NULL) { + /* we've got an unterminated enclosure, + * assign all the data from the start of + * the enclosure to end of data to the + * last element */ + if ((size_t)temp_len > (size_t)(limit - buf)) { + goto quit_loop_2; + } + zval_dtor(return_value); + RETVAL_FALSE; + goto out; + } + temp_len += new_len; + new_temp = erealloc(temp, temp_len); + tptr = new_temp + (size_t)(tptr - temp); + temp = new_temp; + + efree(buf); + buf_len = new_len; + bptr = buf = new_buf; + hunk_begin = buf; + + line_end = limit = (char *)php_fgetcsv_lookup_trailing_spaces(buf, buf_len, delimiter TSRMLS_CC); + line_end_len = buf_len - (size_t)(limit - buf); + + state = 0; + } break; + } + break; + + case -2: + case -1: + php_ignore_value(php_mblen(NULL, 0)); + /* break is omitted intentionally */ + case 1: + /* we need to determine if the enclosure is + * 'real' or is it escaped */ + switch (state) { + case 1: /* escaped */ + bptr++; + state = 0; + break; + case 2: /* embedded enclosure ? let's check it */ + if (*bptr != enclosure) { + /* real enclosure */ + memcpy(tptr, hunk_begin, bptr - hunk_begin - 1); + tptr += (bptr - hunk_begin - 1); + hunk_begin = bptr; + goto quit_loop_2; + } + memcpy(tptr, hunk_begin, bptr - hunk_begin); + tptr += (bptr - hunk_begin); + bptr++; + hunk_begin = bptr; + state = 0; + break; + default: + if (*bptr == enclosure) { + state = 2; + } else if (*bptr == escape_char) { + state = 1; + } + bptr++; + break; + } + break; + + default: + switch (state) { + case 2: + /* real enclosure */ + memcpy(tptr, hunk_begin, bptr - hunk_begin - 1); + tptr += (bptr - hunk_begin - 1); + hunk_begin = bptr; + goto quit_loop_2; + case 1: + bptr += inc_len; + memcpy(tptr, hunk_begin, bptr - hunk_begin); + tptr += (bptr - hunk_begin); + hunk_begin = bptr; + break; + default: + bptr += inc_len; + break; + } + break; + } + inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0); + } + + quit_loop_2: + /* look up for a delimiter */ + for (;;) { + switch (inc_len) { + case 0: + goto quit_loop_3; + + case -2: + case -1: + inc_len = 1; + php_ignore_value(php_mblen(NULL, 0)); + /* break is omitted intentionally */ + case 1: + if (*bptr == delimiter) { + goto quit_loop_3; + } + break; + default: + break; + } + bptr += inc_len; + inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0); + } + + quit_loop_3: + memcpy(tptr, hunk_begin, bptr - hunk_begin); + tptr += (bptr - hunk_begin); + bptr += inc_len; + comp_end = tptr; + } else { + /* 2B. Handle non-enclosure field */ + + hunk_begin = bptr; + + for (;;) { + switch (inc_len) { + case 0: + goto quit_loop_4; + case -2: + case -1: + inc_len = 1; + php_ignore_value(php_mblen(NULL, 0)); + /* break is omitted intentionally */ + case 1: + if (*bptr == delimiter) { + goto quit_loop_4; + } + break; + default: + break; + } + bptr += inc_len; + inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0); + } + quit_loop_4: + memcpy(tptr, hunk_begin, bptr - hunk_begin); + tptr += (bptr - hunk_begin); + + comp_end = (char *)php_fgetcsv_lookup_trailing_spaces(temp, tptr - temp, delimiter TSRMLS_CC); + if (*bptr == delimiter) { + bptr++; + } + } + + /* 3. Now pass our field back to php */ + *comp_end = '\0'; + add_next_index_stringl(return_value, temp, comp_end - temp, 1); + } while (inc_len > 0); + +out: + efree(temp); + if (stream) { + efree(buf); + } +} +/* }}} */ + +#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS) +/* {{{ proto string realpath(string path) + Return the resolved path */ +PHP_FUNCTION(realpath) +{ + char *filename; + int filename_len; + char resolved_path_buff[MAXPATHLEN]; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { + return; + } + + if (VCWD_REALPATH(filename, resolved_path_buff)) { + if (php_check_open_basedir(resolved_path_buff TSRMLS_CC)) { + RETURN_FALSE; + } + +#ifdef ZTS + if (VCWD_ACCESS(resolved_path_buff, F_OK)) { + RETURN_FALSE; + } +#endif + RETURN_STRING(resolved_path_buff, 1); + } else { + RETURN_FALSE; + } +} +/* }}} */ +#endif + +/* See http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2 */ +#define PHP_META_HTML401_CHARS "-_.:" + +/* {{{ php_next_meta_token + Tokenizes an HTML file for get_meta_tags */ +php_meta_tags_token php_next_meta_token(php_meta_tags_data *md TSRMLS_DC) +{ + int ch = 0, compliment; + char buff[META_DEF_BUFSIZE + 1]; + + memset((void *)buff, 0, META_DEF_BUFSIZE + 1); + + while (md->ulc || (!php_stream_eof(md->stream) && (ch = php_stream_getc(md->stream)))) { + if (php_stream_eof(md->stream)) { + break; + } + + if (md->ulc) { + ch = md->lc; + md->ulc = 0; + } + + switch (ch) { + case '<': + return TOK_OPENTAG; + break; + + case '>': + return TOK_CLOSETAG; + break; + + case '=': + return TOK_EQUAL; + break; + case '/': + return TOK_SLASH; + break; + + case '\'': + case '"': + compliment = ch; + md->token_len = 0; + while (!php_stream_eof(md->stream) && (ch = php_stream_getc(md->stream)) && ch != compliment && ch != '<' && ch != '>') { + buff[(md->token_len)++] = ch; + + if (md->token_len == META_DEF_BUFSIZE) { + break; + } + } + + if (ch == '<' || ch == '>') { + /* Was just an apostrohpe */ + md->ulc = 1; + md->lc = ch; + } + + /* We don't need to alloc unless we are in a meta tag */ + if (md->in_meta) { + md->token_data = (char *) emalloc(md->token_len + 1); + memcpy(md->token_data, buff, md->token_len+1); + } + + return TOK_STRING; + break; + + case '\n': + case '\r': + case '\t': + break; + + case ' ': + return TOK_SPACE; + break; + + default: + if (isalnum(ch)) { + md->token_len = 0; + buff[(md->token_len)++] = ch; + while (!php_stream_eof(md->stream) && (ch = php_stream_getc(md->stream)) && (isalnum(ch) || strchr(PHP_META_HTML401_CHARS, ch))) { + buff[(md->token_len)++] = ch; + + if (md->token_len == META_DEF_BUFSIZE) { + break; + } + } + + /* This is ugly, but we have to replace ungetc */ + if (!isalpha(ch) && ch != '-') { + md->ulc = 1; + md->lc = ch; + } + + md->token_data = (char *) emalloc(md->token_len + 1); + memcpy(md->token_data, buff, md->token_len+1); + + return TOK_ID; + } else { + return TOK_OTHER; + } + break; + } + } + + return TOK_EOF; +} +/* }}} */ + +#ifdef HAVE_FNMATCH +/* {{{ proto bool fnmatch(string pattern, string filename [, int flags]) + Match filename against pattern */ +PHP_FUNCTION(fnmatch) +{ + char *pattern, *filename; + int pattern_len, filename_len; + long flags = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|l", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) { + return; + } + + if (filename_len >= MAXPATHLEN) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Filename exceeds the maximum allowed length of %d characters", MAXPATHLEN); + RETURN_FALSE; + } + if (pattern_len >= MAXPATHLEN) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Pattern exceeds the maximum allowed length of %d characters", MAXPATHLEN); + RETURN_FALSE; + } + + RETURN_BOOL( ! fnmatch( pattern, filename, flags )); +} +/* }}} */ +#endif + +/* {{{ proto string sys_get_temp_dir() + Returns directory path used for temporary files */ +PHP_FUNCTION(sys_get_temp_dir) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_STRING((char *)php_get_temporary_directory(), 1); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/ext/standard/file.h b/ext/standard/file.h new file mode 100644 index 0000000..0a4512e --- /dev/null +++ b/ext/standard/file.h @@ -0,0 +1,141 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Rasmus Lerdorf | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +/* Synced with php 3.0 revision 1.30 1999-06-16 [ssb] */ + +#ifndef FILE_H +#define FILE_H + +PHP_MINIT_FUNCTION(file); +PHP_MSHUTDOWN_FUNCTION(file); + +PHP_FUNCTION(tempnam); +PHP_NAMED_FUNCTION(php_if_tmpfile); +PHP_NAMED_FUNCTION(php_if_fopen); +PHPAPI PHP_FUNCTION(fclose); +PHP_FUNCTION(popen); +PHP_FUNCTION(pclose); +PHPAPI PHP_FUNCTION(feof); +PHPAPI PHP_FUNCTION(fread); +PHPAPI PHP_FUNCTION(fgetc); +PHPAPI PHP_FUNCTION(fgets); +PHP_FUNCTION(fscanf); +PHPAPI PHP_FUNCTION(fgetss); +PHP_FUNCTION(fgetcsv); +PHP_FUNCTION(fputcsv); +PHPAPI PHP_FUNCTION(fwrite); +PHPAPI PHP_FUNCTION(fflush); +PHPAPI PHP_FUNCTION(rewind); +PHPAPI PHP_FUNCTION(ftell); +PHPAPI PHP_FUNCTION(fseek); +PHP_FUNCTION(mkdir); +PHP_FUNCTION(rmdir); +PHPAPI PHP_FUNCTION(fpassthru); +PHP_FUNCTION(readfile); +PHP_FUNCTION(umask); +PHP_FUNCTION(rename); +PHP_FUNCTION(unlink); +PHP_FUNCTION(copy); +PHP_FUNCTION(file); +PHP_FUNCTION(file_get_contents); +PHP_FUNCTION(file_put_contents); +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) +PHP_FUNCTION(realpath); +#endif +#ifdef HAVE_FNMATCH +PHP_FUNCTION(fnmatch); +#endif +PHP_NAMED_FUNCTION(php_if_ftruncate); +PHP_NAMED_FUNCTION(php_if_fstat); +PHP_FUNCTION(sys_get_temp_dir); + +PHP_MINIT_FUNCTION(user_streams); + +PHPAPI int php_le_stream_context(TSRMLS_D); +PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC); +PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC); +PHPAPI int php_copy_file_ex(char *src, char *dest, int src_chk TSRMLS_DC); +PHPAPI int php_copy_file_ctx(char *src, char *dest, int src_chk, php_stream_context *ctx TSRMLS_DC); +PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC); +PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC); +PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value TSRMLS_DC); +PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC); + +#define META_DEF_BUFSIZE 8192 + +#define PHP_FILE_USE_INCLUDE_PATH 1 +#define PHP_FILE_IGNORE_NEW_LINES 2 +#define PHP_FILE_SKIP_EMPTY_LINES 4 +#define PHP_FILE_APPEND 8 +#define PHP_FILE_NO_DEFAULT_CONTEXT 16 + +typedef enum _php_meta_tags_token { + TOK_EOF = 0, + TOK_OPENTAG, + TOK_CLOSETAG, + TOK_SLASH, + TOK_EQUAL, + TOK_SPACE, + TOK_ID, + TOK_STRING, + TOK_OTHER +} php_meta_tags_token; + +typedef struct _php_meta_tags_data { + php_stream *stream; + int ulc; + int lc; + char *input_buffer; + char *token_data; + int token_len; + int in_meta; +} php_meta_tags_data; + +php_meta_tags_token php_next_meta_token(php_meta_tags_data * TSRMLS_DC); + +typedef struct { + int pclose_ret; + size_t def_chunk_size; + long auto_detect_line_endings; + long default_socket_timeout; + char *user_agent; /* for the http wrapper */ + char *from_address; /* for the ftp and http wrappers */ + char *user_stream_current_filename; /* for simple recursion protection */ + php_stream_context *default_context; + HashTable *stream_wrappers; /* per-request copy of url_stream_wrappers_hash */ + HashTable *stream_filters; /* per-request copy of stream_filters_hash */ + HashTable *wrapper_errors; /* key: wrapper address; value: linked list of char* */ +} php_file_globals; + +#ifdef ZTS +#define FG(v) TSRMG(file_globals_id, php_file_globals *, v) +extern PHPAPI int file_globals_id; +#else +#define FG(v) (file_globals.v) +extern PHPAPI php_file_globals file_globals; +#endif + + +#endif /* FILE_H */ + diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c new file mode 100644 index 0000000..ce2987b --- /dev/null +++ b/ext/standard/filestat.c @@ -0,0 +1,1240 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Jim Winstead | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#include "php.h" +#include "fopen_wrappers.h" +#include "php_globals.h" + +#include +#include +#include +#include +#include +#include + +#if HAVE_UNISTD_H +# include +#endif + +#if HAVE_SYS_PARAM_H +# include +#endif + +#if HAVE_SYS_VFS_H +# include +#endif + +#ifdef OS2 +# define INCL_DOS +# include +#endif + +#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS) +# include +#elif defined(HAVE_SYS_STATFS_H) && defined(HAVE_STATFS) +# include +#elif defined(HAVE_SYS_MOUNT_H) && defined(HAVE_STATFS) +# include +#endif + +#if HAVE_PWD_H +# ifdef PHP_WIN32 +# include "win32/pwd.h" +# else +# include +# endif +#endif + +#if HAVE_GRP_H +# ifdef PHP_WIN32 +# include "win32/grp.h" +# else +# include +# endif +#endif + +#if HAVE_UTIME +# ifdef PHP_WIN32 +# include +# else +# include +# endif +#endif + +#ifdef PHP_WIN32 +#include "win32/winutil.h" +#endif + +#include "basic_functions.h" +#include "php_filestat.h" + +#ifndef S_ISDIR +#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) +#endif +#ifndef S_ISREG +#define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG) +#endif +#ifndef S_ISLNK +#define S_ISLNK(mode) (((mode)&S_IFMT) == S_IFLNK) +#endif + +#define S_IXROOT ( S_IXUSR | S_IXGRP | S_IXOTH ) + +PHP_RINIT_FUNCTION(filestat) /* {{{ */ +{ + BG(CurrentStatFile)=NULL; + BG(CurrentLStatFile)=NULL; + return SUCCESS; +} +/* }}} */ + +PHP_RSHUTDOWN_FUNCTION(filestat) /* {{{ */ +{ + if (BG(CurrentStatFile)) { + efree (BG(CurrentStatFile)); + BG(CurrentStatFile) = NULL; + } + if (BG(CurrentLStatFile)) { + efree (BG(CurrentLStatFile)); + BG(CurrentLStatFile) = NULL; + } + return SUCCESS; +} +/* }}} */ + +static int php_disk_total_space(char *path, double *space TSRMLS_DC) /* {{{ */ +#if defined(WINDOWS) /* {{{ */ +{ + double bytestotal = 0; + HINSTANCE kernel32; + FARPROC gdfse; + typedef BOOL (WINAPI *gdfse_func)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER); + gdfse_func func; + + /* These are used by GetDiskFreeSpaceEx, if available. */ + ULARGE_INTEGER FreeBytesAvailableToCaller; + ULARGE_INTEGER TotalNumberOfBytes; + ULARGE_INTEGER TotalNumberOfFreeBytes; + + /* These are used by GetDiskFreeSpace otherwise. */ + DWORD SectorsPerCluster; + DWORD BytesPerSector; + DWORD NumberOfFreeClusters; + DWORD TotalNumberOfClusters; + + /* GetDiskFreeSpaceEx is only available in NT and Win95 post-OSR2, + so we have to jump through some hoops to see if the function + exists. */ + kernel32 = LoadLibrary("kernel32.dll"); + if (kernel32) { + gdfse = GetProcAddress(kernel32, "GetDiskFreeSpaceExA"); + /* It's available, so we can call it. */ + if (gdfse) { + func = (gdfse_func)gdfse; + if (func(path, + &FreeBytesAvailableToCaller, + &TotalNumberOfBytes, + &TotalNumberOfFreeBytes) == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", php_win_err()); + return FAILURE; + } + + /* i know - this is ugly, but i works */ + bytestotal = TotalNumberOfBytes.HighPart * + (double) (((unsigned long)1) << 31) * 2.0 + + TotalNumberOfBytes.LowPart; + } else { /* If it's not available, we just use GetDiskFreeSpace */ + if (GetDiskFreeSpace(path, + &SectorsPerCluster, &BytesPerSector, + &NumberOfFreeClusters, &TotalNumberOfClusters) == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", php_win_err()); + return FAILURE; + } + bytestotal = (double)TotalNumberOfClusters * (double)SectorsPerCluster * (double)BytesPerSector; + } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to load kernel32.dll"); + return FAILURE; + } + + *space = bytestotal; + return SUCCESS; +} +/* }}} */ +#elif defined(OS2) /* {{{ */ +{ + double bytestotal = 0; + FSALLOCATE fsinfo; + char drive = path[0] & 95; + + if (DosQueryFSInfo( drive ? drive - 64 : 0, FSIL_ALLOC, &fsinfo, sizeof( fsinfo ) ) == 0) { + bytestotal = (double)fsinfo.cbSector * fsinfo.cSectorUnit * fsinfo.cUnit; + *space = bytestotal; + return SUCCESS; + } + return FAILURE; +} +/* }}} */ +#else /* {{{ if !defined(OS2) && !defined(WINDOWS) */ +{ + double bytestotal = 0; +#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS) + struct statvfs buf; +#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS) + struct statfs buf; +#endif + +#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS) + if (statvfs(path, &buf)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + return FAILURE; + } + if (buf.f_frsize) { + bytestotal = (((double)buf.f_blocks) * ((double)buf.f_frsize)); + } else { + bytestotal = (((double)buf.f_blocks) * ((double)buf.f_bsize)); + } + +#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS) + if (statfs(path, &buf)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + return FAILURE; + } + bytestotal = (((double)buf.f_bsize) * ((double)buf.f_blocks)); +#endif + + *space = bytestotal; + return SUCCESS; +} +#endif +/* }}} */ +/* }}} */ + +/* {{{ proto float disk_total_space(string path) + Get total disk space for filesystem that path is on */ +PHP_FUNCTION(disk_total_space) +{ + double bytestotal; + char *path; + int path_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &path, &path_len) == FAILURE) { + return; + } + + if (php_check_open_basedir(path TSRMLS_CC)) { + RETURN_FALSE; + } + + if (php_disk_total_space(path, &bytestotal TSRMLS_CC) == SUCCESS) { + RETURN_DOUBLE(bytestotal); + } + RETURN_FALSE; +} +/* }}} */ + +static int php_disk_free_space(char *path, double *space TSRMLS_DC) /* {{{ */ +#if defined(WINDOWS) /* {{{ */ +{ + double bytesfree = 0; + + HINSTANCE kernel32; + FARPROC gdfse; + typedef BOOL (WINAPI *gdfse_func)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER); + gdfse_func func; + + /* These are used by GetDiskFreeSpaceEx, if available. */ + ULARGE_INTEGER FreeBytesAvailableToCaller; + ULARGE_INTEGER TotalNumberOfBytes; + ULARGE_INTEGER TotalNumberOfFreeBytes; + + /* These are used by GetDiskFreeSpace otherwise. */ + DWORD SectorsPerCluster; + DWORD BytesPerSector; + DWORD NumberOfFreeClusters; + DWORD TotalNumberOfClusters; + + /* GetDiskFreeSpaceEx is only available in NT and Win95 post-OSR2, + so we have to jump through some hoops to see if the function + exists. */ + kernel32 = LoadLibrary("kernel32.dll"); + if (kernel32) { + gdfse = GetProcAddress(kernel32, "GetDiskFreeSpaceExA"); + /* It's available, so we can call it. */ + if (gdfse) { + func = (gdfse_func)gdfse; + if (func(path, + &FreeBytesAvailableToCaller, + &TotalNumberOfBytes, + &TotalNumberOfFreeBytes) == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", php_win_err()); + return FAILURE; + } + + /* i know - this is ugly, but i works */ + bytesfree = FreeBytesAvailableToCaller.HighPart * + (double) (((unsigned long)1) << 31) * 2.0 + + FreeBytesAvailableToCaller.LowPart; + } else { /* If it's not available, we just use GetDiskFreeSpace */ + if (GetDiskFreeSpace(path, + &SectorsPerCluster, &BytesPerSector, + &NumberOfFreeClusters, &TotalNumberOfClusters) == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", php_win_err()); + return FAILURE; + } + bytesfree = (double)NumberOfFreeClusters * (double)SectorsPerCluster * (double)BytesPerSector; + } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to load kernel32.dll"); + return FAILURE; + } + + *space = bytesfree; + return SUCCESS; +} +/* }}} */ +#elif defined(OS2) /* {{{ */ +{ + double bytesfree = 0; + FSALLOCATE fsinfo; + char drive = path[0] & 95; + + if (DosQueryFSInfo( drive ? drive - 64 : 0, FSIL_ALLOC, &fsinfo, sizeof( fsinfo ) ) == 0) { + bytesfree = (double)fsinfo.cbSector * fsinfo.cSectorUnit * fsinfo.cUnitAvail; + *space = bytesfree; + return SUCCESS; + } + return FAILURE; +} +/* }}} */ +#else /* {{{ if !defined(OS2) && !defined(WINDOWS) */ +{ + double bytesfree = 0; +#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS) + struct statvfs buf; +#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS) + struct statfs buf; +#endif + +#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS) + if (statvfs(path, &buf)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + return FAILURE; + } + if (buf.f_frsize) { + bytesfree = (((double)buf.f_bavail) * ((double)buf.f_frsize)); + } else { + bytesfree = (((double)buf.f_bavail) * ((double)buf.f_bsize)); + } +#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS) + if (statfs(path, &buf)) { + php_error_docref(NULL TSRMLS_CC, 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; +} +#endif +/* }}} */ +/* }}} */ + +/* {{{ proto float disk_free_space(string path) + Get free disk space for filesystem that path is on */ +PHP_FUNCTION(disk_free_space) +{ + double bytesfree; + char *path; + int path_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &path, &path_len) == FAILURE) { + return; + } + + if (php_check_open_basedir(path TSRMLS_CC)) { + RETURN_FALSE; + } + + if (php_disk_free_space(path, &bytesfree TSRMLS_CC) == SUCCESS) { + RETURN_DOUBLE(bytesfree); + } + RETURN_FALSE; +} +/* }}} */ + +#if !defined(WINDOWS) && !defined(NETWARE) +PHPAPI int php_get_gid_by_name(const char *name, gid_t *gid TSRMLS_DC) +{ +#if defined(ZTS) && defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX) + struct group gr; + struct group *retgrptr; + long grbuflen = sysconf(_SC_GETGR_R_SIZE_MAX); + char *grbuf; + + if (grbuflen < 1) { + return FAILURE; + } + + grbuf = emalloc(grbuflen); + if (getgrnam_r(name, &gr, grbuf, grbuflen, &retgrptr) != 0 || retgrptr == NULL) { + efree(grbuf); + return FAILURE; + } + efree(grbuf); + *gid = gr.gr_gid; +#else + struct group *gr = getgrnam(name); + + if (!gr) { + return FAILURE; + } + *gid = gr->gr_gid; +#endif + return SUCCESS; +} +#endif + +static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ +{ + char *filename; + int filename_len; + zval *group; +#if !defined(WINDOWS) + gid_t gid; + int ret; +#endif + php_stream_wrapper *wrapper; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/", &filename, &filename_len, &group) == FAILURE) { + RETURN_FALSE; + } + + wrapper = php_stream_locate_url_wrapper(filename, NULL, 0 TSRMLS_CC); + if(wrapper != &php_plain_files_wrapper || strncasecmp("file://", filename, 7) == 0) { + if(wrapper && wrapper->wops->stream_metadata) { + int option; + void *value; + if (Z_TYPE_P(group) == IS_LONG) { + option = PHP_STREAM_META_GROUP; + value = &Z_LVAL_P(group); + } else if (Z_TYPE_P(group) == IS_STRING) { + option = PHP_STREAM_META_GROUP_NAME; + value = Z_STRVAL_P(group); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter 2 should be string or integer, %s given", zend_zval_type_name(group)); + RETURN_FALSE; + } + if(wrapper->wops->stream_metadata(wrapper, filename, option, value, NULL TSRMLS_CC)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } + } else { +#if !defined(WINDOWS) +/* On Windows, we expect regular chgrp to fail silently by default */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not call chgrp() for a non-standard stream"); +#endif + RETURN_FALSE; + } + } + +#if defined(WINDOWS) + /* We have no native chgrp on Windows, nothing left to do if stream doesn't have own implementation */ + RETURN_FALSE; +#else + if (Z_TYPE_P(group) == IS_LONG) { + gid = (gid_t)Z_LVAL_P(group); + } else if (Z_TYPE_P(group) == IS_STRING) { + if(php_get_gid_by_name(Z_STRVAL_P(group), &gid TSRMLS_CC) != SUCCESS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find gid for %s", Z_STRVAL_P(group)); + RETURN_FALSE; + } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter 2 should be string or integer, %s given", zend_zval_type_name(group)); + RETURN_FALSE; + } + + /* Check the basedir */ + if (php_check_open_basedir(filename TSRMLS_CC)) { + RETURN_FALSE; + } + + if (do_lchgrp) { +#if HAVE_LCHOWN + ret = VCWD_LCHOWN(filename, -1, gid); +#endif + } else { + ret = VCWD_CHOWN(filename, -1, gid); + } + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + RETURN_FALSE; + } + RETURN_TRUE; +#endif +} +/* }}} */ + +#ifndef NETWARE +/* {{{ proto bool chgrp(string filename, mixed group) + Change file group */ +PHP_FUNCTION(chgrp) +{ + php_do_chgrp(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* {{{ proto bool lchgrp(string filename, mixed group) + Change symlink group */ +#if HAVE_LCHOWN +PHP_FUNCTION(lchgrp) +{ +# if !defined(WINDOWS) + php_do_chgrp(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +# else + RETURN_FALSE; +# endif +} +#endif +/* }}} */ +#endif /* !NETWARE */ + +#if !defined(WINDOWS) && !defined(NETWARE) +PHPAPI uid_t php_get_uid_by_name(const char *name, uid_t *uid TSRMLS_DC) +{ +#if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R) + struct passwd pw; + struct passwd *retpwptr = NULL; + long pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); + char *pwbuf; + + if (pwbuflen < 1) { + return FAILURE; + } + + pwbuf = emalloc(pwbuflen); + if (getpwnam_r(name, &pw, pwbuf, pwbuflen, &retpwptr) != 0 || retpwptr == NULL) { + efree(pwbuf); + return FAILURE; + } + efree(pwbuf); + *uid = pw.pw_uid; +#else + struct passwd *pw = getpwnam(name); + + if (!pw) { + return FAILURE; + } + *uid = pw->pw_uid; +#endif + return SUCCESS; +} +#endif + +static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ +{ + char *filename; + int filename_len; + zval *user; +#if !defined(WINDOWS) + uid_t uid; + int ret; +#endif + php_stream_wrapper *wrapper; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/", &filename, &filename_len, &user) == FAILURE) { + return; + } + + wrapper = php_stream_locate_url_wrapper(filename, NULL, 0 TSRMLS_CC); + if(wrapper != &php_plain_files_wrapper || strncasecmp("file://", filename, 7) == 0) { + if(wrapper && wrapper->wops->stream_metadata) { + int option; + void *value; + if (Z_TYPE_P(user) == IS_LONG) { + option = PHP_STREAM_META_OWNER; + value = &Z_LVAL_P(user); + } else if (Z_TYPE_P(user) == IS_STRING) { + option = PHP_STREAM_META_OWNER_NAME; + value = Z_STRVAL_P(user); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter 2 should be string or integer, %s given", zend_zval_type_name(user)); + RETURN_FALSE; + } + if(wrapper->wops->stream_metadata(wrapper, filename, option, value, NULL TSRMLS_CC)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } + } else { +#if !defined(WINDOWS) +/* On Windows, we expect regular chown to fail silently by default */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not call chown() for a non-standard stream"); +#endif + RETURN_FALSE; + } + } + +#if defined(WINDOWS) + /* We have no native chown on Windows, nothing left to do if stream doesn't have own implementation */ + RETURN_FALSE; +#else + + if (Z_TYPE_P(user) == IS_LONG) { + uid = (uid_t)Z_LVAL_P(user); + } else if (Z_TYPE_P(user) == IS_STRING) { + if(php_get_uid_by_name(Z_STRVAL_P(user), &uid TSRMLS_CC) != SUCCESS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find uid for %s", Z_STRVAL_P(user)); + RETURN_FALSE; + } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter 2 should be string or integer, %s given", zend_zval_type_name(user)); + RETURN_FALSE; + } + + /* Check the basedir */ + if (php_check_open_basedir(filename TSRMLS_CC)) { + RETURN_FALSE; + } + + if (do_lchown) { +#if HAVE_LCHOWN + ret = VCWD_LCHOWN(filename, uid, -1); +#endif + } else { + ret = VCWD_CHOWN(filename, uid, -1); + } + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + RETURN_FALSE; + } + RETURN_TRUE; +#endif +} +/* }}} */ + + +#ifndef NETWARE +/* {{{ proto bool chown (string filename, mixed user) + Change file owner */ +PHP_FUNCTION(chown) +{ + php_do_chown(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* {{{ proto bool chown (string filename, mixed user) + Change file owner */ +#if HAVE_LCHOWN +PHP_FUNCTION(lchown) +{ +# if !defined(WINDOWS) + RETVAL_TRUE; + php_do_chown(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +# else + RETURN_FALSE; +# endif +} +#endif +/* }}} */ +#endif /* !NETWARE */ + +/* {{{ proto bool chmod(string filename, int mode) + Change file mode */ +PHP_FUNCTION(chmod) +{ + char *filename; + int filename_len; + long mode; + int ret; + mode_t imode; + php_stream_wrapper *wrapper; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl", &filename, &filename_len, &mode) == FAILURE) { + return; + } + + wrapper = php_stream_locate_url_wrapper(filename, NULL, 0 TSRMLS_CC); + if(wrapper != &php_plain_files_wrapper || strncasecmp("file://", filename, 7) == 0) { + if(wrapper && wrapper->wops->stream_metadata) { + if(wrapper->wops->stream_metadata(wrapper, filename, PHP_STREAM_META_ACCESS, &mode, NULL TSRMLS_CC)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not call chmod() for a non-standard stream"); + RETURN_FALSE; + } + } + + /* Check the basedir */ + if (php_check_open_basedir(filename TSRMLS_CC)) { + RETURN_FALSE; + } + + imode = (mode_t) mode; + + ret = VCWD_CHMOD(filename, imode); + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + RETURN_FALSE; + } + RETURN_TRUE; +} +/* }}} */ + +#if HAVE_UTIME +/* {{{ proto bool touch(string filename [, int time [, int atime]]) + Set modification time of file */ +PHP_FUNCTION(touch) +{ + char *filename; + int filename_len; + long filetime = 0, fileatime = 0; + int ret, argc = ZEND_NUM_ARGS(); + FILE *file; + struct utimbuf newtimebuf; + struct utimbuf *newtime = &newtimebuf; + php_stream_wrapper *wrapper; + + if (zend_parse_parameters(argc TSRMLS_CC, "p|ll", &filename, &filename_len, &filetime, &fileatime) == FAILURE) { + return; + } + + if (!filename_len) { + RETURN_FALSE; + } + + switch (argc) { + case 1: +#ifdef HAVE_UTIME_NULL + newtime = NULL; +#else + newtime->modtime = newtime->actime = time(NULL); +#endif + break; + case 2: + newtime->modtime = newtime->actime = filetime; + break; + case 3: + newtime->modtime = filetime; + newtime->actime = fileatime; + break; + default: + /* Never reached */ + WRONG_PARAM_COUNT; + } + + wrapper = php_stream_locate_url_wrapper(filename, NULL, 0 TSRMLS_CC); + if(wrapper != &php_plain_files_wrapper || strncasecmp("file://", filename, 7) == 0) { + if(wrapper && wrapper->wops->stream_metadata) { + if(wrapper->wops->stream_metadata(wrapper, filename, PHP_STREAM_META_TOUCH, newtime, NULL TSRMLS_CC)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } + } else { + php_stream *stream; + if(argc > 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not call touch() for a non-standard stream"); + RETURN_FALSE; + } + stream = php_stream_open_wrapper_ex(filename, "c", REPORT_ERRORS, NULL, NULL); + if(stream != NULL) { + php_stream_pclose(stream); + RETURN_TRUE; + } else { + RETURN_FALSE; + } + } + } + + /* Check the basedir */ + if (php_check_open_basedir(filename TSRMLS_CC)) { + RETURN_FALSE; + } + + /* create the file if it doesn't exist already */ + if (VCWD_ACCESS(filename, F_OK) != 0) { + file = VCWD_FOPEN(filename, "w"); + if (file == NULL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create file %s because %s", filename, strerror(errno)); + RETURN_FALSE; + } + fclose(file); + } + + ret = VCWD_UTIME(filename, newtime); + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Utime failed: %s", strerror(errno)); + RETURN_FALSE; + } + RETURN_TRUE; +} +/* }}} */ +#endif + +/* {{{ php_clear_stat_cache() +*/ +PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, int filename_len TSRMLS_DC) +{ + /* always clear CurrentStatFile and CurrentLStatFile even if filename is not NULL + * as it may contains outdated data (e.g. "nlink" for a directory when deleting a file + * in this directory, as shown by lstat_stat_variation9.phpt) */ + if (BG(CurrentStatFile)) { + efree(BG(CurrentStatFile)); + BG(CurrentStatFile) = NULL; + } + if (BG(CurrentLStatFile)) { + efree(BG(CurrentLStatFile)); + BG(CurrentLStatFile) = NULL; + } + if (clear_realpath_cache) { + if (filename != NULL) { + realpath_cache_del(filename, filename_len TSRMLS_CC); + } else { + realpath_cache_clean(TSRMLS_C); + } + } +} +/* }}} */ + +/* {{{ proto void clearstatcache([bool clear_realpath_cache[, string filename]]) + Clear file stat cache */ +PHP_FUNCTION(clearstatcache) +{ + zend_bool clear_realpath_cache = 0; + char *filename = NULL; + int filename_len = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|bp", &clear_realpath_cache, &filename, &filename_len) == FAILURE) { + return; + } + + php_clear_stat_cache(clear_realpath_cache, filename, filename_len TSRMLS_CC); +} +/* }}} */ + +#define IS_LINK_OPERATION(__t) ((__t) == FS_TYPE || (__t) == FS_IS_LINK || (__t) == FS_LSTAT) +#define IS_EXISTS_CHECK(__t) ((__t) == FS_EXISTS || (__t) == FS_IS_W || (__t) == FS_IS_R || (__t) == FS_IS_X || (__t) == FS_IS_FILE || (__t) == FS_IS_DIR || (__t) == FS_IS_LINK) +#define IS_ABLE_CHECK(__t) ((__t) == FS_IS_R || (__t) == FS_IS_W || (__t) == FS_IS_X) +#define IS_ACCESS_CHECK(__t) (IS_ABLE_CHECK(type) || (__t) == FS_EXISTS) + +/* {{{ php_stat + */ +PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int type, zval *return_value TSRMLS_DC) +{ + 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; + struct stat *stat_sb; + php_stream_statbuf ssb; + int flags = 0, rmask=S_IROTH, wmask=S_IWOTH, xmask=S_IXOTH; /* access rights defaults to other */ + char *stat_sb_names[13] = { + "dev", "ino", "mode", "nlink", "uid", "gid", "rdev", + "size", "atime", "mtime", "ctime", "blksize", "blocks" + }; + char *local; + php_stream_wrapper *wrapper; + + if (!filename_length) { + RETURN_FALSE; + } + + if ((wrapper = php_stream_locate_url_wrapper(filename, &local, 0 TSRMLS_CC)) == &php_plain_files_wrapper && php_check_open_basedir(local TSRMLS_CC)) { + RETURN_FALSE; + } + + if (IS_ACCESS_CHECK(type)) { + if (wrapper == &php_plain_files_wrapper) { + + switch (type) { +#ifdef F_OK + case FS_EXISTS: + RETURN_BOOL(VCWD_ACCESS(local, F_OK) == 0); + break; +#endif +#ifdef W_OK + case FS_IS_W: + RETURN_BOOL(VCWD_ACCESS(local, W_OK) == 0); + break; +#endif +#ifdef R_OK + case FS_IS_R: + RETURN_BOOL(VCWD_ACCESS(local, R_OK) == 0); + break; +#endif +#ifdef X_OK + case FS_IS_X: + RETURN_BOOL(VCWD_ACCESS(local, X_OK) == 0); + break; +#endif + } + } + } + + if (IS_LINK_OPERATION(type)) { + flags |= PHP_STREAM_URL_STAT_LINK; + } + if (IS_EXISTS_CHECK(type)) { + flags |= PHP_STREAM_URL_STAT_QUIET; + } + + if (php_stream_stat_path_ex((char *)filename, flags, &ssb, NULL)) { + /* Error Occured */ + if (!IS_EXISTS_CHECK(type)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%sstat failed for %s", IS_LINK_OPERATION(type) ? "L" : "", filename); + } + RETURN_FALSE; + } + + stat_sb = &ssb.sb; + + +#ifndef NETWARE + if (type >= FS_IS_W && type <= FS_IS_X) { + if(ssb.sb.st_uid==getuid()) { + rmask=S_IRUSR; + wmask=S_IWUSR; + xmask=S_IXUSR; + } else if(ssb.sb.st_gid==getgid()) { + rmask=S_IRGRP; + wmask=S_IWGRP; + xmask=S_IXGRP; + } else { + int groups, n, i; + gid_t *gids; + + groups = getgroups(0, NULL); + if(groups > 0) { + gids=(gid_t *)safe_emalloc(groups, sizeof(gid_t), 0); + n=getgroups(groups, gids); + for(i=0;ist_dev); + MAKE_LONG_ZVAL_INCREF(stat_ino, stat_sb->st_ino); + MAKE_LONG_ZVAL_INCREF(stat_mode, stat_sb->st_mode); + MAKE_LONG_ZVAL_INCREF(stat_nlink, stat_sb->st_nlink); + MAKE_LONG_ZVAL_INCREF(stat_uid, stat_sb->st_uid); + MAKE_LONG_ZVAL_INCREF(stat_gid, stat_sb->st_gid); +#ifdef HAVE_ST_RDEV + MAKE_LONG_ZVAL_INCREF(stat_rdev, stat_sb->st_rdev); +#else + MAKE_LONG_ZVAL_INCREF(stat_rdev, -1); +#endif + MAKE_LONG_ZVAL_INCREF(stat_size, stat_sb->st_size); + MAKE_LONG_ZVAL_INCREF(stat_atime, stat_sb->st_atime); + MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_sb->st_mtime); + MAKE_LONG_ZVAL_INCREF(stat_ctime, stat_sb->st_ctime); +#ifdef HAVE_ST_BLKSIZE + MAKE_LONG_ZVAL_INCREF(stat_blksize, stat_sb->st_blksize); +#else + MAKE_LONG_ZVAL_INCREF(stat_blksize,-1); +#endif +#ifdef HAVE_ST_BLOCKS + MAKE_LONG_ZVAL_INCREF(stat_blocks, stat_sb->st_blocks); +#else + MAKE_LONG_ZVAL_INCREF(stat_blocks,-1); +#endif + /* Store numeric indexes in propper order */ + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_dev, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_ino, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_mode, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_nlink, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_uid, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_gid, sizeof(zval *), NULL); + + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_rdev, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_size, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_atime, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_mtime, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_ctime, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_blksize, sizeof(zval *), NULL); + zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_blocks, sizeof(zval *), NULL); + + /* Store string indexes referencing the same zval*/ + zend_hash_update(HASH_OF(return_value), stat_sb_names[0], strlen(stat_sb_names[0])+1, (void *) &stat_dev, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[1], strlen(stat_sb_names[1])+1, (void *) &stat_ino, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[2], strlen(stat_sb_names[2])+1, (void *) &stat_mode, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[3], strlen(stat_sb_names[3])+1, (void *) &stat_nlink, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[4], strlen(stat_sb_names[4])+1, (void *) &stat_uid, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[5], strlen(stat_sb_names[5])+1, (void *) &stat_gid, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[6], strlen(stat_sb_names[6])+1, (void *) &stat_rdev, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[7], strlen(stat_sb_names[7])+1, (void *) &stat_size, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[8], strlen(stat_sb_names[8])+1, (void *) &stat_atime, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[9], strlen(stat_sb_names[9])+1, (void *) &stat_mtime, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[10], strlen(stat_sb_names[10])+1, (void *) &stat_ctime, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[11], strlen(stat_sb_names[11])+1, (void *) &stat_blksize, sizeof(zval *), NULL); + zend_hash_update(HASH_OF(return_value), stat_sb_names[12], strlen(stat_sb_names[12])+1, (void *) &stat_blocks, sizeof(zval *), NULL); + + return; + } + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Didn't understand stat call"); + RETURN_FALSE; +} +/* }}} */ + +/* another quickie macro to make defining similar functions easier */ +/* {{{ FileFunction(name, funcnum) */ +#define FileFunction(name, funcnum) \ +void name(INTERNAL_FUNCTION_PARAMETERS) { \ + char *filename; \ + int filename_len; \ + \ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { \ + return; \ + } \ + \ + php_stat(filename, (php_stat_len) filename_len, funcnum, return_value TSRMLS_CC); \ +} +/* }}} */ + +/* {{{ proto int fileperms(string filename) + Get file permissions */ +FileFunction(PHP_FN(fileperms), FS_PERMS) +/* }}} */ + +/* {{{ proto int fileinode(string filename) + Get file inode */ +FileFunction(PHP_FN(fileinode), FS_INODE) +/* }}} */ + +/* {{{ proto int filesize(string filename) + Get file size */ +FileFunction(PHP_FN(filesize), FS_SIZE) +/* }}} */ + +/* {{{ proto int fileowner(string filename) + Get file owner */ +FileFunction(PHP_FN(fileowner), FS_OWNER) +/* }}} */ + +/* {{{ proto int filegroup(string filename) + Get file group */ +FileFunction(PHP_FN(filegroup), FS_GROUP) +/* }}} */ + +/* {{{ proto int fileatime(string filename) + Get last access time of file */ +FileFunction(PHP_FN(fileatime), FS_ATIME) +/* }}} */ + +/* {{{ proto int filemtime(string filename) + Get last modification time of file */ +FileFunction(PHP_FN(filemtime), FS_MTIME) +/* }}} */ + +/* {{{ proto int filectime(string filename) + Get inode modification time of file */ +FileFunction(PHP_FN(filectime), FS_CTIME) +/* }}} */ + +/* {{{ proto string filetype(string filename) + Get file type */ +FileFunction(PHP_FN(filetype), FS_TYPE) +/* }}} */ + +/* {{{ proto bool is_writable(string filename) + Returns true if file can be written */ +FileFunction(PHP_FN(is_writable), FS_IS_W) +/* }}} */ + +/* {{{ proto bool is_readable(string filename) + Returns true if file can be read */ +FileFunction(PHP_FN(is_readable), FS_IS_R) +/* }}} */ + +/* {{{ proto bool is_executable(string filename) + Returns true if file is executable */ +FileFunction(PHP_FN(is_executable), FS_IS_X) +/* }}} */ + +/* {{{ proto bool is_file(string filename) + Returns true if file is a regular file */ +FileFunction(PHP_FN(is_file), FS_IS_FILE) +/* }}} */ + +/* {{{ proto bool is_dir(string filename) + Returns true if file is directory */ +FileFunction(PHP_FN(is_dir), FS_IS_DIR) +/* }}} */ + +/* {{{ proto bool is_link(string filename) + Returns true if file is symbolic link */ +FileFunction(PHP_FN(is_link), FS_IS_LINK) +/* }}} */ + +/* {{{ proto bool file_exists(string filename) + Returns true if filename exists */ +FileFunction(PHP_FN(file_exists), FS_EXISTS) +/* }}} */ + +/* {{{ proto array lstat(string filename) + Give information about a file or symbolic link */ +FileFunction(php_if_lstat, FS_LSTAT) +/* }}} */ + +/* {{{ proto array stat(string filename) + Give information about a file */ +FileFunction(php_if_stat, FS_STAT) +/* }}} */ + +/* {{{ proto bool realpath_cache_size() + Get current size of realpath cache */ +PHP_FUNCTION(realpath_cache_size) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_LONG(realpath_cache_size(TSRMLS_C)); +} + +/* {{{ proto bool realpath_cache_get() + Get current size of realpath cache */ +PHP_FUNCTION(realpath_cache_get) +{ + realpath_cache_bucket **buckets = realpath_cache_get_buckets(TSRMLS_C), **end = buckets + realpath_cache_max_buckets(TSRMLS_C); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + array_init(return_value); + while(buckets < end) { + realpath_cache_bucket *bucket = *buckets; + while(bucket) { + zval *entry; + MAKE_STD_ZVAL(entry); + array_init(entry); + + /* bucket->key is unsigned long */ + if (LONG_MAX >= bucket->key) { + add_assoc_long(entry, "key", bucket->key); + } else { + add_assoc_double(entry, "key", (double)bucket->key); + } + add_assoc_bool(entry, "is_dir", bucket->is_dir); + add_assoc_stringl(entry, "realpath", bucket->realpath, bucket->realpath_len, 1); + add_assoc_long(entry, "expires", bucket->expires); +#ifdef PHP_WIN32 + add_assoc_bool(entry, "is_rvalid", bucket->is_rvalid); + add_assoc_bool(entry, "is_wvalid", bucket->is_wvalid); + add_assoc_bool(entry, "is_readable", bucket->is_readable); + add_assoc_bool(entry, "is_writable", bucket->is_writable); +#endif + zend_hash_update(Z_ARRVAL_P(return_value), bucket->path, bucket->path_len+1, &entry, sizeof(zval *), NULL); + bucket = bucket->next; + } + buckets++; + } +} + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/filters.c b/ext/standard/filters.c new file mode 100644 index 0000000..084860c --- /dev/null +++ b/ext/standard/filters.c @@ -0,0 +1,2152 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: | + | Wez Furlong (wez@thebrainroom.com) | + | Sara Golemon (pollita@php.net) | + | Moriyoshi Koizumi (moriyoshi@php.net) | + | Marcus Boerger (helly@php.net) | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "php_globals.h" +#include "ext/standard/basic_functions.h" +#include "ext/standard/file.h" +#include "ext/standard/php_string.h" +#include "ext/standard/php_smart_str.h" + +/* {{{ rot13 stream filter implementation */ +static char rot13_from[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; +static char rot13_to[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM"; + +static php_stream_filter_status_t strfilter_rot13_filter( + php_stream *stream, + php_stream_filter *thisfilter, + php_stream_bucket_brigade *buckets_in, + php_stream_bucket_brigade *buckets_out, + size_t *bytes_consumed, + int flags + TSRMLS_DC) +{ + php_stream_bucket *bucket; + size_t consumed = 0; + + while (buckets_in->head) { + bucket = php_stream_bucket_make_writeable(buckets_in->head TSRMLS_CC); + + php_strtr(bucket->buf, bucket->buflen, rot13_from, rot13_to, 52); + consumed += bucket->buflen; + + php_stream_bucket_append(buckets_out, bucket TSRMLS_CC); + } + + if (bytes_consumed) { + *bytes_consumed = consumed; + } + + return PSFS_PASS_ON; +} + +static php_stream_filter_ops strfilter_rot13_ops = { + strfilter_rot13_filter, + NULL, + "string.rot13" +}; + +static php_stream_filter *strfilter_rot13_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC) +{ + return php_stream_filter_alloc(&strfilter_rot13_ops, NULL, persistent); +} + +static php_stream_filter_factory strfilter_rot13_factory = { + strfilter_rot13_create +}; +/* }}} */ + +/* {{{ string.toupper / string.tolower stream filter implementation */ +static char lowercase[] = "abcdefghijklmnopqrstuvwxyz"; +static char uppercase[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + +static php_stream_filter_status_t strfilter_toupper_filter( + php_stream *stream, + php_stream_filter *thisfilter, + php_stream_bucket_brigade *buckets_in, + php_stream_bucket_brigade *buckets_out, + size_t *bytes_consumed, + int flags + TSRMLS_DC) +{ + php_stream_bucket *bucket; + size_t consumed = 0; + + while (buckets_in->head) { + bucket = php_stream_bucket_make_writeable(buckets_in->head TSRMLS_CC); + + php_strtr(bucket->buf, bucket->buflen, lowercase, uppercase, 26); + consumed += bucket->buflen; + + php_stream_bucket_append(buckets_out, bucket TSRMLS_CC); + } + + if (bytes_consumed) { + *bytes_consumed = consumed; + } + + return PSFS_PASS_ON; +} + +static php_stream_filter_status_t strfilter_tolower_filter( + php_stream *stream, + php_stream_filter *thisfilter, + php_stream_bucket_brigade *buckets_in, + php_stream_bucket_brigade *buckets_out, + size_t *bytes_consumed, + int flags + TSRMLS_DC) +{ + php_stream_bucket *bucket; + size_t consumed = 0; + + while (buckets_in->head) { + bucket = php_stream_bucket_make_writeable(buckets_in->head TSRMLS_CC); + + php_strtr(bucket->buf, bucket->buflen, uppercase, lowercase, 26); + consumed += bucket->buflen; + + php_stream_bucket_append(buckets_out, bucket TSRMLS_CC); + } + + if (bytes_consumed) { + *bytes_consumed = consumed; + } + + return PSFS_PASS_ON; +} + +static php_stream_filter_ops strfilter_toupper_ops = { + strfilter_toupper_filter, + NULL, + "string.toupper" +}; + +static php_stream_filter_ops strfilter_tolower_ops = { + strfilter_tolower_filter, + NULL, + "string.tolower" +}; + +static php_stream_filter *strfilter_toupper_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC) +{ + return php_stream_filter_alloc(&strfilter_toupper_ops, NULL, persistent); +} + +static php_stream_filter *strfilter_tolower_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC) +{ + return php_stream_filter_alloc(&strfilter_tolower_ops, NULL, persistent); +} + +static php_stream_filter_factory strfilter_toupper_factory = { + strfilter_toupper_create +}; + +static php_stream_filter_factory strfilter_tolower_factory = { + strfilter_tolower_create +}; +/* }}} */ + +/* {{{ strip_tags filter implementation */ +typedef struct _php_strip_tags_filter { + const char *allowed_tags; + int allowed_tags_len; + int state; + int persistent; +} php_strip_tags_filter; + +static int php_strip_tags_filter_ctor(php_strip_tags_filter *inst, const char *allowed_tags, int allowed_tags_len, int persistent) +{ + if (allowed_tags != NULL) { + if (NULL == (inst->allowed_tags = pemalloc(allowed_tags_len, persistent))) { + return FAILURE; + } + memcpy((char *)inst->allowed_tags, allowed_tags, allowed_tags_len); + inst->allowed_tags_len = allowed_tags_len; + } else { + inst->allowed_tags = NULL; + } + inst->state = 0; + inst->persistent = persistent; + + return SUCCESS; +} + +static void php_strip_tags_filter_dtor(php_strip_tags_filter *inst) +{ + if (inst->allowed_tags != NULL) { + pefree((void *)inst->allowed_tags, inst->persistent); + } +} + +static php_stream_filter_status_t strfilter_strip_tags_filter( + php_stream *stream, + php_stream_filter *thisfilter, + php_stream_bucket_brigade *buckets_in, + php_stream_bucket_brigade *buckets_out, + size_t *bytes_consumed, + int flags + TSRMLS_DC) +{ + php_stream_bucket *bucket; + size_t consumed = 0; + php_strip_tags_filter *inst = (php_strip_tags_filter *) thisfilter->abstract; + + while (buckets_in->head) { + bucket = php_stream_bucket_make_writeable(buckets_in->head TSRMLS_CC); + consumed = bucket->buflen; + + bucket->buflen = php_strip_tags(bucket->buf, bucket->buflen, &(inst->state), (char *)inst->allowed_tags, inst->allowed_tags_len); + + php_stream_bucket_append(buckets_out, bucket TSRMLS_CC); + } + + if (bytes_consumed) { + *bytes_consumed = consumed; + } + + return PSFS_PASS_ON; +} + +static void strfilter_strip_tags_dtor(php_stream_filter *thisfilter TSRMLS_DC) +{ + assert(thisfilter->abstract != NULL); + + php_strip_tags_filter_dtor((php_strip_tags_filter *)thisfilter->abstract); + + pefree(thisfilter->abstract, ((php_strip_tags_filter *)thisfilter->abstract)->persistent); +} + +static php_stream_filter_ops strfilter_strip_tags_ops = { + strfilter_strip_tags_filter, + strfilter_strip_tags_dtor, + "string.strip_tags" +}; + +static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC) +{ + php_strip_tags_filter *inst; + smart_str tags_ss = { 0, 0, 0 }; + + inst = pemalloc(sizeof(php_strip_tags_filter), persistent); + + if (inst == NULL) { /* it's possible pemalloc returns NULL + instead of causing it to bail out */ + return NULL; + } + + if (filterparams != NULL) { + if (Z_TYPE_P(filterparams) == IS_ARRAY) { + HashPosition pos; + zval **tmp; + + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(filterparams), &pos); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(filterparams), (void **) &tmp, &pos) == SUCCESS) { + convert_to_string_ex(tmp); + smart_str_appendc(&tags_ss, '<'); + smart_str_appendl(&tags_ss, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); + smart_str_appendc(&tags_ss, '>'); + zend_hash_move_forward_ex(Z_ARRVAL_P(filterparams), &pos); + } + smart_str_0(&tags_ss); + } else { + /* FIXME: convert_to_* may clutter zvals and lead it into segfault ? */ + convert_to_string_ex(&filterparams); + + tags_ss.c = Z_STRVAL_P(filterparams); + tags_ss.len = Z_STRLEN_P(filterparams); + tags_ss.a = 0; + } + } + + if (php_strip_tags_filter_ctor(inst, tags_ss.c, tags_ss.len, persistent) != SUCCESS) { + if (tags_ss.a != 0) { + STR_FREE(tags_ss.c); + } + pefree(inst, persistent); + return NULL; + } + + if (tags_ss.a != 0) { + STR_FREE(tags_ss.c); + } + + return php_stream_filter_alloc(&strfilter_strip_tags_ops, inst, persistent); +} + +static php_stream_filter_factory strfilter_strip_tags_factory = { + strfilter_strip_tags_create +}; + +/* }}} */ + +/* {{{ base64 / quoted_printable stream filter implementation */ + +typedef enum _php_conv_err_t { + PHP_CONV_ERR_SUCCESS = SUCCESS, + PHP_CONV_ERR_UNKNOWN, + PHP_CONV_ERR_TOO_BIG, + PHP_CONV_ERR_INVALID_SEQ, + PHP_CONV_ERR_UNEXPECTED_EOS, + PHP_CONV_ERR_EXISTS, + PHP_CONV_ERR_MORE, + PHP_CONV_ERR_ALLOC, + PHP_CONV_ERR_NOT_FOUND +} php_conv_err_t; + +typedef struct _php_conv php_conv; + +typedef php_conv_err_t (*php_conv_convert_func)(php_conv *, const char **, size_t *, char **, size_t *); +typedef void (*php_conv_dtor_func)(php_conv *); + +struct _php_conv { + php_conv_convert_func convert_op; + php_conv_dtor_func dtor; +}; + +#define php_conv_convert(a, b, c, d, e) ((php_conv *)(a))->convert_op((php_conv *)(a), (b), (c), (d), (e)) +#define php_conv_dtor(a) ((php_conv *)a)->dtor((a)) + +/* {{{ php_conv_base64_encode */ +typedef struct _php_conv_base64_encode { + php_conv _super; + + unsigned char erem[3]; + size_t erem_len; + unsigned int line_ccnt; + unsigned int line_len; + const char *lbchars; + int lbchars_dup; + size_t lbchars_len; + int persistent; +} php_conv_base64_encode; + +static php_conv_err_t php_conv_base64_encode_convert(php_conv_base64_encode *inst, const char **in_p, size_t *in_left, char **out_p, size_t *out_left); +static void php_conv_base64_encode_dtor(php_conv_base64_encode *inst); + +static unsigned char b64_tbl_enc[256] = { + 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', + 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', + 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', + 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/', + 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', + 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', + 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', + 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/', + 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', + 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', + 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', + 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/', + 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', + 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', + 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', + 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' +}; + +static php_conv_err_t php_conv_base64_encode_ctor(php_conv_base64_encode *inst, unsigned int line_len, const char *lbchars, size_t lbchars_len, int lbchars_dup, int persistent) +{ + inst->_super.convert_op = (php_conv_convert_func) php_conv_base64_encode_convert; + inst->_super.dtor = (php_conv_dtor_func) php_conv_base64_encode_dtor; + inst->erem_len = 0; + inst->line_ccnt = line_len; + inst->line_len = line_len; + if (lbchars != NULL) { + inst->lbchars = (lbchars_dup ? pestrdup(lbchars, persistent) : lbchars); + inst->lbchars_len = lbchars_len; + } else { + inst->lbchars = NULL; + } + inst->lbchars_dup = lbchars_dup; + inst->persistent = persistent; + return PHP_CONV_ERR_SUCCESS; +} + +static void php_conv_base64_encode_dtor(php_conv_base64_encode *inst) +{ + assert(inst != NULL); + if (inst->lbchars_dup && inst->lbchars != NULL) { + pefree((void *)inst->lbchars, inst->persistent); + } +} + +static php_conv_err_t php_conv_base64_encode_flush(php_conv_base64_encode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p) +{ + volatile php_conv_err_t err = PHP_CONV_ERR_SUCCESS; + register unsigned char *pd; + register size_t ocnt; + unsigned int line_ccnt; + + pd = (unsigned char *)(*out_pp); + ocnt = *out_left_p; + line_ccnt = inst->line_ccnt; + + switch (inst->erem_len) { + case 0: + /* do nothing */ + break; + + case 1: + if (line_ccnt < 4 && inst->lbchars != NULL) { + if (ocnt < inst->lbchars_len) { + return PHP_CONV_ERR_TOO_BIG; + } + memcpy(pd, inst->lbchars, inst->lbchars_len); + pd += inst->lbchars_len; + ocnt -= inst->lbchars_len; + line_ccnt = inst->line_len; + } + if (ocnt < 4) { + err = PHP_CONV_ERR_TOO_BIG; + goto out; + } + *(pd++) = b64_tbl_enc[(inst->erem[0] >> 2)]; + *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[0] << 4)]; + *(pd++) = '='; + *(pd++) = '='; + inst->erem_len = 0; + ocnt -= 4; + line_ccnt -= 4; + break; + + case 2: + if (line_ccnt < 4 && inst->lbchars != NULL) { + if (ocnt < inst->lbchars_len) { + return PHP_CONV_ERR_TOO_BIG; + } + memcpy(pd, inst->lbchars, inst->lbchars_len); + pd += inst->lbchars_len; + ocnt -= inst->lbchars_len; + line_ccnt = inst->line_len; + } + if (ocnt < 4) { + err = PHP_CONV_ERR_TOO_BIG; + goto out; + } + *(pd++) = b64_tbl_enc[(inst->erem[0] >> 2)]; + *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[0] << 4) | (inst->erem[1] >> 4)]; + *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[1] << 2)]; + *(pd++) = '='; + inst->erem_len = 0; + ocnt -=4; + line_ccnt -= 4; + break; + + default: + /* should not happen... */ + err = PHP_CONV_ERR_UNKNOWN; + break; + } +out: + *out_pp = (char *)pd; + *out_left_p = ocnt; + inst->line_ccnt = line_ccnt; + return err; +} + +static php_conv_err_t php_conv_base64_encode_convert(php_conv_base64_encode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p) +{ + volatile php_conv_err_t err = PHP_CONV_ERR_SUCCESS; + register size_t ocnt, icnt; + register unsigned char *ps, *pd; + register unsigned int line_ccnt; + + if (in_pp == NULL || in_left_p == NULL) { + return php_conv_base64_encode_flush(inst, in_pp, in_left_p, out_pp, out_left_p); + } + + pd = (unsigned char *)(*out_pp); + ocnt = *out_left_p; + ps = (unsigned char *)(*in_pp); + icnt = *in_left_p; + line_ccnt = inst->line_ccnt; + + /* consume the remainder first */ + switch (inst->erem_len) { + case 1: + if (icnt >= 2) { + if (line_ccnt < 4 && inst->lbchars != NULL) { + if (ocnt < inst->lbchars_len) { + return PHP_CONV_ERR_TOO_BIG; + } + memcpy(pd, inst->lbchars, inst->lbchars_len); + pd += inst->lbchars_len; + ocnt -= inst->lbchars_len; + line_ccnt = inst->line_len; + } + if (ocnt < 4) { + err = PHP_CONV_ERR_TOO_BIG; + goto out; + } + *(pd++) = b64_tbl_enc[(inst->erem[0] >> 2)]; + *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[0] << 4) | (ps[0] >> 4)]; + *(pd++) = b64_tbl_enc[(unsigned char)(ps[0] << 2) | (ps[1] >> 6)]; + *(pd++) = b64_tbl_enc[ps[1]]; + ocnt -= 4; + ps += 2; + icnt -= 2; + inst->erem_len = 0; + line_ccnt -= 4; + } + break; + + case 2: + if (icnt >= 1) { + if (inst->line_ccnt < 4 && inst->lbchars != NULL) { + if (ocnt < inst->lbchars_len) { + return PHP_CONV_ERR_TOO_BIG; + } + memcpy(pd, inst->lbchars, inst->lbchars_len); + pd += inst->lbchars_len; + ocnt -= inst->lbchars_len; + line_ccnt = inst->line_len; + } + if (ocnt < 4) { + err = PHP_CONV_ERR_TOO_BIG; + goto out; + } + *(pd++) = b64_tbl_enc[(inst->erem[0] >> 2)]; + *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[0] << 4) | (inst->erem[1] >> 4)]; + *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[1] << 2) | (ps[0] >> 6)]; + *(pd++) = b64_tbl_enc[ps[0]]; + ocnt -= 4; + ps += 1; + icnt -= 1; + inst->erem_len = 0; + line_ccnt -= 4; + } + break; + } + + while (icnt >= 3) { + if (line_ccnt < 4 && inst->lbchars != NULL) { + if (ocnt < inst->lbchars_len) { + err = PHP_CONV_ERR_TOO_BIG; + goto out; + } + memcpy(pd, inst->lbchars, inst->lbchars_len); + pd += inst->lbchars_len; + ocnt -= inst->lbchars_len; + line_ccnt = inst->line_len; + } + if (ocnt < 4) { + err = PHP_CONV_ERR_TOO_BIG; + goto out; + } + *(pd++) = b64_tbl_enc[ps[0] >> 2]; + *(pd++) = b64_tbl_enc[(unsigned char)(ps[0] << 4) | (ps[1] >> 4)]; + *(pd++) = b64_tbl_enc[(unsigned char)(ps[1] << 2) | (ps[2] >> 6)]; + *(pd++) = b64_tbl_enc[ps[2]]; + + ps += 3; + icnt -=3; + ocnt -= 4; + line_ccnt -= 4; + } + for (;icnt > 0; icnt--) { + inst->erem[inst->erem_len++] = *(ps++); + } + +out: + *in_pp = (const char *)ps; + *in_left_p = icnt; + *out_pp = (char *)pd; + *out_left_p = ocnt; + inst->line_ccnt = line_ccnt; + + return err; +} + +/* }}} */ + +/* {{{ php_conv_base64_decode */ +typedef struct _php_conv_base64_decode { + php_conv _super; + + unsigned int urem; + unsigned int urem_nbits; + unsigned int ustat; + int eos; +} php_conv_base64_decode; + +static php_conv_err_t php_conv_base64_decode_convert(php_conv_base64_decode *inst, const char **in_p, size_t *in_left, char **out_p, size_t *out_left); +static void php_conv_base64_decode_dtor(php_conv_base64_decode *inst); + +static unsigned int b64_tbl_dec[256] = { + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64,128, 64, 64, + 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64, + 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 +}; + +static int php_conv_base64_decode_ctor(php_conv_base64_decode *inst) +{ + inst->_super.convert_op = (php_conv_convert_func) php_conv_base64_decode_convert; + inst->_super.dtor = (php_conv_dtor_func) php_conv_base64_decode_dtor; + + inst->urem = 0; + inst->urem_nbits = 0; + inst->ustat = 0; + inst->eos = 0; + return SUCCESS; +} + +static void php_conv_base64_decode_dtor(php_conv_base64_decode *inst) +{ + /* do nothing */ +} + +#define bmask(a) (0xffff >> (16 - a)) +static php_conv_err_t php_conv_base64_decode_convert(php_conv_base64_decode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p) +{ + php_conv_err_t err; + + unsigned int urem, urem_nbits; + unsigned int pack, pack_bcnt; + unsigned char *ps, *pd; + size_t icnt, ocnt; + unsigned int ustat; + + static const unsigned int nbitsof_pack = 8; + + if (in_pp == NULL || in_left_p == NULL) { + if (inst->eos || inst->urem_nbits == 0) { + return PHP_CONV_ERR_SUCCESS; + } + return PHP_CONV_ERR_UNEXPECTED_EOS; + } + + err = PHP_CONV_ERR_SUCCESS; + + ps = (unsigned char *)*in_pp; + pd = (unsigned char *)*out_pp; + icnt = *in_left_p; + ocnt = *out_left_p; + + urem = inst->urem; + urem_nbits = inst->urem_nbits; + ustat = inst->ustat; + + pack = 0; + pack_bcnt = nbitsof_pack; + + for (;;) { + if (pack_bcnt >= urem_nbits) { + pack_bcnt -= urem_nbits; + pack |= (urem << pack_bcnt); + urem_nbits = 0; + } else { + urem_nbits -= pack_bcnt; + pack |= (urem >> urem_nbits); + urem &= bmask(urem_nbits); + pack_bcnt = 0; + } + if (pack_bcnt > 0) { + unsigned int i; + + if (icnt < 1) { + break; + } + + i = b64_tbl_dec[(unsigned int)*(ps++)]; + icnt--; + ustat |= i & 0x80; + + if (!(i & 0xc0)) { + if (ustat) { + err = PHP_CONV_ERR_INVALID_SEQ; + break; + } + if (6 <= pack_bcnt) { + pack_bcnt -= 6; + pack |= (i << pack_bcnt); + urem = 0; + } else { + urem_nbits = 6 - pack_bcnt; + pack |= (i >> urem_nbits); + urem = i & bmask(urem_nbits); + pack_bcnt = 0; + } + } else if (ustat) { + if (pack_bcnt == 8 || pack_bcnt == 2) { + err = PHP_CONV_ERR_INVALID_SEQ; + break; + } + inst->eos = 1; + } + } + if ((pack_bcnt | ustat) == 0) { + if (ocnt < 1) { + err = PHP_CONV_ERR_TOO_BIG; + break; + } + *(pd++) = pack; + ocnt--; + pack = 0; + pack_bcnt = nbitsof_pack; + } + } + + if (urem_nbits >= pack_bcnt) { + urem |= (pack << (urem_nbits - pack_bcnt)); + urem_nbits += (nbitsof_pack - pack_bcnt); + } else { + urem |= (pack >> (pack_bcnt - urem_nbits)); + urem_nbits += (nbitsof_pack - pack_bcnt); + } + + inst->urem = urem; + inst->urem_nbits = urem_nbits; + inst->ustat = ustat; + + *in_pp = (const char *)ps; + *in_left_p = icnt; + *out_pp = (char *)pd; + *out_left_p = ocnt; + + return err; +} +#undef bmask +/* }}} */ + +/* {{{ php_conv_qprint_encode */ +typedef struct _php_conv_qprint_encode { + php_conv _super; + + int opts; + unsigned int line_ccnt; + unsigned int line_len; + const char *lbchars; + int lbchars_dup; + size_t lbchars_len; + int persistent; + unsigned int lb_ptr; + unsigned int lb_cnt; +} php_conv_qprint_encode; + +#define PHP_CONV_QPRINT_OPT_BINARY 0x00000001 +#define PHP_CONV_QPRINT_OPT_FORCE_ENCODE_FIRST 0x00000002 + +static void php_conv_qprint_encode_dtor(php_conv_qprint_encode *inst); +static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p); + +static void php_conv_qprint_encode_dtor(php_conv_qprint_encode *inst) +{ + assert(inst != NULL); + if (inst->lbchars_dup && inst->lbchars != NULL) { + pefree((void *)inst->lbchars, inst->persistent); + } +} + +#define NEXT_CHAR(ps, icnt, lb_ptr, lb_cnt, lbchars) \ + ((lb_ptr) < (lb_cnt) ? (lbchars)[(lb_ptr)] : *(ps)) + +#define CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt) \ + if ((lb_ptr) < (lb_cnt)) { \ + (lb_ptr)++; \ + } else { \ + (lb_cnt) = (lb_ptr) = 0; \ + --(icnt); \ + (ps)++; \ + } + +static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p) +{ + php_conv_err_t err = PHP_CONV_ERR_SUCCESS; + unsigned char *ps, *pd; + size_t icnt, ocnt; + unsigned int c; + unsigned int line_ccnt; + unsigned int lb_ptr; + unsigned int lb_cnt; + int opts; + static char qp_digits[] = "0123456789ABCDEF"; + + line_ccnt = inst->line_ccnt; + opts = inst->opts; + lb_ptr = inst->lb_ptr; + lb_cnt = inst->lb_cnt; + + if ((in_pp == NULL || in_left_p == NULL) && (lb_ptr >=lb_cnt)) { + return PHP_CONV_ERR_SUCCESS; + } + + ps = (unsigned char *)(*in_pp); + icnt = *in_left_p; + pd = (unsigned char *)(*out_pp); + ocnt = *out_left_p; + + for (;;) { + if (!(opts & PHP_CONV_QPRINT_OPT_BINARY) && inst->lbchars != NULL && inst->lbchars_len > 0) { + /* look ahead for the line break chars to make a right decision + * how to consume incoming characters */ + + if (icnt > 0 && *ps == inst->lbchars[lb_cnt]) { + lb_cnt++; + + if (lb_cnt >= inst->lbchars_len) { + unsigned int i; + + if (ocnt < lb_cnt) { + lb_cnt--; + err = PHP_CONV_ERR_TOO_BIG; + break; + } + + for (i = 0; i < lb_cnt; i++) { + *(pd++) = inst->lbchars[i]; + ocnt--; + } + line_ccnt = inst->line_len; + lb_ptr = lb_cnt = 0; + } + ps++, icnt--; + continue; + } + } + + if (lb_ptr >= lb_cnt && icnt <= 0) { + break; + } + + c = NEXT_CHAR(ps, icnt, lb_ptr, lb_cnt, inst->lbchars); + + if (!(opts & PHP_CONV_QPRINT_OPT_BINARY) && (c == '\t' || c == ' ')) { + if (line_ccnt < 2 && inst->lbchars != NULL) { + if (ocnt < inst->lbchars_len + 1) { + err = PHP_CONV_ERR_TOO_BIG; + break; + } + + *(pd++) = '='; + ocnt--; + line_ccnt--; + + memcpy(pd, inst->lbchars, inst->lbchars_len); + pd += inst->lbchars_len; + ocnt -= inst->lbchars_len; + line_ccnt = inst->line_len; + } else { + if (ocnt < 1) { + err = PHP_CONV_ERR_TOO_BIG; + break; + } + *(pd++) = c; + ocnt--; + line_ccnt--; + CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt); + } + } else if ((!(opts & PHP_CONV_QPRINT_OPT_FORCE_ENCODE_FIRST) || line_ccnt < inst->line_len) && ((c >= 33 && c <= 60) || (c >= 62 && c <= 126))) { + if (line_ccnt < 2 && inst->lbchars != NULL) { + if (ocnt < inst->lbchars_len + 1) { + err = PHP_CONV_ERR_TOO_BIG; + break; + } + *(pd++) = '='; + ocnt--; + line_ccnt--; + + memcpy(pd, inst->lbchars, inst->lbchars_len); + pd += inst->lbchars_len; + ocnt -= inst->lbchars_len; + line_ccnt = inst->line_len; + } + if (ocnt < 1) { + err = PHP_CONV_ERR_TOO_BIG; + break; + } + *(pd++) = c; + ocnt--; + line_ccnt--; + CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt); + } else { + if (line_ccnt < 4) { + if (ocnt < inst->lbchars_len + 1) { + err = PHP_CONV_ERR_TOO_BIG; + break; + } + *(pd++) = '='; + ocnt--; + line_ccnt--; + + memcpy(pd, inst->lbchars, inst->lbchars_len); + pd += inst->lbchars_len; + ocnt -= inst->lbchars_len; + line_ccnt = inst->line_len; + } + if (ocnt < 3) { + err = PHP_CONV_ERR_TOO_BIG; + break; + } + *(pd++) = '='; + *(pd++) = qp_digits[(c >> 4)]; + *(pd++) = qp_digits[(c & 0x0f)]; + ocnt -= 3; + line_ccnt -= 3; + CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt); + } + } + + *in_pp = (const char *)ps; + *in_left_p = icnt; + *out_pp = (char *)pd; + *out_left_p = ocnt; + inst->line_ccnt = line_ccnt; + inst->lb_ptr = lb_ptr; + inst->lb_cnt = lb_cnt; + return err; +} +#undef NEXT_CHAR +#undef CONSUME_CHAR + +static php_conv_err_t php_conv_qprint_encode_ctor(php_conv_qprint_encode *inst, unsigned int line_len, const char *lbchars, size_t lbchars_len, int lbchars_dup, int opts, int persistent) +{ + if (line_len < 4 && lbchars != NULL) { + return PHP_CONV_ERR_TOO_BIG; + } + inst->_super.convert_op = (php_conv_convert_func) php_conv_qprint_encode_convert; + inst->_super.dtor = (php_conv_dtor_func) php_conv_qprint_encode_dtor; + inst->line_ccnt = line_len; + inst->line_len = line_len; + if (lbchars != NULL) { + inst->lbchars = (lbchars_dup ? pestrdup(lbchars, persistent) : lbchars); + inst->lbchars_len = lbchars_len; + } else { + inst->lbchars = NULL; + } + inst->lbchars_dup = lbchars_dup; + inst->persistent = persistent; + inst->opts = opts; + inst->lb_cnt = inst->lb_ptr = 0; + return PHP_CONV_ERR_SUCCESS; +} +/* }}} */ + +/* {{{ php_conv_qprint_decode */ +typedef struct _php_conv_qprint_decode { + php_conv _super; + + int scan_stat; + unsigned int next_char; + const char *lbchars; + int lbchars_dup; + size_t lbchars_len; + int persistent; + unsigned int lb_ptr; + unsigned int lb_cnt; +} php_conv_qprint_decode; + +static void php_conv_qprint_decode_dtor(php_conv_qprint_decode *inst) +{ + assert(inst != NULL); + if (inst->lbchars_dup && inst->lbchars != NULL) { + pefree((void *)inst->lbchars, inst->persistent); + } +} + +static php_conv_err_t php_conv_qprint_decode_convert(php_conv_qprint_decode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p) +{ + php_conv_err_t err = PHP_CONV_ERR_SUCCESS; + size_t icnt, ocnt; + unsigned char *ps, *pd; + unsigned int scan_stat; + unsigned int next_char; + unsigned int lb_ptr, lb_cnt; + + lb_ptr = inst->lb_ptr; + lb_cnt = inst->lb_cnt; + + if ((in_pp == NULL || in_left_p == NULL) && lb_cnt == lb_ptr) { + if (inst->scan_stat != 0) { + return PHP_CONV_ERR_UNEXPECTED_EOS; + } + return PHP_CONV_ERR_SUCCESS; + } + + ps = (unsigned char *)(*in_pp); + icnt = *in_left_p; + pd = (unsigned char *)(*out_pp); + ocnt = *out_left_p; + scan_stat = inst->scan_stat; + next_char = inst->next_char; + + for (;;) { + switch (scan_stat) { + case 0: { + if (icnt <= 0) { + goto out; + } + if (*ps == '=') { + scan_stat = 1; + } else { + if (ocnt < 1) { + err = PHP_CONV_ERR_TOO_BIG; + goto out; + } + *(pd++) = *ps; + ocnt--; + } + ps++, icnt--; + } break; + + case 1: { + if (icnt <= 0) { + goto out; + } + if (*ps == ' ' || *ps == '\t') { + scan_stat = 4; + ps++, icnt--; + break; + } else if (!inst->lbchars && lb_cnt == 0 && *ps == '\r') { + /* auto-detect line endings, looks like network line ending \r\n (could be mac \r) */ + lb_cnt++; + scan_stat = 5; + ps++, icnt--; + break; + } else if (!inst->lbchars && lb_cnt == 0 && *ps == '\n') { + /* auto-detect line endings, looks like unix-lineendings, not to spec, but it is seem in the wild, a lot */ + lb_cnt = lb_ptr = 0; + scan_stat = 0; + ps++, icnt--; + break; + } else if (lb_cnt < inst->lbchars_len && + *ps == (unsigned char)inst->lbchars[lb_cnt]) { + lb_cnt++; + scan_stat = 5; + ps++, icnt--; + break; + } + } /* break is missing intentionally */ + + case 2: { + if (icnt <= 0) { + goto out; + } + + if (!isxdigit((int) *ps)) { + err = PHP_CONV_ERR_INVALID_SEQ; + goto out; + } + next_char = (next_char << 4) | (*ps >= 'A' ? *ps - 0x37 : *ps - 0x30); + scan_stat++; + ps++, icnt--; + if (scan_stat != 3) { + break; + } + } /* break is missing intentionally */ + + case 3: { + if (ocnt < 1) { + err = PHP_CONV_ERR_TOO_BIG; + goto out; + } + *(pd++) = next_char; + ocnt--; + scan_stat = 0; + } break; + + case 4: { + if (icnt <= 0) { + goto out; + } + if (lb_cnt < inst->lbchars_len && + *ps == (unsigned char)inst->lbchars[lb_cnt]) { + lb_cnt++; + scan_stat = 5; + } + if (*ps != '\t' && *ps != ' ') { + err = PHP_CONV_ERR_INVALID_SEQ; + goto out; + } + ps++, icnt--; + } break; + + case 5: { + if (!inst->lbchars && lb_cnt == 1 && *ps == '\n') { + /* auto-detect soft line breaks, found network line break */ + lb_cnt = lb_ptr = 0; + scan_stat = 0; + ps++, icnt--; /* consume \n */ + } else if (!inst->lbchars && lb_cnt > 0) { + /* auto-detect soft line breaks, found mac line break */ + lb_cnt = lb_ptr = 0; + scan_stat = 0; + } else if (lb_cnt >= inst->lbchars_len) { + /* soft line break */ + lb_cnt = lb_ptr = 0; + scan_stat = 0; + } else if (icnt > 0) { + if (*ps == (unsigned char)inst->lbchars[lb_cnt]) { + lb_cnt++; + ps++, icnt--; + } else { + scan_stat = 6; /* no break for short-cut */ + } + } else { + goto out; + } + } break; + + case 6: { + if (lb_ptr < lb_cnt) { + if (ocnt < 1) { + err = PHP_CONV_ERR_TOO_BIG; + goto out; + } + *(pd++) = inst->lbchars[lb_ptr++]; + ocnt--; + } else { + scan_stat = 0; + lb_cnt = lb_ptr = 0; + } + } break; + } + } +out: + *in_pp = (const char *)ps; + *in_left_p = icnt; + *out_pp = (char *)pd; + *out_left_p = ocnt; + inst->scan_stat = scan_stat; + inst->lb_ptr = lb_ptr; + inst->lb_cnt = lb_cnt; + inst->next_char = next_char; + + return err; +} +static php_conv_err_t php_conv_qprint_decode_ctor(php_conv_qprint_decode *inst, const char *lbchars, size_t lbchars_len, int lbchars_dup, int persistent) +{ + inst->_super.convert_op = (php_conv_convert_func) php_conv_qprint_decode_convert; + inst->_super.dtor = (php_conv_dtor_func) php_conv_qprint_decode_dtor; + inst->scan_stat = 0; + inst->next_char = 0; + inst->lb_ptr = inst->lb_cnt = 0; + if (lbchars != NULL) { + inst->lbchars = (lbchars_dup ? pestrdup(lbchars, persistent) : lbchars); + inst->lbchars_len = lbchars_len; + } else { + inst->lbchars = NULL; + inst->lbchars_len = 0; + } + inst->lbchars_dup = lbchars_dup; + inst->persistent = persistent; + return PHP_CONV_ERR_SUCCESS; +} +/* }}} */ + +typedef struct _php_convert_filter { + php_conv *cd; + int persistent; + char *filtername; + char stub[128]; + size_t stub_len; +} php_convert_filter; + +#define PHP_CONV_BASE64_ENCODE 1 +#define PHP_CONV_BASE64_DECODE 2 +#define PHP_CONV_QPRINT_ENCODE 3 +#define PHP_CONV_QPRINT_DECODE 4 + +static php_conv_err_t php_conv_get_string_prop_ex(const HashTable *ht, char **pretval, size_t *pretval_len, char *field_name, size_t field_name_len, int persistent) +{ + zval **tmpval; + + *pretval = NULL; + *pretval_len = 0; + + if (zend_hash_find((HashTable *)ht, field_name, field_name_len, (void **)&tmpval) == SUCCESS) { + if (Z_TYPE_PP(tmpval) != IS_STRING) { + zval zt = **tmpval; + + convert_to_string(&zt); + + if (NULL == (*pretval = pemalloc(Z_STRLEN(zt) + 1, persistent))) { + return PHP_CONV_ERR_ALLOC; + } + + *pretval_len = Z_STRLEN(zt); + memcpy(*pretval, Z_STRVAL(zt), Z_STRLEN(zt) + 1); + zval_dtor(&zt); + } else { + if (NULL == (*pretval = pemalloc(Z_STRLEN_PP(tmpval) + 1, persistent))) { + return PHP_CONV_ERR_ALLOC; + } + *pretval_len = Z_STRLEN_PP(tmpval); + memcpy(*pretval, Z_STRVAL_PP(tmpval), Z_STRLEN_PP(tmpval) + 1); + } + } else { + return PHP_CONV_ERR_NOT_FOUND; + } + return PHP_CONV_ERR_SUCCESS; +} + +#if IT_WAS_USED +static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, long *pretval, char *field_name, size_t field_name_len) +{ + zval **tmpval; + + *pretval = 0; + + if (zend_hash_find((HashTable *)ht, field_name, field_name_len, (void **)&tmpval) == SUCCESS) { + zval tmp, *ztval = *tmpval; + + if (Z_TYPE_PP(tmpval) != IS_LONG) { + tmp = *ztval; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + ztval = &tmp; + } + *pretval = Z_LVAL_P(ztval); + } else { + return PHP_CONV_ERR_NOT_FOUND; + } + return PHP_CONV_ERR_SUCCESS; +} +#endif + +static php_conv_err_t php_conv_get_ulong_prop_ex(const HashTable *ht, unsigned long *pretval, char *field_name, size_t field_name_len) +{ + zval **tmpval; + + *pretval = 0; + + if (zend_hash_find((HashTable *)ht, field_name, field_name_len, (void **)&tmpval) == SUCCESS) { + zval tmp, *ztval = *tmpval; + + if (Z_TYPE_PP(tmpval) != IS_LONG) { + tmp = *ztval; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + ztval = &tmp; + } + if (Z_LVAL_P(ztval) < 0) { + *pretval = 0; + } else { + *pretval = Z_LVAL_P(ztval); + } + } else { + return PHP_CONV_ERR_NOT_FOUND; + } + return PHP_CONV_ERR_SUCCESS; +} + +static php_conv_err_t php_conv_get_bool_prop_ex(const HashTable *ht, int *pretval, char *field_name, size_t field_name_len) +{ + zval **tmpval; + + *pretval = 0; + + if (zend_hash_find((HashTable *)ht, field_name, field_name_len, (void **)&tmpval) == SUCCESS) { + zval tmp, *ztval = *tmpval; + + if (Z_TYPE_PP(tmpval) != IS_BOOL) { + tmp = *ztval; + zval_copy_ctor(&tmp); + convert_to_boolean(&tmp); + ztval = &tmp; + } + *pretval = Z_BVAL_P(ztval); + } else { + return PHP_CONV_ERR_NOT_FOUND; + } + return PHP_CONV_ERR_SUCCESS; +} + + +#if IT_WAS_USED +static int php_conv_get_int_prop_ex(const HashTable *ht, int *pretval, char *field_name, size_t field_name_len) +{ + long l; + php_conv_err_t err; + + *pretval = 0; + + if ((err = php_conv_get_long_prop_ex(ht, &l, field_name, field_name_len)) == PHP_CONV_ERR_SUCCESS) { + *pretval = l; + } + return err; +} +#endif + +static int php_conv_get_uint_prop_ex(const HashTable *ht, unsigned int *pretval, char *field_name, size_t field_name_len) +{ + long l; + php_conv_err_t err; + + *pretval = 0; + + if ((err = php_conv_get_ulong_prop_ex(ht, &l, field_name, field_name_len)) == PHP_CONV_ERR_SUCCESS) { + *pretval = l; + } + return err; +} + +#define GET_STR_PROP(ht, var, var_len, fldname, persistent) \ + php_conv_get_string_prop_ex(ht, &var, &var_len, fldname, sizeof(fldname), persistent) + +#define GET_INT_PROP(ht, var, fldname) \ + php_conv_get_int_prop_ex(ht, &var, fldname, sizeof(fldname)) + +#define GET_UINT_PROP(ht, var, fldname) \ + php_conv_get_uint_prop_ex(ht, &var, fldname, sizeof(fldname)) + +#define GET_BOOL_PROP(ht, var, fldname) \ + php_conv_get_bool_prop_ex(ht, &var, fldname, sizeof(fldname)) + +static php_conv *php_conv_open(int conv_mode, const HashTable *options, int persistent) +{ + /* FIXME: I'll have to replace this ugly code by something neat + (factories?) in the near future. */ + php_conv *retval = NULL; + + switch (conv_mode) { + case PHP_CONV_BASE64_ENCODE: { + unsigned int line_len = 0; + char *lbchars = NULL; + size_t lbchars_len; + + if (options != NULL) { + GET_STR_PROP(options, lbchars, lbchars_len, "line-break-chars", 0); + GET_UINT_PROP(options, line_len, "line-length"); + if (line_len < 4) { + if (lbchars != NULL) { + pefree(lbchars, 0); + } + lbchars = NULL; + } else { + if (lbchars == NULL) { + lbchars = pestrdup("\r\n", 0); + lbchars_len = 2; + } + } + } + retval = pemalloc(sizeof(php_conv_base64_encode), persistent); + if (lbchars != NULL) { + if (php_conv_base64_encode_ctor((php_conv_base64_encode *)retval, line_len, lbchars, lbchars_len, 1, persistent)) { + if (lbchars != NULL) { + pefree(lbchars, 0); + } + goto out_failure; + } + pefree(lbchars, 0); + } else { + if (php_conv_base64_encode_ctor((php_conv_base64_encode *)retval, 0, NULL, 0, 0, persistent)) { + goto out_failure; + } + } + } break; + + case PHP_CONV_BASE64_DECODE: + retval = pemalloc(sizeof(php_conv_base64_decode), persistent); + if (php_conv_base64_decode_ctor((php_conv_base64_decode *)retval)) { + goto out_failure; + } + break; + + case PHP_CONV_QPRINT_ENCODE: { + unsigned int line_len = 0; + char *lbchars = NULL; + size_t lbchars_len; + int opts = 0; + + if (options != NULL) { + int opt_binary = 0; + int opt_force_encode_first = 0; + + GET_STR_PROP(options, lbchars, lbchars_len, "line-break-chars", 0); + GET_UINT_PROP(options, line_len, "line-length"); + GET_BOOL_PROP(options, opt_binary, "binary"); + GET_BOOL_PROP(options, opt_force_encode_first, "force-encode-first"); + + if (line_len < 4) { + if (lbchars != NULL) { + pefree(lbchars, 0); + } + lbchars = NULL; + } else { + if (lbchars == NULL) { + lbchars = pestrdup("\r\n", 0); + lbchars_len = 2; + } + } + opts |= (opt_binary ? PHP_CONV_QPRINT_OPT_BINARY : 0); + opts |= (opt_force_encode_first ? PHP_CONV_QPRINT_OPT_FORCE_ENCODE_FIRST : 0); + } + retval = pemalloc(sizeof(php_conv_qprint_encode), persistent); + if (lbchars != NULL) { + if (php_conv_qprint_encode_ctor((php_conv_qprint_encode *)retval, line_len, lbchars, lbchars_len, 1, opts, persistent)) { + pefree(lbchars, 0); + goto out_failure; + } + pefree(lbchars, 0); + } else { + if (php_conv_qprint_encode_ctor((php_conv_qprint_encode *)retval, 0, NULL, 0, 0, opts, persistent)) { + goto out_failure; + } + } + } break; + + case PHP_CONV_QPRINT_DECODE: { + char *lbchars = NULL; + size_t lbchars_len; + + if (options != NULL) { + /* If line-break-chars are not specified, filter will attempt to detect line endings (\r, \n, or \r\n) */ + GET_STR_PROP(options, lbchars, lbchars_len, "line-break-chars", 0); + } + + retval = pemalloc(sizeof(php_conv_qprint_decode), persistent); + if (lbchars != NULL) { + if (php_conv_qprint_decode_ctor((php_conv_qprint_decode *)retval, lbchars, lbchars_len, 1, persistent)) { + pefree(lbchars, 0); + goto out_failure; + } + pefree(lbchars, 0); + } else { + if (php_conv_qprint_decode_ctor((php_conv_qprint_decode *)retval, NULL, 0, 0, persistent)) { + goto out_failure; + } + } + } break; + + default: + retval = NULL; + break; + } + return retval; + +out_failure: + if (retval != NULL) { + pefree(retval, persistent); + } + return NULL; +} + +#undef GET_STR_PROP +#undef GET_INT_PROP +#undef GET_UINT_PROP +#undef GET_BOOL_PROP + +static int php_convert_filter_ctor(php_convert_filter *inst, + int conv_mode, HashTable *conv_opts, + const char *filtername, int persistent) +{ + inst->persistent = persistent; + inst->filtername = pestrdup(filtername, persistent); + inst->stub_len = 0; + + if ((inst->cd = php_conv_open(conv_mode, conv_opts, persistent)) == NULL) { + goto out_failure; + } + + return SUCCESS; + +out_failure: + if (inst->cd != NULL) { + php_conv_dtor(inst->cd); + pefree(inst->cd, persistent); + } + if (inst->filtername != NULL) { + pefree(inst->filtername, persistent); + } + return FAILURE; +} + +static void php_convert_filter_dtor(php_convert_filter *inst) +{ + if (inst->cd != NULL) { + php_conv_dtor(inst->cd); + pefree(inst->cd, inst->persistent); + } + + if (inst->filtername != NULL) { + pefree(inst->filtername, inst->persistent); + } +} + +/* {{{ strfilter_convert_append_bucket */ +static int strfilter_convert_append_bucket( + php_convert_filter *inst, + php_stream *stream, php_stream_filter *filter, + php_stream_bucket_brigade *buckets_out, + const char *ps, size_t buf_len, size_t *consumed, + int persistent TSRMLS_DC) +{ + php_conv_err_t err; + php_stream_bucket *new_bucket; + char *out_buf = NULL; + size_t out_buf_size; + char *pd; + const char *pt; + size_t ocnt, icnt, tcnt; + size_t initial_out_buf_size; + + if (ps == NULL) { + initial_out_buf_size = 64; + icnt = 1; + } else { + initial_out_buf_size = buf_len; + icnt = buf_len; + } + + out_buf_size = ocnt = initial_out_buf_size; + if (NULL == (out_buf = pemalloc(out_buf_size, persistent))) { + return FAILURE; + } + + pd = out_buf; + + if (inst->stub_len > 0) { + pt = inst->stub; + tcnt = inst->stub_len; + + while (tcnt > 0) { + err = php_conv_convert(inst->cd, &pt, &tcnt, &pd, &ocnt); + + switch (err) { + case PHP_CONV_ERR_INVALID_SEQ: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): invalid byte sequence", inst->filtername); + goto out_failure; + + case PHP_CONV_ERR_MORE: + if (ps != NULL) { + if (icnt > 0) { + if (inst->stub_len >= sizeof(inst->stub)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): insufficient buffer", inst->filtername); + goto out_failure; + } + inst->stub[inst->stub_len++] = *(ps++); + icnt--; + pt = inst->stub; + tcnt = inst->stub_len; + } else { + tcnt = 0; + break; + } + } + break; + + case PHP_CONV_ERR_UNEXPECTED_EOS: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): unexpected end of stream", inst->filtername); + goto out_failure; + + case PHP_CONV_ERR_TOO_BIG: { + char *new_out_buf; + size_t new_out_buf_size; + + new_out_buf_size = out_buf_size << 1; + + if (new_out_buf_size < out_buf_size) { + /* whoa! no bigger buckets are sold anywhere... */ + if (NULL == (new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, persistent TSRMLS_CC))) { + goto out_failure; + } + + php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC); + + out_buf_size = ocnt = initial_out_buf_size; + if (NULL == (out_buf = pemalloc(out_buf_size, persistent))) { + return FAILURE; + } + pd = out_buf; + } else { + if (NULL == (new_out_buf = perealloc(out_buf, new_out_buf_size, persistent))) { + if (NULL == (new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, persistent TSRMLS_CC))) { + goto out_failure; + } + + php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC); + return FAILURE; + } + + pd = new_out_buf + (pd - out_buf); + ocnt += (new_out_buf_size - out_buf_size); + out_buf = new_out_buf; + out_buf_size = new_out_buf_size; + } + } break; + + case PHP_CONV_ERR_UNKNOWN: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): unknown error", inst->filtername); + goto out_failure; + + default: + break; + } + } + memmove(inst->stub, pt, tcnt); + inst->stub_len = tcnt; + } + + while (icnt > 0) { + err = ((ps == NULL ? php_conv_convert(inst->cd, NULL, NULL, &pd, &ocnt): + php_conv_convert(inst->cd, &ps, &icnt, &pd, &ocnt))); + switch (err) { + case PHP_CONV_ERR_INVALID_SEQ: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): invalid byte sequence", inst->filtername); + goto out_failure; + + case PHP_CONV_ERR_MORE: + if (ps != NULL) { + if (icnt > sizeof(inst->stub)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): insufficient buffer", inst->filtername); + goto out_failure; + } + memcpy(inst->stub, ps, icnt); + inst->stub_len = icnt; + ps += icnt; + icnt = 0; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): unexpected octet values", inst->filtername); + goto out_failure; + } + break; + + case PHP_CONV_ERR_TOO_BIG: { + char *new_out_buf; + size_t new_out_buf_size; + + new_out_buf_size = out_buf_size << 1; + + if (new_out_buf_size < out_buf_size) { + /* whoa! no bigger buckets are sold anywhere... */ + if (NULL == (new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, persistent TSRMLS_CC))) { + goto out_failure; + } + + php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC); + + out_buf_size = ocnt = initial_out_buf_size; + if (NULL == (out_buf = pemalloc(out_buf_size, persistent))) { + return FAILURE; + } + pd = out_buf; + } else { + if (NULL == (new_out_buf = perealloc(out_buf, new_out_buf_size, persistent))) { + if (NULL == (new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, persistent TSRMLS_CC))) { + goto out_failure; + } + + php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC); + return FAILURE; + } + pd = new_out_buf + (pd - out_buf); + ocnt += (new_out_buf_size - out_buf_size); + out_buf = new_out_buf; + out_buf_size = new_out_buf_size; + } + } break; + + case PHP_CONV_ERR_UNKNOWN: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): unknown error", inst->filtername); + goto out_failure; + + default: + if (ps == NULL) { + icnt = 0; + } + break; + } + } + + if (out_buf_size - ocnt > 0) { + if (NULL == (new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, persistent TSRMLS_CC))) { + goto out_failure; + } + php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC); + } else { + pefree(out_buf, persistent); + } + *consumed += buf_len - icnt; + + return SUCCESS; + +out_failure: + pefree(out_buf, persistent); + return FAILURE; +} +/* }}} */ + +static php_stream_filter_status_t strfilter_convert_filter( + php_stream *stream, + php_stream_filter *thisfilter, + php_stream_bucket_brigade *buckets_in, + php_stream_bucket_brigade *buckets_out, + size_t *bytes_consumed, + int flags + TSRMLS_DC) +{ + php_stream_bucket *bucket = NULL; + size_t consumed = 0; + php_convert_filter *inst = (php_convert_filter *)thisfilter->abstract; + + while (buckets_in->head != NULL) { + bucket = buckets_in->head; + + php_stream_bucket_unlink(bucket TSRMLS_CC); + + if (strfilter_convert_append_bucket(inst, stream, thisfilter, + buckets_out, bucket->buf, bucket->buflen, &consumed, + php_stream_is_persistent(stream) TSRMLS_CC) != SUCCESS) { + goto out_failure; + } + + php_stream_bucket_delref(bucket TSRMLS_CC); + } + + if (flags != PSFS_FLAG_NORMAL) { + if (strfilter_convert_append_bucket(inst, stream, thisfilter, + buckets_out, NULL, 0, &consumed, + php_stream_is_persistent(stream) TSRMLS_CC) != SUCCESS) { + goto out_failure; + } + } + + if (bytes_consumed) { + *bytes_consumed = consumed; + } + + return PSFS_PASS_ON; + +out_failure: + if (bucket != NULL) { + php_stream_bucket_delref(bucket TSRMLS_CC); + } + return PSFS_ERR_FATAL; +} + +static void strfilter_convert_dtor(php_stream_filter *thisfilter TSRMLS_DC) +{ + assert(thisfilter->abstract != NULL); + + php_convert_filter_dtor((php_convert_filter *)thisfilter->abstract); + pefree(thisfilter->abstract, ((php_convert_filter *)thisfilter->abstract)->persistent); +} + +static php_stream_filter_ops strfilter_convert_ops = { + strfilter_convert_filter, + strfilter_convert_dtor, + "convert.*" +}; + +static php_stream_filter *strfilter_convert_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC) +{ + php_convert_filter *inst; + php_stream_filter *retval = NULL; + + char *dot; + int conv_mode = 0; + + if (filterparams != NULL && Z_TYPE_P(filterparams) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "stream filter (%s): invalid filter parameter", filtername); + return NULL; + } + + if ((dot = strchr(filtername, '.')) == NULL) { + return NULL; + } + ++dot; + + inst = pemalloc(sizeof(php_convert_filter), persistent); + + if (strcasecmp(dot, "base64-encode") == 0) { + conv_mode = PHP_CONV_BASE64_ENCODE; + } else if (strcasecmp(dot, "base64-decode") == 0) { + conv_mode = PHP_CONV_BASE64_DECODE; + } else if (strcasecmp(dot, "quoted-printable-encode") == 0) { + conv_mode = PHP_CONV_QPRINT_ENCODE; + } else if (strcasecmp(dot, "quoted-printable-decode") == 0) { + conv_mode = PHP_CONV_QPRINT_DECODE; + } + + if (php_convert_filter_ctor(inst, conv_mode, + (filterparams != NULL ? Z_ARRVAL_P(filterparams) : NULL), + filtername, persistent) != SUCCESS) { + goto out; + } + + retval = php_stream_filter_alloc(&strfilter_convert_ops, inst, persistent); +out: + if (retval == NULL) { + pefree(inst, persistent); + } + + return retval; +} + +static php_stream_filter_factory strfilter_convert_factory = { + strfilter_convert_create +}; +/* }}} */ + +/* {{{ consumed filter implementation */ +typedef struct _php_consumed_filter_data { + int persistent; + size_t consumed; + off_t offset; +} php_consumed_filter_data; + +static php_stream_filter_status_t consumed_filter_filter( + php_stream *stream, + php_stream_filter *thisfilter, + php_stream_bucket_brigade *buckets_in, + php_stream_bucket_brigade *buckets_out, + size_t *bytes_consumed, + int flags + TSRMLS_DC) +{ + php_consumed_filter_data *data = (php_consumed_filter_data *)(thisfilter->abstract); + php_stream_bucket *bucket; + size_t consumed = 0; + + if (data->offset == ~0) { + data->offset = php_stream_tell(stream); + } + while ((bucket = buckets_in->head) != NULL) { + php_stream_bucket_unlink(bucket TSRMLS_CC); + consumed += bucket->buflen; + php_stream_bucket_append(buckets_out, bucket TSRMLS_CC); + } + if (bytes_consumed) { + *bytes_consumed = consumed; + } + if (flags & PSFS_FLAG_FLUSH_CLOSE) { + php_stream_seek(stream, data->offset + data->consumed, SEEK_SET); + } + data->consumed += consumed; + + return PSFS_PASS_ON; +} + +static void consumed_filter_dtor(php_stream_filter *thisfilter TSRMLS_DC) +{ + if (thisfilter && thisfilter->abstract) { + php_consumed_filter_data *data = (php_consumed_filter_data*)thisfilter->abstract; + pefree(data, data->persistent); + } +} + +static php_stream_filter_ops consumed_filter_ops = { + consumed_filter_filter, + consumed_filter_dtor, + "consumed" +}; + +static php_stream_filter *consumed_filter_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC) +{ + php_stream_filter_ops *fops = NULL; + php_consumed_filter_data *data; + + if (strcasecmp(filtername, "consumed")) { + return NULL; + } + + /* Create this filter */ + data = pecalloc(1, sizeof(php_consumed_filter_data), persistent); + if (!data) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes", sizeof(php_consumed_filter_data)); + return NULL; + } + data->persistent = persistent; + data->consumed = 0; + data->offset = ~0; + fops = &consumed_filter_ops; + + return php_stream_filter_alloc(fops, data, persistent); +} + +php_stream_filter_factory consumed_filter_factory = { + consumed_filter_create +}; + +/* }}} */ + +/* {{{ chunked filter implementation */ +typedef enum _php_chunked_filter_state { + CHUNK_SIZE_START, + CHUNK_SIZE, + CHUNK_SIZE_EXT, + CHUNK_SIZE_CR, + CHUNK_SIZE_LF, + CHUNK_BODY, + CHUNK_BODY_CR, + CHUNK_BODY_LF, + CHUNK_TRAILER, + CHUNK_ERROR +} php_chunked_filter_state; + +typedef struct _php_chunked_filter_data { + php_chunked_filter_state state; + size_t chunk_size; + int persistent; +} php_chunked_filter_data; + +static int php_dechunk(char *buf, int len, php_chunked_filter_data *data) +{ + char *p = buf; + char *end = p + len; + char *out = buf; + int out_len = 0; + + while (p < end) { + switch (data->state) { + case CHUNK_SIZE_START: + data->chunk_size = 0; + case CHUNK_SIZE: + while (p < end) { + if (*p >= '0' && *p <= '9') { + data->chunk_size = (data->chunk_size * 16) + (*p - '0'); + } else if (*p >= 'A' && *p <= 'F') { + data->chunk_size = (data->chunk_size * 16) + (*p - 'A' + 10); + } else if (*p >= 'a' && *p <= 'f') { + data->chunk_size = (data->chunk_size * 16) + (*p - 'a' + 10); + } else if (data->state == CHUNK_SIZE_START) { + data->state = CHUNK_ERROR; + break; + } else { + data->state = CHUNK_SIZE_EXT; + break; + } + data->state = CHUNK_SIZE; + p++; + } + if (data->state == CHUNK_ERROR) { + continue; + } else if (p == end) { + return out_len; + } + case CHUNK_SIZE_EXT: + /* skip extension */ + while (p < end && *p != '\r' && *p != '\n') { + p++; + } + if (p == end) { + return out_len; + } + case CHUNK_SIZE_CR: + if (*p == '\r') { + p++; + if (p == end) { + data->state = CHUNK_SIZE_LF; + return out_len; + } + } + case CHUNK_SIZE_LF: + if (*p == '\n') { + p++; + if (data->chunk_size == 0) { + /* last chunk */ + data->state = CHUNK_TRAILER; + continue; + } else if (p == end) { + data->state = CHUNK_BODY; + return out_len; + } + } else { + data->state = CHUNK_ERROR; + continue; + } + case CHUNK_BODY: + if ((size_t) (end - p) >= data->chunk_size) { + if (p != out) { + memmove(out, p, data->chunk_size); + } + out += data->chunk_size; + out_len += data->chunk_size; + p += data->chunk_size; + if (p == end) { + data->state = CHUNK_BODY_CR; + return out_len; + } + } else { + if (p != out) { + memmove(out, p, end - p); + } + data->chunk_size -= end - p; + data->state=CHUNK_BODY; + out_len += end - p; + return out_len; + } + case CHUNK_BODY_CR: + if (*p == '\r') { + p++; + if (p == end) { + data->state = CHUNK_BODY_LF; + return out_len; + } + } + case CHUNK_BODY_LF: + if (*p == '\n') { + p++; + data->state = CHUNK_SIZE_START; + continue; + } else { + data->state = CHUNK_ERROR; + continue; + } + case CHUNK_TRAILER: + /* ignore trailer */ + p = end; + continue; + case CHUNK_ERROR: + if (p != out) { + memmove(out, p, end - p); + } + out_len += end - p; + return out_len; + } + } + return out_len; +} + +static php_stream_filter_status_t php_chunked_filter( + php_stream *stream, + php_stream_filter *thisfilter, + php_stream_bucket_brigade *buckets_in, + php_stream_bucket_brigade *buckets_out, + size_t *bytes_consumed, + int flags + TSRMLS_DC) +{ + php_stream_bucket *bucket; + size_t consumed = 0; + php_chunked_filter_data *data = (php_chunked_filter_data *) thisfilter->abstract; + + while (buckets_in->head) { + bucket = php_stream_bucket_make_writeable(buckets_in->head TSRMLS_CC); + consumed += bucket->buflen; + bucket->buflen = php_dechunk(bucket->buf, bucket->buflen, data); + php_stream_bucket_append(buckets_out, bucket TSRMLS_CC); + } + + if (bytes_consumed) { + *bytes_consumed = consumed; + } + + return PSFS_PASS_ON; +} + +static void php_chunked_dtor(php_stream_filter *thisfilter TSRMLS_DC) +{ + if (thisfilter && thisfilter->abstract) { + php_chunked_filter_data *data = (php_chunked_filter_data *) thisfilter->abstract; + pefree(data, data->persistent); + } +} + +static php_stream_filter_ops chunked_filter_ops = { + php_chunked_filter, + php_chunked_dtor, + "dechunk" +}; + +static php_stream_filter *chunked_filter_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC) +{ + php_stream_filter_ops *fops = NULL; + php_chunked_filter_data *data; + + if (strcasecmp(filtername, "dechunk")) { + return NULL; + } + + /* Create this filter */ + data = (php_chunked_filter_data *)pecalloc(1, sizeof(php_chunked_filter_data), persistent); + if (!data) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes", sizeof(php_chunked_filter_data)); + return NULL; + } + data->state = CHUNK_SIZE_START; + data->chunk_size = 0; + data->persistent = persistent; + fops = &chunked_filter_ops; + + return php_stream_filter_alloc(fops, data, persistent); +} + +static php_stream_filter_factory chunked_filter_factory = { + chunked_filter_create +}; +/* }}} */ + +static const struct { + php_stream_filter_ops *ops; + php_stream_filter_factory *factory; +} standard_filters[] = { + { &strfilter_rot13_ops, &strfilter_rot13_factory }, + { &strfilter_toupper_ops, &strfilter_toupper_factory }, + { &strfilter_tolower_ops, &strfilter_tolower_factory }, + { &strfilter_strip_tags_ops, &strfilter_strip_tags_factory }, + { &strfilter_convert_ops, &strfilter_convert_factory }, + { &consumed_filter_ops, &consumed_filter_factory }, + { &chunked_filter_ops, &chunked_filter_factory }, + /* additional filters to go here */ + { NULL, NULL } +}; + +/* {{{ filter MINIT and MSHUTDOWN */ +PHP_MINIT_FUNCTION(standard_filters) +{ + int i; + + for (i = 0; standard_filters[i].ops; i++) { + if (FAILURE == php_stream_filter_register_factory( + standard_filters[i].ops->label, + standard_filters[i].factory + TSRMLS_CC)) { + return FAILURE; + } + } + return SUCCESS; +} + +PHP_MSHUTDOWN_FUNCTION(standard_filters) +{ + int i; + + for (i = 0; standard_filters[i].ops; i++) { + php_stream_filter_unregister_factory(standard_filters[i].ops->label TSRMLS_CC); + } + return SUCCESS; +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/flock_compat.c b/ext/standard/flock_compat.c new file mode 100644 index 0000000..41f95eb --- /dev/null +++ b/ext/standard/flock_compat.c @@ -0,0 +1,239 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Sascha Schumann | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include +#include "ext/standard/flock_compat.h" + +#if HAVE_STRUCT_FLOCK +#include +#include +#include +#endif + +#ifdef PHP_WIN32 +#include +#include "config.w32.h" +#endif + +#ifdef NETWARE +#include +#endif + +#ifndef HAVE_FLOCK +PHPAPI int flock(int fd, int operation) +{ + return php_flock(fd, operation); +} +#endif /* !defined(HAVE_FLOCK) */ + +PHPAPI int php_flock(int fd, int operation) +#if HAVE_STRUCT_FLOCK /* {{{ */ +{ + struct flock flck; + int ret; + + flck.l_start = flck.l_len = 0; + flck.l_whence = SEEK_SET; + + if (operation & LOCK_SH) + flck.l_type = F_RDLCK; + else if (operation & LOCK_EX) + flck.l_type = F_WRLCK; + else if (operation & LOCK_UN) + flck.l_type = F_UNLCK; + else { + errno = EINVAL; + return -1; + } + + ret = fcntl(fd, operation & LOCK_NB ? F_SETLK : F_SETLKW, &flck); + + if (operation & LOCK_NB && ret == -1 && + (errno == EACCES || errno == EAGAIN)) + errno = EWOULDBLOCK; + + if (ret != -1) ret = 0; + + return ret; +} +/* }}} */ +#elif defined(PHP_WIN32) /* {{{ */ +/* + * Program: Unix compatibility routines + * + * Author: Mark Crispin + * Networks and Distributed Computing + * Computing & Communications + * University of Washington + * Administration Building, AG-44 + * Seattle, WA 98195 + * Internet: MRC@CAC.Washington.EDU + * + * Date: 14 September 1996 + * Last Edited: 14 August 1997 + * + * Copyright 1997 by the University of Washington + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appears in all copies and that both the + * above copyright notice and this permission notice appear in supporting + * documentation, and that the name of the University of Washington not be + * used in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. This software is made available + * "as is", and + * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, + * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN + * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT + * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ +/* DEDICATION + + * This file is dedicated to my dog, Unix, also known as Yun-chan and + * Unix J. Terwilliker Jehosophat Aloysius Monstrosity Animal Beast. Unix + * passed away at the age of 11 1/2 on September 14, 1996, 12:18 PM PDT, after + * a two-month bout with cirrhosis of the liver. + * + * He was a dear friend, and I miss him terribly. + * + * Lift a leg, Yunie. Luv ya forever!!!! + */ +{ + HANDLE hdl = (HANDLE) _get_osfhandle(fd); + DWORD low = 1, high = 0; + OVERLAPPED offset = + {0, 0, 0, 0, NULL}; + if (hdl < 0) + return -1; /* error in file descriptor */ + /* bug for bug compatible with Unix */ + UnlockFileEx(hdl, 0, low, high, &offset); + switch (operation & ~LOCK_NB) { /* translate to LockFileEx() op */ + case LOCK_EX: /* exclusive */ + if (LockFileEx(hdl, LOCKFILE_EXCLUSIVE_LOCK + + ((operation & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0), + 0, low, high, &offset)) + return 0; + break; + case LOCK_SH: /* shared */ + if (LockFileEx(hdl, ((operation & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0), + 0, low, high, &offset)) + return 0; + break; + case LOCK_UN: /* unlock */ + return 0; /* always succeeds */ + default: /* default */ + break; + } + /* Under Win32 MT library, errno is not a variable but a function call, + * which cannot be assigned to. + */ +#if !defined(PHP_WIN32) + errno = EINVAL; /* bad call */ +#endif + return -1; +} +/* }}} */ +#else +#warning no proper flock support for your site +{ + errno = 0; + return 0; +} +#endif + +#ifndef PHP_WIN32 +#if !(HAVE_INET_ATON) +/* {{{ inet_aton + * Check whether "cp" is a valid ascii representation + * of an Internet address and convert to a binary address. + * Returns 1 if the address is valid, 0 if not. + * This replaces inet_addr, the return value from which + * cannot distinguish between failure and a local broadcast address. + */ +int inet_aton(const char *cp, struct in_addr *ap) +{ + int dots = 0; + register unsigned long acc = 0, addr = 0; + + do { + register char cc = *cp; + + switch (cc) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + acc = acc * 10 + (cc - '0'); + break; + + case '.': + if (++dots > 3) { + return 0; + } + /* Fall through */ + + case '\0': + if (acc > 255) { + return 0; + } + addr = addr << 8 | acc; + acc = 0; + break; + + default: + return 0; + } + } while (*cp++) ; + + /* Normalize the address */ + if (dots < 3) { + addr <<= 8 * (3 - dots) ; + } + + /* Store it if requested */ + if (ap) { + ap->s_addr = htonl(addr); + } + + return 1; +} +/* }}} */ +#endif /* !HAVE_INET_ATON */ +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/flock_compat.h b/ext/standard/flock_compat.h new file mode 100644 index 0000000..819d63c --- /dev/null +++ b/ext/standard/flock_compat.h @@ -0,0 +1,66 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Sascha Schumann | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef FLOCK_COMPAT_H +#define FLOCK_COMPAT_H + +/* php_flock internally uses fcntl whther or not flock is available + * This way our php_flock even works on NFS files. + * More info: /usr/src/linux/Documentation + */ +PHPAPI int php_flock(int fd, int operation); + +#ifndef HAVE_FLOCK +# define LOCK_SH 1 +# define LOCK_EX 2 +# define LOCK_NB 4 +# define LOCK_UN 8 +PHPAPI int flock(int fd, int operation); +#endif + +/* Userland LOCK_* constants */ +#define PHP_LOCK_SH 1 +#define PHP_LOCK_EX 2 +#define PHP_LOCK_UN 3 +#define PHP_LOCK_NB 4 + +#ifdef PHP_WIN32 +# ifdef EWOULDBLOCK +# undef EWOULDBLOCK +# endif +# define EWOULDBLOCK WSAEWOULDBLOCK +# define fsync _commit +# define ftruncate(a, b) chsize(a, b) +#endif /* defined(PHP_WIN32) */ + +#if !HAVE_INET_ATON +#if HAVE_NETINET_IN_H +#include +#endif +#if HAVE_ARPA_INET_H +#include +#endif + +#ifndef PHP_WIN32 +extern int inet_aton(const char *, struct in_addr *); +#endif +#endif + +#endif /* FLOCK_COMPAT_H */ diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c new file mode 100644 index 0000000..0035d20 --- /dev/null +++ b/ext/standard/formatted_print.c @@ -0,0 +1,793 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Stig Sæther Bakken | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#include /* modf() */ +#include "php.h" +#include "ext/standard/head.h" +#include "php_string.h" +#include "zend_execute.h" +#include + +#ifdef HAVE_LOCALE_H +#include +#define LCONV_DECIMAL_POINT (*lconv->decimal_point) +#else +#define LCONV_DECIMAL_POINT '.' +#endif + +#define ALIGN_LEFT 0 +#define ALIGN_RIGHT 1 +#define ADJ_WIDTH 1 +#define ADJ_PRECISION 2 +#define NUM_BUF_SIZE 500 +#define FLOAT_PRECISION 6 +#define MAX_FLOAT_PRECISION 53 + +#if 0 +/* trick to control varargs functions through cpp */ +# define PRINTF_DEBUG(arg) php_printf arg +#else +# define PRINTF_DEBUG(arg) +#endif + +static char hexchars[] = "0123456789abcdef"; +static char HEXCHARS[] = "0123456789ABCDEF"; + +/* php_spintf_appendchar() {{{ */ +inline static void +php_sprintf_appendchar(char **buffer, int *pos, int *size, char add TSRMLS_DC) +{ + if ((*pos + 1) >= *size) { + *size <<= 1; + PRINTF_DEBUG(("%s(): ereallocing buffer to %d bytes\n", get_active_function_name(TSRMLS_C), *size)); + *buffer = erealloc(*buffer, *size); + } + PRINTF_DEBUG(("sprintf: appending '%c', pos=\n", add, *pos)); + (*buffer)[(*pos)++] = add; +} +/* }}} */ + +/* php_spintf_appendstring() {{{ */ +inline static void +php_sprintf_appendstring(char **buffer, int *pos, int *size, char *add, + int min_width, int max_width, char padding, + int alignment, int len, int neg, int expprec, int always_sign) +{ + register int npad; + int req_size; + int copy_len; + int m_width; + + copy_len = (expprec ? MIN(max_width, len) : len); + npad = min_width - copy_len; + + if (npad < 0) { + npad = 0; + } + + PRINTF_DEBUG(("sprintf: appendstring(%x, %d, %d, \"%s\", %d, '%c', %d)\n", + *buffer, *pos, *size, add, min_width, padding, alignment)); + m_width = MAX(min_width, copy_len); + + if(m_width > INT_MAX - *pos - 1) { + zend_error_noreturn(E_ERROR, "Field width %d is too long", m_width); + } + + req_size = *pos + m_width + 1; + + if (req_size > *size) { + while (req_size > *size) { + if(*size > INT_MAX/2) { + zend_error_noreturn(E_ERROR, "Field width %d is too long", req_size); + } + *size <<= 1; + } + PRINTF_DEBUG(("sprintf ereallocing buffer to %d bytes\n", *size)); + *buffer = erealloc(*buffer, *size); + } + if (alignment == ALIGN_RIGHT) { + if ((neg || always_sign) && padding=='0') { + (*buffer)[(*pos)++] = (neg) ? '-' : '+'; + add++; + len--; + copy_len--; + } + while (npad-- > 0) { + (*buffer)[(*pos)++] = padding; + } + } + PRINTF_DEBUG(("sprintf: appending \"%s\"\n", add)); + memcpy(&(*buffer)[*pos], add, copy_len + 1); + *pos += copy_len; + if (alignment == ALIGN_LEFT) { + while (npad--) { + (*buffer)[(*pos)++] = padding; + } + } +} +/* }}} */ + +/* php_spintf_appendint() {{{ */ +inline static void +php_sprintf_appendint(char **buffer, int *pos, int *size, long number, + int width, char padding, int alignment, + int always_sign) +{ + char numbuf[NUM_BUF_SIZE]; + register unsigned long magn, nmagn; + register unsigned int i = NUM_BUF_SIZE - 1, neg = 0; + + PRINTF_DEBUG(("sprintf: appendint(%x, %x, %x, %d, %d, '%c', %d)\n", + *buffer, pos, size, number, width, padding, alignment)); + if (number < 0) { + neg = 1; + magn = ((unsigned long) -(number + 1)) + 1; + } else { + magn = (unsigned long) number; + } + + /* Can't right-pad 0's on integers */ + if(alignment==0 && padding=='0') padding=' '; + + numbuf[i] = '\0'; + + do { + nmagn = magn / 10; + + numbuf[--i] = (unsigned char)(magn - (nmagn * 10)) + '0'; + magn = nmagn; + } + while (magn > 0 && i > 0); + if (neg) { + numbuf[--i] = '-'; + } else if (always_sign) { + numbuf[--i] = '+'; + } + PRINTF_DEBUG(("sprintf: appending %d as \"%s\", i=%d\n", + number, &numbuf[i], i)); + php_sprintf_appendstring(buffer, pos, size, &numbuf[i], width, 0, + padding, alignment, (NUM_BUF_SIZE - 1) - i, + neg, 0, always_sign); +} +/* }}} */ + +/* php_spintf_appenduint() {{{ */ +inline static void +php_sprintf_appenduint(char **buffer, int *pos, int *size, + unsigned long number, + int width, char padding, int alignment) +{ + char numbuf[NUM_BUF_SIZE]; + register unsigned long magn, nmagn; + register unsigned int i = NUM_BUF_SIZE - 1; + + PRINTF_DEBUG(("sprintf: appenduint(%x, %x, %x, %d, %d, '%c', %d)\n", + *buffer, pos, size, number, width, padding, alignment)); + magn = (unsigned long) number; + + /* Can't right-pad 0's on integers */ + if (alignment == 0 && padding == '0') padding = ' '; + + numbuf[i] = '\0'; + + do { + nmagn = magn / 10; + + numbuf[--i] = (unsigned char)(magn - (nmagn * 10)) + '0'; + magn = nmagn; + } while (magn > 0 && i > 0); + + PRINTF_DEBUG(("sprintf: appending %d as \"%s\", i=%d\n", number, &numbuf[i], i)); + php_sprintf_appendstring(buffer, pos, size, &numbuf[i], width, 0, + padding, alignment, (NUM_BUF_SIZE - 1) - i, 0, 0, 0); +} +/* }}} */ + +/* php_spintf_appenddouble() {{{ */ +inline static void +php_sprintf_appenddouble(char **buffer, int *pos, + int *size, double number, + int width, char padding, + int alignment, int precision, + int adjust, char fmt, + int always_sign + TSRMLS_DC) +{ + char num_buf[NUM_BUF_SIZE]; + char *s = NULL; + int s_len = 0, is_negative = 0; +#ifdef HAVE_LOCALE_H + struct lconv *lconv; +#endif + + PRINTF_DEBUG(("sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n", + *buffer, pos, size, number, width, padding, alignment, fmt)); + if ((adjust & ADJ_PRECISION) == 0) { + precision = FLOAT_PRECISION; + } else if (precision > MAX_FLOAT_PRECISION) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Requested precision of %d digits was truncated to PHP maximum of %d digits", precision, MAX_FLOAT_PRECISION); + precision = MAX_FLOAT_PRECISION; + } + + if (zend_isnan(number)) { + is_negative = (number<0); + php_sprintf_appendstring(buffer, pos, size, "NaN", 3, 0, padding, + alignment, 3, is_negative, 0, always_sign); + return; + } + + if (zend_isinf(number)) { + is_negative = (number<0); + php_sprintf_appendstring(buffer, pos, size, "INF", 3, 0, padding, + alignment, 3, is_negative, 0, always_sign); + return; + } + + switch (fmt) { + case 'e': + case 'E': + case 'f': + case 'F': +#ifdef HAVE_LOCALE_H + lconv = localeconv(); +#endif + s = php_conv_fp((fmt == 'f')?'F':fmt, number, 0, precision, + (fmt == 'f')?LCONV_DECIMAL_POINT:'.', + &is_negative, &num_buf[1], &s_len); + if (is_negative) { + num_buf[0] = '-'; + s = num_buf; + s_len++; + } else if (always_sign) { + num_buf[0] = '+'; + s = num_buf; + s_len++; + } + break; + + case 'g': + case 'G': + if (precision == 0) + precision = 1; + /* + * * We use &num_buf[ 1 ], so that we have room for the sign + */ +#ifdef HAVE_LOCALE_H + lconv = localeconv(); +#endif + s = php_gcvt(number, precision, LCONV_DECIMAL_POINT, (fmt == 'G')?'E':'e', &num_buf[1]); + is_negative = 0; + if (*s == '-') { + is_negative = 1; + s = &num_buf[1]; + } else if (always_sign) { + num_buf[0] = '+'; + s = num_buf; + } + + s_len = strlen(s); + break; + } + + php_sprintf_appendstring(buffer, pos, size, s, width, 0, padding, + alignment, s_len, is_negative, 0, always_sign); +} +/* }}} */ + +/* php_spintf_appendd2n() {{{ */ +inline static void +php_sprintf_append2n(char **buffer, int *pos, int *size, long number, + int width, char padding, int alignment, int n, + char *chartable, int expprec) +{ + char numbuf[NUM_BUF_SIZE]; + register unsigned long num; + register unsigned int i = NUM_BUF_SIZE - 1; + register int andbits = (1 << n) - 1; + + PRINTF_DEBUG(("sprintf: append2n(%x, %x, %x, %d, %d, '%c', %d, %d, %x)\n", + *buffer, pos, size, number, width, padding, alignment, n, + chartable)); + PRINTF_DEBUG(("sprintf: append2n 2^%d andbits=%x\n", n, andbits)); + + num = (unsigned long) number; + numbuf[i] = '\0'; + + do { + numbuf[--i] = chartable[(num & andbits)]; + num >>= n; + } + while (num > 0); + + php_sprintf_appendstring(buffer, pos, size, &numbuf[i], width, 0, + padding, alignment, (NUM_BUF_SIZE - 1) - i, + 0, expprec, 0); +} +/* }}} */ + +/* php_spintf_getnumber() {{{ */ +inline static int +php_sprintf_getnumber(char *buffer, int *pos) +{ + char *endptr; + register long num = strtol(&buffer[*pos], &endptr, 10); + register int i = 0; + + if (endptr != NULL) { + i = (endptr - &buffer[*pos]); + } + PRINTF_DEBUG(("sprintf_getnumber: number was %d bytes long\n", i)); + *pos += i; + + if (num >= INT_MAX || num < 0) { + return -1; + } else { + return (int) num; + } +} +/* }}} */ + +/* php_formatted_print() {{{ + * New sprintf implementation for PHP. + * + * Modifiers: + * + * " " pad integers with spaces + * "-" left adjusted field + * n field size + * "."n precision (floats only) + * "+" Always place a sign (+ or -) in front of a number + * + * Type specifiers: + * + * "%" literal "%", modifiers are ignored. + * "b" integer argument is printed as binary + * "c" integer argument is printed as a single character + * "d" argument is an integer + * "f" the argument is a float + * "o" integer argument is printed as octal + * "s" argument is a string + * "x" integer argument is printed as lowercase hexadecimal + * "X" integer argument is printed as uppercase hexadecimal + * + */ +static char * +php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC) +{ + zval ***args, **z_format; + int argc, size = 240, inpos = 0, outpos = 0, temppos; + int alignment, currarg, adjusting, argnum, width, precision; + char *format, *result, padding; + int always_sign; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) { + return NULL; + } + + /* verify the number of args */ + if ((use_array && argc != (2 + format_offset)) + || (!use_array && argc < (1 + format_offset))) { + efree(args); + WRONG_PARAM_COUNT_WITH_RETVAL(NULL); + } + + if (use_array) { + int i = 1; + zval ***newargs; + zval **array; + + z_format = args[format_offset]; + array = args[1 + format_offset]; + + SEPARATE_ZVAL(array); + convert_to_array_ex(array); + + argc = 1 + zend_hash_num_elements(Z_ARRVAL_PP(array)); + newargs = (zval ***)safe_emalloc(argc, sizeof(zval *), 0); + newargs[0] = z_format; + + for (zend_hash_internal_pointer_reset(Z_ARRVAL_PP(array)); + zend_hash_get_current_data(Z_ARRVAL_PP(array), (void **)&newargs[i++]) == SUCCESS; + zend_hash_move_forward(Z_ARRVAL_PP(array))); + + efree(args); + args = newargs; + format_offset = 0; + } + + convert_to_string_ex(args[format_offset]); + format = Z_STRVAL_PP(args[format_offset]); + result = emalloc(size); + + currarg = 1; + + while (inpos= argc) { + efree(result); + efree(args); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too few arguments"); + return NULL; + } + + if (format[inpos] == 'l') { + inpos++; + } + PRINTF_DEBUG(("sprintf: format character='%c'\n", format[inpos])); + /* now we expect to find a type specifier */ + if (multiuse) { + MAKE_STD_ZVAL(tmp); + *tmp = **(args[argnum]); + INIT_PZVAL(tmp); + zval_copy_ctor(tmp); + } else { + SEPARATE_ZVAL(args[argnum]); + tmp = *(args[argnum]); + } + + switch (format[inpos]) { + case 's': { + zval *var, var_copy; + int use_copy; + + zend_make_printable_zval(tmp, &var_copy, &use_copy); + if (use_copy) { + var = &var_copy; + } else { + var = tmp; + } + php_sprintf_appendstring(&result, &outpos, &size, + Z_STRVAL_P(var), + width, precision, padding, + alignment, + Z_STRLEN_P(var), + 0, expprec, 0); + if (use_copy) { + zval_dtor(&var_copy); + } + break; + } + + case 'd': + convert_to_long(tmp); + php_sprintf_appendint(&result, &outpos, &size, + Z_LVAL_P(tmp), + width, padding, alignment, + always_sign); + break; + + case 'u': + convert_to_long(tmp); + php_sprintf_appenduint(&result, &outpos, &size, + Z_LVAL_P(tmp), + width, padding, alignment); + break; + + case 'g': + case 'G': + case 'e': + case 'E': + case 'f': + case 'F': + convert_to_double(tmp); + php_sprintf_appenddouble(&result, &outpos, &size, + Z_DVAL_P(tmp), + width, padding, alignment, + precision, adjusting, + format[inpos], always_sign + TSRMLS_CC); + break; + + case 'c': + convert_to_long(tmp); + php_sprintf_appendchar(&result, &outpos, &size, + (char) Z_LVAL_P(tmp) TSRMLS_CC); + break; + + case 'o': + convert_to_long(tmp); + php_sprintf_append2n(&result, &outpos, &size, + Z_LVAL_P(tmp), + width, padding, alignment, 3, + hexchars, expprec); + break; + + case 'x': + convert_to_long(tmp); + php_sprintf_append2n(&result, &outpos, &size, + Z_LVAL_P(tmp), + width, padding, alignment, 4, + hexchars, expprec); + break; + + case 'X': + convert_to_long(tmp); + php_sprintf_append2n(&result, &outpos, &size, + Z_LVAL_P(tmp), + width, padding, alignment, 4, + HEXCHARS, expprec); + break; + + case 'b': + convert_to_long(tmp); + php_sprintf_append2n(&result, &outpos, &size, + Z_LVAL_P(tmp), + width, padding, alignment, 1, + hexchars, expprec); + break; + + case '%': + php_sprintf_appendchar(&result, &outpos, &size, '%' TSRMLS_CC); + + break; + default: + break; + } + if (multiuse) { + zval_ptr_dtor(&tmp); + } + inpos++; + } + } + + efree(args); + + /* possibly, we have to make sure we have room for the terminating null? */ + result[outpos]=0; + *len = outpos; + return result; +} +/* }}} */ + +/* {{{ proto string sprintf(string format [, mixed arg1 [, mixed ...]]) + Return a formatted string */ +PHP_FUNCTION(user_sprintf) +{ + char *result; + int len; + + if ((result=php_formatted_print(ht, &len, 0, 0 TSRMLS_CC))==NULL) { + RETURN_FALSE; + } + RETVAL_STRINGL(result, len, 0); +} +/* }}} */ + +/* {{{ proto string vsprintf(string format, array args) + Return a formatted string */ +PHP_FUNCTION(vsprintf) +{ + char *result; + int len; + + if ((result=php_formatted_print(ht, &len, 1, 0 TSRMLS_CC))==NULL) { + RETURN_FALSE; + } + RETVAL_STRINGL(result, len, 0); +} +/* }}} */ + +/* {{{ proto int printf(string format [, mixed arg1 [, mixed ...]]) + Output a formatted string */ +PHP_FUNCTION(user_printf) +{ + char *result; + int len, rlen; + + if ((result=php_formatted_print(ht, &len, 0, 0 TSRMLS_CC))==NULL) { + RETURN_FALSE; + } + rlen = PHPWRITE(result, len); + efree(result); + RETURN_LONG(rlen); +} +/* }}} */ + +/* {{{ proto int vprintf(string format, array args) + Output a formatted string */ +PHP_FUNCTION(vprintf) +{ + char *result; + int len, rlen; + + if ((result=php_formatted_print(ht, &len, 1, 0 TSRMLS_CC))==NULL) { + RETURN_FALSE; + } + rlen = PHPWRITE(result, len); + efree(result); + RETURN_LONG(rlen); +} +/* }}} */ + +/* {{{ proto int fprintf(resource stream, string format [, mixed arg1 [, mixed ...]]) + Output a formatted string into a stream */ +PHP_FUNCTION(fprintf) +{ + php_stream *stream; + zval *arg1; + char *result; + int len; + + if (ZEND_NUM_ARGS() < 2) { + WRONG_PARAM_COUNT; + } + + if (zend_parse_parameters(1 TSRMLS_CC, "r", &arg1) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, &arg1); + + if ((result=php_formatted_print(ht, &len, 0, 1 TSRMLS_CC))==NULL) { + RETURN_FALSE; + } + + php_stream_write(stream, result, len); + + efree(result); + + RETURN_LONG(len); +} +/* }}} */ + +/* {{{ proto int vfprintf(resource stream, string format, array args) + Output a formatted string into a stream */ +PHP_FUNCTION(vfprintf) +{ + php_stream *stream; + zval *arg1; + char *result; + int len; + + if (ZEND_NUM_ARGS() != 3) { + WRONG_PARAM_COUNT; + } + + if (zend_parse_parameters(1 TSRMLS_CC, "r", &arg1) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, &arg1); + + if ((result=php_formatted_print(ht, &len, 1, 1 TSRMLS_CC))==NULL) { + RETURN_FALSE; + } + + php_stream_write(stream, result, len); + + efree(result); + + RETURN_LONG(len); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c new file mode 100644 index 0000000..b7d5335 --- /dev/null +++ b/ext/standard/fsock.c @@ -0,0 +1,141 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Paul Panotzki - Bunyip Information Systems | + | Jim Winstead | + | Sascha Schumann | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "php_globals.h" +#include +#include +#include "php_network.h" +#include "file.h" + +/* {{{ php_fsockopen() */ + +static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) +{ + char *host; + int host_len; + long port = -1; + zval *zerrno = NULL, *zerrstr = NULL; + double timeout = FG(default_socket_timeout); + unsigned long conv; + struct timeval tv; + char *hashkey = NULL; + php_stream *stream = NULL; + int err; + char *hostname = NULL; + long hostname_len; + char *errstr = NULL; + + RETVAL_FALSE; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lzzd", &host, &host_len, &port, &zerrno, &zerrstr, &timeout) == FAILURE) { + RETURN_FALSE; + } + + if (persistent) { + spprintf(&hashkey, 0, "pfsockopen__%s:%ld", host, port); + } + + if (port > 0) { + hostname_len = spprintf(&hostname, 0, "%s:%ld", host, port); + } else { + hostname_len = host_len; + hostname = host; + } + + /* prepare the timeout value for use */ + conv = (unsigned long) (timeout * 1000000.0); + tv.tv_sec = conv / 1000000; + tv.tv_usec = conv % 1000000; + + if (zerrno) { + zval_dtor(zerrno); + ZVAL_LONG(zerrno, 0); + } + if (zerrstr) { + zval_dtor(zerrstr); + ZVAL_STRING(zerrstr, "", 1); + } + + stream = php_stream_xport_create(hostname, hostname_len, REPORT_ERRORS, + STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, hashkey, &tv, NULL, &errstr, &err); + + if (port > 0) { + efree(hostname); + } + if (stream == NULL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s:%ld (%s)", host, port, errstr == NULL ? "Unknown error" : errstr); + } + + if (hashkey) { + efree(hashkey); + } + + if (stream == NULL) { + if (zerrno) { + zval_dtor(zerrno); + ZVAL_LONG(zerrno, err); + } + if (zerrstr && errstr) { + /* no need to dup; we need to efree buf anyway */ + zval_dtor(zerrstr); + ZVAL_STRING(zerrstr, errstr, 0); + } + else if (!zerrstr && errstr) { + efree(errstr); + } + + RETURN_FALSE; + } + + if (errstr) { + efree(errstr); + } + + php_stream_to_zval(stream, return_value); +} + +/* }}} */ + +/* {{{ proto resource fsockopen(string hostname, int port [, int errno [, string errstr [, float timeout]]]) + Open Internet or Unix domain socket connection */ +PHP_FUNCTION(fsockopen) +{ + php_fsockopen_stream(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ +/* {{{ proto resource pfsockopen(string hostname, int port [, int errno [, string errstr [, float timeout]]]) + Open persistent Internet or Unix domain socket connection */ +PHP_FUNCTION(pfsockopen) +{ + php_fsockopen_stream(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/fsock.h b/ext/standard/fsock.h new file mode 100644 index 0000000..70d0a5b --- /dev/null +++ b/ext/standard/fsock.h @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Paul Panotzki - Bunyip Information Systems | + | Jim Winstead | + | Wez Furlong | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +/* Synced with php 3.0 revision 1.24 1999-06-18 [ssb] */ + +#ifndef FSOCK_H +#define FSOCK_H + +#include "file.h" + +#include "php_network.h" + +PHP_FUNCTION(fsockopen); +PHP_FUNCTION(pfsockopen); + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim: sw=4 ts=4 + */ +#endif /* FSOCK_H */ diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c new file mode 100644 index 0000000..3b01059 --- /dev/null +++ b/ext/standard/ftok.c @@ -0,0 +1,71 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Andrew Sitnikov | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" + +#include + +#ifdef HAVE_SYS_IPC_H +#include +#endif + +#if HAVE_FTOK +/* {{{ proto int ftok(string pathname, string proj) + Convert a pathname and a project identifier to a System V IPC key */ +PHP_FUNCTION(ftok) +{ + char *pathname, *proj; + int pathname_len, proj_len; + key_t k; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &pathname, &pathname_len, &proj, &proj_len) == FAILURE) { + return; + } + + if (pathname_len == 0){ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Pathname is invalid"); + RETURN_LONG(-1); + } + + if (proj_len != 1){ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Project identifier is invalid"); + RETURN_LONG(-1); + } + + if (php_check_open_basedir(pathname TSRMLS_CC)) { + RETURN_LONG(-1); + } + + k = ftok(pathname, proj[0]); + if (k == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "ftok() failed - %s", strerror(errno)); + } + + RETURN_LONG(k); +} +/* }}} */ +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c new file mode 100644 index 0000000..3732939 --- /dev/null +++ b/ext/standard/ftp_fopen_wrapper.c @@ -0,0 +1,1204 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Jim Winstead | + | Hartmut Holzgraefe | + | Sara Golemon | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#include "php.h" +#include "php_globals.h" +#include "php_network.h" +#include "php_ini.h" + +#include +#include +#include +#include +#include +#include + +#ifdef PHP_WIN32 +#include +#define O_RDONLY _O_RDONLY +#include "win32/param.h" +#else +#include +#endif + +#include "php_standard.h" + +#include +#if HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef PHP_WIN32 +#include +#elif defined(NETWARE) && defined(USE_WINSOCK) +#include +#else +#include +#include +#if HAVE_ARPA_INET_H +#include +#endif +#endif + +#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE) +#undef AF_UNIX +#endif + +#if defined(AF_UNIX) +#include +#endif + +#include "php_fopen_wrappers.h" + +#define FTPS_ENCRYPT_DATA 1 +#define GET_FTP_RESULT(stream) get_ftp_result((stream), tmp_line, sizeof(tmp_line) TSRMLS_CC) + +typedef struct _php_ftp_dirstream_data { + php_stream *datastream; + php_stream *controlstream; + php_stream *dirstream; +} php_ftp_dirstream_data; + +/* {{{ get_ftp_result + */ +static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer_size TSRMLS_DC) +{ + while (php_stream_gets(stream, buffer, buffer_size-1) && + !(isdigit((int) buffer[0]) && isdigit((int) buffer[1]) && + isdigit((int) buffer[2]) && buffer[3] == ' ')); + return strtol(buffer, NULL, 10); +} +/* }}} */ + +/* {{{ php_stream_ftp_stream_stat + */ +static int php_stream_ftp_stream_stat(php_stream_wrapper *wrapper, php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) +{ + /* For now, we return with a failure code to prevent the underlying + * file's details from being used instead. */ + return -1; +} +/* }}} */ + +/* {{{ php_stream_ftp_stream_close + */ +static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper, php_stream *stream TSRMLS_DC) +{ + php_stream *controlstream = stream->wrapperthis; + int ret = 0; + + if (controlstream) { + if (strpbrk(stream->mode, "wa+")) { + char tmp_line[512]; + int result; + + /* For write modes close data stream first to signal EOF to server */ + result = GET_FTP_RESULT(controlstream); + if (result != 226 && result != 250) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "FTP server error %d:%s", result, tmp_line); + ret = EOF; + } + } + + php_stream_write_string(controlstream, "QUIT\r\n"); + php_stream_close(controlstream); + stream->wrapperthis = NULL; + } + + return ret; +} +/* }}} */ + +/* {{{ php_ftp_fopen_connect + */ +static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context, + php_stream **preuseid, php_url **presource, int *puse_ssl, int *puse_ssl_on_data TSRMLS_DC) +{ + php_stream *stream = NULL, *reuseid = NULL; + php_url *resource = NULL; + int result, use_ssl, use_ssl_on_data = 0, tmp_len; + char tmp_line[512]; + char *transport; + int transport_len; + + resource = php_url_parse(path); + if (resource == NULL || resource->path == NULL) { + if (resource && presource) { + *presource = resource; + } + return NULL; + } + + use_ssl = resource->scheme && (strlen(resource->scheme) > 3) && resource->scheme[3] == 's'; + + /* use port 21 if one wasn't specified */ + if (resource->port == 0) + resource->port = 21; + + transport_len = spprintf(&transport, 0, "tcp://%s:%d", resource->host, resource->port); + stream = php_stream_xport_create(transport, transport_len, REPORT_ERRORS, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, NULL, NULL, context, NULL, NULL); + efree(transport); + if (stream == NULL) { + result = 0; /* silence */ + goto connect_errexit; + } + + php_stream_context_set(stream, context); + php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0); + + /* Start talking to ftp server */ + result = GET_FTP_RESULT(stream); + if (result > 299 || result < 200) { + php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE, tmp_line, result); + goto connect_errexit; + } + + if (use_ssl) { + + /* send the AUTH TLS request name */ + php_stream_write_string(stream, "AUTH TLS\r\n"); + + /* get the response */ + result = GET_FTP_RESULT(stream); + if (result != 234) { + /* AUTH TLS not supported try AUTH SSL */ + php_stream_write_string(stream, "AUTH SSL\r\n"); + + /* get the response */ + result = GET_FTP_RESULT(stream); + if (result != 334) { + use_ssl = 0; + } else { + /* we must reuse the old SSL session id */ + /* if we talk to an old ftpd-ssl */ + reuseid = stream; + } + } else { + /* encrypt data etc */ + + + } + + } + + if (use_ssl) { + if (php_stream_xport_crypto_setup(stream, + STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 + || php_stream_xport_crypto_enable(stream, 1 TSRMLS_CC) < 0) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode"); + php_stream_close(stream); + stream = NULL; + goto connect_errexit; + } + + /* set PBSZ to 0 */ + php_stream_write_string(stream, "PBSZ 0\r\n"); + + /* ignore the response */ + result = GET_FTP_RESULT(stream); + + /* set data connection protection level */ +#if FTPS_ENCRYPT_DATA + php_stream_write_string(stream, "PROT P\r\n"); + + /* get the response */ + result = GET_FTP_RESULT(stream); + use_ssl_on_data = (result >= 200 && result<=299) || reuseid; +#else + php_stream_write_string(stream, "PROT C\r\n"); + + /* get the response */ + result = GET_FTP_RESULT(stream); +#endif + } + +#define PHP_FTP_CNTRL_CHK(val, val_len, err_msg) { \ + unsigned char *s = val, *e = s + val_len; \ + while (s < e) { \ + if (iscntrl(*s)) { \ + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, err_msg, val); \ + goto connect_errexit; \ + } \ + s++; \ + } \ +} + + /* send the user name */ + if (resource->user != NULL) { + tmp_len = php_raw_url_decode(resource->user, strlen(resource->user)); + + PHP_FTP_CNTRL_CHK(resource->user, tmp_len, "Invalid login %s") + + php_stream_printf(stream TSRMLS_CC, "USER %s\r\n", resource->user); + } else { + php_stream_write_string(stream, "USER anonymous\r\n"); + } + + /* get the response */ + result = GET_FTP_RESULT(stream); + + /* if a password is required, send it */ + if (result >= 300 && result <= 399) { + php_stream_notify_info(context, PHP_STREAM_NOTIFY_AUTH_REQUIRED, tmp_line, 0); + + if (resource->pass != NULL) { + tmp_len = php_raw_url_decode(resource->pass, strlen(resource->pass)); + + PHP_FTP_CNTRL_CHK(resource->pass, tmp_len, "Invalid password %s") + + php_stream_printf(stream TSRMLS_CC, "PASS %s\r\n", resource->pass); + } else { + /* if the user has configured who they are, + send that as the password */ + if (FG(from_address)) { + php_stream_printf(stream TSRMLS_CC, "PASS %s\r\n", FG(from_address)); + } else { + php_stream_write_string(stream, "PASS anonymous\r\n"); + } + } + + /* read the response */ + result = GET_FTP_RESULT(stream); + + if (result > 299 || result < 200) { + php_stream_notify_error(context, PHP_STREAM_NOTIFY_AUTH_RESULT, tmp_line, result); + } else { + php_stream_notify_info(context, PHP_STREAM_NOTIFY_AUTH_RESULT, tmp_line, result); + } + } + if (result > 299 || result < 200) { + goto connect_errexit; + } + + if (puse_ssl) { + *puse_ssl = use_ssl; + } + if (puse_ssl_on_data) { + *puse_ssl_on_data = use_ssl_on_data; + } + if (preuseid) { + *preuseid = reuseid; + } + if (presource) { + *presource = resource; + } + + return stream; + +connect_errexit: + if (resource) { + php_url_free(resource); + } + + if (stream) { + php_stream_close(stream); + } + + return NULL; +} +/* }}} */ + +/* {{{ php_fopen_do_pasv + */ +static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, size_t ip_size, char **phoststart TSRMLS_DC) +{ + char tmp_line[512]; + int result, i; + unsigned short portno; + char *tpath, *ttpath, *hoststart=NULL; + +#ifdef HAVE_IPV6 + /* We try EPSV first, needed for IPv6 and works on some IPv4 servers */ + php_stream_write_string(stream, "EPSV\r\n"); + result = GET_FTP_RESULT(stream); + + /* check if we got a 229 response */ + if (result != 229) { +#endif + /* EPSV failed, let's try PASV */ + php_stream_write_string(stream, "PASV\r\n"); + result = GET_FTP_RESULT(stream); + + /* make sure we got a 227 response */ + if (result != 227) { + return 0; + } + + /* parse pasv command (129, 80, 95, 25, 13, 221) */ + tpath = tmp_line; + /* skip over the "227 Some message " part */ + for (tpath += 4; *tpath && !isdigit((int) *tpath); tpath++); + if (!*tpath) { + return 0; + } + /* skip over the host ip, to get the port */ + hoststart = tpath; + for (i = 0; i < 4; i++) { + for (; isdigit((int) *tpath); tpath++); + if (*tpath != ',') { + return 0; + } + *tpath='.'; + tpath++; + } + tpath[-1] = '\0'; + memcpy(ip, hoststart, ip_size); + ip[ip_size-1] = '\0'; + hoststart = ip; + + /* pull out the MSB of the port */ + portno = (unsigned short) strtoul(tpath, &ttpath, 10) * 256; + if (ttpath == NULL) { + /* didn't get correct response from PASV */ + return 0; + } + tpath = ttpath; + if (*tpath != ',') { + return 0; + } + tpath++; + /* pull out the LSB of the port */ + portno += (unsigned short) strtoul(tpath, &ttpath, 10); +#ifdef HAVE_IPV6 + } else { + /* parse epsv command (|||6446|) */ + for (i = 0, tpath = tmp_line + 4; *tpath; tpath++) { + if (*tpath == '|') { + i++; + if (i == 3) + break; + } + } + if (i < 3) { + return 0; + } + /* pull out the port */ + portno = (unsigned short) strtoul(tpath + 1, &ttpath, 10); + } +#endif + if (ttpath == NULL) { + /* didn't get correct response from EPSV/PASV */ + return 0; + } + + if (phoststart) { + *phoststart = hoststart; + } + + return portno; +} +/* }}} */ + +/* {{{ php_fopen_url_wrap_ftp + */ +php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) +{ + php_stream *stream = NULL, *datastream = NULL; + php_url *resource = NULL; + char tmp_line[512]; + char ip[sizeof("123.123.123.123")]; + unsigned short portno; + char *hoststart = NULL; + int result = 0, use_ssl, use_ssl_on_data=0; + php_stream *reuseid=NULL; + size_t file_size = 0; + zval **tmpzval; + int allow_overwrite = 0; + int read_write = 0; + char *transport; + int transport_len; + + tmp_line[0] = '\0'; + + if (strpbrk(mode, "r+")) { + read_write = 1; /* Open for reading */ + } + if (strpbrk(mode, "wa+")) { + if (read_write) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP does not support simultaneous read/write connections"); + return NULL; + } + if (strchr(mode, 'a')) { + read_write = 3; /* Open for Appending */ + } else { + read_write = 2; /* Open for writting */ + } + } + if (!read_write) { + /* No mode specified? */ + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unknown file open mode"); + return NULL; + } + + if (context && + php_stream_context_get_option(context, "ftp", "proxy", &tmpzval) == SUCCESS) { + if (read_write == 1) { + /* Use http wrapper to proxy ftp request */ + return php_stream_url_wrap_http(wrapper, path, mode, options, opened_path, context STREAMS_CC TSRMLS_CC); + } else { + /* ftp proxy is read-only */ + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP proxy may only be used in read mode"); + return NULL; + } + } + + stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &resource, &use_ssl, &use_ssl_on_data TSRMLS_CC); + if (!stream) { + goto errexit; + } + + /* set the connection to be binary */ + php_stream_write_string(stream, "TYPE I\r\n"); + result = GET_FTP_RESULT(stream); + if (result > 299 || result < 200) + goto errexit; + + /* find out the size of the file (verifying it exists) */ + php_stream_printf(stream TSRMLS_CC, "SIZE %s\r\n", resource->path); + + /* read the response */ + result = GET_FTP_RESULT(stream); + if (read_write == 1) { + /* Read Mode */ + char *sizestr; + + /* when reading file, it must exist */ + if (result > 299 || result < 200) { + errno = ENOENT; + goto errexit; + } + + sizestr = strchr(tmp_line, ' '); + if (sizestr) { + sizestr++; + file_size = atoi(sizestr); + php_stream_notify_file_size(context, file_size, tmp_line, result); + } + } else if (read_write == 2) { + /* when writing file (but not appending), it must NOT exist, unless a context option exists which allows it */ + if (context && php_stream_context_get_option(context, "ftp", "overwrite", &tmpzval) == SUCCESS) { + allow_overwrite = Z_LVAL_PP(tmpzval); + } + if (result <= 299 && result >= 200) { + if (allow_overwrite) { + /* Context permits overwritting file, + so we just delete whatever's there in preparation */ + php_stream_printf(stream TSRMLS_CC, "DELE %s\r\n", resource->path); + result = GET_FTP_RESULT(stream); + if (result >= 300 || result <= 199) { + goto errexit; + } + } else { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Remote file already exists and overwrite context option not specified"); + errno = EEXIST; + goto errexit; + } + } + } + + /* set up the passive connection */ + portno = php_fopen_do_pasv(stream, ip, sizeof(ip), &hoststart TSRMLS_CC); + + if (!portno) { + goto errexit; + } + + /* Send RETR/STOR command */ + if (read_write == 1) { + /* set resume position if applicable */ + if (context && + php_stream_context_get_option(context, "ftp", "resume_pos", &tmpzval) == SUCCESS && + Z_TYPE_PP(tmpzval) == IS_LONG && + Z_LVAL_PP(tmpzval) > 0) { + php_stream_printf(stream TSRMLS_CC, "REST %ld\r\n", Z_LVAL_PP(tmpzval)); + result = GET_FTP_RESULT(stream); + if (result < 300 || result > 399) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to resume from offset %ld", Z_LVAL_PP(tmpzval)); + goto errexit; + } + } + + /* retrieve file */ + memcpy(tmp_line, "RETR", sizeof("RETR")); + } else if (read_write == 2) { + /* Write new file */ + memcpy(tmp_line, "STOR", sizeof("STOR")); + } else { + /* Append */ + memcpy(tmp_line, "APPE", sizeof("APPE")); + } + php_stream_printf(stream TSRMLS_CC, "%s %s\r\n", tmp_line, (resource->path != NULL ? resource->path : "/")); + + /* open the data channel */ + if (hoststart == NULL) { + hoststart = resource->host; + } + transport_len = spprintf(&transport, 0, "tcp://%s:%d", hoststart, portno); + datastream = php_stream_xport_create(transport, transport_len, REPORT_ERRORS, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, NULL, NULL, context, NULL, NULL); + efree(transport); + if (datastream == NULL) { + goto errexit; + } + + result = GET_FTP_RESULT(stream); + if (result != 150 && result != 125) { + /* Could not retrieve or send the file + * this data will only be sent to us after connection on the data port was initiated. + */ + php_stream_close(datastream); + datastream = NULL; + goto errexit; + } + + php_stream_context_set(datastream, context); + php_stream_notify_progress_init(context, 0, file_size); + + if (use_ssl_on_data && (php_stream_xport_crypto_setup(datastream, + STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 || + php_stream_xport_crypto_enable(datastream, 1 TSRMLS_CC) < 0)) { + + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode"); + php_stream_close(datastream); + datastream = NULL; + goto errexit; + } + + /* remember control stream */ + datastream->wrapperthis = stream; + + php_url_free(resource); + return datastream; + +errexit: + if (resource) { + php_url_free(resource); + } + if (stream) { + php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE, tmp_line, result); + php_stream_close(stream); + } + if (tmp_line[0] != '\0') + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP server reports %s", tmp_line); + return NULL; +} +/* }}} */ + +/* {{{ php_ftp_dirsteam_read + */ +static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) +{ + php_stream_dirent *ent = (php_stream_dirent *)buf; + php_stream *innerstream; + size_t tmp_len; + char *basename; + size_t basename_len; + + innerstream = ((php_ftp_dirstream_data *)stream->abstract)->datastream; + + if (count != sizeof(php_stream_dirent)) { + return 0; + } + + if (php_stream_eof(innerstream)) { + return 0; + } + + if (!php_stream_get_line(innerstream, ent->d_name, sizeof(ent->d_name), &tmp_len)) { + return 0; + } + + php_basename(ent->d_name, tmp_len, NULL, 0, &basename, &basename_len TSRMLS_CC); + if (!basename) { + return 0; + } + + if (!basename_len) { + efree(basename); + return 0; + } + + tmp_len = MIN(sizeof(ent->d_name), basename_len - 1); + memcpy(ent->d_name, basename, tmp_len); + ent->d_name[tmp_len - 1] = '\0'; + efree(basename); + + /* Trim off trailing whitespace characters */ + tmp_len--; + while (tmp_len >= 0 && + (ent->d_name[tmp_len] == '\n' || ent->d_name[tmp_len] == '\r' || + ent->d_name[tmp_len] == '\t' || ent->d_name[tmp_len] == ' ')) { + ent->d_name[tmp_len--] = '\0'; + } + + return sizeof(php_stream_dirent); +} +/* }}} */ + +/* {{{ php_ftp_dirstream_close + */ +static int php_ftp_dirstream_close(php_stream *stream, int close_handle TSRMLS_DC) +{ + php_ftp_dirstream_data *data = stream->abstract; + + /* close control connection */ + if (data->controlstream) { + php_stream_close(data->controlstream); + data->controlstream = NULL; + } + /* close data connection */ + php_stream_close(data->datastream); + data->datastream = NULL; + + efree(data); + stream->abstract = NULL; + + return 0; +} +/* }}} */ + +/* ftp dirstreams only need to support read and close operations, + They can't be rewound because the underlying ftp stream can't be rewound. */ +static php_stream_ops php_ftp_dirstream_ops = { + NULL, /* write */ + php_ftp_dirstream_read, /* read */ + php_ftp_dirstream_close, /* close */ + NULL, /* flush */ + "ftpdir", + NULL, /* rewind */ + NULL, /* cast */ + NULL, /* stat */ + NULL /* set option */ +}; + +/* {{{ php_stream_ftp_opendir + */ +php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) +{ + php_stream *stream, *reuseid, *datastream = NULL; + php_ftp_dirstream_data *dirsdata; + php_url *resource = NULL; + int result = 0, use_ssl, use_ssl_on_data = 0; + char *hoststart = NULL, tmp_line[512]; + char ip[sizeof("123.123.123.123")]; + unsigned short portno; + + tmp_line[0] = '\0'; + + stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &resource, &use_ssl, &use_ssl_on_data TSRMLS_CC); + if (!stream) { + goto opendir_errexit; + } + + /* set the connection to be ascii */ + php_stream_write_string(stream, "TYPE A\r\n"); + result = GET_FTP_RESULT(stream); + if (result > 299 || result < 200) + goto opendir_errexit; + + /* set up the passive connection */ + portno = php_fopen_do_pasv(stream, ip, sizeof(ip), &hoststart TSRMLS_CC); + + if (!portno) { + goto opendir_errexit; + } + + php_stream_printf(stream TSRMLS_CC, "NLST %s\r\n", (resource->path != NULL ? resource->path : "/")); + + /* open the data channel */ + if (hoststart == NULL) { + hoststart = resource->host; + } + datastream = php_stream_sock_open_host(hoststart, portno, SOCK_STREAM, 0, 0); + if (datastream == NULL) { + goto opendir_errexit; + } + + result = GET_FTP_RESULT(stream); + if (result != 150 && result != 125) { + /* Could not retrieve or send the file + * this data will only be sent to us after connection on the data port was initiated. + */ + php_stream_close(datastream); + datastream = NULL; + goto opendir_errexit; + } + + php_stream_context_set(datastream, context); + + if (use_ssl_on_data && (php_stream_xport_crypto_setup(stream, + STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 || + php_stream_xport_crypto_enable(stream, 1 TSRMLS_CC) < 0)) { + + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode"); + php_stream_close(datastream); + datastream = NULL; + goto opendir_errexit; + } + + php_url_free(resource); + + dirsdata = emalloc(sizeof *dirsdata); + dirsdata->datastream = datastream; + dirsdata->controlstream = stream; + dirsdata->dirstream = php_stream_alloc(&php_ftp_dirstream_ops, dirsdata, 0, mode); + + return dirsdata->dirstream; + +opendir_errexit: + if (resource) { + php_url_free(resource); + } + if (stream) { + php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE, tmp_line, result); + php_stream_close(stream); + } + if (tmp_line[0] != '\0') { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP server reports %s", tmp_line); + } + return NULL; +} +/* }}} */ + +/* {{{ php_stream_ftp_url_stat + */ +static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) +{ + php_stream *stream = NULL; + php_url *resource = NULL; + int result; + char tmp_line[512]; + + /* If ssb is NULL then someone is misbehaving */ + if (!ssb) return -1; + + stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL TSRMLS_CC); + if (!stream) { + goto stat_errexit; + } + + ssb->sb.st_mode = 0644; /* FTP won't give us a valid mode, so aproximate one based on being readable */ + php_stream_printf(stream TSRMLS_CC, "CWD %s\r\n", (resource->path != NULL ? resource->path : "/")); /* If we can CWD to it, it's a directory (maybe a link, but we can't tell) */ + result = GET_FTP_RESULT(stream); + if (result < 200 || result > 299) { + ssb->sb.st_mode |= S_IFREG; + } else { + ssb->sb.st_mode |= S_IFDIR; + } + + php_stream_write_string(stream, "TYPE I\r\n"); /* we need this since some servers refuse to accept SIZE command in ASCII mode */ + + result = GET_FTP_RESULT(stream); + + if(result < 200 || result > 299) { + goto stat_errexit; + } + + php_stream_printf(stream TSRMLS_CC, "SIZE %s\r\n", (resource->path != NULL ? resource->path : "/")); + result = GET_FTP_RESULT(stream); + if (result < 200 || result > 299) { + /* Failure either means it doesn't exist + or it's a directory and this server + fails on listing directory sizes */ + if (ssb->sb.st_mode & S_IFDIR) { + ssb->sb.st_size = 0; + } else { + goto stat_errexit; + } + } else { + ssb->sb.st_size = atoi(tmp_line + 4); + } + + php_stream_printf(stream TSRMLS_CC, "MDTM %s\r\n", (resource->path != NULL ? resource->path : "/")); + result = GET_FTP_RESULT(stream); + if (result == 213) { + char *p = tmp_line + 4; + int n; + struct tm tm, tmbuf, *gmt; + time_t stamp; + + while (p - tmp_line < sizeof(tmp_line) && !isdigit(*p)) { + p++; + } + + if (p - tmp_line > sizeof(tmp_line)) { + goto mdtm_error; + } + + n = sscanf(p, "%4u%2u%2u%2u%2u%2u", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec); + if (n != 6) { + goto mdtm_error; + } + + tm.tm_year -= 1900; + tm.tm_mon--; + tm.tm_isdst = -1; + + /* figure out the GMT offset */ + stamp = time(NULL); + gmt = php_gmtime_r(&stamp, &tmbuf); + if (!gmt) { + goto mdtm_error; + } + gmt->tm_isdst = -1; + + /* apply the GMT offset */ + tm.tm_sec += stamp - mktime(gmt); + tm.tm_isdst = gmt->tm_isdst; + + ssb->sb.st_mtime = mktime(&tm); + } else { + /* error or unsupported command */ +mdtm_error: + ssb->sb.st_mtime = -1; + } + + ssb->sb.st_ino = 0; /* Unknown values */ + ssb->sb.st_dev = 0; + ssb->sb.st_uid = 0; + ssb->sb.st_gid = 0; + ssb->sb.st_atime = -1; + ssb->sb.st_ctime = -1; + + ssb->sb.st_nlink = 1; + ssb->sb.st_rdev = -1; +#ifdef HAVE_ST_BLKSIZE + ssb->sb.st_blksize = 4096; /* Guess since FTP won't expose this information */ +#ifdef HAVE_ST_BLOCKS + ssb->sb.st_blocks = (int)((4095 + ssb->sb.st_size) / ssb->sb.st_blksize); /* emulate ceil */ +#endif +#endif + php_stream_close(stream); + php_url_free(resource); + return 0; + +stat_errexit: + if (resource) { + php_url_free(resource); + } + if (stream) { + php_stream_close(stream); + } + return -1; +} +/* }}} */ + +/* {{{ php_stream_ftp_unlink + */ +static int php_stream_ftp_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) +{ + php_stream *stream = NULL; + php_url *resource = NULL; + int result; + char tmp_line[512]; + + stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, NULL, NULL, &resource, NULL, NULL TSRMLS_CC); + if (!stream) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect to %s", url); + } + goto unlink_errexit; + } + + if (resource->path == NULL) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path provided in %s", url); + } + goto unlink_errexit; + } + + /* Attempt to delete the file */ + php_stream_printf(stream TSRMLS_CC, "DELE %s\r\n", (resource->path != NULL ? resource->path : "/")); + + result = GET_FTP_RESULT(stream); + if (result < 200 || result > 299) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error Deleting file: %s", tmp_line); + } + goto unlink_errexit; + } + + php_url_free(resource); + php_stream_close(stream); + return 1; + +unlink_errexit: + if (resource) { + php_url_free(resource); + } + if (stream) { + php_stream_close(stream); + } + return 0; +} +/* }}} */ + +/* {{{ php_stream_ftp_rename + */ +static int php_stream_ftp_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC) +{ + php_stream *stream = NULL; + php_url *resource_from = NULL, *resource_to = NULL; + int result; + char tmp_line[512]; + + resource_from = php_url_parse(url_from); + resource_to = php_url_parse(url_to); + /* Must be same scheme (ftp/ftp or ftps/ftps), same host, and same port + (or a 21/0 0/21 combination which is also "same") + Also require paths to/from */ + if (!resource_from || + !resource_to || + !resource_from->scheme || + !resource_to->scheme || + strcmp(resource_from->scheme, resource_to->scheme) || + !resource_from->host || + !resource_to->host || + strcmp(resource_from->host, resource_to->host) || + (resource_from->port != resource_to->port && + resource_from->port * resource_to->port != 0 && + resource_from->port + resource_to->port != 21) || + !resource_from->path || + !resource_to->path) { + goto rename_errexit; + } + + stream = php_ftp_fopen_connect(wrapper, url_from, "r", 0, NULL, NULL, NULL, NULL, NULL, NULL TSRMLS_CC); + if (!stream) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect to %s", resource_from->host); + } + goto rename_errexit; + } + + /* Rename FROM */ + php_stream_printf(stream TSRMLS_CC, "RNFR %s\r\n", (resource_from->path != NULL ? resource_from->path : "/")); + + result = GET_FTP_RESULT(stream); + if (result < 300 || result > 399) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error Renaming file: %s", tmp_line); + } + goto rename_errexit; + } + + /* Rename TO */ + php_stream_printf(stream TSRMLS_CC, "RNTO %s\r\n", (resource_to->path != NULL ? resource_to->path : "/")); + + result = GET_FTP_RESULT(stream); + if (result < 200 || result > 299) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error Renaming file: %s", tmp_line); + } + goto rename_errexit; + } + + php_url_free(resource_from); + php_url_free(resource_to); + php_stream_close(stream); + return 1; + +rename_errexit: + if (resource_from) { + php_url_free(resource_from); + } + if (resource_to) { + php_url_free(resource_to); + } + if (stream) { + php_stream_close(stream); + } + return 0; +} +/* }}} */ + +/* {{{ php_stream_ftp_mkdir + */ +static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, char *url, int mode, int options, php_stream_context *context TSRMLS_DC) +{ + php_stream *stream = NULL; + php_url *resource = NULL; + int result, recursive = options & PHP_STREAM_MKDIR_RECURSIVE; + char tmp_line[512]; + + stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, NULL, NULL, &resource, NULL, NULL TSRMLS_CC); + if (!stream) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect to %s", url); + } + goto mkdir_errexit; + } + + if (resource->path == NULL) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path provided in %s", url); + } + goto mkdir_errexit; + } + + if (!recursive) { + php_stream_printf(stream TSRMLS_CC, "MKD %s\r\n", resource->path); + result = GET_FTP_RESULT(stream); + } else { + /* we look for directory separator from the end of string, thus hopefuly reducing our work load */ + char *p, *e, *buf; + + buf = estrdup(resource->path); + e = buf + strlen(buf); + + /* find a top level directory we need to create */ + while ((p = strrchr(buf, '/'))) { + *p = '\0'; + php_stream_printf(stream TSRMLS_CC, "CWD %s\r\n", buf); + result = GET_FTP_RESULT(stream); + if (result >= 200 && result <= 299) { + *p = '/'; + break; + } + } + if (p == buf) { + php_stream_printf(stream TSRMLS_CC, "MKD %s\r\n", resource->path); + result = GET_FTP_RESULT(stream); + } else { + php_stream_printf(stream TSRMLS_CC, "MKD %s\r\n", buf); + result = GET_FTP_RESULT(stream); + if (result >= 200 && result <= 299) { + if (!p) { + p = buf; + } + /* create any needed directories if the creation of the 1st directory worked */ + while (++p != e) { + if (*p == '\0' && *(p + 1) != '\0') { + *p = '/'; + php_stream_printf(stream TSRMLS_CC, "MKD %s\r\n", buf); + result = GET_FTP_RESULT(stream); + if (result < 200 || result > 299) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", tmp_line); + } + break; + } + } + } + } + } + efree(buf); + } + + php_url_free(resource); + php_stream_close(stream); + + if (result < 200 || result > 299) { + /* Failure */ + return 0; + } + + return 1; + +mkdir_errexit: + if (resource) { + php_url_free(resource); + } + if (stream) { + php_stream_close(stream); + } + return 0; +} +/* }}} */ + +/* {{{ php_stream_ftp_rmdir + */ +static int php_stream_ftp_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) +{ + php_stream *stream = NULL; + php_url *resource = NULL; + int result; + char tmp_line[512]; + + stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, NULL, NULL, &resource, NULL, NULL TSRMLS_CC); + if (!stream) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect to %s", url); + } + goto rmdir_errexit; + } + + if (resource->path == NULL) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path provided in %s", url); + } + goto rmdir_errexit; + } + + php_stream_printf(stream TSRMLS_CC, "RMD %s\r\n", resource->path); + result = GET_FTP_RESULT(stream); + + if (result < 200 || result > 299) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", tmp_line); + } + goto rmdir_errexit; + } + + php_url_free(resource); + php_stream_close(stream); + + return 1; + +rmdir_errexit: + if (resource) { + php_url_free(resource); + } + if (stream) { + php_stream_close(stream); + } + return 0; +} +/* }}} */ + +static php_stream_wrapper_ops ftp_stream_wops = { + php_stream_url_wrap_ftp, + php_stream_ftp_stream_close, /* stream_close */ + php_stream_ftp_stream_stat, + php_stream_ftp_url_stat, /* stat_url */ + php_stream_ftp_opendir, /* opendir */ + "ftp", + php_stream_ftp_unlink, /* unlink */ + php_stream_ftp_rename, /* rename */ + php_stream_ftp_mkdir, /* mkdir */ + php_stream_ftp_rmdir /* rmdir */ +}; + +PHPAPI php_stream_wrapper php_stream_ftp_wrapper = { + &ftp_stream_wops, + NULL, + 1 /* is_url */ +}; + + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/head.c b/ext/standard/head.c new file mode 100644 index 0000000..97f61f2 --- /dev/null +++ b/ext/standard/head.c @@ -0,0 +1,321 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Rasmus Lerdorf | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#include +#include "php.h" +#include "ext/standard/php_standard.h" +#include "ext/date/php_date.h" +#include "SAPI.h" +#include "php_main.h" +#include "head.h" +#ifdef TM_IN_SYS_TIME +#include +#else +#include +#endif + +#include "php_globals.h" + + +/* Implementation of the language Header() function */ +/* {{{ proto void header(string header [, bool replace, [int http_response_code]]) + Sends a raw HTTP header */ +PHP_FUNCTION(header) +{ + zend_bool rep = 1; + sapi_header_line ctr = {0}; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &ctr.line, + &ctr.line_len, &rep, &ctr.response_code) == FAILURE) + return; + + sapi_header_op(rep ? SAPI_HEADER_REPLACE:SAPI_HEADER_ADD, &ctr TSRMLS_CC); +} +/* }}} */ + +/* {{{ proto void header_remove([string name]) + Removes an HTTP header previously set using header() */ +PHP_FUNCTION(header_remove) +{ + sapi_header_line ctr = {0}; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &ctr.line, + &ctr.line_len) == FAILURE) + return; + + sapi_header_op(ZEND_NUM_ARGS() == 0 ? SAPI_HEADER_DELETE_ALL : SAPI_HEADER_DELETE, &ctr TSRMLS_CC); +} +/* }}} */ + +PHPAPI int php_header(TSRMLS_D) +{ + if (sapi_send_headers(TSRMLS_C)==FAILURE || SG(request_info).headers_only) { + return 0; /* don't allow output */ + } else { + return 1; /* allow output */ + } +} + + +PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure, int url_encode, int httponly TSRMLS_DC) +{ + char *cookie, *encoded_value = NULL; + int len=sizeof("Set-Cookie: "); + char *dt; + sapi_header_line ctr = {0}; + int result; + + if (name && strpbrk(name, "=,; \t\r\n\013\014") != NULL) { /* man isspace for \013 and \014 */ + zend_error( E_WARNING, "Cookie names cannot contain any of the following '=,; \\t\\r\\n\\013\\014'" ); + return FAILURE; + } + + if (!url_encode && value && strpbrk(value, ",; \t\r\n\013\014") != NULL) { /* man isspace for \013 and \014 */ + zend_error( E_WARNING, "Cookie values cannot contain any of the following ',; \\t\\r\\n\\013\\014'" ); + return FAILURE; + } + + len += name_len; + if (value && url_encode) { + int encoded_value_len; + + encoded_value = php_url_encode(value, value_len, &encoded_value_len); + len += encoded_value_len; + } else if ( value ) { + encoded_value = estrdup(value); + len += value_len; + } + if (path) { + len += path_len; + } + if (domain) { + len += domain_len; + } + + cookie = emalloc(len + 100); + + if (value && value_len == 0) { + /* + * MSIE doesn't delete a cookie when you set it to a null value + * so in order to force cookies to be deleted, even on MSIE, we + * pick an expiry date in the past + */ + dt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, 1, 0 TSRMLS_CC); + snprintf(cookie, len + 100, "Set-Cookie: %s=deleted; expires=%s", name, dt); + efree(dt); + } else { + snprintf(cookie, len + 100, "Set-Cookie: %s=%s", name, value ? encoded_value : ""); + if (expires > 0) { + const char *p; + strlcat(cookie, "; expires=", len + 100); + dt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, expires, 0 TSRMLS_CC); + /* check to make sure that the year does not exceed 4 digits in length */ + p = zend_memrchr(dt, '-', strlen(dt)); + if (!p || *(p + 5) != ' ') { + efree(dt); + efree(cookie); + efree(encoded_value); + zend_error(E_WARNING, "Expiry date cannot have a year greater then 9999"); + return FAILURE; + } + strlcat(cookie, dt, len + 100); + efree(dt); + } + } + + if (encoded_value) { + efree(encoded_value); + } + + if (path && path_len > 0) { + strlcat(cookie, "; path=", len + 100); + strlcat(cookie, path, len + 100); + } + if (domain && domain_len > 0) { + strlcat(cookie, "; domain=", len + 100); + strlcat(cookie, domain, len + 100); + } + if (secure) { + strlcat(cookie, "; secure", len + 100); + } + if (httponly) { + strlcat(cookie, "; httponly", len + 100); + } + + ctr.line = cookie; + ctr.line_len = strlen(cookie); + + result = sapi_header_op(SAPI_HEADER_ADD, &ctr TSRMLS_CC); + efree(cookie); + return result; +} + + +/* php_set_cookie(name, value, expires, path, domain, secure) */ +/* {{{ proto bool setcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure[, bool httponly]]]]]]) + Send a cookie */ +PHP_FUNCTION(setcookie) +{ + char *name, *value = NULL, *path = NULL, *domain = NULL; + long expires = 0; + zend_bool secure = 0, httponly = 0; + int name_len, value_len = 0, path_len = 0, domain_len = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, + &name_len, &value, &value_len, &expires, &path, + &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) { + return; + } + + if (php_setcookie(name, name_len, value, value_len, expires, path, path_len, domain, domain_len, secure, 1, httponly TSRMLS_CC) == SUCCESS) { + RETVAL_TRUE; + } else { + RETVAL_FALSE; + } +} +/* }}} */ + +/* {{{ proto bool setrawcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure[, bool httponly]]]]]]) + Send a cookie with no url encoding of the value */ +PHP_FUNCTION(setrawcookie) +{ + char *name, *value = NULL, *path = NULL, *domain = NULL; + long expires = 0; + zend_bool secure = 0, httponly = 0; + int name_len, value_len = 0, path_len = 0, domain_len = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, + &name_len, &value, &value_len, &expires, &path, + &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) { + return; + } + + if (php_setcookie(name, name_len, value, value_len, expires, path, path_len, domain, domain_len, secure, 0, httponly TSRMLS_CC) == SUCCESS) { + RETVAL_TRUE; + } else { + RETVAL_FALSE; + } +} +/* }}} */ + + +/* {{{ proto bool headers_sent([string &$file [, int &$line]]) + Returns true if headers have already been sent, false otherwise */ +PHP_FUNCTION(headers_sent) +{ + zval *arg1 = NULL, *arg2 = NULL; + const char *file=""; + int line=0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zz", &arg1, &arg2) == FAILURE) + return; + + if (SG(headers_sent)) { + line = php_output_get_start_lineno(TSRMLS_C); + file = php_output_get_start_filename(TSRMLS_C); + } + + switch(ZEND_NUM_ARGS()) { + case 2: + zval_dtor(arg2); + ZVAL_LONG(arg2, line); + case 1: + zval_dtor(arg1); + if (file) { + ZVAL_STRING(arg1, file, 1); + } else { + ZVAL_STRING(arg1, "", 1); + } + break; + } + + if (SG(headers_sent)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ php_head_apply_header_list_to_hash + Turn an llist of sapi_header_struct headers into a numerically indexed zval hash */ +static void php_head_apply_header_list_to_hash(void *data, void *arg TSRMLS_DC) +{ + sapi_header_struct *sapi_header = (sapi_header_struct *)data; + + if (arg && sapi_header) { + add_next_index_string((zval *)arg, (char *)(sapi_header->header), 1); + } +} + +/* {{{ proto array headers_list(void) + Return list of headers to be sent / already sent */ +PHP_FUNCTION(headers_list) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + if (!&SG(sapi_headers).headers) { + RETURN_FALSE; + } + array_init(return_value); + zend_llist_apply_with_argument(&SG(sapi_headers).headers, php_head_apply_header_list_to_hash, return_value TSRMLS_CC); +} +/* }}} */ + +/* {{{ proto long http_response_code([int response_code]) + Sets a response code, or returns the current HTTP response code */ +PHP_FUNCTION(http_response_code) +{ + long response_code = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &response_code) == FAILURE) { + return; + } + + if (response_code) + { + long old_response_code; + + old_response_code = SG(sapi_headers).http_response_code; + SG(sapi_headers).http_response_code = response_code; + + if (old_response_code) { + RETURN_LONG(old_response_code); + } + + RETURN_TRUE; + } + + if (!SG(sapi_headers).http_response_code) { + RETURN_FALSE; + } + + RETURN_LONG(SG(sapi_headers).http_response_code); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 * End: + */ diff --git a/ext/standard/head.h b/ext/standard/head.h new file mode 100644 index 0000000..7d657ba --- /dev/null +++ b/ext/standard/head.h @@ -0,0 +1,36 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Rasmus Lerdorf | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef HEAD_H +#define HEAD_H + +extern PHP_RINIT_FUNCTION(head); +PHP_FUNCTION(header); +PHP_FUNCTION(header_remove); +PHP_FUNCTION(setcookie); +PHP_FUNCTION(setrawcookie); +PHP_FUNCTION(headers_sent); +PHP_FUNCTION(headers_list); +PHP_FUNCTION(http_response_code); + +PHPAPI int php_header(TSRMLS_D); +PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure, int url_encode, int httponly TSRMLS_DC); + +#endif diff --git a/ext/standard/html.c b/ext/standard/html.c new file mode 100644 index 0000000..414fa65 --- /dev/null +++ b/ext/standard/html.c @@ -0,0 +1,1708 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Jaakko HyvÀtti | + | Wez Furlong | + | Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +/* + * HTML entity resources: + * + * http://www.unicode.org/Public/MAPPINGS/OBSOLETE/UNI2SGML.TXT + * + * XHTML 1.0 DTD + * http://www.w3.org/TR/2002/REC-xhtml1-20020801/dtds.html#h-A2 + * + * From HTML 4.01 strict DTD: + * http://www.w3.org/TR/html4/HTMLlat1.ent + * http://www.w3.org/TR/html4/HTMLsymbol.ent + * http://www.w3.org/TR/html4/HTMLspecial.ent + * + * HTML 5: + * http://dev.w3.org/html5/spec/Overview.html#named-character-references + */ + +#include "php.h" +#if PHP_WIN32 +#include "config.w32.h" +#else +#include +#endif +#include "php_standard.h" +#include "php_string.h" +#include "SAPI.h" +#if HAVE_LOCALE_H +#include +#endif +#if HAVE_LANGINFO_H +#include +#endif + +#include +#include "html_tables.h" + +/* Macro for disabling flag of translation of non-basic entities where this isn't supported. + * Not appropriate for html_entity_decode/htmlspecialchars_decode */ +#define LIMIT_ALL(all, doctype, charset) do { \ + (all) = (all) && !CHARSET_PARTIAL_SUPPORT((charset)) && ((doctype) != ENT_HTML_DOC_XML1); \ +} while (0) + +#define MB_FAILURE(pos, advance) do { \ + *cursor = pos + (advance); \ + *status = FAILURE; \ + return 0; \ +} while (0) + +#define CHECK_LEN(pos, chars_need) ((str_len - (pos)) >= (chars_need)) + +/* valid as single byte character or leading byte */ +#define utf8_lead(c) ((c) < 0x80 || ((c) >= 0xC2 && (c) <= 0xF4)) +/* whether it's actually valid depends on other stuff; + * this macro cannot check for non-shortest forms, surrogates or + * code points above 0x10FFFF */ +#define utf8_trail(c) ((c) >= 0x80 && (c) <= 0xBF) + +#define gb2312_lead(c) ((c) != 0x8E && (c) != 0x8F && (c) != 0xA0 && (c) != 0xFF) +#define gb2312_trail(c) ((c) >= 0xA1 && (c) <= 0xFE) + +#define sjis_lead(c) ((c) != 0x80 && (c) != 0xA0 && (c) < 0xFD) +#define sjis_trail(c) ((c) >= 0x40 && (c) != 0x7F && (c) < 0xFD) + +/* {{{ get_next_char + */ +static inline unsigned int get_next_char( + enum entity_charset charset, + const unsigned char *str, + size_t str_len, + size_t *cursor, + int *status) +{ + size_t pos = *cursor; + unsigned int this_char = 0; + + *status = SUCCESS; + assert(pos <= str_len); + + if (!CHECK_LEN(pos, 1)) + MB_FAILURE(pos, 1); + + switch (charset) { + case cs_utf_8: + { + /* We'll follow strategy 2. from section 3.6.1 of UTR #36: + * "In a reported illegal byte sequence, do not include any + * non-initial byte that encodes a valid character or is a leading + * byte for a valid sequence." */ + unsigned char c; + c = str[pos]; + if (c < 0x80) { + this_char = c; + pos++; + } else if (c < 0xc2) { + MB_FAILURE(pos, 1); + } else if (c < 0xe0) { + if (!CHECK_LEN(pos, 2)) + MB_FAILURE(pos, 1); + + if (!utf8_trail(str[pos + 1])) { + MB_FAILURE(pos, utf8_lead(str[pos + 1]) ? 1 : 2); + } + this_char = ((c & 0x1f) << 6) | (str[pos + 1] & 0x3f); + if (this_char < 0x80) { /* non-shortest form */ + MB_FAILURE(pos, 2); + } + pos += 2; + } else if (c < 0xf0) { + size_t avail = str_len - pos; + + if (avail < 3 || + !utf8_trail(str[pos + 1]) || !utf8_trail(str[pos + 2])) { + if (avail < 2 || utf8_lead(str[pos + 1])) + MB_FAILURE(pos, 1); + else if (avail < 3 || utf8_lead(str[pos + 2])) + MB_FAILURE(pos, 2); + else + MB_FAILURE(pos, 3); + } + + this_char = ((c & 0x0f) << 12) | ((str[pos + 1] & 0x3f) << 6) | (str[pos + 2] & 0x3f); + if (this_char < 0x800) { /* non-shortest form */ + MB_FAILURE(pos, 3); + } else if (this_char >= 0xd800 && this_char <= 0xdfff) { /* surrogate */ + MB_FAILURE(pos, 3); + } + pos += 3; + } else if (c < 0xf5) { + size_t avail = str_len - pos; + + if (avail < 4 || + !utf8_trail(str[pos + 1]) || !utf8_trail(str[pos + 2]) || + !utf8_trail(str[pos + 3])) { + if (avail < 2 || utf8_lead(str[pos + 1])) + MB_FAILURE(pos, 1); + else if (avail < 3 || utf8_lead(str[pos + 2])) + MB_FAILURE(pos, 2); + else if (avail < 4 || utf8_lead(str[pos + 3])) + MB_FAILURE(pos, 3); + else + MB_FAILURE(pos, 4); + } + + this_char = ((c & 0x07) << 18) | ((str[pos + 1] & 0x3f) << 12) | ((str[pos + 2] & 0x3f) << 6) | (str[pos + 3] & 0x3f); + if (this_char < 0x10000 || this_char > 0x10FFFF) { /* non-shortest form or outside range */ + MB_FAILURE(pos, 4); + } + pos += 4; + } else { + MB_FAILURE(pos, 1); + } + } + break; + + case cs_big5: + /* reference http://demo.icu-project.org/icu-bin/convexp?conv=big5 */ + { + unsigned char c = str[pos]; + if (c >= 0x81 && c <= 0xFE) { + unsigned char next; + if (!CHECK_LEN(pos, 2)) + MB_FAILURE(pos, 1); + + next = str[pos + 1]; + + if ((next >= 0x40 && next <= 0x7E) || + (next >= 0xA1 && next <= 0xFE)) { + this_char = (c << 8) | next; + } else { + MB_FAILURE(pos, 1); + } + pos += 2; + } else { + this_char = c; + pos += 1; + } + } + break; + + case cs_big5hkscs: + { + unsigned char c = str[pos]; + if (c >= 0x81 && c <= 0xFE) { + unsigned char next; + if (!CHECK_LEN(pos, 2)) + MB_FAILURE(pos, 1); + + next = str[pos + 1]; + + if ((next >= 0x40 && next <= 0x7E) || + (next >= 0xA1 && next <= 0xFE)) { + this_char = (c << 8) | next; + } else if (next != 0x80 && next != 0xFF) { + MB_FAILURE(pos, 1); + } else { + MB_FAILURE(pos, 2); + } + pos += 2; + } else { + this_char = c; + pos += 1; + } + } + break; + + case cs_gb2312: /* EUC-CN */ + { + unsigned char c = str[pos]; + if (c >= 0xA1 && c <= 0xFE) { + unsigned char next; + if (!CHECK_LEN(pos, 2)) + MB_FAILURE(pos, 1); + + next = str[pos + 1]; + + if (gb2312_trail(next)) { + this_char = (c << 8) | next; + } else if (gb2312_lead(next)) { + MB_FAILURE(pos, 1); + } else { + MB_FAILURE(pos, 2); + } + pos += 2; + } else if (gb2312_lead(c)) { + this_char = c; + pos += 1; + } else { + MB_FAILURE(pos, 1); + } + } + break; + + case cs_sjis: + { + unsigned char c = str[pos]; + if ((c >= 0x81 && c <= 0x9F) || (c >= 0xE0 && c <= 0xFC)) { + unsigned char next; + if (!CHECK_LEN(pos, 2)) + MB_FAILURE(pos, 1); + + next = str[pos + 1]; + + if (sjis_trail(next)) { + this_char = (c << 8) | next; + } else if (sjis_lead(next)) { + MB_FAILURE(pos, 1); + } else { + MB_FAILURE(pos, 2); + } + pos += 2; + } else if (c < 0x80 || (c >= 0xA1 && c <= 0xDF)) { + this_char = c; + pos += 1; + } else { + MB_FAILURE(pos, 1); + } + } + break; + + case cs_eucjp: + { + unsigned char c = str[pos]; + + if (c >= 0xA1 && c <= 0xFE) { + unsigned next; + if (!CHECK_LEN(pos, 2)) + MB_FAILURE(pos, 1); + next = str[pos + 1]; + + if (next >= 0xA1 && next <= 0xFE) { + /* this a jis kanji char */ + this_char = (c << 8) | next; + } else { + MB_FAILURE(pos, (next != 0xA0 && next != 0xFF) ? 1 : 2); + } + pos += 2; + } else if (c == 0x8E) { + unsigned next; + if (!CHECK_LEN(pos, 2)) + MB_FAILURE(pos, 1); + + next = str[pos + 1]; + if (next >= 0xA1 && next <= 0xDF) { + /* JIS X 0201 kana */ + this_char = (c << 8) | next; + } else { + MB_FAILURE(pos, (next != 0xA0 && next != 0xFF) ? 1 : 2); + } + pos += 2; + } else if (c == 0x8F) { + size_t avail = str_len - pos; + + if (avail < 3 || !(str[pos + 1] >= 0xA1 && str[pos + 1] <= 0xFE) || + !(str[pos + 2] >= 0xA1 && str[pos + 2] <= 0xFE)) { + if (avail < 2 || (str[pos + 1] != 0xA0 && str[pos + 1] != 0xFF)) + MB_FAILURE(pos, 1); + else if (avail < 3 || (str[pos + 2] != 0xA0 && str[pos + 2] != 0xFF)) + MB_FAILURE(pos, 2); + else + MB_FAILURE(pos, 3); + } else { + /* JIS X 0212 hojo-kanji */ + this_char = (c << 16) | (str[pos + 1] << 8) | str[pos + 2]; + } + pos += 3; + } else if (c != 0xA0 && c != 0xFF) { + /* character encoded in 1 code unit */ + this_char = c; + pos += 1; + } else { + MB_FAILURE(pos, 1); + } + } + break; + default: + /* single-byte charsets */ + this_char = str[pos++]; + break; + } + + *cursor = pos; + return this_char; +} +/* }}} */ + +/* {{{ php_next_utf8_char + * Public interface for get_next_char used with UTF-8 */ + PHPAPI unsigned int php_next_utf8_char( + const unsigned char *str, + size_t str_len, + size_t *cursor, + int *status) +{ + return get_next_char(cs_utf_8, str, str_len, cursor, status); +} +/* }}} */ + +/* {{{ entity_charset determine_charset + * returns the charset identifier based on current locale or a hint. + * defaults to UTF-8 */ +static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC) +{ + int i; + enum entity_charset charset = cs_utf_8; + int len = 0; + const zend_encoding *zenc; + + /* Default is now UTF-8 */ + if (charset_hint == NULL) + return cs_utf_8; + + if ((len = strlen(charset_hint)) != 0) { + goto det_charset; + } + + zenc = zend_multibyte_get_internal_encoding(TSRMLS_C); + if (zenc != NULL) { + charset_hint = (char *)zend_multibyte_get_encoding_name(zenc); + if (charset_hint != NULL && (len=strlen(charset_hint)) != 0) { + if ((len == 4) /* sizeof (none|auto|pass) */ && + (!memcmp("pass", charset_hint, 4) || + !memcmp("auto", charset_hint, 4) || + !memcmp("auto", charset_hint, 4))) { + charset_hint = NULL; + len = 0; + } else { + goto det_charset; + } + } + } + + charset_hint = SG(default_charset); + if (charset_hint != NULL && (len=strlen(charset_hint)) != 0) { + goto det_charset; + } + + /* try to detect the charset for the locale */ +#if HAVE_NL_LANGINFO && HAVE_LOCALE_H && defined(CODESET) + charset_hint = nl_langinfo(CODESET); + if (charset_hint != NULL && (len=strlen(charset_hint)) != 0) { + goto det_charset; + } +#endif + +#if HAVE_LOCALE_H + /* try to figure out the charset from the locale */ + { + char *localename; + char *dot, *at; + + /* lang[_territory][.codeset][@modifier] */ + localename = setlocale(LC_CTYPE, NULL); + + dot = strchr(localename, '.'); + if (dot) { + dot++; + /* locale specifies a codeset */ + at = strchr(dot, '@'); + if (at) + len = at - dot; + else + len = strlen(dot); + charset_hint = dot; + } else { + /* no explicit name; see if the name itself + * is the charset */ + charset_hint = localename; + len = strlen(charset_hint); + } + } +#endif + +det_charset: + + if (charset_hint) { + int found = 0; + + /* now walk the charset map and look for the codeset */ + for (i = 0; charset_map[i].codeset; i++) { + if (len == strlen(charset_map[i].codeset) && strncasecmp(charset_hint, charset_map[i].codeset, len) == 0) { + charset = charset_map[i].charset; + found = 1; + break; + } + } + if (!found) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "charset `%s' not supported, assuming utf-8", + charset_hint); + } + } + return charset; +} +/* }}} */ + +/* {{{ php_utf32_utf8 */ +static inline size_t php_utf32_utf8(unsigned char *buf, unsigned k) +{ + size_t retval = 0; + + /* assert(0x0 <= k <= 0x10FFFF); */ + + if (k < 0x80) { + buf[0] = k; + retval = 1; + } else if (k < 0x800) { + buf[0] = 0xc0 | (k >> 6); + buf[1] = 0x80 | (k & 0x3f); + retval = 2; + } else if (k < 0x10000) { + buf[0] = 0xe0 | (k >> 12); + buf[1] = 0x80 | ((k >> 6) & 0x3f); + buf[2] = 0x80 | (k & 0x3f); + retval = 3; + } else { + buf[0] = 0xf0 | (k >> 18); + buf[1] = 0x80 | ((k >> 12) & 0x3f); + buf[2] = 0x80 | ((k >> 6) & 0x3f); + buf[3] = 0x80 | (k & 0x3f); + retval = 4; + } + /* UTF-8 has been restricted to max 4 bytes since RFC 3629 */ + + return retval; +} +/* }}} */ + +/* {{{ php_mb2_int_to_char + * Convert back big endian int representation of sequence of one or two 8-bit code units. */ +static inline size_t php_mb2_int_to_char(unsigned char *buf, unsigned k) +{ + assert(k <= 0xFFFFU); + /* one or two bytes */ + if (k <= 0xFFU) { /* 1 */ + buf[0] = k; + return 1U; + } else { /* 2 */ + buf[0] = k >> 8; + buf[1] = k & 0xFFU; + return 2U; + } +} +/* }}} */ + +/* {{{ php_mb3_int_to_char + * Convert back big endian int representation of sequence of one to three 8-bit code units. + * For EUC-JP. */ +static inline size_t php_mb3_int_to_char(unsigned char *buf, unsigned k) +{ + assert(k <= 0xFFFFFFU); + /* one to three bytes */ + if (k <= 0xFFU) { /* 1 */ + buf[0] = k; + return 1U; + } else if (k <= 0xFFFFU) { /* 2 */ + buf[0] = k >> 8; + buf[1] = k & 0xFFU; + return 2U; + } else { + buf[0] = k >> 16; + buf[1] = (k >> 8) & 0xFFU; + buf[2] = k & 0xFFU; + return 3U; + } +} +/* }}} */ + + +/* {{{ unimap_bsearc_cmp + * Binary search of unicode code points in unicode <--> charset mapping. + * Returns the code point in the target charset (whose mapping table was given) or 0 if + * the unicode code point is not in the table. + */ +static inline unsigned char unimap_bsearch(const uni_to_enc *table, unsigned code_key_a, size_t num) +{ + const uni_to_enc *l = table, + *h = &table[num-1], + *m; + unsigned short code_key; + + /* we have no mappings outside the BMP */ + if (code_key_a > 0xFFFFU) + return 0; + + code_key = (unsigned short) code_key_a; + + while (l <= h) { + m = l + (h - l) / 2; + if (code_key < m->un_code_point) + h = m - 1; + else if (code_key > m->un_code_point) + l = m + 1; + else + return m->cs_code; + } + return 0; +} +/* }}} */ + +/* {{{ map_from_unicode */ +static inline int map_from_unicode(unsigned code, enum entity_charset charset, unsigned *res) +{ + unsigned char found; + const uni_to_enc *table; + size_t table_size; + + switch (charset) { + case cs_8859_1: + /* identity mapping of code points to unicode */ + if (code > 0xFF) { + return FAILURE; + } + *res = code; + break; + + case cs_8859_5: + if (code <= 0xA0 || code == 0xAD /* soft hyphen */) { + *res = code; + } else if (code == 0x2116) { + *res = 0xF0; /* numero sign */ + } else if (code == 0xA7) { + *res = 0xFD; /* section sign */ + } else if (code >= 0x0401 && code <= 0x044F) { + if (code == 0x040D || code == 0x0450 || code == 0x045D) + return FAILURE; + *res = code - 0x360; + } else { + return FAILURE; + } + break; + + case cs_8859_15: + if (code < 0xA4 || (code > 0xBE && code <= 0xFF)) { + *res = code; + } else { /* between A4 and 0xBE */ + found = unimap_bsearch(unimap_iso885915, + code, sizeof(unimap_iso885915) / sizeof(*unimap_iso885915)); + if (found) + *res = found; + else + return FAILURE; + } + break; + + case cs_cp1252: + if (code <= 0x7F || (code >= 0xA0 && code <= 0xFF)) { + *res = code; + } else { + found = unimap_bsearch(unimap_win1252, + code, sizeof(unimap_win1252) / sizeof(*unimap_win1252)); + if (found) + *res = found; + else + return FAILURE; + } + break; + + case cs_macroman: + if (code == 0x7F) + return FAILURE; + table = unimap_macroman; + table_size = sizeof(unimap_macroman) / sizeof(*unimap_macroman); + goto table_over_7F; + case cs_cp1251: + table = unimap_win1251; + table_size = sizeof(unimap_win1251) / sizeof(*unimap_win1251); + goto table_over_7F; + case cs_koi8r: + table = unimap_koi8r; + table_size = sizeof(unimap_koi8r) / sizeof(*unimap_koi8r); + goto table_over_7F; + case cs_cp866: + table = unimap_cp866; + table_size = sizeof(unimap_cp866) / sizeof(*unimap_cp866); + +table_over_7F: + if (code <= 0x7F) { + *res = code; + } else { + found = unimap_bsearch(table, code, table_size); + if (found) + *res = found; + else + return FAILURE; + } + break; + + /* from here on, only map the possible characters in the ASCII range. + * to improve support here, it's a matter of building the unicode mappings. + * See */ + case cs_sjis: + case cs_eucjp: + /* we interpret 0x5C as the Yen symbol. This is not universal. + * See */ + if (code >= 0x20 && code <= 0x7D) { + if (code == 0x5C) + return FAILURE; + *res = code; + } else { + return FAILURE; + } + break; + + case cs_big5: + case cs_big5hkscs: + case cs_gb2312: + if (code >= 0x20 && code <= 0x7D) { + *res = code; + } else { + return FAILURE; + } + break; + + default: + return FAILURE; + } + + return SUCCESS; +} +/* }}} */ + +/* {{{ */ +static inline void map_to_unicode(unsigned code, const enc_to_uni *table, unsigned *res) +{ + /* only single byte encodings are currently supported; assumed code <= 0xFF */ + *res = table->inner[ENT_ENC_TO_UNI_STAGE1(code)]->uni_cp[ENT_ENC_TO_UNI_STAGE2(code)]; +} +/* }}} */ + +/* {{{ unicode_cp_is_allowed */ +static inline int unicode_cp_is_allowed(unsigned uni_cp, int document_type) +{ + /* XML 1.0 HTML 4.01 HTML 5 + * 0x09..0x0A 0x09..0x0A 0x09..0x0A + * 0x0D 0x0D 0x0C..0x0D + * 0x0020..0xD7FF 0x20..0x7E 0x20..0x7E + * 0x00A0..0xD7FF 0x00A0..0xD7FF + * 0xE000..0xFFFD 0xE000..0x10FFFF 0xE000..0xFDCF + * 0x010000..0x10FFFF 0xFDF0..0x10FFFF (*) + * + * (*) exclude code points where ((code & 0xFFFF) >= 0xFFFE) + * + * References: + * XML 1.0: + * HTML 4.01: + * HTML 5: + * + * Not sure this is the relevant part for HTML 5, though. I opted to + * disallow the characters that would result in a parse error when + * preprocessing of the input stream. See also section 8.1.3. + * + * It's unclear if XHTML 1.0 allows C1 characters. I'll opt to apply to + * XHTML 1.0 the same rules as for XML 1.0. + * See . + */ + + switch (document_type) { + case ENT_HTML_DOC_HTML401: + return (uni_cp >= 0x20 && uni_cp <= 0x7E) || + (uni_cp == 0x0A || uni_cp == 0x09 || uni_cp == 0x0D) || + (uni_cp >= 0xA0 && uni_cp <= 0xD7FF) || + (uni_cp >= 0xE000 && uni_cp <= 0x10FFFF); + case ENT_HTML_DOC_HTML5: + return (uni_cp >= 0x20 && uni_cp <= 0x7E) || + (uni_cp >= 0x09 && uni_cp <= 0x0D && uni_cp != 0x0B) || /* form feed U+0C allowed */ + (uni_cp >= 0xA0 && uni_cp <= 0xD7FF) || + (uni_cp >= 0xE000 && uni_cp <= 0x10FFFF && + ((uni_cp & 0xFFFF) < 0xFFFE) && /* last two of each plane (nonchars) disallowed */ + (uni_cp < 0xFDD0 || uni_cp > 0xFDEF)); /* U+FDD0-U+FDEF (nonchars) disallowed */ + case ENT_HTML_DOC_XHTML: + case ENT_HTML_DOC_XML1: + return (uni_cp >= 0x20 && uni_cp <= 0xD7FF) || + (uni_cp == 0x0A || uni_cp == 0x09 || uni_cp == 0x0D) || + (uni_cp >= 0xE000 && uni_cp <= 0x10FFFF && uni_cp != 0xFFFE && uni_cp != 0xFFFF); + default: + return 1; + } +} +/* }}} */ + +/* {{{ unicode_cp_is_allowed */ +static inline int numeric_entity_is_allowed(unsigned uni_cp, int document_type) +{ + /* less restrictive than unicode_cp_is_allowed */ + switch (document_type) { + case ENT_HTML_DOC_HTML401: + /* all non-SGML characters (those marked with UNUSED in DESCSET) should be + * representable with numeric entities */ + return uni_cp <= 0x10FFFF; + case ENT_HTML_DOC_HTML5: + /* 8.1.4. The numeric character reference forms described above are allowed to + * reference any Unicode code point other than U+0000, U+000D, permanently + * undefined Unicode characters (noncharacters), and control characters other + * than space characters (U+0009, U+000A, U+000C and U+000D) */ + /* seems to allow surrogate characters, then */ + return (uni_cp >= 0x20 && uni_cp <= 0x7E) || + (uni_cp >= 0x09 && uni_cp <= 0x0C && uni_cp != 0x0B) || /* form feed U+0C allowed, but not U+0D */ + (uni_cp >= 0xA0 && uni_cp <= 0x10FFFF && + ((uni_cp & 0xFFFF) < 0xFFFE) && /* last two of each plane (nonchars) disallowed */ + (uni_cp < 0xFDD0 || uni_cp > 0xFDEF)); /* U+FDD0-U+FDEF (nonchars) disallowed */ + case ENT_HTML_DOC_XHTML: + case ENT_HTML_DOC_XML1: + /* OTOH, XML 1.0 requires "character references to match the production for Char + * See */ + return unicode_cp_is_allowed(uni_cp, document_type); + default: + return 1; + } +} +/* }}} */ + +/* {{{ process_numeric_entity + * Auxiliary function to traverse_for_entities. + * On input, *buf should point to the first character after # and on output, it's the last + * byte read, no matter if there was success or insuccess. + */ +static inline int process_numeric_entity(const char **buf, unsigned *code_point) +{ + long code_l; + int hexadecimal = (**buf == 'x' || **buf == 'X'); /* TODO: XML apparently disallows "X" */ + char *endptr; + + if (hexadecimal && (**buf != '\0')) + (*buf)++; + + /* strtol allows whitespace and other stuff in the beginning + * we're not interested */ + if ((hexadecimal && !isxdigit(**buf)) || + (!hexadecimal && !isdigit(**buf))) { + return FAILURE; + } + + code_l = strtol(*buf, &endptr, hexadecimal ? 16 : 10); + /* we're guaranteed there were valid digits, so *endptr > buf */ + *buf = endptr; + + if (**buf != ';') + return FAILURE; + + /* many more are invalid, but that depends on whether it's HTML + * (and which version) or XML. */ + if (code_l > 0x10FFFFL) + return FAILURE; + + if (code_point != NULL) + *code_point = (unsigned)code_l; + + return SUCCESS; +} +/* }}} */ + +/* {{{ process_named_entity */ +static inline int process_named_entity_html(const char **buf, const char **start, size_t *length) +{ + *start = *buf; + + /* "&" is represented by a 0x26 in all supported encodings. That means + * the byte after represents a character or is the leading byte of an + * sequence of 8-bit code units. If in the ranges below, it represents + * necessarily a alpha character because none of the supported encodings + * has an overlap with ASCII in the leading byte (only on the second one) */ + while ((**buf >= 'a' && **buf <= 'z') || + (**buf >= 'A' && **buf <= 'Z') || + (**buf >= '0' && **buf <= '9')) { + (*buf)++; + } + + if (**buf != ';') + return FAILURE; + + /* cast to size_t OK as the quantity is always non-negative */ + *length = *buf - *start; + + if (*length == 0) + return FAILURE; + + return SUCCESS; +} +/* }}} */ + +/* {{{ resolve_named_entity_html */ +static inline int resolve_named_entity_html(const char *start, size_t length, const entity_ht *ht, unsigned *uni_cp1, unsigned *uni_cp2) +{ + const entity_cp_map *s; + ulong hash = zend_inline_hash_func(start, length); + + s = ht->buckets[hash % ht->num_elems]; + while (s->entity) { + if (s->entity_len == length) { + if (memcmp(start, s->entity, length) == 0) { + *uni_cp1 = s->codepoint1; + *uni_cp2 = s->codepoint2; + return SUCCESS; + } + } + s++; + } + return FAILURE; +} +/* }}} */ + +static inline size_t write_octet_sequence(unsigned char *buf, enum entity_charset charset, unsigned code) { + /* code is not necessarily a unicode code point */ + switch (charset) { + case cs_utf_8: + return php_utf32_utf8(buf, code); + + case cs_8859_1: + case cs_cp1252: + case cs_8859_15: + case cs_koi8r: + case cs_cp1251: + case cs_8859_5: + case cs_cp866: + case cs_macroman: + /* single byte stuff */ + *buf = code; + return 1; + + case cs_big5: + case cs_big5hkscs: + case cs_sjis: + case cs_gb2312: + /* we don't have complete unicode mappings for these yet in entity_decode, + * and we opt to pass through the octet sequences for these in htmlentities + * instead of converting to an int and then converting back. */ +#if 0 + return php_mb2_int_to_char(buf, code); +#else +#ifdef ZEND_DEBUG + assert(code <= 0xFFU); +#endif + *buf = code; + return 1; +#endif + + case cs_eucjp: +#if 0 /* idem */ + return php_mb2_int_to_char(buf, code); +#else +#ifdef ZEND_DEBUG + assert(code <= 0xFFU); +#endif + *buf = code; + return 1; +#endif + + default: + assert(0); + return 0; + } +} + +/* {{{ traverse_for_entities + * Auxiliary function to php_unescape_html_entities(). + * - The argument "all" determines if all numeric entities are decode or only those + * that correspond to quotes (depending on quote_style). + */ +/* maximum expansion (factor 1.2) for HTML 5 with ≫⃒ and ≪⃒ */ +/* +2 is 1 because of rest (probably unnecessary), 1 because of terminating 0 */ +#define TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(oldlen) ((oldlen) + (oldlen) / 5 + 2) +static void traverse_for_entities( + const char *old, + size_t oldlen, + char *ret, /* should have allocated TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(olden) */ + size_t *retlen, + int all, + int flags, + const entity_ht *inv_map, + enum entity_charset charset) +{ + const char *p, + *lim; + char *q; + int doctype = flags & ENT_HTML_DOC_TYPE_MASK; + + lim = old + oldlen; /* terminator address */ + assert(*lim == '\0'); + + for (p = old, q = ret; p < lim;) { + unsigned code, code2 = 0; + const char *next = NULL; /* when set, next > p, otherwise possible inf loop */ + + /* Shift JIS, Big5 and HKSCS use multi-byte encodings where an + * ASCII range byte can be part of a multi-byte sequence. + * However, they start at 0x40, therefore if we find a 0x26 byte, + * we're sure it represents the '&' character. */ + + /* assumes there are no single-char entities */ + if (p[0] != '&' || (p + 3 >= lim)) { + *(q++) = *(p++); + continue; + } + + /* now p[3] is surely valid and is no terminator */ + + /* numerical entity */ + if (p[1] == '#') { + next = &p[2]; + if (process_numeric_entity(&next, &code) == FAILURE) + goto invalid_code; + + /* If we're in htmlspecialchars_decode, we're only decoding entities + * that represent &, <, >, " and '. Is this one of them? */ + if (!all && (code > 63U || + stage3_table_be_apos_00000[code].data.ent.entity == NULL)) + goto invalid_code; + + /* are we allowed to decode this entity in this document type? + * HTML 5 is the only that has a character that cannot be used in + * a numeric entity but is allowed literally (U+000D). The + * unoptimized version would be ... || !numeric_entity_is_allowed(code) */ + if (!unicode_cp_is_allowed(code, doctype) || + (doctype == ENT_HTML_DOC_HTML5 && code == 0x0D)) + goto invalid_code; + } else { + const char *start; + size_t ent_len; + + next = &p[1]; + start = next; + + if (process_named_entity_html(&next, &start, &ent_len) == FAILURE) + goto invalid_code; + + if (resolve_named_entity_html(start, ent_len, inv_map, &code, &code2) == FAILURE) { + if (doctype == ENT_HTML_DOC_XHTML && ent_len == 4 && start[0] == 'a' + && start[1] == 'p' && start[2] == 'o' && start[3] == 's') { + /* uses html4 inv_map, which doesn't include apos;. This is a + * hack to support it */ + code = (unsigned) '\''; + } else { + goto invalid_code; + } + } + } + + assert(*next == ';'); + + if (((code == '\'' && !(flags & ENT_HTML_QUOTE_SINGLE)) || + (code == '"' && !(flags & ENT_HTML_QUOTE_DOUBLE))) + /* && code2 == '\0' always true for current maps */) + goto invalid_code; + + /* UTF-8 doesn't need mapping (ISO-8859-1 doesn't either, but + * the call is needed to ensure the codepoint <= U+00FF) */ + if (charset != cs_utf_8) { + /* replace unicode code point */ + if (map_from_unicode(code, charset, &code) == FAILURE || code2 != 0) + goto invalid_code; /* not representable in target charset */ + } + + q += write_octet_sequence(q, charset, code); + if (code2) { + q += write_octet_sequence(q, charset, code2); + } + + /* jump over the valid entity; may go beyond size of buffer; np */ + p = next + 1; + continue; + +invalid_code: + for (; p < next; p++) { + *(q++) = *p; + } + } + + *q = '\0'; + *retlen = (size_t)(q - ret); +} +/* }}} */ + +/* {{{ unescape_inverse_map */ +static const entity_ht *unescape_inverse_map(int all, int flags) +{ + int document_type = flags & ENT_HTML_DOC_TYPE_MASK; + + if (all) { + switch (document_type) { + case ENT_HTML_DOC_HTML401: + case ENT_HTML_DOC_XHTML: /* but watch out for '...*/ + return &ent_ht_html4; + case ENT_HTML_DOC_HTML5: + return &ent_ht_html5; + default: + return &ent_ht_be_apos; + } + } else { + switch (document_type) { + case ENT_HTML_DOC_HTML401: + return &ent_ht_be_noapos; + default: + return &ent_ht_be_apos; + } + } +} +/* }}} */ + +/* {{{ determine_entity_table + * Entity table to use. Note that entity tables are defined in terms of + * unicode code points */ +static entity_table_opt determine_entity_table(int all, int doctype) +{ + entity_table_opt retval = {NULL}; + + assert(!(doctype == ENT_HTML_DOC_XML1 && all)); + + if (all) { + retval.ms_table = (doctype == ENT_HTML_DOC_HTML5) ? + entity_ms_table_html5 : entity_ms_table_html4; + } else { + retval.table = (doctype == ENT_HTML_DOC_HTML401) ? + stage3_table_be_noapos_00000 : stage3_table_be_apos_00000; + } + return retval; +} +/* }}} */ + +/* {{{ php_unescape_html_entities + * The parameter "all" should be true to decode all possible entities, false to decode + * only the basic ones, i.e., those in basic_entities_ex + the numeric entities + * that correspond to quotes. + */ +PHPAPI char *php_unescape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC) +{ + size_t retlen; + char *ret; + enum entity_charset charset; + const entity_ht *inverse_map = NULL; + size_t new_size = TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(oldlen); + + if (all) { + charset = determine_charset(hint_charset TSRMLS_CC); + } else { + charset = cs_8859_1; /* charset shouldn't matter, use ISO-8859-1 for performance */ + } + + /* don't use LIMIT_ALL! */ + + if (oldlen > new_size) { + /* overflow, refuse to do anything */ + ret = estrndup((char*)old, oldlen); + retlen = oldlen; + goto empty_source; + } + ret = emalloc(new_size); + *ret = '\0'; + retlen = oldlen; + if (retlen == 0) { + goto empty_source; + } + + inverse_map = unescape_inverse_map(all, flags); + + /* replace numeric entities */ + traverse_for_entities(old, oldlen, ret, &retlen, all, flags, inverse_map, charset); + +empty_source: + *newlen = retlen; + return ret; +} +/* }}} */ + +PHPAPI char *php_escape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC) +{ + return php_escape_html_entities_ex(old, oldlen, newlen, all, flags, hint_charset, 1 TSRMLS_CC); +} + +/* {{{ find_entity_for_char */ +static inline void find_entity_for_char( + unsigned int k, + enum entity_charset charset, + const entity_stage1_row *table, + const unsigned char **entity, + size_t *entity_len, + unsigned char *old, + size_t oldlen, + size_t *cursor) +{ + unsigned stage1_idx = ENT_STAGE1_INDEX(k); + const entity_stage3_row *c; + + if (stage1_idx > 0x1D) { + *entity = NULL; + *entity_len = 0; + return; + } + + c = &table[stage1_idx][ENT_STAGE2_INDEX(k)][ENT_STAGE3_INDEX(k)]; + + if (!c->ambiguous) { + *entity = (const unsigned char *)c->data.ent.entity; + *entity_len = c->data.ent.entity_len; + } else { + /* peek at next char */ + size_t cursor_before = *cursor; + int status = SUCCESS; + unsigned next_char; + + if (!(*cursor < oldlen)) + goto no_suitable_2nd; + + next_char = get_next_char(charset, old, oldlen, cursor, &status); + + if (status == FAILURE) + goto no_suitable_2nd; + + { + const entity_multicodepoint_row *s, *e; + + s = &c->data.multicodepoint_table[1]; + e = s - 1 + c->data.multicodepoint_table[0].leading_entry.size; + /* we could do a binary search but it's not worth it since we have + * at most two entries... */ + for ( ; s <= e; s++) { + if (s->normal_entry.second_cp == next_char) { + *entity = s->normal_entry.entity; + *entity_len = s->normal_entry.entity_len; + return; + } + } + } +no_suitable_2nd: + *cursor = cursor_before; + *entity = (const unsigned char *) + c->data.multicodepoint_table[0].leading_entry.default_entity; + *entity_len = c->data.multicodepoint_table[0].leading_entry.default_entity_len; + } +} +/* }}} */ + +/* {{{ find_entity_for_char_basic */ +static inline void find_entity_for_char_basic( + unsigned int k, + const entity_stage3_row *table, + const unsigned char **entity, + size_t *entity_len) +{ + if (k >= 64U) { + *entity = NULL; + *entity_len = 0; + return; + } + + *entity = table[k].data.ent.entity; + *entity_len = table[k].data.ent.entity_len; +} +/* }}} */ + +/* {{{ php_escape_html_entities + */ +PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset, zend_bool double_encode TSRMLS_DC) +{ + size_t cursor, maxlen, len; + char *replaced; + enum entity_charset charset = determine_charset(hint_charset TSRMLS_CC); + int doctype = flags & ENT_HTML_DOC_TYPE_MASK; + entity_table_opt entity_table; + const enc_to_uni *to_uni_table = NULL; + const entity_ht *inv_map = NULL; /* used for !double_encode */ + /* only used if flags includes ENT_HTML_IGNORE_ERRORS or ENT_HTML_SUBSTITUTE_DISALLOWED_CHARS */ + const unsigned char *replacement; + size_t replacement_len; + + if (all) { /* replace with all named entities */ + if (CHARSET_PARTIAL_SUPPORT(charset)) { + php_error_docref0(NULL TSRMLS_CC, E_STRICT, "Only basic entities " + "substitution is supported for multi-byte encodings other than UTF-8; " + "functionality is equivalent to htmlspecialchars"); + } + LIMIT_ALL(all, doctype, charset); + } + entity_table = determine_entity_table(all, doctype); + if (all && !CHARSET_UNICODE_COMPAT(charset)) { + to_uni_table = enc_to_uni_index[charset]; + } + + if (!double_encode) { + /* first arg is 1 because we want to identify valid named entities + * even if we are only encoding the basic ones */ + inv_map = unescape_inverse_map(1, flags); + } + + if (flags & (ENT_HTML_SUBSTITUTE_ERRORS | ENT_HTML_SUBSTITUTE_DISALLOWED_CHARS)) { + if (charset == cs_utf_8) { + replacement = (const unsigned char*)"\xEF\xBF\xBD"; + replacement_len = sizeof("\xEF\xBF\xBD") - 1; + } else { + replacement = (const unsigned char*)"�"; + replacement_len = sizeof("�") - 1; + } + } + + /* initial estimate */ + if (oldlen < 64) { + maxlen = 128; + } else { + maxlen = 2 * oldlen; + if (maxlen < oldlen) { + zend_error_noreturn(E_ERROR, "Input string is too long"); + return NULL; + } + } + + replaced = emalloc(maxlen + 1); /* adding 1 is safe: maxlen is even */ + len = 0; + cursor = 0; + while (cursor < oldlen) { + const unsigned char *mbsequence = NULL; + size_t mbseqlen = 0, + cursor_before = cursor; + int status = SUCCESS; + unsigned int this_char = get_next_char(charset, old, oldlen, &cursor, &status); + + /* guarantee we have at least 40 bytes to write. + * In HTML5, entities may take up to 33 bytes */ + if (len > maxlen - 40) { /* maxlen can never be smaller than 128 */ + replaced = safe_erealloc(replaced, maxlen , 1, 128 + 1); + maxlen += 128; + } + + if (status == FAILURE) { + /* invalid MB sequence */ + if (flags & ENT_HTML_IGNORE_ERRORS) { + continue; + } else if (flags & ENT_HTML_SUBSTITUTE_ERRORS) { + memcpy(&replaced[len], replacement, replacement_len); + len += replacement_len; + continue; + } else { + efree(replaced); + *newlen = 0; + return STR_EMPTY_ALLOC(); + } + } else { /* SUCCESS */ + mbsequence = &old[cursor_before]; + mbseqlen = cursor - cursor_before; + } + + if (this_char != '&') { /* no entity on this position */ + const unsigned char *rep = NULL; + size_t rep_len = 0; + + if (((this_char == '\'' && !(flags & ENT_HTML_QUOTE_SINGLE)) || + (this_char == '"' && !(flags & ENT_HTML_QUOTE_DOUBLE)))) + goto pass_char_through; + + if (all) { /* false that CHARSET_PARTIAL_SUPPORT(charset) */ + if (to_uni_table != NULL) { + /* !CHARSET_UNICODE_COMPAT therefore not UTF-8; since UTF-8 + * is the only multibyte encoding with !CHARSET_PARTIAL_SUPPORT, + * we're using a single byte encoding */ + map_to_unicode(this_char, to_uni_table, &this_char); + if (this_char == 0xFFFF) /* no mapping; pass through */ + goto pass_char_through; + } + /* the cursor may advance */ + find_entity_for_char(this_char, charset, entity_table.ms_table, &rep, + &rep_len, old, oldlen, &cursor); + } else { + find_entity_for_char_basic(this_char, entity_table.table, &rep, &rep_len); + } + + if (rep != NULL) { + replaced[len++] = '&'; + memcpy(&replaced[len], rep, rep_len); + len += rep_len; + replaced[len++] = ';'; + } else { + /* we did not find an entity for this char. + * check for its validity, if its valid pass it unchanged */ + if (flags & ENT_HTML_SUBSTITUTE_DISALLOWED_CHARS) { + if (CHARSET_UNICODE_COMPAT(charset)) { + if (!unicode_cp_is_allowed(this_char, doctype)) { + mbsequence = replacement; + mbseqlen = replacement_len; + } + } else if (to_uni_table) { + if (!all) /* otherwise we already did this */ + map_to_unicode(this_char, to_uni_table, &this_char); + if (!unicode_cp_is_allowed(this_char, doctype)) { + mbsequence = replacement; + mbseqlen = replacement_len; + } + } else { + /* not a unicode code point, unless, coincidentally, it's in + * the 0x20..0x7D range (except 0x5C in sjis). We know nothing + * about other code points, because we have no tables. Since + * Unicode code points in that range are not disallowed in any + * document type, we could do nothing. However, conversion + * tables frequently map 0x00-0x1F to the respective C0 code + * points. Let's play it safe and admit that's the case */ + if (this_char <= 0x7D && + !unicode_cp_is_allowed(this_char, doctype)) { + mbsequence = replacement; + mbseqlen = replacement_len; + } + } + } +pass_char_through: + if (mbseqlen > 1) { + memcpy(replaced + len, mbsequence, mbseqlen); + len += mbseqlen; + } else { + replaced[len++] = mbsequence[0]; + } + } + } else { /* this_char == '&' */ + if (double_encode) { +encode_amp: + memcpy(&replaced[len], "&", sizeof("&") - 1); + len += sizeof("&") - 1; + } else { /* no double encode */ + /* check if entity is valid */ + size_t ent_len; /* not counting & or ; */ + /* peek at next char */ + if (old[cursor] == '#') { /* numeric entity */ + unsigned code_point; + int valid; + char *pos = (char*)&old[cursor+1]; + valid = process_numeric_entity((const char **)&pos, &code_point); + if (valid == FAILURE) + goto encode_amp; + if (flags & ENT_HTML_SUBSTITUTE_DISALLOWED_CHARS) { + if (!numeric_entity_is_allowed(code_point, doctype)) + goto encode_amp; + } + ent_len = pos - (char*)&old[cursor]; + } else { /* named entity */ + /* check for vality of named entity */ + const char *start = &old[cursor], + *next = start; + unsigned dummy1, dummy2; + + if (process_named_entity_html(&next, &start, &ent_len) == FAILURE) + goto encode_amp; + if (resolve_named_entity_html(start, ent_len, inv_map, &dummy1, &dummy2) == FAILURE) { + if (!(doctype == ENT_HTML_DOC_XHTML && ent_len == 4 && start[0] == 'a' + && start[1] == 'p' && start[2] == 'o' && start[3] == 's')) { + /* uses html4 inv_map, which doesn't include apos;. This is a + * hack to support it */ + goto encode_amp; + } + } + } + /* checks passed; copy entity to result */ + /* entity size is unbounded, we may need more memory */ + /* at this point maxlen - len >= 40 */ + if (maxlen - len < ent_len + 2 /* & and ; */) { + /* ent_len < oldlen, which is certainly <= SIZE_MAX/2 */ + replaced = safe_erealloc(replaced, maxlen, 1, ent_len + 128 + 1); + maxlen += ent_len + 128; + } + replaced[len++] = '&'; + memcpy(&replaced[len], &old[cursor], ent_len); + len += ent_len; + replaced[len++] = ';'; + cursor += ent_len + 1; + } + } + } + replaced[len] = '\0'; + *newlen = len; + + return replaced; +} +/* }}} */ + +/* {{{ php_html_entities + */ +static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) +{ + char *str, *hint_charset = NULL; + int str_len, hint_charset_len = 0; + size_t new_len; + long flags = ENT_COMPAT; + char *replaced; + zend_bool double_encode = 1; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!b", &str, &str_len, &flags, &hint_charset, &hint_charset_len, &double_encode) == FAILURE) { + return; + } + + replaced = php_escape_html_entities_ex(str, str_len, &new_len, all, (int) flags, hint_charset, double_encode TSRMLS_CC); + RETVAL_STRINGL(replaced, (int)new_len, 0); +} +/* }}} */ + +#define HTML_SPECIALCHARS 0 +#define HTML_ENTITIES 1 + +/* {{{ register_html_constants + */ +void register_html_constants(INIT_FUNC_ARGS) +{ + REGISTER_LONG_CONSTANT("HTML_SPECIALCHARS", HTML_SPECIALCHARS, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("HTML_ENTITIES", HTML_ENTITIES, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_COMPAT", ENT_COMPAT, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_QUOTES", ENT_QUOTES, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_NOQUOTES", ENT_NOQUOTES, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_IGNORE", ENT_IGNORE, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_SUBSTITUTE", ENT_SUBSTITUTE, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_DISALLOWED", ENT_DISALLOWED, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_HTML401", ENT_HTML401, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_XML1", ENT_XML1, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_XHTML", ENT_XHTML, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_HTML5", ENT_HTML5, CONST_PERSISTENT|CONST_CS); +} +/* }}} */ + +/* {{{ proto string htmlspecialchars(string string [, int quote_style[, string charset[, bool double_encode]]]) + Convert special characters to HTML entities */ +PHP_FUNCTION(htmlspecialchars) +{ + php_html_entities(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* {{{ proto string htmlspecialchars_decode(string string [, int quote_style]) + Convert special HTML entities back to characters */ +PHP_FUNCTION(htmlspecialchars_decode) +{ + char *str; + int str_len; + size_t new_len = 0; + long quote_style = ENT_COMPAT; + char *replaced; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, "e_style) == FAILURE) { + return; + } + + replaced = php_unescape_html_entities(str, str_len, &new_len, 0 /*!all*/, quote_style, NULL TSRMLS_CC); + if (replaced) { + RETURN_STRINGL(replaced, (int)new_len, 0); + } + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto string html_entity_decode(string string [, int quote_style][, string charset]) + Convert all HTML entities to their applicable characters */ +PHP_FUNCTION(html_entity_decode) +{ + char *str, *hint_charset = NULL; + int str_len, hint_charset_len = 0; + size_t new_len = 0; + long quote_style = ENT_COMPAT; + char *replaced; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, + "e_style, &hint_charset, &hint_charset_len) == FAILURE) { + return; + } + + replaced = php_unescape_html_entities(str, str_len, &new_len, 1 /*all*/, quote_style, hint_charset TSRMLS_CC); + if (replaced) { + RETURN_STRINGL(replaced, (int)new_len, 0); + } + RETURN_FALSE; +} +/* }}} */ + + +/* {{{ proto string htmlentities(string string [, int quote_style[, string charset[, bool double_encode]]]) + Convert all applicable characters to HTML entities */ +PHP_FUNCTION(htmlentities) +{ + php_html_entities(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +/* {{{ write_s3row_data */ +static inline void write_s3row_data( + const entity_stage3_row *r, + unsigned orig_cp, + enum entity_charset charset, + zval *arr) +{ + char key[9] = ""; /* two unicode code points in UTF-8 */ + char entity[LONGEST_ENTITY_LENGTH + 2] = {'&'}; + size_t written_k1; + + written_k1 = write_octet_sequence(key, charset, orig_cp); + + if (!r->ambiguous) { + size_t l = r->data.ent.entity_len; + memcpy(&entity[1], r->data.ent.entity, l); + entity[l + 1] = ';'; + add_assoc_stringl_ex(arr, key, written_k1 + 1, entity, l + 2, 1); + } else { + unsigned i, + num_entries; + const entity_multicodepoint_row *mcpr = r->data.multicodepoint_table; + + if (mcpr[0].leading_entry.default_entity != NULL) { + size_t l = mcpr[0].leading_entry.default_entity_len; + memcpy(&entity[1], mcpr[0].leading_entry.default_entity, l); + entity[l + 1] = ';'; + add_assoc_stringl_ex(arr, key, written_k1 + 1, entity, l + 2, 1); + } + num_entries = mcpr[0].leading_entry.size; + for (i = 1; i <= num_entries; i++) { + size_t l, + written_k2; + unsigned uni_cp, + spe_cp; + + uni_cp = mcpr[i].normal_entry.second_cp; + l = mcpr[i].normal_entry.entity_len; + + if (!CHARSET_UNICODE_COMPAT(charset)) { + if (map_from_unicode(uni_cp, charset, &spe_cp) == FAILURE) + continue; /* non representable in this charset */ + } else { + spe_cp = uni_cp; + } + + written_k2 = write_octet_sequence(&key[written_k1], charset, spe_cp); + memcpy(&entity[1], mcpr[i].normal_entry.entity, l); + entity[l + 1] = ';'; + entity[l + 1] = '\0'; + add_assoc_stringl_ex(arr, key, written_k1 + written_k2 + 1, entity, l + 1, 1); + } + } +} +/* }}} */ + +/* {{{ proto array get_html_translation_table([int table [, int flags [, string charset_hint]]]) + Returns the internal translation table used by htmlspecialchars and htmlentities */ +PHP_FUNCTION(get_html_translation_table) +{ + long all = HTML_SPECIALCHARS, + flags = ENT_COMPAT; + int doctype; + entity_table_opt entity_table; + const enc_to_uni *to_uni_table; + char *charset_hint = NULL; + int charset_hint_len; + enum entity_charset charset; + + /* in this function we have to jump through some loops because we're + * getting the translated table from data structures that are optimized for + * random access, not traversal */ + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls", + &all, &flags, &charset_hint, &charset_hint_len) == FAILURE) { + return; + } + + charset = determine_charset(charset_hint TSRMLS_CC); + doctype = flags & ENT_HTML_DOC_TYPE_MASK; + LIMIT_ALL(all, doctype, charset); + + array_init(return_value); + + entity_table = determine_entity_table(all, doctype); + if (all && !CHARSET_UNICODE_COMPAT(charset)) { + to_uni_table = enc_to_uni_index[charset]; + } + + if (all) { /* HTML_ENTITIES (actually, any non-zero value for 1st param) */ + const entity_stage1_row *ms_table = entity_table.ms_table; + + if (CHARSET_UNICODE_COMPAT(charset)) { + unsigned i, j, k, + max_i, max_j, max_k; + /* no mapping to unicode required */ + if (CHARSET_SINGLE_BYTE(charset)) { /* ISO-8859-1 */ + max_i = 1; max_j = 4; max_k = 64; + } else { + max_i = 0x1E; max_j = 64; max_k = 64; + } + + for (i = 0; i < max_i; i++) { + if (ms_table[i] == empty_stage2_table) + continue; + for (j = 0; j < max_j; j++) { + if (ms_table[i][j] == empty_stage3_table) + continue; + for (k = 0; k < max_k; k++) { + const entity_stage3_row *r = &ms_table[i][j][k]; + unsigned code; + + if (r->data.ent.entity == NULL) + continue; + + code = ENT_CODE_POINT_FROM_STAGES(i, j, k); + if (((code == '\'' && !(flags & ENT_HTML_QUOTE_SINGLE)) || + (code == '"' && !(flags & ENT_HTML_QUOTE_DOUBLE)))) + continue; + write_s3row_data(r, code, charset, return_value); + } + } + } + } else { + /* we have to iterate through the set of code points for this + * encoding and map them to unicode code points */ + unsigned i; + for (i = 0; i <= 0xFF; i++) { + const entity_stage3_row *r; + unsigned uni_cp; + + /* can be done before mapping, they're invariant */ + if (((i == '\'' && !(flags & ENT_HTML_QUOTE_SINGLE)) || + (i == '"' && !(flags & ENT_HTML_QUOTE_DOUBLE)))) + continue; + + map_to_unicode(i, to_uni_table, &uni_cp); + r = &ms_table[ENT_STAGE1_INDEX(uni_cp)][ENT_STAGE2_INDEX(uni_cp)][ENT_STAGE3_INDEX(uni_cp)]; + if (r->data.ent.entity == NULL) + continue; + + write_s3row_data(r, i, charset, return_value); + } + } + } else { + /* we could use sizeof(stage3_table_be_apos_00000) as well */ + unsigned j, + numelems = sizeof(stage3_table_be_noapos_00000) / + sizeof(*stage3_table_be_noapos_00000); + + for (j = 0; j < numelems; j++) { + const entity_stage3_row *r = &entity_table.table[j]; + if (r->data.ent.entity == NULL) + continue; + + if (((j == '\'' && !(flags & ENT_HTML_QUOTE_SINGLE)) || + (j == '"' && !(flags & ENT_HTML_QUOTE_DOUBLE)))) + continue; + + /* charset is indifferent, used cs_8859_1 for efficiency */ + write_s3row_data(r, j, cs_8859_1, return_value); + } + } +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/html.h b/ext/standard/html.h new file mode 100644 index 0000000..ae11476 --- /dev/null +++ b/ext/standard/html.h @@ -0,0 +1,62 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Rasmus Lerdorf | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef HTML_H +#define HTML_H + +#define ENT_HTML_QUOTE_NONE 0 +#define ENT_HTML_QUOTE_SINGLE 1 +#define ENT_HTML_QUOTE_DOUBLE 2 +#define ENT_HTML_IGNORE_ERRORS 4 +#define ENT_HTML_SUBSTITUTE_ERRORS 8 +#define ENT_HTML_DOC_TYPE_MASK (16|32) +#define ENT_HTML_DOC_HTML401 0 +#define ENT_HTML_DOC_XML1 16 +#define ENT_HTML_DOC_XHTML 32 +#define ENT_HTML_DOC_HTML5 (16|32) +/* reserve bit 6 */ +#define ENT_HTML_SUBSTITUTE_DISALLOWED_CHARS 128 + + +#define ENT_COMPAT ENT_HTML_QUOTE_DOUBLE +#define ENT_QUOTES (ENT_HTML_QUOTE_DOUBLE | ENT_HTML_QUOTE_SINGLE) +#define ENT_NOQUOTES ENT_HTML_QUOTE_NONE +#define ENT_IGNORE ENT_HTML_IGNORE_ERRORS +#define ENT_SUBSTITUTE ENT_HTML_SUBSTITUTE_ERRORS +#define ENT_HTML401 0 +#define ENT_XML1 16 +#define ENT_XHTML 32 +#define ENT_HTML5 (16|32) +#define ENT_DISALLOWED 128 + +void register_html_constants(INIT_FUNC_ARGS); + +PHP_FUNCTION(htmlspecialchars); +PHP_FUNCTION(htmlentities); +PHP_FUNCTION(htmlspecialchars_decode); +PHP_FUNCTION(html_entity_decode); +PHP_FUNCTION(get_html_translation_table); + +PHPAPI char *php_escape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC); +PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset, zend_bool double_encode TSRMLS_DC); +PHPAPI char *php_unescape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC); +PHPAPI unsigned int php_next_utf8_char(const unsigned char *str, size_t str_len, size_t *cursor, int *status); + +#endif /* HTML_H */ diff --git a/ext/standard/html_tables.h b/ext/standard/html_tables.h new file mode 100644 index 0000000..c24531d --- /dev/null +++ b/ext/standard/html_tables.h @@ -0,0 +1,6235 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef HTML_TABLES_H +#define HTML_TABLES_H + +/************************************************************************** +*************************************************************************** +** THIS FILE IS AUTOMATICALLY GENERATED. DO NOT MODIFY IT. ** +*************************************************************************** +** Please change html_tables/html_table_gen.php instead and then ** +** run it in order to generate this file ** +*************************************************************************** +**************************************************************************/ + +enum entity_charset { cs_utf_8, cs_8859_1, cs_cp1252, cs_8859_15, cs_cp1251, + cs_8859_5, cs_cp866, cs_macroman, cs_koi8r, cs_big5, + cs_gb2312, cs_big5hkscs, cs_sjis, cs_eucjp, + cs_numelems /* used to count the number of charsets */ + }; +#define CHARSET_UNICODE_COMPAT(cs) ((cs) <= cs_8859_1) +#define CHARSET_SINGLE_BYTE(cs) ((cs) > cs_utf_8 && (cs) < cs_big5) +#define CHARSET_PARTIAL_SUPPORT(cs) ((cs) >= cs_big5) + +static const struct { + const char *codeset; + enum entity_charset charset; +} charset_map[] = { + { "ISO-8859-1", cs_8859_1 }, + { "ISO8859-1", cs_8859_1 }, + { "ISO-8859-15", cs_8859_15 }, + { "ISO8859-15", cs_8859_15 }, + { "utf-8", cs_utf_8 }, + { "cp1252", cs_cp1252 }, + { "Windows-1252", cs_cp1252 }, + { "1252", cs_cp1252 }, + { "BIG5", cs_big5 }, + { "950", cs_big5 }, + { "GB2312", cs_gb2312 }, + { "936", cs_gb2312 }, + { "BIG5-HKSCS", cs_big5hkscs }, + { "Shift_JIS", cs_sjis }, + { "SJIS", cs_sjis }, + { "932", cs_sjis }, + { "SJIS-win", cs_sjis }, + { "CP932", cs_sjis }, + { "EUCJP", cs_eucjp }, + { "EUC-JP", cs_eucjp }, + { "eucJP-win", cs_eucjp }, + { "KOI8-R", cs_koi8r }, + { "koi8-ru", cs_koi8r }, + { "koi8r", cs_koi8r }, + { "cp1251", cs_cp1251 }, + { "Windows-1251", cs_cp1251 }, + { "win-1251", cs_cp1251 }, + { "iso8859-5", cs_8859_5 }, + { "iso-8859-5", cs_8859_5 }, + { "cp866", cs_cp866 }, + { "866", cs_cp866 }, + { "ibm866", cs_cp866 }, + { "MacRoman", cs_macroman }, + { NULL } +}; + +/* longest entity name length excluding & and ; */ +#define LONGEST_ENTITY_LENGTH 31 + +/* Definitions for mappings *to* Unicode. + * The origin charset must have at most 256 code points. + * The multi-byte encodings are not supported */ +typedef struct { + unsigned short uni_cp[64]; +} enc_to_uni_stage2; + +typedef struct { + const enc_to_uni_stage2 *inner[4]; +} enc_to_uni; + +/* bits 7-8 bits (only single bytes encodings supported )*/ +#define ENT_ENC_TO_UNI_STAGE1(k) ((k & 0xC0) >> 6) +/* bits 1-6 */ +#define ENT_ENC_TO_UNI_STAGE2(k) ((k) & 0x3F) + +/* {{{ Mappings *to* Unicode for ISO-8859-1 */ + +/* {{{ Stage 2 tables for ISO-8859-1 */ + +static const enc_to_uni_stage2 enc_to_uni_s2_iso88591_00 = { { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, + 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, + 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, + 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, + 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, + 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, + 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, + 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, + 0x003C, 0x003D, 0x003E, 0x003F, +} }; + +static const enc_to_uni_stage2 enc_to_uni_s2_iso88591_40 = { { + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, + 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, + 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, + 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, + 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, + 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, + 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, + 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, + 0x007C, 0x007D, 0x007E, 0x007F, +} }; + +static const enc_to_uni_stage2 enc_to_uni_s2_iso88591_80 = { { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, + 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, + 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, + 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, + 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, + 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, + 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, + 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, + 0x00BC, 0x00BD, 0x00BE, 0x00BF, +} }; + +static const enc_to_uni_stage2 enc_to_uni_s2_iso88591_C0 = { { + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, + 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, + 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0, 0x00D1, + 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, + 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, + 0x00DE, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, + 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, + 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, + 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, + 0x00FC, 0x00FD, 0x00FE, 0x00FF, +} }; + +/* end of stage 2 tables for ISO-8859-1 }}} */ + +/* {{{ Stage 1 table for ISO-8859-1 */ +static const enc_to_uni enc_to_uni_iso88591 = { { + &enc_to_uni_s2_iso88591_00, + &enc_to_uni_s2_iso88591_40, + &enc_to_uni_s2_iso88591_80, + &enc_to_uni_s2_iso88591_C0 } +}; +/* end of stage 1 table for ISO-8859-1 }}} */ + +/* {{{ Mappings *to* Unicode for ISO-8859-5 */ + +/* {{{ Stage 2 tables for ISO-8859-5 */ + +static const enc_to_uni_stage2 enc_to_uni_s2_iso88595_80 = { { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, + 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, + 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, + 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, + 0x009E, 0x009F, 0x00A0, 0x0401, 0x0402, 0x0403, + 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, + 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, + 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, + 0x041C, 0x041D, 0x041E, 0x041F, +} }; + +static const enc_to_uni_stage2 enc_to_uni_s2_iso88595_C0 = { { + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, + 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, + 0x042C, 0x042D, 0x042E, 0x042F, 0x0430, 0x0431, + 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, + 0x043E, 0x043F, 0x0440, 0x0441, 0x0442, 0x0443, + 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, + 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, + 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, + 0x0456, 0x0457, 0x0458, 0x0459, 0x045A, 0x045B, + 0x045C, 0x00A7, 0x045E, 0x045F, +} }; + +/* end of stage 2 tables for ISO-8859-5 }}} */ + +/* {{{ Stage 1 table for ISO-8859-5 */ +static const enc_to_uni enc_to_uni_iso88595 = { { + &enc_to_uni_s2_iso88591_00, + &enc_to_uni_s2_iso88591_40, + &enc_to_uni_s2_iso88595_80, + &enc_to_uni_s2_iso88595_C0 } +}; +/* end of stage 1 table for ISO-8859-5 }}} */ + +/* {{{ Mappings *to* Unicode for ISO-8859-15 */ + +/* {{{ Stage 2 tables for ISO-8859-15 */ + +static const enc_to_uni_stage2 enc_to_uni_s2_iso885915_80 = { { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, + 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, + 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, + 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, + 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, + 0x20AC, 0x00A5, 0x0160, 0x00A7, 0x0161, 0x00A9, + 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x017D, 0x00B5, + 0x00B6, 0x00B7, 0x017E, 0x00B9, 0x00BA, 0x00BB, + 0x0152, 0x0153, 0x0178, 0x00BF, +} }; + +/* end of stage 2 tables for ISO-8859-15 }}} */ + +/* {{{ Stage 1 table for ISO-8859-15 */ +static const enc_to_uni enc_to_uni_iso885915 = { { + &enc_to_uni_s2_iso88591_00, + &enc_to_uni_s2_iso88591_40, + &enc_to_uni_s2_iso885915_80, + &enc_to_uni_s2_iso88591_C0 } +}; +/* end of stage 1 table for ISO-8859-15 }}} */ + +/* {{{ Mappings *to* Unicode for Windows-1252 */ + +/* {{{ Stage 2 tables for Windows-1252 */ + +static const enc_to_uni_stage2 enc_to_uni_s2_win1252_80 = { { + 0x20AC, 0xFFFF, 0x201A, 0x0192, 0x201E, 0x2026, + 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, + 0x0152, 0xFFFF, 0x017D, 0xFFFF, 0xFFFF, 0x2018, + 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0xFFFF, + 0x017E, 0x0178, 0x00A0, 0x00A1, 0x00A2, 0x00A3, + 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, + 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, + 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, + 0x00BC, 0x00BD, 0x00BE, 0x00BF, +} }; + +/* end of stage 2 tables for Windows-1252 }}} */ + +/* {{{ Stage 1 table for Windows-1252 */ +static const enc_to_uni enc_to_uni_win1252 = { { + &enc_to_uni_s2_iso88591_00, + &enc_to_uni_s2_iso88591_40, + &enc_to_uni_s2_win1252_80, + &enc_to_uni_s2_iso88591_C0 } +}; +/* end of stage 1 table for Windows-1252 }}} */ + +/* {{{ Mappings *to* Unicode for Windows-1251 */ + +/* {{{ Stage 2 tables for Windows-1251 */ + +static const enc_to_uni_stage2 enc_to_uni_s2_win1251_80 = { { + 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, + 0x2020, 0x2021, 0x20AC, 0x2030, 0x0409, 0x2039, + 0x040A, 0x040C, 0x040B, 0x040F, 0x0452, 0x2018, + 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0xFFFF, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, + 0x045B, 0x045F, 0x00A0, 0x040E, 0x045E, 0x0408, + 0x00A4, 0x0490, 0x00A6, 0x00A7, 0x0401, 0x00A9, + 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, + 0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, + 0x00B6, 0x00B7, 0x0451, 0x2116, 0x0454, 0x00BB, + 0x0458, 0x0405, 0x0455, 0x0457, +} }; + +static const enc_to_uni_stage2 enc_to_uni_s2_win1251_C0 = { { + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, + 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, + 0x041C, 0x041D, 0x041E, 0x041F, 0x0420, 0x0421, + 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, + 0x042E, 0x042F, 0x0430, 0x0431, 0x0432, 0x0433, + 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, + 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, + 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, + 0x044C, 0x044D, 0x044E, 0x044F, +} }; + +/* end of stage 2 tables for Windows-1251 }}} */ + +/* {{{ Stage 1 table for Windows-1251 */ +static const enc_to_uni enc_to_uni_win1251 = { { + &enc_to_uni_s2_iso88591_00, + &enc_to_uni_s2_iso88591_40, + &enc_to_uni_s2_win1251_80, + &enc_to_uni_s2_win1251_C0 } +}; +/* end of stage 1 table for Windows-1251 }}} */ + +/* {{{ Mappings *to* Unicode for KOI8-R */ + +/* {{{ Stage 2 tables for KOI8-R */ + +static const enc_to_uni_stage2 enc_to_uni_s2_koi8r_80 = { { + 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, + 0x251C, 0x2524, 0x252C, 0x2534, 0x253C, 0x2580, + 0x2584, 0x2588, 0x258C, 0x2590, 0x2591, 0x2592, + 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, + 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, + 0x00B7, 0x00F7, 0x2550, 0x2551, 0x2552, 0x0451, + 0x2553, 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, + 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E, + 0x255F, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, + 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, 0x2569, + 0x256A, 0x256B, 0x256C, 0x00A9, +} }; + +static const enc_to_uni_stage2 enc_to_uni_s2_koi8r_C0 = { { + 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, + 0x0444, 0x0433, 0x0445, 0x0438, 0x0439, 0x043A, + 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x044F, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, + 0x0447, 0x044A, 0x042E, 0x0410, 0x0411, 0x0426, + 0x0414, 0x0415, 0x0424, 0x0413, 0x0425, 0x0418, + 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, + 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, + 0x0416, 0x0412, 0x042C, 0x042B, 0x0417, 0x0428, + 0x042D, 0x0429, 0x0427, 0x042A, +} }; + +/* end of stage 2 tables for KOI8-R }}} */ + +/* {{{ Stage 1 table for KOI8-R */ +static const enc_to_uni enc_to_uni_koi8r = { { + &enc_to_uni_s2_iso88591_00, + &enc_to_uni_s2_iso88591_40, + &enc_to_uni_s2_koi8r_80, + &enc_to_uni_s2_koi8r_C0 } +}; +/* end of stage 1 table for KOI8-R }}} */ + +/* {{{ Mappings *to* Unicode for CP-866 */ + +/* {{{ Stage 2 tables for CP-866 */ + +static const enc_to_uni_stage2 enc_to_uni_s2_cp866_80 = { { + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, + 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, + 0x041C, 0x041D, 0x041E, 0x041F, 0x0420, 0x0421, + 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, + 0x042E, 0x042F, 0x0430, 0x0431, 0x0432, 0x0433, + 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, + 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, + 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, + 0x255D, 0x255C, 0x255B, 0x2510, +} }; + +static const enc_to_uni_stage2 enc_to_uni_s2_cp866_C0 = { { + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, + 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, + 0x2560, 0x2550, 0x256C, 0x2567, 0x2568, 0x2564, + 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, + 0x2590, 0x2580, 0x0440, 0x0441, 0x0442, 0x0443, + 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, + 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, + 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, + 0x040E, 0x045E, 0x00B0, 0x2219, 0x00B7, 0x221A, + 0x2116, 0x00A4, 0x25A0, 0x00A0, +} }; + +/* end of stage 2 tables for CP-866 }}} */ + +/* {{{ Stage 1 table for CP-866 */ +static const enc_to_uni enc_to_uni_cp866 = { { + &enc_to_uni_s2_iso88591_00, + &enc_to_uni_s2_iso88591_40, + &enc_to_uni_s2_cp866_80, + &enc_to_uni_s2_cp866_C0 } +}; +/* end of stage 1 table for CP-866 }}} */ + +/* {{{ Mappings *to* Unicode for MacRoman */ + +/* {{{ Stage 2 tables for MacRoman */ + +static const enc_to_uni_stage2 enc_to_uni_s2_macroman_00 = { { + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0x0020, 0x0021, 0x0022, 0x0023, + 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, + 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, + 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, + 0x003C, 0x003D, 0x003E, 0x003F, +} }; + +static const enc_to_uni_stage2 enc_to_uni_s2_macroman_40 = { { + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, + 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, + 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, + 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, + 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, + 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, + 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, + 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, + 0x007C, 0x007D, 0x007E, 0xFFFF, +} }; + +static const enc_to_uni_stage2 enc_to_uni_s2_macroman_80 = { { + 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, + 0x00DC, 0x00E1, 0x00E0, 0x00E2, 0x00E4, 0x00E3, + 0x00E5, 0x00E7, 0x00E9, 0x00E8, 0x00EA, 0x00EB, + 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, + 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, + 0x00FB, 0x00FC, 0x2020, 0x00B0, 0x00A2, 0x00A3, + 0x00A7, 0x2022, 0x00B6, 0x00DF, 0x00AE, 0x00A9, + 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8, + 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, + 0x2202, 0x2211, 0x220F, 0x03C0, 0x222B, 0x00AA, + 0x00BA, 0x03A9, 0x00E6, 0x00F8, +} }; + +static const enc_to_uni_stage2 enc_to_uni_s2_macroman_C0 = { { + 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, + 0x2206, 0x00AB, 0x00BB, 0x2026, 0x00A0, 0x00C0, + 0x00C3, 0x00D5, 0x0152, 0x0153, 0x2013, 0x2014, + 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, + 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, + 0xFB01, 0xFB02, 0x2021, 0x00B7, 0x201A, 0x201E, + 0x2030, 0x00C2, 0x00CA, 0x00C1, 0x00CB, 0x00C8, + 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, + 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, + 0x02C6, 0x02DC, 0x00AF, 0x02D8, 0x02D9, 0x02DA, + 0x00B8, 0x02DD, 0x02DB, 0x02C7, +} }; + +/* end of stage 2 tables for MacRoman }}} */ + +/* {{{ Stage 1 table for MacRoman */ +static const enc_to_uni enc_to_uni_macroman = { { + &enc_to_uni_s2_macroman_00, + &enc_to_uni_s2_macroman_40, + &enc_to_uni_s2_macroman_80, + &enc_to_uni_s2_macroman_C0 } +}; +/* end of stage 1 table for MacRoman }}} */ + +/* {{{ Index of tables for encoding conversion */ +static const enc_to_uni *const enc_to_uni_index[cs_numelems] = { + NULL, + &enc_to_uni_iso88591, + &enc_to_uni_win1252, + &enc_to_uni_iso885915, + &enc_to_uni_win1251, + &enc_to_uni_iso88595, + &enc_to_uni_cp866, + &enc_to_uni_macroman, + &enc_to_uni_koi8r, +}; +/* }}} */ + +/* Definitions for mappings *from* Unicode */ + +typedef struct { + unsigned short un_code_point; /* we don't need bigger */ + unsigned char cs_code; /* currently, we only have maps to single-byte encodings */ +} uni_to_enc; + +/* {{{ Mappings *from* Unicode for ISO-8859-15 */ +static const uni_to_enc unimap_iso885915[] = { + { 0x00A5, 0xA5 }, /* yen sign */ + { 0x00A7, 0xA7 }, /* section sign */ + { 0x00A9, 0xA9 }, /* copyright sign */ + { 0x00AA, 0xAA }, /* feminine ordinal indicator */ + { 0x00AB, 0xAB }, /* left-pointing double angle quotation mark */ + { 0x00AC, 0xAC }, /* not sign */ + { 0x00AD, 0xAD }, /* soft hyphen */ + { 0x00AE, 0xAE }, /* registered sign */ + { 0x00AF, 0xAF }, /* macron */ + { 0x00B0, 0xB0 }, /* degree sign */ + { 0x00B1, 0xB1 }, /* plus-minus sign */ + { 0x00B2, 0xB2 }, /* superscript two */ + { 0x00B3, 0xB3 }, /* superscript three */ + { 0x00B5, 0xB5 }, /* micro sign */ + { 0x00B6, 0xB6 }, /* pilcrow sign */ + { 0x00B7, 0xB7 }, /* middle dot */ + { 0x00B9, 0xB9 }, /* superscript one */ + { 0x00BA, 0xBA }, /* masculine ordinal indicator */ + { 0x00BB, 0xBB }, /* right-pointing double angle quotation mark */ + { 0x0152, 0xBC }, /* latin capital ligature oe */ + { 0x0153, 0xBD }, /* latin small ligature oe */ + { 0x0160, 0xA6 }, /* latin capital letter s with caron */ + { 0x0161, 0xA8 }, /* latin small letter s with caron */ + { 0x0178, 0xBE }, /* latin capital letter y with diaeresis */ + { 0x017D, 0xB4 }, /* latin capital letter z with caron */ + { 0x017E, 0xB8 }, /* latin small letter z with caron */ + { 0x20AC, 0xA4 }, /* euro sign */ +}; +/* {{{ end of mappings *from* Unicode for ISO-8859-15 */ + +/* {{{ Mappings *from* Unicode for Windows-1252 */ +static const uni_to_enc unimap_win1252[] = { + { 0x0152, 0x8C }, /* latin capital ligature oe */ + { 0x0153, 0x9C }, /* latin small ligature oe */ + { 0x0160, 0x8A }, /* latin capital letter s with caron */ + { 0x0161, 0x9A }, /* latin small letter s with caron */ + { 0x0178, 0x9F }, /* latin capital letter y with diaeresis */ + { 0x017D, 0x8E }, /* latin capital letter z with caron */ + { 0x017E, 0x9E }, /* latin small letter z with caron */ + { 0x0192, 0x83 }, /* latin small letter f with hook */ + { 0x02C6, 0x88 }, /* modifier letter circumflex accent */ + { 0x02DC, 0x98 }, /* small tilde */ + { 0x2013, 0x96 }, /* en dash */ + { 0x2014, 0x97 }, /* em dash */ + { 0x2018, 0x91 }, /* left single quotation mark */ + { 0x2019, 0x92 }, /* right single quotation mark */ + { 0x201A, 0x82 }, /* single low-9 quotation mark */ + { 0x201C, 0x93 }, /* left double quotation mark */ + { 0x201D, 0x94 }, /* right double quotation mark */ + { 0x201E, 0x84 }, /* double low-9 quotation mark */ + { 0x2020, 0x86 }, /* dagger */ + { 0x2021, 0x87 }, /* double dagger */ + { 0x2022, 0x95 }, /* bullet */ + { 0x2026, 0x85 }, /* horizontal ellipsis */ + { 0x2030, 0x89 }, /* per mille sign */ + { 0x2039, 0x8B }, /* single left-pointing angle quotation mark */ + { 0x203A, 0x9B }, /* single right-pointing angle quotation mark */ + { 0x20AC, 0x80 }, /* euro sign */ + { 0x2122, 0x99 }, /* trade mark sign */ +}; +/* {{{ end of mappings *from* Unicode for Windows-1252 */ + +/* {{{ Mappings *from* Unicode for Windows-1251 */ +static const uni_to_enc unimap_win1251[] = { + { 0x00A0, 0xA0 }, /* no-break space */ + { 0x00A4, 0xA4 }, /* currency sign */ + { 0x00A6, 0xA6 }, /* broken bar */ + { 0x00A7, 0xA7 }, /* section sign */ + { 0x00A9, 0xA9 }, /* copyright sign */ + { 0x00AB, 0xAB }, /* left-pointing double angle quotation mark */ + { 0x00AC, 0xAC }, /* not sign */ + { 0x00AD, 0xAD }, /* soft hyphen */ + { 0x00AE, 0xAE }, /* registered sign */ + { 0x00B0, 0xB0 }, /* degree sign */ + { 0x00B1, 0xB1 }, /* plus-minus sign */ + { 0x00B5, 0xB5 }, /* micro sign */ + { 0x00B6, 0xB6 }, /* pilcrow sign */ + { 0x00B7, 0xB7 }, /* middle dot */ + { 0x00BB, 0xBB }, /* right-pointing double angle quotation mark */ + { 0x0401, 0xA8 }, /* cyrillic capital letter io */ + { 0x0402, 0x80 }, /* cyrillic capital letter dje */ + { 0x0403, 0x81 }, /* cyrillic capital letter gje */ + { 0x0404, 0xAA }, /* cyrillic capital letter ukrainian ie */ + { 0x0405, 0xBD }, /* cyrillic capital letter dze */ + { 0x0406, 0xB2 }, /* cyrillic capital letter byelorussian-ukrainian i */ + { 0x0407, 0xAF }, /* cyrillic capital letter yi */ + { 0x0408, 0xA3 }, /* cyrillic capital letter je */ + { 0x0409, 0x8A }, /* cyrillic capital letter lje */ + { 0x040A, 0x8C }, /* cyrillic capital letter nje */ + { 0x040B, 0x8E }, /* cyrillic capital letter tshe */ + { 0x040C, 0x8D }, /* cyrillic capital letter kje */ + { 0x040E, 0xA1 }, /* cyrillic capital letter short u */ + { 0x040F, 0x8F }, /* cyrillic capital letter dzhe */ + { 0x0410, 0xC0 }, /* cyrillic capital letter a */ + { 0x0411, 0xC1 }, /* cyrillic capital letter be */ + { 0x0412, 0xC2 }, /* cyrillic capital letter ve */ + { 0x0413, 0xC3 }, /* cyrillic capital letter ghe */ + { 0x0414, 0xC4 }, /* cyrillic capital letter de */ + { 0x0415, 0xC5 }, /* cyrillic capital letter ie */ + { 0x0416, 0xC6 }, /* cyrillic capital letter zhe */ + { 0x0417, 0xC7 }, /* cyrillic capital letter ze */ + { 0x0418, 0xC8 }, /* cyrillic capital letter i */ + { 0x0419, 0xC9 }, /* cyrillic capital letter short i */ + { 0x041A, 0xCA }, /* cyrillic capital letter ka */ + { 0x041B, 0xCB }, /* cyrillic capital letter el */ + { 0x041C, 0xCC }, /* cyrillic capital letter em */ + { 0x041D, 0xCD }, /* cyrillic capital letter en */ + { 0x041E, 0xCE }, /* cyrillic capital letter o */ + { 0x041F, 0xCF }, /* cyrillic capital letter pe */ + { 0x0420, 0xD0 }, /* cyrillic capital letter er */ + { 0x0421, 0xD1 }, /* cyrillic capital letter es */ + { 0x0422, 0xD2 }, /* cyrillic capital letter te */ + { 0x0423, 0xD3 }, /* cyrillic capital letter u */ + { 0x0424, 0xD4 }, /* cyrillic capital letter ef */ + { 0x0425, 0xD5 }, /* cyrillic capital letter ha */ + { 0x0426, 0xD6 }, /* cyrillic capital letter tse */ + { 0x0427, 0xD7 }, /* cyrillic capital letter che */ + { 0x0428, 0xD8 }, /* cyrillic capital letter sha */ + { 0x0429, 0xD9 }, /* cyrillic capital letter shcha */ + { 0x042A, 0xDA }, /* cyrillic capital letter hard sign */ + { 0x042B, 0xDB }, /* cyrillic capital letter yeru */ + { 0x042C, 0xDC }, /* cyrillic capital letter soft sign */ + { 0x042D, 0xDD }, /* cyrillic capital letter e */ + { 0x042E, 0xDE }, /* cyrillic capital letter yu */ + { 0x042F, 0xDF }, /* cyrillic capital letter ya */ + { 0x0430, 0xE0 }, /* cyrillic small letter a */ + { 0x0431, 0xE1 }, /* cyrillic small letter be */ + { 0x0432, 0xE2 }, /* cyrillic small letter ve */ + { 0x0433, 0xE3 }, /* cyrillic small letter ghe */ + { 0x0434, 0xE4 }, /* cyrillic small letter de */ + { 0x0435, 0xE5 }, /* cyrillic small letter ie */ + { 0x0436, 0xE6 }, /* cyrillic small letter zhe */ + { 0x0437, 0xE7 }, /* cyrillic small letter ze */ + { 0x0438, 0xE8 }, /* cyrillic small letter i */ + { 0x0439, 0xE9 }, /* cyrillic small letter short i */ + { 0x043A, 0xEA }, /* cyrillic small letter ka */ + { 0x043B, 0xEB }, /* cyrillic small letter el */ + { 0x043C, 0xEC }, /* cyrillic small letter em */ + { 0x043D, 0xED }, /* cyrillic small letter en */ + { 0x043E, 0xEE }, /* cyrillic small letter o */ + { 0x043F, 0xEF }, /* cyrillic small letter pe */ + { 0x0440, 0xF0 }, /* cyrillic small letter er */ + { 0x0441, 0xF1 }, /* cyrillic small letter es */ + { 0x0442, 0xF2 }, /* cyrillic small letter te */ + { 0x0443, 0xF3 }, /* cyrillic small letter u */ + { 0x0444, 0xF4 }, /* cyrillic small letter ef */ + { 0x0445, 0xF5 }, /* cyrillic small letter ha */ + { 0x0446, 0xF6 }, /* cyrillic small letter tse */ + { 0x0447, 0xF7 }, /* cyrillic small letter che */ + { 0x0448, 0xF8 }, /* cyrillic small letter sha */ + { 0x0449, 0xF9 }, /* cyrillic small letter shcha */ + { 0x044A, 0xFA }, /* cyrillic small letter hard sign */ + { 0x044B, 0xFB }, /* cyrillic small letter yeru */ + { 0x044C, 0xFC }, /* cyrillic small letter soft sign */ + { 0x044D, 0xFD }, /* cyrillic small letter e */ + { 0x044E, 0xFE }, /* cyrillic small letter yu */ + { 0x044F, 0xFF }, /* cyrillic small letter ya */ + { 0x0451, 0xB8 }, /* cyrillic small letter io */ + { 0x0452, 0x90 }, /* cyrillic small letter dje */ + { 0x0453, 0x83 }, /* cyrillic small letter gje */ + { 0x0454, 0xBA }, /* cyrillic small letter ukrainian ie */ + { 0x0455, 0xBE }, /* cyrillic small letter dze */ + { 0x0456, 0xB3 }, /* cyrillic small letter byelorussian-ukrainian i */ + { 0x0457, 0xBF }, /* cyrillic small letter yi */ + { 0x0458, 0xBC }, /* cyrillic small letter je */ + { 0x0459, 0x9A }, /* cyrillic small letter lje */ + { 0x045A, 0x9C }, /* cyrillic small letter nje */ + { 0x045B, 0x9E }, /* cyrillic small letter tshe */ + { 0x045C, 0x9D }, /* cyrillic small letter kje */ + { 0x045E, 0xA2 }, /* cyrillic small letter short u */ + { 0x045F, 0x9F }, /* cyrillic small letter dzhe */ + { 0x0490, 0xA5 }, /* cyrillic capital letter ghe with upturn */ + { 0x0491, 0xB4 }, /* cyrillic small letter ghe with upturn */ + { 0x2013, 0x96 }, /* en dash */ + { 0x2014, 0x97 }, /* em dash */ + { 0x2018, 0x91 }, /* left single quotation mark */ + { 0x2019, 0x92 }, /* right single quotation mark */ + { 0x201A, 0x82 }, /* single low-9 quotation mark */ + { 0x201C, 0x93 }, /* left double quotation mark */ + { 0x201D, 0x94 }, /* right double quotation mark */ + { 0x201E, 0x84 }, /* double low-9 quotation mark */ + { 0x2020, 0x86 }, /* dagger */ + { 0x2021, 0x87 }, /* double dagger */ + { 0x2022, 0x95 }, /* bullet */ + { 0x2026, 0x85 }, /* horizontal ellipsis */ + { 0x2030, 0x89 }, /* per mille sign */ + { 0x2039, 0x8B }, /* single left-pointing angle quotation mark */ + { 0x203A, 0x9B }, /* single right-pointing angle quotation mark */ + { 0x20AC, 0x88 }, /* euro sign */ + { 0x2116, 0xB9 }, /* numero sign */ + { 0x2122, 0x99 }, /* trade mark sign */ +}; +/* {{{ end of mappings *from* Unicode for Windows-1251 */ + +/* {{{ Mappings *from* Unicode for KOI8-R */ +static const uni_to_enc unimap_koi8r[] = { + { 0x00A0, 0x9A }, /* no-break space */ + { 0x00A9, 0xBF }, /* copyright sign */ + { 0x00B0, 0x9C }, /* degree sign */ + { 0x00B2, 0x9D }, /* superscript two */ + { 0x00B7, 0x9E }, /* middle dot */ + { 0x00F7, 0x9F }, /* division sign */ + { 0x0401, 0xB3 }, /* cyrillic capital letter io */ + { 0x0410, 0xE1 }, /* cyrillic capital letter a */ + { 0x0411, 0xE2 }, /* cyrillic capital letter be */ + { 0x0412, 0xF7 }, /* cyrillic capital letter ve */ + { 0x0413, 0xE7 }, /* cyrillic capital letter ghe */ + { 0x0414, 0xE4 }, /* cyrillic capital letter de */ + { 0x0415, 0xE5 }, /* cyrillic capital letter ie */ + { 0x0416, 0xF6 }, /* cyrillic capital letter zhe */ + { 0x0417, 0xFA }, /* cyrillic capital letter ze */ + { 0x0418, 0xE9 }, /* cyrillic capital letter i */ + { 0x0419, 0xEA }, /* cyrillic capital letter short i */ + { 0x041A, 0xEB }, /* cyrillic capital letter ka */ + { 0x041B, 0xEC }, /* cyrillic capital letter el */ + { 0x041C, 0xED }, /* cyrillic capital letter em */ + { 0x041D, 0xEE }, /* cyrillic capital letter en */ + { 0x041E, 0xEF }, /* cyrillic capital letter o */ + { 0x041F, 0xF0 }, /* cyrillic capital letter pe */ + { 0x0420, 0xF2 }, /* cyrillic capital letter er */ + { 0x0421, 0xF3 }, /* cyrillic capital letter es */ + { 0x0422, 0xF4 }, /* cyrillic capital letter te */ + { 0x0423, 0xF5 }, /* cyrillic capital letter u */ + { 0x0424, 0xE6 }, /* cyrillic capital letter ef */ + { 0x0425, 0xE8 }, /* cyrillic capital letter ha */ + { 0x0426, 0xE3 }, /* cyrillic capital letter tse */ + { 0x0427, 0xFE }, /* cyrillic capital letter che */ + { 0x0428, 0xFB }, /* cyrillic capital letter sha */ + { 0x0429, 0xFD }, /* cyrillic capital letter shcha */ + { 0x042A, 0xFF }, /* cyrillic capital letter hard sign */ + { 0x042B, 0xF9 }, /* cyrillic capital letter yeru */ + { 0x042C, 0xF8 }, /* cyrillic capital letter soft sign */ + { 0x042D, 0xFC }, /* cyrillic capital letter e */ + { 0x042E, 0xE0 }, /* cyrillic capital letter yu */ + { 0x042F, 0xF1 }, /* cyrillic capital letter ya */ + { 0x0430, 0xC1 }, /* cyrillic small letter a */ + { 0x0431, 0xC2 }, /* cyrillic small letter be */ + { 0x0432, 0xD7 }, /* cyrillic small letter ve */ + { 0x0433, 0xC7 }, /* cyrillic small letter ghe */ + { 0x0434, 0xC4 }, /* cyrillic small letter de */ + { 0x0435, 0xC5 }, /* cyrillic small letter ie */ + { 0x0436, 0xD6 }, /* cyrillic small letter zhe */ + { 0x0437, 0xDA }, /* cyrillic small letter ze */ + { 0x0438, 0xC9 }, /* cyrillic small letter i */ + { 0x0439, 0xCA }, /* cyrillic small letter short i */ + { 0x043A, 0xCB }, /* cyrillic small letter ka */ + { 0x043B, 0xCC }, /* cyrillic small letter el */ + { 0x043C, 0xCD }, /* cyrillic small letter em */ + { 0x043D, 0xCE }, /* cyrillic small letter en */ + { 0x043E, 0xCF }, /* cyrillic small letter o */ + { 0x043F, 0xD0 }, /* cyrillic small letter pe */ + { 0x0440, 0xD2 }, /* cyrillic small letter er */ + { 0x0441, 0xD3 }, /* cyrillic small letter es */ + { 0x0442, 0xD4 }, /* cyrillic small letter te */ + { 0x0443, 0xD5 }, /* cyrillic small letter u */ + { 0x0444, 0xC6 }, /* cyrillic small letter ef */ + { 0x0445, 0xC8 }, /* cyrillic small letter ha */ + { 0x0446, 0xC3 }, /* cyrillic small letter tse */ + { 0x0447, 0xDE }, /* cyrillic small letter che */ + { 0x0448, 0xDB }, /* cyrillic small letter sha */ + { 0x0449, 0xDD }, /* cyrillic small letter shcha */ + { 0x044A, 0xDF }, /* cyrillic small letter hard sign */ + { 0x044B, 0xD9 }, /* cyrillic small letter yeru */ + { 0x044C, 0xD8 }, /* cyrillic small letter soft sign */ + { 0x044D, 0xDC }, /* cyrillic small letter e */ + { 0x044E, 0xC0 }, /* cyrillic small letter yu */ + { 0x044F, 0xD1 }, /* cyrillic small letter ya */ + { 0x0451, 0xA3 }, /* cyrillic small letter io */ + { 0x2219, 0x95 }, /* bullet operator */ + { 0x221A, 0x96 }, /* square root */ + { 0x2248, 0x97 }, /* almost equal to */ + { 0x2264, 0x98 }, /* less-than or equal to */ + { 0x2265, 0x99 }, /* greater-than or equal to */ + { 0x2320, 0x93 }, /* top half integral */ + { 0x2321, 0x9B }, /* bottom half integral */ + { 0x2500, 0x80 }, /* box drawings light horizontal */ + { 0x2502, 0x81 }, /* box drawings light vertical */ + { 0x250C, 0x82 }, /* box drawings light down and right */ + { 0x2510, 0x83 }, /* box drawings light down and left */ + { 0x2514, 0x84 }, /* box drawings light up and right */ + { 0x2518, 0x85 }, /* box drawings light up and left */ + { 0x251C, 0x86 }, /* box drawings light vertical and right */ + { 0x2524, 0x87 }, /* box drawings light vertical and left */ + { 0x252C, 0x88 }, /* box drawings light down and horizontal */ + { 0x2534, 0x89 }, /* box drawings light up and horizontal */ + { 0x253C, 0x8A }, /* box drawings light vertical and horizontal */ + { 0x2550, 0xA0 }, /* box drawings double horizontal */ + { 0x2551, 0xA1 }, /* box drawings double vertical */ + { 0x2552, 0xA2 }, /* box drawings down single and right double */ + { 0x2553, 0xA4 }, /* box drawings down double and right single */ + { 0x2554, 0xA5 }, /* box drawings double down and right */ + { 0x2555, 0xA6 }, /* box drawings down single and left double */ + { 0x2556, 0xA7 }, /* box drawings down double and left single */ + { 0x2557, 0xA8 }, /* box drawings double down and left */ + { 0x2558, 0xA9 }, /* box drawings up single and right double */ + { 0x2559, 0xAA }, /* box drawings up double and right single */ + { 0x255A, 0xAB }, /* box drawings double up and right */ + { 0x255B, 0xAC }, /* box drawings up single and left double */ + { 0x255C, 0xAD }, /* box drawings up double and left single */ + { 0x255D, 0xAE }, /* box drawings double up and left */ + { 0x255E, 0xAF }, /* box drawings vertical single and right double */ + { 0x255F, 0xB0 }, /* box drawings vertical double and right single */ + { 0x2560, 0xB1 }, /* box drawings double vertical and right */ + { 0x2561, 0xB2 }, /* box drawings vertical single and left double */ + { 0x2562, 0xB4 }, /* box drawings vertical double and left single */ + { 0x2563, 0xB5 }, /* box drawings double vertical and left */ + { 0x2564, 0xB6 }, /* box drawings down single and horizontal double */ + { 0x2565, 0xB7 }, /* box drawings down double and horizontal single */ + { 0x2566, 0xB8 }, /* box drawings double down and horizontal */ + { 0x2567, 0xB9 }, /* box drawings up single and horizontal double */ + { 0x2568, 0xBA }, /* box drawings up double and horizontal single */ + { 0x2569, 0xBB }, /* box drawings double up and horizontal */ + { 0x256A, 0xBC }, /* box drawings vertical single and horizontal double */ + { 0x256B, 0xBD }, /* box drawings vertical double and horizontal single */ + { 0x256C, 0xBE }, /* box drawings double vertical and horizontal */ + { 0x2580, 0x8B }, /* upper half block */ + { 0x2584, 0x8C }, /* lower half block */ + { 0x2588, 0x8D }, /* full block */ + { 0x258C, 0x8E }, /* left half block */ + { 0x2590, 0x8F }, /* right half block */ + { 0x2591, 0x90 }, /* light shade */ + { 0x2592, 0x91 }, /* medium shade */ + { 0x2593, 0x92 }, /* dark shade */ + { 0x25A0, 0x94 }, /* black square */ +}; +/* {{{ end of mappings *from* Unicode for KOI8-R */ + +/* {{{ Mappings *from* Unicode for CP-866 */ +static const uni_to_enc unimap_cp866[] = { + { 0x00A0, 0xFF }, /* no-break space */ + { 0x00A4, 0xFD }, /* currency sign */ + { 0x00B0, 0xF8 }, /* degree sign */ + { 0x00B7, 0xFA }, /* middle dot */ + { 0x0401, 0xF0 }, /* cyrillic capital letter io */ + { 0x0404, 0xF2 }, /* cyrillic capital letter ukrainian ie */ + { 0x0407, 0xF4 }, /* cyrillic capital letter yi */ + { 0x040E, 0xF6 }, /* cyrillic capital letter short u */ + { 0x0410, 0x80 }, /* cyrillic capital letter a */ + { 0x0411, 0x81 }, /* cyrillic capital letter be */ + { 0x0412, 0x82 }, /* cyrillic capital letter ve */ + { 0x0413, 0x83 }, /* cyrillic capital letter ghe */ + { 0x0414, 0x84 }, /* cyrillic capital letter de */ + { 0x0415, 0x85 }, /* cyrillic capital letter ie */ + { 0x0416, 0x86 }, /* cyrillic capital letter zhe */ + { 0x0417, 0x87 }, /* cyrillic capital letter ze */ + { 0x0418, 0x88 }, /* cyrillic capital letter i */ + { 0x0419, 0x89 }, /* cyrillic capital letter short i */ + { 0x041A, 0x8A }, /* cyrillic capital letter ka */ + { 0x041B, 0x8B }, /* cyrillic capital letter el */ + { 0x041C, 0x8C }, /* cyrillic capital letter em */ + { 0x041D, 0x8D }, /* cyrillic capital letter en */ + { 0x041E, 0x8E }, /* cyrillic capital letter o */ + { 0x041F, 0x8F }, /* cyrillic capital letter pe */ + { 0x0420, 0x90 }, /* cyrillic capital letter er */ + { 0x0421, 0x91 }, /* cyrillic capital letter es */ + { 0x0422, 0x92 }, /* cyrillic capital letter te */ + { 0x0423, 0x93 }, /* cyrillic capital letter u */ + { 0x0424, 0x94 }, /* cyrillic capital letter ef */ + { 0x0425, 0x95 }, /* cyrillic capital letter ha */ + { 0x0426, 0x96 }, /* cyrillic capital letter tse */ + { 0x0427, 0x97 }, /* cyrillic capital letter che */ + { 0x0428, 0x98 }, /* cyrillic capital letter sha */ + { 0x0429, 0x99 }, /* cyrillic capital letter shcha */ + { 0x042A, 0x9A }, /* cyrillic capital letter hard sign */ + { 0x042B, 0x9B }, /* cyrillic capital letter yeru */ + { 0x042C, 0x9C }, /* cyrillic capital letter soft sign */ + { 0x042D, 0x9D }, /* cyrillic capital letter e */ + { 0x042E, 0x9E }, /* cyrillic capital letter yu */ + { 0x042F, 0x9F }, /* cyrillic capital letter ya */ + { 0x0430, 0xA0 }, /* cyrillic small letter a */ + { 0x0431, 0xA1 }, /* cyrillic small letter be */ + { 0x0432, 0xA2 }, /* cyrillic small letter ve */ + { 0x0433, 0xA3 }, /* cyrillic small letter ghe */ + { 0x0434, 0xA4 }, /* cyrillic small letter de */ + { 0x0435, 0xA5 }, /* cyrillic small letter ie */ + { 0x0436, 0xA6 }, /* cyrillic small letter zhe */ + { 0x0437, 0xA7 }, /* cyrillic small letter ze */ + { 0x0438, 0xA8 }, /* cyrillic small letter i */ + { 0x0439, 0xA9 }, /* cyrillic small letter short i */ + { 0x043A, 0xAA }, /* cyrillic small letter ka */ + { 0x043B, 0xAB }, /* cyrillic small letter el */ + { 0x043C, 0xAC }, /* cyrillic small letter em */ + { 0x043D, 0xAD }, /* cyrillic small letter en */ + { 0x043E, 0xAE }, /* cyrillic small letter o */ + { 0x043F, 0xAF }, /* cyrillic small letter pe */ + { 0x0440, 0xE0 }, /* cyrillic small letter er */ + { 0x0441, 0xE1 }, /* cyrillic small letter es */ + { 0x0442, 0xE2 }, /* cyrillic small letter te */ + { 0x0443, 0xE3 }, /* cyrillic small letter u */ + { 0x0444, 0xE4 }, /* cyrillic small letter ef */ + { 0x0445, 0xE5 }, /* cyrillic small letter ha */ + { 0x0446, 0xE6 }, /* cyrillic small letter tse */ + { 0x0447, 0xE7 }, /* cyrillic small letter che */ + { 0x0448, 0xE8 }, /* cyrillic small letter sha */ + { 0x0449, 0xE9 }, /* cyrillic small letter shcha */ + { 0x044A, 0xEA }, /* cyrillic small letter hard sign */ + { 0x044B, 0xEB }, /* cyrillic small letter yeru */ + { 0x044C, 0xEC }, /* cyrillic small letter soft sign */ + { 0x044D, 0xED }, /* cyrillic small letter e */ + { 0x044E, 0xEE }, /* cyrillic small letter yu */ + { 0x044F, 0xEF }, /* cyrillic small letter ya */ + { 0x0451, 0xF1 }, /* cyrillic small letter io */ + { 0x0454, 0xF3 }, /* cyrillic small letter ukrainian ie */ + { 0x0457, 0xF5 }, /* cyrillic small letter yi */ + { 0x045E, 0xF7 }, /* cyrillic small letter short u */ + { 0x2116, 0xFC }, /* numero sign */ + { 0x2219, 0xF9 }, /* bullet operator */ + { 0x221A, 0xFB }, /* square root */ + { 0x2500, 0xC4 }, /* box drawings light horizontal */ + { 0x2502, 0xB3 }, /* box drawings light vertical */ + { 0x250C, 0xDA }, /* box drawings light down and right */ + { 0x2510, 0xBF }, /* box drawings light down and left */ + { 0x2514, 0xC0 }, /* box drawings light up and right */ + { 0x2518, 0xD9 }, /* box drawings light up and left */ + { 0x251C, 0xC3 }, /* box drawings light vertical and right */ + { 0x2524, 0xB4 }, /* box drawings light vertical and left */ + { 0x252C, 0xC2 }, /* box drawings light down and horizontal */ + { 0x2534, 0xC1 }, /* box drawings light up and horizontal */ + { 0x253C, 0xC5 }, /* box drawings light vertical and horizontal */ + { 0x2550, 0xCD }, /* box drawings double horizontal */ + { 0x2551, 0xBA }, /* box drawings double vertical */ + { 0x2552, 0xD5 }, /* box drawings down single and right double */ + { 0x2553, 0xD6 }, /* box drawings down double and right single */ + { 0x2554, 0xC9 }, /* box drawings double down and right */ + { 0x2555, 0xB8 }, /* box drawings down single and left double */ + { 0x2556, 0xB7 }, /* box drawings down double and left single */ + { 0x2557, 0xBB }, /* box drawings double down and left */ + { 0x2558, 0xD4 }, /* box drawings up single and right double */ + { 0x2559, 0xD3 }, /* box drawings up double and right single */ + { 0x255A, 0xC8 }, /* box drawings double up and right */ + { 0x255B, 0xBE }, /* box drawings up single and left double */ + { 0x255C, 0xBD }, /* box drawings up double and left single */ + { 0x255D, 0xBC }, /* box drawings double up and left */ + { 0x255E, 0xC6 }, /* box drawings vertical single and right double */ + { 0x255F, 0xC7 }, /* box drawings vertical double and right single */ + { 0x2560, 0xCC }, /* box drawings double vertical and right */ + { 0x2561, 0xB5 }, /* box drawings vertical single and left double */ + { 0x2562, 0xB6 }, /* box drawings vertical double and left single */ + { 0x2563, 0xB9 }, /* box drawings double vertical and left */ + { 0x2564, 0xD1 }, /* box drawings down single and horizontal double */ + { 0x2565, 0xD2 }, /* box drawings down double and horizontal single */ + { 0x2566, 0xCB }, /* box drawings double down and horizontal */ + { 0x2567, 0xCF }, /* box drawings up single and horizontal double */ + { 0x2568, 0xD0 }, /* box drawings up double and horizontal single */ + { 0x2569, 0xCA }, /* box drawings double up and horizontal */ + { 0x256A, 0xD8 }, /* box drawings vertical single and horizontal double */ + { 0x256B, 0xD7 }, /* box drawings vertical double and horizontal single */ + { 0x256C, 0xCE }, /* box drawings double vertical and horizontal */ + { 0x2580, 0xDF }, /* upper half block */ + { 0x2584, 0xDC }, /* lower half block */ + { 0x2588, 0xDB }, /* full block */ + { 0x258C, 0xDD }, /* left half block */ + { 0x2590, 0xDE }, /* right half block */ + { 0x2591, 0xB0 }, /* light shade */ + { 0x2592, 0xB1 }, /* medium shade */ + { 0x2593, 0xB2 }, /* dark shade */ + { 0x25A0, 0xFE }, /* black square */ +}; +/* {{{ end of mappings *from* Unicode for CP-866 */ + +/* {{{ Mappings *from* Unicode for MacRoman */ +static const uni_to_enc unimap_macroman[] = { + { 0x00A0, 0xCA }, /* no-break space */ + { 0x00A1, 0xC1 }, /* inverted exclamation mark */ + { 0x00A2, 0xA2 }, /* cent sign */ + { 0x00A3, 0xA3 }, /* pound sign */ + { 0x00A5, 0xB4 }, /* yen sign */ + { 0x00A7, 0xA4 }, /* section sign */ + { 0x00A8, 0xAC }, /* diaeresis */ + { 0x00A9, 0xA9 }, /* copyright sign */ + { 0x00AA, 0xBB }, /* feminine ordinal indicator */ + { 0x00AB, 0xC7 }, /* left-pointing double angle quotation mark */ + { 0x00AC, 0xC2 }, /* not sign */ + { 0x00AE, 0xA8 }, /* registered sign */ + { 0x00AF, 0xF8 }, /* macron */ + { 0x00B0, 0xA1 }, /* degree sign */ + { 0x00B1, 0xB1 }, /* plus-minus sign */ + { 0x00B4, 0xAB }, /* acute accent */ + { 0x00B5, 0xB5 }, /* micro sign */ + { 0x00B6, 0xA6 }, /* pilcrow sign */ + { 0x00B7, 0xE1 }, /* middle dot */ + { 0x00B8, 0xFC }, /* cedilla */ + { 0x00BA, 0xBC }, /* masculine ordinal indicator */ + { 0x00BB, 0xC8 }, /* right-pointing double angle quotation mark */ + { 0x00BF, 0xC0 }, /* inverted question mark */ + { 0x00C0, 0xCB }, /* latin capital letter a with grave */ + { 0x00C1, 0xE7 }, /* latin capital letter a with acute */ + { 0x00C2, 0xE5 }, /* latin capital letter a with circumflex */ + { 0x00C3, 0xCC }, /* latin capital letter a with tilde */ + { 0x00C4, 0x80 }, /* latin capital letter a with diaeresis */ + { 0x00C5, 0x81 }, /* latin capital letter a with ring above */ + { 0x00C6, 0xAE }, /* latin capital letter ae */ + { 0x00C7, 0x82 }, /* latin capital letter c with cedilla */ + { 0x00C8, 0xE9 }, /* latin capital letter e with grave */ + { 0x00C9, 0x83 }, /* latin capital letter e with acute */ + { 0x00CA, 0xE6 }, /* latin capital letter e with circumflex */ + { 0x00CB, 0xE8 }, /* latin capital letter e with diaeresis */ + { 0x00CC, 0xED }, /* latin capital letter i with grave */ + { 0x00CD, 0xEA }, /* latin capital letter i with acute */ + { 0x00CE, 0xEB }, /* latin capital letter i with circumflex */ + { 0x00CF, 0xEC }, /* latin capital letter i with diaeresis */ + { 0x00D1, 0x84 }, /* latin capital letter n with tilde */ + { 0x00D2, 0xF1 }, /* latin capital letter o with grave */ + { 0x00D3, 0xEE }, /* latin capital letter o with acute */ + { 0x00D4, 0xEF }, /* latin capital letter o with circumflex */ + { 0x00D5, 0xCD }, /* latin capital letter o with tilde */ + { 0x00D6, 0x85 }, /* latin capital letter o with diaeresis */ + { 0x00D8, 0xAF }, /* latin capital letter o with stroke */ + { 0x00D9, 0xF4 }, /* latin capital letter u with grave */ + { 0x00DA, 0xF2 }, /* latin capital letter u with acute */ + { 0x00DB, 0xF3 }, /* latin capital letter u with circumflex */ + { 0x00DC, 0x86 }, /* latin capital letter u with diaeresis */ + { 0x00DF, 0xA7 }, /* latin small letter sharp s */ + { 0x00E0, 0x88 }, /* latin small letter a with grave */ + { 0x00E1, 0x87 }, /* latin small letter a with acute */ + { 0x00E2, 0x89 }, /* latin small letter a with circumflex */ + { 0x00E3, 0x8B }, /* latin small letter a with tilde */ + { 0x00E4, 0x8A }, /* latin small letter a with diaeresis */ + { 0x00E5, 0x8C }, /* latin small letter a with ring above */ + { 0x00E6, 0xBE }, /* latin small letter ae */ + { 0x00E7, 0x8D }, /* latin small letter c with cedilla */ + { 0x00E8, 0x8F }, /* latin small letter e with grave */ + { 0x00E9, 0x8E }, /* latin small letter e with acute */ + { 0x00EA, 0x90 }, /* latin small letter e with circumflex */ + { 0x00EB, 0x91 }, /* latin small letter e with diaeresis */ + { 0x00EC, 0x93 }, /* latin small letter i with grave */ + { 0x00ED, 0x92 }, /* latin small letter i with acute */ + { 0x00EE, 0x94 }, /* latin small letter i with circumflex */ + { 0x00EF, 0x95 }, /* latin small letter i with diaeresis */ + { 0x00F1, 0x96 }, /* latin small letter n with tilde */ + { 0x00F2, 0x98 }, /* latin small letter o with grave */ + { 0x00F3, 0x97 }, /* latin small letter o with acute */ + { 0x00F4, 0x99 }, /* latin small letter o with circumflex */ + { 0x00F5, 0x9B }, /* latin small letter o with tilde */ + { 0x00F6, 0x9A }, /* latin small letter o with diaeresis */ + { 0x00F7, 0xD6 }, /* division sign */ + { 0x00F8, 0xBF }, /* latin small letter o with stroke */ + { 0x00F9, 0x9D }, /* latin small letter u with grave */ + { 0x00FA, 0x9C }, /* latin small letter u with acute */ + { 0x00FB, 0x9E }, /* latin small letter u with circumflex */ + { 0x00FC, 0x9F }, /* latin small letter u with diaeresis */ + { 0x00FF, 0xD8 }, /* latin small letter y with diaeresis */ + { 0x0131, 0xF5 }, /* latin small letter dotless i */ + { 0x0152, 0xCE }, /* latin capital ligature oe */ + { 0x0153, 0xCF }, /* latin small ligature oe */ + { 0x0178, 0xD9 }, /* latin capital letter y with diaeresis */ + { 0x0192, 0xC4 }, /* latin small letter f with hook */ + { 0x02C6, 0xF6 }, /* modifier letter circumflex accent */ + { 0x02C7, 0xFF }, /* caron */ + { 0x02D8, 0xF9 }, /* breve */ + { 0x02D9, 0xFA }, /* dot above */ + { 0x02DA, 0xFB }, /* ring above */ + { 0x02DB, 0xFE }, /* ogonek */ + { 0x02DC, 0xF7 }, /* small tilde */ + { 0x02DD, 0xFD }, /* double acute accent */ + { 0x03A9, 0xBD }, /* greek capital letter omega */ + { 0x03C0, 0xB9 }, /* greek small letter pi */ + { 0x2013, 0xD0 }, /* en dash */ + { 0x2014, 0xD1 }, /* em dash */ + { 0x2018, 0xD4 }, /* left single quotation mark */ + { 0x2019, 0xD5 }, /* right single quotation mark */ + { 0x201A, 0xE2 }, /* single low-9 quotation mark */ + { 0x201C, 0xD2 }, /* left double quotation mark */ + { 0x201D, 0xD3 }, /* right double quotation mark */ + { 0x201E, 0xE3 }, /* double low-9 quotation mark */ + { 0x2020, 0xA0 }, /* dagger */ + { 0x2021, 0xE0 }, /* double dagger */ + { 0x2022, 0xA5 }, /* bullet */ + { 0x2026, 0xC9 }, /* horizontal ellipsis */ + { 0x2030, 0xE4 }, /* per mille sign */ + { 0x2039, 0xDC }, /* single left-pointing angle quotation mark */ + { 0x203A, 0xDD }, /* single right-pointing angle quotation mark */ + { 0x2044, 0xDA }, /* fraction slash */ + { 0x20AC, 0xDB }, /* euro sign */ + { 0x2122, 0xAA }, /* trade mark sign */ + { 0x2202, 0xB6 }, /* partial differential */ + { 0x2206, 0xC6 }, /* increment */ + { 0x220F, 0xB8 }, /* n-ary product */ + { 0x2211, 0xB7 }, /* n-ary summation */ + { 0x221A, 0xC3 }, /* square root */ + { 0x221E, 0xB0 }, /* infinity */ + { 0x222B, 0xBA }, /* integral */ + { 0x2248, 0xC5 }, /* almost equal to */ + { 0x2260, 0xAD }, /* not equal to */ + { 0x2264, 0xB2 }, /* less-than or equal to */ + { 0x2265, 0xB3 }, /* greater-than or equal to */ + { 0x25CA, 0xD7 }, /* lozenge */ + { 0xF8FF, 0xF0 }, /* apple logo */ + { 0xFB01, 0xDE }, /* latin small ligature fi */ + { 0xFB02, 0xDF }, /* latin small ligature fl */ +}; +/* {{{ end of mappings *from* Unicode for MacRoman */ + +/* HTML 5 has many more named entities. + * Some of them map to two unicode code points, not one. + * We're going to use a three-stage table (with an extra one for the entities + * with two code points). */ + +#define ENT_STAGE1_INDEX(k) (((k) & 0xFFF000) >> 12) /* > 1D, we have no mapping */ +#define ENT_STAGE2_INDEX(k) (((k) & 0xFC0) >> 6) +#define ENT_STAGE3_INDEX(k) ((k) & 0x3F) +#define ENT_CODE_POINT_FROM_STAGES(i,j,k) (((i) << 12) | ((j) << 6) | (k)) + +/* Table should be organized with a leading row telling the size of + * the table and the default entity (maybe NULL) and the rest being + * normal rows ordered by code point so that we can do a binary search */ +typedef union { + struct { + unsigned size; /* number of remaining entries in the table */ + const char *default_entity; + unsigned short default_entity_len; + } leading_entry; + struct { + unsigned second_cp; /* second code point */ + const char *entity; + unsigned short entity_len; + } normal_entry; +} entity_multicodepoint_row; + +/* blocks of these should start at code points k where k % 0xFC0 == 0 */ +typedef struct { + char ambiguous; /* if 0 look into entity */ + union { + struct { + const char *entity; /* may be NULL */ + unsigned short entity_len; + } ent; + const entity_multicodepoint_row *multicodepoint_table; + } data; +} entity_stage3_row; + +/* Calculate k & 0x3F Use as offset */ +typedef const entity_stage3_row *entity_stage2_row; /* 64 elements */ + +/* Calculate k & 0xFC0 >> 6. Use as offset */ +typedef const entity_stage3_row *const *entity_stage1_row; /* 64 elements */ + +/* For stage 1, Calculate k & 0xFFF000 >> 3*4. + * If larger than 1D, we have no mapping. Otherwise lookup that index */ + +typedef struct { + const entity_stage1_row *ms_table; + /* for tables with only basic entities, this member is to be accessed + * directly for better performance: */ + const entity_stage3_row *table; +} entity_table_opt; + +/* Replaced "GT" > "gt" and "QUOT" > "quot" for consistency's sake. */ + +/* {{{ Start of HTML5 multi-stage table for codepoint -> entity */ + +/* {{{ Start of double code point tables for HTML5 */ + +static const entity_multicodepoint_row multi_cp_html5_0003C[] = { + { {01, "lt", 2} }, + { {0x020D2, "nvlt", 4} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0003D[] = { + { {01, "equals", 6} }, + { {0x020E5, "bne", 3} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0003E[] = { + { {01, "gt", 2} }, + { {0x020D2, "nvgt", 4} }, +}; +static const entity_multicodepoint_row multi_cp_html5_00066[] = { + { {01, NULL , 0} }, + { {0x0006A, "fjlig", 5} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0205F[] = { + { {01, "MediumSpace", 11} }, + { {0x0200A, "ThickSpace", 10} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0219D[] = { + { {01, "rarrw", 5} }, + { {0x00338, "nrarrw", 6} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02202[] = { + { {01, "part", 4} }, + { {0x00338, "npart", 5} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02220[] = { + { {01, "angle", 5} }, + { {0x020D2, "nang", 4} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02229[] = { + { {01, "cap", 3} }, + { {0x0FE00, "caps", 4} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0222A[] = { + { {01, "cup", 3} }, + { {0x0FE00, "cups", 4} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0223C[] = { + { {01, "sim", 3} }, + { {0x020D2, "nvsim", 5} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0223D[] = { + { {01, "bsim", 4} }, + { {0x00331, "race", 4} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0223E[] = { + { {01, "ac", 2} }, + { {0x00333, "acE", 3} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02242[] = { + { {01, "esim", 4} }, + { {0x00338, "nesim", 5} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0224B[] = { + { {01, "apid", 4} }, + { {0x00338, "napid", 5} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0224D[] = { + { {01, "CupCap", 6} }, + { {0x020D2, "nvap", 4} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0224E[] = { + { {01, "bump", 4} }, + { {0x00338, "nbump", 5} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0224F[] = { + { {01, "HumpEqual", 9} }, + { {0x00338, "nbumpe", 6} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02250[] = { + { {01, "esdot", 5} }, + { {0x00338, "nedot", 5} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02261[] = { + { {01, "Congruent", 9} }, + { {0x020E5, "bnequiv", 7} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02264[] = { + { {01, "leq", 3} }, + { {0x020D2, "nvle", 4} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02265[] = { + { {01, "ge", 2} }, + { {0x020D2, "nvge", 4} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02266[] = { + { {01, "lE", 2} }, + { {0x00338, "nlE", 3} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02267[] = { + { {01, "geqq", 4} }, + { {0x00338, "NotGreaterFullEqual", 19} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02268[] = { + { {01, "lneqq", 5} }, + { {0x0FE00, "lvertneqq", 9} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02269[] = { + { {01, "gneqq", 5} }, + { {0x0FE00, "gvertneqq", 9} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0226A[] = { + { {02, "ll", 2} }, + { {0x00338, "nLtv", 4} }, + { {0x020D2, "nLt", 3} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0226B[] = { + { {02, "gg", 2} }, + { {0x00338, "NotGreaterGreater", 17} }, + { {0x020D2, "nGt", 3} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0227F[] = { + { {01, "SucceedsTilde", 13} }, + { {0x00338, "NotSucceedsTilde", 16} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02282[] = { + { {01, "sub", 3} }, + { {0x020D2, "vnsub", 5} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02283[] = { + { {01, "sup", 3} }, + { {0x020D2, "nsupset", 7} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0228A[] = { + { {01, "subsetneq", 9} }, + { {0x0FE00, "vsubne", 6} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0228B[] = { + { {01, "supsetneq", 9} }, + { {0x0FE00, "vsupne", 6} }, +}; +static const entity_multicodepoint_row multi_cp_html5_0228F[] = { + { {01, "sqsub", 5} }, + { {0x00338, "NotSquareSubset", 15} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02290[] = { + { {01, "sqsupset", 8} }, + { {0x00338, "NotSquareSuperset", 17} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02293[] = { + { {01, "sqcap", 5} }, + { {0x0FE00, "sqcaps", 6} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02294[] = { + { {01, "sqcup", 5} }, + { {0x0FE00, "sqcups", 6} }, +}; +static const entity_multicodepoint_row multi_cp_html5_022B4[] = { + { {01, "LeftTriangleEqual", 17} }, + { {0x020D2, "nvltrie", 7} }, +}; +static const entity_multicodepoint_row multi_cp_html5_022B5[] = { + { {01, "RightTriangleEqual", 18} }, + { {0x020D2, "nvrtrie", 7} }, +}; +static const entity_multicodepoint_row multi_cp_html5_022D8[] = { + { {01, "Ll", 2} }, + { {0x00338, "nLl", 3} }, +}; +static const entity_multicodepoint_row multi_cp_html5_022D9[] = { + { {01, "Gg", 2} }, + { {0x00338, "nGg", 3} }, +}; +static const entity_multicodepoint_row multi_cp_html5_022DA[] = { + { {01, "lesseqgtr", 9} }, + { {0x0FE00, "lesg", 4} }, +}; +static const entity_multicodepoint_row multi_cp_html5_022DB[] = { + { {01, "gtreqless", 9} }, + { {0x0FE00, "gesl", 4} }, +}; +static const entity_multicodepoint_row multi_cp_html5_022F5[] = { + { {01, "isindot", 7} }, + { {0x00338, "notindot", 8} }, +}; +static const entity_multicodepoint_row multi_cp_html5_022F9[] = { + { {01, "isinE", 5} }, + { {0x00338, "notinE", 6} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02933[] = { + { {01, "rarrc", 5} }, + { {0x00338, "nrarrc", 6} }, +}; +static const entity_multicodepoint_row multi_cp_html5_029CF[] = { + { {01, "LeftTriangleBar", 15} }, + { {0x00338, "NotLeftTriangleBar", 18} }, +}; +static const entity_multicodepoint_row multi_cp_html5_029D0[] = { + { {01, "RightTriangleBar", 16} }, + { {0x00338, "NotRightTriangleBar", 19} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02A6D[] = { + { {01, "congdot", 7} }, + { {0x00338, "ncongdot", 8} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02A70[] = { + { {01, "apE", 3} }, + { {0x00338, "napE", 4} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02A7D[] = { + { {01, "les", 3} }, + { {0x00338, "nles", 4} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02A7E[] = { + { {01, "ges", 3} }, + { {0x00338, "nges", 4} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02AA1[] = { + { {01, "LessLess", 8} }, + { {0x00338, "NotNestedLessLess", 17} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02AA2[] = { + { {01, "GreaterGreater", 14} }, + { {0x00338, "NotNestedGreaterGreater", 23} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02AAC[] = { + { {01, "smte", 4} }, + { {0x0FE00, "smtes", 5} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02AAD[] = { + { {01, "late", 4} }, + { {0x0FE00, "lates", 5} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02AAF[] = { + { {01, "preceq", 6} }, + { {0x00338, "NotPrecedesEqual", 16} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02AB0[] = { + { {01, "SucceedsEqual", 13} }, + { {0x00338, "NotSucceedsEqual", 16} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02AC5[] = { + { {01, "subE", 4} }, + { {0x00338, "nsubE", 5} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02AC6[] = { + { {01, "supseteqq", 9} }, + { {0x00338, "nsupseteqq", 10} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02ACB[] = { + { {01, "subsetneqq", 10} }, + { {0x0FE00, "vsubnE", 6} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02ACC[] = { + { {01, "supnE", 5} }, + { {0x0FE00, "varsupsetneqq", 13} }, +}; +static const entity_multicodepoint_row multi_cp_html5_02AFD[] = { + { {01, NULL , 0} }, + { {0x0FE00, "varsupsetneqq", 13} }, +}; + +/* End of double code point tables }}} */ + +/* {{{ Stage 3 Tables for HTML5 */ + +static const entity_stage3_row empty_stage3_table[] = { + /* 64 elements */ + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; +static const entity_stage3_row stage3_table_html5_00000[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"Tab", 3} } }, {0, { {"NewLine", 7} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"excl", 4} } }, {0, { {"quot", 4} } }, {0, { {"num", 3} } }, + {0, { {"dollar", 6} } }, {0, { {"percnt", 6} } }, {0, { {"amp", 3} } }, {0, { {"apos", 4} } }, + {0, { {"lpar", 4} } }, {0, { {"rpar", 4} } }, {0, { {"ast", 3} } }, {0, { {"plus", 4} } }, + {0, { {"comma", 5} } }, {0, { {NULL, 0} } }, {0, { {"period", 6} } }, {0, { {"sol", 3} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"colon", 5} } }, {0, { {"semi", 4} } }, + {1, { {(void *)multi_cp_html5_0003C} } }, {1, { {(void *)multi_cp_html5_0003D} } }, {1, { {(void *)multi_cp_html5_0003E} } }, {0, { {"quest", 5} } }, +}; + +static const entity_stage3_row stage3_table_html5_00040[] = { + {0, { {"commat", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"lbrack", 6} } }, + {0, { {"bsol", 4} } }, {0, { {"rsqb", 4} } }, {0, { {"Hat", 3} } }, {0, { {"lowbar", 6} } }, + {0, { {"grave", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {1, { {(void *)multi_cp_html5_00066} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"lbrace", 6} } }, + {0, { {"vert", 4} } }, {0, { {"rcub", 4} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_00080[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"nbsp", 4} } }, {0, { {"iexcl", 5} } }, {0, { {"cent", 4} } }, {0, { {"pound", 5} } }, + {0, { {"curren", 6} } }, {0, { {"yen", 3} } }, {0, { {"brvbar", 6} } }, {0, { {"sect", 4} } }, + {0, { {"DoubleDot", 9} } }, {0, { {"copy", 4} } }, {0, { {"ordf", 4} } }, {0, { {"laquo", 5} } }, + {0, { {"not", 3} } }, {0, { {"shy", 3} } }, {0, { {"reg", 3} } }, {0, { {"macr", 4} } }, + {0, { {"deg", 3} } }, {0, { {"plusmn", 6} } }, {0, { {"sup2", 4} } }, {0, { {"sup3", 4} } }, + {0, { {"DiacriticalAcute", 16} } }, {0, { {"micro", 5} } }, {0, { {"para", 4} } }, {0, { {"CenterDot", 9} } }, + {0, { {"Cedilla", 7} } }, {0, { {"sup1", 4} } }, {0, { {"ordm", 4} } }, {0, { {"raquo", 5} } }, + {0, { {"frac14", 6} } }, {0, { {"half", 4} } }, {0, { {"frac34", 6} } }, {0, { {"iquest", 6} } }, +}; + +static const entity_stage3_row stage3_table_html5_000C0[] = { + {0, { {"Agrave", 6} } }, {0, { {"Aacute", 6} } }, {0, { {"Acirc", 5} } }, {0, { {"Atilde", 6} } }, + {0, { {"Auml", 4} } }, {0, { {"Aring", 5} } }, {0, { {"AElig", 5} } }, {0, { {"Ccedil", 6} } }, + {0, { {"Egrave", 6} } }, {0, { {"Eacute", 6} } }, {0, { {"Ecirc", 5} } }, {0, { {"Euml", 4} } }, + {0, { {"Igrave", 6} } }, {0, { {"Iacute", 6} } }, {0, { {"Icirc", 5} } }, {0, { {"Iuml", 4} } }, + {0, { {"ETH", 3} } }, {0, { {"Ntilde", 6} } }, {0, { {"Ograve", 6} } }, {0, { {"Oacute", 6} } }, + {0, { {"Ocirc", 5} } }, {0, { {"Otilde", 6} } }, {0, { {"Ouml", 4} } }, {0, { {"times", 5} } }, + {0, { {"Oslash", 6} } }, {0, { {"Ugrave", 6} } }, {0, { {"Uacute", 6} } }, {0, { {"Ucirc", 5} } }, + {0, { {"Uuml", 4} } }, {0, { {"Yacute", 6} } }, {0, { {"THORN", 5} } }, {0, { {"szlig", 5} } }, + {0, { {"agrave", 6} } }, {0, { {"aacute", 6} } }, {0, { {"acirc", 5} } }, {0, { {"atilde", 6} } }, + {0, { {"auml", 4} } }, {0, { {"aring", 5} } }, {0, { {"aelig", 5} } }, {0, { {"ccedil", 6} } }, + {0, { {"egrave", 6} } }, {0, { {"eacute", 6} } }, {0, { {"ecirc", 5} } }, {0, { {"euml", 4} } }, + {0, { {"igrave", 6} } }, {0, { {"iacute", 6} } }, {0, { {"icirc", 5} } }, {0, { {"iuml", 4} } }, + {0, { {"eth", 3} } }, {0, { {"ntilde", 6} } }, {0, { {"ograve", 6} } }, {0, { {"oacute", 6} } }, + {0, { {"ocirc", 5} } }, {0, { {"otilde", 6} } }, {0, { {"ouml", 4} } }, {0, { {"divide", 6} } }, + {0, { {"oslash", 6} } }, {0, { {"ugrave", 6} } }, {0, { {"uacute", 6} } }, {0, { {"ucirc", 5} } }, + {0, { {"uuml", 4} } }, {0, { {"yacute", 6} } }, {0, { {"thorn", 5} } }, {0, { {"yuml", 4} } }, +}; + +static const entity_stage3_row stage3_table_html5_00100[] = { + {0, { {"Amacr", 5} } }, {0, { {"amacr", 5} } }, {0, { {"Abreve", 6} } }, {0, { {"abreve", 6} } }, + {0, { {"Aogon", 5} } }, {0, { {"aogon", 5} } }, {0, { {"Cacute", 6} } }, {0, { {"cacute", 6} } }, + {0, { {"Ccirc", 5} } }, {0, { {"ccirc", 5} } }, {0, { {"Cdot", 4} } }, {0, { {"cdot", 4} } }, + {0, { {"Ccaron", 6} } }, {0, { {"ccaron", 6} } }, {0, { {"Dcaron", 6} } }, {0, { {"dcaron", 6} } }, + {0, { {"Dstrok", 6} } }, {0, { {"dstrok", 6} } }, {0, { {"Emacr", 5} } }, {0, { {"emacr", 5} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"Edot", 4} } }, {0, { {"edot", 4} } }, + {0, { {"Eogon", 5} } }, {0, { {"eogon", 5} } }, {0, { {"Ecaron", 6} } }, {0, { {"ecaron", 6} } }, + {0, { {"Gcirc", 5} } }, {0, { {"gcirc", 5} } }, {0, { {"Gbreve", 6} } }, {0, { {"gbreve", 6} } }, + {0, { {"Gdot", 4} } }, {0, { {"gdot", 4} } }, {0, { {"Gcedil", 6} } }, {0, { {NULL, 0} } }, + {0, { {"Hcirc", 5} } }, {0, { {"hcirc", 5} } }, {0, { {"Hstrok", 6} } }, {0, { {"hstrok", 6} } }, + {0, { {"Itilde", 6} } }, {0, { {"itilde", 6} } }, {0, { {"Imacr", 5} } }, {0, { {"imacr", 5} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"Iogon", 5} } }, {0, { {"iogon", 5} } }, + {0, { {"Idot", 4} } }, {0, { {"inodot", 6} } }, {0, { {"IJlig", 5} } }, {0, { {"ijlig", 5} } }, + {0, { {"Jcirc", 5} } }, {0, { {"jcirc", 5} } }, {0, { {"Kcedil", 6} } }, {0, { {"kcedil", 6} } }, + {0, { {"kgreen", 6} } }, {0, { {"Lacute", 6} } }, {0, { {"lacute", 6} } }, {0, { {"Lcedil", 6} } }, + {0, { {"lcedil", 6} } }, {0, { {"Lcaron", 6} } }, {0, { {"lcaron", 6} } }, {0, { {"Lmidot", 6} } }, +}; + +static const entity_stage3_row stage3_table_html5_00140[] = { + {0, { {"lmidot", 6} } }, {0, { {"Lstrok", 6} } }, {0, { {"lstrok", 6} } }, {0, { {"Nacute", 6} } }, + {0, { {"nacute", 6} } }, {0, { {"Ncedil", 6} } }, {0, { {"ncedil", 6} } }, {0, { {"Ncaron", 6} } }, + {0, { {"ncaron", 6} } }, {0, { {"napos", 5} } }, {0, { {"ENG", 3} } }, {0, { {"eng", 3} } }, + {0, { {"Omacr", 5} } }, {0, { {"omacr", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"Odblac", 6} } }, {0, { {"odblac", 6} } }, {0, { {"OElig", 5} } }, {0, { {"oelig", 5} } }, + {0, { {"Racute", 6} } }, {0, { {"racute", 6} } }, {0, { {"Rcedil", 6} } }, {0, { {"rcedil", 6} } }, + {0, { {"Rcaron", 6} } }, {0, { {"rcaron", 6} } }, {0, { {"Sacute", 6} } }, {0, { {"sacute", 6} } }, + {0, { {"Scirc", 5} } }, {0, { {"scirc", 5} } }, {0, { {"Scedil", 6} } }, {0, { {"scedil", 6} } }, + {0, { {"Scaron", 6} } }, {0, { {"scaron", 6} } }, {0, { {"Tcedil", 6} } }, {0, { {"tcedil", 6} } }, + {0, { {"Tcaron", 6} } }, {0, { {"tcaron", 6} } }, {0, { {"Tstrok", 6} } }, {0, { {"tstrok", 6} } }, + {0, { {"Utilde", 6} } }, {0, { {"utilde", 6} } }, {0, { {"Umacr", 5} } }, {0, { {"umacr", 5} } }, + {0, { {"Ubreve", 6} } }, {0, { {"ubreve", 6} } }, {0, { {"Uring", 5} } }, {0, { {"uring", 5} } }, + {0, { {"Udblac", 6} } }, {0, { {"udblac", 6} } }, {0, { {"Uogon", 5} } }, {0, { {"uogon", 5} } }, + {0, { {"Wcirc", 5} } }, {0, { {"wcirc", 5} } }, {0, { {"Ycirc", 5} } }, {0, { {"ycirc", 5} } }, + {0, { {"Yuml", 4} } }, {0, { {"Zacute", 6} } }, {0, { {"zacute", 6} } }, {0, { {"Zdot", 4} } }, + {0, { {"zdot", 4} } }, {0, { {"Zcaron", 6} } }, {0, { {"zcaron", 6} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_00180[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"fnof", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"imped", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_001C0[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"gacute", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_00200[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"jmath", 5} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_002C0[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"circ", 4} } }, {0, { {"Hacek", 5} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"Breve", 5} } }, {0, { {"dot", 3} } }, {0, { {"ring", 4} } }, {0, { {"ogon", 4} } }, + {0, { {"DiacriticalTilde", 16} } }, {0, { {"DiacriticalDoubleAcute", 22} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_00300[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"DownBreve", 9} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_00380[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"Alpha", 5} } }, {0, { {"Beta", 4} } }, {0, { {"Gamma", 5} } }, + {0, { {"Delta", 5} } }, {0, { {"Epsilon", 7} } }, {0, { {"Zeta", 4} } }, {0, { {"Eta", 3} } }, + {0, { {"Theta", 5} } }, {0, { {"Iota", 4} } }, {0, { {"Kappa", 5} } }, {0, { {"Lambda", 6} } }, + {0, { {"Mu", 2} } }, {0, { {"Nu", 2} } }, {0, { {"Xi", 2} } }, {0, { {"Omicron", 7} } }, + {0, { {"Pi", 2} } }, {0, { {"Rho", 3} } }, {0, { {NULL, 0} } }, {0, { {"Sigma", 5} } }, + {0, { {"Tau", 3} } }, {0, { {"Upsilon", 7} } }, {0, { {"Phi", 3} } }, {0, { {"Chi", 3} } }, + {0, { {"Psi", 3} } }, {0, { {"Omega", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"alpha", 5} } }, {0, { {"beta", 4} } }, {0, { {"gamma", 5} } }, + {0, { {"delta", 5} } }, {0, { {"epsi", 4} } }, {0, { {"zeta", 4} } }, {0, { {"eta", 3} } }, + {0, { {"theta", 5} } }, {0, { {"iota", 4} } }, {0, { {"kappa", 5} } }, {0, { {"lambda", 6} } }, + {0, { {"mu", 2} } }, {0, { {"nu", 2} } }, {0, { {"xi", 2} } }, {0, { {"omicron", 7} } }, +}; + +static const entity_stage3_row stage3_table_html5_003C0[] = { + {0, { {"pi", 2} } }, {0, { {"rho", 3} } }, {0, { {"sigmav", 6} } }, {0, { {"sigma", 5} } }, + {0, { {"tau", 3} } }, {0, { {"upsi", 4} } }, {0, { {"phi", 3} } }, {0, { {"chi", 3} } }, + {0, { {"psi", 3} } }, {0, { {"omega", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"thetasym", 8} } }, {0, { {"upsih", 5} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"straightphi", 11} } }, {0, { {"piv", 3} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"Gammad", 6} } }, {0, { {"gammad", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"varkappa", 8} } }, {0, { {"rhov", 4} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"straightepsilon", 15} } }, {0, { {"backepsilon", 11} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_00400[] = { + {0, { {NULL, 0} } }, {0, { {"IOcy", 4} } }, {0, { {"DJcy", 4} } }, {0, { {"GJcy", 4} } }, + {0, { {"Jukcy", 5} } }, {0, { {"DScy", 4} } }, {0, { {"Iukcy", 5} } }, {0, { {"YIcy", 4} } }, + {0, { {"Jsercy", 6} } }, {0, { {"LJcy", 4} } }, {0, { {"NJcy", 4} } }, {0, { {"TSHcy", 5} } }, + {0, { {"KJcy", 4} } }, {0, { {NULL, 0} } }, {0, { {"Ubrcy", 5} } }, {0, { {"DZcy", 4} } }, + {0, { {"Acy", 3} } }, {0, { {"Bcy", 3} } }, {0, { {"Vcy", 3} } }, {0, { {"Gcy", 3} } }, + {0, { {"Dcy", 3} } }, {0, { {"IEcy", 4} } }, {0, { {"ZHcy", 4} } }, {0, { {"Zcy", 3} } }, + {0, { {"Icy", 3} } }, {0, { {"Jcy", 3} } }, {0, { {"Kcy", 3} } }, {0, { {"Lcy", 3} } }, + {0, { {"Mcy", 3} } }, {0, { {"Ncy", 3} } }, {0, { {"Ocy", 3} } }, {0, { {"Pcy", 3} } }, + {0, { {"Rcy", 3} } }, {0, { {"Scy", 3} } }, {0, { {"Tcy", 3} } }, {0, { {"Ucy", 3} } }, + {0, { {"Fcy", 3} } }, {0, { {"KHcy", 4} } }, {0, { {"TScy", 4} } }, {0, { {"CHcy", 4} } }, + {0, { {"SHcy", 4} } }, {0, { {"SHCHcy", 6} } }, {0, { {"HARDcy", 6} } }, {0, { {"Ycy", 3} } }, + {0, { {"SOFTcy", 6} } }, {0, { {"Ecy", 3} } }, {0, { {"YUcy", 4} } }, {0, { {"YAcy", 4} } }, + {0, { {"acy", 3} } }, {0, { {"bcy", 3} } }, {0, { {"vcy", 3} } }, {0, { {"gcy", 3} } }, + {0, { {"dcy", 3} } }, {0, { {"iecy", 4} } }, {0, { {"zhcy", 4} } }, {0, { {"zcy", 3} } }, + {0, { {"icy", 3} } }, {0, { {"jcy", 3} } }, {0, { {"kcy", 3} } }, {0, { {"lcy", 3} } }, + {0, { {"mcy", 3} } }, {0, { {"ncy", 3} } }, {0, { {"ocy", 3} } }, {0, { {"pcy", 3} } }, +}; + +static const entity_stage3_row stage3_table_html5_00440[] = { + {0, { {"rcy", 3} } }, {0, { {"scy", 3} } }, {0, { {"tcy", 3} } }, {0, { {"ucy", 3} } }, + {0, { {"fcy", 3} } }, {0, { {"khcy", 4} } }, {0, { {"tscy", 4} } }, {0, { {"chcy", 4} } }, + {0, { {"shcy", 4} } }, {0, { {"shchcy", 6} } }, {0, { {"hardcy", 6} } }, {0, { {"ycy", 3} } }, + {0, { {"softcy", 6} } }, {0, { {"ecy", 3} } }, {0, { {"yucy", 4} } }, {0, { {"yacy", 4} } }, + {0, { {NULL, 0} } }, {0, { {"iocy", 4} } }, {0, { {"djcy", 4} } }, {0, { {"gjcy", 4} } }, + {0, { {"jukcy", 5} } }, {0, { {"dscy", 4} } }, {0, { {"iukcy", 5} } }, {0, { {"yicy", 4} } }, + {0, { {"jsercy", 6} } }, {0, { {"ljcy", 4} } }, {0, { {"njcy", 4} } }, {0, { {"tshcy", 5} } }, + {0, { {"kjcy", 4} } }, {0, { {NULL, 0} } }, {0, { {"ubrcy", 5} } }, {0, { {"dzcy", 4} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02000[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"ensp", 4} } }, {0, { {"emsp", 4} } }, + {0, { {"emsp13", 6} } }, {0, { {"emsp14", 6} } }, {0, { {NULL, 0} } }, {0, { {"numsp", 5} } }, + {0, { {"puncsp", 6} } }, {0, { {"ThinSpace", 9} } }, {0, { {"hairsp", 6} } }, {0, { {"ZeroWidthSpace", 14} } }, + {0, { {"zwnj", 4} } }, {0, { {"zwj", 3} } }, {0, { {"lrm", 3} } }, {0, { {"rlm", 3} } }, + {0, { {"hyphen", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"ndash", 5} } }, + {0, { {"mdash", 5} } }, {0, { {"horbar", 6} } }, {0, { {"Verbar", 6} } }, {0, { {NULL, 0} } }, + {0, { {"OpenCurlyQuote", 14} } }, {0, { {"rsquo", 5} } }, {0, { {"sbquo", 5} } }, {0, { {NULL, 0} } }, + {0, { {"OpenCurlyDoubleQuote", 20} } }, {0, { {"rdquo", 5} } }, {0, { {"bdquo", 5} } }, {0, { {NULL, 0} } }, + {0, { {"dagger", 6} } }, {0, { {"Dagger", 6} } }, {0, { {"bull", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"nldr", 4} } }, {0, { {"hellip", 6} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"permil", 6} } }, {0, { {"pertenk", 7} } }, {0, { {"prime", 5} } }, {0, { {"Prime", 5} } }, + {0, { {"tprime", 6} } }, {0, { {"backprime", 9} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"lsaquo", 6} } }, {0, { {"rsaquo", 6} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"oline", 5} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02040[] = { + {0, { {NULL, 0} } }, {0, { {"caret", 5} } }, {0, { {NULL, 0} } }, {0, { {"hybull", 6} } }, + {0, { {"frasl", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"bsemi", 5} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"qprime", 6} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {1, { {(void *)multi_cp_html5_0205F} } }, + {0, { {"NoBreak", 7} } }, {0, { {"af", 2} } }, {0, { {"InvisibleTimes", 14} } }, {0, { {"ic", 2} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02080[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"euro", 4} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_020C0[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"TripleDot", 9} } }, + {0, { {"DotDot", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02100[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"complexes", 9} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"incare", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"gscr", 4} } }, {0, { {"HilbertSpace", 12} } }, + {0, { {"Hfr", 3} } }, {0, { {"Hopf", 4} } }, {0, { {"planckh", 7} } }, {0, { {"planck", 6} } }, + {0, { {"imagline", 8} } }, {0, { {"Ifr", 3} } }, {0, { {"lagran", 6} } }, {0, { {"ell", 3} } }, + {0, { {NULL, 0} } }, {0, { {"naturals", 8} } }, {0, { {"numero", 6} } }, {0, { {"copysr", 6} } }, + {0, { {"wp", 2} } }, {0, { {"primes", 6} } }, {0, { {"rationals", 9} } }, {0, { {"realine", 7} } }, + {0, { {"Rfr", 3} } }, {0, { {"Ropf", 4} } }, {0, { {"rx", 2} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"trade", 5} } }, {0, { {NULL, 0} } }, + {0, { {"Zopf", 4} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"mho", 3} } }, + {0, { {"Zfr", 3} } }, {0, { {"iiota", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"Bscr", 4} } }, {0, { {"Cfr", 3} } }, {0, { {NULL, 0} } }, {0, { {"escr", 4} } }, + {0, { {"expectation", 11} } }, {0, { {"Fouriertrf", 10} } }, {0, { {NULL, 0} } }, {0, { {"Mellintrf", 9} } }, + {0, { {"orderof", 7} } }, {0, { {"aleph", 5} } }, {0, { {"beth", 4} } }, {0, { {"gimel", 5} } }, + {0, { {"daleth", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02140[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"CapitalDifferentialD", 20} } }, {0, { {"DifferentialD", 13} } }, {0, { {"exponentiale", 12} } }, + {0, { {"ImaginaryI", 10} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"frac13", 6} } }, + {0, { {"frac23", 6} } }, {0, { {"frac15", 6} } }, {0, { {"frac25", 6} } }, {0, { {"frac35", 6} } }, + {0, { {"frac45", 6} } }, {0, { {"frac16", 6} } }, {0, { {"frac56", 6} } }, {0, { {"frac18", 6} } }, + {0, { {"frac38", 6} } }, {0, { {"frac58", 6} } }, {0, { {"frac78", 6} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02180[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"larr", 4} } }, {0, { {"uarr", 4} } }, {0, { {"srarr", 5} } }, {0, { {"darr", 4} } }, + {0, { {"harr", 4} } }, {0, { {"UpDownArrow", 11} } }, {0, { {"nwarrow", 7} } }, {0, { {"UpperRightArrow", 15} } }, + {0, { {"LowerRightArrow", 15} } }, {0, { {"swarr", 5} } }, {0, { {"nleftarrow", 10} } }, {0, { {"nrarr", 5} } }, + {0, { {NULL, 0} } }, {1, { {(void *)multi_cp_html5_0219D} } }, {0, { {"Larr", 4} } }, {0, { {"Uarr", 4} } }, + {0, { {"twoheadrightarrow", 17} } }, {0, { {"Darr", 4} } }, {0, { {"larrtl", 6} } }, {0, { {"rarrtl", 6} } }, + {0, { {"LeftTeeArrow", 12} } }, {0, { {"UpTeeArrow", 10} } }, {0, { {"map", 3} } }, {0, { {"DownTeeArrow", 12} } }, + {0, { {NULL, 0} } }, {0, { {"larrhk", 6} } }, {0, { {"rarrhk", 6} } }, {0, { {"larrlp", 6} } }, + {0, { {"looparrowright", 14} } }, {0, { {"harrw", 5} } }, {0, { {"nleftrightarrow", 15} } }, {0, { {NULL, 0} } }, + {0, { {"Lsh", 3} } }, {0, { {"rsh", 3} } }, {0, { {"ldsh", 4} } }, {0, { {"rdsh", 4} } }, + {0, { {NULL, 0} } }, {0, { {"crarr", 5} } }, {0, { {"curvearrowleft", 14} } }, {0, { {"curarr", 6} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"olarr", 5} } }, {0, { {"orarr", 5} } }, + {0, { {"leftharpoonup", 13} } }, {0, { {"leftharpoondown", 15} } }, {0, { {"RightUpVector", 13} } }, {0, { {"uharl", 5} } }, +}; + +static const entity_stage3_row stage3_table_html5_021C0[] = { + {0, { {"rharu", 5} } }, {0, { {"rhard", 5} } }, {0, { {"RightDownVector", 15} } }, {0, { {"dharl", 5} } }, + {0, { {"rightleftarrows", 15} } }, {0, { {"udarr", 5} } }, {0, { {"lrarr", 5} } }, {0, { {"llarr", 5} } }, + {0, { {"upuparrows", 10} } }, {0, { {"rrarr", 5} } }, {0, { {"downdownarrows", 14} } }, {0, { {"leftrightharpoons", 17} } }, + {0, { {"rightleftharpoons", 17} } }, {0, { {"nLeftarrow", 10} } }, {0, { {"nhArr", 5} } }, {0, { {"nrArr", 5} } }, + {0, { {"DoubleLeftArrow", 15} } }, {0, { {"DoubleUpArrow", 13} } }, {0, { {"Implies", 7} } }, {0, { {"Downarrow", 9} } }, + {0, { {"hArr", 4} } }, {0, { {"Updownarrow", 11} } }, {0, { {"nwArr", 5} } }, {0, { {"neArr", 5} } }, + {0, { {"seArr", 5} } }, {0, { {"swArr", 5} } }, {0, { {"lAarr", 5} } }, {0, { {"rAarr", 5} } }, + {0, { {NULL, 0} } }, {0, { {"zigrarr", 7} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"LeftArrowBar", 12} } }, {0, { {"RightArrowBar", 13} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"DownArrowUpArrow", 16} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"loarr", 5} } }, {0, { {"roarr", 5} } }, {0, { {"hoarr", 5} } }, +}; + +static const entity_stage3_row stage3_table_html5_02200[] = { + {0, { {"forall", 6} } }, {0, { {"comp", 4} } }, {1, { {(void *)multi_cp_html5_02202} } }, {0, { {"Exists", 6} } }, + {0, { {"nexist", 6} } }, {0, { {"empty", 5} } }, {0, { {NULL, 0} } }, {0, { {"nabla", 5} } }, + {0, { {"isinv", 5} } }, {0, { {"notin", 5} } }, {0, { {NULL, 0} } }, {0, { {"ReverseElement", 14} } }, + {0, { {"notniva", 7} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"prod", 4} } }, + {0, { {"Coproduct", 9} } }, {0, { {"sum", 3} } }, {0, { {"minus", 5} } }, {0, { {"MinusPlus", 9} } }, + {0, { {"plusdo", 6} } }, {0, { {NULL, 0} } }, {0, { {"ssetmn", 6} } }, {0, { {"lowast", 6} } }, + {0, { {"compfn", 6} } }, {0, { {NULL, 0} } }, {0, { {"Sqrt", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"prop", 4} } }, {0, { {"infin", 5} } }, {0, { {"angrt", 5} } }, + {1, { {(void *)multi_cp_html5_02220} } }, {0, { {"angmsd", 6} } }, {0, { {"angsph", 6} } }, {0, { {"mid", 3} } }, + {0, { {"nshortmid", 9} } }, {0, { {"shortparallel", 13} } }, {0, { {"nparallel", 9} } }, {0, { {"and", 3} } }, + {0, { {"or", 2} } }, {1, { {(void *)multi_cp_html5_02229} } }, {1, { {(void *)multi_cp_html5_0222A} } }, {0, { {"Integral", 8} } }, + {0, { {"Int", 3} } }, {0, { {"tint", 4} } }, {0, { {"ContourIntegral", 15} } }, {0, { {"DoubleContourIntegral", 21} } }, + {0, { {"Cconint", 7} } }, {0, { {"cwint", 5} } }, {0, { {"cwconint", 8} } }, {0, { {"awconint", 8} } }, + {0, { {"there4", 6} } }, {0, { {"Because", 7} } }, {0, { {"ratio", 5} } }, {0, { {"Colon", 5} } }, + {0, { {"minusd", 6} } }, {0, { {NULL, 0} } }, {0, { {"mDDot", 5} } }, {0, { {"homtht", 6} } }, + {1, { {(void *)multi_cp_html5_0223C} } }, {1, { {(void *)multi_cp_html5_0223D} } }, {1, { {(void *)multi_cp_html5_0223E} } }, {0, { {"acd", 3} } }, +}; + +static const entity_stage3_row stage3_table_html5_02240[] = { + {0, { {"wr", 2} } }, {0, { {"NotTilde", 8} } }, {1, { {(void *)multi_cp_html5_02242} } }, {0, { {"simeq", 5} } }, + {0, { {"nsime", 5} } }, {0, { {"TildeFullEqual", 14} } }, {0, { {"simne", 5} } }, {0, { {"ncong", 5} } }, + {0, { {"approx", 6} } }, {0, { {"napprox", 7} } }, {0, { {"ape", 3} } }, {1, { {(void *)multi_cp_html5_0224B} } }, + {0, { {"bcong", 5} } }, {1, { {(void *)multi_cp_html5_0224D} } }, {1, { {(void *)multi_cp_html5_0224E} } }, {1, { {(void *)multi_cp_html5_0224F} } }, + {1, { {(void *)multi_cp_html5_02250} } }, {0, { {"doteqdot", 8} } }, {0, { {"fallingdotseq", 13} } }, {0, { {"risingdotseq", 12} } }, + {0, { {"coloneq", 7} } }, {0, { {"eqcolon", 7} } }, {0, { {"ecir", 4} } }, {0, { {"circeq", 6} } }, + {0, { {NULL, 0} } }, {0, { {"wedgeq", 6} } }, {0, { {"veeeq", 5} } }, {0, { {NULL, 0} } }, + {0, { {"triangleq", 9} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"equest", 6} } }, + {0, { {"NotEqual", 8} } }, {1, { {(void *)multi_cp_html5_02261} } }, {0, { {"NotCongruent", 12} } }, {0, { {NULL, 0} } }, + {1, { {(void *)multi_cp_html5_02264} } }, {1, { {(void *)multi_cp_html5_02265} } }, {1, { {(void *)multi_cp_html5_02266} } }, {1, { {(void *)multi_cp_html5_02267} } }, + {1, { {(void *)multi_cp_html5_02268} } }, {1, { {(void *)multi_cp_html5_02269} } }, {1, { {(void *)multi_cp_html5_0226A} } }, {1, { {(void *)multi_cp_html5_0226B} } }, + {0, { {"between", 7} } }, {0, { {"NotCupCap", 9} } }, {0, { {"NotLess", 7} } }, {0, { {"ngtr", 4} } }, + {0, { {"NotLessEqual", 12} } }, {0, { {"ngeq", 4} } }, {0, { {"LessTilde", 9} } }, {0, { {"GreaterTilde", 12} } }, + {0, { {"nlsim", 5} } }, {0, { {"ngsim", 5} } }, {0, { {"lessgtr", 7} } }, {0, { {"gl", 2} } }, + {0, { {"ntlg", 4} } }, {0, { {"NotGreaterLess", 14} } }, {0, { {"prec", 4} } }, {0, { {"succ", 4} } }, + {0, { {"PrecedesSlantEqual", 18} } }, {0, { {"succcurlyeq", 11} } }, {0, { {"precsim", 7} } }, {1, { {(void *)multi_cp_html5_0227F} } }, +}; + +static const entity_stage3_row stage3_table_html5_02280[] = { + {0, { {"npr", 3} } }, {0, { {"NotSucceeds", 11} } }, {1, { {(void *)multi_cp_html5_02282} } }, {1, { {(void *)multi_cp_html5_02283} } }, + {0, { {"nsub", 4} } }, {0, { {"nsup", 4} } }, {0, { {"SubsetEqual", 11} } }, {0, { {"supe", 4} } }, + {0, { {"NotSubsetEqual", 14} } }, {0, { {"NotSupersetEqual", 16} } }, {1, { {(void *)multi_cp_html5_0228A} } }, {1, { {(void *)multi_cp_html5_0228B} } }, + {0, { {NULL, 0} } }, {0, { {"cupdot", 6} } }, {0, { {"UnionPlus", 9} } }, {1, { {(void *)multi_cp_html5_0228F} } }, + {1, { {(void *)multi_cp_html5_02290} } }, {0, { {"SquareSubsetEqual", 17} } }, {0, { {"SquareSupersetEqual", 19} } }, {1, { {(void *)multi_cp_html5_02293} } }, + {1, { {(void *)multi_cp_html5_02294} } }, {0, { {"CirclePlus", 10} } }, {0, { {"ominus", 6} } }, {0, { {"CircleTimes", 11} } }, + {0, { {"osol", 4} } }, {0, { {"CircleDot", 9} } }, {0, { {"ocir", 4} } }, {0, { {"oast", 4} } }, + {0, { {NULL, 0} } }, {0, { {"odash", 5} } }, {0, { {"boxplus", 7} } }, {0, { {"boxminus", 8} } }, + {0, { {"timesb", 6} } }, {0, { {"sdotb", 5} } }, {0, { {"vdash", 5} } }, {0, { {"dashv", 5} } }, + {0, { {"DownTee", 7} } }, {0, { {"perp", 4} } }, {0, { {NULL, 0} } }, {0, { {"models", 6} } }, + {0, { {"DoubleRightTee", 14} } }, {0, { {"Vdash", 5} } }, {0, { {"Vvdash", 6} } }, {0, { {"VDash", 5} } }, + {0, { {"nvdash", 6} } }, {0, { {"nvDash", 6} } }, {0, { {"nVdash", 6} } }, {0, { {"nVDash", 6} } }, + {0, { {"prurel", 6} } }, {0, { {NULL, 0} } }, {0, { {"vartriangleleft", 15} } }, {0, { {"vrtri", 5} } }, + {1, { {(void *)multi_cp_html5_022B4} } }, {1, { {(void *)multi_cp_html5_022B5} } }, {0, { {"origof", 6} } }, {0, { {"imof", 4} } }, + {0, { {"mumap", 5} } }, {0, { {"hercon", 6} } }, {0, { {"intcal", 6} } }, {0, { {"veebar", 6} } }, + {0, { {NULL, 0} } }, {0, { {"barvee", 6} } }, {0, { {"angrtvb", 7} } }, {0, { {"lrtri", 5} } }, +}; + +static const entity_stage3_row stage3_table_html5_022C0[] = { + {0, { {"xwedge", 6} } }, {0, { {"xvee", 4} } }, {0, { {"bigcap", 6} } }, {0, { {"bigcup", 6} } }, + {0, { {"diamond", 7} } }, {0, { {"sdot", 4} } }, {0, { {"Star", 4} } }, {0, { {"divonx", 6} } }, + {0, { {"bowtie", 6} } }, {0, { {"ltimes", 6} } }, {0, { {"rtimes", 6} } }, {0, { {"lthree", 6} } }, + {0, { {"rthree", 6} } }, {0, { {"backsimeq", 9} } }, {0, { {"curlyvee", 8} } }, {0, { {"curlywedge", 10} } }, + {0, { {"Sub", 3} } }, {0, { {"Supset", 6} } }, {0, { {"Cap", 3} } }, {0, { {"Cup", 3} } }, + {0, { {"pitchfork", 9} } }, {0, { {"epar", 4} } }, {0, { {"lessdot", 7} } }, {0, { {"gtrdot", 6} } }, + {1, { {(void *)multi_cp_html5_022D8} } }, {1, { {(void *)multi_cp_html5_022D9} } }, {1, { {(void *)multi_cp_html5_022DA} } }, {1, { {(void *)multi_cp_html5_022DB} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"curlyeqprec", 11} } }, {0, { {"cuesc", 5} } }, + {0, { {"NotPrecedesSlantEqual", 21} } }, {0, { {"NotSucceedsSlantEqual", 21} } }, {0, { {"NotSquareSubsetEqual", 20} } }, {0, { {"NotSquareSupersetEqual", 22} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"lnsim", 5} } }, {0, { {"gnsim", 5} } }, + {0, { {"precnsim", 8} } }, {0, { {"scnsim", 6} } }, {0, { {"nltri", 5} } }, {0, { {"ntriangleright", 14} } }, + {0, { {"nltrie", 6} } }, {0, { {"NotRightTriangleEqual", 21} } }, {0, { {"vellip", 6} } }, {0, { {"ctdot", 5} } }, + {0, { {"utdot", 5} } }, {0, { {"dtdot", 5} } }, {0, { {"disin", 5} } }, {0, { {"isinsv", 6} } }, + {0, { {"isins", 5} } }, {1, { {(void *)multi_cp_html5_022F5} } }, {0, { {"notinvc", 7} } }, {0, { {"notinvb", 7} } }, + {0, { {NULL, 0} } }, {1, { {(void *)multi_cp_html5_022F9} } }, {0, { {"nisd", 4} } }, {0, { {"xnis", 4} } }, + {0, { {"nis", 3} } }, {0, { {"notnivc", 7} } }, {0, { {"notnivb", 7} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02300[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"barwed", 6} } }, {0, { {"doublebarwedge", 14} } }, {0, { {NULL, 0} } }, + {0, { {"lceil", 5} } }, {0, { {"RightCeiling", 12} } }, {0, { {"LeftFloor", 9} } }, {0, { {"RightFloor", 10} } }, + {0, { {"drcrop", 6} } }, {0, { {"dlcrop", 6} } }, {0, { {"urcrop", 6} } }, {0, { {"ulcrop", 6} } }, + {0, { {"bnot", 4} } }, {0, { {NULL, 0} } }, {0, { {"profline", 8} } }, {0, { {"profsurf", 8} } }, + {0, { {NULL, 0} } }, {0, { {"telrec", 6} } }, {0, { {"target", 6} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"ulcorner", 8} } }, {0, { {"urcorner", 8} } }, {0, { {"llcorner", 8} } }, {0, { {"drcorn", 6} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"frown", 5} } }, {0, { {"smile", 5} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"cylcty", 6} } }, {0, { {"profalar", 8} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"topbot", 6} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"ovbar", 5} } }, {0, { {NULL, 0} } }, {0, { {"solbar", 6} } }, +}; + +static const entity_stage3_row stage3_table_html5_02340[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"angzarr", 7} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02380[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"lmoust", 6} } }, {0, { {"rmoust", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"OverBracket", 11} } }, {0, { {"bbrk", 4} } }, {0, { {"bbrktbrk", 8} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_023C0[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"OverParenthesis", 15} } }, {0, { {"UnderParenthesis", 16} } }, {0, { {"OverBrace", 9} } }, {0, { {"UnderBrace", 10} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"trpezium", 8} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"elinters", 8} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02400[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"blank", 5} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_024C0[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"oS", 2} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02500[] = { + {0, { {"HorizontalLine", 14} } }, {0, { {NULL, 0} } }, {0, { {"boxv", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"boxdr", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"boxdl", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"boxur", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"boxul", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"boxvr", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"boxvl", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"boxhd", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"boxhu", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"boxvh", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02540[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"boxH", 4} } }, {0, { {"boxV", 4} } }, {0, { {"boxdR", 5} } }, {0, { {"boxDr", 5} } }, + {0, { {"boxDR", 5} } }, {0, { {"boxdL", 5} } }, {0, { {"boxDl", 5} } }, {0, { {"boxDL", 5} } }, + {0, { {"boxuR", 5} } }, {0, { {"boxUr", 5} } }, {0, { {"boxUR", 5} } }, {0, { {"boxuL", 5} } }, + {0, { {"boxUl", 5} } }, {0, { {"boxUL", 5} } }, {0, { {"boxvR", 5} } }, {0, { {"boxVr", 5} } }, + {0, { {"boxVR", 5} } }, {0, { {"boxvL", 5} } }, {0, { {"boxVl", 5} } }, {0, { {"boxVL", 5} } }, + {0, { {"boxHd", 5} } }, {0, { {"boxhD", 5} } }, {0, { {"boxHD", 5} } }, {0, { {"boxHu", 5} } }, + {0, { {"boxhU", 5} } }, {0, { {"boxHU", 5} } }, {0, { {"boxvH", 5} } }, {0, { {"boxVh", 5} } }, + {0, { {"boxVH", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02580[] = { + {0, { {"uhblk", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"lhblk", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"block", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"blk14", 5} } }, {0, { {"blk12", 5} } }, {0, { {"blk34", 5} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"Square", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"squarf", 6} } }, {0, { {"EmptyVerySmallSquare", 20} } }, + {0, { {NULL, 0} } }, {0, { {"rect", 4} } }, {0, { {"marker", 6} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"fltns", 5} } }, {0, { {NULL, 0} } }, {0, { {"bigtriangleup", 13} } }, + {0, { {"blacktriangle", 13} } }, {0, { {"triangle", 8} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"blacktriangleright", 18} } }, {0, { {"rtri", 4} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"bigtriangledown", 15} } }, {0, { {"blacktriangledown", 17} } }, {0, { {"triangledown", 12} } }, +}; + +static const entity_stage3_row stage3_table_html5_025C0[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"blacktriangleleft", 17} } }, {0, { {"ltri", 4} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"lozenge", 7} } }, {0, { {"cir", 3} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"tridot", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"bigcirc", 7} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"ultri", 5} } }, {0, { {"urtri", 5} } }, {0, { {"lltri", 5} } }, {0, { {"EmptySmallSquare", 16} } }, + {0, { {"FilledSmallSquare", 17} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02600[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"starf", 5} } }, {0, { {"star", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"phone", 5} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02640[] = { + {0, { {"female", 6} } }, {0, { {NULL, 0} } }, {0, { {"male", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"spadesuit", 9} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"clubs", 5} } }, + {0, { {NULL, 0} } }, {0, { {"hearts", 6} } }, {0, { {"diamondsuit", 11} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"sung", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"flat", 4} } }, {0, { {"natur", 5} } }, {0, { {"sharp", 5} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02700[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"check", 5} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"cross", 5} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"maltese", 7} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"sext", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02740[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"VerticalSeparator", 17} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"lbbrk", 5} } }, {0, { {"rbbrk", 5} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_027C0[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"bsolhsub", 8} } }, {0, { {"suphsol", 7} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"LeftDoubleBracket", 17} } }, {0, { {"RightDoubleBracket", 18} } }, + {0, { {"langle", 6} } }, {0, { {"RightAngleBracket", 17} } }, {0, { {"Lang", 4} } }, {0, { {"Rang", 4} } }, + {0, { {"loang", 5} } }, {0, { {"roang", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"longleftarrow", 13} } }, {0, { {"LongRightArrow", 14} } }, {0, { {"LongLeftRightArrow", 18} } }, + {0, { {"xlArr", 5} } }, {0, { {"DoubleLongRightArrow", 20} } }, {0, { {"xhArr", 5} } }, {0, { {NULL, 0} } }, + {0, { {"xmap", 4} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"dzigrarr", 8} } }, +}; + +static const entity_stage3_row stage3_table_html5_02900[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"nvlArr", 6} } }, {0, { {"nvrArr", 6} } }, + {0, { {"nvHarr", 6} } }, {0, { {"Map", 3} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"lbarr", 5} } }, {0, { {"bkarow", 6} } }, {0, { {"lBarr", 5} } }, {0, { {"dbkarow", 7} } }, + {0, { {"drbkarow", 8} } }, {0, { {"DDotrahd", 8} } }, {0, { {"UpArrowBar", 10} } }, {0, { {"DownArrowBar", 12} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"Rarrtl", 6} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"latail", 6} } }, {0, { {"ratail", 6} } }, {0, { {"lAtail", 6} } }, + {0, { {"rAtail", 6} } }, {0, { {"larrfs", 6} } }, {0, { {"rarrfs", 6} } }, {0, { {"larrbfs", 7} } }, + {0, { {"rarrbfs", 7} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"nwarhk", 6} } }, + {0, { {"nearhk", 6} } }, {0, { {"searhk", 6} } }, {0, { {"swarhk", 6} } }, {0, { {"nwnear", 6} } }, + {0, { {"toea", 4} } }, {0, { {"seswar", 6} } }, {0, { {"swnwar", 6} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {1, { {(void *)multi_cp_html5_02933} } }, + {0, { {NULL, 0} } }, {0, { {"cudarrr", 7} } }, {0, { {"ldca", 4} } }, {0, { {"rdca", 4} } }, + {0, { {"cudarrl", 7} } }, {0, { {"larrpl", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"curarrm", 7} } }, {0, { {"cularrp", 7} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02940[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"rarrpl", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"harrcir", 7} } }, {0, { {"Uarrocir", 8} } }, {0, { {"lurdshar", 8} } }, {0, { {"ldrushar", 8} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"LeftRightVector", 15} } }, {0, { {"RightUpDownVector", 17} } }, + {0, { {"DownLeftRightVector", 19} } }, {0, { {"LeftUpDownVector", 16} } }, {0, { {"LeftVectorBar", 13} } }, {0, { {"RightVectorBar", 14} } }, + {0, { {"RightUpVectorBar", 16} } }, {0, { {"RightDownVectorBar", 18} } }, {0, { {"DownLeftVectorBar", 17} } }, {0, { {"DownRightVectorBar", 18} } }, + {0, { {"LeftUpVectorBar", 15} } }, {0, { {"LeftDownVectorBar", 17} } }, {0, { {"LeftTeeVector", 13} } }, {0, { {"RightTeeVector", 14} } }, + {0, { {"RightUpTeeVector", 16} } }, {0, { {"RightDownTeeVector", 18} } }, {0, { {"DownLeftTeeVector", 17} } }, {0, { {"DownRightTeeVector", 18} } }, + {0, { {"LeftUpTeeVector", 15} } }, {0, { {"LeftDownTeeVector", 17} } }, {0, { {"lHar", 4} } }, {0, { {"uHar", 4} } }, + {0, { {"rHar", 4} } }, {0, { {"dHar", 4} } }, {0, { {"luruhar", 7} } }, {0, { {"ldrdhar", 7} } }, + {0, { {"ruluhar", 7} } }, {0, { {"rdldhar", 7} } }, {0, { {"lharul", 6} } }, {0, { {"llhard", 6} } }, + {0, { {"rharul", 6} } }, {0, { {"lrhard", 6} } }, {0, { {"udhar", 5} } }, {0, { {"ReverseUpEquilibrium", 20} } }, + {0, { {"RoundImplies", 12} } }, {0, { {"erarr", 5} } }, {0, { {"simrarr", 7} } }, {0, { {"larrsim", 7} } }, + {0, { {"rarrsim", 7} } }, {0, { {"rarrap", 6} } }, {0, { {"ltlarr", 6} } }, {0, { {NULL, 0} } }, + {0, { {"gtrarr", 6} } }, {0, { {"subrarr", 7} } }, {0, { {NULL, 0} } }, {0, { {"suplarr", 7} } }, + {0, { {"lfisht", 6} } }, {0, { {"rfisht", 6} } }, {0, { {"ufisht", 6} } }, {0, { {"dfisht", 6} } }, +}; + +static const entity_stage3_row stage3_table_html5_02980[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"lopar", 5} } }, {0, { {"ropar", 5} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"lbrke", 5} } }, + {0, { {"rbrke", 5} } }, {0, { {"lbrkslu", 7} } }, {0, { {"rbrksld", 7} } }, {0, { {"lbrksld", 7} } }, + {0, { {"rbrkslu", 7} } }, {0, { {"langd", 5} } }, {0, { {"rangd", 5} } }, {0, { {"lparlt", 6} } }, + {0, { {"rpargt", 6} } }, {0, { {"gtlPar", 6} } }, {0, { {"ltrPar", 6} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"vzigzag", 7} } }, {0, { {NULL, 0} } }, + {0, { {"vangrt", 6} } }, {0, { {"angrtvbd", 8} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"ange", 4} } }, {0, { {"range", 5} } }, {0, { {"dwangle", 7} } }, {0, { {"uwangle", 7} } }, + {0, { {"angmsdaa", 8} } }, {0, { {"angmsdab", 8} } }, {0, { {"angmsdac", 8} } }, {0, { {"angmsdad", 8} } }, + {0, { {"angmsdae", 8} } }, {0, { {"angmsdaf", 8} } }, {0, { {"angmsdag", 8} } }, {0, { {"angmsdah", 8} } }, + {0, { {"bemptyv", 7} } }, {0, { {"demptyv", 7} } }, {0, { {"cemptyv", 7} } }, {0, { {"raemptyv", 8} } }, + {0, { {"laemptyv", 8} } }, {0, { {"ohbar", 5} } }, {0, { {"omid", 4} } }, {0, { {"opar", 4} } }, + {0, { {NULL, 0} } }, {0, { {"operp", 5} } }, {0, { {NULL, 0} } }, {0, { {"olcross", 7} } }, + {0, { {"odsold", 6} } }, {0, { {NULL, 0} } }, {0, { {"olcir", 5} } }, {0, { {"ofcir", 5} } }, +}; + +static const entity_stage3_row stage3_table_html5_029C0[] = { + {0, { {"olt", 3} } }, {0, { {"ogt", 3} } }, {0, { {"cirscir", 7} } }, {0, { {"cirE", 4} } }, + {0, { {"solb", 4} } }, {0, { {"bsolb", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"boxbox", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"trisb", 5} } }, {0, { {"rtriltri", 8} } }, {1, { {(void *)multi_cp_html5_029CF} } }, + {1, { {(void *)multi_cp_html5_029D0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"iinfin", 6} } }, {0, { {"infintie", 8} } }, {0, { {"nvinfin", 7} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"eparsl", 6} } }, + {0, { {"smeparsl", 8} } }, {0, { {"eqvparsl", 8} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"lozf", 4} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"RuleDelayed", 11} } }, {0, { {NULL, 0} } }, {0, { {"dsol", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_02A00[] = { + {0, { {"xodot", 5} } }, {0, { {"bigoplus", 8} } }, {0, { {"bigotimes", 9} } }, {0, { {NULL, 0} } }, + {0, { {"biguplus", 8} } }, {0, { {NULL, 0} } }, {0, { {"bigsqcup", 8} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"iiiint", 6} } }, {0, { {"fpartint", 8} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"cirfnint", 8} } }, {0, { {"awint", 5} } }, {0, { {"rppolint", 8} } }, {0, { {"scpolint", 8} } }, + {0, { {"npolint", 7} } }, {0, { {"pointint", 8} } }, {0, { {"quatint", 7} } }, {0, { {"intlarhk", 8} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"pluscir", 7} } }, {0, { {"plusacir", 8} } }, + {0, { {"simplus", 7} } }, {0, { {"plusdu", 6} } }, {0, { {"plussim", 7} } }, {0, { {"plustwo", 7} } }, + {0, { {NULL, 0} } }, {0, { {"mcomma", 6} } }, {0, { {"minusdu", 7} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"loplus", 6} } }, {0, { {"roplus", 6} } }, {0, { {"Cross", 5} } }, + {0, { {"timesd", 6} } }, {0, { {"timesbar", 8} } }, {0, { {NULL, 0} } }, {0, { {"smashp", 6} } }, + {0, { {"lotimes", 7} } }, {0, { {"rotimes", 7} } }, {0, { {"otimesas", 8} } }, {0, { {"Otimes", 6} } }, + {0, { {"odiv", 4} } }, {0, { {"triplus", 7} } }, {0, { {"triminus", 8} } }, {0, { {"tritime", 7} } }, + {0, { {"iprod", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"amalg", 5} } }, +}; + +static const entity_stage3_row stage3_table_html5_02A40[] = { + {0, { {"capdot", 6} } }, {0, { {NULL, 0} } }, {0, { {"ncup", 4} } }, {0, { {"ncap", 4} } }, + {0, { {"capand", 6} } }, {0, { {"cupor", 5} } }, {0, { {"cupcap", 6} } }, {0, { {"capcup", 6} } }, + {0, { {"cupbrcap", 8} } }, {0, { {"capbrcup", 8} } }, {0, { {"cupcup", 6} } }, {0, { {"capcap", 6} } }, + {0, { {"ccups", 5} } }, {0, { {"ccaps", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"ccupssm", 7} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"And", 3} } }, + {0, { {"Or", 2} } }, {0, { {"andand", 6} } }, {0, { {"oror", 4} } }, {0, { {"orslope", 7} } }, + {0, { {"andslope", 8} } }, {0, { {NULL, 0} } }, {0, { {"andv", 4} } }, {0, { {"orv", 3} } }, + {0, { {"andd", 4} } }, {0, { {"ord", 3} } }, {0, { {NULL, 0} } }, {0, { {"wedbar", 6} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"sdote", 5} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"simdot", 6} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {1, { {(void *)multi_cp_html5_02A6D} } }, {0, { {"easter", 6} } }, {0, { {"apacir", 6} } }, + {1, { {(void *)multi_cp_html5_02A70} } }, {0, { {"eplus", 5} } }, {0, { {"pluse", 5} } }, {0, { {"Esim", 4} } }, + {0, { {"Colone", 6} } }, {0, { {"Equal", 5} } }, {0, { {NULL, 0} } }, {0, { {"ddotseq", 7} } }, + {0, { {"equivDD", 7} } }, {0, { {"ltcir", 5} } }, {0, { {"gtcir", 5} } }, {0, { {"ltquest", 7} } }, + {0, { {"gtquest", 7} } }, {1, { {(void *)multi_cp_html5_02A7D} } }, {1, { {(void *)multi_cp_html5_02A7E} } }, {0, { {"lesdot", 6} } }, +}; + +static const entity_stage3_row stage3_table_html5_02A80[] = { + {0, { {"gesdot", 6} } }, {0, { {"lesdoto", 7} } }, {0, { {"gesdoto", 7} } }, {0, { {"lesdotor", 8} } }, + {0, { {"gesdotol", 8} } }, {0, { {"lap", 3} } }, {0, { {"gap", 3} } }, {0, { {"lne", 3} } }, + {0, { {"gne", 3} } }, {0, { {"lnap", 4} } }, {0, { {"gnap", 4} } }, {0, { {"lesseqqgtr", 10} } }, + {0, { {"gEl", 3} } }, {0, { {"lsime", 5} } }, {0, { {"gsime", 5} } }, {0, { {"lsimg", 5} } }, + {0, { {"gsiml", 5} } }, {0, { {"lgE", 3} } }, {0, { {"glE", 3} } }, {0, { {"lesges", 6} } }, + {0, { {"gesles", 6} } }, {0, { {"els", 3} } }, {0, { {"egs", 3} } }, {0, { {"elsdot", 6} } }, + {0, { {"egsdot", 6} } }, {0, { {"el", 2} } }, {0, { {"eg", 2} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"siml", 4} } }, {0, { {"simg", 4} } }, {0, { {"simlE", 5} } }, + {0, { {"simgE", 5} } }, {1, { {(void *)multi_cp_html5_02AA1} } }, {1, { {(void *)multi_cp_html5_02AA2} } }, {0, { {NULL, 0} } }, + {0, { {"glj", 3} } }, {0, { {"gla", 3} } }, {0, { {"ltcc", 4} } }, {0, { {"gtcc", 4} } }, + {0, { {"lescc", 5} } }, {0, { {"gescc", 5} } }, {0, { {"smt", 3} } }, {0, { {"lat", 3} } }, + {1, { {(void *)multi_cp_html5_02AAC} } }, {1, { {(void *)multi_cp_html5_02AAD} } }, {0, { {"bumpE", 5} } }, {1, { {(void *)multi_cp_html5_02AAF} } }, + {1, { {(void *)multi_cp_html5_02AB0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"prE", 3} } }, + {0, { {"scE", 3} } }, {0, { {"precneqq", 8} } }, {0, { {"scnE", 4} } }, {0, { {"precapprox", 10} } }, + {0, { {"succapprox", 10} } }, {0, { {"precnapprox", 11} } }, {0, { {"succnapprox", 11} } }, {0, { {"Pr", 2} } }, + {0, { {"Sc", 2} } }, {0, { {"subdot", 6} } }, {0, { {"supdot", 6} } }, {0, { {"subplus", 7} } }, +}; + +static const entity_stage3_row stage3_table_html5_02AC0[] = { + {0, { {"supplus", 7} } }, {0, { {"submult", 7} } }, {0, { {"supmult", 7} } }, {0, { {"subedot", 7} } }, + {0, { {"supedot", 7} } }, {1, { {(void *)multi_cp_html5_02AC5} } }, {1, { {(void *)multi_cp_html5_02AC6} } }, {0, { {"subsim", 6} } }, + {0, { {"supsim", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {1, { {(void *)multi_cp_html5_02ACB} } }, + {1, { {(void *)multi_cp_html5_02ACC} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"csub", 4} } }, + {0, { {"csup", 4} } }, {0, { {"csube", 5} } }, {0, { {"csupe", 5} } }, {0, { {"subsup", 6} } }, + {0, { {"supsub", 6} } }, {0, { {"subsub", 6} } }, {0, { {"supsup", 6} } }, {0, { {"suphsub", 7} } }, + {0, { {"supdsub", 7} } }, {0, { {"forkv", 5} } }, {0, { {"topfork", 7} } }, {0, { {"mlcp", 4} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"Dashv", 5} } }, {0, { {NULL, 0} } }, {0, { {"Vdashl", 6} } }, {0, { {"Barv", 4} } }, + {0, { {"vBar", 4} } }, {0, { {"vBarv", 5} } }, {0, { {NULL, 0} } }, {0, { {"Vbar", 4} } }, + {0, { {"Not", 3} } }, {0, { {"bNot", 4} } }, {0, { {"rnmid", 5} } }, {0, { {"cirmid", 6} } }, + {0, { {"midcir", 6} } }, {0, { {"topcir", 6} } }, {0, { {"nhpar", 5} } }, {0, { {"parsim", 6} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {1, { {(void *)multi_cp_html5_02AFD} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_0FB00[] = { + {0, { {"fflig", 5} } }, {0, { {"filig", 5} } }, {0, { {"fllig", 5} } }, {0, { {"ffilig", 6} } }, + {0, { {"ffllig", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_1D480[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"Ascr", 4} } }, {0, { {NULL, 0} } }, {0, { {"Cscr", 4} } }, {0, { {"Dscr", 4} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"Gscr", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"Jscr", 4} } }, {0, { {"Kscr", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"Nscr", 4} } }, {0, { {"Oscr", 4} } }, {0, { {"Pscr", 4} } }, + {0, { {"Qscr", 4} } }, {0, { {NULL, 0} } }, {0, { {"Sscr", 4} } }, {0, { {"Tscr", 4} } }, + {0, { {"Uscr", 4} } }, {0, { {"Vscr", 4} } }, {0, { {"Wscr", 4} } }, {0, { {"Xscr", 4} } }, + {0, { {"Yscr", 4} } }, {0, { {"Zscr", 4} } }, {0, { {"ascr", 4} } }, {0, { {"bscr", 4} } }, + {0, { {"cscr", 4} } }, {0, { {"dscr", 4} } }, {0, { {NULL, 0} } }, {0, { {"fscr", 4} } }, + {0, { {NULL, 0} } }, {0, { {"hscr", 4} } }, {0, { {"iscr", 4} } }, {0, { {"jscr", 4} } }, +}; + +static const entity_stage3_row stage3_table_html5_1D4C0[] = { + {0, { {"kscr", 4} } }, {0, { {"lscr", 4} } }, {0, { {"mscr", 4} } }, {0, { {"nscr", 4} } }, + {0, { {NULL, 0} } }, {0, { {"pscr", 4} } }, {0, { {"qscr", 4} } }, {0, { {"rscr", 4} } }, + {0, { {"sscr", 4} } }, {0, { {"tscr", 4} } }, {0, { {"uscr", 4} } }, {0, { {"vscr", 4} } }, + {0, { {"wscr", 4} } }, {0, { {"xscr", 4} } }, {0, { {"yscr", 4} } }, {0, { {"zscr", 4} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_1D500[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"Afr", 3} } }, {0, { {"Bfr", 3} } }, {0, { {NULL, 0} } }, {0, { {"Dfr", 3} } }, + {0, { {"Efr", 3} } }, {0, { {"Ffr", 3} } }, {0, { {"Gfr", 3} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"Jfr", 3} } }, {0, { {"Kfr", 3} } }, {0, { {"Lfr", 3} } }, + {0, { {"Mfr", 3} } }, {0, { {"Nfr", 3} } }, {0, { {"Ofr", 3} } }, {0, { {"Pfr", 3} } }, + {0, { {"Qfr", 3} } }, {0, { {NULL, 0} } }, {0, { {"Sfr", 3} } }, {0, { {"Tfr", 3} } }, + {0, { {"Ufr", 3} } }, {0, { {"Vfr", 3} } }, {0, { {"Wfr", 3} } }, {0, { {"Xfr", 3} } }, + {0, { {"Yfr", 3} } }, {0, { {NULL, 0} } }, {0, { {"afr", 3} } }, {0, { {"bfr", 3} } }, + {0, { {"cfr", 3} } }, {0, { {"dfr", 3} } }, {0, { {"efr", 3} } }, {0, { {"ffr", 3} } }, + {0, { {"gfr", 3} } }, {0, { {"hfr", 3} } }, {0, { {"ifr", 3} } }, {0, { {"jfr", 3} } }, + {0, { {"kfr", 3} } }, {0, { {"lfr", 3} } }, {0, { {"mfr", 3} } }, {0, { {"nfr", 3} } }, + {0, { {"ofr", 3} } }, {0, { {"pfr", 3} } }, {0, { {"qfr", 3} } }, {0, { {"rfr", 3} } }, + {0, { {"sfr", 3} } }, {0, { {"tfr", 3} } }, {0, { {"ufr", 3} } }, {0, { {"vfr", 3} } }, + {0, { {"wfr", 3} } }, {0, { {"xfr", 3} } }, {0, { {"yfr", 3} } }, {0, { {"zfr", 3} } }, + {0, { {"Aopf", 4} } }, {0, { {"Bopf", 4} } }, {0, { {NULL, 0} } }, {0, { {"Dopf", 4} } }, + {0, { {"Eopf", 4} } }, {0, { {"Fopf", 4} } }, {0, { {"Gopf", 4} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html5_1D540[] = { + {0, { {"Iopf", 4} } }, {0, { {"Jopf", 4} } }, {0, { {"Kopf", 4} } }, {0, { {"Lopf", 4} } }, + {0, { {"Mopf", 4} } }, {0, { {NULL, 0} } }, {0, { {"Oopf", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"Sopf", 4} } }, {0, { {"Topf", 4} } }, + {0, { {"Uopf", 4} } }, {0, { {"Vopf", 4} } }, {0, { {"Wopf", 4} } }, {0, { {"Xopf", 4} } }, + {0, { {"Yopf", 4} } }, {0, { {NULL, 0} } }, {0, { {"aopf", 4} } }, {0, { {"bopf", 4} } }, + {0, { {"copf", 4} } }, {0, { {"dopf", 4} } }, {0, { {"eopf", 4} } }, {0, { {"fopf", 4} } }, + {0, { {"gopf", 4} } }, {0, { {"hopf", 4} } }, {0, { {"iopf", 4} } }, {0, { {"jopf", 4} } }, + {0, { {"kopf", 4} } }, {0, { {"lopf", 4} } }, {0, { {"mopf", 4} } }, {0, { {"nopf", 4} } }, + {0, { {"oopf", 4} } }, {0, { {"popf", 4} } }, {0, { {"qopf", 4} } }, {0, { {"ropf", 4} } }, + {0, { {"sopf", 4} } }, {0, { {"topf", 4} } }, {0, { {"uopf", 4} } }, {0, { {"vopf", 4} } }, + {0, { {"wopf", 4} } }, {0, { {"xopf", 4} } }, {0, { {"yopf", 4} } }, {0, { {"zopf", 4} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +/* end of stage 3 Tables for HTML5 }}} */ + +/* {{{ Stage 2 Tables for HTML5 */ + +static const entity_stage2_row empty_stage2_table[] = { + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, +}; +static const entity_stage2_row stage2_table_html5_00000[] = { + stage3_table_html5_00000, stage3_table_html5_00040, stage3_table_html5_00080, stage3_table_html5_000C0, + stage3_table_html5_00100, stage3_table_html5_00140, stage3_table_html5_00180, stage3_table_html5_001C0, + stage3_table_html5_00200, empty_stage3_table, empty_stage3_table, stage3_table_html5_002C0, + stage3_table_html5_00300, empty_stage3_table, stage3_table_html5_00380, stage3_table_html5_003C0, + stage3_table_html5_00400, stage3_table_html5_00440, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, +}; + +static const entity_stage2_row stage2_table_html5_02000[] = { + stage3_table_html5_02000, stage3_table_html5_02040, stage3_table_html5_02080, stage3_table_html5_020C0, + stage3_table_html5_02100, stage3_table_html5_02140, stage3_table_html5_02180, stage3_table_html5_021C0, + stage3_table_html5_02200, stage3_table_html5_02240, stage3_table_html5_02280, stage3_table_html5_022C0, + stage3_table_html5_02300, stage3_table_html5_02340, stage3_table_html5_02380, stage3_table_html5_023C0, + stage3_table_html5_02400, empty_stage3_table, empty_stage3_table, stage3_table_html5_024C0, + stage3_table_html5_02500, stage3_table_html5_02540, stage3_table_html5_02580, stage3_table_html5_025C0, + stage3_table_html5_02600, stage3_table_html5_02640, empty_stage3_table, empty_stage3_table, + stage3_table_html5_02700, stage3_table_html5_02740, empty_stage3_table, stage3_table_html5_027C0, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + stage3_table_html5_02900, stage3_table_html5_02940, stage3_table_html5_02980, stage3_table_html5_029C0, + stage3_table_html5_02A00, stage3_table_html5_02A40, stage3_table_html5_02A80, stage3_table_html5_02AC0, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, +}; + +static const entity_stage2_row stage2_table_html5_0F000[] = { + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + stage3_table_html5_0FB00, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, +}; + +static const entity_stage2_row stage2_table_html5_1D000[] = { + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, stage3_table_html5_1D480, stage3_table_html5_1D4C0, + stage3_table_html5_1D500, stage3_table_html5_1D540, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, +}; + +/* end of stage 2 tables for HTML5 }}} */ + +static const entity_stage1_row entity_ms_table_html5[] = { + stage2_table_html5_00000, + empty_stage2_table, + stage2_table_html5_02000, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + stage2_table_html5_0F000, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + stage2_table_html5_1D000, +}; + +/* end of HTML5 multi-stage table for codepoint -> entity }}} */ + +/* {{{ HTML5 hash table for entity -> codepoint */ + +typedef struct { + const char *entity; + unsigned short entity_len; + unsigned int codepoint1; + unsigned int codepoint2; +} entity_cp_map; + +typedef const entity_cp_map *entity_ht_bucket; + +typedef struct { + unsigned num_elems; /* power of 2 */ + const entity_ht_bucket *buckets; /* .num_elems elements */ +} entity_ht; + +static const entity_cp_map ht_bucket_empty[] = { {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_000[] = { {"realpart", 8, 0x0211C, 0}, {"varr", 4, 0x02195, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_001[] = { {"angrt", 5, 0x0221F, 0}, {"iogon", 5, 0x0012F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_003[] = { {"lessdot", 7, 0x022D6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_005[] = { {"simrarr", 7, 0x02972, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_007[] = { {"Zscr", 4, 0x1D4B5, 0}, {"midast", 6, 0x0002A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_00D[] = { {"copf", 4, 0x1D554, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_00F[] = { {"female", 6, 0x02640, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_017[] = { {"NegativeThickSpace", 18, 0x0200B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_020[] = { {"copy", 4, 0x000A9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_022[] = { {"angst", 5, 0x000C5, 0}, {"searr", 5, 0x02198, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_024[] = { {"sqcups", 6, 0x02294, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_027[] = { {"Acirc", 5, 0x000C2, 0}, {"gtdot", 5, 0x022D7, 0}, {"varpi", 5, 0x003D6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_028[] = { {"UpTee", 5, 0x022A5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_029[] = { {"TildeTilde", 10, 0x02248, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_02A[] = { {"mfr", 3, 0x1D52A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_02B[] = { {"RightVectorBar", 14, 0x02953, 0}, {"gesdot", 6, 0x02A80, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_02C[] = { {"Uarrocir", 8, 0x02949, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_02E[] = { {"RightTriangleBar", 16, 0x029D0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_030[] = { {"Ocy", 3, 0x0041E, 0}, {"int", 3, 0x0222B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_034[] = { {"preccurlyeq", 11, 0x0227C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_038[] = { {"sccue", 5, 0x0227D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_040[] = { {"DoubleContourIntegral", 21, 0x0222F, 0}, {"nexist", 6, 0x02204, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_047[] = { {"acirc", 5, 0x000E2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_04C[] = { {"setmn", 5, 0x02216, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_04E[] = { {"Dopf", 4, 0x1D53B, 0}, {"LeftTee", 7, 0x022A3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_051[] = { {"SquareSuperset", 14, 0x02290, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_059[] = { {"udhar", 5, 0x0296E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_05D[] = { {"Equal", 5, 0x02A75, 0}, {"pscr", 4, 0x1D4C5, 0}, {"xvee", 4, 0x022C1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_05F[] = { {"approx", 6, 0x02248, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_060[] = { {"HARDcy", 6, 0x0042A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_061[] = { {"nGg", 3, 0x022D9, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_063[] = { {"yopf", 4, 0x1D56A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_064[] = { {"prcue", 5, 0x0227C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_065[] = { {"loarr", 5, 0x021FD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_069[] = { {"mho", 3, 0x02127, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_06A[] = { {"otimesas", 8, 0x02A36, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_06D[] = { {"capcap", 6, 0x02A4B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_06E[] = { {"eplus", 5, 0x02A71, 0}, {"nGt", 3, 0x0226B, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_06F[] = { {"Bumpeq", 6, 0x0224E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_071[] = { {"submult", 7, 0x02AC1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_073[] = { {"subplus", 7, 0x02ABF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_074[] = { {"auml", 4, 0x000E4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_07A[] = { {"RightDoubleBracket", 18, 0x027E7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_07B[] = { {"varkappa", 8, 0x003F0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_07C[] = { {"plusdo", 6, 0x02214, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_07F[] = { {"mid", 3, 0x02223, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_082[] = { {"plusdu", 6, 0x02A25, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_084[] = { {"notniva", 7, 0x0220C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_085[] = { {"notnivb", 7, 0x022FE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_086[] = { {"notnivc", 7, 0x022FD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_088[] = { {"varepsilon", 10, 0x003F5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_089[] = { {"nspar", 5, 0x02226, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_08C[] = { {"Ofr", 3, 0x1D512, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_08E[] = { {"Omega", 5, 0x003A9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_090[] = { {"equals", 6, 0x0003D, 0}, {"harrcir", 7, 0x02948, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_094[] = { {"Succeeds", 8, 0x0227B, 0}, {"cupdot", 6, 0x0228D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_097[] = { {"lsqb", 4, 0x0005B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_09E[] = { {"Qscr", 4, 0x1D4AC, 0}, {"urcorn", 6, 0x0231D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0A4[] = { {"Zopf", 4, 0x02124, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0A6[] = { {"triangleleft", 12, 0x025C3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0AB[] = { {"supdsub", 7, 0x02AD8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0AC[] = { {"chcy", 4, 0x00447, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0AD[] = { {"sqsupset", 8, 0x02290, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0AE[] = { {"omega", 5, 0x003C9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0AF[] = { {"rthree", 6, 0x022CC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0B0[] = { {"THORN", 5, 0x000DE, 0}, {"clubsuit", 8, 0x02663, 0}, {"filig", 5, 0x0FB01, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0B2[] = { {"ocir", 4, 0x0229A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0B8[] = { {"ShortDownArrow", 14, 0x02193, 0}, {"atilde", 6, 0x000E3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0B9[] = { {"DownLeftTeeVector", 17, 0x0295E, 0}, {"LeftTeeArrow", 12, 0x021A4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0BA[] = { {"GreaterFullEqual", 16, 0x02267, 0}, {"emsp", 4, 0x02003, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0C0[] = { {"lozf", 4, 0x029EB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0C4[] = { {"ThinSpace", 9, 0x02009, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0CE[] = { {"fnof", 4, 0x00192, 0}, {"multimap", 8, 0x022B8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0D1[] = { {"Zacute", 6, 0x00179, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0D2[] = { {"mdash", 5, 0x02014, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0D3[] = { {"minusb", 6, 0x0229F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0D5[] = { {"minusd", 6, 0x02238, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0DF[] = { {"varsigma", 8, 0x003C2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0E5[] = { {"ntilde", 6, 0x000F1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0E6[] = { {"Lambda", 6, 0x0039B, 0}, {"integers", 8, 0x02124, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0E8[] = { {"gesles", 6, 0x02A94, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0EC[] = { {"NotSubset", 9, 0x02282, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0EF[] = { {"NotLeftTriangleEqual", 20, 0x022EC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0F3[] = { {"LessLess", 8, 0x02AA1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0F4[] = { {"gscr", 4, 0x0210A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0FA[] = { {"popf", 4, 0x1D561, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0FB[] = { {"Agrave", 6, 0x000C0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0FD[] = { {"nvinfin", 7, 0x029DE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_0FE[] = { {"gacute", 6, 0x001F5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_100[] = { {"diam", 4, 0x022C4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_101[] = { {"nesim", 5, 0x02242, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_103[] = { {"YIcy", 4, 0x00407, 0}, {"bcy", 3, 0x00431, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_105[] = { {"Exists", 6, 0x02203, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_106[] = { {"vert", 4, 0x0007C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_109[] = { {"ropar", 5, 0x02986, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_10A[] = { {"topfork", 7, 0x02ADA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_10B[] = { {"nLl", 3, 0x022D8, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_10D[] = { {"notin", 5, 0x02209, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_10E[] = { {"SucceedsSlantEqual", 18, 0x0227D, 0}, {"toea", 4, 0x02928, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_10F[] = { {"ImaginaryI", 10, 0x02148, 0}, {"srarr", 5, 0x02192, 0}, {"ulcorner", 8, 0x0231C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_110[] = { {"LeftArrowBar", 12, 0x021E4, 0}, {"ldsh", 4, 0x021B2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_111[] = { {"DownBreve", 9, 0x00311, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_113[] = { {"nLt", 3, 0x0226A, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_116[] = { {"vltri", 5, 0x022B2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_11B[] = { {"VDash", 5, 0x022AB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_11C[] = { {"Dstrok", 6, 0x00110, 0}, {"Intersection", 12, 0x022C2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_11E[] = { {"lrhar", 5, 0x021CB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_121[] = { {"RightTee", 8, 0x022A2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_124[] = { {"RightArrowLeftArrow", 19, 0x021C4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_129[] = { {"Ccirc", 5, 0x00108, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_12A[] = { {"ntrianglelefteq", 15, 0x022EC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_12C[] = { {"leftharpoonup", 13, 0x021BC, 0}, {"scap", 4, 0x02AB8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_12E[] = { {"darr", 4, 0x02193, 0}, {"qfr", 3, 0x1D52E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_12F[] = { {"cdot", 4, 0x0010B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_130[] = { {"supseteqq", 9, 0x02AC6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_134[] = { {"Scy", 3, 0x00421, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_135[] = { {"Hscr", 4, 0x0210B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_137[] = { {"LowerRightArrow", 15, 0x02198, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_13A[] = { {"divide", 6, 0x000F7, 0}, {"tcedil", 6, 0x00163, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_13B[] = { {"LeftArrow", 9, 0x02190, 0}, {"Qopf", 4, 0x0211A, 0}, {"vDash", 5, 0x022A8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_145[] = { {"dash", 4, 0x02010, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_147[] = { {"oror", 4, 0x02A56, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_149[] = { {"ccirc", 5, 0x00109, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_14B[] = { {"LongLeftArrow", 13, 0x027F5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_14C[] = { {"straightphi", 11, 0x003D5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_14E[] = { {"xlarr", 5, 0x027F5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_14F[] = { {"DJcy", 4, 0x00402, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_158[] = { {"nbsp", 4, 0x000A0, 0}, {"succcurlyeq", 11, 0x0227D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_159[] = { {"njcy", 4, 0x0045A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_15B[] = { {"Leftarrow", 9, 0x021D0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_15E[] = { {"dtrif", 5, 0x025BE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_15F[] = { {"bfr", 3, 0x1D51F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_161[] = { {"GreaterTilde", 12, 0x02273, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_164[] = { {"hamilt", 6, 0x0210B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_165[] = { {"Dcy", 3, 0x00414, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_168[] = { {"LeftUpVector", 12, 0x021BF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_16A[] = { {"bigoplus", 8, 0x02A01, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_170[] = { {"nwarhk", 6, 0x02923, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_173[] = { {"diams", 5, 0x02666, 0}, {"suphsol", 7, 0x027C9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_17A[] = { {"boxminus", 8, 0x0229F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_17B[] = { {"leftarrow", 9, 0x02190, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_17C[] = { {"andd", 4, 0x02A5C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_17F[] = { {"NonBreakingSpace", 16, 0x000A0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_181[] = { {"xutri", 5, 0x025B3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_189[] = { {"Longleftrightarrow", 18, 0x027FA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_18B[] = { {"Longleftarrow", 13, 0x027F8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_18C[] = { {"gtrapprox", 9, 0x02A86, 0}, {"phmmat", 6, 0x02133, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_18E[] = { {"andv", 4, 0x02A5A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_18F[] = { {"equiv", 5, 0x02261, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_190[] = { {"Sfr", 3, 0x1D516, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_191[] = { {"gopf", 4, 0x1D558, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_193[] = { {"sqsub", 5, 0x0228F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_195[] = { {"approxeq", 8, 0x0224A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_19A[] = { {"Del", 3, 0x02207, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_19C[] = { {"nrightarrow", 11, 0x0219B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_19F[] = { {"SquareUnion", 11, 0x02294, 0}, {"strns", 5, 0x000AF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1A0[] = { {"Itilde", 6, 0x00128, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1A1[] = { {"sqsup", 5, 0x02290, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1A2[] = { {"Ouml", 4, 0x000D6, 0}, {"PrecedesTilde", 13, 0x0227E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1A3[] = { {"AMP", 3, 0x00026, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1A4[] = { {"plusmn", 6, 0x000B1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1A5[] = { {"xcup", 4, 0x022C3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1A8[] = { {"radic", 5, 0x0221A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1AB[] = { {"longleftarrow", 13, 0x027F5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1AC[] = { {"lrcorner", 8, 0x0231F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1AD[] = { {"notni", 5, 0x0220C, 0}, {"updownarrow", 11, 0x02195, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1AE[] = { {"szlig", 5, 0x000DF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1AF[] = { {"ugrave", 6, 0x000F9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1B0[] = { {"imof", 4, 0x022B7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1B2[] = { {"csub", 4, 0x02ACF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1B5[] = { {"gsim", 4, 0x02273, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1B9[] = { {"leftleftarrows", 14, 0x021C7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1BD[] = { {"backcong", 8, 0x0224C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1BE[] = { {"clubs", 5, 0x02663, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1C0[] = { {"csup", 4, 0x02AD0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1C1[] = { {"Dfr", 3, 0x1D507, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1C4[] = { {"profline", 8, 0x02312, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1C6[] = { {"Zdot", 4, 0x0017B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1C9[] = { {"ClockwiseContourIntegral", 24, 0x02232, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1CA[] = { {"roplus", 6, 0x02A2E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1CD[] = { {"Rang", 4, 0x027EB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1CE[] = { {"bcong", 5, 0x0224C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1D0[] = { {"tshcy", 5, 0x0045B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1D1[] = { {"eDot", 4, 0x02251, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1D2[] = { {"Hopf", 4, 0x0210D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1D4[] = { {"lpar", 4, 0x00028, 0}, {"odash", 5, 0x0229D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1D5[] = { {"capbrcup", 8, 0x02A49, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1D6[] = { {"ucy", 3, 0x00443, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1D8[] = { {"ofcir", 5, 0x029BF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1D9[] = { {"Breve", 5, 0x002D8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1DA[] = { {"barvee", 6, 0x022BD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1DF[] = { {"backsim", 7, 0x0223D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1E0[] = { {"ange", 4, 0x029A4, 0}, {"half", 4, 0x000BD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1E1[] = { {"tscr", 4, 0x1D4C9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1E5[] = { {"realine", 7, 0x0211B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1E6[] = { {"Oacute", 6, 0x000D3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1E7[] = { {"dfisht", 6, 0x0297F, 0}, {"swnwar", 6, 0x0292A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1E8[] = { {"tscy", 4, 0x00446, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1EB[] = { {"lsquor", 6, 0x0201A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1EF[] = { {"naturals", 8, 0x02115, 0}, {"utrif", 5, 0x025B4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1F0[] = { {"DiacriticalTilde", 16, 0x002DC, 0}, {"RightUpVectorBar", 16, 0x02954, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1F2[] = { {"rHar", 4, 0x02964, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1F4[] = { {"curlyeqprec", 11, 0x022DE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1F8[] = { {"dtri", 4, 0x025BF, 0}, {"euml", 4, 0x000EB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1F9[] = { {"breve", 5, 0x002D8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1FA[] = { {"Barwed", 6, 0x02306, 0}, {"nvlArr", 6, 0x02902, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1FC[] = { {"dcaron", 6, 0x0010F, 0}, {"natural", 7, 0x0266E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1FE[] = { {"nsupseteqq", 10, 0x02AC6, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_1FF[] = { {"nedot", 5, 0x02250, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_205[] = { {"bigtriangledown", 15, 0x025BD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_207[] = { {"fcy", 3, 0x00444, 0}, {"marker", 6, 0x025AE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_20E[] = { {"Union", 5, 0x022C3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_212[] = { {"varpropto", 9, 0x0221D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_213[] = { {"CloseCurlyDoubleQuote", 21, 0x0201D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_219[] = { {"DoubleLongRightArrow", 20, 0x027F9, 0}, {"GreaterGreater", 14, 0x02AA2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_21D[] = { {"Umacr", 5, 0x0016A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_220[] = { {"Colon", 5, 0x02237, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_222[] = { {"Hat", 3, 0x0005E, 0}, {"Uscr", 4, 0x1D4B0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_227[] = { {"SHCHcy", 6, 0x00429, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_229[] = { {"nLeftarrow", 10, 0x021CD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_22B[] = { {"Ecirc", 5, 0x000CA, 0}, {"Jukcy", 5, 0x00404, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_22C[] = { {"nbumpe", 6, 0x0224F, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_22D[] = { {"NotLess", 7, 0x0226E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_22F[] = { {"gtlPar", 6, 0x02995, 0}, {"suphsub", 7, 0x02AD7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_230[] = { {"gtreqqless", 10, 0x02A8C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_232[] = { {"ufr", 3, 0x1D532, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_234[] = { {"cirscir", 7, 0x029C2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_239[] = { {"LeftDownTeeVector", 17, 0x02961, 0}, {"duhar", 5, 0x0296F, 0}, {"nrtrie", 6, 0x022ED, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_23C[] = { {"llhard", 6, 0x0296B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_23D[] = { {"umacr", 5, 0x0016B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_23E[] = { {"lates", 5, 0x02AAD, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_240[] = { {"colon", 5, 0x0003A, 0}, {"iacute", 6, 0x000ED, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_241[] = { {"NotPrecedes", 11, 0x02280, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_242[] = { {"cirfnint", 8, 0x02A10, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_246[] = { {"barwedge", 8, 0x02305, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_249[] = { {"nleftarrow", 10, 0x0219A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_24A[] = { {"Ubrcy", 5, 0x0040E, 0}, {"leftthreetimes", 14, 0x022CB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_24B[] = { {"andand", 6, 0x02A55, 0}, {"ecirc", 5, 0x000EA, 0}, {"jukcy", 5, 0x00454, 0}, {"quatint", 7, 0x02A16, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_24D[] = { {"lharul", 6, 0x0296A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_251[] = { {"smtes", 5, 0x02AAC, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_252[] = { {"UnionPlus", 9, 0x0228E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_257[] = { {"NotLeftTriangle", 15, 0x022EA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_25A[] = { {"bne", 3, 0x0003D, 0x020E5}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_25B[] = { {"gtrsim", 6, 0x02273, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_25C[] = { {"Rarr", 4, 0x021A0, 0}, {"ldquor", 6, 0x0201E, 0}, {"phiv", 4, 0x003D5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_25D[] = { {"because", 7, 0x02235, 0}, {"gEl", 3, 0x02A8C, 0}, {"setminus", 8, 0x02216, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_263[] = { {"ffr", 3, 0x1D523, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_26A[] = { {"ubrcy", 5, 0x0045E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_26B[] = { {"elinters", 8, 0x023E7, 0}, {"plusb", 5, 0x0229E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_26E[] = { {"pluse", 5, 0x02A72, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_274[] = { {"CapitalDifferentialD", 20, 0x02145, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_277[] = { {"daleth", 6, 0x02138, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_278[] = { {"kscr", 4, 0x1D4C0, 0}, {"ogon", 4, 0x002DB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_27C[] = { {"SHcy", 4, 0x00428, 0}, {"equest", 6, 0x0225F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_27E[] = { {"rbarr", 5, 0x0290D, 0}, {"topf", 4, 0x1D565, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_283[] = { {"tritime", 7, 0x02A3B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_28A[] = { {"bot", 3, 0x022A5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_294[] = { {"Wfr", 3, 0x1D51A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_297[] = { {"HumpEqual", 9, 0x0224F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_298[] = { {"rightleftharpoons", 17, 0x021CC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_29D[] = { {"frasl", 5, 0x02044, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_29F[] = { {"UnderBracket", 12, 0x023B5, 0}, {"ovbar", 5, 0x0233D, 0}, {"upharpoonright", 14, 0x021BE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2A0[] = { {"euro", 4, 0x020AC, 0}, {"nhArr", 5, 0x021CE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2A9[] = { {"NotSupersetEqual", 16, 0x02289, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2AE[] = { {"cularr", 6, 0x021B6, 0}, {"scnE", 4, 0x02AB6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2B1[] = { {"napid", 5, 0x0224B, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2B2[] = { {"harr", 4, 0x02194, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2B3[] = { {"gdot", 4, 0x00121, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2B9[] = { {"Lscr", 4, 0x02112, 0}, {"zeta", 4, 0x003B6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2BF[] = { {"ENG", 3, 0x0014A, 0}, {"Uopf", 4, 0x1D54C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2C4[] = { {"esdot", 5, 0x02250, 0}, {"scsim", 5, 0x0227F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2C5[] = { {"Hfr", 3, 0x0210C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2CE[] = { {"RightArrow", 10, 0x02192, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2CF[] = { {"Sqrt", 4, 0x0221A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2D3[] = { {"xodot", 5, 0x02A00, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2DA[] = { {"ycy", 3, 0x0044B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2DB[] = { {"hkswarow", 8, 0x02926, 0}, {"urtri", 5, 0x025F9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2DC[] = { {"roang", 5, 0x027ED, 0}, {"tosa", 4, 0x02929, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2E3[] = { {"CircleMinus", 11, 0x02296, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2E4[] = { {"Lcaron", 6, 0x0013D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2EB[] = { {"ShortLeftArrow", 14, 0x02190, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2EC[] = { {"Dot", 3, 0x000A8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2EE[] = { {"Rightarrow", 10, 0x021D2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2F0[] = { {"prsim", 5, 0x0227E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2F2[] = { {"notinE", 6, 0x022F9, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_2F8[] = { {"becaus", 6, 0x02235, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_300[] = { {"NotEqualTilde", 13, 0x02242, 0x00338}, {"nparallel", 9, 0x02226, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_301[] = { {"capcup", 6, 0x02A47, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_304[] = { {"simeq", 5, 0x02243, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_305[] = { {"forall", 6, 0x02200, 0}, {"straightepsilon", 15, 0x003F5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_308[] = { {"ruluhar", 7, 0x02968, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_30B[] = { {"jcy", 3, 0x00439, 0}, {"ltcc", 4, 0x02AA6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_30F[] = { {"bscr", 4, 0x1D4B7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_311[] = { {"ExponentialE", 12, 0x02147, 0}, {"weierp", 6, 0x02118, 0}, {"yen", 3, 0x000A5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_313[] = { {"blacksquare", 11, 0x025AA, 0}, {"uml", 3, 0x000A8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_315[] = { {"backsimeq", 9, 0x022CD, 0}, {"kopf", 4, 0x1D55C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_319[] = { {"NotPrecedesEqual", 16, 0x02AAF, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_31A[] = { {"simgE", 5, 0x02AA0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_31B[] = { {"tridot", 6, 0x025EC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_326[] = { {"DoubleLongLeftArrow", 19, 0x027F8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_329[] = { {"models", 6, 0x022A7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_32A[] = { {"emptyv", 6, 0x02205, 0}, {"eqslantgtr", 10, 0x02A96, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_32D[] = { {"Gcirc", 5, 0x0011C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_330[] = { {"bernou", 6, 0x0212C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_331[] = { {"HumpDownHump", 12, 0x0224E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_336[] = { {"yfr", 3, 0x1D536, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_338[] = { {"blacktriangle", 13, 0x025B4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_33B[] = { {"yacy", 4, 0x0044F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_33F[] = { {"lsime", 5, 0x02A8D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_340[] = { {"NotTildeEqual", 13, 0x02244, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_341[] = { {"lsimg", 5, 0x02A8F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_347[] = { {"ncap", 4, 0x02A43, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_34D[] = { {"DD", 2, 0x02145, 0}, {"gcirc", 5, 0x0011D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_350[] = { {"Cscr", 4, 0x1D49E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_356[] = { {"Lopf", 4, 0x1D543, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_358[] = { {"lBarr", 5, 0x0290E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_359[] = { {"Leftrightarrow", 14, 0x021D4, 0}, {"gtrdot", 6, 0x022D7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_35D[] = { {"NotSquareSubset", 15, 0x0228F, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_35F[] = { {"sqsubset", 8, 0x0228F, 0}, {"subsetneq", 9, 0x0228A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_361[] = { {"doublebarwedge", 14, 0x02306, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_363[] = { {"blacktriangleleft", 17, 0x025C2, 0}, {"hellip", 6, 0x02026, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_365[] = { {"xscr", 4, 0x1D4CD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_367[] = { {"LessFullEqual", 13, 0x02266, 0}, {"jfr", 3, 0x1D527, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_369[] = { {"GreaterSlantEqual", 17, 0x02A7E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_36A[] = { {"Uring", 5, 0x0016E, 0}, {"VeryThinSpace", 13, 0x0200A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_36B[] = { {"roarr", 5, 0x021FE, 0}, {"scaron", 6, 0x00161, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_36D[] = { {"Lcy", 3, 0x0041B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_36E[] = { {"RightDownVector", 15, 0x021C2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_36F[] = { {"Sub", 3, 0x022D0, 0}, {"pitchfork", 9, 0x022D4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_372[] = { {"nvsim", 5, 0x0223C, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_374[] = { {"xrArr", 5, 0x027F9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_378[] = { {"CloseCurlyQuote", 15, 0x02019, 0}, {"uwangle", 7, 0x029A7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_37A[] = { {"Sum", 3, 0x02211, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_37C[] = { {"iuml", 4, 0x000EF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_37D[] = { {"Sup", 3, 0x022D1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_37E[] = { {"planck", 6, 0x0210F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_37F[] = { {"Egrave", 6, 0x000C8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_380[] = { {"curlywedge", 10, 0x022CF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_382[] = { {"TildeFullEqual", 14, 0x02245, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_383[] = { {"searhk", 6, 0x02925, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_386[] = { {"ETH", 3, 0x000D0, 0}, {"napos", 5, 0x00149, 0}, {"upsi", 4, 0x003C5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_387[] = { {"twoheadleftarrow", 16, 0x0219E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_38A[] = { {"Assign", 6, 0x02254, 0}, {"uring", 5, 0x0016F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_38D[] = { {"SquareIntersection", 18, 0x02293, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_38E[] = { {"lmidot", 6, 0x00140, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_391[] = { {"kcedil", 6, 0x00137, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_394[] = { {"curren", 6, 0x000A4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_397[] = { {"acute", 5, 0x000B4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_398[] = { {"curlyeqsucc", 11, 0x022DF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_39C[] = { {"Omicron", 7, 0x0039F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_39F[] = { {"uarr", 4, 0x02191, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3A0[] = { {"Hstrok", 6, 0x00126, 0}, {"UnderBrace", 10, 0x023DF, 0}, {"tdot", 4, 0x020DB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3A1[] = { {"qint", 4, 0x02A0C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3A4[] = { {"sfrown", 6, 0x02322, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3A5[] = { {"trpezium", 8, 0x023E2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3A6[] = { {"Yscr", 4, 0x1D4B4, 0}, {"cedil", 5, 0x000B8, 0}, {"planckh", 7, 0x0210E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3A7[] = { {"lang", 4, 0x027E8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3AC[] = { {"bopf", 4, 0x1D553, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3B2[] = { {"lbbrk", 5, 0x02772, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3B4[] = { {"khcy", 4, 0x00445, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3BF[] = { {"Epsilon", 7, 0x00395, 0}, {"simlE", 5, 0x02A9F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3C0[] = { {"GT", 2, 0x0003E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3C4[] = { {"nap", 3, 0x02249, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3C9[] = { {"Lfr", 3, 0x1D50F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3CD[] = { {"succapprox", 10, 0x02AB8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3D0[] = { {"bsim", 4, 0x0223D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3D3[] = { {"Gg", 2, 0x022D9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3D9[] = { {"angrtvb", 7, 0x022BE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3DE[] = { {"xcirc", 5, 0x025EF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3E0[] = { {"Gt", 2, 0x0226B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3E1[] = { {"LeftRightVector", 15, 0x0294E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3E3[] = { {"circledast", 10, 0x0229B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3E4[] = { {"telrec", 6, 0x02315, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3E6[] = { {"SucceedsTilde", 13, 0x0227F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3E9[] = { {"nLtv", 4, 0x0226A, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3ED[] = { {"Copf", 4, 0x02102, 0}, {"napprox", 7, 0x02249, 0}, {"nsupseteq", 9, 0x02289, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3F1[] = { {"VerticalTilde", 13, 0x02240, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3F2[] = { {"parallel", 8, 0x02225, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3F7[] = { {"precnapprox", 11, 0x02AB9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3FC[] = { {"oscr", 4, 0x02134, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_3FE[] = { {"supsetneqq", 10, 0x02ACC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_402[] = { {"xopf", 4, 0x1D569, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_405[] = { {"mumap", 5, 0x022B8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_407[] = { {"varsupsetneqq", 13, 0x02ACC, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_409[] = { {"ReverseEquilibrium", 18, 0x021CB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_40E[] = { {"Ubreve", 6, 0x0016C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_40F[] = { {"YUcy", 4, 0x0042E, 0}, {"ncy", 3, 0x0043D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_413[] = { {"ltimes", 6, 0x022C9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_41A[] = { {"UpperRightArrow", 15, 0x02197, 0}, {"nvap", 4, 0x0224D, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_41B[] = { {"Im", 2, 0x02111, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_421[] = { {"simne", 5, 0x02246, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_423[] = { {"ccups", 5, 0x02A4C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_424[] = { {"nlArr", 5, 0x021CD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_425[] = { {"rarrsim", 7, 0x02974, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_426[] = { {"Ncaron", 6, 0x00147, 0}, {"vsupnE", 6, 0x02ACC, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_429[] = { {"succeq", 6, 0x02AB0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_42C[] = { {"Gammad", 6, 0x003DC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_42F[] = { {"Icirc", 5, 0x000CE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_430[] = { {"backepsilon", 11, 0x003F6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_432[] = { {"ddarr", 5, 0x021CA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_436[] = { {"larr", 4, 0x02190, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_439[] = { {"divideontimes", 13, 0x022C7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_43C[] = { {"succsim", 7, 0x0227F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_43D[] = { {"Pscr", 4, 0x1D4AB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_43E[] = { {"puncsp", 6, 0x02008, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_43F[] = { {"gtreqless", 9, 0x022DB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_440[] = { {"intcal", 6, 0x022BA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_441[] = { {"nsime", 5, 0x02244, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_443[] = { {"Yopf", 4, 0x1D550, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_446[] = { {"angsph", 6, 0x02222, 0}, {"vsupne", 6, 0x0228B, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_447[] = { {"NotNestedLessLess", 17, 0x02AA1, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_44A[] = { {"PrecedesSlantEqual", 18, 0x0227C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_44F[] = { {"icirc", 5, 0x000EE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_450[] = { {"DownLeftVectorBar", 17, 0x02956, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_454[] = { {"Auml", 4, 0x000C4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_457[] = { {"LJcy", 4, 0x00409, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_458[] = { {"sqsube", 6, 0x02291, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_45D[] = { {"nprec", 5, 0x02280, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_45F[] = { {"ngE", 3, 0x02267, 0x00338}, {"smile", 5, 0x02323, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_465[] = { {"LT", 2, 0x0003C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_466[] = { {"ldrdhar", 7, 0x02967, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_469[] = { {"utri", 4, 0x025B5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_46A[] = { {"Sacute", 6, 0x0015A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_46B[] = { {"late", 4, 0x02AAD, 0}, {"nfr", 3, 0x1D52B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_46D[] = { {"NotNestedGreaterGreater", 23, 0x02AA2, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_46F[] = { {"nwarr", 5, 0x02196, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_470[] = { {"biguplus", 8, 0x02A04, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_471[] = { {"Pcy", 3, 0x0041F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_472[] = { {"bigtriangleup", 13, 0x025B3, 0}, {"rationals", 9, 0x0211A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_473[] = { {"congdot", 7, 0x02A6D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_475[] = { {"PlusMinus", 9, 0x000B1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_479[] = { {"IOcy", 4, 0x00401, 0}, {"Scedil", 6, 0x0015E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_47C[] = { {"eqcirc", 6, 0x02256, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_47D[] = { {"Ll", 2, 0x022D8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_47F[] = { {"Cayleys", 7, 0x0212D, 0}, {"nge", 3, 0x02271, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_480[] = { {"NotGreater", 10, 0x0226F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_485[] = { {"Lt", 2, 0x0226A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_488[] = { {"rotimes", 7, 0x02A35, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_48C[] = { {"caps", 4, 0x02229, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_48E[] = { {"ngt", 3, 0x0226F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_48F[] = { {"Cross", 5, 0x02A2F, 0}, {"bumpeq", 6, 0x0224F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_490[] = { {"VerticalSeparator", 17, 0x02758, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_491[] = { {"plankv", 6, 0x0210F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_493[] = { {"fscr", 4, 0x1D4BB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_495[] = { {"bsol", 4, 0x0005C, 0}, {"sqsubseteq", 10, 0x02291, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_496[] = { {"boxH", 4, 0x02550, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_498[] = { {"rightarrowtail", 14, 0x021A3, 0}, {"ufisht", 6, 0x0297E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_499[] = { {"oopf", 4, 0x1D560, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_49F[] = { {"lobrk", 5, 0x027E6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4A2[] = { {"Acy", 3, 0x00410, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4A4[] = { {"NotSubsetEqual", 14, 0x02288, 0}, {"boxV", 4, 0x02551, 0}, {"dHar", 4, 0x02965, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4A6[] = { {"precnsim", 8, 0x022E8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4A7[] = { {"Mu", 2, 0x0039C, 0}, {"aelig", 5, 0x000E6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4AA[] = { {"gescc", 5, 0x02AA9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4AB[] = { {"origof", 6, 0x022B6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4AE[] = { {"upsih", 5, 0x003D2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4AF[] = { {"cross", 5, 0x02717, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4B2[] = { {"LeftFloor", 9, 0x0230A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4B6[] = { {"boxh", 4, 0x02500, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4B8[] = { {"NotGreaterEqual", 15, 0x02271, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4BC[] = { {"profalar", 8, 0x0232E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4C0[] = { {"nsmid", 5, 0x02224, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4C2[] = { {"hbar", 4, 0x0210F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4C3[] = { {"udarr", 5, 0x021C5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4C4[] = { {"boxv", 4, 0x02502, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4C5[] = { {"olarr", 5, 0x021BA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4C8[] = { {"Nu", 2, 0x0039D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4CB[] = { {"NotCongruent", 12, 0x02262, 0}, {"bkarow", 6, 0x0290D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4CD[] = { {"Pfr", 3, 0x1D513, 0}, {"forkv", 5, 0x02AD9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4CF[] = { {"nis", 3, 0x022FC, 0}, {"trianglerighteq", 15, 0x022B5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4D0[] = { {"ngeq", 4, 0x02271, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4D2[] = { {"cudarrl", 7, 0x02938, 0}, {"nges", 4, 0x02A7E, 0x00338}, {"niv", 3, 0x0220B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4D3[] = { {"SubsetEqual", 11, 0x02286, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4D4[] = { {"Gscr", 4, 0x1D4A2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4D5[] = { {"complexes", 9, 0x02102, 0}, {"eDDot", 5, 0x02A77, 0}, {"nvge", 4, 0x02265, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4D8[] = { {"cudarrr", 7, 0x02935, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4DA[] = { {"Popf", 4, 0x02119, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4DE[] = { {"LongRightArrow", 14, 0x027F6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4DF[] = { {"supseteq", 8, 0x02287, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4E3[] = { {"dollar", 6, 0x00024, 0}, {"gnsim", 5, 0x022E7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4E4[] = { {"nvgt", 4, 0x0003E, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4E6[] = { {"Or", 2, 0x02A54, 0}, {"Vert", 4, 0x02016, 0}, {"lneqq", 5, 0x02268, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4E7[] = { {"nLeftrightarrow", 15, 0x021CE, 0}, {"nbump", 5, 0x0224E, 0x00338}, {"ntriangleright", 14, 0x022EB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4E8[] = { {"ecir", 4, 0x02256, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4E9[] = { {"npolint", 7, 0x02A14, 0}, {"plus", 4, 0x0002B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4ED[] = { {"centerdot", 9, 0x000B7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4F1[] = { {"zacute", 6, 0x0017A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4F7[] = { {"odiv", 4, 0x02A38, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4F9[] = { {"cap", 3, 0x02229, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4FB[] = { {"ensp", 4, 0x02002, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_4FE[] = { {"Afr", 3, 0x1D504, 0}, {"Pi", 2, 0x003A0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_500[] = { {"iquest", 6, 0x000BF, 0}, {"ltri", 4, 0x025C3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_504[] = { {"nlE", 3, 0x02266, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_506[] = { {"Phi", 3, 0x003A6, 0}, {"lambda", 6, 0x003BB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_507[] = { {"Pr", 2, 0x02ABB, 0}, {"Vdashl", 6, 0x02AE6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_509[] = { {"SuchThat", 8, 0x0220B, 0}, {"Supset", 6, 0x022D1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_50E[] = { {"Darr", 4, 0x021A1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_50F[] = { {"Cdot", 4, 0x0010A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_513[] = { {"rcy", 3, 0x00440, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_516[] = { {"orderof", 7, 0x02134, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_518[] = { {"leqq", 4, 0x02266, 0}, {"precsim", 7, 0x0227E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_519[] = { {"RightTriangle", 13, 0x022B3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_51B[] = { {"agrave", 6, 0x000E0, 0}, {"succnapprox", 11, 0x02ABA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_51C[] = { {"Tab", 3, 0x00009, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_524[] = { {"nle", 3, 0x02270, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_525[] = { {"spades", 6, 0x02660, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_526[] = { {"gtcc", 4, 0x02AA7, 0}, {"llcorner", 8, 0x0231E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_52F[] = { {"Oslash", 6, 0x000D8, 0}, {"Tau", 3, 0x003A4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_530[] = { {"fopf", 4, 0x1D557, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_532[] = { {"Mellintrf", 9, 0x02133, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_533[] = { {"nlt", 3, 0x0226E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_534[] = { {"lparlt", 6, 0x02993, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_53B[] = { {"Ccaron", 6, 0x0010C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_53C[] = { {"Re", 2, 0x0211C, 0}, {"dstrok", 6, 0x00111, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_53F[] = { {"leftharpoondown", 15, 0x021BD, 0}, {"ssetmn", 6, 0x02216, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_542[] = { {"lrhard", 6, 0x0296D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_543[] = { {"reg", 3, 0x000AE, 0}, {"sharp", 5, 0x0266F, 0}, {"yicy", 4, 0x00457, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_545[] = { {"ShortUpArrow", 12, 0x02191, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_548[] = { {"plusacir", 8, 0x02A23, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_54F[] = { {"cent", 4, 0x000A2, 0}, {"natur", 5, 0x0266E, 0}, {"varphi", 6, 0x003D5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_550[] = { {"lesg", 4, 0x022DA, 0x0FE00}, {"supnE", 5, 0x02ACC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_551[] = { {"ohbar", 5, 0x029B5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_557[] = { {"NotLessGreater", 14, 0x02278, 0}, {"nleqslant", 9, 0x02A7D, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_55B[] = { {"Sc", 2, 0x02ABC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_55D[] = { {"NotSucceedsEqual", 16, 0x02AB0, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_55F[] = { {"DZcy", 4, 0x0040F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_564[] = { {"vartheta", 8, 0x003D1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_565[] = { {"ltrie", 5, 0x022B4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_566[] = { {"Otilde", 6, 0x000D5, 0}, {"ltrif", 5, 0x025C2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_56C[] = { {"Lsh", 3, 0x021B0, 0}, {"hookleftarrow", 13, 0x021A9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_56F[] = { {"rfr", 3, 0x1D52F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_570[] = { {"supne", 5, 0x0228B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_571[] = { {"Gopf", 4, 0x1D53E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_572[] = { {"UpEquilibrium", 13, 0x0296E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_575[] = { {"Tcy", 3, 0x00422, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_576[] = { {"ffilig", 6, 0x0FB03, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_577[] = { {"fork", 4, 0x022D4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_578[] = { {"oplus", 5, 0x02295, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_57A[] = { {"nvle", 4, 0x02264, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_57B[] = { {"HilbertSpace", 12, 0x0210B, 0}, {"subedot", 7, 0x02AC3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_57C[] = { {"TripleDot", 9, 0x020DB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_580[] = { {"sscr", 4, 0x1D4C8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_582[] = { {"osol", 4, 0x02298, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_583[] = { {"plustwo", 7, 0x02A27, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_586[] = { {"LessGreater", 11, 0x02276, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_588[] = { {"lrarr", 5, 0x021C6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_589[] = { {"nvlt", 4, 0x0003C, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_58D[] = { {"questeq", 7, 0x0225F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_58E[] = { {"LessTilde", 9, 0x02272, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_58F[] = { {"djcy", 4, 0x00452, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_590[] = { {"xoplus", 6, 0x02A01, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_595[] = { {"primes", 6, 0x02119, 0}, {"solb", 4, 0x029C4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_596[] = { {"not", 3, 0x000AC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_59A[] = { {"angzarr", 7, 0x0237C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_59D[] = { {"nearr", 5, 0x02197, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_59F[] = { {"lowast", 6, 0x02217, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5A0[] = { {"cfr", 3, 0x1D520, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5A3[] = { {"ltcir", 5, 0x02A79, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5A6[] = { {"Ecy", 3, 0x0042D, 0}, {"gesdotol", 8, 0x02A84, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5A9[] = { {"longleftrightarrow", 18, 0x027F7, 0}, {"para", 4, 0x000B6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5AC[] = { {"Uacute", 6, 0x000DA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5AD[] = { {"blank", 5, 0x02423, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5AE[] = { {"rho", 3, 0x003C1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5B0[] = { {"dharl", 5, 0x021C3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5B1[] = { {"rsquor", 6, 0x02019, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5B5[] = { {"NotSquareSubsetEqual", 20, 0x022E2, 0}, {"npr", 3, 0x02280, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5B6[] = { {"dharr", 5, 0x021C2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5B7[] = { {"NewLine", 7, 0x0000A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5BB[] = { {"odot", 4, 0x02299, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5BC[] = { {"part", 4, 0x02202, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5BD[] = { {"cuvee", 5, 0x022CE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5BF[] = { {"lesdoto", 7, 0x02A81, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5C0[] = { {"itilde", 6, 0x00129, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5C1[] = { {"Tscr", 4, 0x1D4AF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5C2[] = { {"nsubE", 5, 0x02AC5, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5C4[] = { {"ratio", 5, 0x02236, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5D0[] = { {"Conint", 6, 0x0222F, 0}, {"LeftDownVectorBar", 17, 0x02959, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5D1[] = { {"Tfr", 3, 0x1D517, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5D3[] = { {"fllig", 5, 0x0FB02, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5D5[] = { {"thksim", 6, 0x0223C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5D8[] = { {"Euml", 4, 0x000CB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5D9[] = { {"chi", 3, 0x003C7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5DB[] = { {"ncup", 4, 0x02A42, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5DD[] = { {"SOFTcy", 6, 0x0042C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5DF[] = { {"bnequiv", 7, 0x02261, 0x020E5}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5E2[] = { {"nsube", 5, 0x02288, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5E4[] = { {"mapstoleft", 10, 0x021A4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5E7[] = { {"NotLessSlantEqual", 17, 0x02A7D, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5EA[] = { {"ldrushar", 8, 0x0294B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5ED[] = { {"Equilibrium", 11, 0x021CC, 0}, {"Uogon", 5, 0x00172, 0}, {"supsetneq", 9, 0x0228B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5F0[] = { {"Vbar", 4, 0x02AEB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5F3[] = { {"vnsub", 5, 0x02282, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5F6[] = { {"Square", 6, 0x025A1, 0}, {"lessapprox", 10, 0x02A85, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5F8[] = { {"And", 3, 0x02A53, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5FA[] = { {"gesdoto", 7, 0x02A82, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_5FD[] = { {"gap", 3, 0x02A86, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_601[] = { {"nsucc", 5, 0x02281, 0}, {"thicksim", 8, 0x0223C, 0}, {"vnsup", 5, 0x02283, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_602[] = { {"Efr", 3, 0x1D508, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_603[] = { {"Igrave", 6, 0x000CC, 0}, {"cir", 3, 0x025CB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_606[] = { {"Xi", 2, 0x0039E, 0}, {"oacute", 6, 0x000F3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_609[] = { {"nsc", 3, 0x02281, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_60D[] = { {"uogon", 5, 0x00173, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_613[] = { {"rharul", 6, 0x0296C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_615[] = { {"RuleDelayed", 11, 0x029F4, 0}, {"apacir", 6, 0x02A6F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_617[] = { {"jscr", 4, 0x1D4BF, 0}, {"vcy", 3, 0x00432, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_61A[] = { {"barwed", 6, 0x02305, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_61D[] = { {"sopf", 4, 0x1D564, 0}, {"thkap", 5, 0x02248, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_61F[] = { {"lesseqgtr", 9, 0x022DA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_622[] = { {"rdquor", 6, 0x0201D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_624[] = { {"Lstrok", 6, 0x00141, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_626[] = { {"Product", 7, 0x0220F, 0}, {"sqsupe", 6, 0x02292, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_628[] = { {"awconint", 8, 0x02233, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_62C[] = { {"hearts", 6, 0x02665, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_630[] = { {"rlm", 3, 0x0200F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_632[] = { {"comma", 5, 0x0002C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_636[] = { {"PartialD", 8, 0x02202, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_63A[] = { {"wedbar", 6, 0x02A5F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_63C[] = { {"oline", 5, 0x0203E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_63D[] = { {"OverBracket", 11, 0x023B4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_63E[] = { {"RBarr", 5, 0x02910, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_641[] = { {"uharl", 5, 0x021BF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_642[] = { {"leftrightsquigarrow", 19, 0x021AD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_645[] = { {"RightFloor", 10, 0x0230B, 0}, {"intprod", 7, 0x02A3C, 0}, {"vee", 3, 0x02228, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_646[] = { {"zigrarr", 7, 0x021DD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_647[] = { {"uharr", 5, 0x021BE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_648[] = { {"gcy", 3, 0x00433, 0}, {"varsubsetneq", 12, 0x0228A, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_649[] = { {"leqslant", 8, 0x02A7D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_64A[] = { {"Odblac", 6, 0x00150, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_651[] = { {"minus", 5, 0x02212, 0}, {"scpolint", 8, 0x02A13, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_652[] = { {"lrtri", 5, 0x022BF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_653[] = { {"DiacriticalGrave", 16, 0x00060, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_655[] = { {"num", 3, 0x00023, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_657[] = { {"quest", 5, 0x0003F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_658[] = { {"Kscr", 4, 0x1D4A6, 0}, {"UnderBar", 8, 0x0005F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_659[] = { {"lsquo", 5, 0x02018, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_65C[] = { {"rArr", 4, 0x021D2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_65E[] = { {"Topf", 4, 0x1D54B, 0}, {"heartsuit", 9, 0x02665, 0}, {"rBarr", 5, 0x0290F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_660[] = { {"emptyset", 8, 0x02205, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_669[] = { {"UnderParenthesis", 16, 0x023DD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_670[] = { {"dotplus", 7, 0x02214, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_671[] = { {"Psi", 3, 0x003A8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_672[] = { {"GJcy", 4, 0x00403, 0}, {"exist", 5, 0x02203, 0}, {"simplus", 7, 0x02A24, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_673[] = { {"vfr", 3, 0x1D533, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_676[] = { {"tprime", 6, 0x02034, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_678[] = { {"leftrightharpoons", 17, 0x021CB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_679[] = { {"rbrksld", 7, 0x0298E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_67D[] = { {"Ecaron", 6, 0x0011A, 0}, {"gel", 3, 0x022DB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_680[] = { {"capdot", 6, 0x02A40, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_682[] = { {"geq", 3, 0x02265, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_684[] = { {"LowerLeftArrow", 14, 0x02199, 0}, {"ges", 3, 0x02A7E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_685[] = { {"Colone", 6, 0x02A74, 0}, {"NotLessEqual", 12, 0x02270, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_68A[] = { {"nrarr", 5, 0x0219B, 0}, {"rbrkslu", 7, 0x02990, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_68C[] = { {"flat", 4, 0x0266D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_691[] = { {"there4", 6, 0x02234, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_693[] = { {"Gdot", 4, 0x00120, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_694[] = { {"ijlig", 5, 0x00133, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_696[] = { {"blacklozenge", 12, 0x029EB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_699[] = { {"Zeta", 4, 0x00396, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6A3[] = { {"duarr", 5, 0x021F5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6A4[] = { {"DotEqual", 8, 0x02250, 0}, {"dtdot", 5, 0x022F1, 0}, {"gfr", 3, 0x1D524, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6A8[] = { {"cirE", 4, 0x029C3, 0}, {"period", 6, 0x0002E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6A9[] = { {"lmoust", 6, 0x023B0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6AA[] = { {"Icy", 3, 0x00418, 0}, {"Rcaron", 6, 0x00158, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6AB[] = { {"LeftCeiling", 11, 0x02308, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6AE[] = { {"ascr", 4, 0x1D4B6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6B0[] = { {"boxtimes", 8, 0x022A0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6B4[] = { {"jopf", 4, 0x1D55B, 0}, {"ntriangleleft", 13, 0x022EA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6B6[] = { {"eqcolon", 7, 0x02255, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6B8[] = { {"rbbrk", 5, 0x02773, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6B9[] = { {"homtht", 6, 0x0223B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6BA[] = { {"ggg", 3, 0x022D9, 0}, {"seswar", 6, 0x02929, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6BC[] = { {"perp", 4, 0x022A5, 0}, {"shcy", 4, 0x00448, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6BF[] = { {"phone", 5, 0x0260E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6C0[] = { {"NotDoubleVerticalBar", 20, 0x02226, 0}, {"ngtr", 4, 0x0226F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6C4[] = { {"ThickSpace", 10, 0x0205F, 0x0200A}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6C5[] = { {"ForAll", 6, 0x02200, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6C6[] = { {"circ", 4, 0x002C6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6C7[] = { {"Verbar", 6, 0x02016, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6C8[] = { {"cire", 4, 0x02257, 0}, {"lesges", 6, 0x02A93, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6C9[] = { {"slarr", 5, 0x02190, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6CC[] = { {"RightDownTeeVector", 18, 0x0295D, 0}, {"triangleq", 9, 0x0225C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6CE[] = { {"checkmark", 9, 0x02713, 0}, {"quot", 4, 0x00022, 0}, {"suplarr", 7, 0x0297B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6D1[] = { {"Backslash", 9, 0x02216, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6D2[] = { {"fallingdotseq", 13, 0x02252, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6D4[] = { {"swArr", 5, 0x021D9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6D5[] = { {"Xfr", 3, 0x1D51B, 0}, {"lbrke", 5, 0x0298B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6D9[] = { {"jmath", 5, 0x00237, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6DA[] = { {"lmoustache", 10, 0x023B0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6DB[] = { {"DownTee", 7, 0x022A4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6DC[] = { {"reals", 5, 0x0211D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6DE[] = { {"quaternions", 11, 0x0210D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6E7[] = { {"vzigzag", 7, 0x0299A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6EB[] = { {"pound", 5, 0x000A3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6EE[] = { {"permil", 6, 0x02030, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6EF[] = { {"Bscr", 4, 0x0212C, 0}, {"lfisht", 6, 0x0297C, 0}, {"vartriangleleft", 15, 0x022B2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6F5[] = { {"Kopf", 4, 0x1D542, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6F7[] = { {"Tilde", 5, 0x0223C, 0}, {"gtrarr", 6, 0x02978, 0}, {"lAarr", 5, 0x021DA, 0}, {"opar", 4, 0x029B7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_6FB[] = { {"triangle", 8, 0x025B5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_704[] = { {"lcaron", 6, 0x0013E, 0}, {"wscr", 4, 0x1D4CC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_705[] = { {"asympeq", 7, 0x0224D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_706[] = { {"Ifr", 3, 0x02111, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_707[] = { {"DoubleDot", 9, 0x000A8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_709[] = { {"nVdash", 6, 0x022AE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_70C[] = { {"hairsp", 6, 0x0200A, 0}, {"leftrightarrows", 15, 0x021C6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_70E[] = { {"lbrace", 6, 0x0007B, 0}, {"rightarrow", 10, 0x02192, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_70F[] = { {"Dagger", 6, 0x02021, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_712[] = { {"rsh", 3, 0x021B1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_714[] = { {"eqslantless", 11, 0x02A95, 0}, {"gnapprox", 8, 0x02A8A, 0}, {"lbrack", 6, 0x0005B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_715[] = { {"uHar", 4, 0x02963, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_717[] = { {"tilde", 5, 0x002DC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_719[] = { {"complement", 10, 0x02201, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_71B[] = { {"zcy", 3, 0x00437, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_71E[] = { {"boxDL", 5, 0x02557, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_71F[] = { {"micro", 5, 0x000B5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_723[] = { {"horbar", 6, 0x02015, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_724[] = { {"boxDR", 5, 0x02554, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_727[] = { {"bsolhsub", 8, 0x027C8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_729[] = { {"ac", 2, 0x0223E, 0}, {"nvdash", 6, 0x022AC, 0}, {"precapprox", 10, 0x02AB7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_72C[] = { {"af", 2, 0x02061, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_72D[] = { {"bullet", 6, 0x02022, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_72E[] = { {"demptyv", 7, 0x029B1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_733[] = { {"geqq", 4, 0x02267, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_734[] = { {"uuarr", 5, 0x021C8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_735[] = { {"Ocirc", 5, 0x000D4, 0}, {"utdot", 5, 0x022F0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_736[] = { {"ap", 2, 0x02248, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_738[] = { {"bNot", 4, 0x02AED, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_73B[] = { {"CirclePlus", 10, 0x02295, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_73D[] = { {"glE", 3, 0x02A92, 0}, {"midcir", 6, 0x02AF0, 0}, {"rppolint", 8, 0x02A12, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_73E[] = { {"boxDl", 5, 0x02556, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_73F[] = { {"sdot", 4, 0x022C5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_744[] = { {"boxDr", 5, 0x02553, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_745[] = { {"Xscr", 4, 0x1D4B3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_749[] = { {"dlcrop", 6, 0x0230D, 0}, {"gtrless", 7, 0x02277, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_74B[] = { {"aopf", 4, 0x1D552, 0}, {"operp", 5, 0x029B9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_74C[] = { {"kcy", 3, 0x0043A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_74F[] = { {"larrfs", 6, 0x0291D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_751[] = { {"rcub", 4, 0x0007D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_754[] = { {"nrtri", 5, 0x022EB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_755[] = { {"nparsl", 6, 0x02AFD, 0x020E5}, {"ocirc", 5, 0x000F4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_759[] = { {"gla", 3, 0x02AA5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_75C[] = { {"Iuml", 4, 0x000CF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_75F[] = { {"mcomma", 6, 0x02A29, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_762[] = { {"glj", 3, 0x02AA4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_763[] = { {"Map", 3, 0x02905, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_765[] = { {"copysr", 6, 0x02117, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_766[] = { {"DownTeeArrow", 12, 0x021A7, 0}, {"Upsi", 4, 0x003D2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_768[] = { {"awint", 5, 0x02A11, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_76E[] = { {"DownRightVector", 15, 0x021C1, 0}, {"NotEqual", 8, 0x02260, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_770[] = { {"gesl", 4, 0x022DB, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_772[] = { {"NotCupCap", 9, 0x0226D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_776[] = { {"blacktriangleright", 18, 0x025B8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_777[] = { {"zfr", 3, 0x1D537, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_779[] = { {"leftrightarrow", 14, 0x02194, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_77A[] = { {"Abreve", 6, 0x00102, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_77F[] = { {"Uarr", 4, 0x0219F, 0}, {"gnE", 3, 0x02269, 0}, {"supmult", 7, 0x02AC2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_781[] = { {"supplus", 7, 0x02AC0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_783[] = { {"nabla", 5, 0x02207, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_787[] = { {"Lang", 4, 0x027EA, 0}, {"laquo", 5, 0x000AB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_789[] = { {"larrhk", 6, 0x021A9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_78C[] = { {"Bopf", 4, 0x1D539, 0}, {"lowbar", 6, 0x0005F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_78D[] = { {"cup", 3, 0x0222A, 0}, {"dd", 2, 0x02146, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_78E[] = { {"nsce", 4, 0x02AB0, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_790[] = { {"nshortparallel", 14, 0x02226, 0}, {"nsupE", 5, 0x02AC6, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_794[] = { {"OpenCurlyQuote", 14, 0x02018, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_797[] = { {"bsolb", 5, 0x029C5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_798[] = { {"DScy", 4, 0x00405, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_79A[] = { {"boxHD", 5, 0x02566, 0}, {"ltrPar", 6, 0x02996, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_79B[] = { {"nscr", 4, 0x1D4C3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_79D[] = { {"lEg", 3, 0x02A8B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_79F[] = { {"egrave", 6, 0x000E8, 0}, {"gne", 3, 0x02A88, 0}, {"larrsim", 7, 0x02973, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7A0[] = { {"COPY", 4, 0x000A9, 0}, {"bdquo", 5, 0x0201E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7A1[] = { {"wopf", 4, 0x1D568, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7A2[] = { {"NotRightTriangleEqual", 21, 0x022ED, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7A5[] = { {"robrk", 5, 0x027E7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7A8[] = { {"kfr", 3, 0x1D528, 0}, {"nlsim", 5, 0x02274, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7AA[] = { {"xhArr", 5, 0x027FA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7AB[] = { {"boxHU", 5, 0x02569, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7AC[] = { {"lHar", 4, 0x02962, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7AE[] = { {"Mcy", 3, 0x0041C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7AF[] = { {"ee", 2, 0x02147, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7B0[] = { {"nsupe", 5, 0x02289, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7B1[] = { {"eg", 2, 0x02A9A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7B5[] = { {"trade", 5, 0x02122, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7B6[] = { {"el", 2, 0x02A99, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7B7[] = { {"nsucceq", 7, 0x02AB0, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7B8[] = { {"langle", 6, 0x027E8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7BA[] = { {"boxHd", 5, 0x02564, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7BB[] = { {"Subset", 6, 0x022D0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7BD[] = { {"DownArrowBar", 12, 0x02913, 0}, {"topbot", 6, 0x02336, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7BE[] = { {"OverBrace", 9, 0x023DE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7BF[] = { {"Eta", 3, 0x00397, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7C0[] = { {"hstrok", 6, 0x00127, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7C1[] = { {"Hacek", 5, 0x002C7, 0}, {"diamond", 7, 0x022C4, 0}, {"isinsv", 6, 0x022F3, 0}, {"rtriltri", 8, 0x029CE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7C9[] = { {"nvltrie", 7, 0x022B4, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7CB[] = { {"boxHu", 5, 0x02567, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7CD[] = { {"fpartint", 8, 0x02A0D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7CE[] = { {"Proportional", 12, 0x0221D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7D1[] = { {"NotSuperset", 11, 0x02283, 0x020D2}, {"gE", 2, 0x02267, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7D2[] = { {"scnsim", 6, 0x022E9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7D5[] = { {"uparrow", 7, 0x02191, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7D6[] = { {"ltlarr", 6, 0x02976, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7D9[] = { {"rtimes", 6, 0x022CA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7DA[] = { {"ncong", 5, 0x02247, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7DC[] = { {"Oscr", 4, 0x1D4AA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7E0[] = { {"vArr", 4, 0x021D5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7E2[] = { {"Xopf", 4, 0x1D54F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7E4[] = { {"notinva", 7, 0x02209, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7E5[] = { {"notinvb", 7, 0x022F7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7E6[] = { {"notinvc", 7, 0x022F6, 0}, {"nsqsube", 7, 0x022E2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7EC[] = { {"Tcaron", 6, 0x00164, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7EF[] = { {"upsilon", 7, 0x003C5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7F1[] = { {"ge", 2, 0x02265, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7F3[] = { {"gg", 2, 0x0226B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7F6[] = { {"KJcy", 4, 0x0040C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7F8[] = { {"gl", 2, 0x02277, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7FB[] = { {"dblac", 5, 0x002DD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_7FC[] = { {"lAtail", 6, 0x0291B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_800[] = { {"gt", 2, 0x0003E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_802[] = { {"lotimes", 7, 0x02A34, 0}, {"seArr", 5, 0x021D8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_803[] = { {"Lacute", 6, 0x00139, 0}, {"Laplacetrf", 10, 0x02112, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_808[] = { {"uuml", 4, 0x000FC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_809[] = { {"Amacr", 5, 0x00100, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_80A[] = { {"Mfr", 3, 0x1D510, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_810[] = { {"Int", 3, 0x0222C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_811[] = { {"Vvdash", 6, 0x022AA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_812[] = { {"Lcedil", 6, 0x0013B, 0}, {"larrlp", 6, 0x021AB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_816[] = { {"Larr", 4, 0x0219E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_819[] = { {"CircleTimes", 11, 0x02297, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_81C[] = { {"NotReverseElement", 17, 0x0220C, 0}, {"latail", 6, 0x02919, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_81D[] = { {"ntrianglerighteq", 16, 0x022ED, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_821[] = { {"blk12", 5, 0x02592, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_822[] = { {"intlarhk", 8, 0x02A17, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_823[] = { {"blk14", 5, 0x02591, 0}, {"ccupssm", 7, 0x02A50, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_824[] = { {"hercon", 6, 0x022B9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_828[] = { {"bigotimes", 9, 0x02A02, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_829[] = { {"amacr", 5, 0x00101, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_82D[] = { {"nrarrc", 6, 0x02933, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_82E[] = { {"ubreve", 6, 0x0016D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_830[] = { {"Yacute", 6, 0x000DD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_831[] = { {"ic", 2, 0x02063, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_832[] = { {"escr", 4, 0x0212F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_837[] = { {"ii", 2, 0x02148, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_838[] = { {"DownArrowUpArrow", 16, 0x021F5, 0}, {"nopf", 4, 0x1D55F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_83C[] = { {"in", 2, 0x02208, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_83E[] = { {"bumpE", 5, 0x02AAE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_83F[] = { {"rightharpoonup", 14, 0x021C0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_841[] = { {"nrarrw", 6, 0x0219D, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_842[] = { {"it", 2, 0x02062, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_846[] = { {"ncaron", 6, 0x00148, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_84A[] = { {"succnsim", 8, 0x022E9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_84C[] = { {"gammad", 6, 0x003DD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_84F[] = { {"yucy", 4, 0x0044E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_850[] = { {"ocy", 3, 0x0043E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_855[] = { {"hybull", 6, 0x02043, 0}, {"rpargt", 6, 0x02994, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_857[] = { {"csube", 5, 0x02AD1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_85B[] = { {"iiota", 5, 0x02129, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_85C[] = { {"nsim", 4, 0x02241, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_85E[] = { {"LeftTriangleEqual", 17, 0x022B4, 0}, {"bumpe", 5, 0x0224F, 0}, {"nearhk", 6, 0x02924, 0}, {"nhpar", 5, 0x02AF2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_861[] = { {"risingdotseq", 12, 0x02253, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_865[] = { {"blk34", 5, 0x02593, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_866[] = { {"LeftTriangle", 12, 0x022B2, 0}, {"vBarv", 5, 0x02AE9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_867[] = { {"AElig", 5, 0x000C6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_868[] = { {"DoubleUpDownArrow", 17, 0x021D5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_86A[] = { {"cwint", 5, 0x02231, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_86B[] = { {"rtrie", 5, 0x022B5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_86C[] = { {"rtrif", 5, 0x025B8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_873[] = { {"Fscr", 4, 0x02131, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_876[] = { {"lE", 2, 0x02266, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_879[] = { {"Oopf", 4, 0x1D546, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_87B[] = { {"spar", 4, 0x02225, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_87E[] = { {"uplus", 5, 0x0228E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_88A[] = { {"sacute", 6, 0x0015B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_88C[] = { {"fltns", 5, 0x025B1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_88E[] = { {"rrarr", 5, 0x021C9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_892[] = { {"larrpl", 6, 0x02939, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_895[] = { {"ultri", 5, 0x025F8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_896[] = { {"le", 2, 0x02264, 0}, {"xuplus", 6, 0x02A04, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_897[] = { {"ljcy", 4, 0x00459, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_898[] = { {"lg", 2, 0x02276, 0}, {"vsubnE", 6, 0x02ACB, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_899[] = { {"scedil", 6, 0x0015F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_89D[] = { {"ll", 2, 0x0226A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8A5[] = { {"lt", 2, 0x0003C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8AC[] = { {"ofr", 3, 0x1D52C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8B3[] = { {"nexists", 7, 0x02204, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8B6[] = { {"smallsetminus", 13, 0x02216, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8B7[] = { {"InvisibleComma", 14, 0x02063, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8B8[] = { {"dotminus", 8, 0x02238, 0}, {"vsubne", 6, 0x0228A, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8B9[] = { {"iocy", 4, 0x00451, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8BA[] = { {"gsime", 5, 0x02A8E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8BC[] = { {"Rarrtl", 6, 0x02916, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8BD[] = { {"cirmid", 6, 0x02AEF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8C0[] = { {"ominus", 6, 0x02296, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8C1[] = { {"gsiml", 5, 0x02A90, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8C2[] = { {"Prime", 5, 0x02033, 0}, {"mp", 2, 0x02213, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8C4[] = { {"tint", 4, 0x0222D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8C7[] = { {"mu", 2, 0x003BC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8CF[] = { {"dbkarow", 7, 0x0290F, 0}, {"eopf", 4, 0x1D556, 0}, {"ogt", 3, 0x029C1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8D0[] = { {"Precedes", 8, 0x0227A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8D3[] = { {"UpTeeArrow", 10, 0x021A5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8D6[] = { {"varsupsetneq", 12, 0x0228B, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8D8[] = { {"ne", 2, 0x02260, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8DC[] = { {"ni", 2, 0x0220B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8DD[] = { {"mDDot", 5, 0x0223A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8DE[] = { {"cularrp", 7, 0x0293D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8DF[] = { {"rnmid", 5, 0x02AEE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8E0[] = { {"hardcy", 6, 0x0044A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8E2[] = { {"prime", 5, 0x02032, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8E3[] = { {"Bcy", 3, 0x00411, 0}, {"REG", 3, 0x000AE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8E7[] = { {"oS", 2, 0x024C8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8E8[] = { {"nu", 2, 0x003BD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8E9[] = { {"ohm", 3, 0x003A9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8EB[] = { {"langd", 5, 0x02991, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8F3[] = { {"backprime", 9, 0x02035, 0}, {"esim", 4, 0x02242, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8FB[] = { {"veeeq", 5, 0x0225A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8FE[] = { {"RightCeiling", 12, 0x02309, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_8FF[] = { {"crarr", 5, 0x021B5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_904[] = { {"eqsim", 5, 0x02242, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_906[] = { {"or", 2, 0x02228, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_907[] = { {"OverParenthesis", 15, 0x023DC, 0}, {"UpperLeftArrow", 14, 0x02196, 0}, {"nleftrightarrow", 15, 0x021AE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_909[] = { {"expectation", 11, 0x02130, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_90C[] = { {"coprod", 6, 0x02210, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_90E[] = { {"Qfr", 3, 0x1D514, 0}, {"dArr", 4, 0x021D3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_910[] = { {"Fopf", 4, 0x1D53D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_913[] = { {"Cconint", 7, 0x02230, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_916[] = { {"larrtl", 6, 0x021A2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_918[] = { {"Aacute", 6, 0x000C1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_919[] = { {"DownLeftRightVector", 19, 0x02950, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_91B[] = { {"circleddash", 11, 0x0229D, 0}, {"thinsp", 6, 0x02009, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_91E[] = { {"Longrightarrow", 14, 0x027F9, 0}, {"pi", 2, 0x003C0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_91F[] = { {"hookrightarrow", 14, 0x021AA, 0}, {"rscr", 4, 0x1D4C7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_920[] = { {"scE", 3, 0x02AB4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_922[] = { {"pm", 2, 0x000B1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_923[] = { {"ZHcy", 4, 0x00416, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_927[] = { {"pr", 2, 0x0227A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_929[] = { {"LongLeftRightArrow", 18, 0x027F7, 0}, {"supset", 6, 0x02283, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_92A[] = { {"UpArrowBar", 10, 0x02912, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_92C[] = { {"Utilde", 6, 0x00168, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_92E[] = { {"xlArr", 5, 0x027F8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_930[] = { {"DoubleUpArrow", 13, 0x021D1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_936[] = { {"alefsym", 7, 0x02135, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_939[] = { {"Scirc", 5, 0x0015C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_93B[] = { {"xotime", 6, 0x02A02, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_93F[] = { {"Bfr", 3, 0x1D505, 0}, {"rdca", 4, 0x02937, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_940[] = { {"sce", 3, 0x02AB0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_945[] = { {"Nacute", 6, 0x00143, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_947[] = { {"amalg", 5, 0x02A3F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_94D[] = { {"UpDownArrow", 11, 0x02195, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_94F[] = { {"EqualTilde", 10, 0x02242, 0}, {"boxUL", 5, 0x0255D, 0}, {"oslash", 6, 0x000F8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_950[] = { {"lnap", 4, 0x02A89, 0}, {"thorn", 5, 0x000FE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_952[] = { {"ssmile", 6, 0x02323, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_953[] = { {"ndash", 5, 0x02013, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_954[] = { {"Ncedil", 6, 0x00145, 0}, {"scy", 3, 0x00441, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_955[] = { {"boxUR", 5, 0x0255A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_956[] = { {"Aring", 5, 0x000C5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_959[] = { {"scirc", 5, 0x0015D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_95B[] = { {"ccaron", 6, 0x0010D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_95D[] = { {"dotsquare", 9, 0x022A1, 0}, {"nshortmid", 9, 0x02224, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_95F[] = { {"rsquo", 5, 0x02019, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_960[] = { {"Sscr", 4, 0x1D4AE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_963[] = { {"bigwedge", 8, 0x022C0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_964[] = { {"Bernoullis", 10, 0x0212C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_969[] = { {"harrw", 5, 0x021AD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_96C[] = { {"SquareSubset", 12, 0x0228F, 0}, {"boxVH", 5, 0x0256C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_96F[] = { {"boxUl", 5, 0x0255C, 0}, {"rx", 2, 0x0211E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_970[] = { {"boxVL", 5, 0x02563, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_974[] = { {"olt", 3, 0x029C0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_975[] = { {"boxUr", 5, 0x02559, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_976[] = { {"aring", 5, 0x000E5, 0}, {"boxVR", 5, 0x02560, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_97B[] = { {"sc", 2, 0x0227B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_97C[] = { {"NestedGreaterGreater", 20, 0x0226B, 0}, {"oast", 4, 0x0229B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_97F[] = { {"star", 4, 0x02606, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_981[] = { {"LeftTeeVector", 13, 0x0295A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_983[] = { {"bigsqcup", 8, 0x02A06, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_985[] = { {"dcy", 3, 0x00434, 0}, {"preceq", 6, 0x02AAF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_986[] = { {"otilde", 6, 0x000F5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_988[] = { {"luruhar", 7, 0x02966, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_98C[] = { {"boxVh", 5, 0x0256B, 0}, {"capand", 6, 0x02A44, 0}, {"yuml", 4, 0x000FF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_98D[] = { {"Updownarrow", 11, 0x021D5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_98F[] = { {"TildeEqual", 10, 0x02243, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_990[] = { {"boxVl", 5, 0x02562, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_996[] = { {"boxVr", 5, 0x0255F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_997[] = { {"HorizontalLine", 14, 0x02500, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_99B[] = { {"xmap", 4, 0x027FC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_99C[] = { {"sigmaf", 6, 0x003C2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_99E[] = { {"EmptySmallSquare", 16, 0x025FB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_99F[] = { {"dzcy", 4, 0x0045F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9A0[] = { {"cups", 4, 0x0222A, 0x0FE00}, {"zwj", 3, 0x0200D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9A1[] = { {"beta", 4, 0x003B2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9A6[] = { {"supsim", 6, 0x02AC8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9A8[] = { {"beth", 4, 0x02136, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9AA[] = { {"Iukcy", 5, 0x00406, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9AC[] = { {"eparsl", 6, 0x029E3, 0}, {"sigmav", 6, 0x003C2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9B0[] = { {"lhard", 5, 0x021BD, 0}, {"sfr", 3, 0x1D530, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9B4[] = { {"nsqsupe", 7, 0x022E3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9B5[] = { {"Jsercy", 6, 0x00408, 0}, {"deg", 3, 0x000B0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9B6[] = { {"Ucy", 3, 0x00423, 0}, {"iscr", 4, 0x1D4BE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9B7[] = { {"efDot", 5, 0x02252, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9BB[] = { {"uhblk", 5, 0x02580, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9BC[] = { {"ropf", 4, 0x1D563, 0}, {"vprop", 5, 0x0221D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9BD[] = { {"isinE", 5, 0x022F9, 0}, {"raemptyv", 8, 0x029B3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9C1[] = { {"lharu", 5, 0x021BC, 0}, {"ncongdot", 8, 0x02A6D, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9C2[] = { {"subnE", 5, 0x02ACB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9C3[] = { {"ngsim", 5, 0x02275, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9C5[] = { {"starf", 5, 0x02605, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9C9[] = { {"Ograve", 6, 0x000D2, 0}, {"hksearow", 8, 0x02925, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9CA[] = { {"iukcy", 5, 0x00456, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9CC[] = { {"uacute", 6, 0x000FA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9CF[] = { {"asymp", 5, 0x02248, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9D5[] = { {"lneq", 4, 0x02A87, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9D6[] = { {"Otimes", 6, 0x02A37, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9DA[] = { {"NotTildeTilde", 13, 0x02249, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9DB[] = { {"Integral", 8, 0x0222B, 0}, {"rbrke", 5, 0x0298C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9DD[] = { {"nsub", 4, 0x02284, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9DE[] = { {"rlhar", 5, 0x021CC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9E1[] = { {"dfr", 3, 0x1D521, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9E2[] = { {"subne", 5, 0x0228A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9E5[] = { {"varnothing", 10, 0x02205, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9E7[] = { {"Fcy", 3, 0x00424, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9E9[] = { {"DoubleLeftTee", 13, 0x02AE4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9EB[] = { {"isins", 5, 0x022F4, 0}, {"nsup", 4, 0x02285, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9ED[] = { {"circlearrowleft", 15, 0x021BA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9EE[] = { {"isinv", 5, 0x02208, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9EF[] = { {"IEcy", 4, 0x00415, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9F0[] = { {"conint", 6, 0x0222E, 0}, {"vBar", 4, 0x02AE8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9F1[] = { {"edot", 4, 0x00117, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9F2[] = { {"Kappa", 5, 0x0039A, 0}, {"MediumSpace", 11, 0x0205F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9F3[] = { {"lbrksld", 7, 0x0298F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9F4[] = { {"sect", 4, 0x000A7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9F5[] = { {"nldr", 4, 0x02025, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9F7[] = { {"Jscr", 4, 0x1D4A5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9F9[] = { {"shy", 3, 0x000AD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9FA[] = { {"ulcrop", 6, 0x0230F, 0}, {"veebar", 6, 0x022BB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_9FD[] = { {"Sopf", 4, 0x1D54A, 0}, {"cuwed", 5, 0x022CF, 0}, {"rAarr", 5, 0x021DB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A01[] = { {"erarr", 5, 0x02971, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A04[] = { {"lbrkslu", 7, 0x0298D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A05[] = { {"NotSucceeds", 11, 0x02281, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A06[] = { {"nsccue", 6, 0x022E1, 0}, {"subrarr", 7, 0x02979, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A08[] = { {"looparrowright", 14, 0x021AC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A0C[] = { {"wp", 2, 0x02118, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A0D[] = { {"Emacr", 5, 0x00112, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A0E[] = { {"sim", 3, 0x0223C, 0}, {"wr", 2, 0x02240, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A10[] = { {"Udblac", 6, 0x00170, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A12[] = { {"Ufr", 3, 0x1D518, 0}, {"kappa", 5, 0x003BA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A14[] = { {"notindot", 8, 0x022F5, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A15[] = { {"nleq", 4, 0x02270, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A16[] = { {"NestedLessLess", 14, 0x0226A, 0}, {"square", 6, 0x025A1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A17[] = { {"nles", 4, 0x02A7D, 0x00338}, {"squarf", 6, 0x025AA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A21[] = { {"order", 5, 0x02134, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A23[] = { {"igrave", 6, 0x000EC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A24[] = { {"precneqq", 8, 0x02AB5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A25[] = { {"csupe", 5, 0x02AD2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A26[] = { {"xi", 2, 0x003BE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A28[] = { {"NotHumpEqual", 12, 0x0224F, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A2A[] = { {"ord", 3, 0x02A5D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A2D[] = { {"emacr", 5, 0x00113, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A30[] = { {"nwnear", 6, 0x02927, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A32[] = { {"nprcue", 6, 0x022E0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A36[] = { {"NotExists", 9, 0x02204, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A37[] = { {"die", 3, 0x000A8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A39[] = { {"ddotseq", 7, 0x02A77, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A3B[] = { {"Dashv", 5, 0x02AE4, 0}, {"Ucirc", 5, 0x000DB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A3C[] = { {"orv", 3, 0x02A5B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A3D[] = { {"Because", 7, 0x02235, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A41[] = { {"kgreen", 6, 0x00138, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A43[] = { {"Ffr", 3, 0x1D509, 0}, {"LeftVector", 10, 0x021BC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A44[] = { {"lstrok", 6, 0x00142, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A45[] = { {"twixt", 5, 0x0226C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A48[] = { {"compfn", 6, 0x02218, 0}, {"div", 3, 0x000F7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A4F[] = { {"drcrop", 6, 0x0230C, 0}, {"shortmid", 8, 0x02223, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A53[] = { {"iopf", 4, 0x1D55A, 0}, {"triangledown", 12, 0x025BF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A54[] = { {"IJlig", 5, 0x00132, 0}, {"thetasym", 8, 0x003D1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A56[] = { {"Sigma", 5, 0x003A3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A57[] = { {"equivDD", 7, 0x02A78, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A5A[] = { {"Cacute", 6, 0x00106, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A5B[] = { {"dashv", 5, 0x022A3, 0}, {"ucirc", 5, 0x000FB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A61[] = { {"gneqq", 5, 0x02269, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A62[] = { {"gvertneqq", 9, 0x02269, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A63[] = { {"RightDownVectorBar", 18, 0x02955, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A64[] = { {"NotLessLess", 11, 0x0226A, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A69[] = { {"Ccedil", 6, 0x000C7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A6A[] = { {"odblac", 6, 0x00151, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A6B[] = { {"mstpos", 6, 0x0223E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A6D[] = { {"cemptyv", 7, 0x029B2, 0}, {"rarrap", 6, 0x02975, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A6F[] = { {"rmoust", 6, 0x023B1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A70[] = { {"elsdot", 6, 0x02A97, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A76[] = { {"sigma", 5, 0x003C3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A78[] = { {"Implies", 7, 0x021D2, 0}, {"isin", 4, 0x02208, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A7A[] = { {"bottom", 6, 0x022A5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A7E[] = { {"ShortRightArrow", 15, 0x02192, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A81[] = { {"cupcap", 6, 0x02A46, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A82[] = { {"NotSquareSuperset", 17, 0x02290, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A84[] = { {"LeftArrowRightArrow", 19, 0x021C6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A85[] = { {"FilledVerySmallSquare", 21, 0x025AA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A86[] = { {"LeftUpTeeVector", 15, 0x02960, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A89[] = { {"DoubleRightArrow", 16, 0x021D2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A8D[] = { {"raquo", 5, 0x000BB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A8E[] = { {"Ascr", 4, 0x1D49C, 0}, {"ReverseUpEquilibrium", 20, 0x0296F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A92[] = { {"hArr", 4, 0x021D4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A94[] = { {"Jopf", 4, 0x1D541, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A96[] = { {"npar", 4, 0x02226, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A98[] = { {"SupersetEqual", 13, 0x02287, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A99[] = { {"ffllig", 6, 0x0FB04, 0}, {"smt", 3, 0x02AAA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A9A[] = { {"twoheadrightarrow", 17, 0x021A0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A9D[] = { {"ecaron", 6, 0x0011B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_A9F[] = { {"NotRightTriangleBar", 19, 0x029D0, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AA3[] = { {"apid", 4, 0x0224B, 0}, {"vscr", 4, 0x1D4CB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AA4[] = { {"supdot", 6, 0x02ABE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AA5[] = { {"colone", 6, 0x02254, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AA7[] = { {"dwangle", 7, 0x029A6, 0}, {"shchcy", 6, 0x00449, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AAC[] = { {"ltdot", 5, 0x022D6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AB2[] = { {"downharpoonright", 16, 0x021C2, 0}, {"gjcy", 4, 0x00453, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AB4[] = { {"wfr", 3, 0x1D534, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AB5[] = { {"rfisht", 6, 0x0297D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_ABA[] = { {"Ycy", 3, 0x0042B, 0}, {"swarrow", 7, 0x02199, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AC0[] = { {"nharr", 5, 0x021AE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AC4[] = { {"frac12", 6, 0x000BD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AC5[] = { {"frac13", 6, 0x02153, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AC6[] = { {"frac14", 6, 0x000BC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AC7[] = { {"GreaterEqual", 12, 0x02265, 0}, {"frac15", 6, 0x02155, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AC8[] = { {"Gamma", 5, 0x00393, 0}, {"frac16", 6, 0x02159, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_ACA[] = { {"dzigrarr", 8, 0x027FF, 0}, {"frac18", 6, 0x0215B, 0}, {"rcaron", 6, 0x00159, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_ACC[] = { {"DownRightTeeVector", 18, 0x0295F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_ACF[] = { {"nvrtrie", 7, 0x022B5, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AD2[] = { {"iota", 4, 0x003B9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AD3[] = { {"sol", 3, 0x0002F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AD4[] = { {"rbrace", 6, 0x0007D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_ADA[] = { {"rbrack", 6, 0x0005D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_ADD[] = { {"rsqb", 4, 0x0005D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_ADF[] = { {"oint", 4, 0x0222E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AE4[] = { {"Wscr", 4, 0x1D4B2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AE5[] = { {"hfr", 3, 0x1D525, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AE6[] = { {"frac23", 6, 0x02154, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AE7[] = { {"dlcorn", 6, 0x0231E, 0}, {"verbar", 6, 0x0007C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AE8[] = { {"frac25", 6, 0x02156, 0}, {"gamma", 5, 0x003B3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AE9[] = { {"nVDash", 6, 0x022AF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AEB[] = { {"Jcy", 3, 0x00419, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AF5[] = { {"nwarrow", 7, 0x02196, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AF6[] = { {"OverBar", 7, 0x0203E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AF7[] = { {"rightsquigarrow", 15, 0x0219D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AFA[] = { {"iexcl", 5, 0x000A1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AFD[] = { {"sqcap", 5, 0x02293, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_AFE[] = { {"pertenk", 7, 0x02031, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B08[] = { {"PrecedesEqual", 13, 0x02AAF, 0}, {"frac34", 6, 0x000BE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B09[] = { {"Therefore", 9, 0x02234, 0}, {"frac35", 6, 0x02157, 0}, {"nvDash", 6, 0x022AD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B0A[] = { {"odsold", 6, 0x029BC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B0C[] = { {"dot", 3, 0x002D9, 0}, {"frac38", 6, 0x0215C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B10[] = { {"sqcaps", 6, 0x02293, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B11[] = { {"ZeroWidthSpace", 14, 0x0200B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B15[] = { {"rarrfs", 6, 0x0291E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B16[] = { {"Yfr", 3, 0x1D51C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B1E[] = { {"CircleDot", 9, 0x02299, 0}, {"gtcir", 5, 0x02A7A, 0}, {"squ", 3, 0x025A1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B1F[] = { {"angmsd", 6, 0x02221, 0}, {"nsubseteq", 9, 0x02288, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B23[] = { {"iprod", 5, 0x02A3C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B24[] = { {"bprime", 6, 0x02035, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B27[] = { {"supsub", 6, 0x02AD4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B29[] = { {"SquareSupersetEqual", 19, 0x02292, 0}, {"therefore", 9, 0x02234, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B2A[] = { {"frac45", 6, 0x02158, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B2B[] = { {"Aopf", 4, 0x1D538, 0}, {"NotGreaterFullEqual", 19, 0x02267, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B2C[] = { {"Tstrok", 6, 0x00166, 0}, {"rightleftarrows", 15, 0x021C4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B2D[] = { {"Fouriertrf", 10, 0x02131, 0}, {"epar", 4, 0x022D5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B2E[] = { {"omid", 4, 0x029B6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B2F[] = { {"OpenCurlyDoubleQuote", 20, 0x0201C, 0}, {"dagger", 6, 0x02020, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B33[] = { {"semi", 4, 0x0003B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B35[] = { {"supsup", 6, 0x02AD6, 0}, {"zeetrf", 6, 0x02128, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B36[] = { {"DifferentialD", 13, 0x02146, 0}, {"topcir", 6, 0x02AF1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B3A[] = { {"mscr", 4, 0x1D4C2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B3D[] = { {"Wcirc", 5, 0x00174, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B3E[] = { {"boxdL", 5, 0x02555, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B40[] = { {"Gbreve", 6, 0x0011E, 0}, {"vopf", 4, 0x1D567, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B42[] = { {"lap", 3, 0x02A85, 0}, {"llarr", 5, 0x021C7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B44[] = { {"boxdR", 5, 0x02552, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B46[] = { {"RightAngleBracket", 17, 0x027E9, 0}, {"lat", 3, 0x02AAB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B47[] = { {"Jfr", 3, 0x1D50D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B4C[] = { {"frac56", 6, 0x0215A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B4E[] = { {"frac58", 6, 0x0215D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B4F[] = { {"rarrhk", 6, 0x021AA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B50[] = { {"lesdot", 6, 0x02A7F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B51[] = { {"ApplyFunction", 13, 0x02061, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B52[] = { {"NotGreaterTilde", 15, 0x02275, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B53[] = { {"Cedilla", 7, 0x000B8, 0}, {"curvearrowright", 15, 0x021B7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B56[] = { {"rdsh", 4, 0x021B3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B58[] = { {"larrb", 5, 0x021E4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B5C[] = { {"vrtri", 5, 0x022B3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B5D[] = { {"nequiv", 6, 0x02262, 0}, {"wcirc", 5, 0x00175, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B5E[] = { {"boxdl", 5, 0x02510, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B63[] = { {"DoubleDownArrow", 15, 0x021D3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B64[] = { {"boxdr", 5, 0x0250C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B67[] = { {"pluscir", 7, 0x02A22, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B69[] = { {"longmapsto", 10, 0x027FC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B6B[] = { {"gnap", 4, 0x02A8A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B6D[] = { {"bigodot", 7, 0x02A00, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B72[] = { {"thickapprox", 11, 0x02248, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B73[] = { {"DotDot", 6, 0x020DC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B77[] = { {"incare", 6, 0x02105, 0}, {"rarrbfs", 7, 0x02920, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B78[] = { {"apos", 4, 0x00027, 0}, {"tbrk", 4, 0x023B4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B7A[] = { {"grave", 5, 0x00060, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B7B[] = { {"Nscr", 4, 0x1D4A9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B7E[] = { {"rangle", 6, 0x027E9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B7F[] = { {"uArr", 4, 0x021D1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B81[] = { {"Wopf", 4, 0x1D54E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B82[] = { {"doteq", 5, 0x02250, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B87[] = { {"times", 5, 0x000D7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B8D[] = { {"fflig", 5, 0x0FB00, 0}, {"lcy", 3, 0x0043B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B8F[] = { {"sub", 3, 0x02282, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B90[] = { {"frac78", 6, 0x0215E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B94[] = { {"xrarr", 5, 0x027F6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B98[] = { {"UpArrowDownArrow", 16, 0x021C5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B99[] = { {"bbrktbrk", 8, 0x023B6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B9A[] = { {"abreve", 6, 0x00103, 0}, {"lsaquo", 6, 0x02039, 0}, {"sum", 3, 0x02211, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B9C[] = { {"Eacute", 6, 0x000C9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_B9D[] = { {"sup", 3, 0x02283, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BA5[] = { {"ContourIntegral", 15, 0x0222E, 0}, {"DiacriticalDot", 14, 0x002D9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BA9[] = { {"trisb", 5, 0x029CD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BAE[] = { {"Hcirc", 5, 0x00124, 0}, {"lceil", 5, 0x02308, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BB2[] = { {"Zcaron", 6, 0x0017D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BB5[] = { {"looparrowleft", 13, 0x021AB, 0}, {"oelig", 5, 0x00153, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BB6[] = { {"LessSlantEqual", 14, 0x02A7D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BB7[] = { {"NegativeThinSpace", 17, 0x0200B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BBA[] = { {"boxhD", 5, 0x02565, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BBC[] = { {"omicron", 7, 0x003BF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BBD[] = { {"leg", 3, 0x022DA, 0}, {"rightthreetimes", 15, 0x022CC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BBF[] = { {"NotSucceedsSlantEqual", 21, 0x022E1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BC1[] = { {"angmsdaa", 8, 0x029A8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BC2[] = { {"angmsdab", 8, 0x029A9, 0}, {"rAtail", 6, 0x0291C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BC3[] = { {"angmsdac", 8, 0x029AA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BC4[] = { {"angmsdad", 8, 0x029AB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BC5[] = { {"angmsdae", 8, 0x029AC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BC6[] = { {"angmsdaf", 8, 0x029AD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BC7[] = { {"angmsdag", 8, 0x029AE, 0}, {"leq", 3, 0x02264, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BC8[] = { {"angmsdah", 8, 0x029AF, 0}, {"solbar", 6, 0x0233F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BC9[] = { {"Racute", 6, 0x00154, 0}, {"les", 3, 0x02A7D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BCB[] = { {"boxhU", 5, 0x02568, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BCE[] = { {"hcirc", 5, 0x00125, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BD1[] = { {"dscr", 4, 0x1D4B9, 0}, {"smashp", 6, 0x02A33, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BD7[] = { {"mopf", 4, 0x1D55E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BD8[] = { {"Rcedil", 6, 0x00156, 0}, {"dscy", 4, 0x00455, 0}, {"prap", 4, 0x02AB7, 0}, {"rarrlp", 6, 0x021AC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BD9[] = { {"Aogon", 5, 0x00104, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BDA[] = { {"boxhd", 5, 0x0252C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BDB[] = { {"subset", 6, 0x02282, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BDD[] = { {"lgE", 3, 0x02A91, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BDF[] = { {"epsilon", 7, 0x003B5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BE1[] = { {"curarrm", 7, 0x0293C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BE2[] = { {"ratail", 6, 0x0291A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BE4[] = { {"DoubleLongLeftRightArrow", 24, 0x027FA, 0}, {"rhov", 4, 0x003F1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BE7[] = { {"LeftDoubleBracket", 17, 0x027E6, 0}, {"Lleftarrow", 10, 0x021DA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BE8[] = { {"Uuml", 4, 0x000DC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BE9[] = { {"lfr", 3, 0x1D529, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BEA[] = { {"minusdu", 7, 0x02A2A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BEB[] = { {"boxhu", 5, 0x02534, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BEF[] = { {"Ncy", 3, 0x0041D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BF0[] = { {"gneq", 4, 0x02A88, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BF1[] = { {"rangd", 5, 0x02992, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BF2[] = { {"range", 5, 0x029A5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BF3[] = { {"lfloor", 6, 0x0230A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BF7[] = { {"NotSucceedsTilde", 16, 0x0227F, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BF9[] = { {"aogon", 5, 0x00105, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BFA[] = { {"NotGreaterSlantEqual", 20, 0x02A7E, 0x00338}, {"NotSquareSupersetEqual", 22, 0x022E3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_BFC[] = { {"profsurf", 8, 0x02313, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C02[] = { {"wedgeq", 6, 0x02259, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C0B[] = { {"Alpha", 5, 0x00391, 0}, {"DiacriticalDoubleAcute", 22, 0x002DD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C0C[] = { {"lltri", 5, 0x025FA, 0}, {"tcaron", 6, 0x00165, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C11[] = { {"Imacr", 5, 0x0012A, 0}, {"subseteq", 8, 0x02286, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C12[] = { {"Escr", 4, 0x02130, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C16[] = { {"lArr", 4, 0x021D0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C18[] = { {"Nopf", 4, 0x02115, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C1A[] = { {"rpar", 4, 0x00029, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C1D[] = { {"divonx", 6, 0x022C7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C1E[] = { {"olcir", 5, 0x029BE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C23[] = { {"lacute", 6, 0x0013A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C27[] = { {"zscr", 4, 0x1D4CF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C2B[] = { {"alpha", 5, 0x003B1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C31[] = { {"imacr", 5, 0x0012B, 0}, {"vellip", 6, 0x022EE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C32[] = { {"lcedil", 6, 0x0013C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C33[] = { {"sime", 4, 0x02243, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C34[] = { {"empty", 5, 0x02205, 0}, {"imped", 5, 0x001B5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C35[] = { {"simg", 4, 0x02A9E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C36[] = { {"kjcy", 4, 0x0045C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C3A[] = { {"siml", 4, 0x02A9D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C3E[] = { {"LessEqualGreater", 16, 0x022DA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C3F[] = { {"Ycirc", 5, 0x00176, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C40[] = { {"RoundImplies", 12, 0x02970, 0}, {"nvrArr", 6, 0x02903, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C43[] = { {"check", 5, 0x02713, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C44[] = { {"nlarr", 5, 0x0219A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C46[] = { {"middot", 6, 0x000B7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C48[] = { {"par", 3, 0x02225, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C4A[] = { {"NotGreaterGreater", 17, 0x0226B, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C4B[] = { {"Nfr", 3, 0x1D511, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C4F[] = { {"nwArr", 5, 0x021D6, 0}, {"prec", 4, 0x0227A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C50[] = { {"Barv", 4, 0x02AE7, 0}, {"yacute", 6, 0x000FD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C54[] = { {"DoubleLeftRightArrow", 20, 0x021D4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C58[] = { {"Coproduct", 9, 0x02210, 0}, {"rarrpl", 6, 0x02945, 0}, {"subsim", 6, 0x02AC7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C5A[] = { {"ntgl", 4, 0x02279, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C5B[] = { {"LeftTriangleBar", 15, 0x029CF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C5F[] = { {"ycirc", 5, 0x00177, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C69[] = { {"doteqdot", 8, 0x02251, 0}, {"nang", 4, 0x02220, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C6B[] = { {"bigcap", 6, 0x022C2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C6C[] = { {"CHcy", 4, 0x00427, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C6E[] = { {"dopf", 4, 0x1D555, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C72[] = { {"inodot", 6, 0x00131, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C76[] = { {"nvHarr", 6, 0x02904, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C77[] = { {"laemptyv", 8, 0x029B4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C78[] = { {"bigcirc", 7, 0x025EF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C7A[] = { {"scnap", 5, 0x02ABA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C7B[] = { {"DownLeftVector", 14, 0x021BD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C80[] = { {"race", 4, 0x0223D, 0x00331}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C82[] = { {"vartriangleright", 16, 0x022B3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C89[] = { {"napE", 4, 0x02A70, 0x00338}, {"supedot", 7, 0x02AC4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C8E[] = { {"acE", 3, 0x0223E, 0x00333}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C91[] = { {"pcy", 3, 0x0043F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C93[] = { {"qprime", 6, 0x02057, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C94[] = { {"RightTeeVector", 14, 0x0295B, 0}, {"curlyvee", 8, 0x022CE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C95[] = { {"swarhk", 6, 0x02926, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_C98[] = { {"Atilde", 6, 0x000C3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CA6[] = { {"bbrk", 4, 0x023B5, 0}, {"prnap", 5, 0x02AB9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CA8[] = { {"image", 5, 0x02111, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CA9[] = { {"sext", 4, 0x02736, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CAA[] = { {"ldquo", 5, 0x0201C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CAC[] = { {"NotLeftTriangleBar", 18, 0x029CF, 0x00338}, {"epsiv", 5, 0x003F5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CAD[] = { {"CenterDot", 9, 0x000B7, 0}, {"acd", 3, 0x0223F, 0}, {"upuparrows", 10, 0x021C8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CAF[] = { {"Eopf", 4, 0x1D53C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CB0[] = { {"Jcirc", 5, 0x00134, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CB2[] = { {"smid", 4, 0x02223, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CB4[] = { {"bull", 4, 0x02022, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CB6[] = { {"rhard", 5, 0x021C1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CB7[] = { {"nsupset", 7, 0x02283, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CBA[] = { {"npre", 4, 0x02AAF, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CBE[] = { {"qscr", 4, 0x1D4C6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CC2[] = { {"acy", 3, 0x00430, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CC4[] = { {"lnE", 3, 0x02268, 0}, {"zopf", 4, 0x1D56B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CC5[] = { {"Ntilde", 6, 0x000D1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CC7[] = { {"rharu", 5, 0x021C0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CC8[] = { {"kappav", 6, 0x003F0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CC9[] = { {"timesb", 6, 0x022A0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CCB[] = { {"iiiint", 6, 0x02A0C, 0}, {"timesd", 6, 0x02A30, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CD0[] = { {"jcirc", 5, 0x00135, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CD2[] = { {"nsimeq", 6, 0x02244, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CD3[] = { {"Esim", 4, 0x02A73, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CD9[] = { {"Cap", 3, 0x022D2, 0}, {"bump", 4, 0x0224E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CDA[] = { {"lvnE", 4, 0x02268, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CDC[] = { {"rarrtl", 6, 0x021A3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CE4[] = { {"lne", 3, 0x02A87, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CE6[] = { {"commat", 6, 0x00040, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CE8[] = { {"hslash", 6, 0x0210F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CE9[] = { {"lthree", 6, 0x022CB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CED[] = { {"Gcedil", 6, 0x00122, 0}, {"pfr", 3, 0x1D52D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CF1[] = { {"RightTriangleEqual", 18, 0x022B5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CF2[] = { {"ngeqslant", 9, 0x02A7E, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CF3[] = { {"Rcy", 3, 0x00420, 0}, {"gimel", 5, 0x02137, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CF4[] = { {"curarr", 6, 0x021B7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CFA[] = { {"ntlg", 4, 0x02278, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_CFF[] = { {"Rscr", 4, 0x0211B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D00[] = { {"urcrop", 6, 0x0230E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D06[] = { {"Poincareplane", 13, 0x0210C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D07[] = { {"NoBreak", 7, 0x02060, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D0B[] = { {"lcub", 4, 0x0007B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D0E[] = { {"nltri", 5, 0x022EA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D10[] = { {"blacktriangledown", 17, 0x025BE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D11[] = { {"fjlig", 5, 0x00066, 0x0006A}, {"percnt", 6, 0x00025, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D12[] = { {"rightharpoondown", 16, 0x021C1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D13[] = { {"LeftAngleBracket", 16, 0x027E8, 0}, {"npreceq", 7, 0x02AAF, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D15[] = { {"cupcup", 6, 0x02A4A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D18[] = { {"LeftVectorBar", 13, 0x02952, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D19[] = { {"NJcy", 4, 0x0040A, 0}, {"triangleright", 13, 0x025B9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D1A[] = { {"Tcedil", 6, 0x00162, 0}, {"loz", 3, 0x025CA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D1E[] = { {"afr", 3, 0x1D51E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D1F[] = { {"NotLessTilde", 12, 0x02274, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D20[] = { {"NotElement", 10, 0x02209, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D22[] = { {"NotHumpDownHump", 15, 0x0224E, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D24[] = { {"SquareSubsetEqual", 17, 0x02291, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D26[] = { {"nleqq", 5, 0x02266, 0x00338}, {"phi", 3, 0x003C6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D2A[] = { {"NotRightTriangle", 16, 0x022EB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D32[] = { {"lhblk", 5, 0x02584, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D34[] = { {"caret", 5, 0x02041, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D35[] = { {"bsemi", 5, 0x0204F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D38[] = { {"aacute", 6, 0x000E1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D39[] = { {"mapsto", 6, 0x021A6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D3A[] = { {"Congruent", 9, 0x02261, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D3B[] = { {"Vdash", 5, 0x022A9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D3E[] = { {"longrightarrow", 14, 0x027F6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D42[] = { {"iinfin", 6, 0x029DC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D44[] = { {"EmptyVerySmallSquare", 20, 0x025AB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D49[] = { {"real", 4, 0x0211C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D4C[] = { {"SucceedsEqual", 13, 0x02AB0, 0}, {"utilde", 6, 0x00169, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D4F[] = { {"Rfr", 3, 0x0211C, 0}, {"tau", 3, 0x003C4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D51[] = { {"Wedge", 5, 0x022C0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D54[] = { {"piv", 3, 0x003D6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D55[] = { {"hscr", 4, 0x1D4BD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D56[] = { {"subdot", 6, 0x02ABD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D57[] = { {"dsol", 4, 0x029F6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D5A[] = { {"prnE", 4, 0x02AB5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D5B[] = { {"qopf", 4, 0x1D562, 0}, {"vdash", 5, 0x022A2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D5F[] = { {"Star", 4, 0x022C6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D63[] = { {"sqsupseteq", 10, 0x02292, 0}, {"zhcy", 4, 0x00436, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D65[] = { {"nacute", 6, 0x00144, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D69[] = { {"lessgtr", 7, 0x02276, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D6A[] = { {"nless", 5, 0x0226E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D6C[] = { {"RightTeeArrow", 13, 0x021A6, 0}, {"Yuml", 4, 0x00178, 0}, {"target", 6, 0x02316, 0}, {"upharpoonleft", 13, 0x021BF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D6F[] = { {"between", 7, 0x0226C, 0}, {"boxuL", 5, 0x0255B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D70[] = { {"TSHcy", 5, 0x0040B, 0}, {"lrm", 3, 0x0200E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D71[] = { {"excl", 4, 0x00021, 0}, {"hyphen", 6, 0x02010, 0}, {"mlcp", 4, 0x02ADB, 0}, {"wedge", 5, 0x02227, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D74[] = { {"ncedil", 6, 0x00146, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D75[] = { {"boxuR", 5, 0x02558, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D76[] = { {"Not", 3, 0x02AEC, 0}, {"epsi", 4, 0x003B5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D7C[] = { {"disin", 5, 0x022F2, 0}, {"nRightarrow", 11, 0x021CF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D7D[] = { {"cylcty", 6, 0x0232D, 0}, {"neArr", 5, 0x021D7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D7E[] = { {"prnsim", 6, 0x022E8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D80[] = { {"Cfr", 3, 0x0212D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D81[] = { {"Beta", 4, 0x00392, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D85[] = { {"leftarrowtail", 13, 0x021A2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D87[] = { {"parsl", 5, 0x02AFD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D89[] = { {"xwedge", 6, 0x022C0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D8A[] = { {"olcross", 7, 0x029BB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D8C[] = { {"boxvH", 5, 0x0256A, 0}, {"lsh", 3, 0x021B0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D8D[] = { {"circledR", 8, 0x000AE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D8E[] = { {"Rho", 3, 0x003A1, 0}, {"circledS", 8, 0x024C8, 0}, {"cupor", 5, 0x02A45, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D8F[] = { {"Ugrave", 6, 0x000D9, 0}, {"boxul", 5, 0x02518, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D90[] = { {"boxvL", 5, 0x02561, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D91[] = { {"sqcup", 5, 0x02294, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D93[] = { {"rect", 4, 0x025AD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D94[] = { {"mldr", 4, 0x02026, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D95[] = { {"boxur", 5, 0x02514, 0}, {"digamma", 7, 0x003DD, 0}, {"tcy", 3, 0x00442, 0}, {"urcorner", 8, 0x0231D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D96[] = { {"DoubleLeftArrow", 15, 0x021D0, 0}, {"Iscr", 4, 0x02110, 0}, {"boxvR", 5, 0x0255E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D98[] = { {"ulcorn", 6, 0x0231C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D9A[] = { {"prod", 4, 0x0220F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_D9C[] = { {"Ropf", 4, 0x0211D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DA0[] = { {"rmoustache", 10, 0x023B1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DA5[] = { {"NegativeMediumSpace", 19, 0x0200B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DA6[] = { {"prop", 4, 0x0221D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DA8[] = { {"TScy", 4, 0x00426, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DA9[] = { {"xsqcup", 6, 0x02A06, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DAC[] = { {"bemptyv", 7, 0x029B0, 0}, {"boxvh", 5, 0x0253C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DB0[] = { {"boxvl", 5, 0x02524, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DB3[] = { {"NotTildeFullEqual", 17, 0x02247, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DB4[] = { {"subE", 4, 0x02AC5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DB6[] = { {"boxvr", 5, 0x0251C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DB7[] = { {"bigvee", 6, 0x022C1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DB9[] = { {"Chi", 3, 0x003A7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DBC[] = { {"circeq", 6, 0x02257, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DBE[] = { {"emsp13", 6, 0x02004, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DBF[] = { {"emsp14", 6, 0x02005, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DC2[] = { {"ouml", 4, 0x000F6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DC3[] = { {"RightArrowBar", 13, 0x021E5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DC6[] = { {"ecy", 3, 0x0044D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DC8[] = { {"succneqq", 8, 0x02AB6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DCA[] = { {"npart", 5, 0x02202, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DCF[] = { {"Element", 7, 0x02208, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DD1[] = { {"Edot", 4, 0x00116, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DD3[] = { {"RightUpDownVector", 17, 0x0294F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DD4[] = { {"sube", 4, 0x02286, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DD5[] = { {"jsercy", 6, 0x00458, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DD7[] = { {"varrho", 6, 0x003F1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DD9[] = { {"subsub", 6, 0x02AD5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DDC[] = { {"Dcaron", 6, 0x0010E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DDD[] = { {"Eogon", 5, 0x00118, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DE4[] = { {"geqslant", 8, 0x02A7E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DE6[] = { {"rdldhar", 7, 0x02969, 0}, {"zdot", 4, 0x0017C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DE7[] = { {"subsup", 6, 0x02AD3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DE9[] = { {"ograve", 6, 0x000F2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DEB[] = { {"ReverseElement", 14, 0x0220B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DED[] = { {"drcorn", 6, 0x0231F, 0}, {"rang", 4, 0x027E9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DF1[] = { {"tfr", 3, 0x1D531, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DF2[] = { {"hopf", 4, 0x1D559, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DF3[] = { {"succ", 4, 0x0227B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DF6[] = { {"otimes", 6, 0x02297, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DF7[] = { {"Vcy", 3, 0x00412, 0}, {"ltquest", 7, 0x02A7B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DF9[] = { {"lozenge", 7, 0x025CA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DFB[] = { {"LeftDownVector", 14, 0x021C3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_DFD[] = { {"eogon", 5, 0x00119, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E03[] = { {"amp", 3, 0x00026, 0}, {"lopar", 5, 0x02985, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E04[] = { {"loplus", 6, 0x02A2D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E08[] = { {"NotTilde", 8, 0x02241, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E09[] = { {"CounterClockwiseContourIntegral", 31, 0x02233, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E0C[] = { {"InvisibleTimes", 14, 0x02062, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E11[] = { {"lesdotor", 8, 0x02A83, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E18[] = { {"and", 3, 0x02227, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E1B[] = { {"RightUpVector", 13, 0x021BE, 0}, {"ang", 3, 0x02220, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E1C[] = { {"DoubleRightTee", 14, 0x022A8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E1D[] = { {"LeftUpVectorBar", 15, 0x02958, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E1E[] = { {"smte", 4, 0x02AAC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E20[] = { {"Iacute", 6, 0x000CD, 0}, {"triminus", 8, 0x02A3A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E22[] = { {"efr", 3, 0x1D522, 0}, {"iiint", 5, 0x0222D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E23[] = { {"ctdot", 5, 0x022EF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E24[] = { {"mnplus", 6, 0x02213, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E25[] = { {"Vee", 3, 0x022C1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E28[] = { {"Gcy", 3, 0x00413, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E2A[] = { {"lurdshar", 8, 0x0294A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E2C[] = { {"smeparsl", 8, 0x029E4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E2F[] = { {"DoubleVerticalBar", 17, 0x02225, 0}, {"iecy", 4, 0x00435, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E30[] = { {"udblac", 6, 0x00171, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E32[] = { {"gtquest", 7, 0x02A7C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E33[] = { {"Iopf", 4, 0x1D540, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E35[] = { {"bsime", 5, 0x022CD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E36[] = { {"RightVector", 11, 0x021C0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E37[] = { {"NotGreaterLess", 14, 0x02279, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E3B[] = { {"apE", 3, 0x02A70, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E41[] = { {"CupCap", 6, 0x0224D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E42[] = { {"uscr", 4, 0x1D4CA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E43[] = { {"erDot", 5, 0x02253, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E44[] = { {"egs", 3, 0x02A96, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E48[] = { {"rlarr", 5, 0x021C4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E4C[] = { {"prE", 3, 0x02AB3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E4E[] = { {"QUOT", 4, 0x00022, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E53[] = { {"Vfr", 3, 0x1D519, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E55[] = { {"cupbrcap", 8, 0x02A48, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E57[] = { {"intercal", 8, 0x022BA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E58[] = { {"imath", 5, 0x00131, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E59[] = { {"RightUpTeeVector", 16, 0x0295C, 0}, {"trie", 4, 0x0225C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E5B[] = { {"ape", 3, 0x0224A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E5D[] = { {"softcy", 6, 0x0044C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E5E[] = { {"rarrb", 5, 0x021E5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E5F[] = { {"FilledSmallSquare", 17, 0x025FC, 0}, {"rarrc", 5, 0x02933, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E60[] = { {"Superset", 8, 0x02283, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E61[] = { {"hoarr", 5, 0x021FF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E63[] = { {"DownRightVectorBar", 18, 0x02957, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E64[] = { {"brvbar", 6, 0x000A6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E65[] = { {"ecolon", 6, 0x02255, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E66[] = { {"GreaterLess", 11, 0x02277, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E6A[] = { {"nrArr", 5, 0x021CF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E6C[] = { {"pre", 3, 0x02AAF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E6F[] = { {"aleph", 5, 0x02135, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E70[] = { {"DiacriticalAcute", 16, 0x000B4, 0}, {"SmallCircle", 11, 0x02218, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E71[] = { {"parsim", 6, 0x02AF3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E73[] = { {"rarrw", 5, 0x0219D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E78[] = { {"caron", 5, 0x002C7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E7A[] = { {"cacute", 6, 0x00107, 0}, {"lagran", 6, 0x02112, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E7C[] = { {"rarr", 4, 0x02192, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E80[] = { {"Rrightarrow", 11, 0x021DB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E83[] = { {"Vscr", 4, 0x1D4B1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E84[] = { {"Gfr", 3, 0x1D50A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E89[] = { {"ccedil", 6, 0x000E7, 0}, {"propto", 6, 0x0221D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E8E[] = { {"zwnj", 4, 0x0200C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E91[] = { {"psi", 3, 0x003C8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E99[] = { {"infin", 5, 0x0221E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_E9C[] = { {"circledcirc", 11, 0x0229A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EA1[] = { {"Proportion", 10, 0x02237, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EA2[] = { {"subseteqq", 9, 0x02AC5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EA4[] = { {"nGtv", 4, 0x0226B, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EA8[] = { {"macr", 4, 0x000AF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EA9[] = { {"orslope", 7, 0x02A57, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EB1[] = { {"frown", 5, 0x02322, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EB2[] = { {"Iota", 4, 0x00399, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EB4[] = { {"rceil", 5, 0x02309, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EB7[] = { {"spadesuit", 9, 0x02660, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EB8[] = { {"sstarf", 6, 0x022C6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_ECA[] = { {"icy", 3, 0x00438, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_ECD[] = { {"ast", 3, 0x0002A, 0}, {"nmid", 4, 0x02224, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_ECF[] = { {"bowtie", 6, 0x022C8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_ED1[] = { {"thetav", 6, 0x003D1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_ED7[] = { {"vangrt", 6, 0x0299C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_ED8[] = { {"numsp", 5, 0x02007, 0}, {"triplus", 7, 0x02A39, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_ED9[] = { {"lscr", 4, 0x1D4C1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EDA[] = { {"pointint", 8, 0x02A15, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EDB[] = { {"Theta", 5, 0x00398, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EDF[] = { {"rightrightarrows", 16, 0x021C9, 0}, {"uopf", 4, 0x1D566, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EE2[] = { {"ell", 3, 0x02113, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EE4[] = { {"cuepr", 5, 0x022DE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EE5[] = { {"NotVerticalBar", 14, 0x02224, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EE7[] = { {"xnis", 4, 0x022FB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EE9[] = { {"els", 3, 0x02A95, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EEF[] = { {"DDotrahd", 8, 0x02911, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EF1[] = { {"larrbfs", 7, 0x0291F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EF2[] = { {"Rsh", 3, 0x021B1, 0}, {"boxplus", 7, 0x0229E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EF4[] = { {"swarr", 5, 0x02199, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EF5[] = { {"gvnE", 4, 0x02269, 0x0FE00}, {"xfr", 3, 0x1D535, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EF9[] = { {"ldca", 4, 0x02936, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EFB[] = { {"NotPrecedesSlantEqual", 21, 0x022E0, 0}, {"YAcy", 4, 0x0042F, 0}, {"Zcy", 3, 0x00417, 0}, {"andslope", 8, 0x02A58, 0}, {"numero", 6, 0x02116, 0}, {"theta", 5, 0x003B8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EFE[] = { {"mapstoup", 8, 0x021A5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_EFF[] = { {"bigcup", 6, 0x022C3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F03[] = { {"nesear", 6, 0x02928, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F05[] = { {"lesssim", 7, 0x02272, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F08[] = { {"DownArrow", 9, 0x02193, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F0B[] = { {"orarr", 5, 0x021BB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F0F[] = { {"ccaps", 5, 0x02A4D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F10[] = { {"xdtri", 5, 0x025BD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F11[] = { {"xcap", 4, 0x022C2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F13[] = { {"downdownarrows", 14, 0x021CA, 0}, {"nisd", 4, 0x022FA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F14[] = { {"VerticalBar", 11, 0x02223, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F15[] = { {"TRADE", 5, 0x02122, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F17[] = { {"Omacr", 5, 0x0014C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F18[] = { {"top", 3, 0x022A4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F19[] = { {"LeftRightArrow", 14, 0x02194, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F1A[] = { {"Mscr", 4, 0x02133, 0}, {"iff", 3, 0x021D4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F1F[] = { {"downharpoonleft", 15, 0x021C3, 0}, {"eng", 3, 0x0014B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F20[] = { {"Vopf", 4, 0x1D54D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F26[] = { {"ifr", 3, 0x1D526, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F28[] = { {"Downarrow", 9, 0x021D3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F2C[] = { {"Kcy", 3, 0x0041A, 0}, {"angle", 5, 0x02220, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F2F[] = { {"lescc", 5, 0x02AA8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F30[] = { {"lesseqqgtr", 10, 0x02A8B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F31[] = { {"bigstar", 7, 0x02605, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F33[] = { {"ddagger", 7, 0x02021, 0}, {"nltrie", 6, 0x022EC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F37[] = { {"omacr", 5, 0x0014D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F38[] = { {"cuesc", 5, 0x022DF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F40[] = { {"circlearrowright", 16, 0x021BB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F41[] = { {"ngeqq", 5, 0x02267, 0x00338}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F44[] = { {"squf", 4, 0x025AA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F46[] = { {"rtri", 4, 0x025B9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F47[] = { {"VerticalLine", 12, 0x0007C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F48[] = { {"downarrow", 9, 0x02193, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F4B[] = { {"Scaron", 6, 0x00160, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F4C[] = { {"tstrok", 6, 0x00167, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F50[] = { {"wreath", 6, 0x02240, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F51[] = { {"exponentiale", 12, 0x02147, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F55[] = { {"Idot", 4, 0x00130, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F57[] = { {"Zfr", 3, 0x02128, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F58[] = { {"bnot", 4, 0x02310, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F5B[] = { {"infintie", 8, 0x029DD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F5D[] = { {"angrtvbd", 8, 0x0299D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F5F[] = { {"prurel", 6, 0x022B0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F60[] = { {"gbreve", 6, 0x0011F, 0}, {"rsaquo", 6, 0x0203A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F62[] = { {"sung", 4, 0x0266A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F67[] = { {"lvertneqq", 9, 0x02268, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F68[] = { {"lnsim", 5, 0x022E6, 0}, {"searrow", 7, 0x02198, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F69[] = { {"nsubset", 7, 0x02282, 0x020D2}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F6D[] = { {"Cup", 3, 0x022D3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F6E[] = { {"Lmidot", 6, 0x0013F, 0}, {"sup1", 4, 0x000B9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F6F[] = { {"Delta", 5, 0x00394, 0}, {"sbquo", 5, 0x0201A, 0}, {"sup2", 4, 0x000B2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F70[] = { {"cscr", 4, 0x1D4B8, 0}, {"nsubseteqq", 10, 0x02AC5, 0x00338}, {"sup3", 4, 0x000B3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F71[] = { {"Kcedil", 6, 0x00136, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F72[] = { {"plussim", 7, 0x02A26, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F74[] = { {"KHcy", 4, 0x00425, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F75[] = { {"OElig", 5, 0x00152, 0}, {"simdot", 6, 0x02A6A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F76[] = { {"lopf", 4, 0x1D55D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F77[] = { {"boxbox", 6, 0x029C9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F78[] = { {"bepsi", 5, 0x003F6, 0}, {"lbarr", 5, 0x0290C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F79[] = { {"lnapprox", 8, 0x02A89, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F81[] = { {"sdotb", 5, 0x022A1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F82[] = { {"measuredangle", 13, 0x02221, 0}, {"supE", 4, 0x02AC6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F83[] = { {"map", 3, 0x021A6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F84[] = { {"sdote", 5, 0x02A66, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F86[] = { {"diamondsuit", 11, 0x02666, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F88[] = { {"Kfr", 3, 0x1D50E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F8B[] = { {"imagline", 8, 0x02110, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F8F[] = { {"delta", 5, 0x003B4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F91[] = { {"mapstodown", 10, 0x021A7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F93[] = { {"eqvparsl", 8, 0x029E5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F95[] = { {"UpArrow", 7, 0x02191, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F9A[] = { {"imagpart", 8, 0x02111, 0}, {"lsim", 4, 0x02272, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F9C[] = { {"trianglelefteq", 14, 0x022B4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_F9F[] = { {"isindot", 7, 0x022F5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FA0[] = { {"LeftUpDownVector", 16, 0x02951, 0}, {"curvearrowleft", 14, 0x021B6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FA1[] = { {"Diamond", 7, 0x022C4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FA2[] = { {"supe", 4, 0x02287, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FA3[] = { {"nearrow", 7, 0x02197, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FA9[] = { {"easter", 6, 0x02A6E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FB0[] = { {"rdquo", 5, 0x0201D, 0}, {"subsetneqq", 10, 0x02ACB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FB1[] = { {"Dscr", 4, 0x1D49F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FB4[] = { {"comp", 4, 0x02201, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FB5[] = { {"Uparrow", 7, 0x021D1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FB6[] = { {"coloneq", 7, 0x02254, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FB7[] = { {"Mopf", 4, 0x1D544, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FB9[] = { {"rfloor", 6, 0x0230B, 0}, {"varsubsetneqq", 13, 0x02ACB, 0x0FE00}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FBC[] = { {"eacute", 6, 0x000E9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FC2[] = { {"shortparallel", 13, 0x02225, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FC4[] = { {"male", 4, 0x02642, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FC6[] = { {"yscr", 4, 0x1D4CE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FCA[] = { {"xharr", 5, 0x027F7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FCC[] = { {"cong", 4, 0x02245, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FCE[] = { {"mcy", 3, 0x0043C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FCF[] = { {"Upsilon", 7, 0x003A5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FD0[] = { {"block", 5, 0x02588, 0}, {"maltese", 7, 0x02720, 0}, {"ordf", 4, 0x000AA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FD2[] = { {"zcaron", 6, 0x0017E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FD3[] = { {"malt", 4, 0x02720, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FD6[] = { {"loang", 5, 0x027EC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FD7[] = { {"ordm", 4, 0x000BA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FDD[] = { {"NegativeVeryThinSpace", 21, 0x0200B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FDF[] = { {"eta", 3, 0x003B7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FE1[] = { {"Iogon", 5, 0x0012E, 0}, {"drbkarow", 8, 0x02910, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FE6[] = { {"eth", 3, 0x000F0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FE9[] = { {"racute", 6, 0x00155, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FEA[] = { {"cwconint", 8, 0x02232, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FEB[] = { {"egsdot", 6, 0x02A98, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FF5[] = { {"MinusPlus", 9, 0x02213, 0}, {"ring", 4, 0x002DA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FF8[] = { {"rcedil", 6, 0x00157, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FFC[] = { {"timesbar", 8, 0x02A31, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html5_FFE[] = { {"GreaterEqualLess", 16, 0x022DB, 0}, {NULL, 0, 0, 0} }; + +static const entity_cp_map *const ht_buckets_html5[] = { + ht_bucket_html5_000, ht_bucket_html5_001, ht_bucket_empty, ht_bucket_html5_003, + ht_bucket_empty, ht_bucket_html5_005, ht_bucket_empty, ht_bucket_html5_007, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_00D, ht_bucket_empty, ht_bucket_html5_00F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_017, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_020, ht_bucket_empty, ht_bucket_html5_022, ht_bucket_empty, + ht_bucket_html5_024, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_027, + ht_bucket_html5_028, ht_bucket_html5_029, ht_bucket_html5_02A, ht_bucket_html5_02B, + ht_bucket_html5_02C, ht_bucket_empty, ht_bucket_html5_02E, ht_bucket_empty, + ht_bucket_html5_030, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_034, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_038, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_040, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_047, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_04C, ht_bucket_empty, ht_bucket_html5_04E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_051, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_059, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_05D, ht_bucket_empty, ht_bucket_html5_05F, + ht_bucket_html5_060, ht_bucket_html5_061, ht_bucket_empty, ht_bucket_html5_063, + ht_bucket_html5_064, ht_bucket_html5_065, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_069, ht_bucket_html5_06A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_06D, ht_bucket_html5_06E, ht_bucket_html5_06F, + ht_bucket_empty, ht_bucket_html5_071, ht_bucket_empty, ht_bucket_html5_073, + ht_bucket_html5_074, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_07A, ht_bucket_html5_07B, + ht_bucket_html5_07C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_07F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_082, ht_bucket_empty, + ht_bucket_html5_084, ht_bucket_html5_085, ht_bucket_html5_086, ht_bucket_empty, + ht_bucket_html5_088, ht_bucket_html5_089, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_08C, ht_bucket_empty, ht_bucket_html5_08E, ht_bucket_empty, + ht_bucket_html5_090, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_094, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_097, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_09E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_0A4, ht_bucket_empty, ht_bucket_html5_0A6, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_0AB, + ht_bucket_html5_0AC, ht_bucket_html5_0AD, ht_bucket_html5_0AE, ht_bucket_html5_0AF, + ht_bucket_html5_0B0, ht_bucket_empty, ht_bucket_html5_0B2, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_0B8, ht_bucket_html5_0B9, ht_bucket_html5_0BA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_0C0, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_0C4, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_0CE, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_0D1, ht_bucket_html5_0D2, ht_bucket_html5_0D3, + ht_bucket_empty, ht_bucket_html5_0D5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_0DF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_0E5, ht_bucket_html5_0E6, ht_bucket_empty, + ht_bucket_html5_0E8, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_0EC, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_0EF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_0F3, + ht_bucket_html5_0F4, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_0FA, ht_bucket_html5_0FB, + ht_bucket_empty, ht_bucket_html5_0FD, ht_bucket_html5_0FE, ht_bucket_empty, + ht_bucket_html5_100, ht_bucket_html5_101, ht_bucket_empty, ht_bucket_html5_103, + ht_bucket_empty, ht_bucket_html5_105, ht_bucket_html5_106, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_109, ht_bucket_html5_10A, ht_bucket_html5_10B, + ht_bucket_empty, ht_bucket_html5_10D, ht_bucket_html5_10E, ht_bucket_html5_10F, + ht_bucket_html5_110, ht_bucket_html5_111, ht_bucket_empty, ht_bucket_html5_113, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_116, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_11B, + ht_bucket_html5_11C, ht_bucket_empty, ht_bucket_html5_11E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_121, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_124, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_129, ht_bucket_html5_12A, ht_bucket_empty, + ht_bucket_html5_12C, ht_bucket_empty, ht_bucket_html5_12E, ht_bucket_html5_12F, + ht_bucket_html5_130, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_134, ht_bucket_html5_135, ht_bucket_empty, ht_bucket_html5_137, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_13A, ht_bucket_html5_13B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_145, ht_bucket_empty, ht_bucket_html5_147, + ht_bucket_empty, ht_bucket_html5_149, ht_bucket_empty, ht_bucket_html5_14B, + ht_bucket_html5_14C, ht_bucket_empty, ht_bucket_html5_14E, ht_bucket_html5_14F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_158, ht_bucket_html5_159, ht_bucket_empty, ht_bucket_html5_15B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_15E, ht_bucket_html5_15F, + ht_bucket_empty, ht_bucket_html5_161, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_164, ht_bucket_html5_165, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_168, ht_bucket_empty, ht_bucket_html5_16A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_170, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_173, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_17A, ht_bucket_html5_17B, + ht_bucket_html5_17C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_17F, + ht_bucket_empty, ht_bucket_html5_181, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_189, ht_bucket_empty, ht_bucket_html5_18B, + ht_bucket_html5_18C, ht_bucket_empty, ht_bucket_html5_18E, ht_bucket_html5_18F, + ht_bucket_html5_190, ht_bucket_html5_191, ht_bucket_empty, ht_bucket_html5_193, + ht_bucket_empty, ht_bucket_html5_195, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_19A, ht_bucket_empty, + ht_bucket_html5_19C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_19F, + ht_bucket_html5_1A0, ht_bucket_html5_1A1, ht_bucket_html5_1A2, ht_bucket_html5_1A3, + ht_bucket_html5_1A4, ht_bucket_html5_1A5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_1A8, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_1AB, + ht_bucket_html5_1AC, ht_bucket_html5_1AD, ht_bucket_html5_1AE, ht_bucket_html5_1AF, + ht_bucket_html5_1B0, ht_bucket_empty, ht_bucket_html5_1B2, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_1B5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_1B9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_1BD, ht_bucket_html5_1BE, ht_bucket_empty, + ht_bucket_html5_1C0, ht_bucket_html5_1C1, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_1C4, ht_bucket_empty, ht_bucket_html5_1C6, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_1C9, ht_bucket_html5_1CA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_1CD, ht_bucket_html5_1CE, ht_bucket_empty, + ht_bucket_html5_1D0, ht_bucket_html5_1D1, ht_bucket_html5_1D2, ht_bucket_empty, + ht_bucket_html5_1D4, ht_bucket_html5_1D5, ht_bucket_html5_1D6, ht_bucket_empty, + ht_bucket_html5_1D8, ht_bucket_html5_1D9, ht_bucket_html5_1DA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_1DF, + ht_bucket_html5_1E0, ht_bucket_html5_1E1, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_1E5, ht_bucket_html5_1E6, ht_bucket_html5_1E7, + ht_bucket_html5_1E8, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_1EB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_1EF, + ht_bucket_html5_1F0, ht_bucket_empty, ht_bucket_html5_1F2, ht_bucket_empty, + ht_bucket_html5_1F4, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_1F8, ht_bucket_html5_1F9, ht_bucket_html5_1FA, ht_bucket_empty, + ht_bucket_html5_1FC, ht_bucket_empty, ht_bucket_html5_1FE, ht_bucket_html5_1FF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_205, ht_bucket_empty, ht_bucket_html5_207, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_20E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_212, ht_bucket_html5_213, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_219, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_21D, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_220, ht_bucket_empty, ht_bucket_html5_222, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_227, + ht_bucket_empty, ht_bucket_html5_229, ht_bucket_empty, ht_bucket_html5_22B, + ht_bucket_html5_22C, ht_bucket_html5_22D, ht_bucket_empty, ht_bucket_html5_22F, + ht_bucket_html5_230, ht_bucket_empty, ht_bucket_html5_232, ht_bucket_empty, + ht_bucket_html5_234, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_239, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_23C, ht_bucket_html5_23D, ht_bucket_html5_23E, ht_bucket_empty, + ht_bucket_html5_240, ht_bucket_html5_241, ht_bucket_html5_242, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_246, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_249, ht_bucket_html5_24A, ht_bucket_html5_24B, + ht_bucket_empty, ht_bucket_html5_24D, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_251, ht_bucket_html5_252, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_257, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_25A, ht_bucket_html5_25B, + ht_bucket_html5_25C, ht_bucket_html5_25D, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_263, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_26A, ht_bucket_html5_26B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_26E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_274, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_277, + ht_bucket_html5_278, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_27C, ht_bucket_empty, ht_bucket_html5_27E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_283, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_28A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_294, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_297, + ht_bucket_html5_298, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_29D, ht_bucket_empty, ht_bucket_html5_29F, + ht_bucket_html5_2A0, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_2A9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_2AE, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_2B1, ht_bucket_html5_2B2, ht_bucket_html5_2B3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_2B9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_2BF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_2C4, ht_bucket_html5_2C5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_2CE, ht_bucket_html5_2CF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_2D3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_2DA, ht_bucket_html5_2DB, + ht_bucket_html5_2DC, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_2E3, + ht_bucket_html5_2E4, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_2EB, + ht_bucket_html5_2EC, ht_bucket_empty, ht_bucket_html5_2EE, ht_bucket_empty, + ht_bucket_html5_2F0, ht_bucket_empty, ht_bucket_html5_2F2, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_2F8, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_300, ht_bucket_html5_301, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_304, ht_bucket_html5_305, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_308, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_30B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_30F, + ht_bucket_empty, ht_bucket_html5_311, ht_bucket_empty, ht_bucket_html5_313, + ht_bucket_empty, ht_bucket_html5_315, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_319, ht_bucket_html5_31A, ht_bucket_html5_31B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_326, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_329, ht_bucket_html5_32A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_32D, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_330, ht_bucket_html5_331, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_336, ht_bucket_empty, + ht_bucket_html5_338, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_33B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_33F, + ht_bucket_html5_340, ht_bucket_html5_341, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_347, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_34D, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_350, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_356, ht_bucket_empty, + ht_bucket_html5_358, ht_bucket_html5_359, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_35D, ht_bucket_empty, ht_bucket_html5_35F, + ht_bucket_empty, ht_bucket_html5_361, ht_bucket_empty, ht_bucket_html5_363, + ht_bucket_empty, ht_bucket_html5_365, ht_bucket_empty, ht_bucket_html5_367, + ht_bucket_empty, ht_bucket_html5_369, ht_bucket_html5_36A, ht_bucket_html5_36B, + ht_bucket_empty, ht_bucket_html5_36D, ht_bucket_html5_36E, ht_bucket_html5_36F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_372, ht_bucket_empty, + ht_bucket_html5_374, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_378, ht_bucket_empty, ht_bucket_html5_37A, ht_bucket_empty, + ht_bucket_html5_37C, ht_bucket_html5_37D, ht_bucket_html5_37E, ht_bucket_html5_37F, + ht_bucket_html5_380, ht_bucket_empty, ht_bucket_html5_382, ht_bucket_html5_383, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_386, ht_bucket_html5_387, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_38A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_38D, ht_bucket_html5_38E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_391, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_394, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_397, + ht_bucket_html5_398, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_39C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_39F, + ht_bucket_html5_3A0, ht_bucket_html5_3A1, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_3A4, ht_bucket_html5_3A5, ht_bucket_html5_3A6, ht_bucket_html5_3A7, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_3AC, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_3B2, ht_bucket_empty, + ht_bucket_html5_3B4, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_3BF, + ht_bucket_html5_3C0, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_3C4, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_3C9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_3CD, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_3D0, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_3D3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_3D9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_3DE, ht_bucket_empty, + ht_bucket_html5_3E0, ht_bucket_html5_3E1, ht_bucket_empty, ht_bucket_html5_3E3, + ht_bucket_html5_3E4, ht_bucket_empty, ht_bucket_html5_3E6, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_3E9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_3ED, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_3F1, ht_bucket_html5_3F2, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_3F7, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_3FC, ht_bucket_empty, ht_bucket_html5_3FE, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_402, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_405, ht_bucket_empty, ht_bucket_html5_407, + ht_bucket_empty, ht_bucket_html5_409, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_40E, ht_bucket_html5_40F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_413, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_41A, ht_bucket_html5_41B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_421, ht_bucket_empty, ht_bucket_html5_423, + ht_bucket_html5_424, ht_bucket_html5_425, ht_bucket_html5_426, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_429, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_42C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_42F, + ht_bucket_html5_430, ht_bucket_empty, ht_bucket_html5_432, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_436, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_439, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_43C, ht_bucket_html5_43D, ht_bucket_html5_43E, ht_bucket_html5_43F, + ht_bucket_html5_440, ht_bucket_html5_441, ht_bucket_empty, ht_bucket_html5_443, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_446, ht_bucket_html5_447, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_44A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_44F, + ht_bucket_html5_450, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_454, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_457, + ht_bucket_html5_458, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_45D, ht_bucket_empty, ht_bucket_html5_45F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_465, ht_bucket_html5_466, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_469, ht_bucket_html5_46A, ht_bucket_html5_46B, + ht_bucket_empty, ht_bucket_html5_46D, ht_bucket_empty, ht_bucket_html5_46F, + ht_bucket_html5_470, ht_bucket_html5_471, ht_bucket_html5_472, ht_bucket_html5_473, + ht_bucket_empty, ht_bucket_html5_475, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_479, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_47C, ht_bucket_html5_47D, ht_bucket_empty, ht_bucket_html5_47F, + ht_bucket_html5_480, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_485, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_488, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_48C, ht_bucket_empty, ht_bucket_html5_48E, ht_bucket_html5_48F, + ht_bucket_html5_490, ht_bucket_html5_491, ht_bucket_empty, ht_bucket_html5_493, + ht_bucket_empty, ht_bucket_html5_495, ht_bucket_html5_496, ht_bucket_empty, + ht_bucket_html5_498, ht_bucket_html5_499, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_49F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_4A2, ht_bucket_empty, + ht_bucket_html5_4A4, ht_bucket_empty, ht_bucket_html5_4A6, ht_bucket_html5_4A7, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_4AA, ht_bucket_html5_4AB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_4AE, ht_bucket_html5_4AF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_4B2, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_4B6, ht_bucket_empty, + ht_bucket_html5_4B8, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_4BC, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_4C0, ht_bucket_empty, ht_bucket_html5_4C2, ht_bucket_html5_4C3, + ht_bucket_html5_4C4, ht_bucket_html5_4C5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_4C8, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_4CB, + ht_bucket_empty, ht_bucket_html5_4CD, ht_bucket_empty, ht_bucket_html5_4CF, + ht_bucket_html5_4D0, ht_bucket_empty, ht_bucket_html5_4D2, ht_bucket_html5_4D3, + ht_bucket_html5_4D4, ht_bucket_html5_4D5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_4D8, ht_bucket_empty, ht_bucket_html5_4DA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_4DE, ht_bucket_html5_4DF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_4E3, + ht_bucket_html5_4E4, ht_bucket_empty, ht_bucket_html5_4E6, ht_bucket_html5_4E7, + ht_bucket_html5_4E8, ht_bucket_html5_4E9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_4ED, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_4F1, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_4F7, + ht_bucket_empty, ht_bucket_html5_4F9, ht_bucket_empty, ht_bucket_html5_4FB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_4FE, ht_bucket_empty, + ht_bucket_html5_500, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_504, ht_bucket_empty, ht_bucket_html5_506, ht_bucket_html5_507, + ht_bucket_empty, ht_bucket_html5_509, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_50E, ht_bucket_html5_50F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_513, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_516, ht_bucket_empty, + ht_bucket_html5_518, ht_bucket_html5_519, ht_bucket_empty, ht_bucket_html5_51B, + ht_bucket_html5_51C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_524, ht_bucket_html5_525, ht_bucket_html5_526, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_52F, + ht_bucket_html5_530, ht_bucket_empty, ht_bucket_html5_532, ht_bucket_html5_533, + ht_bucket_html5_534, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_53B, + ht_bucket_html5_53C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_53F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_542, ht_bucket_html5_543, + ht_bucket_empty, ht_bucket_html5_545, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_548, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_54F, + ht_bucket_html5_550, ht_bucket_html5_551, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_557, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_55B, + ht_bucket_empty, ht_bucket_html5_55D, ht_bucket_empty, ht_bucket_html5_55F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_564, ht_bucket_html5_565, ht_bucket_html5_566, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_56C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_56F, + ht_bucket_html5_570, ht_bucket_html5_571, ht_bucket_html5_572, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_575, ht_bucket_html5_576, ht_bucket_html5_577, + ht_bucket_html5_578, ht_bucket_empty, ht_bucket_html5_57A, ht_bucket_html5_57B, + ht_bucket_html5_57C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_580, ht_bucket_empty, ht_bucket_html5_582, ht_bucket_html5_583, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_586, ht_bucket_empty, + ht_bucket_html5_588, ht_bucket_html5_589, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_58D, ht_bucket_html5_58E, ht_bucket_html5_58F, + ht_bucket_html5_590, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_595, ht_bucket_html5_596, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_59A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_59D, ht_bucket_empty, ht_bucket_html5_59F, + ht_bucket_html5_5A0, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_5A3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_5A6, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_5A9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_5AC, ht_bucket_html5_5AD, ht_bucket_html5_5AE, ht_bucket_empty, + ht_bucket_html5_5B0, ht_bucket_html5_5B1, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_5B5, ht_bucket_html5_5B6, ht_bucket_html5_5B7, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_5BB, + ht_bucket_html5_5BC, ht_bucket_html5_5BD, ht_bucket_empty, ht_bucket_html5_5BF, + ht_bucket_html5_5C0, ht_bucket_html5_5C1, ht_bucket_html5_5C2, ht_bucket_empty, + ht_bucket_html5_5C4, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_5D0, ht_bucket_html5_5D1, ht_bucket_empty, ht_bucket_html5_5D3, + ht_bucket_empty, ht_bucket_html5_5D5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_5D8, ht_bucket_html5_5D9, ht_bucket_empty, ht_bucket_html5_5DB, + ht_bucket_empty, ht_bucket_html5_5DD, ht_bucket_empty, ht_bucket_html5_5DF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_5E2, ht_bucket_empty, + ht_bucket_html5_5E4, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_5E7, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_5EA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_5ED, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_5F0, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_5F3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_5F6, ht_bucket_empty, + ht_bucket_html5_5F8, ht_bucket_empty, ht_bucket_html5_5FA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_5FD, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_601, ht_bucket_html5_602, ht_bucket_html5_603, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_606, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_609, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_60D, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_613, + ht_bucket_empty, ht_bucket_html5_615, ht_bucket_empty, ht_bucket_html5_617, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_61A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_61D, ht_bucket_empty, ht_bucket_html5_61F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_622, ht_bucket_empty, + ht_bucket_html5_624, ht_bucket_empty, ht_bucket_html5_626, ht_bucket_empty, + ht_bucket_html5_628, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_62C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_630, ht_bucket_empty, ht_bucket_html5_632, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_636, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_63A, ht_bucket_empty, + ht_bucket_html5_63C, ht_bucket_html5_63D, ht_bucket_html5_63E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_641, ht_bucket_html5_642, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_645, ht_bucket_html5_646, ht_bucket_html5_647, + ht_bucket_html5_648, ht_bucket_html5_649, ht_bucket_html5_64A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_651, ht_bucket_html5_652, ht_bucket_html5_653, + ht_bucket_empty, ht_bucket_html5_655, ht_bucket_empty, ht_bucket_html5_657, + ht_bucket_html5_658, ht_bucket_html5_659, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_65C, ht_bucket_empty, ht_bucket_html5_65E, ht_bucket_empty, + ht_bucket_html5_660, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_669, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_670, ht_bucket_html5_671, ht_bucket_html5_672, ht_bucket_html5_673, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_676, ht_bucket_empty, + ht_bucket_html5_678, ht_bucket_html5_679, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_67D, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_680, ht_bucket_empty, ht_bucket_html5_682, ht_bucket_empty, + ht_bucket_html5_684, ht_bucket_html5_685, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_68A, ht_bucket_empty, + ht_bucket_html5_68C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_691, ht_bucket_empty, ht_bucket_html5_693, + ht_bucket_html5_694, ht_bucket_empty, ht_bucket_html5_696, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_699, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_6A3, + ht_bucket_html5_6A4, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_6A8, ht_bucket_html5_6A9, ht_bucket_html5_6AA, ht_bucket_html5_6AB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_6AE, ht_bucket_empty, + ht_bucket_html5_6B0, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_6B4, ht_bucket_empty, ht_bucket_html5_6B6, ht_bucket_empty, + ht_bucket_html5_6B8, ht_bucket_html5_6B9, ht_bucket_html5_6BA, ht_bucket_empty, + ht_bucket_html5_6BC, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_6BF, + ht_bucket_html5_6C0, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_6C4, ht_bucket_html5_6C5, ht_bucket_html5_6C6, ht_bucket_html5_6C7, + ht_bucket_html5_6C8, ht_bucket_html5_6C9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_6CC, ht_bucket_empty, ht_bucket_html5_6CE, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_6D1, ht_bucket_html5_6D2, ht_bucket_empty, + ht_bucket_html5_6D4, ht_bucket_html5_6D5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_6D9, ht_bucket_html5_6DA, ht_bucket_html5_6DB, + ht_bucket_html5_6DC, ht_bucket_empty, ht_bucket_html5_6DE, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_6E7, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_6EB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_6EE, ht_bucket_html5_6EF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_6F5, ht_bucket_empty, ht_bucket_html5_6F7, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_6FB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_704, ht_bucket_html5_705, ht_bucket_html5_706, ht_bucket_html5_707, + ht_bucket_empty, ht_bucket_html5_709, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_70C, ht_bucket_empty, ht_bucket_html5_70E, ht_bucket_html5_70F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_712, ht_bucket_empty, + ht_bucket_html5_714, ht_bucket_html5_715, ht_bucket_empty, ht_bucket_html5_717, + ht_bucket_empty, ht_bucket_html5_719, ht_bucket_empty, ht_bucket_html5_71B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_71E, ht_bucket_html5_71F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_723, + ht_bucket_html5_724, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_727, + ht_bucket_empty, ht_bucket_html5_729, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_72C, ht_bucket_html5_72D, ht_bucket_html5_72E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_733, + ht_bucket_html5_734, ht_bucket_html5_735, ht_bucket_html5_736, ht_bucket_empty, + ht_bucket_html5_738, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_73B, + ht_bucket_empty, ht_bucket_html5_73D, ht_bucket_html5_73E, ht_bucket_html5_73F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_744, ht_bucket_html5_745, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_749, ht_bucket_empty, ht_bucket_html5_74B, + ht_bucket_html5_74C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_74F, + ht_bucket_empty, ht_bucket_html5_751, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_754, ht_bucket_html5_755, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_759, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_75C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_75F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_762, ht_bucket_html5_763, + ht_bucket_empty, ht_bucket_html5_765, ht_bucket_html5_766, ht_bucket_empty, + ht_bucket_html5_768, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_76E, ht_bucket_empty, + ht_bucket_html5_770, ht_bucket_empty, ht_bucket_html5_772, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_776, ht_bucket_html5_777, + ht_bucket_empty, ht_bucket_html5_779, ht_bucket_html5_77A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_77F, + ht_bucket_empty, ht_bucket_html5_781, ht_bucket_empty, ht_bucket_html5_783, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_787, + ht_bucket_empty, ht_bucket_html5_789, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_78C, ht_bucket_html5_78D, ht_bucket_html5_78E, ht_bucket_empty, + ht_bucket_html5_790, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_794, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_797, + ht_bucket_html5_798, ht_bucket_empty, ht_bucket_html5_79A, ht_bucket_html5_79B, + ht_bucket_empty, ht_bucket_html5_79D, ht_bucket_empty, ht_bucket_html5_79F, + ht_bucket_html5_7A0, ht_bucket_html5_7A1, ht_bucket_html5_7A2, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_7A5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_7A8, ht_bucket_empty, ht_bucket_html5_7AA, ht_bucket_html5_7AB, + ht_bucket_html5_7AC, ht_bucket_empty, ht_bucket_html5_7AE, ht_bucket_html5_7AF, + ht_bucket_html5_7B0, ht_bucket_html5_7B1, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_7B5, ht_bucket_html5_7B6, ht_bucket_html5_7B7, + ht_bucket_html5_7B8, ht_bucket_empty, ht_bucket_html5_7BA, ht_bucket_html5_7BB, + ht_bucket_empty, ht_bucket_html5_7BD, ht_bucket_html5_7BE, ht_bucket_html5_7BF, + ht_bucket_html5_7C0, ht_bucket_html5_7C1, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_7C9, ht_bucket_empty, ht_bucket_html5_7CB, + ht_bucket_empty, ht_bucket_html5_7CD, ht_bucket_html5_7CE, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_7D1, ht_bucket_html5_7D2, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_7D5, ht_bucket_html5_7D6, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_7D9, ht_bucket_html5_7DA, ht_bucket_empty, + ht_bucket_html5_7DC, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_7E0, ht_bucket_empty, ht_bucket_html5_7E2, ht_bucket_empty, + ht_bucket_html5_7E4, ht_bucket_html5_7E5, ht_bucket_html5_7E6, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_7EC, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_7EF, + ht_bucket_empty, ht_bucket_html5_7F1, ht_bucket_empty, ht_bucket_html5_7F3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_7F6, ht_bucket_empty, + ht_bucket_html5_7F8, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_7FB, + ht_bucket_html5_7FC, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_800, ht_bucket_empty, ht_bucket_html5_802, ht_bucket_html5_803, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_808, ht_bucket_html5_809, ht_bucket_html5_80A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_810, ht_bucket_html5_811, ht_bucket_html5_812, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_816, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_819, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_81C, ht_bucket_html5_81D, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_821, ht_bucket_html5_822, ht_bucket_html5_823, + ht_bucket_html5_824, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_828, ht_bucket_html5_829, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_82D, ht_bucket_html5_82E, ht_bucket_empty, + ht_bucket_html5_830, ht_bucket_html5_831, ht_bucket_html5_832, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_837, + ht_bucket_html5_838, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_83C, ht_bucket_empty, ht_bucket_html5_83E, ht_bucket_html5_83F, + ht_bucket_empty, ht_bucket_html5_841, ht_bucket_html5_842, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_846, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_84A, ht_bucket_empty, + ht_bucket_html5_84C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_84F, + ht_bucket_html5_850, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_855, ht_bucket_empty, ht_bucket_html5_857, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_85B, + ht_bucket_html5_85C, ht_bucket_empty, ht_bucket_html5_85E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_861, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_865, ht_bucket_html5_866, ht_bucket_html5_867, + ht_bucket_html5_868, ht_bucket_empty, ht_bucket_html5_86A, ht_bucket_html5_86B, + ht_bucket_html5_86C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_873, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_876, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_879, ht_bucket_empty, ht_bucket_html5_87B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_87E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_88A, ht_bucket_empty, + ht_bucket_html5_88C, ht_bucket_empty, ht_bucket_html5_88E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_892, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_895, ht_bucket_html5_896, ht_bucket_html5_897, + ht_bucket_html5_898, ht_bucket_html5_899, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_89D, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_8A5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_8AC, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_8B3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_8B6, ht_bucket_html5_8B7, + ht_bucket_html5_8B8, ht_bucket_html5_8B9, ht_bucket_html5_8BA, ht_bucket_empty, + ht_bucket_html5_8BC, ht_bucket_html5_8BD, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_8C0, ht_bucket_html5_8C1, ht_bucket_html5_8C2, ht_bucket_empty, + ht_bucket_html5_8C4, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_8C7, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_8CF, + ht_bucket_html5_8D0, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_8D3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_8D6, ht_bucket_empty, + ht_bucket_html5_8D8, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_8DC, ht_bucket_html5_8DD, ht_bucket_html5_8DE, ht_bucket_html5_8DF, + ht_bucket_html5_8E0, ht_bucket_empty, ht_bucket_html5_8E2, ht_bucket_html5_8E3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_8E7, + ht_bucket_html5_8E8, ht_bucket_html5_8E9, ht_bucket_empty, ht_bucket_html5_8EB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_8F3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_8FB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_8FE, ht_bucket_html5_8FF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_904, ht_bucket_empty, ht_bucket_html5_906, ht_bucket_html5_907, + ht_bucket_empty, ht_bucket_html5_909, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_90C, ht_bucket_empty, ht_bucket_html5_90E, ht_bucket_empty, + ht_bucket_html5_910, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_913, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_916, ht_bucket_empty, + ht_bucket_html5_918, ht_bucket_html5_919, ht_bucket_empty, ht_bucket_html5_91B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_91E, ht_bucket_html5_91F, + ht_bucket_html5_920, ht_bucket_empty, ht_bucket_html5_922, ht_bucket_html5_923, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_927, + ht_bucket_empty, ht_bucket_html5_929, ht_bucket_html5_92A, ht_bucket_empty, + ht_bucket_html5_92C, ht_bucket_empty, ht_bucket_html5_92E, ht_bucket_empty, + ht_bucket_html5_930, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_936, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_939, ht_bucket_empty, ht_bucket_html5_93B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_93F, + ht_bucket_html5_940, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_945, ht_bucket_empty, ht_bucket_html5_947, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_94D, ht_bucket_empty, ht_bucket_html5_94F, + ht_bucket_html5_950, ht_bucket_empty, ht_bucket_html5_952, ht_bucket_html5_953, + ht_bucket_html5_954, ht_bucket_html5_955, ht_bucket_html5_956, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_959, ht_bucket_empty, ht_bucket_html5_95B, + ht_bucket_empty, ht_bucket_html5_95D, ht_bucket_empty, ht_bucket_html5_95F, + ht_bucket_html5_960, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_963, + ht_bucket_html5_964, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_969, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_96C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_96F, + ht_bucket_html5_970, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_974, ht_bucket_html5_975, ht_bucket_html5_976, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_97B, + ht_bucket_html5_97C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_97F, + ht_bucket_empty, ht_bucket_html5_981, ht_bucket_empty, ht_bucket_html5_983, + ht_bucket_empty, ht_bucket_html5_985, ht_bucket_html5_986, ht_bucket_empty, + ht_bucket_html5_988, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_98C, ht_bucket_html5_98D, ht_bucket_empty, ht_bucket_html5_98F, + ht_bucket_html5_990, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_996, ht_bucket_html5_997, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_99B, + ht_bucket_html5_99C, ht_bucket_empty, ht_bucket_html5_99E, ht_bucket_html5_99F, + ht_bucket_html5_9A0, ht_bucket_html5_9A1, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_9A6, ht_bucket_empty, + ht_bucket_html5_9A8, ht_bucket_empty, ht_bucket_html5_9AA, ht_bucket_empty, + ht_bucket_html5_9AC, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_9B0, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_9B4, ht_bucket_html5_9B5, ht_bucket_html5_9B6, ht_bucket_html5_9B7, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_9BB, + ht_bucket_html5_9BC, ht_bucket_html5_9BD, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_9C1, ht_bucket_html5_9C2, ht_bucket_html5_9C3, + ht_bucket_empty, ht_bucket_html5_9C5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_9C9, ht_bucket_html5_9CA, ht_bucket_empty, + ht_bucket_html5_9CC, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_9CF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_9D5, ht_bucket_html5_9D6, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_9DA, ht_bucket_html5_9DB, + ht_bucket_empty, ht_bucket_html5_9DD, ht_bucket_html5_9DE, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_9E1, ht_bucket_html5_9E2, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_9E5, ht_bucket_empty, ht_bucket_html5_9E7, + ht_bucket_empty, ht_bucket_html5_9E9, ht_bucket_empty, ht_bucket_html5_9EB, + ht_bucket_empty, ht_bucket_html5_9ED, ht_bucket_html5_9EE, ht_bucket_html5_9EF, + ht_bucket_html5_9F0, ht_bucket_html5_9F1, ht_bucket_html5_9F2, ht_bucket_html5_9F3, + ht_bucket_html5_9F4, ht_bucket_html5_9F5, ht_bucket_empty, ht_bucket_html5_9F7, + ht_bucket_empty, ht_bucket_html5_9F9, ht_bucket_html5_9FA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_9FD, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_A01, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_A04, ht_bucket_html5_A05, ht_bucket_html5_A06, ht_bucket_empty, + ht_bucket_html5_A08, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_A0C, ht_bucket_html5_A0D, ht_bucket_html5_A0E, ht_bucket_empty, + ht_bucket_html5_A10, ht_bucket_empty, ht_bucket_html5_A12, ht_bucket_empty, + ht_bucket_html5_A14, ht_bucket_html5_A15, ht_bucket_html5_A16, ht_bucket_html5_A17, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_A21, ht_bucket_empty, ht_bucket_html5_A23, + ht_bucket_html5_A24, ht_bucket_html5_A25, ht_bucket_html5_A26, ht_bucket_empty, + ht_bucket_html5_A28, ht_bucket_empty, ht_bucket_html5_A2A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_A2D, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_A30, ht_bucket_empty, ht_bucket_html5_A32, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_A36, ht_bucket_html5_A37, + ht_bucket_empty, ht_bucket_html5_A39, ht_bucket_empty, ht_bucket_html5_A3B, + ht_bucket_html5_A3C, ht_bucket_html5_A3D, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_A41, ht_bucket_empty, ht_bucket_html5_A43, + ht_bucket_html5_A44, ht_bucket_html5_A45, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_A48, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_A4F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_A53, + ht_bucket_html5_A54, ht_bucket_empty, ht_bucket_html5_A56, ht_bucket_html5_A57, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_A5A, ht_bucket_html5_A5B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_A61, ht_bucket_html5_A62, ht_bucket_html5_A63, + ht_bucket_html5_A64, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_A69, ht_bucket_html5_A6A, ht_bucket_html5_A6B, + ht_bucket_empty, ht_bucket_html5_A6D, ht_bucket_empty, ht_bucket_html5_A6F, + ht_bucket_html5_A70, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_A76, ht_bucket_empty, + ht_bucket_html5_A78, ht_bucket_empty, ht_bucket_html5_A7A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_A7E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_A81, ht_bucket_html5_A82, ht_bucket_empty, + ht_bucket_html5_A84, ht_bucket_html5_A85, ht_bucket_html5_A86, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_A89, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_A8D, ht_bucket_html5_A8E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_A92, ht_bucket_empty, + ht_bucket_html5_A94, ht_bucket_empty, ht_bucket_html5_A96, ht_bucket_empty, + ht_bucket_html5_A98, ht_bucket_html5_A99, ht_bucket_html5_A9A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_A9D, ht_bucket_empty, ht_bucket_html5_A9F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_AA3, + ht_bucket_html5_AA4, ht_bucket_html5_AA5, ht_bucket_empty, ht_bucket_html5_AA7, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_AAC, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_AB2, ht_bucket_empty, + ht_bucket_html5_AB4, ht_bucket_html5_AB5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_ABA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_AC0, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_AC4, ht_bucket_html5_AC5, ht_bucket_html5_AC6, ht_bucket_html5_AC7, + ht_bucket_html5_AC8, ht_bucket_empty, ht_bucket_html5_ACA, ht_bucket_empty, + ht_bucket_html5_ACC, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_ACF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_AD2, ht_bucket_html5_AD3, + ht_bucket_html5_AD4, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_ADA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_ADD, ht_bucket_empty, ht_bucket_html5_ADF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_AE4, ht_bucket_html5_AE5, ht_bucket_html5_AE6, ht_bucket_html5_AE7, + ht_bucket_html5_AE8, ht_bucket_html5_AE9, ht_bucket_empty, ht_bucket_html5_AEB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_AF5, ht_bucket_html5_AF6, ht_bucket_html5_AF7, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_AFA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_AFD, ht_bucket_html5_AFE, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_B08, ht_bucket_html5_B09, ht_bucket_html5_B0A, ht_bucket_empty, + ht_bucket_html5_B0C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_B10, ht_bucket_html5_B11, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_B15, ht_bucket_html5_B16, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_B1E, ht_bucket_html5_B1F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_B23, + ht_bucket_html5_B24, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_B27, + ht_bucket_empty, ht_bucket_html5_B29, ht_bucket_html5_B2A, ht_bucket_html5_B2B, + ht_bucket_html5_B2C, ht_bucket_html5_B2D, ht_bucket_html5_B2E, ht_bucket_html5_B2F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_B33, + ht_bucket_empty, ht_bucket_html5_B35, ht_bucket_html5_B36, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_B3A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_B3D, ht_bucket_html5_B3E, ht_bucket_empty, + ht_bucket_html5_B40, ht_bucket_empty, ht_bucket_html5_B42, ht_bucket_empty, + ht_bucket_html5_B44, ht_bucket_empty, ht_bucket_html5_B46, ht_bucket_html5_B47, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_B4C, ht_bucket_empty, ht_bucket_html5_B4E, ht_bucket_html5_B4F, + ht_bucket_html5_B50, ht_bucket_html5_B51, ht_bucket_html5_B52, ht_bucket_html5_B53, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_B56, ht_bucket_empty, + ht_bucket_html5_B58, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_B5C, ht_bucket_html5_B5D, ht_bucket_html5_B5E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_B63, + ht_bucket_html5_B64, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_B67, + ht_bucket_empty, ht_bucket_html5_B69, ht_bucket_empty, ht_bucket_html5_B6B, + ht_bucket_empty, ht_bucket_html5_B6D, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_B72, ht_bucket_html5_B73, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_B77, + ht_bucket_html5_B78, ht_bucket_empty, ht_bucket_html5_B7A, ht_bucket_html5_B7B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_B7E, ht_bucket_html5_B7F, + ht_bucket_empty, ht_bucket_html5_B81, ht_bucket_html5_B82, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_B87, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_B8D, ht_bucket_empty, ht_bucket_html5_B8F, + ht_bucket_html5_B90, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_B94, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_B98, ht_bucket_html5_B99, ht_bucket_html5_B9A, ht_bucket_empty, + ht_bucket_html5_B9C, ht_bucket_html5_B9D, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_BA5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_BA9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_BAE, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_BB2, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_BB5, ht_bucket_html5_BB6, ht_bucket_html5_BB7, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_BBA, ht_bucket_empty, + ht_bucket_html5_BBC, ht_bucket_html5_BBD, ht_bucket_empty, ht_bucket_html5_BBF, + ht_bucket_empty, ht_bucket_html5_BC1, ht_bucket_html5_BC2, ht_bucket_html5_BC3, + ht_bucket_html5_BC4, ht_bucket_html5_BC5, ht_bucket_html5_BC6, ht_bucket_html5_BC7, + ht_bucket_html5_BC8, ht_bucket_html5_BC9, ht_bucket_empty, ht_bucket_html5_BCB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_BCE, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_BD1, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_BD7, + ht_bucket_html5_BD8, ht_bucket_html5_BD9, ht_bucket_html5_BDA, ht_bucket_html5_BDB, + ht_bucket_empty, ht_bucket_html5_BDD, ht_bucket_empty, ht_bucket_html5_BDF, + ht_bucket_empty, ht_bucket_html5_BE1, ht_bucket_html5_BE2, ht_bucket_empty, + ht_bucket_html5_BE4, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_BE7, + ht_bucket_html5_BE8, ht_bucket_html5_BE9, ht_bucket_html5_BEA, ht_bucket_html5_BEB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_BEF, + ht_bucket_html5_BF0, ht_bucket_html5_BF1, ht_bucket_html5_BF2, ht_bucket_html5_BF3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_BF7, + ht_bucket_empty, ht_bucket_html5_BF9, ht_bucket_html5_BFA, ht_bucket_empty, + ht_bucket_html5_BFC, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_C02, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_C0B, + ht_bucket_html5_C0C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_C11, ht_bucket_html5_C12, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_C16, ht_bucket_empty, + ht_bucket_html5_C18, ht_bucket_empty, ht_bucket_html5_C1A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_C1D, ht_bucket_html5_C1E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_C23, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_C27, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_C2B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_C31, ht_bucket_html5_C32, ht_bucket_html5_C33, + ht_bucket_html5_C34, ht_bucket_html5_C35, ht_bucket_html5_C36, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_C3A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_C3E, ht_bucket_html5_C3F, + ht_bucket_html5_C40, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_C43, + ht_bucket_html5_C44, ht_bucket_empty, ht_bucket_html5_C46, ht_bucket_empty, + ht_bucket_html5_C48, ht_bucket_empty, ht_bucket_html5_C4A, ht_bucket_html5_C4B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_C4F, + ht_bucket_html5_C50, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_C54, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_C58, ht_bucket_empty, ht_bucket_html5_C5A, ht_bucket_html5_C5B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_C5F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_C69, ht_bucket_empty, ht_bucket_html5_C6B, + ht_bucket_html5_C6C, ht_bucket_empty, ht_bucket_html5_C6E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_C72, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_C76, ht_bucket_html5_C77, + ht_bucket_html5_C78, ht_bucket_empty, ht_bucket_html5_C7A, ht_bucket_html5_C7B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_C80, ht_bucket_empty, ht_bucket_html5_C82, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_C89, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_C8E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_C91, ht_bucket_empty, ht_bucket_html5_C93, + ht_bucket_html5_C94, ht_bucket_html5_C95, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_C98, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_CA6, ht_bucket_empty, + ht_bucket_html5_CA8, ht_bucket_html5_CA9, ht_bucket_html5_CAA, ht_bucket_empty, + ht_bucket_html5_CAC, ht_bucket_html5_CAD, ht_bucket_empty, ht_bucket_html5_CAF, + ht_bucket_html5_CB0, ht_bucket_empty, ht_bucket_html5_CB2, ht_bucket_empty, + ht_bucket_html5_CB4, ht_bucket_empty, ht_bucket_html5_CB6, ht_bucket_html5_CB7, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_CBA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_CBE, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_CC2, ht_bucket_empty, + ht_bucket_html5_CC4, ht_bucket_html5_CC5, ht_bucket_empty, ht_bucket_html5_CC7, + ht_bucket_html5_CC8, ht_bucket_html5_CC9, ht_bucket_empty, ht_bucket_html5_CCB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_CD0, ht_bucket_empty, ht_bucket_html5_CD2, ht_bucket_html5_CD3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_CD9, ht_bucket_html5_CDA, ht_bucket_empty, + ht_bucket_html5_CDC, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_CE4, ht_bucket_empty, ht_bucket_html5_CE6, ht_bucket_empty, + ht_bucket_html5_CE8, ht_bucket_html5_CE9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_CED, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_CF1, ht_bucket_html5_CF2, ht_bucket_html5_CF3, + ht_bucket_html5_CF4, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_CFA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_CFF, + ht_bucket_html5_D00, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_D06, ht_bucket_html5_D07, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_D0B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_D0E, ht_bucket_empty, + ht_bucket_html5_D10, ht_bucket_html5_D11, ht_bucket_html5_D12, ht_bucket_html5_D13, + ht_bucket_empty, ht_bucket_html5_D15, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_D18, ht_bucket_html5_D19, ht_bucket_html5_D1A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_D1E, ht_bucket_html5_D1F, + ht_bucket_html5_D20, ht_bucket_empty, ht_bucket_html5_D22, ht_bucket_empty, + ht_bucket_html5_D24, ht_bucket_empty, ht_bucket_html5_D26, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_D2A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_D32, ht_bucket_empty, + ht_bucket_html5_D34, ht_bucket_html5_D35, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_D38, ht_bucket_html5_D39, ht_bucket_html5_D3A, ht_bucket_html5_D3B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_D3E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_D42, ht_bucket_empty, + ht_bucket_html5_D44, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_D49, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_D4C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_D4F, + ht_bucket_empty, ht_bucket_html5_D51, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_D54, ht_bucket_html5_D55, ht_bucket_html5_D56, ht_bucket_html5_D57, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_D5A, ht_bucket_html5_D5B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_D5F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_D63, + ht_bucket_empty, ht_bucket_html5_D65, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_D69, ht_bucket_html5_D6A, ht_bucket_empty, + ht_bucket_html5_D6C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_D6F, + ht_bucket_html5_D70, ht_bucket_html5_D71, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_D74, ht_bucket_html5_D75, ht_bucket_html5_D76, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_D7C, ht_bucket_html5_D7D, ht_bucket_html5_D7E, ht_bucket_empty, + ht_bucket_html5_D80, ht_bucket_html5_D81, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_D85, ht_bucket_empty, ht_bucket_html5_D87, + ht_bucket_empty, ht_bucket_html5_D89, ht_bucket_html5_D8A, ht_bucket_empty, + ht_bucket_html5_D8C, ht_bucket_html5_D8D, ht_bucket_html5_D8E, ht_bucket_html5_D8F, + ht_bucket_html5_D90, ht_bucket_html5_D91, ht_bucket_empty, ht_bucket_html5_D93, + ht_bucket_html5_D94, ht_bucket_html5_D95, ht_bucket_html5_D96, ht_bucket_empty, + ht_bucket_html5_D98, ht_bucket_empty, ht_bucket_html5_D9A, ht_bucket_empty, + ht_bucket_html5_D9C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_DA0, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_DA5, ht_bucket_html5_DA6, ht_bucket_empty, + ht_bucket_html5_DA8, ht_bucket_html5_DA9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_DAC, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_DB0, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_DB3, + ht_bucket_html5_DB4, ht_bucket_empty, ht_bucket_html5_DB6, ht_bucket_html5_DB7, + ht_bucket_empty, ht_bucket_html5_DB9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_DBC, ht_bucket_empty, ht_bucket_html5_DBE, ht_bucket_html5_DBF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_DC2, ht_bucket_html5_DC3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_DC6, ht_bucket_empty, + ht_bucket_html5_DC8, ht_bucket_empty, ht_bucket_html5_DCA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_DCF, + ht_bucket_empty, ht_bucket_html5_DD1, ht_bucket_empty, ht_bucket_html5_DD3, + ht_bucket_html5_DD4, ht_bucket_html5_DD5, ht_bucket_empty, ht_bucket_html5_DD7, + ht_bucket_empty, ht_bucket_html5_DD9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_DDC, ht_bucket_html5_DDD, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_DE4, ht_bucket_empty, ht_bucket_html5_DE6, ht_bucket_html5_DE7, + ht_bucket_empty, ht_bucket_html5_DE9, ht_bucket_empty, ht_bucket_html5_DEB, + ht_bucket_empty, ht_bucket_html5_DED, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_DF1, ht_bucket_html5_DF2, ht_bucket_html5_DF3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_DF6, ht_bucket_html5_DF7, + ht_bucket_empty, ht_bucket_html5_DF9, ht_bucket_empty, ht_bucket_html5_DFB, + ht_bucket_empty, ht_bucket_html5_DFD, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_E03, + ht_bucket_html5_E04, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_E08, ht_bucket_html5_E09, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_E0C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_E11, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_E18, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_E1B, + ht_bucket_html5_E1C, ht_bucket_html5_E1D, ht_bucket_html5_E1E, ht_bucket_empty, + ht_bucket_html5_E20, ht_bucket_empty, ht_bucket_html5_E22, ht_bucket_html5_E23, + ht_bucket_html5_E24, ht_bucket_html5_E25, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_E28, ht_bucket_empty, ht_bucket_html5_E2A, ht_bucket_empty, + ht_bucket_html5_E2C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_E2F, + ht_bucket_html5_E30, ht_bucket_empty, ht_bucket_html5_E32, ht_bucket_html5_E33, + ht_bucket_empty, ht_bucket_html5_E35, ht_bucket_html5_E36, ht_bucket_html5_E37, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_E3B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_E41, ht_bucket_html5_E42, ht_bucket_html5_E43, + ht_bucket_html5_E44, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_E48, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_E4C, ht_bucket_empty, ht_bucket_html5_E4E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_E53, + ht_bucket_empty, ht_bucket_html5_E55, ht_bucket_empty, ht_bucket_html5_E57, + ht_bucket_html5_E58, ht_bucket_html5_E59, ht_bucket_empty, ht_bucket_html5_E5B, + ht_bucket_empty, ht_bucket_html5_E5D, ht_bucket_html5_E5E, ht_bucket_html5_E5F, + ht_bucket_html5_E60, ht_bucket_html5_E61, ht_bucket_empty, ht_bucket_html5_E63, + ht_bucket_html5_E64, ht_bucket_html5_E65, ht_bucket_html5_E66, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_E6A, ht_bucket_empty, + ht_bucket_html5_E6C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_E6F, + ht_bucket_html5_E70, ht_bucket_html5_E71, ht_bucket_empty, ht_bucket_html5_E73, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_E78, ht_bucket_empty, ht_bucket_html5_E7A, ht_bucket_empty, + ht_bucket_html5_E7C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_E80, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_E83, + ht_bucket_html5_E84, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_E89, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_E8E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_E91, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_E99, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_E9C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_EA1, ht_bucket_html5_EA2, ht_bucket_empty, + ht_bucket_html5_EA4, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_EA8, ht_bucket_html5_EA9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_EB1, ht_bucket_html5_EB2, ht_bucket_empty, + ht_bucket_html5_EB4, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_EB7, + ht_bucket_html5_EB8, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_ECA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_ECD, ht_bucket_empty, ht_bucket_html5_ECF, + ht_bucket_empty, ht_bucket_html5_ED1, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_ED7, + ht_bucket_html5_ED8, ht_bucket_html5_ED9, ht_bucket_html5_EDA, ht_bucket_html5_EDB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_EDF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_EE2, ht_bucket_empty, + ht_bucket_html5_EE4, ht_bucket_html5_EE5, ht_bucket_empty, ht_bucket_html5_EE7, + ht_bucket_empty, ht_bucket_html5_EE9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_EEF, + ht_bucket_empty, ht_bucket_html5_EF1, ht_bucket_html5_EF2, ht_bucket_empty, + ht_bucket_html5_EF4, ht_bucket_html5_EF5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_EF9, ht_bucket_empty, ht_bucket_html5_EFB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_EFE, ht_bucket_html5_EFF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_F03, + ht_bucket_empty, ht_bucket_html5_F05, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_F08, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_F0B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_F0F, + ht_bucket_html5_F10, ht_bucket_html5_F11, ht_bucket_empty, ht_bucket_html5_F13, + ht_bucket_html5_F14, ht_bucket_html5_F15, ht_bucket_empty, ht_bucket_html5_F17, + ht_bucket_html5_F18, ht_bucket_html5_F19, ht_bucket_html5_F1A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_F1F, + ht_bucket_html5_F20, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_F26, ht_bucket_empty, + ht_bucket_html5_F28, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_F2C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_F2F, + ht_bucket_html5_F30, ht_bucket_html5_F31, ht_bucket_empty, ht_bucket_html5_F33, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_F37, + ht_bucket_html5_F38, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_F40, ht_bucket_html5_F41, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_F44, ht_bucket_empty, ht_bucket_html5_F46, ht_bucket_html5_F47, + ht_bucket_html5_F48, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_F4B, + ht_bucket_html5_F4C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_F50, ht_bucket_html5_F51, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_F55, ht_bucket_empty, ht_bucket_html5_F57, + ht_bucket_html5_F58, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_F5B, + ht_bucket_empty, ht_bucket_html5_F5D, ht_bucket_empty, ht_bucket_html5_F5F, + ht_bucket_html5_F60, ht_bucket_empty, ht_bucket_html5_F62, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_F67, + ht_bucket_html5_F68, ht_bucket_html5_F69, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_F6D, ht_bucket_html5_F6E, ht_bucket_html5_F6F, + ht_bucket_html5_F70, ht_bucket_html5_F71, ht_bucket_html5_F72, ht_bucket_empty, + ht_bucket_html5_F74, ht_bucket_html5_F75, ht_bucket_html5_F76, ht_bucket_html5_F77, + ht_bucket_html5_F78, ht_bucket_html5_F79, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_F81, ht_bucket_html5_F82, ht_bucket_html5_F83, + ht_bucket_html5_F84, ht_bucket_empty, ht_bucket_html5_F86, ht_bucket_empty, + ht_bucket_html5_F88, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_F8B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_F8F, + ht_bucket_empty, ht_bucket_html5_F91, ht_bucket_empty, ht_bucket_html5_F93, + ht_bucket_empty, ht_bucket_html5_F95, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_F9A, ht_bucket_empty, + ht_bucket_html5_F9C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_F9F, + ht_bucket_html5_FA0, ht_bucket_html5_FA1, ht_bucket_html5_FA2, ht_bucket_html5_FA3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_FA9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_FB0, ht_bucket_html5_FB1, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_FB4, ht_bucket_html5_FB5, ht_bucket_html5_FB6, ht_bucket_html5_FB7, + ht_bucket_empty, ht_bucket_html5_FB9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_FBC, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_FC2, ht_bucket_empty, + ht_bucket_html5_FC4, ht_bucket_empty, ht_bucket_html5_FC6, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_FCA, ht_bucket_empty, + ht_bucket_html5_FCC, ht_bucket_empty, ht_bucket_html5_FCE, ht_bucket_html5_FCF, + ht_bucket_html5_FD0, ht_bucket_empty, ht_bucket_html5_FD2, ht_bucket_html5_FD3, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_FD6, ht_bucket_html5_FD7, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_FDD, ht_bucket_empty, ht_bucket_html5_FDF, + ht_bucket_empty, ht_bucket_html5_FE1, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html5_FE6, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_FE9, ht_bucket_html5_FEA, ht_bucket_html5_FEB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html5_FF5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_FF8, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html5_FFC, ht_bucket_empty, ht_bucket_html5_FFE, ht_bucket_empty, +}; + +static const entity_ht ent_ht_html5 = { + 0x1000, + ht_buckets_html5 +}; + +/* end of HTML5 hash table for entity -> codepoint }}} */ + +/* {{{ Start of HTML 4.01 multi-stage table for codepoint -> entity */ + +/* {{{ Stage 3 Tables for HTML 4.01 */ + +static const entity_stage3_row stage3_table_html4_00000[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"quot", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"amp", 3} } }, {0, { {"#039", 4} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"lt", 2} } }, {0, { {NULL, 0} } }, {0, { {"gt", 2} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_00080[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"nbsp", 4} } }, {0, { {"iexcl", 5} } }, {0, { {"cent", 4} } }, {0, { {"pound", 5} } }, + {0, { {"curren", 6} } }, {0, { {"yen", 3} } }, {0, { {"brvbar", 6} } }, {0, { {"sect", 4} } }, + {0, { {"uml", 3} } }, {0, { {"copy", 4} } }, {0, { {"ordf", 4} } }, {0, { {"laquo", 5} } }, + {0, { {"not", 3} } }, {0, { {"shy", 3} } }, {0, { {"reg", 3} } }, {0, { {"macr", 4} } }, + {0, { {"deg", 3} } }, {0, { {"plusmn", 6} } }, {0, { {"sup2", 4} } }, {0, { {"sup3", 4} } }, + {0, { {"acute", 5} } }, {0, { {"micro", 5} } }, {0, { {"para", 4} } }, {0, { {"middot", 6} } }, + {0, { {"cedil", 5} } }, {0, { {"sup1", 4} } }, {0, { {"ordm", 4} } }, {0, { {"raquo", 5} } }, + {0, { {"frac14", 6} } }, {0, { {"frac12", 6} } }, {0, { {"frac34", 6} } }, {0, { {"iquest", 6} } }, +}; + +static const entity_stage3_row stage3_table_html4_000C0[] = { + {0, { {"Agrave", 6} } }, {0, { {"Aacute", 6} } }, {0, { {"Acirc", 5} } }, {0, { {"Atilde", 6} } }, + {0, { {"Auml", 4} } }, {0, { {"Aring", 5} } }, {0, { {"AElig", 5} } }, {0, { {"Ccedil", 6} } }, + {0, { {"Egrave", 6} } }, {0, { {"Eacute", 6} } }, {0, { {"Ecirc", 5} } }, {0, { {"Euml", 4} } }, + {0, { {"Igrave", 6} } }, {0, { {"Iacute", 6} } }, {0, { {"Icirc", 5} } }, {0, { {"Iuml", 4} } }, + {0, { {"ETH", 3} } }, {0, { {"Ntilde", 6} } }, {0, { {"Ograve", 6} } }, {0, { {"Oacute", 6} } }, + {0, { {"Ocirc", 5} } }, {0, { {"Otilde", 6} } }, {0, { {"Ouml", 4} } }, {0, { {"times", 5} } }, + {0, { {"Oslash", 6} } }, {0, { {"Ugrave", 6} } }, {0, { {"Uacute", 6} } }, {0, { {"Ucirc", 5} } }, + {0, { {"Uuml", 4} } }, {0, { {"Yacute", 6} } }, {0, { {"THORN", 5} } }, {0, { {"szlig", 5} } }, + {0, { {"agrave", 6} } }, {0, { {"aacute", 6} } }, {0, { {"acirc", 5} } }, {0, { {"atilde", 6} } }, + {0, { {"auml", 4} } }, {0, { {"aring", 5} } }, {0, { {"aelig", 5} } }, {0, { {"ccedil", 6} } }, + {0, { {"egrave", 6} } }, {0, { {"eacute", 6} } }, {0, { {"ecirc", 5} } }, {0, { {"euml", 4} } }, + {0, { {"igrave", 6} } }, {0, { {"iacute", 6} } }, {0, { {"icirc", 5} } }, {0, { {"iuml", 4} } }, + {0, { {"eth", 3} } }, {0, { {"ntilde", 6} } }, {0, { {"ograve", 6} } }, {0, { {"oacute", 6} } }, + {0, { {"ocirc", 5} } }, {0, { {"otilde", 6} } }, {0, { {"ouml", 4} } }, {0, { {"divide", 6} } }, + {0, { {"oslash", 6} } }, {0, { {"ugrave", 6} } }, {0, { {"uacute", 6} } }, {0, { {"ucirc", 5} } }, + {0, { {"uuml", 4} } }, {0, { {"yacute", 6} } }, {0, { {"thorn", 5} } }, {0, { {"yuml", 4} } }, +}; + +static const entity_stage3_row stage3_table_html4_00140[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"OElig", 5} } }, {0, { {"oelig", 5} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"Scaron", 6} } }, {0, { {"scaron", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"Yuml", 4} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_00180[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"fnof", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_002C0[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"circ", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"tilde", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_00380[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"Alpha", 5} } }, {0, { {"Beta", 4} } }, {0, { {"Gamma", 5} } }, + {0, { {"Delta", 5} } }, {0, { {"Epsilon", 7} } }, {0, { {"Zeta", 4} } }, {0, { {"Eta", 3} } }, + {0, { {"Theta", 5} } }, {0, { {"Iota", 4} } }, {0, { {"Kappa", 5} } }, {0, { {"Lambda", 6} } }, + {0, { {"Mu", 2} } }, {0, { {"Nu", 2} } }, {0, { {"Xi", 2} } }, {0, { {"Omicron", 7} } }, + {0, { {"Pi", 2} } }, {0, { {"Rho", 3} } }, {0, { {NULL, 0} } }, {0, { {"Sigma", 5} } }, + {0, { {"Tau", 3} } }, {0, { {"Upsilon", 7} } }, {0, { {"Phi", 3} } }, {0, { {"Chi", 3} } }, + {0, { {"Psi", 3} } }, {0, { {"Omega", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"alpha", 5} } }, {0, { {"beta", 4} } }, {0, { {"gamma", 5} } }, + {0, { {"delta", 5} } }, {0, { {"epsilon", 7} } }, {0, { {"zeta", 4} } }, {0, { {"eta", 3} } }, + {0, { {"theta", 5} } }, {0, { {"iota", 4} } }, {0, { {"kappa", 5} } }, {0, { {"lambda", 6} } }, + {0, { {"mu", 2} } }, {0, { {"nu", 2} } }, {0, { {"xi", 2} } }, {0, { {"omicron", 7} } }, +}; + +static const entity_stage3_row stage3_table_html4_003C0[] = { + {0, { {"pi", 2} } }, {0, { {"rho", 3} } }, {0, { {"sigmaf", 6} } }, {0, { {"sigma", 5} } }, + {0, { {"tau", 3} } }, {0, { {"upsilon", 7} } }, {0, { {"phi", 3} } }, {0, { {"chi", 3} } }, + {0, { {"psi", 3} } }, {0, { {"omega", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"thetasym", 8} } }, {0, { {"upsih", 5} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"piv", 3} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_02000[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"ensp", 4} } }, {0, { {"emsp", 4} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"thinsp", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"zwnj", 4} } }, {0, { {"zwj", 3} } }, {0, { {"lrm", 3} } }, {0, { {"rlm", 3} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"ndash", 5} } }, + {0, { {"mdash", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"lsquo", 5} } }, {0, { {"rsquo", 5} } }, {0, { {"sbquo", 5} } }, {0, { {NULL, 0} } }, + {0, { {"ldquo", 5} } }, {0, { {"rdquo", 5} } }, {0, { {"bdquo", 5} } }, {0, { {NULL, 0} } }, + {0, { {"dagger", 6} } }, {0, { {"Dagger", 6} } }, {0, { {"bull", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"hellip", 6} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"permil", 6} } }, {0, { {NULL, 0} } }, {0, { {"prime", 5} } }, {0, { {"Prime", 5} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"lsaquo", 6} } }, {0, { {"rsaquo", 6} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"oline", 5} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_02040[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"frasl", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_02080[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"euro", 4} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_02100[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"image", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"weierp", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"real", 4} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"trade", 5} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"alefsym", 7} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_02180[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"larr", 4} } }, {0, { {"uarr", 4} } }, {0, { {"rarr", 4} } }, {0, { {"darr", 4} } }, + {0, { {"harr", 4} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"crarr", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_021C0[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"lArr", 4} } }, {0, { {"uArr", 4} } }, {0, { {"rArr", 4} } }, {0, { {"dArr", 4} } }, + {0, { {"hArr", 4} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_02200[] = { + {0, { {"forall", 6} } }, {0, { {NULL, 0} } }, {0, { {"part", 4} } }, {0, { {"exist", 5} } }, + {0, { {NULL, 0} } }, {0, { {"empty", 5} } }, {0, { {NULL, 0} } }, {0, { {"nabla", 5} } }, + {0, { {"isin", 4} } }, {0, { {"notin", 5} } }, {0, { {NULL, 0} } }, {0, { {"ni", 2} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"prod", 4} } }, + {0, { {NULL, 0} } }, {0, { {"sum", 3} } }, {0, { {"minus", 5} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"lowast", 6} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"radic", 5} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"prop", 4} } }, {0, { {"infin", 5} } }, {0, { {NULL, 0} } }, + {0, { {"ang", 3} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"and", 3} } }, + {0, { {"or", 2} } }, {0, { {"cap", 3} } }, {0, { {"cup", 3} } }, {0, { {"int", 3} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"there4", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"sim", 3} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_02240[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"cong", 4} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"asymp", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"ne", 2} } }, {0, { {"equiv", 5} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"le", 2} } }, {0, { {"ge", 2} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_02280[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"sub", 3} } }, {0, { {"sup", 3} } }, + {0, { {"nsub", 4} } }, {0, { {NULL, 0} } }, {0, { {"sube", 4} } }, {0, { {"supe", 4} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"oplus", 5} } }, {0, { {NULL, 0} } }, {0, { {"otimes", 6} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"perp", 4} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_022C0[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"sdot", 4} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_02300[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"lceil", 5} } }, {0, { {"rceil", 5} } }, {0, { {"lfloor", 6} } }, {0, { {"rfloor", 6} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {"lang", 4} } }, {0, { {"rang", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_025C0[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"loz", 3} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +static const entity_stage3_row stage3_table_html4_02640[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"spades", 6} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"clubs", 5} } }, + {0, { {NULL, 0} } }, {0, { {"hearts", 6} } }, {0, { {"diams", 5} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, +}; + +/* end of stage 3 Tables for HTML 4.01 }}} */ + +/* {{{ Stage 2 Tables for HTML 4.01 */ + +static const entity_stage2_row stage2_table_html4_00000[] = { + stage3_table_html4_00000, empty_stage3_table, stage3_table_html4_00080, stage3_table_html4_000C0, + empty_stage3_table, stage3_table_html4_00140, stage3_table_html4_00180, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, stage3_table_html4_002C0, + empty_stage3_table, empty_stage3_table, stage3_table_html4_00380, stage3_table_html4_003C0, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, +}; + +static const entity_stage2_row stage2_table_html4_02000[] = { + stage3_table_html4_02000, stage3_table_html4_02040, stage3_table_html4_02080, empty_stage3_table, + stage3_table_html4_02100, empty_stage3_table, stage3_table_html4_02180, stage3_table_html4_021C0, + stage3_table_html4_02200, stage3_table_html4_02240, stage3_table_html4_02280, stage3_table_html4_022C0, + stage3_table_html4_02300, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, stage3_table_html4_025C0, + empty_stage3_table, stage3_table_html4_02640, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, + empty_stage3_table, empty_stage3_table, empty_stage3_table, empty_stage3_table, +}; + +/* end of stage 2 tables for HTML 4.01 }}} */ + +static const entity_stage1_row entity_ms_table_html4[] = { + stage2_table_html4_00000, + empty_stage2_table, + stage2_table_html4_02000, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, + empty_stage2_table, +}; + +/* end of HTML 4.01 multi-stage table for codepoint -> entity }}} */ + +/* {{{ HTML 4.01 hash table for entity -> codepoint */ + +static const entity_cp_map ht_bucket_html4_000[] = { {"gt", 2, 0x0003E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_003[] = { {"Igrave", 6, 0x000CC, 0}, {"amp", 3, 0x00026, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_006[] = { {"oacute", 6, 0x000F3, 0}, {"Xi", 2, 0x0039E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_008[] = { {"uuml", 4, 0x000FC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_00B[] = { {"Alpha", 5, 0x00391, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_00E[] = { {"sim", 3, 0x0223C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_012[] = { {"kappa", 5, 0x003BA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_016[] = { {"lArr", 4, 0x021D0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_018[] = { {"and", 3, 0x02227, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_01B[] = { {"ang", 3, 0x02220, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_020[] = { {"copy", 4, 0x000A9, 0}, {"Iacute", 6, 0x000CD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_023[] = { {"igrave", 6, 0x000EC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_026[] = { {"xi", 2, 0x003BE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_027[] = { {"Acirc", 5, 0x000C2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_02B[] = { {"Ecirc", 5, 0x000CA, 0}, {"alpha", 5, 0x003B1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_02C[] = { {"hearts", 6, 0x02665, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_02F[] = { {"Icirc", 5, 0x000CE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_030[] = { {"Yacute", 6, 0x000DD, 0}, {"int", 3, 0x0222B, 0}, {"rlm", 3, 0x0200F, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_034[] = { {"empty", 5, 0x02205, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_036[] = { {"larr", 4, 0x02190, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_03B[] = { {"Ucirc", 5, 0x000DB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_03C[] = { {"oline", 5, 0x0203E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_040[] = { {"iacute", 6, 0x000ED, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_046[] = { {"middot", 6, 0x000B7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_047[] = { {"acirc", 5, 0x000E2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_04B[] = { {"ecirc", 5, 0x000EA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_04F[] = { {"icirc", 5, 0x000EE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_050[] = { {"yacute", 6, 0x000FD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_051[] = { {"minus", 5, 0x02212, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_054[] = { {"Auml", 4, 0x000C4, 0}, {"thetasym", 8, 0x003D1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_056[] = { {"Sigma", 5, 0x003A3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_059[] = { {"lsquo", 5, 0x02018, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_05B[] = { {"ucirc", 5, 0x000FB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_05C[] = { {"rArr", 4, 0x021D2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_064[] = { {"brvbar", 6, 0x000A6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_067[] = { {"AElig", 5, 0x000C6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_069[] = { {"Ccedil", 6, 0x000C7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_071[] = { {"Psi", 3, 0x003A8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_072[] = { {"exist", 5, 0x02203, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_074[] = { {"auml", 4, 0x000E4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_076[] = { {"sigma", 5, 0x003C3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_078[] = { {"isin", 4, 0x02208, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_07C[] = { {"rarr", 4, 0x02192, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_089[] = { {"ccedil", 6, 0x000E7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_08D[] = { {"raquo", 5, 0x000BB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_08E[] = { {"Omega", 5, 0x003A9, 0}, {"zwnj", 4, 0x0200C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_091[] = { {"psi", 3, 0x003C8, 0}, {"there4", 6, 0x02234, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_092[] = { {"hArr", 4, 0x021D4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_096[] = { {"le", 2, 0x02264, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_098[] = { {"Atilde", 6, 0x000C3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_099[] = { {"Zeta", 4, 0x00396, 0}, {"infin", 5, 0x0221E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_09D[] = { {"frasl", 5, 0x02044, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0A0[] = { {"euro", 4, 0x020AC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0A5[] = { {"lt", 2, 0x0003C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0A7[] = { {"aelig", 5, 0x000E6, 0}, {"Mu", 2, 0x0039C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0A8[] = { {"macr", 4, 0x000AF, 0}, {"image", 5, 0x02111, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0AA[] = { {"ldquo", 5, 0x0201C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0AE[] = { {"omega", 5, 0x003C9, 0}, {"upsih", 5, 0x003D2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0B0[] = { {"THORN", 5, 0x000DE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0B2[] = { {"Iota", 4, 0x00399, 0}, {"harr", 4, 0x02194, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0B4[] = { {"bull", 4, 0x02022, 0}, {"rceil", 5, 0x02309, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0B8[] = { {"atilde", 6, 0x000E3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0B9[] = { {"zeta", 4, 0x003B6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0BA[] = { {"emsp", 4, 0x02003, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0BC[] = { {"perp", 4, 0x022A5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0C2[] = { {"Prime", 5, 0x02033, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0C4[] = { {"frac12", 6, 0x000BD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0C5[] = { {"Ntilde", 6, 0x000D1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0C6[] = { {"frac14", 6, 0x000BC, 0}, {"circ", 4, 0x002C6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0C7[] = { {"mu", 2, 0x003BC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0C8[] = { {"Gamma", 5, 0x00393, 0}, {"Nu", 2, 0x0039D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0CE[] = { {"fnof", 4, 0x00192, 0}, {"quot", 4, 0x00022, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0D2[] = { {"iota", 4, 0x003B9, 0}, {"mdash", 5, 0x02014, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0D8[] = { {"ne", 2, 0x02260, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0DB[] = { {"Theta", 5, 0x00398, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0DC[] = { {"ni", 2, 0x0220B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0E2[] = { {"prime", 5, 0x02032, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0E5[] = { {"ntilde", 6, 0x000F1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0E6[] = { {"Lambda", 6, 0x0039B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0E8[] = { {"gamma", 5, 0x003B3, 0}, {"nu", 2, 0x003BD, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0EB[] = { {"pound", 5, 0x000A3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0EE[] = { {"permil", 6, 0x02030, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0F9[] = { {"cap", 3, 0x02229, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0FA[] = { {"iexcl", 5, 0x000A1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0FB[] = { {"Agrave", 6, 0x000C0, 0}, {"theta", 5, 0x003B8, 0}, {"ensp", 4, 0x02002, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0FE[] = { {"Pi", 2, 0x003A0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_0FF[] = { {"crarr", 5, 0x021B5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_100[] = { {"iquest", 6, 0x000BF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_105[] = { {"forall", 6, 0x02200, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_106[] = { {"Phi", 3, 0x003A6, 0}, {"lambda", 6, 0x003BB, 0}, {"or", 2, 0x02228, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_108[] = { {"frac34", 6, 0x000BE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_10D[] = { {"notin", 5, 0x02209, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_10E[] = { {"dArr", 4, 0x021D3, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_10F[] = { {"Dagger", 6, 0x02021, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_111[] = { {"yen", 3, 0x000A5, 0}, {"weierp", 6, 0x02118, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_113[] = { {"uml", 3, 0x000A8, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_117[] = { {"tilde", 5, 0x002DC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_118[] = { {"Aacute", 6, 0x000C1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_11A[] = { {"loz", 3, 0x025CA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_11B[] = { {"agrave", 6, 0x000E0, 0}, {"thinsp", 6, 0x02009, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_11E[] = { {"pi", 2, 0x003C0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_11F[] = { {"micro", 5, 0x000B5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_125[] = { {"spades", 6, 0x02660, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_126[] = { {"phi", 3, 0x003C6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_12E[] = { {"darr", 4, 0x02193, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_12F[] = { {"Oslash", 6, 0x000D8, 0}, {"Tau", 3, 0x003A4, 0}, {"dagger", 6, 0x02020, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_135[] = { {"Ocirc", 5, 0x000D4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_136[] = { {"alefsym", 7, 0x02135, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_138[] = { {"aacute", 6, 0x000E1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_13A[] = { {"divide", 6, 0x000F7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_13F[] = { {"sdot", 4, 0x022C5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_143[] = { {"reg", 3, 0x000AE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_149[] = { {"real", 4, 0x0211C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_14B[] = { {"Scaron", 6, 0x00160, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_14F[] = { {"cent", 4, 0x000A2, 0}, {"oslash", 6, 0x000F8, 0}, {"tau", 3, 0x003C4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_150[] = { {"thorn", 5, 0x000FE, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_153[] = { {"ndash", 5, 0x02013, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_154[] = { {"piv", 3, 0x003D6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_155[] = { {"ocirc", 5, 0x000F4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_156[] = { {"Aring", 5, 0x000C5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_158[] = { {"nbsp", 4, 0x000A0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_15C[] = { {"Iuml", 4, 0x000CF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_15F[] = { {"rsquo", 5, 0x02019, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_160[] = { {"rsaquo", 6, 0x0203A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_163[] = { {"hellip", 6, 0x02026, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_166[] = { {"Otilde", 6, 0x000D5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_16B[] = { {"scaron", 6, 0x00161, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_16C[] = { {"Yuml", 4, 0x00178, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_16E[] = { {"sup1", 4, 0x000B9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_16F[] = { {"sup2", 4, 0x000B2, 0}, {"Delta", 5, 0x00394, 0}, {"sbquo", 5, 0x0201A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_170[] = { {"sup3", 4, 0x000B3, 0}, {"lrm", 3, 0x0200E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_173[] = { {"diams", 5, 0x02666, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_175[] = { {"OElig", 5, 0x00152, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_176[] = { {"aring", 5, 0x000E5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_178[] = { {"oplus", 5, 0x02295, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_17C[] = { {"iuml", 4, 0x000EF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_17F[] = { {"Egrave", 6, 0x000C8, 0}, {"uArr", 4, 0x021D1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_181[] = { {"Beta", 4, 0x00392, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_183[] = { {"nabla", 5, 0x02207, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_186[] = { {"ETH", 3, 0x000D0, 0}, {"otilde", 6, 0x000F5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_187[] = { {"laquo", 5, 0x000AB, 0}, {"times", 5, 0x000D7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_18C[] = { {"yuml", 4, 0x000FF, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_18D[] = { {"cup", 3, 0x0222A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_18E[] = { {"Rho", 3, 0x003A1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_18F[] = { {"Ugrave", 6, 0x000D9, 0}, {"delta", 5, 0x003B4, 0}, {"equiv", 5, 0x02261, 0}, {"sub", 3, 0x02282, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_194[] = { {"curren", 6, 0x000A4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_196[] = { {"not", 3, 0x000AC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_197[] = { {"acute", 5, 0x000B4, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_19A[] = { {"prod", 4, 0x0220F, 0}, {"sum", 3, 0x02211, 0}, {"lsaquo", 6, 0x02039, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_19C[] = { {"Eacute", 6, 0x000C9, 0}, {"Omicron", 7, 0x0039F, 0}, {"sigmaf", 6, 0x003C2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_19D[] = { {"sup", 3, 0x02283, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_19F[] = { {"egrave", 6, 0x000E8, 0}, {"uarr", 4, 0x02191, 0}, {"lowast", 6, 0x02217, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1A0[] = { {"zwj", 3, 0x0200D, 0}, {"bdquo", 5, 0x0201E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1A1[] = { {"beta", 4, 0x003B2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1A2[] = { {"Ouml", 4, 0x000D6, 0}, {"supe", 4, 0x02287, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1A4[] = { {"plusmn", 6, 0x000B1, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1A6[] = { {"cedil", 5, 0x000B8, 0}, {"prop", 4, 0x0221D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1A7[] = { {"lang", 4, 0x02329, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1A8[] = { {"radic", 5, 0x0221A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1A9[] = { {"para", 4, 0x000B6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1AC[] = { {"Uacute", 6, 0x000DA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1AE[] = { {"szlig", 5, 0x000DF, 0}, {"rho", 3, 0x003C1, 0}, {"lceil", 5, 0x02308, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1AF[] = { {"ugrave", 6, 0x000F9, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1B0[] = { {"rdquo", 5, 0x0201D, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1B5[] = { {"deg", 3, 0x000B0, 0}, {"trade", 5, 0x02122, 0}, {"oelig", 5, 0x00153, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1B9[] = { {"Chi", 3, 0x003A7, 0}, {"rfloor", 6, 0x0230B, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1BC[] = { {"eacute", 6, 0x000E9, 0}, {"omicron", 7, 0x003BF, 0}, {"part", 4, 0x02202, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1BE[] = { {"clubs", 5, 0x02663, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1BF[] = { {"Epsilon", 7, 0x00395, 0}, {"Eta", 3, 0x00397, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1C2[] = { {"ouml", 4, 0x000F6, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1C4[] = { {"#039", 4, 0x00027, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1C9[] = { {"Ograve", 6, 0x000D2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1CC[] = { {"uacute", 6, 0x000FA, 0}, {"cong", 4, 0x02245, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1CF[] = { {"Upsilon", 7, 0x003A5, 0}, {"asymp", 5, 0x02248, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1D0[] = { {"ordf", 4, 0x000AA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1D4[] = { {"sube", 4, 0x02286, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1D7[] = { {"ordm", 4, 0x000BA, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1D8[] = { {"Euml", 4, 0x000CB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1D9[] = { {"chi", 3, 0x003C7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1DD[] = { {"nsub", 4, 0x02284, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1DF[] = { {"epsilon", 7, 0x003B5, 0}, {"eta", 3, 0x003B7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1E6[] = { {"Oacute", 6, 0x000D3, 0}, {"eth", 3, 0x000F0, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1E8[] = { {"Uuml", 4, 0x000DC, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1E9[] = { {"ograve", 6, 0x000F2, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1ED[] = { {"rang", 4, 0x0232A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1EF[] = { {"upsilon", 7, 0x003C5, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1F1[] = { {"ge", 2, 0x02265, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1F2[] = { {"Kappa", 5, 0x0039A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1F3[] = { {"lfloor", 6, 0x0230A, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1F4[] = { {"sect", 4, 0x000A7, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1F6[] = { {"otimes", 6, 0x02297, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1F8[] = { {"euml", 4, 0x000EB, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_html4_1F9[] = { {"shy", 3, 0x000AD, 0}, {NULL, 0, 0, 0} }; + +static const entity_cp_map *const ht_buckets_html4[] = { + ht_bucket_html4_000, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_003, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_006, ht_bucket_empty, + ht_bucket_html4_008, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_00B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_00E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_012, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_016, ht_bucket_empty, + ht_bucket_html4_018, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_01B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_020, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_023, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_026, ht_bucket_html4_027, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_02B, + ht_bucket_html4_02C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_02F, + ht_bucket_html4_030, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_034, ht_bucket_empty, ht_bucket_html4_036, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_03B, + ht_bucket_html4_03C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_040, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_046, ht_bucket_html4_047, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_04B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_04F, + ht_bucket_html4_050, ht_bucket_html4_051, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_054, ht_bucket_empty, ht_bucket_html4_056, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_059, ht_bucket_empty, ht_bucket_html4_05B, + ht_bucket_html4_05C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_064, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_067, + ht_bucket_empty, ht_bucket_html4_069, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_071, ht_bucket_html4_072, ht_bucket_empty, + ht_bucket_html4_074, ht_bucket_empty, ht_bucket_html4_076, ht_bucket_empty, + ht_bucket_html4_078, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_07C, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_089, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_08D, ht_bucket_html4_08E, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_091, ht_bucket_html4_092, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_096, ht_bucket_empty, + ht_bucket_html4_098, ht_bucket_html4_099, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_09D, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_0A0, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_0A5, ht_bucket_empty, ht_bucket_html4_0A7, + ht_bucket_html4_0A8, ht_bucket_empty, ht_bucket_html4_0AA, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_0AE, ht_bucket_empty, + ht_bucket_html4_0B0, ht_bucket_empty, ht_bucket_html4_0B2, ht_bucket_empty, + ht_bucket_html4_0B4, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_0B8, ht_bucket_html4_0B9, ht_bucket_html4_0BA, ht_bucket_empty, + ht_bucket_html4_0BC, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_0C2, ht_bucket_empty, + ht_bucket_html4_0C4, ht_bucket_html4_0C5, ht_bucket_html4_0C6, ht_bucket_html4_0C7, + ht_bucket_html4_0C8, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_0CE, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_0D2, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_0D8, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_0DB, + ht_bucket_html4_0DC, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_0E2, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_0E5, ht_bucket_html4_0E6, ht_bucket_empty, + ht_bucket_html4_0E8, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_0EB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_0EE, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_0F9, ht_bucket_html4_0FA, ht_bucket_html4_0FB, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_0FE, ht_bucket_html4_0FF, + ht_bucket_html4_100, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_105, ht_bucket_html4_106, ht_bucket_empty, + ht_bucket_html4_108, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_10D, ht_bucket_html4_10E, ht_bucket_html4_10F, + ht_bucket_empty, ht_bucket_html4_111, ht_bucket_empty, ht_bucket_html4_113, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_117, + ht_bucket_html4_118, ht_bucket_empty, ht_bucket_html4_11A, ht_bucket_html4_11B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_11E, ht_bucket_html4_11F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_125, ht_bucket_html4_126, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_12E, ht_bucket_html4_12F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_135, ht_bucket_html4_136, ht_bucket_empty, + ht_bucket_html4_138, ht_bucket_empty, ht_bucket_html4_13A, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_13F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_143, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_149, ht_bucket_empty, ht_bucket_html4_14B, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_14F, + ht_bucket_html4_150, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_153, + ht_bucket_html4_154, ht_bucket_html4_155, ht_bucket_html4_156, ht_bucket_empty, + ht_bucket_html4_158, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_15C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_15F, + ht_bucket_html4_160, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_163, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_166, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_16B, + ht_bucket_html4_16C, ht_bucket_empty, ht_bucket_html4_16E, ht_bucket_html4_16F, + ht_bucket_html4_170, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_173, + ht_bucket_empty, ht_bucket_html4_175, ht_bucket_html4_176, ht_bucket_empty, + ht_bucket_html4_178, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_17C, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_17F, + ht_bucket_empty, ht_bucket_html4_181, ht_bucket_empty, ht_bucket_html4_183, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_186, ht_bucket_html4_187, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_18C, ht_bucket_html4_18D, ht_bucket_html4_18E, ht_bucket_html4_18F, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_194, ht_bucket_empty, ht_bucket_html4_196, ht_bucket_html4_197, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_19A, ht_bucket_empty, + ht_bucket_html4_19C, ht_bucket_html4_19D, ht_bucket_empty, ht_bucket_html4_19F, + ht_bucket_html4_1A0, ht_bucket_html4_1A1, ht_bucket_html4_1A2, ht_bucket_empty, + ht_bucket_html4_1A4, ht_bucket_empty, ht_bucket_html4_1A6, ht_bucket_html4_1A7, + ht_bucket_html4_1A8, ht_bucket_html4_1A9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_1AC, ht_bucket_empty, ht_bucket_html4_1AE, ht_bucket_html4_1AF, + ht_bucket_html4_1B0, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_1B5, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_1B9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_1BC, ht_bucket_empty, ht_bucket_html4_1BE, ht_bucket_html4_1BF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_1C2, ht_bucket_empty, + ht_bucket_html4_1C4, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_1C9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_1CC, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_1CF, + ht_bucket_html4_1D0, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_html4_1D4, ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_1D7, + ht_bucket_html4_1D8, ht_bucket_html4_1D9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_1DD, ht_bucket_empty, ht_bucket_html4_1DF, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_html4_1E6, ht_bucket_empty, + ht_bucket_html4_1E8, ht_bucket_html4_1E9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_html4_1ED, ht_bucket_empty, ht_bucket_html4_1EF, + ht_bucket_empty, ht_bucket_html4_1F1, ht_bucket_html4_1F2, ht_bucket_html4_1F3, + ht_bucket_html4_1F4, ht_bucket_empty, ht_bucket_html4_1F6, ht_bucket_empty, + ht_bucket_html4_1F8, ht_bucket_html4_1F9, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, +}; + +static const entity_ht ent_ht_html4 = { + 0x200, + ht_buckets_html4 +}; + +/* end of HTML 4.01 hash table for entity -> codepoint }}} */ + +/* {{{ Start of Basic entities (no apos) table for codepoint -> entity */ + +static const entity_stage3_row stage3_table_be_noapos_00000[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"quot", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"amp", 3} } }, {0, { {"#039", 4} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"lt", 2} } }, {0, { {NULL, 0} } }, {0, { {"gt", 2} } }, {0, { {NULL, 0} } }, +}; + +/* {{{ Basic entities (no apos) hash table for entity -> codepoint */ + +static const entity_cp_map ht_bucket_be_noapos_000[] = { {"gt", 2, 0x0003E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_be_noapos_003[] = { {"amp", 3, 0x00026, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_be_noapos_004[] = { {"#039", 4, 0x00027, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_be_noapos_005[] = { {"lt", 2, 0x0003C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_be_noapos_00E[] = { {"quot", 4, 0x00022, 0}, {NULL, 0, 0, 0} }; + +static const entity_cp_map *const ht_buckets_be_noapos[] = { + ht_bucket_be_noapos_000, ht_bucket_empty, ht_bucket_empty, ht_bucket_be_noapos_003, + ht_bucket_be_noapos_004, ht_bucket_be_noapos_005, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_be_noapos_00E, ht_bucket_empty, +}; + +static const entity_ht ent_ht_be_noapos = { + 0x10, + ht_buckets_be_noapos +}; + +/* end of Basic entities (no apos) hash table for entity -> codepoint }}} */ + +/* {{{ Start of Basic entities (with apos) table for codepoint -> entity */ + +static const entity_stage3_row stage3_table_be_apos_00000[] = { + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"quot", 4} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"amp", 3} } }, {0, { {"apos", 4} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, + {0, { {"lt", 2} } }, {0, { {NULL, 0} } }, {0, { {"gt", 2} } }, {0, { {NULL, 0} } }, +}; + +/* {{{ Basic entities (with apos) hash table for entity -> codepoint */ + +static const entity_cp_map ht_bucket_be_apos_000[] = { {"gt", 2, 0x0003E, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_be_apos_003[] = { {"amp", 3, 0x00026, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_be_apos_005[] = { {"lt", 2, 0x0003C, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_be_apos_008[] = { {"apos", 4, 0x00027, 0}, {NULL, 0, 0, 0} }; +static const entity_cp_map ht_bucket_be_apos_00E[] = { {"quot", 4, 0x00022, 0}, {NULL, 0, 0, 0} }; + +static const entity_cp_map *const ht_buckets_be_apos[] = { + ht_bucket_be_apos_000, ht_bucket_empty, ht_bucket_empty, ht_bucket_be_apos_003, + ht_bucket_empty, ht_bucket_be_apos_005, ht_bucket_empty, ht_bucket_empty, + ht_bucket_be_apos_008, ht_bucket_empty, ht_bucket_empty, ht_bucket_empty, + ht_bucket_empty, ht_bucket_empty, ht_bucket_be_apos_00E, ht_bucket_empty, +}; + +static const entity_ht ent_ht_be_apos = { + 0x10, + ht_buckets_be_apos +}; + +/* end of Basic entities (with apos) hash table for entity -> codepoint }}} */ + +#endif /* HTML_TABLES_H */ diff --git a/ext/standard/html_tables/ents_basic.txt b/ext/standard/html_tables/ents_basic.txt new file mode 100644 index 0000000..3a2ec93 --- /dev/null +++ b/ext/standard/html_tables/ents_basic.txt @@ -0,0 +1,5 @@ +quot 22 +amp 26 +#039 27 +lt 3C +gt 3E diff --git a/ext/standard/html_tables/ents_basic_apos.txt b/ext/standard/html_tables/ents_basic_apos.txt new file mode 100644 index 0000000..6a0f307 --- /dev/null +++ b/ext/standard/html_tables/ents_basic_apos.txt @@ -0,0 +1,5 @@ +quot 22 +amp 26 +apos 27 +lt 3C +gt 3E diff --git a/ext/standard/html_tables/ents_html401.txt b/ext/standard/html_tables/ents_html401.txt new file mode 100644 index 0000000..7e1564b --- /dev/null +++ b/ext/standard/html_tables/ents_html401.txt @@ -0,0 +1,253 @@ +#039 0027 //artifical; there's no ' in HTML 4.01 +nbsp 00A0 +iexcl 00A1 +cent 00A2 +pound 00A3 +curren 00A4 +yen 00A5 +brvbar 00A6 +sect 00A7 +uml 00A8 +copy 00A9 +ordf 00AA +laquo 00AB +not 00AC +shy 00AD +reg 00AE +macr 00AF +deg 00B0 +plusmn 00B1 +sup2 00B2 +sup3 00B3 +acute 00B4 +micro 00B5 +para 00B6 +middot 00B7 +cedil 00B8 +sup1 00B9 +ordm 00BA +raquo 00BB +frac14 00BC +frac12 00BD +frac34 00BE +iquest 00BF +Agrave 00C0 +Aacute 00C1 +Acirc 00C2 +Atilde 00C3 +Auml 00C4 +Aring 00C5 +AElig 00C6 +Ccedil 00C7 +Egrave 00C8 +Eacute 00C9 +Ecirc 00CA +Euml 00CB +Igrave 00CC +Iacute 00CD +Icirc 00CE +Iuml 00CF +ETH 00D0 +Ntilde 00D1 +Ograve 00D2 +Oacute 00D3 +Ocirc 00D4 +Otilde 00D5 +Ouml 00D6 +times 00D7 +Oslash 00D8 +Ugrave 00D9 +Uacute 00DA +Ucirc 00DB +Uuml 00DC +Yacute 00DD +THORN 00DE +szlig 00DF +agrave 00E0 +aacute 00E1 +acirc 00E2 +atilde 00E3 +auml 00E4 +aring 00E5 +aelig 00E6 +ccedil 00E7 +egrave 00E8 +eacute 00E9 +ecirc 00EA +euml 00EB +igrave 00EC +iacute 00ED +icirc 00EE +iuml 00EF +eth 00F0 +ntilde 00F1 +ograve 00F2 +oacute 00F3 +ocirc 00F4 +otilde 00F5 +ouml 00F6 +divide 00F7 +oslash 00F8 +ugrave 00F9 +uacute 00FA +ucirc 00FB +uuml 00FC +yacute 00FD +thorn 00FE +yuml 00FF +fnof 0192 +Alpha 0391 +Beta 0392 +Gamma 0393 +Delta 0394 +Epsilon 0395 +Zeta 0396 +Eta 0397 +Theta 0398 +Iota 0399 +Kappa 039A +Lambda 039B +Mu 039C +Nu 039D +Xi 039E +Omicron 039F +Pi 03A0 +Rho 03A1 +Sigma 03A3 +Tau 03A4 +Upsilon 03A5 +Phi 03A6 +Chi 03A7 +Psi 03A8 +Omega 03A9 +alpha 03B1 +beta 03B2 +gamma 03B3 +delta 03B4 +epsilon 03B5 +zeta 03B6 +eta 03B7 +theta 03B8 +iota 03B9 +kappa 03BA +lambda 03BB +mu 03BC +nu 03BD +xi 03BE +omicron 03BF +pi 03C0 +rho 03C1 +sigmaf 03C2 +sigma 03C3 +tau 03C4 +upsilon 03C5 +phi 03C6 +chi 03C7 +psi 03C8 +omega 03C9 +thetasym 03D1 +upsih 03D2 +piv 03D6 +bull 2022 +hellip 2026 +prime 2032 +Prime 2033 +oline 203E +frasl 2044 +weierp 2118 +image 2111 +real 211C +trade 2122 +alefsym 2135 +larr 2190 +uarr 2191 +rarr 2192 +darr 2193 +harr 2194 +crarr 21B5 +lArr 21D0 +uArr 21D1 +rArr 21D2 +dArr 21D3 +hArr 21D4 +forall 2200 +part 2202 +exist 2203 +empty 2205 +nabla 2207 +isin 2208 +notin 2209 +ni 220B +prod 220F +sum 2211 +minus 2212 +lowast 2217 +radic 221A +prop 221D +infin 221E +ang 2220 +and 2227 +or 2228 +cap 2229 +cup 222A +int 222B +there4 2234 +sim 223C +cong 2245 +asymp 2248 +ne 2260 +equiv 2261 +le 2264 +ge 2265 +sub 2282 +sup 2283 +nsub 2284 +sube 2286 +supe 2287 +oplus 2295 +otimes 2297 +perp 22A5 +sdot 22C5 +lceil 2308 +rceil 2309 +lfloor 230A +rfloor 230B +lang 2329 +rang 232A +loz 25CA +spades 2660 +clubs 2663 +hearts 2665 +diams 2666 +quot 0022 +amp 0026 +lt 003C +gt 003E +OElig 0152 +oelig 0153 +Scaron 0160 +scaron 0161 +Yuml 0178 +circ 02C6 +tilde 02DC +ensp 2002 +emsp 2003 +thinsp 2009 +zwnj 200C +zwj 200D +lrm 200E +rlm 200F +ndash 2013 +mdash 2014 +lsquo 2018 +rsquo 2019 +sbquo 201A +ldquo 201C +rdquo 201D +bdquo 201E +dagger 2020 +Dagger 2021 +permil 2030 +lsaquo 2039 +rsaquo 203A +euro 20AC \ No newline at end of file diff --git a/ext/standard/html_tables/ents_html5.txt b/ext/standard/html_tables/ents_html5.txt new file mode 100644 index 0000000..18defb2 --- /dev/null +++ b/ext/standard/html_tables/ents_html5.txt @@ -0,0 +1,2125 @@ +AElig 000C6 +AMP 00026 +Aacute 000C1 +Abreve 00102 +Acirc 000C2 +Acy 00410 +Afr 1D504 +Agrave 000C0 +Alpha 00391 +Amacr 00100 +And 02A53 +Aogon 00104 +Aopf 1D538 +ApplyFunction 02061 +Aring 000C5 +Ascr 1D49C +Assign 02254 +Atilde 000C3 +Auml 000C4 +Backslash 02216 +Barv 02AE7 +Barwed 02306 +Bcy 00411 +Because 02235 +Bernoullis 0212C +Beta 00392 +Bfr 1D505 +Bopf 1D539 +Breve 002D8 +Bscr 0212C +Bumpeq 0224E +CHcy 00427 +COPY 000A9 +Cacute 00106 +Cap 022D2 +CapitalDifferentialD 02145 +Cayleys 0212D +Ccaron 0010C +Ccedil 000C7 +Ccirc 00108 +Cconint 02230 +Cdot 0010A +Cedilla 000B8 +CenterDot 000B7 +Cfr 0212D +Chi 003A7 +CircleDot 02299 +CircleMinus 02296 +CirclePlus 02295 +CircleTimes 02297 +ClockwiseContourIntegral 02232 +CloseCurlyDoubleQuote 0201D +CloseCurlyQuote 02019 +Colon 02237 +Colone 02A74 +Congruent 02261 +Conint 0222F +ContourIntegral 0222E +Copf 02102 +Coproduct 02210 +CounterClockwiseContourIntegral 02233 +Cross 02A2F +Cscr 1D49E +Cup 022D3 +CupCap 0224D +DD 02145 +DDotrahd 02911 +DJcy 00402 +DScy 00405 +DZcy 0040F +Dagger 02021 +Darr 021A1 +Dashv 02AE4 +Dcaron 0010E +Dcy 00414 +Del 02207 +Delta 00394 +Dfr 1D507 +DiacriticalAcute 000B4 +DiacriticalDot 002D9 +DiacriticalDoubleAcute 002DD +DiacriticalGrave 00060 +DiacriticalTilde 002DC +Diamond 022C4 +DifferentialD 02146 +Dopf 1D53B +Dot 000A8 +DotDot 020DC +DotEqual 02250 +DoubleContourIntegral 0222F +DoubleDot 000A8 +DoubleDownArrow 021D3 +DoubleLeftArrow 021D0 +DoubleLeftRightArrow 021D4 +DoubleLeftTee 02AE4 +DoubleLongLeftArrow 027F8 +DoubleLongLeftRightArrow 027FA +DoubleLongRightArrow 027F9 +DoubleRightArrow 021D2 +DoubleRightTee 022A8 +DoubleUpArrow 021D1 +DoubleUpDownArrow 021D5 +DoubleVerticalBar 02225 +DownArrow 02193 +DownArrowBar 02913 +DownArrowUpArrow 021F5 +DownBreve 00311 +DownLeftRightVector 02950 +DownLeftTeeVector 0295E +DownLeftVector 021BD +DownLeftVectorBar 02956 +DownRightTeeVector 0295F +DownRightVector 021C1 +DownRightVectorBar 02957 +DownTee 022A4 +DownTeeArrow 021A7 +Downarrow 021D3 +Dscr 1D49F +Dstrok 00110 +ENG 0014A +ETH 000D0 +Eacute 000C9 +Ecaron 0011A +Ecirc 000CA +Ecy 0042D +Edot 00116 +Efr 1D508 +Egrave 000C8 +Element 02208 +Emacr 00112 +EmptySmallSquare 025FB +EmptyVerySmallSquare 025AB +Eogon 00118 +Eopf 1D53C +Epsilon 00395 +Equal 02A75 +EqualTilde 02242 +Equilibrium 021CC +Escr 02130 +Esim 02A73 +Eta 00397 +Euml 000CB +Exists 02203 +ExponentialE 02147 +Fcy 00424 +Ffr 1D509 +FilledSmallSquare 025FC +FilledVerySmallSquare 025AA +Fopf 1D53D +ForAll 02200 +Fouriertrf 02131 +Fscr 02131 +GJcy 00403 +GT 0003E +Gamma 00393 +Gammad 003DC +Gbreve 0011E +Gcedil 00122 +Gcirc 0011C +Gcy 00413 +Gdot 00120 +Gfr 1D50A +Gg 022D9 +Gopf 1D53E +GreaterEqual 02265 +GreaterEqualLess 022DB +GreaterFullEqual 02267 +GreaterGreater 02AA2 +GreaterLess 02277 +GreaterSlantEqual 02A7E +GreaterTilde 02273 +Gscr 1D4A2 +Gt 0226B +HARDcy 0042A +Hacek 002C7 +Hat 0005E +Hcirc 00124 +Hfr 0210C +HilbertSpace 0210B +Hopf 0210D +HorizontalLine 02500 +Hscr 0210B +Hstrok 00126 +HumpDownHump 0224E +HumpEqual 0224F +IEcy 00415 +IJlig 00132 +IOcy 00401 +Iacute 000CD +Icirc 000CE +Icy 00418 +Idot 00130 +Ifr 02111 +Igrave 000CC +Im 02111 +Imacr 0012A +ImaginaryI 02148 +Implies 021D2 +Int 0222C +Integral 0222B +Intersection 022C2 +InvisibleComma 02063 +InvisibleTimes 02062 +Iogon 0012E +Iopf 1D540 +Iota 00399 +Iscr 02110 +Itilde 00128 +Iukcy 00406 +Iuml 000CF +Jcirc 00134 +Jcy 00419 +Jfr 1D50D +Jopf 1D541 +Jscr 1D4A5 +Jsercy 00408 +Jukcy 00404 +KHcy 00425 +KJcy 0040C +Kappa 0039A +Kcedil 00136 +Kcy 0041A +Kfr 1D50E +Kopf 1D542 +Kscr 1D4A6 +LJcy 00409 +LT 0003C +Lacute 00139 +Lambda 0039B +Lang 027EA +Laplacetrf 02112 +Larr 0219E +Lcaron 0013D +Lcedil 0013B +Lcy 0041B +LeftAngleBracket 027E8 +LeftArrow 02190 +LeftArrowBar 021E4 +LeftArrowRightArrow 021C6 +LeftCeiling 02308 +LeftDoubleBracket 027E6 +LeftDownTeeVector 02961 +LeftDownVector 021C3 +LeftDownVectorBar 02959 +LeftFloor 0230A +LeftRightArrow 02194 +LeftRightVector 0294E +LeftTee 022A3 +LeftTeeArrow 021A4 +LeftTeeVector 0295A +LeftTriangle 022B2 +LeftTriangleBar 029CF +LeftTriangleEqual 022B4 +LeftUpDownVector 02951 +LeftUpTeeVector 02960 +LeftUpVector 021BF +LeftUpVectorBar 02958 +LeftVector 021BC +LeftVectorBar 02952 +Leftarrow 021D0 +Leftrightarrow 021D4 +LessEqualGreater 022DA +LessFullEqual 02266 +LessGreater 02276 +LessLess 02AA1 +LessSlantEqual 02A7D +LessTilde 02272 +Lfr 1D50F +Ll 022D8 +Lleftarrow 021DA +Lmidot 0013F +LongLeftArrow 027F5 +LongLeftRightArrow 027F7 +LongRightArrow 027F6 +Longleftarrow 027F8 +Longleftrightarrow 027FA +Longrightarrow 027F9 +Lopf 1D543 +LowerLeftArrow 02199 +LowerRightArrow 02198 +Lscr 02112 +Lsh 021B0 +Lstrok 00141 +Lt 0226A +Map 02905 +Mcy 0041C +MediumSpace 0205F +Mellintrf 02133 +Mfr 1D510 +MinusPlus 02213 +Mopf 1D544 +Mscr 02133 +Mu 0039C +NJcy 0040A +Nacute 00143 +Ncaron 00147 +Ncedil 00145 +Ncy 0041D +NegativeMediumSpace 0200B +NegativeThickSpace 0200B +NegativeThinSpace 0200B +NegativeVeryThinSpace 0200B +NestedGreaterGreater 0226B +NestedLessLess 0226A +NewLine 0000A +Nfr 1D511 +NoBreak 02060 +NonBreakingSpace 000A0 +Nopf 02115 +Not 02AEC +NotCongruent 02262 +NotCupCap 0226D +NotDoubleVerticalBar 02226 +NotElement 02209 +NotEqual 02260 +NotEqualTilde 02242 00338 +NotExists 02204 +NotGreater 0226F +NotGreaterEqual 02271 +NotGreaterFullEqual 02267 00338 +NotGreaterGreater 0226B 00338 +NotGreaterLess 02279 +NotGreaterSlantEqual 02A7E 00338 +NotGreaterTilde 02275 +NotHumpDownHump 0224E 00338 +NotHumpEqual 0224F 00338 +NotLeftTriangle 022EA +NotLeftTriangleBar 029CF 00338 +NotLeftTriangleEqual 022EC +NotLess 0226E +NotLessEqual 02270 +NotLessGreater 02278 +NotLessLess 0226A 00338 +NotLessSlantEqual 02A7D 00338 +NotLessTilde 02274 +NotNestedGreaterGreater 02AA2 00338 +NotNestedLessLess 02AA1 00338 +NotPrecedes 02280 +NotPrecedesEqual 02AAF 00338 +NotPrecedesSlantEqual 022E0 +NotReverseElement 0220C +NotRightTriangle 022EB +NotRightTriangleBar 029D0 00338 +NotRightTriangleEqual 022ED +NotSquareSubset 0228F 00338 +NotSquareSubsetEqual 022E2 +NotSquareSuperset 02290 00338 +NotSquareSupersetEqual 022E3 +NotSubset 02282 020D2 +NotSubsetEqual 02288 +NotSucceeds 02281 +NotSucceedsEqual 02AB0 00338 +NotSucceedsSlantEqual 022E1 +NotSucceedsTilde 0227F 00338 +NotSuperset 02283 020D2 +NotSupersetEqual 02289 +NotTilde 02241 +NotTildeEqual 02244 +NotTildeFullEqual 02247 +NotTildeTilde 02249 +NotVerticalBar 02224 +Nscr 1D4A9 +Ntilde 000D1 +Nu 0039D +OElig 00152 +Oacute 000D3 +Ocirc 000D4 +Ocy 0041E +Odblac 00150 +Ofr 1D512 +Ograve 000D2 +Omacr 0014C +Omega 003A9 +Omicron 0039F +Oopf 1D546 +OpenCurlyDoubleQuote 0201C +OpenCurlyQuote 02018 +Or 02A54 +Oscr 1D4AA +Oslash 000D8 +Otilde 000D5 +Otimes 02A37 +Ouml 000D6 +OverBar 0203E +OverBrace 023DE +OverBracket 023B4 +OverParenthesis 023DC +PartialD 02202 +Pcy 0041F +Pfr 1D513 +Phi 003A6 +Pi 003A0 +PlusMinus 000B1 +Poincareplane 0210C +Popf 02119 +Pr 02ABB +Precedes 0227A +PrecedesEqual 02AAF +PrecedesSlantEqual 0227C +PrecedesTilde 0227E +Prime 02033 +Product 0220F +Proportion 02237 +Proportional 0221D +Pscr 1D4AB +Psi 003A8 +QUOT 00022 +Qfr 1D514 +Qopf 0211A +Qscr 1D4AC +RBarr 02910 +REG 000AE +Racute 00154 +Rang 027EB +Rarr 021A0 +Rarrtl 02916 +Rcaron 00158 +Rcedil 00156 +Rcy 00420 +Re 0211C +ReverseElement 0220B +ReverseEquilibrium 021CB +ReverseUpEquilibrium 0296F +Rfr 0211C +Rho 003A1 +RightAngleBracket 027E9 +RightArrow 02192 +RightArrowBar 021E5 +RightArrowLeftArrow 021C4 +RightCeiling 02309 +RightDoubleBracket 027E7 +RightDownTeeVector 0295D +RightDownVector 021C2 +RightDownVectorBar 02955 +RightFloor 0230B +RightTee 022A2 +RightTeeArrow 021A6 +RightTeeVector 0295B +RightTriangle 022B3 +RightTriangleBar 029D0 +RightTriangleEqual 022B5 +RightUpDownVector 0294F +RightUpTeeVector 0295C +RightUpVector 021BE +RightUpVectorBar 02954 +RightVector 021C0 +RightVectorBar 02953 +Rightarrow 021D2 +Ropf 0211D +RoundImplies 02970 +Rrightarrow 021DB +Rscr 0211B +Rsh 021B1 +RuleDelayed 029F4 +SHCHcy 00429 +SHcy 00428 +SOFTcy 0042C +Sacute 0015A +Sc 02ABC +Scaron 00160 +Scedil 0015E +Scirc 0015C +Scy 00421 +Sfr 1D516 +ShortDownArrow 02193 +ShortLeftArrow 02190 +ShortRightArrow 02192 +ShortUpArrow 02191 +Sigma 003A3 +SmallCircle 02218 +Sopf 1D54A +Sqrt 0221A +Square 025A1 +SquareIntersection 02293 +SquareSubset 0228F +SquareSubsetEqual 02291 +SquareSuperset 02290 +SquareSupersetEqual 02292 +SquareUnion 02294 +Sscr 1D4AE +Star 022C6 +Sub 022D0 +Subset 022D0 +SubsetEqual 02286 +Succeeds 0227B +SucceedsEqual 02AB0 +SucceedsSlantEqual 0227D +SucceedsTilde 0227F +SuchThat 0220B +Sum 02211 +Sup 022D1 +Superset 02283 +SupersetEqual 02287 +Supset 022D1 +THORN 000DE +TRADE 02122 +TSHcy 0040B +TScy 00426 +Tab 00009 +Tau 003A4 +Tcaron 00164 +Tcedil 00162 +Tcy 00422 +Tfr 1D517 +Therefore 02234 +Theta 00398 +ThickSpace 0205F 0200A +ThinSpace 02009 +Tilde 0223C +TildeEqual 02243 +TildeFullEqual 02245 +TildeTilde 02248 +Topf 1D54B +TripleDot 020DB +Tscr 1D4AF +Tstrok 00166 +Uacute 000DA +Uarr 0219F +Uarrocir 02949 +Ubrcy 0040E +Ubreve 0016C +Ucirc 000DB +Ucy 00423 +Udblac 00170 +Ufr 1D518 +Ugrave 000D9 +Umacr 0016A +UnderBar 0005F +UnderBrace 023DF +UnderBracket 023B5 +UnderParenthesis 023DD +Union 022C3 +UnionPlus 0228E +Uogon 00172 +Uopf 1D54C +UpArrow 02191 +UpArrowBar 02912 +UpArrowDownArrow 021C5 +UpDownArrow 02195 +UpEquilibrium 0296E +UpTee 022A5 +UpTeeArrow 021A5 +Uparrow 021D1 +Updownarrow 021D5 +UpperLeftArrow 02196 +UpperRightArrow 02197 +Upsi 003D2 +Upsilon 003A5 +Uring 0016E +Uscr 1D4B0 +Utilde 00168 +Uuml 000DC +VDash 022AB +Vbar 02AEB +Vcy 00412 +Vdash 022A9 +Vdashl 02AE6 +Vee 022C1 +Verbar 02016 +Vert 02016 +VerticalBar 02223 +VerticalLine 0007C +VerticalSeparator 02758 +VerticalTilde 02240 +VeryThinSpace 0200A +Vfr 1D519 +Vopf 1D54D +Vscr 1D4B1 +Vvdash 022AA +Wcirc 00174 +Wedge 022C0 +Wfr 1D51A +Wopf 1D54E +Wscr 1D4B2 +Xfr 1D51B +Xi 0039E +Xopf 1D54F +Xscr 1D4B3 +YAcy 0042F +YIcy 00407 +YUcy 0042E +Yacute 000DD +Ycirc 00176 +Ycy 0042B +Yfr 1D51C +Yopf 1D550 +Yscr 1D4B4 +Yuml 00178 +ZHcy 00416 +Zacute 00179 +Zcaron 0017D +Zcy 00417 +Zdot 0017B +ZeroWidthSpace 0200B +Zeta 00396 +Zfr 02128 +Zopf 02124 +Zscr 1D4B5 +aacute 000E1 +abreve 00103 +ac 0223E +acE 0223E 00333 +acd 0223F +acirc 000E2 +acute 000B4 +acy 00430 +aelig 000E6 +af 02061 +afr 1D51E +agrave 000E0 +alefsym 02135 +aleph 02135 +alpha 003B1 +amacr 00101 +amalg 02A3F +amp 00026 +and 02227 +andand 02A55 +andd 02A5C +andslope 02A58 +andv 02A5A +ang 02220 +ange 029A4 +angle 02220 +angmsd 02221 +angmsdaa 029A8 +angmsdab 029A9 +angmsdac 029AA +angmsdad 029AB +angmsdae 029AC +angmsdaf 029AD +angmsdag 029AE +angmsdah 029AF +angrt 0221F +angrtvb 022BE +angrtvbd 0299D +angsph 02222 +angst 000C5 +angzarr 0237C +aogon 00105 +aopf 1D552 +ap 02248 +apE 02A70 +apacir 02A6F +ape 0224A +apid 0224B +apos 00027 +approx 02248 +approxeq 0224A +aring 000E5 +ascr 1D4B6 +ast 0002A +asymp 02248 +asympeq 0224D +atilde 000E3 +auml 000E4 +awconint 02233 +awint 02A11 +bNot 02AED +backcong 0224C +backepsilon 003F6 +backprime 02035 +backsim 0223D +backsimeq 022CD +barvee 022BD +barwed 02305 +barwedge 02305 +bbrk 023B5 +bbrktbrk 023B6 +bcong 0224C +bcy 00431 +bdquo 0201E +becaus 02235 +because 02235 +bemptyv 029B0 +bepsi 003F6 +bernou 0212C +beta 003B2 +beth 02136 +between 0226C +bfr 1D51F +bigcap 022C2 +bigcirc 025EF +bigcup 022C3 +bigodot 02A00 +bigoplus 02A01 +bigotimes 02A02 +bigsqcup 02A06 +bigstar 02605 +bigtriangledown 025BD +bigtriangleup 025B3 +biguplus 02A04 +bigvee 022C1 +bigwedge 022C0 +bkarow 0290D +blacklozenge 029EB +blacksquare 025AA +blacktriangle 025B4 +blacktriangledown 025BE +blacktriangleleft 025C2 +blacktriangleright 025B8 +blank 02423 +blk12 02592 +blk14 02591 +blk34 02593 +block 02588 +bne 0003D 020E5 +bnequiv 02261 020E5 +bnot 02310 +bopf 1D553 +bot 022A5 +bottom 022A5 +bowtie 022C8 +boxDL 02557 +boxDR 02554 +boxDl 02556 +boxDr 02553 +boxH 02550 +boxHD 02566 +boxHU 02569 +boxHd 02564 +boxHu 02567 +boxUL 0255D +boxUR 0255A +boxUl 0255C +boxUr 02559 +boxV 02551 +boxVH 0256C +boxVL 02563 +boxVR 02560 +boxVh 0256B +boxVl 02562 +boxVr 0255F +boxbox 029C9 +boxdL 02555 +boxdR 02552 +boxdl 02510 +boxdr 0250C +boxh 02500 +boxhD 02565 +boxhU 02568 +boxhd 0252C +boxhu 02534 +boxminus 0229F +boxplus 0229E +boxtimes 022A0 +boxuL 0255B +boxuR 02558 +boxul 02518 +boxur 02514 +boxv 02502 +boxvH 0256A +boxvL 02561 +boxvR 0255E +boxvh 0253C +boxvl 02524 +boxvr 0251C +bprime 02035 +breve 002D8 +brvbar 000A6 +bscr 1D4B7 +bsemi 0204F +bsim 0223D +bsime 022CD +bsol 0005C +bsolb 029C5 +bsolhsub 027C8 +bull 02022 +bullet 02022 +bump 0224E +bumpE 02AAE +bumpe 0224F +bumpeq 0224F +cacute 00107 +cap 02229 +capand 02A44 +capbrcup 02A49 +capcap 02A4B +capcup 02A47 +capdot 02A40 +caps 02229 0FE00 +caret 02041 +caron 002C7 +ccaps 02A4D +ccaron 0010D +ccedil 000E7 +ccirc 00109 +ccups 02A4C +ccupssm 02A50 +cdot 0010B +cedil 000B8 +cemptyv 029B2 +cent 000A2 +centerdot 000B7 +cfr 1D520 +chcy 00447 +check 02713 +checkmark 02713 +chi 003C7 +cir 025CB +cirE 029C3 +circ 002C6 +circeq 02257 +circlearrowleft 021BA +circlearrowright 021BB +circledR 000AE +circledS 024C8 +circledast 0229B +circledcirc 0229A +circleddash 0229D +cire 02257 +cirfnint 02A10 +cirmid 02AEF +cirscir 029C2 +clubs 02663 +clubsuit 02663 +colon 0003A +colone 02254 +coloneq 02254 +comma 0002C +commat 00040 +comp 02201 +compfn 02218 +complement 02201 +complexes 02102 +cong 02245 +congdot 02A6D +conint 0222E +copf 1D554 +coprod 02210 +copy 000A9 +copysr 02117 +crarr 021B5 +cross 02717 +cscr 1D4B8 +csub 02ACF +csube 02AD1 +csup 02AD0 +csupe 02AD2 +ctdot 022EF +cudarrl 02938 +cudarrr 02935 +cuepr 022DE +cuesc 022DF +cularr 021B6 +cularrp 0293D +cup 0222A +cupbrcap 02A48 +cupcap 02A46 +cupcup 02A4A +cupdot 0228D +cupor 02A45 +cups 0222A 0FE00 +curarr 021B7 +curarrm 0293C +curlyeqprec 022DE +curlyeqsucc 022DF +curlyvee 022CE +curlywedge 022CF +curren 000A4 +curvearrowleft 021B6 +curvearrowright 021B7 +cuvee 022CE +cuwed 022CF +cwconint 02232 +cwint 02231 +cylcty 0232D +dArr 021D3 +dHar 02965 +dagger 02020 +daleth 02138 +darr 02193 +dash 02010 +dashv 022A3 +dbkarow 0290F +dblac 002DD +dcaron 0010F +dcy 00434 +dd 02146 +ddagger 02021 +ddarr 021CA +ddotseq 02A77 +deg 000B0 +delta 003B4 +demptyv 029B1 +dfisht 0297F +dfr 1D521 +dharl 021C3 +dharr 021C2 +diam 022C4 +diamond 022C4 +diamondsuit 02666 +diams 02666 +die 000A8 +digamma 003DD +disin 022F2 +div 000F7 +divide 000F7 +divideontimes 022C7 +divonx 022C7 +djcy 00452 +dlcorn 0231E +dlcrop 0230D +dollar 00024 +dopf 1D555 +dot 002D9 +doteq 02250 +doteqdot 02251 +dotminus 02238 +dotplus 02214 +dotsquare 022A1 +doublebarwedge 02306 +downarrow 02193 +downdownarrows 021CA +downharpoonleft 021C3 +downharpoonright 021C2 +drbkarow 02910 +drcorn 0231F +drcrop 0230C +dscr 1D4B9 +dscy 00455 +dsol 029F6 +dstrok 00111 +dtdot 022F1 +dtri 025BF +dtrif 025BE +duarr 021F5 +duhar 0296F +dwangle 029A6 +dzcy 0045F +dzigrarr 027FF +eDDot 02A77 +eDot 02251 +eacute 000E9 +easter 02A6E +ecaron 0011B +ecir 02256 +ecirc 000EA +ecolon 02255 +ecy 0044D +edot 00117 +ee 02147 +efDot 02252 +efr 1D522 +eg 02A9A +egrave 000E8 +egs 02A96 +egsdot 02A98 +el 02A99 +elinters 023E7 +ell 02113 +els 02A95 +elsdot 02A97 +emacr 00113 +empty 02205 +emptyset 02205 +emptyv 02205 +emsp 02003 +emsp13 02004 +emsp14 02005 +eng 0014B +ensp 02002 +eogon 00119 +eopf 1D556 +epar 022D5 +eparsl 029E3 +eplus 02A71 +epsi 003B5 +epsilon 003B5 +epsiv 003F5 +eqcirc 02256 +eqcolon 02255 +eqsim 02242 +eqslantgtr 02A96 +eqslantless 02A95 +equals 0003D +equest 0225F +equiv 02261 +equivDD 02A78 +eqvparsl 029E5 +erDot 02253 +erarr 02971 +escr 0212F +esdot 02250 +esim 02242 +eta 003B7 +eth 000F0 +euml 000EB +euro 020AC +excl 00021 +exist 02203 +expectation 02130 +exponentiale 02147 +fallingdotseq 02252 +fcy 00444 +female 02640 +ffilig 0FB03 +fflig 0FB00 +ffllig 0FB04 +ffr 1D523 +filig 0FB01 +fjlig 00066 0006A +flat 0266D +fllig 0FB02 +fltns 025B1 +fnof 00192 +fopf 1D557 +forall 02200 +fork 022D4 +forkv 02AD9 +fpartint 02A0D +frac12 000BD +frac13 02153 +frac14 000BC +frac15 02155 +frac16 02159 +frac18 0215B +frac23 02154 +frac25 02156 +frac34 000BE +frac35 02157 +frac38 0215C +frac45 02158 +frac56 0215A +frac58 0215D +frac78 0215E +frasl 02044 +frown 02322 +fscr 1D4BB +gE 02267 +gEl 02A8C +gacute 001F5 +gamma 003B3 +gammad 003DD +gap 02A86 +gbreve 0011F +gcirc 0011D +gcy 00433 +gdot 00121 +ge 02265 +gel 022DB +geq 02265 +geqq 02267 +geqslant 02A7E +ges 02A7E +gescc 02AA9 +gesdot 02A80 +gesdoto 02A82 +gesdotol 02A84 +gesl 022DB 0FE00 +gesles 02A94 +gfr 1D524 +gg 0226B +ggg 022D9 +gimel 02137 +gjcy 00453 +gl 02277 +glE 02A92 +gla 02AA5 +glj 02AA4 +gnE 02269 +gnap 02A8A +gnapprox 02A8A +gne 02A88 +gneq 02A88 +gneqq 02269 +gnsim 022E7 +gopf 1D558 +grave 00060 +gscr 0210A +gsim 02273 +gsime 02A8E +gsiml 02A90 +gt 0003E +gtcc 02AA7 +gtcir 02A7A +gtdot 022D7 +gtlPar 02995 +gtquest 02A7C +gtrapprox 02A86 +gtrarr 02978 +gtrdot 022D7 +gtreqless 022DB +gtreqqless 02A8C +gtrless 02277 +gtrsim 02273 +gvertneqq 02269 0FE00 +gvnE 02269 0FE00 +hArr 021D4 +hairsp 0200A +half 000BD +hamilt 0210B +hardcy 0044A +harr 02194 +harrcir 02948 +harrw 021AD +hbar 0210F +hcirc 00125 +hearts 02665 +heartsuit 02665 +hellip 02026 +hercon 022B9 +hfr 1D525 +hksearow 02925 +hkswarow 02926 +hoarr 021FF +homtht 0223B +hookleftarrow 021A9 +hookrightarrow 021AA +hopf 1D559 +horbar 02015 +hscr 1D4BD +hslash 0210F +hstrok 00127 +hybull 02043 +hyphen 02010 +iacute 000ED +ic 02063 +icirc 000EE +icy 00438 +iecy 00435 +iexcl 000A1 +iff 021D4 +ifr 1D526 +igrave 000EC +ii 02148 +iiiint 02A0C +iiint 0222D +iinfin 029DC +iiota 02129 +ijlig 00133 +imacr 0012B +image 02111 +imagline 02110 +imagpart 02111 +imath 00131 +imof 022B7 +imped 001B5 +in 02208 +incare 02105 +infin 0221E +infintie 029DD +inodot 00131 +int 0222B +intcal 022BA +integers 02124 +intercal 022BA +intlarhk 02A17 +intprod 02A3C +iocy 00451 +iogon 0012F +iopf 1D55A +iota 003B9 +iprod 02A3C +iquest 000BF +iscr 1D4BE +isin 02208 +isinE 022F9 +isindot 022F5 +isins 022F4 +isinsv 022F3 +isinv 02208 +it 02062 +itilde 00129 +iukcy 00456 +iuml 000EF +jcirc 00135 +jcy 00439 +jfr 1D527 +jmath 00237 +jopf 1D55B +jscr 1D4BF +jsercy 00458 +jukcy 00454 +kappa 003BA +kappav 003F0 +kcedil 00137 +kcy 0043A +kfr 1D528 +kgreen 00138 +khcy 00445 +kjcy 0045C +kopf 1D55C +kscr 1D4C0 +lAarr 021DA +lArr 021D0 +lAtail 0291B +lBarr 0290E +lE 02266 +lEg 02A8B +lHar 02962 +lacute 0013A +laemptyv 029B4 +lagran 02112 +lambda 003BB +lang 027E8 +langd 02991 +langle 027E8 +lap 02A85 +laquo 000AB +larr 02190 +larrb 021E4 +larrbfs 0291F +larrfs 0291D +larrhk 021A9 +larrlp 021AB +larrpl 02939 +larrsim 02973 +larrtl 021A2 +lat 02AAB +latail 02919 +late 02AAD +lates 02AAD 0FE00 +lbarr 0290C +lbbrk 02772 +lbrace 0007B +lbrack 0005B +lbrke 0298B +lbrksld 0298F +lbrkslu 0298D +lcaron 0013E +lcedil 0013C +lceil 02308 +lcub 0007B +lcy 0043B +ldca 02936 +ldquo 0201C +ldquor 0201E +ldrdhar 02967 +ldrushar 0294B +ldsh 021B2 +le 02264 +leftarrow 02190 +leftarrowtail 021A2 +leftharpoondown 021BD +leftharpoonup 021BC +leftleftarrows 021C7 +leftrightarrow 02194 +leftrightarrows 021C6 +leftrightharpoons 021CB +leftrightsquigarrow 021AD +leftthreetimes 022CB +leg 022DA +leq 02264 +leqq 02266 +leqslant 02A7D +les 02A7D +lescc 02AA8 +lesdot 02A7F +lesdoto 02A81 +lesdotor 02A83 +lesg 022DA 0FE00 +lesges 02A93 +lessapprox 02A85 +lessdot 022D6 +lesseqgtr 022DA +lesseqqgtr 02A8B +lessgtr 02276 +lesssim 02272 +lfisht 0297C +lfloor 0230A +lfr 1D529 +lg 02276 +lgE 02A91 +lhard 021BD +lharu 021BC +lharul 0296A +lhblk 02584 +ljcy 00459 +ll 0226A +llarr 021C7 +llcorner 0231E +llhard 0296B +lltri 025FA +lmidot 00140 +lmoust 023B0 +lmoustache 023B0 +lnE 02268 +lnap 02A89 +lnapprox 02A89 +lne 02A87 +lneq 02A87 +lneqq 02268 +lnsim 022E6 +loang 027EC +loarr 021FD +lobrk 027E6 +longleftarrow 027F5 +longleftrightarrow 027F7 +longmapsto 027FC +longrightarrow 027F6 +looparrowleft 021AB +looparrowright 021AC +lopar 02985 +lopf 1D55D +loplus 02A2D +lotimes 02A34 +lowast 02217 +lowbar 0005F +loz 025CA +lozenge 025CA +lozf 029EB +lpar 00028 +lparlt 02993 +lrarr 021C6 +lrcorner 0231F +lrhar 021CB +lrhard 0296D +lrm 0200E +lrtri 022BF +lsaquo 02039 +lscr 1D4C1 +lsh 021B0 +lsim 02272 +lsime 02A8D +lsimg 02A8F +lsqb 0005B +lsquo 02018 +lsquor 0201A +lstrok 00142 +lt 0003C +ltcc 02AA6 +ltcir 02A79 +ltdot 022D6 +lthree 022CB +ltimes 022C9 +ltlarr 02976 +ltquest 02A7B +ltrPar 02996 +ltri 025C3 +ltrie 022B4 +ltrif 025C2 +lurdshar 0294A +luruhar 02966 +lvertneqq 02268 0FE00 +lvnE 02268 0FE00 +mDDot 0223A +macr 000AF +male 02642 +malt 02720 +maltese 02720 +map 021A6 +mapsto 021A6 +mapstodown 021A7 +mapstoleft 021A4 +mapstoup 021A5 +marker 025AE +mcomma 02A29 +mcy 0043C +mdash 02014 +measuredangle 02221 +mfr 1D52A +mho 02127 +micro 000B5 +mid 02223 +midast 0002A +midcir 02AF0 +middot 000B7 +minus 02212 +minusb 0229F +minusd 02238 +minusdu 02A2A +mlcp 02ADB +mldr 02026 +mnplus 02213 +models 022A7 +mopf 1D55E +mp 02213 +mscr 1D4C2 +mstpos 0223E +mu 003BC +multimap 022B8 +mumap 022B8 +nGg 022D9 00338 +nGt 0226B 020D2 +nGtv 0226B 00338 +nLeftarrow 021CD +nLeftrightarrow 021CE +nLl 022D8 00338 +nLt 0226A 020D2 +nLtv 0226A 00338 +nRightarrow 021CF +nVDash 022AF +nVdash 022AE +nabla 02207 +nacute 00144 +nang 02220 020D2 +nap 02249 +napE 02A70 00338 +napid 0224B 00338 +napos 00149 +napprox 02249 +natur 0266E +natural 0266E +naturals 02115 +nbsp 000A0 +nbump 0224E 00338 +nbumpe 0224F 00338 +ncap 02A43 +ncaron 00148 +ncedil 00146 +ncong 02247 +ncongdot 02A6D 00338 +ncup 02A42 +ncy 0043D +ndash 02013 +ne 02260 +neArr 021D7 +nearhk 02924 +nearr 02197 +nearrow 02197 +nedot 02250 00338 +nequiv 02262 +nesear 02928 +nesim 02242 00338 +nexist 02204 +nexists 02204 +nfr 1D52B +ngE 02267 00338 +nge 02271 +ngeq 02271 +ngeqq 02267 00338 +ngeqslant 02A7E 00338 +nges 02A7E 00338 +ngsim 02275 +ngt 0226F +ngtr 0226F +nhArr 021CE +nharr 021AE +nhpar 02AF2 +ni 0220B +nis 022FC +nisd 022FA +niv 0220B +njcy 0045A +nlArr 021CD +nlE 02266 00338 +nlarr 0219A +nldr 02025 +nle 02270 +nleftarrow 0219A +nleftrightarrow 021AE +nleq 02270 +nleqq 02266 00338 +nleqslant 02A7D 00338 +nles 02A7D 00338 +nless 0226E +nlsim 02274 +nlt 0226E +nltri 022EA +nltrie 022EC +nmid 02224 +nopf 1D55F +not 000AC +notin 02209 +notinE 022F9 00338 +notindot 022F5 00338 +notinva 02209 +notinvb 022F7 +notinvc 022F6 +notni 0220C +notniva 0220C +notnivb 022FE +notnivc 022FD +npar 02226 +nparallel 02226 +nparsl 02AFD 020E5 +npart 02202 00338 +npolint 02A14 +npr 02280 +nprcue 022E0 +npre 02AAF 00338 +nprec 02280 +npreceq 02AAF 00338 +nrArr 021CF +nrarr 0219B +nrarrc 02933 00338 +nrarrw 0219D 00338 +nrightarrow 0219B +nrtri 022EB +nrtrie 022ED +nsc 02281 +nsccue 022E1 +nsce 02AB0 00338 +nscr 1D4C3 +nshortmid 02224 +nshortparallel 02226 +nsim 02241 +nsime 02244 +nsimeq 02244 +nsmid 02224 +nspar 02226 +nsqsube 022E2 +nsqsupe 022E3 +nsub 02284 +nsubE 02AC5 00338 +nsube 02288 +nsubset 02282 020D2 +nsubseteq 02288 +nsubseteqq 02AC5 00338 +nsucc 02281 +nsucceq 02AB0 00338 +nsup 02285 +nsupE 02AC6 00338 +nsupe 02289 +nsupset 02283 020D2 +nsupseteq 02289 +nsupseteqq 02AC6 00338 +ntgl 02279 +ntilde 000F1 +ntlg 02278 +ntriangleleft 022EA +ntrianglelefteq 022EC +ntriangleright 022EB +ntrianglerighteq 022ED +nu 003BD +num 00023 +numero 02116 +numsp 02007 +nvDash 022AD +nvHarr 02904 +nvap 0224D 020D2 +nvdash 022AC +nvge 02265 020D2 +nvgt 0003E 020D2 +nvinfin 029DE +nvlArr 02902 +nvle 02264 020D2 +nvlt 0003C 020D2 +nvltrie 022B4 020D2 +nvrArr 02903 +nvrtrie 022B5 020D2 +nvsim 0223C 020D2 +nwArr 021D6 +nwarhk 02923 +nwarr 02196 +nwarrow 02196 +nwnear 02927 +oS 024C8 +oacute 000F3 +oast 0229B +ocir 0229A +ocirc 000F4 +ocy 0043E +odash 0229D +odblac 00151 +odiv 02A38 +odot 02299 +odsold 029BC +oelig 00153 +ofcir 029BF +ofr 1D52C +ogon 002DB +ograve 000F2 +ogt 029C1 +ohbar 029B5 +ohm 003A9 +oint 0222E +olarr 021BA +olcir 029BE +olcross 029BB +oline 0203E +olt 029C0 +omacr 0014D +omega 003C9 +omicron 003BF +omid 029B6 +ominus 02296 +oopf 1D560 +opar 029B7 +operp 029B9 +oplus 02295 +or 02228 +orarr 021BB +ord 02A5D +order 02134 +orderof 02134 +ordf 000AA +ordm 000BA +origof 022B6 +oror 02A56 +orslope 02A57 +orv 02A5B +oscr 02134 +oslash 000F8 +osol 02298 +otilde 000F5 +otimes 02297 +otimesas 02A36 +ouml 000F6 +ovbar 0233D +par 02225 +para 000B6 +parallel 02225 +parsim 02AF3 +parsl 02AFD +part 02202 +pcy 0043F +percnt 00025 +period 0002E +permil 02030 +perp 022A5 +pertenk 02031 +pfr 1D52D +phi 003C6 +phiv 003D5 +phmmat 02133 +phone 0260E +pi 003C0 +pitchfork 022D4 +piv 003D6 +planck 0210F +planckh 0210E +plankv 0210F +plus 0002B +plusacir 02A23 +plusb 0229E +pluscir 02A22 +plusdo 02214 +plusdu 02A25 +pluse 02A72 +plusmn 000B1 +plussim 02A26 +plustwo 02A27 +pm 000B1 +pointint 02A15 +popf 1D561 +pound 000A3 +pr 0227A +prE 02AB3 +prap 02AB7 +prcue 0227C +pre 02AAF +prec 0227A +precapprox 02AB7 +preccurlyeq 0227C +preceq 02AAF +precnapprox 02AB9 +precneqq 02AB5 +precnsim 022E8 +precsim 0227E +prime 02032 +primes 02119 +prnE 02AB5 +prnap 02AB9 +prnsim 022E8 +prod 0220F +profalar 0232E +profline 02312 +profsurf 02313 +prop 0221D +propto 0221D +prsim 0227E +prurel 022B0 +pscr 1D4C5 +psi 003C8 +puncsp 02008 +qfr 1D52E +qint 02A0C +qopf 1D562 +qprime 02057 +qscr 1D4C6 +quaternions 0210D +quatint 02A16 +quest 0003F +questeq 0225F +quot 00022 +rAarr 021DB +rArr 021D2 +rAtail 0291C +rBarr 0290F +rHar 02964 +race 0223D 00331 +racute 00155 +radic 0221A +raemptyv 029B3 +rang 027E9 +rangd 02992 +range 029A5 +rangle 027E9 +raquo 000BB +rarr 02192 +rarrap 02975 +rarrb 021E5 +rarrbfs 02920 +rarrc 02933 +rarrfs 0291E +rarrhk 021AA +rarrlp 021AC +rarrpl 02945 +rarrsim 02974 +rarrtl 021A3 +rarrw 0219D +ratail 0291A +ratio 02236 +rationals 0211A +rbarr 0290D +rbbrk 02773 +rbrace 0007D +rbrack 0005D +rbrke 0298C +rbrksld 0298E +rbrkslu 02990 +rcaron 00159 +rcedil 00157 +rceil 02309 +rcub 0007D +rcy 00440 +rdca 02937 +rdldhar 02969 +rdquo 0201D +rdquor 0201D +rdsh 021B3 +real 0211C +realine 0211B +realpart 0211C +reals 0211D +rect 025AD +reg 000AE +rfisht 0297D +rfloor 0230B +rfr 1D52F +rhard 021C1 +rharu 021C0 +rharul 0296C +rho 003C1 +rhov 003F1 +rightarrow 02192 +rightarrowtail 021A3 +rightharpoondown 021C1 +rightharpoonup 021C0 +rightleftarrows 021C4 +rightleftharpoons 021CC +rightrightarrows 021C9 +rightsquigarrow 0219D +rightthreetimes 022CC +ring 002DA +risingdotseq 02253 +rlarr 021C4 +rlhar 021CC +rlm 0200F +rmoust 023B1 +rmoustache 023B1 +rnmid 02AEE +roang 027ED +roarr 021FE +robrk 027E7 +ropar 02986 +ropf 1D563 +roplus 02A2E +rotimes 02A35 +rpar 00029 +rpargt 02994 +rppolint 02A12 +rrarr 021C9 +rsaquo 0203A +rscr 1D4C7 +rsh 021B1 +rsqb 0005D +rsquo 02019 +rsquor 02019 +rthree 022CC +rtimes 022CA +rtri 025B9 +rtrie 022B5 +rtrif 025B8 +rtriltri 029CE +ruluhar 02968 +rx 0211E +sacute 0015B +sbquo 0201A +sc 0227B +scE 02AB4 +scap 02AB8 +scaron 00161 +sccue 0227D +sce 02AB0 +scedil 0015F +scirc 0015D +scnE 02AB6 +scnap 02ABA +scnsim 022E9 +scpolint 02A13 +scsim 0227F +scy 00441 +sdot 022C5 +sdotb 022A1 +sdote 02A66 +seArr 021D8 +searhk 02925 +searr 02198 +searrow 02198 +sect 000A7 +semi 0003B +seswar 02929 +setminus 02216 +setmn 02216 +sext 02736 +sfr 1D530 +sfrown 02322 +sharp 0266F +shchcy 00449 +shcy 00448 +shortmid 02223 +shortparallel 02225 +shy 000AD +sigma 003C3 +sigmaf 003C2 +sigmav 003C2 +sim 0223C +simdot 02A6A +sime 02243 +simeq 02243 +simg 02A9E +simgE 02AA0 +siml 02A9D +simlE 02A9F +simne 02246 +simplus 02A24 +simrarr 02972 +slarr 02190 +smallsetminus 02216 +smashp 02A33 +smeparsl 029E4 +smid 02223 +smile 02323 +smt 02AAA +smte 02AAC +smtes 02AAC 0FE00 +softcy 0044C +sol 0002F +solb 029C4 +solbar 0233F +sopf 1D564 +spades 02660 +spadesuit 02660 +spar 02225 +sqcap 02293 +sqcaps 02293 0FE00 +sqcup 02294 +sqcups 02294 0FE00 +sqsub 0228F +sqsube 02291 +sqsubset 0228F +sqsubseteq 02291 +sqsup 02290 +sqsupe 02292 +sqsupset 02290 +sqsupseteq 02292 +squ 025A1 +square 025A1 +squarf 025AA +squf 025AA +srarr 02192 +sscr 1D4C8 +ssetmn 02216 +ssmile 02323 +sstarf 022C6 +star 02606 +starf 02605 +straightepsilon 003F5 +straightphi 003D5 +strns 000AF +sub 02282 +subE 02AC5 +subdot 02ABD +sube 02286 +subedot 02AC3 +submult 02AC1 +subnE 02ACB +subne 0228A +subplus 02ABF +subrarr 02979 +subset 02282 +subseteq 02286 +subseteqq 02AC5 +subsetneq 0228A +subsetneqq 02ACB +subsim 02AC7 +subsub 02AD5 +subsup 02AD3 +succ 0227B +succapprox 02AB8 +succcurlyeq 0227D +succeq 02AB0 +succnapprox 02ABA +succneqq 02AB6 +succnsim 022E9 +succsim 0227F +sum 02211 +sung 0266A +sup 02283 +sup1 000B9 +sup2 000B2 +sup3 000B3 +supE 02AC6 +supdot 02ABE +supdsub 02AD8 +supe 02287 +supedot 02AC4 +suphsol 027C9 +suphsub 02AD7 +suplarr 0297B +supmult 02AC2 +supnE 02ACC +supne 0228B +supplus 02AC0 +supset 02283 +supseteq 02287 +supseteqq 02AC6 +supsetneq 0228B +supsetneqq 02ACC +supsim 02AC8 +supsub 02AD4 +supsup 02AD6 +swArr 021D9 +swarhk 02926 +swarr 02199 +swarrow 02199 +swnwar 0292A +szlig 000DF +target 02316 +tau 003C4 +tbrk 023B4 +tcaron 00165 +tcedil 00163 +tcy 00442 +tdot 020DB +telrec 02315 +tfr 1D531 +there4 02234 +therefore 02234 +theta 003B8 +thetasym 003D1 +thetav 003D1 +thickapprox 02248 +thicksim 0223C +thinsp 02009 +thkap 02248 +thksim 0223C +thorn 000FE +tilde 002DC +times 000D7 +timesb 022A0 +timesbar 02A31 +timesd 02A30 +tint 0222D +toea 02928 +top 022A4 +topbot 02336 +topcir 02AF1 +topf 1D565 +topfork 02ADA +tosa 02929 +tprime 02034 +trade 02122 +triangle 025B5 +triangledown 025BF +triangleleft 025C3 +trianglelefteq 022B4 +triangleq 0225C +triangleright 025B9 +trianglerighteq 022B5 +tridot 025EC +trie 0225C +triminus 02A3A +triplus 02A39 +trisb 029CD +tritime 02A3B +trpezium 023E2 +tscr 1D4C9 +tscy 00446 +tshcy 0045B +tstrok 00167 +twixt 0226C +twoheadleftarrow 0219E +twoheadrightarrow 021A0 +uArr 021D1 +uHar 02963 +uacute 000FA +uarr 02191 +ubrcy 0045E +ubreve 0016D +ucirc 000FB +ucy 00443 +udarr 021C5 +udblac 00171 +udhar 0296E +ufisht 0297E +ufr 1D532 +ugrave 000F9 +uharl 021BF +uharr 021BE +uhblk 02580 +ulcorn 0231C +ulcorner 0231C +ulcrop 0230F +ultri 025F8 +umacr 0016B +uml 000A8 +uogon 00173 +uopf 1D566 +uparrow 02191 +updownarrow 02195 +upharpoonleft 021BF +upharpoonright 021BE +uplus 0228E +upsi 003C5 +upsih 003D2 +upsilon 003C5 +upuparrows 021C8 +urcorn 0231D +urcorner 0231D +urcrop 0230E +uring 0016F +urtri 025F9 +uscr 1D4CA +utdot 022F0 +utilde 00169 +utri 025B5 +utrif 025B4 +uuarr 021C8 +uuml 000FC +uwangle 029A7 +vArr 021D5 +vBar 02AE8 +vBarv 02AE9 +vDash 022A8 +vangrt 0299C +varepsilon 003F5 +varkappa 003F0 +varnothing 02205 +varphi 003D5 +varpi 003D6 +varpropto 0221D +varr 02195 +varrho 003F1 +varsigma 003C2 +varsubsetneq 0228A 0FE00 +varsubsetneqq 02ACB 0FE00 +varsupsetneq 0228B 0FE00 +varsupsetneqq 02ACC 0FE00 +vartheta 003D1 +vartriangleleft 022B2 +vartriangleright 022B3 +vcy 00432 +vdash 022A2 +vee 02228 +veebar 022BB +veeeq 0225A +vellip 022EE +verbar 0007C +vert 0007C +vfr 1D533 +vltri 022B2 +vnsub 02282 020D2 +vnsup 02283 020D2 +vopf 1D567 +vprop 0221D +vrtri 022B3 +vscr 1D4CB +vsubnE 02ACB 0FE00 +vsubne 0228A 0FE00 +vsupnE 02ACC 0FE00 +vsupne 0228B 0FE00 +vzigzag 0299A +wcirc 00175 +wedbar 02A5F +wedge 02227 +wedgeq 02259 +weierp 02118 +wfr 1D534 +wopf 1D568 +wp 02118 +wr 02240 +wreath 02240 +wscr 1D4CC +xcap 022C2 +xcirc 025EF +xcup 022C3 +xdtri 025BD +xfr 1D535 +xhArr 027FA +xharr 027F7 +xi 003BE +xlArr 027F8 +xlarr 027F5 +xmap 027FC +xnis 022FB +xodot 02A00 +xopf 1D569 +xoplus 02A01 +xotime 02A02 +xrArr 027F9 +xrarr 027F6 +xscr 1D4CD +xsqcup 02A06 +xuplus 02A04 +xutri 025B3 +xvee 022C1 +xwedge 022C0 +yacute 000FD +yacy 0044F +ycirc 00177 +ycy 0044B +yen 000A5 +yfr 1D536 +yicy 00457 +yopf 1D56A +yscr 1D4CE +yucy 0044E +yuml 000FF +zacute 0017A +zcaron 0017E +zcy 00437 +zdot 0017C +zeetrf 02128 +zeta 003B6 +zfr 1D537 +zhcy 00436 +zigrarr 021DD +zopf 1D56B +zscr 1D4CF +zwj 0200D +zwnj 0200C \ No newline at end of file diff --git a/ext/standard/html_tables/ents_xhtml.txt b/ext/standard/html_tables/ents_xhtml.txt new file mode 100644 index 0000000..81800bc --- /dev/null +++ b/ext/standard/html_tables/ents_xhtml.txt @@ -0,0 +1,253 @@ +nbsp 00A0 +iexcl 00A1 +cent 00A2 +pound 00A3 +curren 00A4 +yen 00A5 +brvbar 00A6 +sect 00A7 +uml 00A8 +copy 00A9 +ordf 00AA +laquo 00AB +not 00AC +shy 00AD +reg 00AE +macr 00AF +deg 00B0 +plusmn 00B1 +sup2 00B2 +sup3 00B3 +acute 00B4 +micro 00B5 +para 00B6 +middot 00B7 +cedil 00B8 +sup1 00B9 +ordm 00BA +raquo 00BB +frac14 00BC +frac12 00BD +frac34 00BE +iquest 00BF +Agrave 00C0 +Aacute 00C1 +Acirc 00C2 +Atilde 00C3 +Auml 00C4 +Aring 00C5 +AElig 00C6 +Ccedil 00C7 +Egrave 00C8 +Eacute 00C9 +Ecirc 00CA +Euml 00CB +Igrave 00CC +Iacute 00CD +Icirc 00CE +Iuml 00CF +ETH 00D0 +Ntilde 00D1 +Ograve 00D2 +Oacute 00D3 +Ocirc 00D4 +Otilde 00D5 +Ouml 00D6 +times 00D7 +Oslash 00D8 +Ugrave 00D9 +Uacute 00DA +Ucirc 00DB +Uuml 00DC +Yacute 00DD +THORN 00DE +szlig 00DF +agrave 00E0 +aacute 00E1 +acirc 00E2 +atilde 00E3 +auml 00E4 +aring 00E5 +aelig 00E6 +ccedil 00E7 +egrave 00E8 +eacute 00E9 +ecirc 00EA +euml 00EB +igrave 00EC +iacute 00ED +icirc 00EE +iuml 00EF +eth 00F0 +ntilde 00F1 +ograve 00F2 +oacute 00F3 +ocirc 00F4 +otilde 00F5 +ouml 00F6 +divide 00F7 +oslash 00F8 +ugrave 00F9 +uacute 00FA +ucirc 00FB +uuml 00FC +yacute 00FD +thorn 00FE +yuml 00FF +quot 0022 +amp 0026 +lt 003C +gt 003E +apos 0027 +OElig 0152 +oelig 0153 +Scaron 0160 +scaron 0161 +Yuml 0178 +circ 02C6 +tilde 02DC +ensp 2002 +emsp 2003 +thinsp 2009 +zwnj 200C +zwj 200D +lrm 200E +rlm 200F +ndash 2013 +mdash 2014 +lsquo 2018 +rsquo 2019 +sbquo 201A +ldquo 201C +rdquo 201D +bdquo 201E +dagger 2020 +Dagger 2021 +permil 2030 +lsaquo 2039 +rsaquo 203A +euro 20AC +fnof 0192 +Alpha 0391 +Beta 0392 +Gamma 0393 +Delta 0394 +Epsilon 0395 +Zeta 0396 +Eta 0397 +Theta 0398 +Iota 0399 +Kappa 039A +Lambda 039B +Mu 039C +Nu 039D +Xi 039E +Omicron 039F +Pi 03A0 +Rho 03A1 +Sigma 03A3 +Tau 03A4 +Upsilon 03A5 +Phi 03A6 +Chi 03A7 +Psi 03A8 +Omega 03A9 +alpha 03B1 +beta 03B2 +gamma 03B3 +delta 03B4 +epsilon 03B5 +zeta 03B6 +eta 03B7 +theta 03B8 +iota 03B9 +kappa 03BA +lambda 03BB +mu 03BC +nu 03BD +xi 03BE +omicron 03BF +pi 03C0 +rho 03C1 +sigmaf 03C2 +sigma 03C3 +tau 03C4 +upsilon 03C5 +phi 03C6 +chi 03C7 +psi 03C8 +omega 03C9 +thetasym 03D1 +upsih 03D2 +piv 03D6 +bull 2022 +hellip 2026 +prime 2032 +Prime 2033 +oline 203E +frasl 2044 +weierp 2118 +image 2111 +real 211C +trade 2122 +alefsym 2135 +larr 2190 +uarr 2191 +rarr 2192 +darr 2193 +harr 2194 +crarr 21B5 +lArr 21D0 +uArr 21D1 +rArr 21D2 +dArr 21D3 +hArr 21D4 +forall 2200 +part 2202 +exist 2203 +empty 2205 +nabla 2207 +isin 2208 +notin 2209 +ni 220B +prod 220F +sum 2211 +minus 2212 +lowast 2217 +radic 221A +prop 221D +infin 221E +ang 2220 +and 2227 +or 2228 +cap 2229 +cup 222A +int 222B +there4 2234 +sim 223C +cong 2245 +asymp 2248 +ne 2260 +equiv 2261 +le 2264 +ge 2265 +sub 2282 +sup 2283 +nsub 2284 +sube 2286 +supe 2287 +oplus 2295 +otimes 2297 +perp 22A5 +sdot 22C5 +lceil 2308 +rceil 2309 +lfloor 230A +rfloor 230B +lang 2329 +rang 232A +loz 25CA +spades 2660 +clubs 2663 +hearts 2665 +diams 2666 \ No newline at end of file diff --git a/ext/standard/html_tables/html_table_gen.php b/ext/standard/html_tables/html_table_gen.php new file mode 100644 index 0000000..7e7314f --- /dev/null +++ b/ext/standard/html_tables/html_table_gen.php @@ -0,0 +1,812 @@ + | + +----------------------------------------------------------------------+ +*/ + +/* This file prints to stdout the contents of ext/standard/html_tables.h */ +/* put together with glue; have patience */ + +$t = << cs_utf_8 && (cs) < cs_big5) +#define CHARSET_PARTIAL_SUPPORT(cs) ((cs) >= cs_big5) + +static const struct { + const char *codeset; + enum entity_charset charset; +} charset_map[] = { + { "ISO-8859-1", cs_8859_1 }, + { "ISO8859-1", cs_8859_1 }, + { "ISO-8859-15", cs_8859_15 }, + { "ISO8859-15", cs_8859_15 }, + { "utf-8", cs_utf_8 }, + { "cp1252", cs_cp1252 }, + { "Windows-1252", cs_cp1252 }, + { "1252", cs_cp1252 }, + { "BIG5", cs_big5 }, + { "950", cs_big5 }, + { "GB2312", cs_gb2312 }, + { "936", cs_gb2312 }, + { "BIG5-HKSCS", cs_big5hkscs }, + { "Shift_JIS", cs_sjis }, + { "SJIS", cs_sjis }, + { "932", cs_sjis }, + { "EUCJP", cs_eucjp }, + { "EUC-JP", cs_eucjp }, + { "KOI8-R", cs_koi8r }, + { "koi8-ru", cs_koi8r }, + { "koi8r", cs_koi8r }, + { "cp1251", cs_cp1251 }, + { "Windows-1251", cs_cp1251 }, + { "win-1251", cs_cp1251 }, + { "iso8859-5", cs_8859_5 }, + { "iso-8859-5", cs_8859_5 }, + { "cp866", cs_cp866 }, + { "866", cs_cp866 }, + { "ibm866", cs_cp866 }, + { "MacRoman", cs_macroman }, + { NULL } +}; + +/* longest entity name length excluding & and ; */ +#define LONGEST_ENTITY_LENGTH 31 + +/* Definitions for mappings *to* Unicode. + * The origin charset must have at most 256 code points. + * The multi-byte encodings are not supported */ +typedef struct { + unsigned short uni_cp[64]; +} enc_to_uni_stage2; + +typedef struct { + const enc_to_uni_stage2 *inner[4]; +} enc_to_uni; + +/* bits 7-8 bits (only single bytes encodings supported )*/ +#define ENT_ENC_TO_UNI_STAGE1(k) ((k & 0xC0) >> 6) +/* bits 1-6 */ +#define ENT_ENC_TO_UNI_STAGE2(k) ((k) & 0x3F) + + +CODE; + +echo sprintf($t, date("Y")); + +$encodings = array( + array( + "ident" => "iso88591", + "enumid" => 1, + "name" => "ISO-8859-1", + "file" => "mappings/8859-1.TXT", + ), + array( + "ident" => "iso88595", + "enumid" => 5, + "name" => "ISO-8859-5", + "file" => "mappings/8859-5.TXT", + ), + array( + "ident" => "iso885915", + "enumid" => 3, + "name" => "ISO-8859-15", + "file" => "mappings/8859-15.TXT", + ), + array( + "ident" => "win1252", + "enumid" => 2, + "enumident" => "cp1252", + "name" => "Windows-1252", + "file" => "mappings/CP1252.TXT", + ), + array( + "ident" => "win1251", + "enumid" => 4, + "enumident" => "cp1252", + "name" => "Windows-1251", + "file" => "mappings/CP1251.TXT", + ), + array( + "ident" => "koi8r", + "enumid" => 8, + "name" => "KOI8-R", + "file" => "mappings/KOI8-R.TXT", + ), + array( + "ident" => "cp866", + "enumid" => 6, + "name" => "CP-866", + "file" => "mappings/CP866.TXT", + ), + array( + "ident" => "macroman", + "enumid" => 7, + "name" => "MacRoman", + "file" => "mappings/ROMAN.TXT", + ), +); + +$prevStage2 = array(); + +foreach ($encodings as $e) { + echo +"/* {{{ Mappings *to* Unicode for {$e['name']} */\n\n"; + + /* process file */ + $map = array(); + $lines = explode("\n", file_get_contents($e{'file'})); + foreach ($lines as $l) { + if (preg_match("/^0x([0-9A-Z]{2})\t0x([0-9A-Z]{2,})/i", $l, $matches)) + $map[] = array($matches[1], $matches[2]); + } + + $mappy = array(); + foreach ($map as $v) { $mappy[hexdec($v[0])] = hexdec($v[1]); } + + $mstable = array("ident" => $e['ident']); + /* calculate two-stage tables */ + for ($i = 0; $i < 4; $i++) { + for ($j = 0; $j < 64; $j++) { + $cp = $i << 6 | $j; + $mstable[$i][$j] = isset($mappy[$cp]) ? $mappy[$cp] : NULL; + } + } + + echo +"/* {{{ Stage 2 tables for {$e['name']} */\n\n"; + + $s2tables_idents = array(); + for ($i = 0; $i < 4; $i++) { + if (($t = array_keys($prevStage2, $mstable[$i])) !== array()) { + $s2tables_idents[$i] = $encodings[$t[0]/5]["ident"]; + continue; + } + + $s2tables_idents[$i] = $e["ident"]; + + echo "static const enc_to_uni_stage2 enc_to_uni_s2_{$e['ident']}_". + sprintf("%02X", $i << 6)." = { {\n"; + for ($j = 0; $j < 64; $j++) { + if ($j == 0) echo "\t"; + elseif ($j % 6 == 0) echo "\n\t"; + else echo " "; + if ($mstable[$i][$j] !== NULL) + echo sprintf("0x%04X,", $mstable[$i][$j]); + else + echo "0xFFFF,"; /* special value; indicates no mapping */ + } + echo "\n} };\n\n"; + + $prevStage2[] = $mstable[$i]; + } + + echo +"/* end of stage 2 tables for {$e['name']} }}} */\n\n"; + + echo +"/* {{{ Stage 1 table for {$e['name']} */\n"; + + echo +"static const enc_to_uni enc_to_uni_{$e['ident']} = { { +\t&enc_to_uni_s2_{$s2tables_idents[0]}_00, +\t&enc_to_uni_s2_{$s2tables_idents[1]}_40, +\t&enc_to_uni_s2_{$s2tables_idents[2]}_80, +\t&enc_to_uni_s2_{$s2tables_idents[3]}_C0 } +}; +"; + + echo +"/* end of stage 1 table for {$e['name']} }}} */\n\n"; +} + +$maxencnum = max(array_map(function($e) { return $e['enumid']; }, $encodings)); +$a = range(0, $maxencnum); +foreach ($encodings as $e) { $a[$e['enumid']] = $e['ident']; } + + echo +"/* {{{ Index of tables for encoding conversion */ +static const enc_to_uni *const enc_to_uni_index[cs_numelems] = {\n"; + +foreach ($a as $k => $v) { + if (is_numeric($v)) + echo "\tNULL,\n"; + else + echo "\t&enc_to_uni_$v,\n"; +} + + echo +"}; +/* }}} */\n"; + +$t = << "iso885915", + "name" => "ISO-8859-15", + "file" => "mappings/8859-15.TXT", + "range" => array(0xA4, 0xBE), + ), + array( + "ident" => "win1252", + "name" => "Windows-1252", + "file" => "mappings/CP1252.TXT", + "range" => array(0x80, 0x9F), + ), + array( + "ident" => "win1251", + "name" => "Windows-1251", + "file" => "mappings/CP1251.TXT", + "range" => array(0x80, 0xFF), + ), + array( + "ident" => "koi8r", + "name" => "KOI8-R", + "file" => "mappings/KOI8-R.TXT", + "range" => array(0x80, 0xFF), + ), + array( + "ident" => "cp866", + "name" => "CP-866", + "file" => "mappings/CP866.TXT", + "range" => array(0x80, 0xFF), + ), + array( + "ident" => "macroman", + "name" => "MacRoman", + "file" => "mappings/ROMAN.TXT", + "range" => array(0x80, 0xFF), + ), +); + +foreach ($encodings as $e) { + echo +"/* {{{ Mappings *from* Unicode for {$e['name']} */\n"; + + /* process file */ + $map = array(); + $lines = explode("\n", file_get_contents($e{'file'})); + foreach ($lines as $l) { + if (preg_match("/^0x([0-9A-Z]{2})\t0x([0-9A-Z]{2,})\s+#\s*(.*)$/i", $l, $matches)) + $map[] = array($matches[1], $matches[2], rtrim($matches[3])); + } + + $mappy = array(); + foreach ($map as $v) { + if (hexdec($v[0]) >= $e['range'][0] && hexdec($v[0]) <= $e['range'][1]) + $mappy[hexdec($v[1])] = array(hexdec($v[0]), strtolower($v[2])); + } + ksort($mappy); + + echo +"static const uni_to_enc unimap_{$e['ident']}[] = {\n"; + + foreach ($mappy as $k => $v) { + echo "\t{ ", sprintf("0x%04X", $k), ", ", sprintf("0x%02X", $v[0]), " },\t/* ", + $v[1], " */\n"; + } + echo "};\n"; + + echo +"/* {{{ end of mappings *from* Unicode for {$e['name']} */\n\n"; +} + +$data = file_get_contents("ents_html5.txt"); +$pass2 = false; +$name = "HTML5"; +$ident = "html5"; +again: + +$t = <<<'CODE' +/* HTML 5 has many more named entities. + * Some of them map to two unicode code points, not one. + * We're going to use a three-stage table (with an extra one for the entities + * with two code points). */ + +#define ENT_STAGE1_INDEX(k) (((k) & 0xFFF000) >> 12) /* > 1D, we have no mapping */ +#define ENT_STAGE2_INDEX(k) (((k) & 0xFC0) >> 6) +#define ENT_STAGE3_INDEX(k) ((k) & 0x3F) +#define ENT_CODE_POINT_FROM_STAGES(i,j,k) (((i) << 12) | ((j) << 6) | (k)) + +/* Table should be organized with a leading row telling the size of + * the table and the default entity (maybe NULL) and the rest being + * normal rows ordered by code point so that we can do a binary search */ +typedef union { + struct { + unsigned size; /* number of remaining entries in the table */ + const char *default_entity; + unsigned short default_entity_len; + } leading_entry; + struct { + unsigned second_cp; /* second code point */ + const char *entity; + unsigned short entity_len; + } normal_entry; +} entity_multicodepoint_row; + +/* blocks of these should start at code points k where k % 0xFC0 == 0 */ +typedef struct { + char ambiguous; /* if 0 look into entity */ + union { + struct { + const char *entity; /* may be NULL */ + unsigned short entity_len; + } ent; + const entity_multicodepoint_row *multicodepoint_table; + } data; +} entity_stage3_row; + +/* Calculate k & 0x3F Use as offset */ +typedef const entity_stage3_row *entity_stage2_row; /* 64 elements */ + +/* Calculate k & 0xFC0 >> 6. Use as offset */ +typedef const entity_stage3_row *const *entity_stage1_row; /* 64 elements */ + +/* For stage 1, Calculate k & 0xFFF000 >> 3*4. + * If larger than 1D, we have no mapping. Otherwise lookup that index */ + +typedef struct { + const entity_stage1_row *ms_table; + /* for tables with only basic entities, this member is to be accessed + * directly for better performance: */ + const entity_stage3_row *table; +} entity_table_opt; + +/* Replaced "GT" > "gt" and "QUOT" > "quot" for consistency's sake. */ + + +CODE; + +if (!$pass2) + echo $t; + +$dp = array(); + +foreach (explode("\n", $data) as $l) { + if (preg_match('/^(#?[a-z0-9]+)\s+([a-f0-9]+) ([a-f0-9]+)/i', $l, $matches)) { + //echo sprintf("\t{\"%-21s 1, 0x%05d},\n", $matches[1].",", $matches[2]); + $dp[] = array($matches[1], $matches[2], $matches[3]); + } else if (preg_match('/^(#?[a-z0-9]+)\s+([a-f0-9]+)/i', $l, $matches)) { + $dp[] = array($matches[1], $matches[2]); + } +} + +$origdp = $dp; + +usort($dp, function($a, $b) { return hexdec($a[1])-hexdec($b[1]); }); + +$multicp_rows = array(); +foreach ($dp as $el) { + if (count($el) == 3) { + $multicp_rows[$el[1]] = array(); + } +} + +foreach ($dp as $el) { + if (key_exists($el[1], $multicp_rows)) { + if (count($el) == 3) + $multicp_rows[$el[1]][$el[2]] = $el[0]; + else + $multicp_rows[$el[1]]["default"] = $el[0]; + } +} + +if ($pass2 < 2) + echo "/* {{{ Start of $name multi-stage table for codepoint -> entity */", "\n\n"; +else + echo "/* {{{ Start of $name table for codepoint -> entity */", "\n\n"; + +if (empty($multicp_rows)) + goto skip_multicp; + +ksort($multicp_rows); +foreach ($multicp_rows as &$v) { ksort($v); } + +echo +"/* {{{ Start of double code point tables for $name */", "\n\n"; + +foreach ($multicp_rows as $k => $v) { + echo "static const entity_multicodepoint_row multi_cp_{$ident}_", + sprintf("%05s", $k), "[] = {", "\n"; + if (key_exists("default", $v)) { + if ($v['default'] == 'GT') /* hack to make > translate to > not GT; */ + $v['default'] = "gt"; + echo "\t{ {", sprintf("%02d", count($v) - 1), + ",\t\t", sprintf("\"%-21s", $v["default"].'",'), "\t", + sprintf("% 2d", strlen($v["default"])), '} },', "\n"; + } else { + echo "\t{ {", sprintf("%02d", count($v)), + ",\t\t", sprintf("%-22s", 'NULL'), ",\t0} },\n"; + } + unset($v["default"]); + foreach ($v as $l => $w) { + echo "\t{ {", sprintf("0x%05s", $l), ",\t", sprintf("\"%-21s", $w.'",'), "\t", + sprintf("% 2d", strlen($w)), '} },', "\n"; + } + echo "};\n"; +} +echo "\n/* End of double code point tables }}} */", "\n\n"; + +skip_multicp: + +if ($pass2 < 2) + echo "/* {{{ Stage 3 Tables for $name */", "\n\n"; + +$t = <<> 12; + $s2 = (hexdec($el[1]) & 0xFC0) >> 6; + $s3 = hexdec($el[1]) & 0x3F; + if (key_exists($el[1], $multicp_rows)) { + $mstable[$s1][$s2][$s3] = ""; + } else { + $mstable[$s1][$s2][$s3] = $el[0]; + } +} + +for ($i = 0; $i < 0x1E; $i++) { + for ($k = 0; $k < 64; $k++) { + $any3 = false; + $col3 = array(); + for ($l = 0; $l < 64; $l++) { + if (isset($mstable[$i][$k][$l])) { + $any3 = true; + $col3[$l] = $mstable[$i][$k][$l]; + } else { + $col3[$l] = null; + } + } + if ($any3) { + echo "static const entity_stage3_row stage3_table_{$ident}_", + sprintf("%02X%03X", $i, $k << 6), "[] = {\n"; + foreach ($col3 as $y => $z) { + if ($y == 0) echo "\t"; + elseif ($y % 4 == 0) echo "\n\t"; + else echo " "; + if ($z === NULL) + echo "{0, { {NULL, 0} } },"; + elseif ($z === "QUOT") /* hack to translate " into "e;, not " */ + echo "{0, { {\"quot\", 4} } },"; + elseif ($z !== "") + echo "{0, { {\"$z\", ", strlen($z), "} } },"; + else + echo "{1, { {(void *)", sprintf("multi_cp_{$ident}_%05X", + ($i << 12) | ($k << 6) | $y ), "} } },"; + + } + echo "\n};\n\n"; + } + } +} + +if ($pass2 < 2) + echo "/* end of stage 3 Tables for $name }}} */", "\n\n"; + +if ($pass2 > 1) + goto hashtables; + +echo +"/* {{{ Stage 2 Tables for $name */", "\n\n"; + +$t = << entity }}} */\n\n"; + +/* commented-out; this enabled binary search, which turned out to be + * significantly slower than the hash tables for html 5 entities */ +//echo +//"/* {{{ HTML 5 tables for entity -> codepoint */", "\n\n"; + +//$t = << $entlen*1.2) { +// die("violated assumption for traverse_for_entities"); +// } +// } +// +// $k++; +//} +//echo "\n};\n\n"; +// +//echo "static const size_t html5_ent_cp_map_size = $k;\n\n"; +// +//echo +//"/* end of HTML 5 tables for entity -> codepoint }}} */\n\n"; + +hashtables: + +echo +"/* {{{ $name hash table for entity -> codepoint */", "\n\n"; + +$t = << 0; $nKeyLength--) { + $hash = (int)(((int)(((int)($hash << 5)) + $hash)) + ord($str[$pos++])) + & 0xFFFFFFFF; + } + return $hash; + +} + +$numelems = max(pow(2, ceil(log(1.5*count($origdp))/log(2))),16); +$mask = $numelems - 1; +$hashes = array(); +foreach ($origdp as $e) { + $hashes[hashfun($e[0]) & $mask][] = $e; + if (isset($e[2])) { + $entlen = strlen($e[0]) + 2; + $utf8len = strlen( + mb_convert_encoding("&#x{$e[1]};&#x{$e[2]};", "UTF-8", "HTML-ENTITIES")); + if ($utf8len > $entlen*1.2) { + die("violated assumption for traverse_for_entities"); + } + } +} + +for ($i = 0; $i < $numelems; $i++) { + if (empty($hashes[$i])) + continue; + echo "static const entity_cp_map ht_bucket_{$ident}_", sprintf("%03X", $i) ,"[] = {"; + foreach ($hashes[$i] as $h) { + if (isset($h[2])) { + echo sprintf(' {"%s", %d, 0x%05X, 0x%05X},', + $h[0], strlen($h[0]), hexdec($h[1]), hexdec($h[2])); + } else { + echo sprintf(' {"%s", %d, 0x%05X, 0},', + $h[0], strlen($h[0]), hexdec($h[1])); + } + } + echo " {NULL, 0, 0, 0} };\n"; +} +echo "\n"; + +echo +"static const entity_cp_map *const ht_buckets_{$ident}[] = {\n"; + +for ($i = 0; $i < $numelems; $i++) { + if ($i == 0) echo "\t"; + elseif ($i % 4 == 0) echo "\n\t"; + else echo " "; + if (empty($hashes[$i])) + echo "ht_bucket_empty,"; + else + echo "ht_bucket_{$ident}_", sprintf("%03X", $i), ","; +} +echo "\n};\n\n"; + +echo +"static const entity_ht ent_ht_{$ident} = { + ", sprintf("0x%X", $numelems), ", + ht_buckets_{$ident} +};\n\n"; + +echo +"/* end of $name hash table for entity -> codepoint }}} */\n\n"; + +if (!$pass2) { + $data = file_get_contents("ents_html401.txt"); + $pass2 = 1; + $name = "HTML 4.01"; + $ident = "html4"; + goto again; +} elseif ($pass2 == 1) { + $data = file_get_contents("ents_basic.txt"); + $pass2 = 2; + $name = "Basic entities (no apos)"; + $ident = "be_noapos"; + goto again; +} elseif ($pass2 == 2) { + $data = file_get_contents("ents_basic_apos.txt"); + $pass2 = 3; + $name = "Basic entities (with apos)"; + $ident = "be_apos"; + goto again; +} + +echo "#endif /* HTML_TABLES_H */\n"; diff --git a/ext/standard/html_tables/mappings/8859-1.TXT b/ext/standard/html_tables/mappings/8859-1.TXT new file mode 100644 index 0000000..473ecab --- /dev/null +++ b/ext/standard/html_tables/mappings/8859-1.TXT @@ -0,0 +1,303 @@ +# +# Name: ISO/IEC 8859-1:1998 to Unicode +# Unicode version: 3.0 +# Table version: 1.0 +# Table format: Format A +# Date: 1999 July 27 +# Authors: Ken Whistler +# +# Copyright (c) 1991-1999 Unicode, Inc. All Rights reserved. +# +# This file is provided as-is by Unicode, Inc. (The Unicode Consortium). +# No claims are made as to fitness for any particular purpose. No +# warranties of any kind are expressed or implied. The recipient +# agrees to determine applicability of information provided. If this +# file has been provided on optical media by Unicode, Inc., the sole +# remedy for any claim will be exchange of defective media within 90 +# days of receipt. +# +# Unicode, Inc. hereby grants the right to freely use the information +# supplied in this file in the creation of products supporting the +# Unicode Standard, and to make copies of this file in any form for +# internal or external distribution as long as this notice remains +# attached. +# +# General notes: +# +# This table contains the data the Unicode Consortium has on how +# ISO/IEC 8859-1:1998 characters map into Unicode. +# +# Format: Three tab-separated columns +# Column #1 is the ISO/IEC 8859-1 code (in hex as 0xXX) +# Column #2 is the Unicode (in hex as 0xXXXX) +# Column #3 the Unicode name (follows a comment sign, '#') +# +# The entries are in ISO/IEC 8859-1 order. +# +# Version history +# 1.0 version updates 0.1 version by adding mappings for all +# control characters. +# +# Updated versions of this file may be found in: +# +# +# Any comments or problems, contact +# Please note that is an archival address; +# notices will be checked, but do not expect an immediate response. +# +0x00 0x0000 # NULL +0x01 0x0001 # START OF HEADING +0x02 0x0002 # START OF TEXT +0x03 0x0003 # END OF TEXT +0x04 0x0004 # END OF TRANSMISSION +0x05 0x0005 # ENQUIRY +0x06 0x0006 # ACKNOWLEDGE +0x07 0x0007 # BELL +0x08 0x0008 # BACKSPACE +0x09 0x0009 # HORIZONTAL TABULATION +0x0A 0x000A # LINE FEED +0x0B 0x000B # VERTICAL TABULATION +0x0C 0x000C # FORM FEED +0x0D 0x000D # CARRIAGE RETURN +0x0E 0x000E # SHIFT OUT +0x0F 0x000F # SHIFT IN +0x10 0x0010 # DATA LINK ESCAPE +0x11 0x0011 # DEVICE CONTROL ONE +0x12 0x0012 # DEVICE CONTROL TWO +0x13 0x0013 # DEVICE CONTROL THREE +0x14 0x0014 # DEVICE CONTROL FOUR +0x15 0x0015 # NEGATIVE ACKNOWLEDGE +0x16 0x0016 # SYNCHRONOUS IDLE +0x17 0x0017 # END OF TRANSMISSION BLOCK +0x18 0x0018 # CANCEL +0x19 0x0019 # END OF MEDIUM +0x1A 0x001A # SUBSTITUTE +0x1B 0x001B # ESCAPE +0x1C 0x001C # FILE SEPARATOR +0x1D 0x001D # GROUP SEPARATOR +0x1E 0x001E # RECORD SEPARATOR +0x1F 0x001F # UNIT SEPARATOR +0x20 0x0020 # SPACE +0x21 0x0021 # EXCLAMATION MARK +0x22 0x0022 # QUOTATION MARK +0x23 0x0023 # NUMBER SIGN +0x24 0x0024 # DOLLAR SIGN +0x25 0x0025 # PERCENT SIGN +0x26 0x0026 # AMPERSAND +0x27 0x0027 # APOSTROPHE +0x28 0x0028 # LEFT PARENTHESIS +0x29 0x0029 # RIGHT PARENTHESIS +0x2A 0x002A # ASTERISK +0x2B 0x002B # PLUS SIGN +0x2C 0x002C # COMMA +0x2D 0x002D # HYPHEN-MINUS +0x2E 0x002E # FULL STOP +0x2F 0x002F # SOLIDUS +0x30 0x0030 # DIGIT ZERO +0x31 0x0031 # DIGIT ONE +0x32 0x0032 # DIGIT TWO +0x33 0x0033 # DIGIT THREE +0x34 0x0034 # DIGIT FOUR +0x35 0x0035 # DIGIT FIVE +0x36 0x0036 # DIGIT SIX +0x37 0x0037 # DIGIT SEVEN +0x38 0x0038 # DIGIT EIGHT +0x39 0x0039 # DIGIT NINE +0x3A 0x003A # COLON +0x3B 0x003B # SEMICOLON +0x3C 0x003C # LESS-THAN SIGN +0x3D 0x003D # EQUALS SIGN +0x3E 0x003E # GREATER-THAN SIGN +0x3F 0x003F # QUESTION MARK +0x40 0x0040 # COMMERCIAL AT +0x41 0x0041 # LATIN CAPITAL LETTER A +0x42 0x0042 # LATIN CAPITAL LETTER B +0x43 0x0043 # LATIN CAPITAL LETTER C +0x44 0x0044 # LATIN CAPITAL LETTER D +0x45 0x0045 # LATIN CAPITAL LETTER E +0x46 0x0046 # LATIN CAPITAL LETTER F +0x47 0x0047 # LATIN CAPITAL LETTER G +0x48 0x0048 # LATIN CAPITAL LETTER H +0x49 0x0049 # LATIN CAPITAL LETTER I +0x4A 0x004A # LATIN CAPITAL LETTER J +0x4B 0x004B # LATIN CAPITAL LETTER K +0x4C 0x004C # LATIN CAPITAL LETTER L +0x4D 0x004D # LATIN CAPITAL LETTER M +0x4E 0x004E # LATIN CAPITAL LETTER N +0x4F 0x004F # LATIN CAPITAL LETTER O +0x50 0x0050 # LATIN CAPITAL LETTER P +0x51 0x0051 # LATIN CAPITAL LETTER Q +0x52 0x0052 # LATIN CAPITAL LETTER R +0x53 0x0053 # LATIN CAPITAL LETTER S +0x54 0x0054 # LATIN CAPITAL LETTER T +0x55 0x0055 # LATIN CAPITAL LETTER U +0x56 0x0056 # LATIN CAPITAL LETTER V +0x57 0x0057 # LATIN CAPITAL LETTER W +0x58 0x0058 # LATIN CAPITAL LETTER X +0x59 0x0059 # LATIN CAPITAL LETTER Y +0x5A 0x005A # LATIN CAPITAL LETTER Z +0x5B 0x005B # LEFT SQUARE BRACKET +0x5C 0x005C # REVERSE SOLIDUS +0x5D 0x005D # RIGHT SQUARE BRACKET +0x5E 0x005E # CIRCUMFLEX ACCENT +0x5F 0x005F # LOW LINE +0x60 0x0060 # GRAVE ACCENT +0x61 0x0061 # LATIN SMALL LETTER A +0x62 0x0062 # LATIN SMALL LETTER B +0x63 0x0063 # LATIN SMALL LETTER C +0x64 0x0064 # LATIN SMALL LETTER D +0x65 0x0065 # LATIN SMALL LETTER E +0x66 0x0066 # LATIN SMALL LETTER F +0x67 0x0067 # LATIN SMALL LETTER G +0x68 0x0068 # LATIN SMALL LETTER H +0x69 0x0069 # LATIN SMALL LETTER I +0x6A 0x006A # LATIN SMALL LETTER J +0x6B 0x006B # LATIN SMALL LETTER K +0x6C 0x006C # LATIN SMALL LETTER L +0x6D 0x006D # LATIN SMALL LETTER M +0x6E 0x006E # LATIN SMALL LETTER N +0x6F 0x006F # LATIN SMALL LETTER O +0x70 0x0070 # LATIN SMALL LETTER P +0x71 0x0071 # LATIN SMALL LETTER Q +0x72 0x0072 # LATIN SMALL LETTER R +0x73 0x0073 # LATIN SMALL LETTER S +0x74 0x0074 # LATIN SMALL LETTER T +0x75 0x0075 # LATIN SMALL LETTER U +0x76 0x0076 # LATIN SMALL LETTER V +0x77 0x0077 # LATIN SMALL LETTER W +0x78 0x0078 # LATIN SMALL LETTER X +0x79 0x0079 # LATIN SMALL LETTER Y +0x7A 0x007A # LATIN SMALL LETTER Z +0x7B 0x007B # LEFT CURLY BRACKET +0x7C 0x007C # VERTICAL LINE +0x7D 0x007D # RIGHT CURLY BRACKET +0x7E 0x007E # TILDE +0x7F 0x007F # DELETE +0x80 0x0080 # +0x81 0x0081 # +0x82 0x0082 # +0x83 0x0083 # +0x84 0x0084 # +0x85 0x0085 # +0x86 0x0086 # +0x87 0x0087 # +0x88 0x0088 # +0x89 0x0089 # +0x8A 0x008A # +0x8B 0x008B # +0x8C 0x008C # +0x8D 0x008D # +0x8E 0x008E # +0x8F 0x008F # +0x90 0x0090 # +0x91 0x0091 # +0x92 0x0092 # +0x93 0x0093 # +0x94 0x0094 # +0x95 0x0095 # +0x96 0x0096 # +0x97 0x0097 # +0x98 0x0098 # +0x99 0x0099 # +0x9A 0x009A # +0x9B 0x009B # +0x9C 0x009C # +0x9D 0x009D # +0x9E 0x009E # +0x9F 0x009F # +0xA0 0x00A0 # NO-BREAK SPACE +0xA1 0x00A1 # INVERTED EXCLAMATION MARK +0xA2 0x00A2 # CENT SIGN +0xA3 0x00A3 # POUND SIGN +0xA4 0x00A4 # CURRENCY SIGN +0xA5 0x00A5 # YEN SIGN +0xA6 0x00A6 # BROKEN BAR +0xA7 0x00A7 # SECTION SIGN +0xA8 0x00A8 # DIAERESIS +0xA9 0x00A9 # COPYRIGHT SIGN +0xAA 0x00AA # FEMININE ORDINAL INDICATOR +0xAB 0x00AB # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +0xAC 0x00AC # NOT SIGN +0xAD 0x00AD # SOFT HYPHEN +0xAE 0x00AE # REGISTERED SIGN +0xAF 0x00AF # MACRON +0xB0 0x00B0 # DEGREE SIGN +0xB1 0x00B1 # PLUS-MINUS SIGN +0xB2 0x00B2 # SUPERSCRIPT TWO +0xB3 0x00B3 # SUPERSCRIPT THREE +0xB4 0x00B4 # ACUTE ACCENT +0xB5 0x00B5 # MICRO SIGN +0xB6 0x00B6 # PILCROW SIGN +0xB7 0x00B7 # MIDDLE DOT +0xB8 0x00B8 # CEDILLA +0xB9 0x00B9 # SUPERSCRIPT ONE +0xBA 0x00BA # MASCULINE ORDINAL INDICATOR +0xBB 0x00BB # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK +0xBC 0x00BC # VULGAR FRACTION ONE QUARTER +0xBD 0x00BD # VULGAR FRACTION ONE HALF +0xBE 0x00BE # VULGAR FRACTION THREE QUARTERS +0xBF 0x00BF # INVERTED QUESTION MARK +0xC0 0x00C0 # LATIN CAPITAL LETTER A WITH GRAVE +0xC1 0x00C1 # LATIN CAPITAL LETTER A WITH ACUTE +0xC2 0x00C2 # LATIN CAPITAL LETTER A WITH CIRCUMFLEX +0xC3 0x00C3 # LATIN CAPITAL LETTER A WITH TILDE +0xC4 0x00C4 # LATIN CAPITAL LETTER A WITH DIAERESIS +0xC5 0x00C5 # LATIN CAPITAL LETTER A WITH RING ABOVE +0xC6 0x00C6 # LATIN CAPITAL LETTER AE +0xC7 0x00C7 # LATIN CAPITAL LETTER C WITH CEDILLA +0xC8 0x00C8 # LATIN CAPITAL LETTER E WITH GRAVE +0xC9 0x00C9 # LATIN CAPITAL LETTER E WITH ACUTE +0xCA 0x00CA # LATIN CAPITAL LETTER E WITH CIRCUMFLEX +0xCB 0x00CB # LATIN CAPITAL LETTER E WITH DIAERESIS +0xCC 0x00CC # LATIN CAPITAL LETTER I WITH GRAVE +0xCD 0x00CD # LATIN CAPITAL LETTER I WITH ACUTE +0xCE 0x00CE # LATIN CAPITAL LETTER I WITH CIRCUMFLEX +0xCF 0x00CF # LATIN CAPITAL LETTER I WITH DIAERESIS +0xD0 0x00D0 # LATIN CAPITAL LETTER ETH (Icelandic) +0xD1 0x00D1 # LATIN CAPITAL LETTER N WITH TILDE +0xD2 0x00D2 # LATIN CAPITAL LETTER O WITH GRAVE +0xD3 0x00D3 # LATIN CAPITAL LETTER O WITH ACUTE +0xD4 0x00D4 # LATIN CAPITAL LETTER O WITH CIRCUMFLEX +0xD5 0x00D5 # LATIN CAPITAL LETTER O WITH TILDE +0xD6 0x00D6 # LATIN CAPITAL LETTER O WITH DIAERESIS +0xD7 0x00D7 # MULTIPLICATION SIGN +0xD8 0x00D8 # LATIN CAPITAL LETTER O WITH STROKE +0xD9 0x00D9 # LATIN CAPITAL LETTER U WITH GRAVE +0xDA 0x00DA # LATIN CAPITAL LETTER U WITH ACUTE +0xDB 0x00DB # LATIN CAPITAL LETTER U WITH CIRCUMFLEX +0xDC 0x00DC # LATIN CAPITAL LETTER U WITH DIAERESIS +0xDD 0x00DD # LATIN CAPITAL LETTER Y WITH ACUTE +0xDE 0x00DE # LATIN CAPITAL LETTER THORN (Icelandic) +0xDF 0x00DF # LATIN SMALL LETTER SHARP S (German) +0xE0 0x00E0 # LATIN SMALL LETTER A WITH GRAVE +0xE1 0x00E1 # LATIN SMALL LETTER A WITH ACUTE +0xE2 0x00E2 # LATIN SMALL LETTER A WITH CIRCUMFLEX +0xE3 0x00E3 # LATIN SMALL LETTER A WITH TILDE +0xE4 0x00E4 # LATIN SMALL LETTER A WITH DIAERESIS +0xE5 0x00E5 # LATIN SMALL LETTER A WITH RING ABOVE +0xE6 0x00E6 # LATIN SMALL LETTER AE +0xE7 0x00E7 # LATIN SMALL LETTER C WITH CEDILLA +0xE8 0x00E8 # LATIN SMALL LETTER E WITH GRAVE +0xE9 0x00E9 # LATIN SMALL LETTER E WITH ACUTE +0xEA 0x00EA # LATIN SMALL LETTER E WITH CIRCUMFLEX +0xEB 0x00EB # LATIN SMALL LETTER E WITH DIAERESIS +0xEC 0x00EC # LATIN SMALL LETTER I WITH GRAVE +0xED 0x00ED # LATIN SMALL LETTER I WITH ACUTE +0xEE 0x00EE # LATIN SMALL LETTER I WITH CIRCUMFLEX +0xEF 0x00EF # LATIN SMALL LETTER I WITH DIAERESIS +0xF0 0x00F0 # LATIN SMALL LETTER ETH (Icelandic) +0xF1 0x00F1 # LATIN SMALL LETTER N WITH TILDE +0xF2 0x00F2 # LATIN SMALL LETTER O WITH GRAVE +0xF3 0x00F3 # LATIN SMALL LETTER O WITH ACUTE +0xF4 0x00F4 # LATIN SMALL LETTER O WITH CIRCUMFLEX +0xF5 0x00F5 # LATIN SMALL LETTER O WITH TILDE +0xF6 0x00F6 # LATIN SMALL LETTER O WITH DIAERESIS +0xF7 0x00F7 # DIVISION SIGN +0xF8 0x00F8 # LATIN SMALL LETTER O WITH STROKE +0xF9 0x00F9 # LATIN SMALL LETTER U WITH GRAVE +0xFA 0x00FA # LATIN SMALL LETTER U WITH ACUTE +0xFB 0x00FB # LATIN SMALL LETTER U WITH CIRCUMFLEX +0xFC 0x00FC # LATIN SMALL LETTER U WITH DIAERESIS +0xFD 0x00FD # LATIN SMALL LETTER Y WITH ACUTE +0xFE 0x00FE # LATIN SMALL LETTER THORN (Icelandic) +0xFF 0x00FF # LATIN SMALL LETTER Y WITH DIAERESIS diff --git a/ext/standard/html_tables/mappings/8859-15.TXT b/ext/standard/html_tables/mappings/8859-15.TXT new file mode 100644 index 0000000..ab2f32f --- /dev/null +++ b/ext/standard/html_tables/mappings/8859-15.TXT @@ -0,0 +1,303 @@ +# +# Name: ISO/IEC 8859-15:1999 to Unicode +# Unicode version: 3.0 +# Table version: 1.0 +# Table format: Format A +# Date: 1999 July 27 +# Authors: Markus Kuhn +# Ken Whistler +# +# Copyright (c) 1998 - 1999 Unicode, Inc. All Rights reserved. +# +# This file is provided as-is by Unicode, Inc. (The Unicode Consortium). +# No claims are made as to fitness for any particular purpose. No +# warranties of any kind are expressed or implied. The recipient +# agrees to determine applicability of information provided. If this +# file has been provided on optical media by Unicode, Inc., the sole +# remedy for any claim will be exchange of defective media within 90 +# days of receipt. +# +# Unicode, Inc. hereby grants the right to freely use the information +# supplied in this file in the creation of products supporting the +# Unicode Standard, and to make copies of this file in any form for +# internal or external distribution as long as this notice remains +# attached. +# +# General notes: +# +# This table contains the data the Unicode Consortium has on how +# ISO/IEC 8859-15:1999 characters map into Unicode. +# +# Format: Three tab-separated columns +# Column #1 is the ISO/IEC 8859-15 code (in hex as 0xXX) +# Column #2 is the Unicode (in hex as 0xXXXX) +# Column #3 the Unicode name (follows a comment sign, '#') +# +# The entries are in ISO/IEC 8859-15 order. +# +# Version history +# +# Updated versions of this file may be found in: +# +# +# Any comments or problems, contact +# Please note that is an archival address; +# notices will be checked, but do not expect an immediate response. +# +0x00 0x0000 # NULL +0x01 0x0001 # START OF HEADING +0x02 0x0002 # START OF TEXT +0x03 0x0003 # END OF TEXT +0x04 0x0004 # END OF TRANSMISSION +0x05 0x0005 # ENQUIRY +0x06 0x0006 # ACKNOWLEDGE +0x07 0x0007 # BELL +0x08 0x0008 # BACKSPACE +0x09 0x0009 # HORIZONTAL TABULATION +0x0A 0x000A # LINE FEED +0x0B 0x000B # VERTICAL TABULATION +0x0C 0x000C # FORM FEED +0x0D 0x000D # CARRIAGE RETURN +0x0E 0x000E # SHIFT OUT +0x0F 0x000F # SHIFT IN +0x10 0x0010 # DATA LINK ESCAPE +0x11 0x0011 # DEVICE CONTROL ONE +0x12 0x0012 # DEVICE CONTROL TWO +0x13 0x0013 # DEVICE CONTROL THREE +0x14 0x0014 # DEVICE CONTROL FOUR +0x15 0x0015 # NEGATIVE ACKNOWLEDGE +0x16 0x0016 # SYNCHRONOUS IDLE +0x17 0x0017 # END OF TRANSMISSION BLOCK +0x18 0x0018 # CANCEL +0x19 0x0019 # END OF MEDIUM +0x1A 0x001A # SUBSTITUTE +0x1B 0x001B # ESCAPE +0x1C 0x001C # FILE SEPARATOR +0x1D 0x001D # GROUP SEPARATOR +0x1E 0x001E # RECORD SEPARATOR +0x1F 0x001F # UNIT SEPARATOR +0x20 0x0020 # SPACE +0x21 0x0021 # EXCLAMATION MARK +0x22 0x0022 # QUOTATION MARK +0x23 0x0023 # NUMBER SIGN +0x24 0x0024 # DOLLAR SIGN +0x25 0x0025 # PERCENT SIGN +0x26 0x0026 # AMPERSAND +0x27 0x0027 # APOSTROPHE +0x28 0x0028 # LEFT PARENTHESIS +0x29 0x0029 # RIGHT PARENTHESIS +0x2A 0x002A # ASTERISK +0x2B 0x002B # PLUS SIGN +0x2C 0x002C # COMMA +0x2D 0x002D # HYPHEN-MINUS +0x2E 0x002E # FULL STOP +0x2F 0x002F # SOLIDUS +0x30 0x0030 # DIGIT ZERO +0x31 0x0031 # DIGIT ONE +0x32 0x0032 # DIGIT TWO +0x33 0x0033 # DIGIT THREE +0x34 0x0034 # DIGIT FOUR +0x35 0x0035 # DIGIT FIVE +0x36 0x0036 # DIGIT SIX +0x37 0x0037 # DIGIT SEVEN +0x38 0x0038 # DIGIT EIGHT +0x39 0x0039 # DIGIT NINE +0x3A 0x003A # COLON +0x3B 0x003B # SEMICOLON +0x3C 0x003C # LESS-THAN SIGN +0x3D 0x003D # EQUALS SIGN +0x3E 0x003E # GREATER-THAN SIGN +0x3F 0x003F # QUESTION MARK +0x40 0x0040 # COMMERCIAL AT +0x41 0x0041 # LATIN CAPITAL LETTER A +0x42 0x0042 # LATIN CAPITAL LETTER B +0x43 0x0043 # LATIN CAPITAL LETTER C +0x44 0x0044 # LATIN CAPITAL LETTER D +0x45 0x0045 # LATIN CAPITAL LETTER E +0x46 0x0046 # LATIN CAPITAL LETTER F +0x47 0x0047 # LATIN CAPITAL LETTER G +0x48 0x0048 # LATIN CAPITAL LETTER H +0x49 0x0049 # LATIN CAPITAL LETTER I +0x4A 0x004A # LATIN CAPITAL LETTER J +0x4B 0x004B # LATIN CAPITAL LETTER K +0x4C 0x004C # LATIN CAPITAL LETTER L +0x4D 0x004D # LATIN CAPITAL LETTER M +0x4E 0x004E # LATIN CAPITAL LETTER N +0x4F 0x004F # LATIN CAPITAL LETTER O +0x50 0x0050 # LATIN CAPITAL LETTER P +0x51 0x0051 # LATIN CAPITAL LETTER Q +0x52 0x0052 # LATIN CAPITAL LETTER R +0x53 0x0053 # LATIN CAPITAL LETTER S +0x54 0x0054 # LATIN CAPITAL LETTER T +0x55 0x0055 # LATIN CAPITAL LETTER U +0x56 0x0056 # LATIN CAPITAL LETTER V +0x57 0x0057 # LATIN CAPITAL LETTER W +0x58 0x0058 # LATIN CAPITAL LETTER X +0x59 0x0059 # LATIN CAPITAL LETTER Y +0x5A 0x005A # LATIN CAPITAL LETTER Z +0x5B 0x005B # LEFT SQUARE BRACKET +0x5C 0x005C # REVERSE SOLIDUS +0x5D 0x005D # RIGHT SQUARE BRACKET +0x5E 0x005E # CIRCUMFLEX ACCENT +0x5F 0x005F # LOW LINE +0x60 0x0060 # GRAVE ACCENT +0x61 0x0061 # LATIN SMALL LETTER A +0x62 0x0062 # LATIN SMALL LETTER B +0x63 0x0063 # LATIN SMALL LETTER C +0x64 0x0064 # LATIN SMALL LETTER D +0x65 0x0065 # LATIN SMALL LETTER E +0x66 0x0066 # LATIN SMALL LETTER F +0x67 0x0067 # LATIN SMALL LETTER G +0x68 0x0068 # LATIN SMALL LETTER H +0x69 0x0069 # LATIN SMALL LETTER I +0x6A 0x006A # LATIN SMALL LETTER J +0x6B 0x006B # LATIN SMALL LETTER K +0x6C 0x006C # LATIN SMALL LETTER L +0x6D 0x006D # LATIN SMALL LETTER M +0x6E 0x006E # LATIN SMALL LETTER N +0x6F 0x006F # LATIN SMALL LETTER O +0x70 0x0070 # LATIN SMALL LETTER P +0x71 0x0071 # LATIN SMALL LETTER Q +0x72 0x0072 # LATIN SMALL LETTER R +0x73 0x0073 # LATIN SMALL LETTER S +0x74 0x0074 # LATIN SMALL LETTER T +0x75 0x0075 # LATIN SMALL LETTER U +0x76 0x0076 # LATIN SMALL LETTER V +0x77 0x0077 # LATIN SMALL LETTER W +0x78 0x0078 # LATIN SMALL LETTER X +0x79 0x0079 # LATIN SMALL LETTER Y +0x7A 0x007A # LATIN SMALL LETTER Z +0x7B 0x007B # LEFT CURLY BRACKET +0x7C 0x007C # VERTICAL LINE +0x7D 0x007D # RIGHT CURLY BRACKET +0x7E 0x007E # TILDE +0x7F 0x007F # DELETE +0x80 0x0080 # +0x81 0x0081 # +0x82 0x0082 # +0x83 0x0083 # +0x84 0x0084 # +0x85 0x0085 # +0x86 0x0086 # +0x87 0x0087 # +0x88 0x0088 # +0x89 0x0089 # +0x8A 0x008A # +0x8B 0x008B # +0x8C 0x008C # +0x8D 0x008D # +0x8E 0x008E # +0x8F 0x008F # +0x90 0x0090 # +0x91 0x0091 # +0x92 0x0092 # +0x93 0x0093 # +0x94 0x0094 # +0x95 0x0095 # +0x96 0x0096 # +0x97 0x0097 # +0x98 0x0098 # +0x99 0x0099 # +0x9A 0x009A # +0x9B 0x009B # +0x9C 0x009C # +0x9D 0x009D # +0x9E 0x009E # +0x9F 0x009F # +0xA0 0x00A0 # NO-BREAK SPACE +0xA1 0x00A1 # INVERTED EXCLAMATION MARK +0xA2 0x00A2 # CENT SIGN +0xA3 0x00A3 # POUND SIGN +0xA4 0x20AC # EURO SIGN +0xA5 0x00A5 # YEN SIGN +0xA6 0x0160 # LATIN CAPITAL LETTER S WITH CARON +0xA7 0x00A7 # SECTION SIGN +0xA8 0x0161 # LATIN SMALL LETTER S WITH CARON +0xA9 0x00A9 # COPYRIGHT SIGN +0xAA 0x00AA # FEMININE ORDINAL INDICATOR +0xAB 0x00AB # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +0xAC 0x00AC # NOT SIGN +0xAD 0x00AD # SOFT HYPHEN +0xAE 0x00AE # REGISTERED SIGN +0xAF 0x00AF # MACRON +0xB0 0x00B0 # DEGREE SIGN +0xB1 0x00B1 # PLUS-MINUS SIGN +0xB2 0x00B2 # SUPERSCRIPT TWO +0xB3 0x00B3 # SUPERSCRIPT THREE +0xB4 0x017D # LATIN CAPITAL LETTER Z WITH CARON +0xB5 0x00B5 # MICRO SIGN +0xB6 0x00B6 # PILCROW SIGN +0xB7 0x00B7 # MIDDLE DOT +0xB8 0x017E # LATIN SMALL LETTER Z WITH CARON +0xB9 0x00B9 # SUPERSCRIPT ONE +0xBA 0x00BA # MASCULINE ORDINAL INDICATOR +0xBB 0x00BB # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK +0xBC 0x0152 # LATIN CAPITAL LIGATURE OE +0xBD 0x0153 # LATIN SMALL LIGATURE OE +0xBE 0x0178 # LATIN CAPITAL LETTER Y WITH DIAERESIS +0xBF 0x00BF # INVERTED QUESTION MARK +0xC0 0x00C0 # LATIN CAPITAL LETTER A WITH GRAVE +0xC1 0x00C1 # LATIN CAPITAL LETTER A WITH ACUTE +0xC2 0x00C2 # LATIN CAPITAL LETTER A WITH CIRCUMFLEX +0xC3 0x00C3 # LATIN CAPITAL LETTER A WITH TILDE +0xC4 0x00C4 # LATIN CAPITAL LETTER A WITH DIAERESIS +0xC5 0x00C5 # LATIN CAPITAL LETTER A WITH RING ABOVE +0xC6 0x00C6 # LATIN CAPITAL LETTER AE +0xC7 0x00C7 # LATIN CAPITAL LETTER C WITH CEDILLA +0xC8 0x00C8 # LATIN CAPITAL LETTER E WITH GRAVE +0xC9 0x00C9 # LATIN CAPITAL LETTER E WITH ACUTE +0xCA 0x00CA # LATIN CAPITAL LETTER E WITH CIRCUMFLEX +0xCB 0x00CB # LATIN CAPITAL LETTER E WITH DIAERESIS +0xCC 0x00CC # LATIN CAPITAL LETTER I WITH GRAVE +0xCD 0x00CD # LATIN CAPITAL LETTER I WITH ACUTE +0xCE 0x00CE # LATIN CAPITAL LETTER I WITH CIRCUMFLEX +0xCF 0x00CF # LATIN CAPITAL LETTER I WITH DIAERESIS +0xD0 0x00D0 # LATIN CAPITAL LETTER ETH +0xD1 0x00D1 # LATIN CAPITAL LETTER N WITH TILDE +0xD2 0x00D2 # LATIN CAPITAL LETTER O WITH GRAVE +0xD3 0x00D3 # LATIN CAPITAL LETTER O WITH ACUTE +0xD4 0x00D4 # LATIN CAPITAL LETTER O WITH CIRCUMFLEX +0xD5 0x00D5 # LATIN CAPITAL LETTER O WITH TILDE +0xD6 0x00D6 # LATIN CAPITAL LETTER O WITH DIAERESIS +0xD7 0x00D7 # MULTIPLICATION SIGN +0xD8 0x00D8 # LATIN CAPITAL LETTER O WITH STROKE +0xD9 0x00D9 # LATIN CAPITAL LETTER U WITH GRAVE +0xDA 0x00DA # LATIN CAPITAL LETTER U WITH ACUTE +0xDB 0x00DB # LATIN CAPITAL LETTER U WITH CIRCUMFLEX +0xDC 0x00DC # LATIN CAPITAL LETTER U WITH DIAERESIS +0xDD 0x00DD # LATIN CAPITAL LETTER Y WITH ACUTE +0xDE 0x00DE # LATIN CAPITAL LETTER THORN +0xDF 0x00DF # LATIN SMALL LETTER SHARP S +0xE0 0x00E0 # LATIN SMALL LETTER A WITH GRAVE +0xE1 0x00E1 # LATIN SMALL LETTER A WITH ACUTE +0xE2 0x00E2 # LATIN SMALL LETTER A WITH CIRCUMFLEX +0xE3 0x00E3 # LATIN SMALL LETTER A WITH TILDE +0xE4 0x00E4 # LATIN SMALL LETTER A WITH DIAERESIS +0xE5 0x00E5 # LATIN SMALL LETTER A WITH RING ABOVE +0xE6 0x00E6 # LATIN SMALL LETTER AE +0xE7 0x00E7 # LATIN SMALL LETTER C WITH CEDILLA +0xE8 0x00E8 # LATIN SMALL LETTER E WITH GRAVE +0xE9 0x00E9 # LATIN SMALL LETTER E WITH ACUTE +0xEA 0x00EA # LATIN SMALL LETTER E WITH CIRCUMFLEX +0xEB 0x00EB # LATIN SMALL LETTER E WITH DIAERESIS +0xEC 0x00EC # LATIN SMALL LETTER I WITH GRAVE +0xED 0x00ED # LATIN SMALL LETTER I WITH ACUTE +0xEE 0x00EE # LATIN SMALL LETTER I WITH CIRCUMFLEX +0xEF 0x00EF # LATIN SMALL LETTER I WITH DIAERESIS +0xF0 0x00F0 # LATIN SMALL LETTER ETH +0xF1 0x00F1 # LATIN SMALL LETTER N WITH TILDE +0xF2 0x00F2 # LATIN SMALL LETTER O WITH GRAVE +0xF3 0x00F3 # LATIN SMALL LETTER O WITH ACUTE +0xF4 0x00F4 # LATIN SMALL LETTER O WITH CIRCUMFLEX +0xF5 0x00F5 # LATIN SMALL LETTER O WITH TILDE +0xF6 0x00F6 # LATIN SMALL LETTER O WITH DIAERESIS +0xF7 0x00F7 # DIVISION SIGN +0xF8 0x00F8 # LATIN SMALL LETTER O WITH STROKE +0xF9 0x00F9 # LATIN SMALL LETTER U WITH GRAVE +0xFA 0x00FA # LATIN SMALL LETTER U WITH ACUTE +0xFB 0x00FB # LATIN SMALL LETTER U WITH CIRCUMFLEX +0xFC 0x00FC # LATIN SMALL LETTER U WITH DIAERESIS +0xFD 0x00FD # LATIN SMALL LETTER Y WITH ACUTE +0xFE 0x00FE # LATIN SMALL LETTER THORN +0xFF 0x00FF # LATIN SMALL LETTER Y WITH DIAERESIS + diff --git a/ext/standard/html_tables/mappings/8859-5.TXT b/ext/standard/html_tables/mappings/8859-5.TXT new file mode 100644 index 0000000..a7ed1ce --- /dev/null +++ b/ext/standard/html_tables/mappings/8859-5.TXT @@ -0,0 +1,303 @@ +# +# Name: ISO 8859-5:1999 to Unicode +# Unicode version: 3.0 +# Table version: 1.0 +# Table format: Format A +# Date: 1999 July 27 +# Authors: Ken Whistler +# +# Copyright (c) 1991-1999 Unicode, Inc. All Rights reserved. +# +# This file is provided as-is by Unicode, Inc. (The Unicode Consortium). +# No claims are made as to fitness for any particular purpose. No +# warranties of any kind are expressed or implied. The recipient +# agrees to determine applicability of information provided. If this +# file has been provided on optical media by Unicode, Inc., the sole +# remedy for any claim will be exchange of defective media within 90 +# days of receipt. +# +# Unicode, Inc. hereby grants the right to freely use the information +# supplied in this file in the creation of products supporting the +# Unicode Standard, and to make copies of this file in any form for +# internal or external distribution as long as this notice remains +# attached. +# +# General notes: +# +# This table contains the data the Unicode Consortium has on how +# ISO/IEC 8859-5:1999 characters map into Unicode. +# +# Format: Three tab-separated columns +# Column #1 is the ISO/IEC 8859-5 code (in hex as 0xXX) +# Column #2 is the Unicode (in hex as 0xXXXX) +# Column #3 the Unicode name (follows a comment sign, '#') +# +# The entries are in ISO/IEC 8859-5 order. +# +# Version history +# 1.0 version updates 0.1 version by adding mappings for all +# control characters. +# +# Updated versions of this file may be found in: +# +# +# Any comments or problems, contact +# Please note that is an archival address; +# notices will be checked, but do not expect an immediate response. +# +0x00 0x0000 # NULL +0x01 0x0001 # START OF HEADING +0x02 0x0002 # START OF TEXT +0x03 0x0003 # END OF TEXT +0x04 0x0004 # END OF TRANSMISSION +0x05 0x0005 # ENQUIRY +0x06 0x0006 # ACKNOWLEDGE +0x07 0x0007 # BELL +0x08 0x0008 # BACKSPACE +0x09 0x0009 # HORIZONTAL TABULATION +0x0A 0x000A # LINE FEED +0x0B 0x000B # VERTICAL TABULATION +0x0C 0x000C # FORM FEED +0x0D 0x000D # CARRIAGE RETURN +0x0E 0x000E # SHIFT OUT +0x0F 0x000F # SHIFT IN +0x10 0x0010 # DATA LINK ESCAPE +0x11 0x0011 # DEVICE CONTROL ONE +0x12 0x0012 # DEVICE CONTROL TWO +0x13 0x0013 # DEVICE CONTROL THREE +0x14 0x0014 # DEVICE CONTROL FOUR +0x15 0x0015 # NEGATIVE ACKNOWLEDGE +0x16 0x0016 # SYNCHRONOUS IDLE +0x17 0x0017 # END OF TRANSMISSION BLOCK +0x18 0x0018 # CANCEL +0x19 0x0019 # END OF MEDIUM +0x1A 0x001A # SUBSTITUTE +0x1B 0x001B # ESCAPE +0x1C 0x001C # FILE SEPARATOR +0x1D 0x001D # GROUP SEPARATOR +0x1E 0x001E # RECORD SEPARATOR +0x1F 0x001F # UNIT SEPARATOR +0x20 0x0020 # SPACE +0x21 0x0021 # EXCLAMATION MARK +0x22 0x0022 # QUOTATION MARK +0x23 0x0023 # NUMBER SIGN +0x24 0x0024 # DOLLAR SIGN +0x25 0x0025 # PERCENT SIGN +0x26 0x0026 # AMPERSAND +0x27 0x0027 # APOSTROPHE +0x28 0x0028 # LEFT PARENTHESIS +0x29 0x0029 # RIGHT PARENTHESIS +0x2A 0x002A # ASTERISK +0x2B 0x002B # PLUS SIGN +0x2C 0x002C # COMMA +0x2D 0x002D # HYPHEN-MINUS +0x2E 0x002E # FULL STOP +0x2F 0x002F # SOLIDUS +0x30 0x0030 # DIGIT ZERO +0x31 0x0031 # DIGIT ONE +0x32 0x0032 # DIGIT TWO +0x33 0x0033 # DIGIT THREE +0x34 0x0034 # DIGIT FOUR +0x35 0x0035 # DIGIT FIVE +0x36 0x0036 # DIGIT SIX +0x37 0x0037 # DIGIT SEVEN +0x38 0x0038 # DIGIT EIGHT +0x39 0x0039 # DIGIT NINE +0x3A 0x003A # COLON +0x3B 0x003B # SEMICOLON +0x3C 0x003C # LESS-THAN SIGN +0x3D 0x003D # EQUALS SIGN +0x3E 0x003E # GREATER-THAN SIGN +0x3F 0x003F # QUESTION MARK +0x40 0x0040 # COMMERCIAL AT +0x41 0x0041 # LATIN CAPITAL LETTER A +0x42 0x0042 # LATIN CAPITAL LETTER B +0x43 0x0043 # LATIN CAPITAL LETTER C +0x44 0x0044 # LATIN CAPITAL LETTER D +0x45 0x0045 # LATIN CAPITAL LETTER E +0x46 0x0046 # LATIN CAPITAL LETTER F +0x47 0x0047 # LATIN CAPITAL LETTER G +0x48 0x0048 # LATIN CAPITAL LETTER H +0x49 0x0049 # LATIN CAPITAL LETTER I +0x4A 0x004A # LATIN CAPITAL LETTER J +0x4B 0x004B # LATIN CAPITAL LETTER K +0x4C 0x004C # LATIN CAPITAL LETTER L +0x4D 0x004D # LATIN CAPITAL LETTER M +0x4E 0x004E # LATIN CAPITAL LETTER N +0x4F 0x004F # LATIN CAPITAL LETTER O +0x50 0x0050 # LATIN CAPITAL LETTER P +0x51 0x0051 # LATIN CAPITAL LETTER Q +0x52 0x0052 # LATIN CAPITAL LETTER R +0x53 0x0053 # LATIN CAPITAL LETTER S +0x54 0x0054 # LATIN CAPITAL LETTER T +0x55 0x0055 # LATIN CAPITAL LETTER U +0x56 0x0056 # LATIN CAPITAL LETTER V +0x57 0x0057 # LATIN CAPITAL LETTER W +0x58 0x0058 # LATIN CAPITAL LETTER X +0x59 0x0059 # LATIN CAPITAL LETTER Y +0x5A 0x005A # LATIN CAPITAL LETTER Z +0x5B 0x005B # LEFT SQUARE BRACKET +0x5C 0x005C # REVERSE SOLIDUS +0x5D 0x005D # RIGHT SQUARE BRACKET +0x5E 0x005E # CIRCUMFLEX ACCENT +0x5F 0x005F # LOW LINE +0x60 0x0060 # GRAVE ACCENT +0x61 0x0061 # LATIN SMALL LETTER A +0x62 0x0062 # LATIN SMALL LETTER B +0x63 0x0063 # LATIN SMALL LETTER C +0x64 0x0064 # LATIN SMALL LETTER D +0x65 0x0065 # LATIN SMALL LETTER E +0x66 0x0066 # LATIN SMALL LETTER F +0x67 0x0067 # LATIN SMALL LETTER G +0x68 0x0068 # LATIN SMALL LETTER H +0x69 0x0069 # LATIN SMALL LETTER I +0x6A 0x006A # LATIN SMALL LETTER J +0x6B 0x006B # LATIN SMALL LETTER K +0x6C 0x006C # LATIN SMALL LETTER L +0x6D 0x006D # LATIN SMALL LETTER M +0x6E 0x006E # LATIN SMALL LETTER N +0x6F 0x006F # LATIN SMALL LETTER O +0x70 0x0070 # LATIN SMALL LETTER P +0x71 0x0071 # LATIN SMALL LETTER Q +0x72 0x0072 # LATIN SMALL LETTER R +0x73 0x0073 # LATIN SMALL LETTER S +0x74 0x0074 # LATIN SMALL LETTER T +0x75 0x0075 # LATIN SMALL LETTER U +0x76 0x0076 # LATIN SMALL LETTER V +0x77 0x0077 # LATIN SMALL LETTER W +0x78 0x0078 # LATIN SMALL LETTER X +0x79 0x0079 # LATIN SMALL LETTER Y +0x7A 0x007A # LATIN SMALL LETTER Z +0x7B 0x007B # LEFT CURLY BRACKET +0x7C 0x007C # VERTICAL LINE +0x7D 0x007D # RIGHT CURLY BRACKET +0x7E 0x007E # TILDE +0x7F 0x007F # DELETE +0x80 0x0080 # +0x81 0x0081 # +0x82 0x0082 # +0x83 0x0083 # +0x84 0x0084 # +0x85 0x0085 # +0x86 0x0086 # +0x87 0x0087 # +0x88 0x0088 # +0x89 0x0089 # +0x8A 0x008A # +0x8B 0x008B # +0x8C 0x008C # +0x8D 0x008D # +0x8E 0x008E # +0x8F 0x008F # +0x90 0x0090 # +0x91 0x0091 # +0x92 0x0092 # +0x93 0x0093 # +0x94 0x0094 # +0x95 0x0095 # +0x96 0x0096 # +0x97 0x0097 # +0x98 0x0098 # +0x99 0x0099 # +0x9A 0x009A # +0x9B 0x009B # +0x9C 0x009C # +0x9D 0x009D # +0x9E 0x009E # +0x9F 0x009F # +0xA0 0x00A0 # NO-BREAK SPACE +0xA1 0x0401 # CYRILLIC CAPITAL LETTER IO +0xA2 0x0402 # CYRILLIC CAPITAL LETTER DJE +0xA3 0x0403 # CYRILLIC CAPITAL LETTER GJE +0xA4 0x0404 # CYRILLIC CAPITAL LETTER UKRAINIAN IE +0xA5 0x0405 # CYRILLIC CAPITAL LETTER DZE +0xA6 0x0406 # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I +0xA7 0x0407 # CYRILLIC CAPITAL LETTER YI +0xA8 0x0408 # CYRILLIC CAPITAL LETTER JE +0xA9 0x0409 # CYRILLIC CAPITAL LETTER LJE +0xAA 0x040A # CYRILLIC CAPITAL LETTER NJE +0xAB 0x040B # CYRILLIC CAPITAL LETTER TSHE +0xAC 0x040C # CYRILLIC CAPITAL LETTER KJE +0xAD 0x00AD # SOFT HYPHEN +0xAE 0x040E # CYRILLIC CAPITAL LETTER SHORT U +0xAF 0x040F # CYRILLIC CAPITAL LETTER DZHE +0xB0 0x0410 # CYRILLIC CAPITAL LETTER A +0xB1 0x0411 # CYRILLIC CAPITAL LETTER BE +0xB2 0x0412 # CYRILLIC CAPITAL LETTER VE +0xB3 0x0413 # CYRILLIC CAPITAL LETTER GHE +0xB4 0x0414 # CYRILLIC CAPITAL LETTER DE +0xB5 0x0415 # CYRILLIC CAPITAL LETTER IE +0xB6 0x0416 # CYRILLIC CAPITAL LETTER ZHE +0xB7 0x0417 # CYRILLIC CAPITAL LETTER ZE +0xB8 0x0418 # CYRILLIC CAPITAL LETTER I +0xB9 0x0419 # CYRILLIC CAPITAL LETTER SHORT I +0xBA 0x041A # CYRILLIC CAPITAL LETTER KA +0xBB 0x041B # CYRILLIC CAPITAL LETTER EL +0xBC 0x041C # CYRILLIC CAPITAL LETTER EM +0xBD 0x041D # CYRILLIC CAPITAL LETTER EN +0xBE 0x041E # CYRILLIC CAPITAL LETTER O +0xBF 0x041F # CYRILLIC CAPITAL LETTER PE +0xC0 0x0420 # CYRILLIC CAPITAL LETTER ER +0xC1 0x0421 # CYRILLIC CAPITAL LETTER ES +0xC2 0x0422 # CYRILLIC CAPITAL LETTER TE +0xC3 0x0423 # CYRILLIC CAPITAL LETTER U +0xC4 0x0424 # CYRILLIC CAPITAL LETTER EF +0xC5 0x0425 # CYRILLIC CAPITAL LETTER HA +0xC6 0x0426 # CYRILLIC CAPITAL LETTER TSE +0xC7 0x0427 # CYRILLIC CAPITAL LETTER CHE +0xC8 0x0428 # CYRILLIC CAPITAL LETTER SHA +0xC9 0x0429 # CYRILLIC CAPITAL LETTER SHCHA +0xCA 0x042A # CYRILLIC CAPITAL LETTER HARD SIGN +0xCB 0x042B # CYRILLIC CAPITAL LETTER YERU +0xCC 0x042C # CYRILLIC CAPITAL LETTER SOFT SIGN +0xCD 0x042D # CYRILLIC CAPITAL LETTER E +0xCE 0x042E # CYRILLIC CAPITAL LETTER YU +0xCF 0x042F # CYRILLIC CAPITAL LETTER YA +0xD0 0x0430 # CYRILLIC SMALL LETTER A +0xD1 0x0431 # CYRILLIC SMALL LETTER BE +0xD2 0x0432 # CYRILLIC SMALL LETTER VE +0xD3 0x0433 # CYRILLIC SMALL LETTER GHE +0xD4 0x0434 # CYRILLIC SMALL LETTER DE +0xD5 0x0435 # CYRILLIC SMALL LETTER IE +0xD6 0x0436 # CYRILLIC SMALL LETTER ZHE +0xD7 0x0437 # CYRILLIC SMALL LETTER ZE +0xD8 0x0438 # CYRILLIC SMALL LETTER I +0xD9 0x0439 # CYRILLIC SMALL LETTER SHORT I +0xDA 0x043A # CYRILLIC SMALL LETTER KA +0xDB 0x043B # CYRILLIC SMALL LETTER EL +0xDC 0x043C # CYRILLIC SMALL LETTER EM +0xDD 0x043D # CYRILLIC SMALL LETTER EN +0xDE 0x043E # CYRILLIC SMALL LETTER O +0xDF 0x043F # CYRILLIC SMALL LETTER PE +0xE0 0x0440 # CYRILLIC SMALL LETTER ER +0xE1 0x0441 # CYRILLIC SMALL LETTER ES +0xE2 0x0442 # CYRILLIC SMALL LETTER TE +0xE3 0x0443 # CYRILLIC SMALL LETTER U +0xE4 0x0444 # CYRILLIC SMALL LETTER EF +0xE5 0x0445 # CYRILLIC SMALL LETTER HA +0xE6 0x0446 # CYRILLIC SMALL LETTER TSE +0xE7 0x0447 # CYRILLIC SMALL LETTER CHE +0xE8 0x0448 # CYRILLIC SMALL LETTER SHA +0xE9 0x0449 # CYRILLIC SMALL LETTER SHCHA +0xEA 0x044A # CYRILLIC SMALL LETTER HARD SIGN +0xEB 0x044B # CYRILLIC SMALL LETTER YERU +0xEC 0x044C # CYRILLIC SMALL LETTER SOFT SIGN +0xED 0x044D # CYRILLIC SMALL LETTER E +0xEE 0x044E # CYRILLIC SMALL LETTER YU +0xEF 0x044F # CYRILLIC SMALL LETTER YA +0xF0 0x2116 # NUMERO SIGN +0xF1 0x0451 # CYRILLIC SMALL LETTER IO +0xF2 0x0452 # CYRILLIC SMALL LETTER DJE +0xF3 0x0453 # CYRILLIC SMALL LETTER GJE +0xF4 0x0454 # CYRILLIC SMALL LETTER UKRAINIAN IE +0xF5 0x0455 # CYRILLIC SMALL LETTER DZE +0xF6 0x0456 # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I +0xF7 0x0457 # CYRILLIC SMALL LETTER YI +0xF8 0x0458 # CYRILLIC SMALL LETTER JE +0xF9 0x0459 # CYRILLIC SMALL LETTER LJE +0xFA 0x045A # CYRILLIC SMALL LETTER NJE +0xFB 0x045B # CYRILLIC SMALL LETTER TSHE +0xFC 0x045C # CYRILLIC SMALL LETTER KJE +0xFD 0x00A7 # SECTION SIGN +0xFE 0x045E # CYRILLIC SMALL LETTER SHORT U +0xFF 0x045F # CYRILLIC SMALL LETTER DZHE diff --git a/ext/standard/html_tables/mappings/CP1251.TXT b/ext/standard/html_tables/mappings/CP1251.TXT new file mode 100644 index 0000000..4d9b355 --- /dev/null +++ b/ext/standard/html_tables/mappings/CP1251.TXT @@ -0,0 +1,274 @@ +# +# Name: cp1251 to Unicode table +# Unicode version: 2.0 +# Table version: 2.01 +# Table format: Format A +# Date: 04/15/98 +# +# Contact: Shawn.Steele@microsoft.com +# +# General notes: none +# +# Format: Three tab-separated columns +# Column #1 is the cp1251 code (in hex) +# Column #2 is the Unicode (in hex as 0xXXXX) +# Column #3 is the Unicode name (follows a comment sign, '#') +# +# The entries are in cp1251 order +# +0x00 0x0000 #NULL +0x01 0x0001 #START OF HEADING +0x02 0x0002 #START OF TEXT +0x03 0x0003 #END OF TEXT +0x04 0x0004 #END OF TRANSMISSION +0x05 0x0005 #ENQUIRY +0x06 0x0006 #ACKNOWLEDGE +0x07 0x0007 #BELL +0x08 0x0008 #BACKSPACE +0x09 0x0009 #HORIZONTAL TABULATION +0x0A 0x000A #LINE FEED +0x0B 0x000B #VERTICAL TABULATION +0x0C 0x000C #FORM FEED +0x0D 0x000D #CARRIAGE RETURN +0x0E 0x000E #SHIFT OUT +0x0F 0x000F #SHIFT IN +0x10 0x0010 #DATA LINK ESCAPE +0x11 0x0011 #DEVICE CONTROL ONE +0x12 0x0012 #DEVICE CONTROL TWO +0x13 0x0013 #DEVICE CONTROL THREE +0x14 0x0014 #DEVICE CONTROL FOUR +0x15 0x0015 #NEGATIVE ACKNOWLEDGE +0x16 0x0016 #SYNCHRONOUS IDLE +0x17 0x0017 #END OF TRANSMISSION BLOCK +0x18 0x0018 #CANCEL +0x19 0x0019 #END OF MEDIUM +0x1A 0x001A #SUBSTITUTE +0x1B 0x001B #ESCAPE +0x1C 0x001C #FILE SEPARATOR +0x1D 0x001D #GROUP SEPARATOR +0x1E 0x001E #RECORD SEPARATOR +0x1F 0x001F #UNIT SEPARATOR +0x20 0x0020 #SPACE +0x21 0x0021 #EXCLAMATION MARK +0x22 0x0022 #QUOTATION MARK +0x23 0x0023 #NUMBER SIGN +0x24 0x0024 #DOLLAR SIGN +0x25 0x0025 #PERCENT SIGN +0x26 0x0026 #AMPERSAND +0x27 0x0027 #APOSTROPHE +0x28 0x0028 #LEFT PARENTHESIS +0x29 0x0029 #RIGHT PARENTHESIS +0x2A 0x002A #ASTERISK +0x2B 0x002B #PLUS SIGN +0x2C 0x002C #COMMA +0x2D 0x002D #HYPHEN-MINUS +0x2E 0x002E #FULL STOP +0x2F 0x002F #SOLIDUS +0x30 0x0030 #DIGIT ZERO +0x31 0x0031 #DIGIT ONE +0x32 0x0032 #DIGIT TWO +0x33 0x0033 #DIGIT THREE +0x34 0x0034 #DIGIT FOUR +0x35 0x0035 #DIGIT FIVE +0x36 0x0036 #DIGIT SIX +0x37 0x0037 #DIGIT SEVEN +0x38 0x0038 #DIGIT EIGHT +0x39 0x0039 #DIGIT NINE +0x3A 0x003A #COLON +0x3B 0x003B #SEMICOLON +0x3C 0x003C #LESS-THAN SIGN +0x3D 0x003D #EQUALS SIGN +0x3E 0x003E #GREATER-THAN SIGN +0x3F 0x003F #QUESTION MARK +0x40 0x0040 #COMMERCIAL AT +0x41 0x0041 #LATIN CAPITAL LETTER A +0x42 0x0042 #LATIN CAPITAL LETTER B +0x43 0x0043 #LATIN CAPITAL LETTER C +0x44 0x0044 #LATIN CAPITAL LETTER D +0x45 0x0045 #LATIN CAPITAL LETTER E +0x46 0x0046 #LATIN CAPITAL LETTER F +0x47 0x0047 #LATIN CAPITAL LETTER G +0x48 0x0048 #LATIN CAPITAL LETTER H +0x49 0x0049 #LATIN CAPITAL LETTER I +0x4A 0x004A #LATIN CAPITAL LETTER J +0x4B 0x004B #LATIN CAPITAL LETTER K +0x4C 0x004C #LATIN CAPITAL LETTER L +0x4D 0x004D #LATIN CAPITAL LETTER M +0x4E 0x004E #LATIN CAPITAL LETTER N +0x4F 0x004F #LATIN CAPITAL LETTER O +0x50 0x0050 #LATIN CAPITAL LETTER P +0x51 0x0051 #LATIN CAPITAL LETTER Q +0x52 0x0052 #LATIN CAPITAL LETTER R +0x53 0x0053 #LATIN CAPITAL LETTER S +0x54 0x0054 #LATIN CAPITAL LETTER T +0x55 0x0055 #LATIN CAPITAL LETTER U +0x56 0x0056 #LATIN CAPITAL LETTER V +0x57 0x0057 #LATIN CAPITAL LETTER W +0x58 0x0058 #LATIN CAPITAL LETTER X +0x59 0x0059 #LATIN CAPITAL LETTER Y +0x5A 0x005A #LATIN CAPITAL LETTER Z +0x5B 0x005B #LEFT SQUARE BRACKET +0x5C 0x005C #REVERSE SOLIDUS +0x5D 0x005D #RIGHT SQUARE BRACKET +0x5E 0x005E #CIRCUMFLEX ACCENT +0x5F 0x005F #LOW LINE +0x60 0x0060 #GRAVE ACCENT +0x61 0x0061 #LATIN SMALL LETTER A +0x62 0x0062 #LATIN SMALL LETTER B +0x63 0x0063 #LATIN SMALL LETTER C +0x64 0x0064 #LATIN SMALL LETTER D +0x65 0x0065 #LATIN SMALL LETTER E +0x66 0x0066 #LATIN SMALL LETTER F +0x67 0x0067 #LATIN SMALL LETTER G +0x68 0x0068 #LATIN SMALL LETTER H +0x69 0x0069 #LATIN SMALL LETTER I +0x6A 0x006A #LATIN SMALL LETTER J +0x6B 0x006B #LATIN SMALL LETTER K +0x6C 0x006C #LATIN SMALL LETTER L +0x6D 0x006D #LATIN SMALL LETTER M +0x6E 0x006E #LATIN SMALL LETTER N +0x6F 0x006F #LATIN SMALL LETTER O +0x70 0x0070 #LATIN SMALL LETTER P +0x71 0x0071 #LATIN SMALL LETTER Q +0x72 0x0072 #LATIN SMALL LETTER R +0x73 0x0073 #LATIN SMALL LETTER S +0x74 0x0074 #LATIN SMALL LETTER T +0x75 0x0075 #LATIN SMALL LETTER U +0x76 0x0076 #LATIN SMALL LETTER V +0x77 0x0077 #LATIN SMALL LETTER W +0x78 0x0078 #LATIN SMALL LETTER X +0x79 0x0079 #LATIN SMALL LETTER Y +0x7A 0x007A #LATIN SMALL LETTER Z +0x7B 0x007B #LEFT CURLY BRACKET +0x7C 0x007C #VERTICAL LINE +0x7D 0x007D #RIGHT CURLY BRACKET +0x7E 0x007E #TILDE +0x7F 0x007F #DELETE +0x80 0x0402 #CYRILLIC CAPITAL LETTER DJE +0x81 0x0403 #CYRILLIC CAPITAL LETTER GJE +0x82 0x201A #SINGLE LOW-9 QUOTATION MARK +0x83 0x0453 #CYRILLIC SMALL LETTER GJE +0x84 0x201E #DOUBLE LOW-9 QUOTATION MARK +0x85 0x2026 #HORIZONTAL ELLIPSIS +0x86 0x2020 #DAGGER +0x87 0x2021 #DOUBLE DAGGER +0x88 0x20AC #EURO SIGN +0x89 0x2030 #PER MILLE SIGN +0x8A 0x0409 #CYRILLIC CAPITAL LETTER LJE +0x8B 0x2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK +0x8C 0x040A #CYRILLIC CAPITAL LETTER NJE +0x8D 0x040C #CYRILLIC CAPITAL LETTER KJE +0x8E 0x040B #CYRILLIC CAPITAL LETTER TSHE +0x8F 0x040F #CYRILLIC CAPITAL LETTER DZHE +0x90 0x0452 #CYRILLIC SMALL LETTER DJE +0x91 0x2018 #LEFT SINGLE QUOTATION MARK +0x92 0x2019 #RIGHT SINGLE QUOTATION MARK +0x93 0x201C #LEFT DOUBLE QUOTATION MARK +0x94 0x201D #RIGHT DOUBLE QUOTATION MARK +0x95 0x2022 #BULLET +0x96 0x2013 #EN DASH +0x97 0x2014 #EM DASH +0x98 #UNDEFINED +0x99 0x2122 #TRADE MARK SIGN +0x9A 0x0459 #CYRILLIC SMALL LETTER LJE +0x9B 0x203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK +0x9C 0x045A #CYRILLIC SMALL LETTER NJE +0x9D 0x045C #CYRILLIC SMALL LETTER KJE +0x9E 0x045B #CYRILLIC SMALL LETTER TSHE +0x9F 0x045F #CYRILLIC SMALL LETTER DZHE +0xA0 0x00A0 #NO-BREAK SPACE +0xA1 0x040E #CYRILLIC CAPITAL LETTER SHORT U +0xA2 0x045E #CYRILLIC SMALL LETTER SHORT U +0xA3 0x0408 #CYRILLIC CAPITAL LETTER JE +0xA4 0x00A4 #CURRENCY SIGN +0xA5 0x0490 #CYRILLIC CAPITAL LETTER GHE WITH UPTURN +0xA6 0x00A6 #BROKEN BAR +0xA7 0x00A7 #SECTION SIGN +0xA8 0x0401 #CYRILLIC CAPITAL LETTER IO +0xA9 0x00A9 #COPYRIGHT SIGN +0xAA 0x0404 #CYRILLIC CAPITAL LETTER UKRAINIAN IE +0xAB 0x00AB #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +0xAC 0x00AC #NOT SIGN +0xAD 0x00AD #SOFT HYPHEN +0xAE 0x00AE #REGISTERED SIGN +0xAF 0x0407 #CYRILLIC CAPITAL LETTER YI +0xB0 0x00B0 #DEGREE SIGN +0xB1 0x00B1 #PLUS-MINUS SIGN +0xB2 0x0406 #CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I +0xB3 0x0456 #CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I +0xB4 0x0491 #CYRILLIC SMALL LETTER GHE WITH UPTURN +0xB5 0x00B5 #MICRO SIGN +0xB6 0x00B6 #PILCROW SIGN +0xB7 0x00B7 #MIDDLE DOT +0xB8 0x0451 #CYRILLIC SMALL LETTER IO +0xB9 0x2116 #NUMERO SIGN +0xBA 0x0454 #CYRILLIC SMALL LETTER UKRAINIAN IE +0xBB 0x00BB #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK +0xBC 0x0458 #CYRILLIC SMALL LETTER JE +0xBD 0x0405 #CYRILLIC CAPITAL LETTER DZE +0xBE 0x0455 #CYRILLIC SMALL LETTER DZE +0xBF 0x0457 #CYRILLIC SMALL LETTER YI +0xC0 0x0410 #CYRILLIC CAPITAL LETTER A +0xC1 0x0411 #CYRILLIC CAPITAL LETTER BE +0xC2 0x0412 #CYRILLIC CAPITAL LETTER VE +0xC3 0x0413 #CYRILLIC CAPITAL LETTER GHE +0xC4 0x0414 #CYRILLIC CAPITAL LETTER DE +0xC5 0x0415 #CYRILLIC CAPITAL LETTER IE +0xC6 0x0416 #CYRILLIC CAPITAL LETTER ZHE +0xC7 0x0417 #CYRILLIC CAPITAL LETTER ZE +0xC8 0x0418 #CYRILLIC CAPITAL LETTER I +0xC9 0x0419 #CYRILLIC CAPITAL LETTER SHORT I +0xCA 0x041A #CYRILLIC CAPITAL LETTER KA +0xCB 0x041B #CYRILLIC CAPITAL LETTER EL +0xCC 0x041C #CYRILLIC CAPITAL LETTER EM +0xCD 0x041D #CYRILLIC CAPITAL LETTER EN +0xCE 0x041E #CYRILLIC CAPITAL LETTER O +0xCF 0x041F #CYRILLIC CAPITAL LETTER PE +0xD0 0x0420 #CYRILLIC CAPITAL LETTER ER +0xD1 0x0421 #CYRILLIC CAPITAL LETTER ES +0xD2 0x0422 #CYRILLIC CAPITAL LETTER TE +0xD3 0x0423 #CYRILLIC CAPITAL LETTER U +0xD4 0x0424 #CYRILLIC CAPITAL LETTER EF +0xD5 0x0425 #CYRILLIC CAPITAL LETTER HA +0xD6 0x0426 #CYRILLIC CAPITAL LETTER TSE +0xD7 0x0427 #CYRILLIC CAPITAL LETTER CHE +0xD8 0x0428 #CYRILLIC CAPITAL LETTER SHA +0xD9 0x0429 #CYRILLIC CAPITAL LETTER SHCHA +0xDA 0x042A #CYRILLIC CAPITAL LETTER HARD SIGN +0xDB 0x042B #CYRILLIC CAPITAL LETTER YERU +0xDC 0x042C #CYRILLIC CAPITAL LETTER SOFT SIGN +0xDD 0x042D #CYRILLIC CAPITAL LETTER E +0xDE 0x042E #CYRILLIC CAPITAL LETTER YU +0xDF 0x042F #CYRILLIC CAPITAL LETTER YA +0xE0 0x0430 #CYRILLIC SMALL LETTER A +0xE1 0x0431 #CYRILLIC SMALL LETTER BE +0xE2 0x0432 #CYRILLIC SMALL LETTER VE +0xE3 0x0433 #CYRILLIC SMALL LETTER GHE +0xE4 0x0434 #CYRILLIC SMALL LETTER DE +0xE5 0x0435 #CYRILLIC SMALL LETTER IE +0xE6 0x0436 #CYRILLIC SMALL LETTER ZHE +0xE7 0x0437 #CYRILLIC SMALL LETTER ZE +0xE8 0x0438 #CYRILLIC SMALL LETTER I +0xE9 0x0439 #CYRILLIC SMALL LETTER SHORT I +0xEA 0x043A #CYRILLIC SMALL LETTER KA +0xEB 0x043B #CYRILLIC SMALL LETTER EL +0xEC 0x043C #CYRILLIC SMALL LETTER EM +0xED 0x043D #CYRILLIC SMALL LETTER EN +0xEE 0x043E #CYRILLIC SMALL LETTER O +0xEF 0x043F #CYRILLIC SMALL LETTER PE +0xF0 0x0440 #CYRILLIC SMALL LETTER ER +0xF1 0x0441 #CYRILLIC SMALL LETTER ES +0xF2 0x0442 #CYRILLIC SMALL LETTER TE +0xF3 0x0443 #CYRILLIC SMALL LETTER U +0xF4 0x0444 #CYRILLIC SMALL LETTER EF +0xF5 0x0445 #CYRILLIC SMALL LETTER HA +0xF6 0x0446 #CYRILLIC SMALL LETTER TSE +0xF7 0x0447 #CYRILLIC SMALL LETTER CHE +0xF8 0x0448 #CYRILLIC SMALL LETTER SHA +0xF9 0x0449 #CYRILLIC SMALL LETTER SHCHA +0xFA 0x044A #CYRILLIC SMALL LETTER HARD SIGN +0xFB 0x044B #CYRILLIC SMALL LETTER YERU +0xFC 0x044C #CYRILLIC SMALL LETTER SOFT SIGN +0xFD 0x044D #CYRILLIC SMALL LETTER E +0xFE 0x044E #CYRILLIC SMALL LETTER YU +0xFF 0x044F #CYRILLIC SMALL LETTER YA diff --git a/ext/standard/html_tables/mappings/CP1252.TXT b/ext/standard/html_tables/mappings/CP1252.TXT new file mode 100644 index 0000000..8ff4b20 --- /dev/null +++ b/ext/standard/html_tables/mappings/CP1252.TXT @@ -0,0 +1,274 @@ +# +# Name: cp1252 to Unicode table +# Unicode version: 2.0 +# Table version: 2.01 +# Table format: Format A +# Date: 04/15/98 +# +# Contact: Shawn.Steele@microsoft.com +# +# General notes: none +# +# Format: Three tab-separated columns +# Column #1 is the cp1252 code (in hex) +# Column #2 is the Unicode (in hex as 0xXXXX) +# Column #3 is the Unicode name (follows a comment sign, '#') +# +# The entries are in cp1252 order +# +0x00 0x0000 #NULL +0x01 0x0001 #START OF HEADING +0x02 0x0002 #START OF TEXT +0x03 0x0003 #END OF TEXT +0x04 0x0004 #END OF TRANSMISSION +0x05 0x0005 #ENQUIRY +0x06 0x0006 #ACKNOWLEDGE +0x07 0x0007 #BELL +0x08 0x0008 #BACKSPACE +0x09 0x0009 #HORIZONTAL TABULATION +0x0A 0x000A #LINE FEED +0x0B 0x000B #VERTICAL TABULATION +0x0C 0x000C #FORM FEED +0x0D 0x000D #CARRIAGE RETURN +0x0E 0x000E #SHIFT OUT +0x0F 0x000F #SHIFT IN +0x10 0x0010 #DATA LINK ESCAPE +0x11 0x0011 #DEVICE CONTROL ONE +0x12 0x0012 #DEVICE CONTROL TWO +0x13 0x0013 #DEVICE CONTROL THREE +0x14 0x0014 #DEVICE CONTROL FOUR +0x15 0x0015 #NEGATIVE ACKNOWLEDGE +0x16 0x0016 #SYNCHRONOUS IDLE +0x17 0x0017 #END OF TRANSMISSION BLOCK +0x18 0x0018 #CANCEL +0x19 0x0019 #END OF MEDIUM +0x1A 0x001A #SUBSTITUTE +0x1B 0x001B #ESCAPE +0x1C 0x001C #FILE SEPARATOR +0x1D 0x001D #GROUP SEPARATOR +0x1E 0x001E #RECORD SEPARATOR +0x1F 0x001F #UNIT SEPARATOR +0x20 0x0020 #SPACE +0x21 0x0021 #EXCLAMATION MARK +0x22 0x0022 #QUOTATION MARK +0x23 0x0023 #NUMBER SIGN +0x24 0x0024 #DOLLAR SIGN +0x25 0x0025 #PERCENT SIGN +0x26 0x0026 #AMPERSAND +0x27 0x0027 #APOSTROPHE +0x28 0x0028 #LEFT PARENTHESIS +0x29 0x0029 #RIGHT PARENTHESIS +0x2A 0x002A #ASTERISK +0x2B 0x002B #PLUS SIGN +0x2C 0x002C #COMMA +0x2D 0x002D #HYPHEN-MINUS +0x2E 0x002E #FULL STOP +0x2F 0x002F #SOLIDUS +0x30 0x0030 #DIGIT ZERO +0x31 0x0031 #DIGIT ONE +0x32 0x0032 #DIGIT TWO +0x33 0x0033 #DIGIT THREE +0x34 0x0034 #DIGIT FOUR +0x35 0x0035 #DIGIT FIVE +0x36 0x0036 #DIGIT SIX +0x37 0x0037 #DIGIT SEVEN +0x38 0x0038 #DIGIT EIGHT +0x39 0x0039 #DIGIT NINE +0x3A 0x003A #COLON +0x3B 0x003B #SEMICOLON +0x3C 0x003C #LESS-THAN SIGN +0x3D 0x003D #EQUALS SIGN +0x3E 0x003E #GREATER-THAN SIGN +0x3F 0x003F #QUESTION MARK +0x40 0x0040 #COMMERCIAL AT +0x41 0x0041 #LATIN CAPITAL LETTER A +0x42 0x0042 #LATIN CAPITAL LETTER B +0x43 0x0043 #LATIN CAPITAL LETTER C +0x44 0x0044 #LATIN CAPITAL LETTER D +0x45 0x0045 #LATIN CAPITAL LETTER E +0x46 0x0046 #LATIN CAPITAL LETTER F +0x47 0x0047 #LATIN CAPITAL LETTER G +0x48 0x0048 #LATIN CAPITAL LETTER H +0x49 0x0049 #LATIN CAPITAL LETTER I +0x4A 0x004A #LATIN CAPITAL LETTER J +0x4B 0x004B #LATIN CAPITAL LETTER K +0x4C 0x004C #LATIN CAPITAL LETTER L +0x4D 0x004D #LATIN CAPITAL LETTER M +0x4E 0x004E #LATIN CAPITAL LETTER N +0x4F 0x004F #LATIN CAPITAL LETTER O +0x50 0x0050 #LATIN CAPITAL LETTER P +0x51 0x0051 #LATIN CAPITAL LETTER Q +0x52 0x0052 #LATIN CAPITAL LETTER R +0x53 0x0053 #LATIN CAPITAL LETTER S +0x54 0x0054 #LATIN CAPITAL LETTER T +0x55 0x0055 #LATIN CAPITAL LETTER U +0x56 0x0056 #LATIN CAPITAL LETTER V +0x57 0x0057 #LATIN CAPITAL LETTER W +0x58 0x0058 #LATIN CAPITAL LETTER X +0x59 0x0059 #LATIN CAPITAL LETTER Y +0x5A 0x005A #LATIN CAPITAL LETTER Z +0x5B 0x005B #LEFT SQUARE BRACKET +0x5C 0x005C #REVERSE SOLIDUS +0x5D 0x005D #RIGHT SQUARE BRACKET +0x5E 0x005E #CIRCUMFLEX ACCENT +0x5F 0x005F #LOW LINE +0x60 0x0060 #GRAVE ACCENT +0x61 0x0061 #LATIN SMALL LETTER A +0x62 0x0062 #LATIN SMALL LETTER B +0x63 0x0063 #LATIN SMALL LETTER C +0x64 0x0064 #LATIN SMALL LETTER D +0x65 0x0065 #LATIN SMALL LETTER E +0x66 0x0066 #LATIN SMALL LETTER F +0x67 0x0067 #LATIN SMALL LETTER G +0x68 0x0068 #LATIN SMALL LETTER H +0x69 0x0069 #LATIN SMALL LETTER I +0x6A 0x006A #LATIN SMALL LETTER J +0x6B 0x006B #LATIN SMALL LETTER K +0x6C 0x006C #LATIN SMALL LETTER L +0x6D 0x006D #LATIN SMALL LETTER M +0x6E 0x006E #LATIN SMALL LETTER N +0x6F 0x006F #LATIN SMALL LETTER O +0x70 0x0070 #LATIN SMALL LETTER P +0x71 0x0071 #LATIN SMALL LETTER Q +0x72 0x0072 #LATIN SMALL LETTER R +0x73 0x0073 #LATIN SMALL LETTER S +0x74 0x0074 #LATIN SMALL LETTER T +0x75 0x0075 #LATIN SMALL LETTER U +0x76 0x0076 #LATIN SMALL LETTER V +0x77 0x0077 #LATIN SMALL LETTER W +0x78 0x0078 #LATIN SMALL LETTER X +0x79 0x0079 #LATIN SMALL LETTER Y +0x7A 0x007A #LATIN SMALL LETTER Z +0x7B 0x007B #LEFT CURLY BRACKET +0x7C 0x007C #VERTICAL LINE +0x7D 0x007D #RIGHT CURLY BRACKET +0x7E 0x007E #TILDE +0x7F 0x007F #DELETE +0x80 0x20AC #EURO SIGN +0x81 #UNDEFINED +0x82 0x201A #SINGLE LOW-9 QUOTATION MARK +0x83 0x0192 #LATIN SMALL LETTER F WITH HOOK +0x84 0x201E #DOUBLE LOW-9 QUOTATION MARK +0x85 0x2026 #HORIZONTAL ELLIPSIS +0x86 0x2020 #DAGGER +0x87 0x2021 #DOUBLE DAGGER +0x88 0x02C6 #MODIFIER LETTER CIRCUMFLEX ACCENT +0x89 0x2030 #PER MILLE SIGN +0x8A 0x0160 #LATIN CAPITAL LETTER S WITH CARON +0x8B 0x2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK +0x8C 0x0152 #LATIN CAPITAL LIGATURE OE +0x8D #UNDEFINED +0x8E 0x017D #LATIN CAPITAL LETTER Z WITH CARON +0x8F #UNDEFINED +0x90 #UNDEFINED +0x91 0x2018 #LEFT SINGLE QUOTATION MARK +0x92 0x2019 #RIGHT SINGLE QUOTATION MARK +0x93 0x201C #LEFT DOUBLE QUOTATION MARK +0x94 0x201D #RIGHT DOUBLE QUOTATION MARK +0x95 0x2022 #BULLET +0x96 0x2013 #EN DASH +0x97 0x2014 #EM DASH +0x98 0x02DC #SMALL TILDE +0x99 0x2122 #TRADE MARK SIGN +0x9A 0x0161 #LATIN SMALL LETTER S WITH CARON +0x9B 0x203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK +0x9C 0x0153 #LATIN SMALL LIGATURE OE +0x9D #UNDEFINED +0x9E 0x017E #LATIN SMALL LETTER Z WITH CARON +0x9F 0x0178 #LATIN CAPITAL LETTER Y WITH DIAERESIS +0xA0 0x00A0 #NO-BREAK SPACE +0xA1 0x00A1 #INVERTED EXCLAMATION MARK +0xA2 0x00A2 #CENT SIGN +0xA3 0x00A3 #POUND SIGN +0xA4 0x00A4 #CURRENCY SIGN +0xA5 0x00A5 #YEN SIGN +0xA6 0x00A6 #BROKEN BAR +0xA7 0x00A7 #SECTION SIGN +0xA8 0x00A8 #DIAERESIS +0xA9 0x00A9 #COPYRIGHT SIGN +0xAA 0x00AA #FEMININE ORDINAL INDICATOR +0xAB 0x00AB #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +0xAC 0x00AC #NOT SIGN +0xAD 0x00AD #SOFT HYPHEN +0xAE 0x00AE #REGISTERED SIGN +0xAF 0x00AF #MACRON +0xB0 0x00B0 #DEGREE SIGN +0xB1 0x00B1 #PLUS-MINUS SIGN +0xB2 0x00B2 #SUPERSCRIPT TWO +0xB3 0x00B3 #SUPERSCRIPT THREE +0xB4 0x00B4 #ACUTE ACCENT +0xB5 0x00B5 #MICRO SIGN +0xB6 0x00B6 #PILCROW SIGN +0xB7 0x00B7 #MIDDLE DOT +0xB8 0x00B8 #CEDILLA +0xB9 0x00B9 #SUPERSCRIPT ONE +0xBA 0x00BA #MASCULINE ORDINAL INDICATOR +0xBB 0x00BB #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK +0xBC 0x00BC #VULGAR FRACTION ONE QUARTER +0xBD 0x00BD #VULGAR FRACTION ONE HALF +0xBE 0x00BE #VULGAR FRACTION THREE QUARTERS +0xBF 0x00BF #INVERTED QUESTION MARK +0xC0 0x00C0 #LATIN CAPITAL LETTER A WITH GRAVE +0xC1 0x00C1 #LATIN CAPITAL LETTER A WITH ACUTE +0xC2 0x00C2 #LATIN CAPITAL LETTER A WITH CIRCUMFLEX +0xC3 0x00C3 #LATIN CAPITAL LETTER A WITH TILDE +0xC4 0x00C4 #LATIN CAPITAL LETTER A WITH DIAERESIS +0xC5 0x00C5 #LATIN CAPITAL LETTER A WITH RING ABOVE +0xC6 0x00C6 #LATIN CAPITAL LETTER AE +0xC7 0x00C7 #LATIN CAPITAL LETTER C WITH CEDILLA +0xC8 0x00C8 #LATIN CAPITAL LETTER E WITH GRAVE +0xC9 0x00C9 #LATIN CAPITAL LETTER E WITH ACUTE +0xCA 0x00CA #LATIN CAPITAL LETTER E WITH CIRCUMFLEX +0xCB 0x00CB #LATIN CAPITAL LETTER E WITH DIAERESIS +0xCC 0x00CC #LATIN CAPITAL LETTER I WITH GRAVE +0xCD 0x00CD #LATIN CAPITAL LETTER I WITH ACUTE +0xCE 0x00CE #LATIN CAPITAL LETTER I WITH CIRCUMFLEX +0xCF 0x00CF #LATIN CAPITAL LETTER I WITH DIAERESIS +0xD0 0x00D0 #LATIN CAPITAL LETTER ETH +0xD1 0x00D1 #LATIN CAPITAL LETTER N WITH TILDE +0xD2 0x00D2 #LATIN CAPITAL LETTER O WITH GRAVE +0xD3 0x00D3 #LATIN CAPITAL LETTER O WITH ACUTE +0xD4 0x00D4 #LATIN CAPITAL LETTER O WITH CIRCUMFLEX +0xD5 0x00D5 #LATIN CAPITAL LETTER O WITH TILDE +0xD6 0x00D6 #LATIN CAPITAL LETTER O WITH DIAERESIS +0xD7 0x00D7 #MULTIPLICATION SIGN +0xD8 0x00D8 #LATIN CAPITAL LETTER O WITH STROKE +0xD9 0x00D9 #LATIN CAPITAL LETTER U WITH GRAVE +0xDA 0x00DA #LATIN CAPITAL LETTER U WITH ACUTE +0xDB 0x00DB #LATIN CAPITAL LETTER U WITH CIRCUMFLEX +0xDC 0x00DC #LATIN CAPITAL LETTER U WITH DIAERESIS +0xDD 0x00DD #LATIN CAPITAL LETTER Y WITH ACUTE +0xDE 0x00DE #LATIN CAPITAL LETTER THORN +0xDF 0x00DF #LATIN SMALL LETTER SHARP S +0xE0 0x00E0 #LATIN SMALL LETTER A WITH GRAVE +0xE1 0x00E1 #LATIN SMALL LETTER A WITH ACUTE +0xE2 0x00E2 #LATIN SMALL LETTER A WITH CIRCUMFLEX +0xE3 0x00E3 #LATIN SMALL LETTER A WITH TILDE +0xE4 0x00E4 #LATIN SMALL LETTER A WITH DIAERESIS +0xE5 0x00E5 #LATIN SMALL LETTER A WITH RING ABOVE +0xE6 0x00E6 #LATIN SMALL LETTER AE +0xE7 0x00E7 #LATIN SMALL LETTER C WITH CEDILLA +0xE8 0x00E8 #LATIN SMALL LETTER E WITH GRAVE +0xE9 0x00E9 #LATIN SMALL LETTER E WITH ACUTE +0xEA 0x00EA #LATIN SMALL LETTER E WITH CIRCUMFLEX +0xEB 0x00EB #LATIN SMALL LETTER E WITH DIAERESIS +0xEC 0x00EC #LATIN SMALL LETTER I WITH GRAVE +0xED 0x00ED #LATIN SMALL LETTER I WITH ACUTE +0xEE 0x00EE #LATIN SMALL LETTER I WITH CIRCUMFLEX +0xEF 0x00EF #LATIN SMALL LETTER I WITH DIAERESIS +0xF0 0x00F0 #LATIN SMALL LETTER ETH +0xF1 0x00F1 #LATIN SMALL LETTER N WITH TILDE +0xF2 0x00F2 #LATIN SMALL LETTER O WITH GRAVE +0xF3 0x00F3 #LATIN SMALL LETTER O WITH ACUTE +0xF4 0x00F4 #LATIN SMALL LETTER O WITH CIRCUMFLEX +0xF5 0x00F5 #LATIN SMALL LETTER O WITH TILDE +0xF6 0x00F6 #LATIN SMALL LETTER O WITH DIAERESIS +0xF7 0x00F7 #DIVISION SIGN +0xF8 0x00F8 #LATIN SMALL LETTER O WITH STROKE +0xF9 0x00F9 #LATIN SMALL LETTER U WITH GRAVE +0xFA 0x00FA #LATIN SMALL LETTER U WITH ACUTE +0xFB 0x00FB #LATIN SMALL LETTER U WITH CIRCUMFLEX +0xFC 0x00FC #LATIN SMALL LETTER U WITH DIAERESIS +0xFD 0x00FD #LATIN SMALL LETTER Y WITH ACUTE +0xFE 0x00FE #LATIN SMALL LETTER THORN +0xFF 0x00FF #LATIN SMALL LETTER Y WITH DIAERESIS diff --git a/ext/standard/html_tables/mappings/CP866.TXT b/ext/standard/html_tables/mappings/CP866.TXT new file mode 100644 index 0000000..b0213a1 --- /dev/null +++ b/ext/standard/html_tables/mappings/CP866.TXT @@ -0,0 +1,275 @@ +# +# Name: cp866_DOSCyrillicRussian to Unicode table +# Unicode version: 2.0 +# Table version: 2.00 +# Table format: Format A +# Date: 04/24/96 +# Contact: Shawn.Steele@microsoft.com +# +# General notes: none +# +# Format: Three tab-separated columns +# Column #1 is the cp866_DOSCyrillicRussian code (in hex) +# Column #2 is the Unicode (in hex as 0xXXXX) +# Column #3 is the Unicode name (follows a comment sign, '#') +# +# The entries are in cp866_DOSCyrillicRussian order +# +0x00 0x0000 #NULL +0x01 0x0001 #START OF HEADING +0x02 0x0002 #START OF TEXT +0x03 0x0003 #END OF TEXT +0x04 0x0004 #END OF TRANSMISSION +0x05 0x0005 #ENQUIRY +0x06 0x0006 #ACKNOWLEDGE +0x07 0x0007 #BELL +0x08 0x0008 #BACKSPACE +0x09 0x0009 #HORIZONTAL TABULATION +0x0a 0x000a #LINE FEED +0x0b 0x000b #VERTICAL TABULATION +0x0c 0x000c #FORM FEED +0x0d 0x000d #CARRIAGE RETURN +0x0e 0x000e #SHIFT OUT +0x0f 0x000f #SHIFT IN +0x10 0x0010 #DATA LINK ESCAPE +0x11 0x0011 #DEVICE CONTROL ONE +0x12 0x0012 #DEVICE CONTROL TWO +0x13 0x0013 #DEVICE CONTROL THREE +0x14 0x0014 #DEVICE CONTROL FOUR +0x15 0x0015 #NEGATIVE ACKNOWLEDGE +0x16 0x0016 #SYNCHRONOUS IDLE +0x17 0x0017 #END OF TRANSMISSION BLOCK +0x18 0x0018 #CANCEL +0x19 0x0019 #END OF MEDIUM +0x1a 0x001a #SUBSTITUTE +0x1b 0x001b #ESCAPE +0x1c 0x001c #FILE SEPARATOR +0x1d 0x001d #GROUP SEPARATOR +0x1e 0x001e #RECORD SEPARATOR +0x1f 0x001f #UNIT SEPARATOR +0x20 0x0020 #SPACE +0x21 0x0021 #EXCLAMATION MARK +0x22 0x0022 #QUOTATION MARK +0x23 0x0023 #NUMBER SIGN +0x24 0x0024 #DOLLAR SIGN +0x25 0x0025 #PERCENT SIGN +0x26 0x0026 #AMPERSAND +0x27 0x0027 #APOSTROPHE +0x28 0x0028 #LEFT PARENTHESIS +0x29 0x0029 #RIGHT PARENTHESIS +0x2a 0x002a #ASTERISK +0x2b 0x002b #PLUS SIGN +0x2c 0x002c #COMMA +0x2d 0x002d #HYPHEN-MINUS +0x2e 0x002e #FULL STOP +0x2f 0x002f #SOLIDUS +0x30 0x0030 #DIGIT ZERO +0x31 0x0031 #DIGIT ONE +0x32 0x0032 #DIGIT TWO +0x33 0x0033 #DIGIT THREE +0x34 0x0034 #DIGIT FOUR +0x35 0x0035 #DIGIT FIVE +0x36 0x0036 #DIGIT SIX +0x37 0x0037 #DIGIT SEVEN +0x38 0x0038 #DIGIT EIGHT +0x39 0x0039 #DIGIT NINE +0x3a 0x003a #COLON +0x3b 0x003b #SEMICOLON +0x3c 0x003c #LESS-THAN SIGN +0x3d 0x003d #EQUALS SIGN +0x3e 0x003e #GREATER-THAN SIGN +0x3f 0x003f #QUESTION MARK +0x40 0x0040 #COMMERCIAL AT +0x41 0x0041 #LATIN CAPITAL LETTER A +0x42 0x0042 #LATIN CAPITAL LETTER B +0x43 0x0043 #LATIN CAPITAL LETTER C +0x44 0x0044 #LATIN CAPITAL LETTER D +0x45 0x0045 #LATIN CAPITAL LETTER E +0x46 0x0046 #LATIN CAPITAL LETTER F +0x47 0x0047 #LATIN CAPITAL LETTER G +0x48 0x0048 #LATIN CAPITAL LETTER H +0x49 0x0049 #LATIN CAPITAL LETTER I +0x4a 0x004a #LATIN CAPITAL LETTER J +0x4b 0x004b #LATIN CAPITAL LETTER K +0x4c 0x004c #LATIN CAPITAL LETTER L +0x4d 0x004d #LATIN CAPITAL LETTER M +0x4e 0x004e #LATIN CAPITAL LETTER N +0x4f 0x004f #LATIN CAPITAL LETTER O +0x50 0x0050 #LATIN CAPITAL LETTER P +0x51 0x0051 #LATIN CAPITAL LETTER Q +0x52 0x0052 #LATIN CAPITAL LETTER R +0x53 0x0053 #LATIN CAPITAL LETTER S +0x54 0x0054 #LATIN CAPITAL LETTER T +0x55 0x0055 #LATIN CAPITAL LETTER U +0x56 0x0056 #LATIN CAPITAL LETTER V +0x57 0x0057 #LATIN CAPITAL LETTER W +0x58 0x0058 #LATIN CAPITAL LETTER X +0x59 0x0059 #LATIN CAPITAL LETTER Y +0x5a 0x005a #LATIN CAPITAL LETTER Z +0x5b 0x005b #LEFT SQUARE BRACKET +0x5c 0x005c #REVERSE SOLIDUS +0x5d 0x005d #RIGHT SQUARE BRACKET +0x5e 0x005e #CIRCUMFLEX ACCENT +0x5f 0x005f #LOW LINE +0x60 0x0060 #GRAVE ACCENT +0x61 0x0061 #LATIN SMALL LETTER A +0x62 0x0062 #LATIN SMALL LETTER B +0x63 0x0063 #LATIN SMALL LETTER C +0x64 0x0064 #LATIN SMALL LETTER D +0x65 0x0065 #LATIN SMALL LETTER E +0x66 0x0066 #LATIN SMALL LETTER F +0x67 0x0067 #LATIN SMALL LETTER G +0x68 0x0068 #LATIN SMALL LETTER H +0x69 0x0069 #LATIN SMALL LETTER I +0x6a 0x006a #LATIN SMALL LETTER J +0x6b 0x006b #LATIN SMALL LETTER K +0x6c 0x006c #LATIN SMALL LETTER L +0x6d 0x006d #LATIN SMALL LETTER M +0x6e 0x006e #LATIN SMALL LETTER N +0x6f 0x006f #LATIN SMALL LETTER O +0x70 0x0070 #LATIN SMALL LETTER P +0x71 0x0071 #LATIN SMALL LETTER Q +0x72 0x0072 #LATIN SMALL LETTER R +0x73 0x0073 #LATIN SMALL LETTER S +0x74 0x0074 #LATIN SMALL LETTER T +0x75 0x0075 #LATIN SMALL LETTER U +0x76 0x0076 #LATIN SMALL LETTER V +0x77 0x0077 #LATIN SMALL LETTER W +0x78 0x0078 #LATIN SMALL LETTER X +0x79 0x0079 #LATIN SMALL LETTER Y +0x7a 0x007a #LATIN SMALL LETTER Z +0x7b 0x007b #LEFT CURLY BRACKET +0x7c 0x007c #VERTICAL LINE +0x7d 0x007d #RIGHT CURLY BRACKET +0x7e 0x007e #TILDE +0x7f 0x007f #DELETE +0x80 0x0410 #CYRILLIC CAPITAL LETTER A +0x81 0x0411 #CYRILLIC CAPITAL LETTER BE +0x82 0x0412 #CYRILLIC CAPITAL LETTER VE +0x83 0x0413 #CYRILLIC CAPITAL LETTER GHE +0x84 0x0414 #CYRILLIC CAPITAL LETTER DE +0x85 0x0415 #CYRILLIC CAPITAL LETTER IE +0x86 0x0416 #CYRILLIC CAPITAL LETTER ZHE +0x87 0x0417 #CYRILLIC CAPITAL LETTER ZE +0x88 0x0418 #CYRILLIC CAPITAL LETTER I +0x89 0x0419 #CYRILLIC CAPITAL LETTER SHORT I +0x8a 0x041a #CYRILLIC CAPITAL LETTER KA +0x8b 0x041b #CYRILLIC CAPITAL LETTER EL +0x8c 0x041c #CYRILLIC CAPITAL LETTER EM +0x8d 0x041d #CYRILLIC CAPITAL LETTER EN +0x8e 0x041e #CYRILLIC CAPITAL LETTER O +0x8f 0x041f #CYRILLIC CAPITAL LETTER PE +0x90 0x0420 #CYRILLIC CAPITAL LETTER ER +0x91 0x0421 #CYRILLIC CAPITAL LETTER ES +0x92 0x0422 #CYRILLIC CAPITAL LETTER TE +0x93 0x0423 #CYRILLIC CAPITAL LETTER U +0x94 0x0424 #CYRILLIC CAPITAL LETTER EF +0x95 0x0425 #CYRILLIC CAPITAL LETTER HA +0x96 0x0426 #CYRILLIC CAPITAL LETTER TSE +0x97 0x0427 #CYRILLIC CAPITAL LETTER CHE +0x98 0x0428 #CYRILLIC CAPITAL LETTER SHA +0x99 0x0429 #CYRILLIC CAPITAL LETTER SHCHA +0x9a 0x042a #CYRILLIC CAPITAL LETTER HARD SIGN +0x9b 0x042b #CYRILLIC CAPITAL LETTER YERU +0x9c 0x042c #CYRILLIC CAPITAL LETTER SOFT SIGN +0x9d 0x042d #CYRILLIC CAPITAL LETTER E +0x9e 0x042e #CYRILLIC CAPITAL LETTER YU +0x9f 0x042f #CYRILLIC CAPITAL LETTER YA +0xa0 0x0430 #CYRILLIC SMALL LETTER A +0xa1 0x0431 #CYRILLIC SMALL LETTER BE +0xa2 0x0432 #CYRILLIC SMALL LETTER VE +0xa3 0x0433 #CYRILLIC SMALL LETTER GHE +0xa4 0x0434 #CYRILLIC SMALL LETTER DE +0xa5 0x0435 #CYRILLIC SMALL LETTER IE +0xa6 0x0436 #CYRILLIC SMALL LETTER ZHE +0xa7 0x0437 #CYRILLIC SMALL LETTER ZE +0xa8 0x0438 #CYRILLIC SMALL LETTER I +0xa9 0x0439 #CYRILLIC SMALL LETTER SHORT I +0xaa 0x043a #CYRILLIC SMALL LETTER KA +0xab 0x043b #CYRILLIC SMALL LETTER EL +0xac 0x043c #CYRILLIC SMALL LETTER EM +0xad 0x043d #CYRILLIC SMALL LETTER EN +0xae 0x043e #CYRILLIC SMALL LETTER O +0xaf 0x043f #CYRILLIC SMALL LETTER PE +0xb0 0x2591 #LIGHT SHADE +0xb1 0x2592 #MEDIUM SHADE +0xb2 0x2593 #DARK SHADE +0xb3 0x2502 #BOX DRAWINGS LIGHT VERTICAL +0xb4 0x2524 #BOX DRAWINGS LIGHT VERTICAL AND LEFT +0xb5 0x2561 #BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE +0xb6 0x2562 #BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE +0xb7 0x2556 #BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE +0xb8 0x2555 #BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE +0xb9 0x2563 #BOX DRAWINGS DOUBLE VERTICAL AND LEFT +0xba 0x2551 #BOX DRAWINGS DOUBLE VERTICAL +0xbb 0x2557 #BOX DRAWINGS DOUBLE DOWN AND LEFT +0xbc 0x255d #BOX DRAWINGS DOUBLE UP AND LEFT +0xbd 0x255c #BOX DRAWINGS UP DOUBLE AND LEFT SINGLE +0xbe 0x255b #BOX DRAWINGS UP SINGLE AND LEFT DOUBLE +0xbf 0x2510 #BOX DRAWINGS LIGHT DOWN AND LEFT +0xc0 0x2514 #BOX DRAWINGS LIGHT UP AND RIGHT +0xc1 0x2534 #BOX DRAWINGS LIGHT UP AND HORIZONTAL +0xc2 0x252c #BOX DRAWINGS LIGHT DOWN AND HORIZONTAL +0xc3 0x251c #BOX DRAWINGS LIGHT VERTICAL AND RIGHT +0xc4 0x2500 #BOX DRAWINGS LIGHT HORIZONTAL +0xc5 0x253c #BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL +0xc6 0x255e #BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE +0xc7 0x255f #BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE +0xc8 0x255a #BOX DRAWINGS DOUBLE UP AND RIGHT +0xc9 0x2554 #BOX DRAWINGS DOUBLE DOWN AND RIGHT +0xca 0x2569 #BOX DRAWINGS DOUBLE UP AND HORIZONTAL +0xcb 0x2566 #BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL +0xcc 0x2560 #BOX DRAWINGS DOUBLE VERTICAL AND RIGHT +0xcd 0x2550 #BOX DRAWINGS DOUBLE HORIZONTAL +0xce 0x256c #BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL +0xcf 0x2567 #BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE +0xd0 0x2568 #BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE +0xd1 0x2564 #BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE +0xd2 0x2565 #BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE +0xd3 0x2559 #BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE +0xd4 0x2558 #BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE +0xd5 0x2552 #BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE +0xd6 0x2553 #BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE +0xd7 0x256b #BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE +0xd8 0x256a #BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE +0xd9 0x2518 #BOX DRAWINGS LIGHT UP AND LEFT +0xda 0x250c #BOX DRAWINGS LIGHT DOWN AND RIGHT +0xdb 0x2588 #FULL BLOCK +0xdc 0x2584 #LOWER HALF BLOCK +0xdd 0x258c #LEFT HALF BLOCK +0xde 0x2590 #RIGHT HALF BLOCK +0xdf 0x2580 #UPPER HALF BLOCK +0xe0 0x0440 #CYRILLIC SMALL LETTER ER +0xe1 0x0441 #CYRILLIC SMALL LETTER ES +0xe2 0x0442 #CYRILLIC SMALL LETTER TE +0xe3 0x0443 #CYRILLIC SMALL LETTER U +0xe4 0x0444 #CYRILLIC SMALL LETTER EF +0xe5 0x0445 #CYRILLIC SMALL LETTER HA +0xe6 0x0446 #CYRILLIC SMALL LETTER TSE +0xe7 0x0447 #CYRILLIC SMALL LETTER CHE +0xe8 0x0448 #CYRILLIC SMALL LETTER SHA +0xe9 0x0449 #CYRILLIC SMALL LETTER SHCHA +0xea 0x044a #CYRILLIC SMALL LETTER HARD SIGN +0xeb 0x044b #CYRILLIC SMALL LETTER YERU +0xec 0x044c #CYRILLIC SMALL LETTER SOFT SIGN +0xed 0x044d #CYRILLIC SMALL LETTER E +0xee 0x044e #CYRILLIC SMALL LETTER YU +0xef 0x044f #CYRILLIC SMALL LETTER YA +0xf0 0x0401 #CYRILLIC CAPITAL LETTER IO +0xf1 0x0451 #CYRILLIC SMALL LETTER IO +0xf2 0x0404 #CYRILLIC CAPITAL LETTER UKRAINIAN IE +0xf3 0x0454 #CYRILLIC SMALL LETTER UKRAINIAN IE +0xf4 0x0407 #CYRILLIC CAPITAL LETTER YI +0xf5 0x0457 #CYRILLIC SMALL LETTER YI +0xf6 0x040e #CYRILLIC CAPITAL LETTER SHORT U +0xf7 0x045e #CYRILLIC SMALL LETTER SHORT U +0xf8 0x00b0 #DEGREE SIGN +0xf9 0x2219 #BULLET OPERATOR +0xfa 0x00b7 #MIDDLE DOT +0xfb 0x221a #SQUARE ROOT +0xfc 0x2116 #NUMERO SIGN +0xfd 0x00a4 #CURRENCY SIGN +0xfe 0x25a0 #BLACK SQUARE +0xff 0x00a0 #NO-BREAK SPACE + + \ No newline at end of file diff --git a/ext/standard/html_tables/mappings/KOI8-R.TXT b/ext/standard/html_tables/mappings/KOI8-R.TXT new file mode 100644 index 0000000..5105610 --- /dev/null +++ b/ext/standard/html_tables/mappings/KOI8-R.TXT @@ -0,0 +1,302 @@ +# +# Name: KOI8-R (RFC1489) to Unicode +# Unicode version: 3.0 +# Table version: 1.0 +# Table format: Format A +# Date: 18 August 1999 +# Authors: Helmut Richter +# +# Copyright (c) 1991-1999 Unicode, Inc. All Rights reserved. +# +# This file is provided as-is by Unicode, Inc. (The Unicode Consortium). +# No claims are made as to fitness for any particular purpose. No +# warranties of any kind are expressed or implied. The recipient +# agrees to determine applicability of information provided. If this +# file has been provided on optical media by Unicode, Inc., the sole +# remedy for any claim will be exchange of defective media within 90 +# days of receipt. +# +# Unicode, Inc. hereby grants the right to freely use the information +# supplied in this file in the creation of products supporting the +# Unicode Standard, and to make copies of this file in any form for +# internal or external distribution as long as this notice remains +# attached. +# +# General notes: +# +# This table contains the data the Unicode Consortium has on how +# KOI8-R characters map into Unicode. The underlying document is the +# mapping described in RFC 1489. No statements are made as to whether +# this mapping is the same as the mapping defined as "Code Page 878" +# with some vendors. +# +# Format: Three tab-separated columns +# Column #1 is the KOI8-R code (in hex as 0xXX) +# Column #2 is the Unicode (in hex as 0xXXXX) +# Column #3 the Unicode name (follows a comment sign, '#') +# +# The entries are in KOI8-R order. +# +# Version history +# 1.0 version: created. +# +# Any comments or problems, contact +# Please note that is an archival address; +# notices will be checked, but do not expect an immediate response. +# +0x00 0x0000 # NULL +0x01 0x0001 # START OF HEADING +0x02 0x0002 # START OF TEXT +0x03 0x0003 # END OF TEXT +0x04 0x0004 # END OF TRANSMISSION +0x05 0x0005 # ENQUIRY +0x06 0x0006 # ACKNOWLEDGE +0x07 0x0007 # BELL +0x08 0x0008 # BACKSPACE +0x09 0x0009 # HORIZONTAL TABULATION +0x0A 0x000A # LINE FEED +0x0B 0x000B # VERTICAL TABULATION +0x0C 0x000C # FORM FEED +0x0D 0x000D # CARRIAGE RETURN +0x0E 0x000E # SHIFT OUT +0x0F 0x000F # SHIFT IN +0x10 0x0010 # DATA LINK ESCAPE +0x11 0x0011 # DEVICE CONTROL ONE +0x12 0x0012 # DEVICE CONTROL TWO +0x13 0x0013 # DEVICE CONTROL THREE +0x14 0x0014 # DEVICE CONTROL FOUR +0x15 0x0015 # NEGATIVE ACKNOWLEDGE +0x16 0x0016 # SYNCHRONOUS IDLE +0x17 0x0017 # END OF TRANSMISSION BLOCK +0x18 0x0018 # CANCEL +0x19 0x0019 # END OF MEDIUM +0x1A 0x001A # SUBSTITUTE +0x1B 0x001B # ESCAPE +0x1C 0x001C # FILE SEPARATOR +0x1D 0x001D # GROUP SEPARATOR +0x1E 0x001E # RECORD SEPARATOR +0x1F 0x001F # UNIT SEPARATOR +0x20 0x0020 # SPACE +0x21 0x0021 # EXCLAMATION MARK +0x22 0x0022 # QUOTATION MARK +0x23 0x0023 # NUMBER SIGN +0x24 0x0024 # DOLLAR SIGN +0x25 0x0025 # PERCENT SIGN +0x26 0x0026 # AMPERSAND +0x27 0x0027 # APOSTROPHE +0x28 0x0028 # LEFT PARENTHESIS +0x29 0x0029 # RIGHT PARENTHESIS +0x2A 0x002A # ASTERISK +0x2B 0x002B # PLUS SIGN +0x2C 0x002C # COMMA +0x2D 0x002D # HYPHEN-MINUS +0x2E 0x002E # FULL STOP +0x2F 0x002F # SOLIDUS +0x30 0x0030 # DIGIT ZERO +0x31 0x0031 # DIGIT ONE +0x32 0x0032 # DIGIT TWO +0x33 0x0033 # DIGIT THREE +0x34 0x0034 # DIGIT FOUR +0x35 0x0035 # DIGIT FIVE +0x36 0x0036 # DIGIT SIX +0x37 0x0037 # DIGIT SEVEN +0x38 0x0038 # DIGIT EIGHT +0x39 0x0039 # DIGIT NINE +0x3A 0x003A # COLON +0x3B 0x003B # SEMICOLON +0x3C 0x003C # LESS-THAN SIGN +0x3D 0x003D # EQUALS SIGN +0x3E 0x003E # GREATER-THAN SIGN +0x3F 0x003F # QUESTION MARK +0x40 0x0040 # COMMERCIAL AT +0x41 0x0041 # LATIN CAPITAL LETTER A +0x42 0x0042 # LATIN CAPITAL LETTER B +0x43 0x0043 # LATIN CAPITAL LETTER C +0x44 0x0044 # LATIN CAPITAL LETTER D +0x45 0x0045 # LATIN CAPITAL LETTER E +0x46 0x0046 # LATIN CAPITAL LETTER F +0x47 0x0047 # LATIN CAPITAL LETTER G +0x48 0x0048 # LATIN CAPITAL LETTER H +0x49 0x0049 # LATIN CAPITAL LETTER I +0x4A 0x004A # LATIN CAPITAL LETTER J +0x4B 0x004B # LATIN CAPITAL LETTER K +0x4C 0x004C # LATIN CAPITAL LETTER L +0x4D 0x004D # LATIN CAPITAL LETTER M +0x4E 0x004E # LATIN CAPITAL LETTER N +0x4F 0x004F # LATIN CAPITAL LETTER O +0x50 0x0050 # LATIN CAPITAL LETTER P +0x51 0x0051 # LATIN CAPITAL LETTER Q +0x52 0x0052 # LATIN CAPITAL LETTER R +0x53 0x0053 # LATIN CAPITAL LETTER S +0x54 0x0054 # LATIN CAPITAL LETTER T +0x55 0x0055 # LATIN CAPITAL LETTER U +0x56 0x0056 # LATIN CAPITAL LETTER V +0x57 0x0057 # LATIN CAPITAL LETTER W +0x58 0x0058 # LATIN CAPITAL LETTER X +0x59 0x0059 # LATIN CAPITAL LETTER Y +0x5A 0x005A # LATIN CAPITAL LETTER Z +0x5B 0x005B # LEFT SQUARE BRACKET +0x5C 0x005C # REVERSE SOLIDUS +0x5D 0x005D # RIGHT SQUARE BRACKET +0x5E 0x005E # CIRCUMFLEX ACCENT +0x5F 0x005F # LOW LINE +0x60 0x0060 # GRAVE ACCENT +0x61 0x0061 # LATIN SMALL LETTER A +0x62 0x0062 # LATIN SMALL LETTER B +0x63 0x0063 # LATIN SMALL LETTER C +0x64 0x0064 # LATIN SMALL LETTER D +0x65 0x0065 # LATIN SMALL LETTER E +0x66 0x0066 # LATIN SMALL LETTER F +0x67 0x0067 # LATIN SMALL LETTER G +0x68 0x0068 # LATIN SMALL LETTER H +0x69 0x0069 # LATIN SMALL LETTER I +0x6A 0x006A # LATIN SMALL LETTER J +0x6B 0x006B # LATIN SMALL LETTER K +0x6C 0x006C # LATIN SMALL LETTER L +0x6D 0x006D # LATIN SMALL LETTER M +0x6E 0x006E # LATIN SMALL LETTER N +0x6F 0x006F # LATIN SMALL LETTER O +0x70 0x0070 # LATIN SMALL LETTER P +0x71 0x0071 # LATIN SMALL LETTER Q +0x72 0x0072 # LATIN SMALL LETTER R +0x73 0x0073 # LATIN SMALL LETTER S +0x74 0x0074 # LATIN SMALL LETTER T +0x75 0x0075 # LATIN SMALL LETTER U +0x76 0x0076 # LATIN SMALL LETTER V +0x77 0x0077 # LATIN SMALL LETTER W +0x78 0x0078 # LATIN SMALL LETTER X +0x79 0x0079 # LATIN SMALL LETTER Y +0x7A 0x007A # LATIN SMALL LETTER Z +0x7B 0x007B # LEFT CURLY BRACKET +0x7C 0x007C # VERTICAL LINE +0x7D 0x007D # RIGHT CURLY BRACKET +0x7E 0x007E # TILDE +0x7F 0x007F # DELETE +0x80 0x2500 # BOX DRAWINGS LIGHT HORIZONTAL +0x81 0x2502 # BOX DRAWINGS LIGHT VERTICAL +0x82 0x250C # BOX DRAWINGS LIGHT DOWN AND RIGHT +0x83 0x2510 # BOX DRAWINGS LIGHT DOWN AND LEFT +0x84 0x2514 # BOX DRAWINGS LIGHT UP AND RIGHT +0x85 0x2518 # BOX DRAWINGS LIGHT UP AND LEFT +0x86 0x251C # BOX DRAWINGS LIGHT VERTICAL AND RIGHT +0x87 0x2524 # BOX DRAWINGS LIGHT VERTICAL AND LEFT +0x88 0x252C # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL +0x89 0x2534 # BOX DRAWINGS LIGHT UP AND HORIZONTAL +0x8A 0x253C # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL +0x8B 0x2580 # UPPER HALF BLOCK +0x8C 0x2584 # LOWER HALF BLOCK +0x8D 0x2588 # FULL BLOCK +0x8E 0x258C # LEFT HALF BLOCK +0x8F 0x2590 # RIGHT HALF BLOCK +0x90 0x2591 # LIGHT SHADE +0x91 0x2592 # MEDIUM SHADE +0x92 0x2593 # DARK SHADE +0x93 0x2320 # TOP HALF INTEGRAL +0x94 0x25A0 # BLACK SQUARE +0x95 0x2219 # BULLET OPERATOR +0x96 0x221A # SQUARE ROOT +0x97 0x2248 # ALMOST EQUAL TO +0x98 0x2264 # LESS-THAN OR EQUAL TO +0x99 0x2265 # GREATER-THAN OR EQUAL TO +0x9A 0x00A0 # NO-BREAK SPACE +0x9B 0x2321 # BOTTOM HALF INTEGRAL +0x9C 0x00B0 # DEGREE SIGN +0x9D 0x00B2 # SUPERSCRIPT TWO +0x9E 0x00B7 # MIDDLE DOT +0x9F 0x00F7 # DIVISION SIGN +0xA0 0x2550 # BOX DRAWINGS DOUBLE HORIZONTAL +0xA1 0x2551 # BOX DRAWINGS DOUBLE VERTICAL +0xA2 0x2552 # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE +0xA3 0x0451 # CYRILLIC SMALL LETTER IO +0xA4 0x2553 # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE +0xA5 0x2554 # BOX DRAWINGS DOUBLE DOWN AND RIGHT +0xA6 0x2555 # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE +0xA7 0x2556 # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE +0xA8 0x2557 # BOX DRAWINGS DOUBLE DOWN AND LEFT +0xA9 0x2558 # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE +0xAA 0x2559 # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE +0xAB 0x255A # BOX DRAWINGS DOUBLE UP AND RIGHT +0xAC 0x255B # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE +0xAD 0x255C # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE +0xAE 0x255D # BOX DRAWINGS DOUBLE UP AND LEFT +0xAF 0x255E # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE +0xB0 0x255F # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE +0xB1 0x2560 # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT +0xB2 0x2561 # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE +0xB3 0x0401 # CYRILLIC CAPITAL LETTER IO +0xB4 0x2562 # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE +0xB5 0x2563 # BOX DRAWINGS DOUBLE VERTICAL AND LEFT +0xB6 0x2564 # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE +0xB7 0x2565 # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE +0xB8 0x2566 # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL +0xB9 0x2567 # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE +0xBA 0x2568 # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE +0xBB 0x2569 # BOX DRAWINGS DOUBLE UP AND HORIZONTAL +0xBC 0x256A # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE +0xBD 0x256B # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE +0xBE 0x256C # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL +0xBF 0x00A9 # COPYRIGHT SIGN +0xC0 0x044E # CYRILLIC SMALL LETTER YU +0xC1 0x0430 # CYRILLIC SMALL LETTER A +0xC2 0x0431 # CYRILLIC SMALL LETTER BE +0xC3 0x0446 # CYRILLIC SMALL LETTER TSE +0xC4 0x0434 # CYRILLIC SMALL LETTER DE +0xC5 0x0435 # CYRILLIC SMALL LETTER IE +0xC6 0x0444 # CYRILLIC SMALL LETTER EF +0xC7 0x0433 # CYRILLIC SMALL LETTER GHE +0xC8 0x0445 # CYRILLIC SMALL LETTER HA +0xC9 0x0438 # CYRILLIC SMALL LETTER I +0xCA 0x0439 # CYRILLIC SMALL LETTER SHORT I +0xCB 0x043A # CYRILLIC SMALL LETTER KA +0xCC 0x043B # CYRILLIC SMALL LETTER EL +0xCD 0x043C # CYRILLIC SMALL LETTER EM +0xCE 0x043D # CYRILLIC SMALL LETTER EN +0xCF 0x043E # CYRILLIC SMALL LETTER O +0xD0 0x043F # CYRILLIC SMALL LETTER PE +0xD1 0x044F # CYRILLIC SMALL LETTER YA +0xD2 0x0440 # CYRILLIC SMALL LETTER ER +0xD3 0x0441 # CYRILLIC SMALL LETTER ES +0xD4 0x0442 # CYRILLIC SMALL LETTER TE +0xD5 0x0443 # CYRILLIC SMALL LETTER U +0xD6 0x0436 # CYRILLIC SMALL LETTER ZHE +0xD7 0x0432 # CYRILLIC SMALL LETTER VE +0xD8 0x044C # CYRILLIC SMALL LETTER SOFT SIGN +0xD9 0x044B # CYRILLIC SMALL LETTER YERU +0xDA 0x0437 # CYRILLIC SMALL LETTER ZE +0xDB 0x0448 # CYRILLIC SMALL LETTER SHA +0xDC 0x044D # CYRILLIC SMALL LETTER E +0xDD 0x0449 # CYRILLIC SMALL LETTER SHCHA +0xDE 0x0447 # CYRILLIC SMALL LETTER CHE +0xDF 0x044A # CYRILLIC SMALL LETTER HARD SIGN +0xE0 0x042E # CYRILLIC CAPITAL LETTER YU +0xE1 0x0410 # CYRILLIC CAPITAL LETTER A +0xE2 0x0411 # CYRILLIC CAPITAL LETTER BE +0xE3 0x0426 # CYRILLIC CAPITAL LETTER TSE +0xE4 0x0414 # CYRILLIC CAPITAL LETTER DE +0xE5 0x0415 # CYRILLIC CAPITAL LETTER IE +0xE6 0x0424 # CYRILLIC CAPITAL LETTER EF +0xE7 0x0413 # CYRILLIC CAPITAL LETTER GHE +0xE8 0x0425 # CYRILLIC CAPITAL LETTER HA +0xE9 0x0418 # CYRILLIC CAPITAL LETTER I +0xEA 0x0419 # CYRILLIC CAPITAL LETTER SHORT I +0xEB 0x041A # CYRILLIC CAPITAL LETTER KA +0xEC 0x041B # CYRILLIC CAPITAL LETTER EL +0xED 0x041C # CYRILLIC CAPITAL LETTER EM +0xEE 0x041D # CYRILLIC CAPITAL LETTER EN +0xEF 0x041E # CYRILLIC CAPITAL LETTER O +0xF0 0x041F # CYRILLIC CAPITAL LETTER PE +0xF1 0x042F # CYRILLIC CAPITAL LETTER YA +0xF2 0x0420 # CYRILLIC CAPITAL LETTER ER +0xF3 0x0421 # CYRILLIC CAPITAL LETTER ES +0xF4 0x0422 # CYRILLIC CAPITAL LETTER TE +0xF5 0x0423 # CYRILLIC CAPITAL LETTER U +0xF6 0x0416 # CYRILLIC CAPITAL LETTER ZHE +0xF7 0x0412 # CYRILLIC CAPITAL LETTER VE +0xF8 0x042C # CYRILLIC CAPITAL LETTER SOFT SIGN +0xF9 0x042B # CYRILLIC CAPITAL LETTER YERU +0xFA 0x0417 # CYRILLIC CAPITAL LETTER ZE +0xFB 0x0428 # CYRILLIC CAPITAL LETTER SHA +0xFC 0x042D # CYRILLIC CAPITAL LETTER E +0xFD 0x0429 # CYRILLIC CAPITAL LETTER SHCHA +0xFE 0x0427 # CYRILLIC CAPITAL LETTER CHE +0xFF 0x042A # CYRILLIC CAPITAL LETTER HARD SIGN diff --git a/ext/standard/html_tables/mappings/ROMAN.TXT b/ext/standard/html_tables/mappings/ROMAN.TXT new file mode 100644 index 0000000..5b3b8b4 --- /dev/null +++ b/ext/standard/html_tables/mappings/ROMAN.TXT @@ -0,0 +1,370 @@ +#======================================================================= +# File name: ROMAN.TXT +# +# Contents: Map (external version) from Mac OS Roman +# character set to Unicode 2.1 and later. +# +# Copyright: (c) 1994-2002, 2005 by Apple Computer, Inc., all rights +# reserved. +# +# Contact: charsets@apple.com +# +# Changes: +# +# c02 2005-Apr-05 Update header comments. Matches internal xml +# and Text Encoding Converter 2.0. +# b4,c1 2002-Dec-19 Update URLs, notes. Matches internal +# utom. +# b03 1999-Sep-22 Update contact e-mail address. Matches +# internal utom, ufrm, and Text +# Encoding Converter version 1.5. +# b02 1998-Aug-18 Encoding changed for Mac OS 8.5; change +# mapping of 0xDB from CURRENCY SIGN to +# EURO SIGN. Matches internal utom, +# ufrm. +# n08 1998-Feb-05 Minor update to header comments +# n06 1997-Dec-14 Add warning about future changes to 0xDB +# from CURRENCY SIGN to EURO SIGN. Clarify +# some header information +# n04 1997-Dec-01 Update to match internal utom, ufrm: +# Change standard mapping for 0xBD from U+2126 +# to its canonical decomposition, U+03A9. +# n03 1995-Apr-15 First version (after fixing some typos). +# Matches internal ufrm. +# +# Standard header: +# ---------------- +# +# Apple, the Apple logo, and Macintosh are trademarks of Apple +# Computer, Inc., registered in the United States and other countries. +# Unicode is a trademark of Unicode Inc. For the sake of brevity, +# throughout this document, "Macintosh" can be used to refer to +# Macintosh computers and "Unicode" can be used to refer to the +# Unicode standard. +# +# Apple Computer, Inc. ("Apple") makes no warranty or representation, +# either express or implied, with respect to this document and the +# included data, its quality, accuracy, or fitness for a particular +# purpose. In no event will Apple be liable for direct, indirect, +# special, incidental, or consequential damages resulting from any +# defect or inaccuracy in this document or the included data. +# +# These mapping tables and character lists are subject to change. +# The latest tables should be available from the following: +# +# +# +# For general information about Mac OS encodings and these mapping +# tables, see the file "README.TXT". +# +# Format: +# ------- +# +# Three tab-separated columns; +# '#' begins a comment which continues to the end of the line. +# Column #1 is the Mac OS Roman code (in hex as 0xNN) +# Column #2 is the corresponding Unicode (in hex as 0xNNNN) +# Column #3 is a comment containing the Unicode name +# +# The entries are in Mac OS Roman code order. +# +# One of these mappings requires the use of a corporate character. +# See the file "CORPCHAR.TXT" and notes below. +# +# Control character mappings are not shown in this table, following +# the conventions of the standard UTC mapping tables. However, the +# Mac OS Roman character set uses the standard control characters at +# 0x00-0x1F and 0x7F. +# +# Notes on Mac OS Roman: +# ---------------------- +# +# This is a legacy Mac OS encoding; in the Mac OS X Carbon and Cocoa +# environments, it is only supported directly in programming +# interfaces for QuickDraw Text, the Script Manager, and related +# Text Utilities. For other purposes it is supported via transcoding +# to and from Unicode. +# +# This character set is used for at least the following Mac OS +# localizations: U.S., British, Canadian French, French, Swiss +# French, German, Swiss German, Italian, Swiss Italian, Dutch, +# Swedish, Norwegian, Danish, Finnish, Spanish, Catalan, +# Portuguese, Brazilian, and the default International system. +# +# Variants of Mac OS Roman are used for Croatian, Icelandic, +# Turkish, Romanian, and other encodings. Separate mapping tables +# are available for these encodings. +# +# Before Mac OS 8.5, code point 0xDB was CURRENCY SIGN, and was +# mapped to U+00A4. In Mac OS 8.5 and later versions, code point +# 0xDB is changed to EURO SIGN and maps to U+20AC; the standard +# Apple fonts are updated for Mac OS 8.5 to reflect this. There is +# a "currency sign" variant of the Mac OS Roman encoding that still +# maps 0xDB to U+00A4; this can be used for older fonts. +# +# Before Mac OS 8.5, the ROM bitmap versions of the fonts Chicago, +# New York, Geneva, and Monaco did not implement the full Mac OS +# Roman character set; they only supported character codes up to +# 0xD8. The TrueType versions of these fonts have always implemented +# the full character set, as with the bitmap and TrueType versions +# of the other standard Roman fonts. +# +# In all Mac OS encodings, fonts such as Chicago which are used +# as "system" fonts (for menus, dialogs, etc.) have four glyphs +# at code points 0x11-0x14 for transient use by the Menu Manager. +# These glyphs are not intended as characters for use in normal +# text, and the associated code points are not generally +# interpreted as associated with these glyphs; they are usually +# interpreted (if at all) as the control codes DC1-DC4. +# +# Unicode mapping issues and notes: +# --------------------------------- +# +# The following corporate zone Unicode character is used in this +# mapping: +# +# 0xF8FF Apple logo +# +# NOTE: The graphic image associated with the Apple logo character +# is not authorized for use without permission of Apple, and +# unauthorized use might constitute trademark infringement. +# +# Details of mapping changes in each version: +# ------------------------------------------- +# +# Changes from version n08 to version b02: +# +# - Encoding changed for Mac OS 8.5; change mapping of 0xDB from +# CURRENCY SIGN (U+00A4) to EURO SIGN (U+20AC). +# +# Changes from version n03 to version n04: +# +# - Change mapping of 0xBD from U+2126 to its canonical +# decomposition, U+03A9. +# +################## + +0x20 0x0020 # SPACE +0x21 0x0021 # EXCLAMATION MARK +0x22 0x0022 # QUOTATION MARK +0x23 0x0023 # NUMBER SIGN +0x24 0x0024 # DOLLAR SIGN +0x25 0x0025 # PERCENT SIGN +0x26 0x0026 # AMPERSAND +0x27 0x0027 # APOSTROPHE +0x28 0x0028 # LEFT PARENTHESIS +0x29 0x0029 # RIGHT PARENTHESIS +0x2A 0x002A # ASTERISK +0x2B 0x002B # PLUS SIGN +0x2C 0x002C # COMMA +0x2D 0x002D # HYPHEN-MINUS +0x2E 0x002E # FULL STOP +0x2F 0x002F # SOLIDUS +0x30 0x0030 # DIGIT ZERO +0x31 0x0031 # DIGIT ONE +0x32 0x0032 # DIGIT TWO +0x33 0x0033 # DIGIT THREE +0x34 0x0034 # DIGIT FOUR +0x35 0x0035 # DIGIT FIVE +0x36 0x0036 # DIGIT SIX +0x37 0x0037 # DIGIT SEVEN +0x38 0x0038 # DIGIT EIGHT +0x39 0x0039 # DIGIT NINE +0x3A 0x003A # COLON +0x3B 0x003B # SEMICOLON +0x3C 0x003C # LESS-THAN SIGN +0x3D 0x003D # EQUALS SIGN +0x3E 0x003E # GREATER-THAN SIGN +0x3F 0x003F # QUESTION MARK +0x40 0x0040 # COMMERCIAL AT +0x41 0x0041 # LATIN CAPITAL LETTER A +0x42 0x0042 # LATIN CAPITAL LETTER B +0x43 0x0043 # LATIN CAPITAL LETTER C +0x44 0x0044 # LATIN CAPITAL LETTER D +0x45 0x0045 # LATIN CAPITAL LETTER E +0x46 0x0046 # LATIN CAPITAL LETTER F +0x47 0x0047 # LATIN CAPITAL LETTER G +0x48 0x0048 # LATIN CAPITAL LETTER H +0x49 0x0049 # LATIN CAPITAL LETTER I +0x4A 0x004A # LATIN CAPITAL LETTER J +0x4B 0x004B # LATIN CAPITAL LETTER K +0x4C 0x004C # LATIN CAPITAL LETTER L +0x4D 0x004D # LATIN CAPITAL LETTER M +0x4E 0x004E # LATIN CAPITAL LETTER N +0x4F 0x004F # LATIN CAPITAL LETTER O +0x50 0x0050 # LATIN CAPITAL LETTER P +0x51 0x0051 # LATIN CAPITAL LETTER Q +0x52 0x0052 # LATIN CAPITAL LETTER R +0x53 0x0053 # LATIN CAPITAL LETTER S +0x54 0x0054 # LATIN CAPITAL LETTER T +0x55 0x0055 # LATIN CAPITAL LETTER U +0x56 0x0056 # LATIN CAPITAL LETTER V +0x57 0x0057 # LATIN CAPITAL LETTER W +0x58 0x0058 # LATIN CAPITAL LETTER X +0x59 0x0059 # LATIN CAPITAL LETTER Y +0x5A 0x005A # LATIN CAPITAL LETTER Z +0x5B 0x005B # LEFT SQUARE BRACKET +0x5C 0x005C # REVERSE SOLIDUS +0x5D 0x005D # RIGHT SQUARE BRACKET +0x5E 0x005E # CIRCUMFLEX ACCENT +0x5F 0x005F # LOW LINE +0x60 0x0060 # GRAVE ACCENT +0x61 0x0061 # LATIN SMALL LETTER A +0x62 0x0062 # LATIN SMALL LETTER B +0x63 0x0063 # LATIN SMALL LETTER C +0x64 0x0064 # LATIN SMALL LETTER D +0x65 0x0065 # LATIN SMALL LETTER E +0x66 0x0066 # LATIN SMALL LETTER F +0x67 0x0067 # LATIN SMALL LETTER G +0x68 0x0068 # LATIN SMALL LETTER H +0x69 0x0069 # LATIN SMALL LETTER I +0x6A 0x006A # LATIN SMALL LETTER J +0x6B 0x006B # LATIN SMALL LETTER K +0x6C 0x006C # LATIN SMALL LETTER L +0x6D 0x006D # LATIN SMALL LETTER M +0x6E 0x006E # LATIN SMALL LETTER N +0x6F 0x006F # LATIN SMALL LETTER O +0x70 0x0070 # LATIN SMALL LETTER P +0x71 0x0071 # LATIN SMALL LETTER Q +0x72 0x0072 # LATIN SMALL LETTER R +0x73 0x0073 # LATIN SMALL LETTER S +0x74 0x0074 # LATIN SMALL LETTER T +0x75 0x0075 # LATIN SMALL LETTER U +0x76 0x0076 # LATIN SMALL LETTER V +0x77 0x0077 # LATIN SMALL LETTER W +0x78 0x0078 # LATIN SMALL LETTER X +0x79 0x0079 # LATIN SMALL LETTER Y +0x7A 0x007A # LATIN SMALL LETTER Z +0x7B 0x007B # LEFT CURLY BRACKET +0x7C 0x007C # VERTICAL LINE +0x7D 0x007D # RIGHT CURLY BRACKET +0x7E 0x007E # TILDE +# +0x80 0x00C4 # LATIN CAPITAL LETTER A WITH DIAERESIS +0x81 0x00C5 # LATIN CAPITAL LETTER A WITH RING ABOVE +0x82 0x00C7 # LATIN CAPITAL LETTER C WITH CEDILLA +0x83 0x00C9 # LATIN CAPITAL LETTER E WITH ACUTE +0x84 0x00D1 # LATIN CAPITAL LETTER N WITH TILDE +0x85 0x00D6 # LATIN CAPITAL LETTER O WITH DIAERESIS +0x86 0x00DC # LATIN CAPITAL LETTER U WITH DIAERESIS +0x87 0x00E1 # LATIN SMALL LETTER A WITH ACUTE +0x88 0x00E0 # LATIN SMALL LETTER A WITH GRAVE +0x89 0x00E2 # LATIN SMALL LETTER A WITH CIRCUMFLEX +0x8A 0x00E4 # LATIN SMALL LETTER A WITH DIAERESIS +0x8B 0x00E3 # LATIN SMALL LETTER A WITH TILDE +0x8C 0x00E5 # LATIN SMALL LETTER A WITH RING ABOVE +0x8D 0x00E7 # LATIN SMALL LETTER C WITH CEDILLA +0x8E 0x00E9 # LATIN SMALL LETTER E WITH ACUTE +0x8F 0x00E8 # LATIN SMALL LETTER E WITH GRAVE +0x90 0x00EA # LATIN SMALL LETTER E WITH CIRCUMFLEX +0x91 0x00EB # LATIN SMALL LETTER E WITH DIAERESIS +0x92 0x00ED # LATIN SMALL LETTER I WITH ACUTE +0x93 0x00EC # LATIN SMALL LETTER I WITH GRAVE +0x94 0x00EE # LATIN SMALL LETTER I WITH CIRCUMFLEX +0x95 0x00EF # LATIN SMALL LETTER I WITH DIAERESIS +0x96 0x00F1 # LATIN SMALL LETTER N WITH TILDE +0x97 0x00F3 # LATIN SMALL LETTER O WITH ACUTE +0x98 0x00F2 # LATIN SMALL LETTER O WITH GRAVE +0x99 0x00F4 # LATIN SMALL LETTER O WITH CIRCUMFLEX +0x9A 0x00F6 # LATIN SMALL LETTER O WITH DIAERESIS +0x9B 0x00F5 # LATIN SMALL LETTER O WITH TILDE +0x9C 0x00FA # LATIN SMALL LETTER U WITH ACUTE +0x9D 0x00F9 # LATIN SMALL LETTER U WITH GRAVE +0x9E 0x00FB # LATIN SMALL LETTER U WITH CIRCUMFLEX +0x9F 0x00FC # LATIN SMALL LETTER U WITH DIAERESIS +0xA0 0x2020 # DAGGER +0xA1 0x00B0 # DEGREE SIGN +0xA2 0x00A2 # CENT SIGN +0xA3 0x00A3 # POUND SIGN +0xA4 0x00A7 # SECTION SIGN +0xA5 0x2022 # BULLET +0xA6 0x00B6 # PILCROW SIGN +0xA7 0x00DF # LATIN SMALL LETTER SHARP S +0xA8 0x00AE # REGISTERED SIGN +0xA9 0x00A9 # COPYRIGHT SIGN +0xAA 0x2122 # TRADE MARK SIGN +0xAB 0x00B4 # ACUTE ACCENT +0xAC 0x00A8 # DIAERESIS +0xAD 0x2260 # NOT EQUAL TO +0xAE 0x00C6 # LATIN CAPITAL LETTER AE +0xAF 0x00D8 # LATIN CAPITAL LETTER O WITH STROKE +0xB0 0x221E # INFINITY +0xB1 0x00B1 # PLUS-MINUS SIGN +0xB2 0x2264 # LESS-THAN OR EQUAL TO +0xB3 0x2265 # GREATER-THAN OR EQUAL TO +0xB4 0x00A5 # YEN SIGN +0xB5 0x00B5 # MICRO SIGN +0xB6 0x2202 # PARTIAL DIFFERENTIAL +0xB7 0x2211 # N-ARY SUMMATION +0xB8 0x220F # N-ARY PRODUCT +0xB9 0x03C0 # GREEK SMALL LETTER PI +0xBA 0x222B # INTEGRAL +0xBB 0x00AA # FEMININE ORDINAL INDICATOR +0xBC 0x00BA # MASCULINE ORDINAL INDICATOR +0xBD 0x03A9 # GREEK CAPITAL LETTER OMEGA +0xBE 0x00E6 # LATIN SMALL LETTER AE +0xBF 0x00F8 # LATIN SMALL LETTER O WITH STROKE +0xC0 0x00BF # INVERTED QUESTION MARK +0xC1 0x00A1 # INVERTED EXCLAMATION MARK +0xC2 0x00AC # NOT SIGN +0xC3 0x221A # SQUARE ROOT +0xC4 0x0192 # LATIN SMALL LETTER F WITH HOOK +0xC5 0x2248 # ALMOST EQUAL TO +0xC6 0x2206 # INCREMENT +0xC7 0x00AB # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +0xC8 0x00BB # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK +0xC9 0x2026 # HORIZONTAL ELLIPSIS +0xCA 0x00A0 # NO-BREAK SPACE +0xCB 0x00C0 # LATIN CAPITAL LETTER A WITH GRAVE +0xCC 0x00C3 # LATIN CAPITAL LETTER A WITH TILDE +0xCD 0x00D5 # LATIN CAPITAL LETTER O WITH TILDE +0xCE 0x0152 # LATIN CAPITAL LIGATURE OE +0xCF 0x0153 # LATIN SMALL LIGATURE OE +0xD0 0x2013 # EN DASH +0xD1 0x2014 # EM DASH +0xD2 0x201C # LEFT DOUBLE QUOTATION MARK +0xD3 0x201D # RIGHT DOUBLE QUOTATION MARK +0xD4 0x2018 # LEFT SINGLE QUOTATION MARK +0xD5 0x2019 # RIGHT SINGLE QUOTATION MARK +0xD6 0x00F7 # DIVISION SIGN +0xD7 0x25CA # LOZENGE +0xD8 0x00FF # LATIN SMALL LETTER Y WITH DIAERESIS +0xD9 0x0178 # LATIN CAPITAL LETTER Y WITH DIAERESIS +0xDA 0x2044 # FRACTION SLASH +0xDB 0x20AC # EURO SIGN +0xDC 0x2039 # SINGLE LEFT-POINTING ANGLE QUOTATION MARK +0xDD 0x203A # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK +0xDE 0xFB01 # LATIN SMALL LIGATURE FI +0xDF 0xFB02 # LATIN SMALL LIGATURE FL +0xE0 0x2021 # DOUBLE DAGGER +0xE1 0x00B7 # MIDDLE DOT +0xE2 0x201A # SINGLE LOW-9 QUOTATION MARK +0xE3 0x201E # DOUBLE LOW-9 QUOTATION MARK +0xE4 0x2030 # PER MILLE SIGN +0xE5 0x00C2 # LATIN CAPITAL LETTER A WITH CIRCUMFLEX +0xE6 0x00CA # LATIN CAPITAL LETTER E WITH CIRCUMFLEX +0xE7 0x00C1 # LATIN CAPITAL LETTER A WITH ACUTE +0xE8 0x00CB # LATIN CAPITAL LETTER E WITH DIAERESIS +0xE9 0x00C8 # LATIN CAPITAL LETTER E WITH GRAVE +0xEA 0x00CD # LATIN CAPITAL LETTER I WITH ACUTE +0xEB 0x00CE # LATIN CAPITAL LETTER I WITH CIRCUMFLEX +0xEC 0x00CF # LATIN CAPITAL LETTER I WITH DIAERESIS +0xED 0x00CC # LATIN CAPITAL LETTER I WITH GRAVE +0xEE 0x00D3 # LATIN CAPITAL LETTER O WITH ACUTE +0xEF 0x00D4 # LATIN CAPITAL LETTER O WITH CIRCUMFLEX +0xF0 0xF8FF # Apple logo +0xF1 0x00D2 # LATIN CAPITAL LETTER O WITH GRAVE +0xF2 0x00DA # LATIN CAPITAL LETTER U WITH ACUTE +0xF3 0x00DB # LATIN CAPITAL LETTER U WITH CIRCUMFLEX +0xF4 0x00D9 # LATIN CAPITAL LETTER U WITH GRAVE +0xF5 0x0131 # LATIN SMALL LETTER DOTLESS I +0xF6 0x02C6 # MODIFIER LETTER CIRCUMFLEX ACCENT +0xF7 0x02DC # SMALL TILDE +0xF8 0x00AF # MACRON +0xF9 0x02D8 # BREVE +0xFA 0x02D9 # DOT ABOVE +0xFB 0x02DA # RING ABOVE +0xFC 0x00B8 # CEDILLA +0xFD 0x02DD # DOUBLE ACUTE ACCENT +0xFE 0x02DB # OGONEK +0xFF 0x02C7 # CARON diff --git a/ext/standard/http.c b/ext/standard/http.c new file mode 100644 index 0000000..3e50735 --- /dev/null +++ b/ext/standard/http.c @@ -0,0 +1,253 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Sara Golemon | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php_http.h" +#include "php_ini.h" +#include "url.h" + +#define URL_DEFAULT_ARG_SEP "&" + +/* {{{ php_url_encode_hash */ +PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, + const char *num_prefix, int num_prefix_len, + const char *key_prefix, int key_prefix_len, + const char *key_suffix, int key_suffix_len, + zval *type, char *arg_sep, int enc_type TSRMLS_DC) +{ + char *key = NULL; + char *ekey, *newprefix, *p; + int arg_sep_len, ekey_len, key_type, newprefix_len; + uint key_len; + ulong idx; + zval **zdata = NULL, *copyzval; + + if (!ht) { + return FAILURE; + } + + if (ht->nApplyCount > 0) { + /* Prevent recursion */ + return SUCCESS; + } + + if (!arg_sep) { + arg_sep = INI_STR("arg_separator.output"); + if (!arg_sep || !strlen(arg_sep)) { + arg_sep = URL_DEFAULT_ARG_SEP; + } + } + arg_sep_len = strlen(arg_sep); + + for (zend_hash_internal_pointer_reset(ht); + (key_type = zend_hash_get_current_key_ex(ht, &key, &key_len, &idx, 0, NULL)) != HASH_KEY_NON_EXISTANT; + zend_hash_move_forward(ht) + ) { + if (key_type == HASH_KEY_IS_STRING && key_len && key[key_len-1] == '\0') { + /* We don't want that trailing NULL */ + key_len -= 1; + } + + /* handling for private & protected object properties */ + if (key && *key == '\0' && type != NULL) { + const char *tmp; + + zend_object *zobj = zend_objects_get_address(type TSRMLS_CC); + if (zend_check_property_access(zobj, key, key_len-1 TSRMLS_CC) != SUCCESS) { + /* private or protected property access outside of the class */ + continue; + } + zend_unmangle_property_name(key, key_len-1, &tmp, (const char**)&key); + key_len = strlen(key); + } + + if (zend_hash_get_current_data_ex(ht, (void **)&zdata, NULL) == FAILURE || !zdata || !(*zdata)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error traversing form data array"); + return FAILURE; + } + if (Z_TYPE_PP(zdata) == IS_ARRAY || Z_TYPE_PP(zdata) == IS_OBJECT) { + if (key_type == HASH_KEY_IS_STRING) { + if (enc_type == PHP_QUERY_RFC3986) { + ekey = php_raw_url_encode(key, key_len, &ekey_len); + } else { + ekey = php_url_encode(key, key_len, &ekey_len); + } + newprefix_len = key_suffix_len + ekey_len + key_prefix_len + 3 /* %5B */; + newprefix = emalloc(newprefix_len + 1); + p = newprefix; + + if (key_prefix) { + memcpy(p, key_prefix, key_prefix_len); + p += key_prefix_len; + } + + memcpy(p, ekey, ekey_len); + p += ekey_len; + efree(ekey); + + if (key_suffix) { + memcpy(p, key_suffix, key_suffix_len); + p += key_suffix_len; + } + *(p++) = '%'; + *(p++) = '5'; + *(p++) = 'B'; + *p = '\0'; + } else { + /* Is an integer key */ + ekey_len = spprintf(&ekey, 0, "%ld", idx); + newprefix_len = key_prefix_len + num_prefix_len + ekey_len + key_suffix_len + 3 /* %5B */; + newprefix = emalloc(newprefix_len + 1); + p = newprefix; + + if (key_prefix) { + memcpy(p, key_prefix, key_prefix_len); + p += key_prefix_len; + } + + memcpy(p, num_prefix, num_prefix_len); + p += num_prefix_len; + + memcpy(p, ekey, ekey_len); + p += ekey_len; + efree(ekey); + + if (key_suffix) { + memcpy(p, key_suffix, key_suffix_len); + p += key_suffix_len; + } + *(p++) = '%'; + *(p++) = '5'; + *(p++) = 'B'; + *p = '\0'; + } + ht->nApplyCount++; + php_url_encode_hash_ex(HASH_OF(*zdata), formstr, NULL, 0, newprefix, newprefix_len, "%5D", 3, (Z_TYPE_PP(zdata) == IS_OBJECT ? *zdata : NULL), arg_sep, enc_type TSRMLS_CC); + ht->nApplyCount--; + efree(newprefix); + } else if (Z_TYPE_PP(zdata) == IS_NULL || Z_TYPE_PP(zdata) == IS_RESOURCE) { + /* Skip these types */ + continue; + } else { + if (formstr->len) { + smart_str_appendl(formstr, arg_sep, arg_sep_len); + } + /* Simple key=value */ + smart_str_appendl(formstr, key_prefix, key_prefix_len); + if (key_type == HASH_KEY_IS_STRING) { + if (enc_type == PHP_QUERY_RFC3986) { + ekey = php_raw_url_encode(key, key_len, &ekey_len); + } else { + ekey = php_url_encode(key, key_len, &ekey_len); + } + smart_str_appendl(formstr, ekey, ekey_len); + efree(ekey); + } else { + /* Numeric key */ + if (num_prefix) { + smart_str_appendl(formstr, num_prefix, num_prefix_len); + } + ekey_len = spprintf(&ekey, 0, "%ld", idx); + smart_str_appendl(formstr, ekey, ekey_len); + efree(ekey); + } + smart_str_appendl(formstr, key_suffix, key_suffix_len); + smart_str_appendl(formstr, "=", 1); + switch (Z_TYPE_PP(zdata)) { + case IS_STRING: + if (enc_type == PHP_QUERY_RFC3986) { + ekey = php_raw_url_encode(Z_STRVAL_PP(zdata), Z_STRLEN_PP(zdata), &ekey_len); + } else { + ekey = php_url_encode(Z_STRVAL_PP(zdata), Z_STRLEN_PP(zdata), &ekey_len); + } + break; + case IS_LONG: + case IS_BOOL: + ekey_len = spprintf(&ekey, 0, "%ld", Z_LVAL_PP(zdata)); + break; + case IS_DOUBLE: + ekey_len = spprintf(&ekey, 0, "%.*G", (int) EG(precision), Z_DVAL_PP(zdata)); + break; + default: + /* fall back on convert to string */ + MAKE_STD_ZVAL(copyzval); + *copyzval = **zdata; + zval_copy_ctor(copyzval); + convert_to_string_ex(©zval); + if (enc_type == PHP_QUERY_RFC3986) { + ekey = php_raw_url_encode(Z_STRVAL_P(copyzval), Z_STRLEN_P(copyzval), &ekey_len); + } else { + ekey = php_url_encode(Z_STRVAL_P(copyzval), Z_STRLEN_P(copyzval), &ekey_len); + } + zval_ptr_dtor(©zval); + } + smart_str_appendl(formstr, ekey, ekey_len); + efree(ekey); + } + } + + return SUCCESS; +} +/* }}} */ + +/* {{{ proto string http_build_query(mixed formdata [, string prefix [, string arg_separator [, int enc_type]]]) + Generates a form-encoded query string from an associative array or object. */ +PHP_FUNCTION(http_build_query) +{ + zval *formdata; + char *prefix = NULL, *arg_sep=NULL; + int arg_sep_len = 0, prefix_len = 0; + smart_str formstr = {0}; + long enc_type = PHP_QUERY_RFC1738; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ssl", &formdata, &prefix, &prefix_len, &arg_sep, &arg_sep_len, &enc_type) != SUCCESS) { + RETURN_FALSE; + } + + if (Z_TYPE_P(formdata) != IS_ARRAY && Z_TYPE_P(formdata) != IS_OBJECT) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter 1 expected to be Array or Object. Incorrect value given"); + RETURN_FALSE; + } + + if (php_url_encode_hash_ex(HASH_OF(formdata), &formstr, prefix, prefix_len, NULL, 0, NULL, 0, (Z_TYPE_P(formdata) == IS_OBJECT ? formdata : NULL), arg_sep, enc_type TSRMLS_CC) == FAILURE) { + if (formstr.c) { + efree(formstr.c); + } + RETURN_FALSE; + } + + if (!formstr.c) { + RETURN_EMPTY_STRING(); + } + + smart_str_0(&formstr); + + RETURN_STRINGL(formstr.c, formstr.len, 0); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ + diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c new file mode 100644 index 0000000..870f904 --- /dev/null +++ b/ext/standard/http_fopen_wrapper.c @@ -0,0 +1,962 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Jim Winstead | + | Hartmut Holzgraefe | + | Wez Furlong | + | Sara Golemon | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#include "php.h" +#include "php_globals.h" +#include "php_streams.h" +#include "php_network.h" +#include "php_ini.h" +#include "ext/standard/basic_functions.h" +#include "ext/standard/php_smart_str.h" + +#include +#include +#include +#include +#include +#include + +#ifdef PHP_WIN32 +#define O_RDONLY _O_RDONLY +#include "win32/param.h" +#else +#include +#endif + +#include "php_standard.h" + +#include +#if HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef PHP_WIN32 +#include +#elif defined(NETWARE) && defined(USE_WINSOCK) +#include +#else +#include +#include +#if HAVE_ARPA_INET_H +#include +#endif +#endif + +#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE) +#undef AF_UNIX +#endif + +#if defined(AF_UNIX) +#include +#endif + +#include "php_fopen_wrappers.h" + +#define HTTP_HEADER_BLOCK_SIZE 1024 +#define PHP_URL_REDIRECT_MAX 20 +#define HTTP_HEADER_USER_AGENT 1 +#define HTTP_HEADER_HOST 2 +#define HTTP_HEADER_AUTH 4 +#define HTTP_HEADER_FROM 8 +#define HTTP_HEADER_CONTENT_LENGTH 16 +#define HTTP_HEADER_TYPE 32 + +#define HTTP_WRAPPER_HEADER_INIT 1 +#define HTTP_WRAPPER_REDIRECTED 2 + +php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context, int redirect_max, int flags STREAMS_DC TSRMLS_DC) /* {{{ */ +{ + php_stream *stream = NULL; + php_url *resource = NULL; + int use_ssl; + int use_proxy = 0; + char *scratch = NULL; + char *tmp = NULL; + char *ua_str = NULL; + zval **ua_zval = NULL, **tmpzval = NULL; + int scratch_len = 0; + int body = 0; + char location[HTTP_HEADER_BLOCK_SIZE]; + zval *response_header = NULL; + int reqok = 0; + char *http_header_line = NULL; + char tmp_line[128]; + size_t chunk_size = 0, file_size = 0; + int eol_detect = 0; + char *transport_string, *errstr = NULL; + int transport_len, have_header = 0, request_fulluri = 0, ignore_errors = 0; + char *protocol_version = NULL; + int protocol_version_len = 3; /* Default: "1.0" */ + struct timeval timeout; + char *user_headers = NULL; + int header_init = ((flags & HTTP_WRAPPER_HEADER_INIT) != 0); + int redirected = ((flags & HTTP_WRAPPER_REDIRECTED) != 0); + int follow_location = 1; + php_stream_filter *transfer_encoding = NULL; + int response_code; + + tmp_line[0] = '\0'; + + if (redirect_max < 1) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Redirection limit reached, aborting"); + return NULL; + } + + resource = php_url_parse(path); + if (resource == NULL) { + return NULL; + } + + if (strncasecmp(resource->scheme, "http", sizeof("http")) && strncasecmp(resource->scheme, "https", sizeof("https"))) { + if (!context || + php_stream_context_get_option(context, wrapper->wops->label, "proxy", &tmpzval) == FAILURE || + Z_TYPE_PP(tmpzval) != IS_STRING || + Z_STRLEN_PP(tmpzval) <= 0) { + php_url_free(resource); + return php_stream_open_wrapper_ex(path, mode, REPORT_ERRORS, NULL, context); + } + /* Called from a non-http wrapper with http proxying requested (i.e. ftp) */ + request_fulluri = 1; + use_ssl = 0; + use_proxy = 1; + + transport_len = Z_STRLEN_PP(tmpzval); + transport_string = estrndup(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval)); + } else { + /* Normal http request (possibly with proxy) */ + + if (strpbrk(mode, "awx+")) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP wrapper does not support writeable connections"); + php_url_free(resource); + return NULL; + } + + use_ssl = resource->scheme && (strlen(resource->scheme) > 4) && resource->scheme[4] == 's'; + /* choose default ports */ + if (use_ssl && resource->port == 0) + resource->port = 443; + else if (resource->port == 0) + resource->port = 80; + + if (context && + php_stream_context_get_option(context, wrapper->wops->label, "proxy", &tmpzval) == SUCCESS && + Z_TYPE_PP(tmpzval) == IS_STRING && + Z_STRLEN_PP(tmpzval) > 0) { + use_proxy = 1; + transport_len = Z_STRLEN_PP(tmpzval); + transport_string = estrndup(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval)); + } else { + transport_len = spprintf(&transport_string, 0, "%s://%s:%d", use_ssl ? "ssl" : "tcp", resource->host, resource->port); + } + } + + if (context && php_stream_context_get_option(context, wrapper->wops->label, "timeout", &tmpzval) == SUCCESS) { + SEPARATE_ZVAL(tmpzval); + convert_to_double_ex(tmpzval); + timeout.tv_sec = (time_t) Z_DVAL_PP(tmpzval); + timeout.tv_usec = (size_t) ((Z_DVAL_PP(tmpzval) - timeout.tv_sec) * 1000000); + } else { + timeout.tv_sec = FG(default_socket_timeout); + timeout.tv_usec = 0; + } + + stream = php_stream_xport_create(transport_string, transport_len, options, + STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, + NULL, &timeout, context, &errstr, NULL); + + if (stream) { + php_stream_set_option(stream, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &timeout); + } + + if (errstr) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", errstr); + efree(errstr); + errstr = NULL; + } + + efree(transport_string); + + if (stream && use_proxy && use_ssl) { + smart_str header = {0}; + + smart_str_appendl(&header, "CONNECT ", sizeof("CONNECT ")-1); + smart_str_appends(&header, resource->host); + smart_str_appendc(&header, ':'); + smart_str_append_unsigned(&header, resource->port); + smart_str_appendl(&header, " HTTP/1.0\r\n", sizeof(" HTTP/1.0\r\n")-1); + + /* check if we have Proxy-Authorization header */ + if (context && php_stream_context_get_option(context, "http", "header", &tmpzval) == SUCCESS) { + char *s, *p; + + if (Z_TYPE_PP(tmpzval) == IS_ARRAY) { + HashPosition pos; + zval **tmpheader = NULL; + + for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(tmpzval), &pos); + SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(tmpzval), (void *)&tmpheader, &pos); + zend_hash_move_forward_ex(Z_ARRVAL_PP(tmpzval), &pos)) { + if (Z_TYPE_PP(tmpheader) == IS_STRING) { + s = Z_STRVAL_PP(tmpheader); + do { + while (*s == ' ' || *s == '\t') s++; + p = s; + while (*p != 0 && *p != ':' && *p != '\r' && *p !='\n') p++; + if (*p == ':') { + p++; + if (p - s == sizeof("Proxy-Authorization:") - 1 && + zend_binary_strcasecmp(s, sizeof("Proxy-Authorization:") - 1, + "Proxy-Authorization:", sizeof("Proxy-Authorization:") - 1) == 0) { + while (*p != 0 && *p != '\r' && *p !='\n') p++; + smart_str_appendl(&header, s, p - s); + smart_str_appendl(&header, "\r\n", sizeof("\r\n")-1); + goto finish; + } else { + while (*p != 0 && *p != '\r' && *p !='\n') p++; + } + } + s = p; + while (*s == '\r' || *s == '\n') s++; + } while (*s != 0); + } + } + } else if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval)) { + s = Z_STRVAL_PP(tmpzval); + do { + while (*s == ' ' || *s == '\t') s++; + p = s; + while (*p != 0 && *p != ':' && *p != '\r' && *p !='\n') p++; + if (*p == ':') { + p++; + if (p - s == sizeof("Proxy-Authorization:") - 1 && + zend_binary_strcasecmp(s, sizeof("Proxy-Authorization:") - 1, + "Proxy-Authorization:", sizeof("Proxy-Authorization:") - 1) == 0) { + while (*p != 0 && *p != '\r' && *p !='\n') p++; + smart_str_appendl(&header, s, p - s); + smart_str_appendl(&header, "\r\n", sizeof("\r\n")-1); + goto finish; + } else { + while (*p != 0 && *p != '\r' && *p !='\n') p++; + } + } + s = p; + while (*s == '\r' || *s == '\n') s++; + } while (*s != 0); + } + } +finish: + smart_str_appendl(&header, "\r\n", sizeof("\r\n")-1); + + if (php_stream_write(stream, header.c, header.len) != header.len) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Cannot connect to HTTPS server through proxy"); + php_stream_close(stream); + stream = NULL; + } + smart_str_free(&header); + + if (stream) { + char header_line[HTTP_HEADER_BLOCK_SIZE]; + + /* get response header */ + while (php_stream_gets(stream, header_line, HTTP_HEADER_BLOCK_SIZE-1) != NULL) { + if (header_line[0] == '\n' || + header_line[0] == '\r' || + header_line[0] == '\0') { + break; + } + } + } + + /* enable SSL transport layer */ + if (stream) { + if (php_stream_xport_crypto_setup(stream, STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 || + php_stream_xport_crypto_enable(stream, 1 TSRMLS_CC) < 0) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Cannot connect to HTTPS server through proxy"); + php_stream_close(stream); + stream = NULL; + } + } + } + + if (stream == NULL) + goto out; + + /* avoid buffering issues while reading header */ + if (options & STREAM_WILL_CAST) + chunk_size = php_stream_set_chunk_size(stream, 1); + + /* avoid problems with auto-detecting when reading the headers -> the headers + * are always in canonical \r\n format */ + eol_detect = stream->flags & (PHP_STREAM_FLAG_DETECT_EOL | PHP_STREAM_FLAG_EOL_MAC); + stream->flags &= ~(PHP_STREAM_FLAG_DETECT_EOL | PHP_STREAM_FLAG_EOL_MAC); + + php_stream_context_set(stream, context); + + php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0); + + if (header_init && context && php_stream_context_get_option(context, "http", "max_redirects", &tmpzval) == SUCCESS) { + SEPARATE_ZVAL(tmpzval); + convert_to_long_ex(tmpzval); + redirect_max = Z_LVAL_PP(tmpzval); + } + + if (context && php_stream_context_get_option(context, "http", "method", &tmpzval) == SUCCESS) { + if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 0) { + /* As per the RFC, automatically redirected requests MUST NOT use other methods than + * GET and HEAD unless it can be confirmed by the user */ + if (!redirected + || (Z_STRLEN_PP(tmpzval) == 3 && memcmp("GET", Z_STRVAL_PP(tmpzval), 3) == 0) + || (Z_STRLEN_PP(tmpzval) == 4 && memcmp("HEAD",Z_STRVAL_PP(tmpzval), 4) == 0) + ) { + scratch_len = strlen(path) + 29 + Z_STRLEN_PP(tmpzval); + scratch = emalloc(scratch_len); + strlcpy(scratch, Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval) + 1); + strncat(scratch, " ", 1); + } + } + } + + if (context && php_stream_context_get_option(context, "http", "protocol_version", &tmpzval) == SUCCESS) { + SEPARATE_ZVAL(tmpzval); + convert_to_double_ex(tmpzval); + protocol_version_len = spprintf(&protocol_version, 0, "%.1F", Z_DVAL_PP(tmpzval)); + } + + if (!scratch) { + scratch_len = strlen(path) + 29 + protocol_version_len; + scratch = emalloc(scratch_len); + strncpy(scratch, "GET ", scratch_len); + } + + /* Should we send the entire path in the request line, default to no. */ + if (!request_fulluri && + context && + php_stream_context_get_option(context, "http", "request_fulluri", &tmpzval) == SUCCESS) { + zval ztmp = **tmpzval; + + zval_copy_ctor(&ztmp); + convert_to_boolean(&ztmp); + request_fulluri = Z_BVAL(ztmp) ? 1 : 0; + zval_dtor(&ztmp); + } + + if (request_fulluri) { + /* Ask for everything */ + strcat(scratch, path); + } else { + /* Send the traditional /path/to/file?query_string */ + + /* file */ + if (resource->path && *resource->path) { + strlcat(scratch, resource->path, scratch_len); + } else { + strlcat(scratch, "/", scratch_len); + } + + /* query string */ + if (resource->query) { + strlcat(scratch, "?", scratch_len); + strlcat(scratch, resource->query, scratch_len); + } + } + + /* protocol version we are speaking */ + if (protocol_version) { + strlcat(scratch, " HTTP/", scratch_len); + strlcat(scratch, protocol_version, scratch_len); + strlcat(scratch, "\r\n", scratch_len); + efree(protocol_version); + protocol_version = NULL; + } else { + strlcat(scratch, " HTTP/1.0\r\n", scratch_len); + } + + /* send it */ + php_stream_write(stream, scratch, strlen(scratch)); + + if (context && php_stream_context_get_option(context, "http", "header", &tmpzval) == SUCCESS) { + tmp = NULL; + + if (Z_TYPE_PP(tmpzval) == IS_ARRAY) { + HashPosition pos; + zval **tmpheader = NULL; + smart_str tmpstr = {0}; + + for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(tmpzval), &pos); + SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(tmpzval), (void *)&tmpheader, &pos); + zend_hash_move_forward_ex(Z_ARRVAL_PP(tmpzval), &pos) + ) { + if (Z_TYPE_PP(tmpheader) == IS_STRING) { + smart_str_appendl(&tmpstr, Z_STRVAL_PP(tmpheader), Z_STRLEN_PP(tmpheader)); + smart_str_appendl(&tmpstr, "\r\n", sizeof("\r\n") - 1); + } + } + smart_str_0(&tmpstr); + /* Remove newlines and spaces from start and end. there's at least one extra \r\n at the end that needs to go. */ + if (tmpstr.c) { + tmp = php_trim(tmpstr.c, strlen(tmpstr.c), NULL, 0, NULL, 3 TSRMLS_CC); + smart_str_free(&tmpstr); + } + } + if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval)) { + /* Remove newlines and spaces from start and end php_trim will estrndup() */ + tmp = php_trim(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC); + } + if (tmp && strlen(tmp) > 0) { + char *s; + + if (!header_init) { /* Remove post headers for redirects */ + int l = strlen(tmp); + char *s2, *tmp_c = estrdup(tmp); + + php_strtolower(tmp_c, l); + if ((s = strstr(tmp_c, "content-length:"))) { + if ((s2 = memchr(s, '\n', tmp_c + l - s))) { + int b = tmp_c + l - 1 - s2; + memmove(tmp, tmp + (s2 + 1 - tmp_c), b); + memmove(tmp_c, s2 + 1, b); + + } else { + tmp[s - tmp_c] = *s = '\0'; + } + l = strlen(tmp_c); + } + if ((s = strstr(tmp_c, "content-type:"))) { + if ((s2 = memchr(s, '\n', tmp_c + l - s))) { + memmove(tmp, tmp + (s2 + 1 - tmp_c), tmp_c + l - 1 - s2); + } else { + tmp[s - tmp_c] = '\0'; + } + } + + efree(tmp_c); + tmp_c = php_trim(tmp, strlen(tmp), NULL, 0, NULL, 3 TSRMLS_CC); + efree(tmp); + tmp = tmp_c; + } + + user_headers = estrdup(tmp); + + /* Make lowercase for easy comparison against 'standard' headers */ + php_strtolower(tmp, strlen(tmp)); + if ((s = strstr(tmp, "user-agent:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { + have_header |= HTTP_HEADER_USER_AGENT; + } + if ((s = strstr(tmp, "host:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { + have_header |= HTTP_HEADER_HOST; + } + if ((s = strstr(tmp, "from:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { + have_header |= HTTP_HEADER_FROM; + } + if ((s = strstr(tmp, "authorization:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { + have_header |= HTTP_HEADER_AUTH; + } + if ((s = strstr(tmp, "content-length:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { + have_header |= HTTP_HEADER_CONTENT_LENGTH; + } + if ((s = strstr(tmp, "content-type:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { + have_header |= HTTP_HEADER_TYPE; + } + /* remove Proxy-Authorization header */ + if (use_proxy && use_ssl && (s = strstr(tmp, "proxy-authorization:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { + char *p = s + sizeof("proxy-authorization:") - 1; + + while (s > tmp && (*(s-1) == ' ' || *(s-1) == '\t')) s--; + while (*p != 0 && *p != '\r' && *p != '\n') p++; + while (*p == '\r' || *p == '\n') p++; + if (*p == 0) { + if (s == tmp) { + efree(user_headers); + user_headers = NULL; + } else { + while (s > tmp && (*(s-1) == '\r' || *(s-1) == '\n')) s--; + user_headers[s - tmp] = 0; + } + } else { + memmove(user_headers + (s - tmp), user_headers + (p - tmp), strlen(p) + 1); + } + } + + } + if (tmp) { + efree(tmp); + } + } + + /* auth header if it was specified */ + if (((have_header & HTTP_HEADER_AUTH) == 0) && resource->user) { + /* decode the strings first */ + php_url_decode(resource->user, strlen(resource->user)); + + /* scratch is large enough, since it was made large enough for the whole URL */ + strcpy(scratch, resource->user); + strcat(scratch, ":"); + + /* Note: password is optional! */ + if (resource->pass) { + php_url_decode(resource->pass, strlen(resource->pass)); + strcat(scratch, resource->pass); + } + + tmp = (char*)php_base64_encode((unsigned char*)scratch, strlen(scratch), NULL); + + if (snprintf(scratch, scratch_len, "Authorization: Basic %s\r\n", tmp) > 0) { + php_stream_write(stream, scratch, strlen(scratch)); + php_stream_notify_info(context, PHP_STREAM_NOTIFY_AUTH_REQUIRED, NULL, 0); + } + + efree(tmp); + tmp = NULL; + } + + /* if the user has configured who they are, send a From: line */ + if (((have_header & HTTP_HEADER_FROM) == 0) && FG(from_address)) { + if (snprintf(scratch, scratch_len, "From: %s\r\n", FG(from_address)) > 0) + php_stream_write(stream, scratch, strlen(scratch)); + } + + /* Send Host: header so name-based virtual hosts work */ + if ((have_header & HTTP_HEADER_HOST) == 0) { + if ((use_ssl && resource->port != 443 && resource->port != 0) || + (!use_ssl && resource->port != 80 && resource->port != 0)) { + if (snprintf(scratch, scratch_len, "Host: %s:%i\r\n", resource->host, resource->port) > 0) + php_stream_write(stream, scratch, strlen(scratch)); + } else { + if (snprintf(scratch, scratch_len, "Host: %s\r\n", resource->host) > 0) { + php_stream_write(stream, scratch, strlen(scratch)); + } + } + } + + if (context && + php_stream_context_get_option(context, "http", "user_agent", &ua_zval) == SUCCESS && + Z_TYPE_PP(ua_zval) == IS_STRING) { + ua_str = Z_STRVAL_PP(ua_zval); + } else if (FG(user_agent)) { + ua_str = FG(user_agent); + } + + if (((have_header & HTTP_HEADER_USER_AGENT) == 0) && ua_str) { +#define _UA_HEADER "User-Agent: %s\r\n" + char *ua; + size_t ua_len; + + ua_len = sizeof(_UA_HEADER) + strlen(ua_str); + + /* ensure the header is only sent if user_agent is not blank */ + if (ua_len > sizeof(_UA_HEADER)) { + ua = emalloc(ua_len + 1); + if ((ua_len = slprintf(ua, ua_len, _UA_HEADER, ua_str)) > 0) { + ua[ua_len] = 0; + php_stream_write(stream, ua, ua_len); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot construct User-agent header"); + } + + if (ua) { + efree(ua); + } + } + } + + if (user_headers) { + /* A bit weird, but some servers require that Content-Length be sent prior to Content-Type for POST + * see bug #44603 for details. Since Content-Type maybe part of user's headers we need to do this check first. + */ + if ( + header_init && + context && + !(have_header & HTTP_HEADER_CONTENT_LENGTH) && + php_stream_context_get_option(context, "http", "content", &tmpzval) == SUCCESS && + Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 0 + ) { + scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_PP(tmpzval)); + php_stream_write(stream, scratch, scratch_len); + have_header |= HTTP_HEADER_CONTENT_LENGTH; + } + + php_stream_write(stream, user_headers, strlen(user_headers)); + php_stream_write(stream, "\r\n", sizeof("\r\n")-1); + efree(user_headers); + } + + /* Request content, such as for POST requests */ + if (header_init && context && + php_stream_context_get_option(context, "http", "content", &tmpzval) == SUCCESS && + Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 0) { + if (!(have_header & HTTP_HEADER_CONTENT_LENGTH)) { + scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_PP(tmpzval)); + php_stream_write(stream, scratch, scratch_len); + } + if (!(have_header & HTTP_HEADER_TYPE)) { + php_stream_write(stream, "Content-Type: application/x-www-form-urlencoded\r\n", + sizeof("Content-Type: application/x-www-form-urlencoded\r\n") - 1); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Content-type not specified assuming application/x-www-form-urlencoded"); + } + php_stream_write(stream, "\r\n", sizeof("\r\n")-1); + php_stream_write(stream, Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval)); + } else { + php_stream_write(stream, "\r\n", sizeof("\r\n")-1); + } + + location[0] = '\0'; + + if (!EG(active_symbol_table)) { + zend_rebuild_symbol_table(TSRMLS_C); + } + + if (header_init) { + zval *ztmp; + MAKE_STD_ZVAL(ztmp); + array_init(ztmp); + ZEND_SET_SYMBOL(EG(active_symbol_table), "http_response_header", ztmp); + } + + { + zval **rh; + zend_hash_find(EG(active_symbol_table), "http_response_header", sizeof("http_response_header"), (void **) &rh); + response_header = *rh; + } + + if (!php_stream_eof(stream)) { + size_t tmp_line_len; + /* get response header */ + + if (php_stream_get_line(stream, tmp_line, sizeof(tmp_line) - 1, &tmp_line_len) != NULL) { + zval *http_response; + + if (tmp_line_len > 9) { + response_code = atoi(tmp_line + 9); + } else { + response_code = 0; + } + if (context && SUCCESS==php_stream_context_get_option(context, "http", "ignore_errors", &tmpzval)) { + ignore_errors = zend_is_true(*tmpzval); + } + /* when we request only the header, don't fail even on error codes */ + if ((options & STREAM_ONLY_GET_HEADERS) || ignore_errors) { + reqok = 1; + } + /* all status codes in the 2xx range are defined by the specification as successful; + * all status codes in the 3xx range are for redirection, and so also should never + * fail */ + if (response_code >= 200 && response_code < 400) { + reqok = 1; + } else { + switch(response_code) { + case 403: + php_stream_notify_error(context, PHP_STREAM_NOTIFY_AUTH_RESULT, + tmp_line, response_code); + break; + default: + /* safety net in the event tmp_line == NULL */ + if (!tmp_line_len) { + tmp_line[0] = '\0'; + } + php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE, + tmp_line, response_code); + } + } + if (tmp_line[tmp_line_len - 1] == '\n') { + --tmp_line_len; + if (tmp_line[tmp_line_len - 1] == '\r') { + --tmp_line_len; + } + } + MAKE_STD_ZVAL(http_response); + ZVAL_STRINGL(http_response, tmp_line, tmp_line_len, 1); + zend_hash_next_index_insert(Z_ARRVAL_P(response_header), &http_response, sizeof(zval *), NULL); + } + } else { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP request failed, unexpected end of socket!"); + goto out; + } + + /* read past HTTP headers */ + + http_header_line = emalloc(HTTP_HEADER_BLOCK_SIZE); + + while (!body && !php_stream_eof(stream)) { + size_t http_header_line_length; + if (php_stream_get_line(stream, http_header_line, HTTP_HEADER_BLOCK_SIZE, &http_header_line_length) && *http_header_line != '\n' && *http_header_line != '\r') { + char *e = http_header_line + http_header_line_length - 1; + if (*e != '\n') { + do { /* partial header */ + if (php_stream_get_line(stream, http_header_line, HTTP_HEADER_BLOCK_SIZE, &http_header_line_length) == NULL) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Failed to read HTTP headers"); + goto out; + } + e = http_header_line + http_header_line_length - 1; + } while (*e != '\n'); + continue; + } + while (*e == '\n' || *e == '\r') { + e--; + } + http_header_line_length = e - http_header_line + 1; + http_header_line[http_header_line_length] = '\0'; + + if (!strncasecmp(http_header_line, "Location: ", 10)) { + /* we only care about Location for 300, 301, 302, 303 and 307 */ + /* see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.1 */ + if ((response_code >= 300 && response_code < 304 || 307 == response_code) && context && php_stream_context_get_option(context, "http", "follow_location", &tmpzval) == SUCCESS) { + SEPARATE_ZVAL(tmpzval); + convert_to_long_ex(tmpzval); + follow_location = Z_LVAL_PP(tmpzval); + } + strlcpy(location, http_header_line + 10, sizeof(location)); + } else if (!strncasecmp(http_header_line, "Content-Type: ", 14)) { + php_stream_notify_info(context, PHP_STREAM_NOTIFY_MIME_TYPE_IS, http_header_line + 14, 0); + } else if (!strncasecmp(http_header_line, "Content-Length: ", 16)) { + file_size = atoi(http_header_line + 16); + php_stream_notify_file_size(context, file_size, http_header_line, 0); + } else if (!strncasecmp(http_header_line, "Transfer-Encoding: chunked", sizeof("Transfer-Encoding: chunked"))) { + + /* create filter to decode response body */ + if (!(options & STREAM_ONLY_GET_HEADERS)) { + long decode = 1; + + if (context && php_stream_context_get_option(context, "http", "auto_decode", &tmpzval) == SUCCESS) { + SEPARATE_ZVAL(tmpzval); + convert_to_boolean(*tmpzval); + decode = Z_LVAL_PP(tmpzval); + } + if (decode) { + transfer_encoding = php_stream_filter_create("dechunk", NULL, php_stream_is_persistent(stream) TSRMLS_CC); + if (transfer_encoding) { + /* don't store transfer-encodeing header */ + continue; + } + } + } + } + + if (http_header_line[0] == '\0') { + body = 1; + } else { + zval *http_header; + + MAKE_STD_ZVAL(http_header); + + ZVAL_STRINGL(http_header, http_header_line, http_header_line_length, 1); + + zend_hash_next_index_insert(Z_ARRVAL_P(response_header), &http_header, sizeof(zval *), NULL); + } + } else { + break; + } + } + + if (!reqok || (location[0] != '\0' && follow_location)) { + if (!follow_location || (((options & STREAM_ONLY_GET_HEADERS) || ignore_errors) && redirect_max <= 1)) { + goto out; + } + + if (location[0] != '\0') + php_stream_notify_info(context, PHP_STREAM_NOTIFY_REDIRECTED, location, 0); + + php_stream_close(stream); + stream = NULL; + + if (location[0] != '\0') { + + char new_path[HTTP_HEADER_BLOCK_SIZE]; + char loc_path[HTTP_HEADER_BLOCK_SIZE]; + + *new_path='\0'; + if (strlen(location)<8 || (strncasecmp(location, "http://", sizeof("http://")-1) && + strncasecmp(location, "https://", sizeof("https://")-1) && + strncasecmp(location, "ftp://", sizeof("ftp://")-1) && + strncasecmp(location, "ftps://", sizeof("ftps://")-1))) + { + if (*location != '/') { + if (*(location+1) != '\0' && resource->path) { + char *s = strrchr(resource->path, '/'); + if (!s) { + s = resource->path; + if (!s[0]) { + efree(s); + s = resource->path = estrdup("/"); + } else { + *s = '/'; + } + } + s[1] = '\0'; + if (resource->path && *(resource->path) == '/' && *(resource->path + 1) == '\0') { + snprintf(loc_path, sizeof(loc_path) - 1, "%s%s", resource->path, location); + } else { + snprintf(loc_path, sizeof(loc_path) - 1, "%s/%s", resource->path, location); + } + } else { + snprintf(loc_path, sizeof(loc_path) - 1, "/%s", location); + } + } else { + strlcpy(loc_path, location, sizeof(loc_path)); + } + if ((use_ssl && resource->port != 443) || (!use_ssl && resource->port != 80)) { + snprintf(new_path, sizeof(new_path) - 1, "%s://%s:%d%s", resource->scheme, resource->host, resource->port, loc_path); + } else { + snprintf(new_path, sizeof(new_path) - 1, "%s://%s%s", resource->scheme, resource->host, loc_path); + } + } else { + strlcpy(new_path, location, sizeof(new_path)); + } + + php_url_free(resource); + /* check for invalid redirection URLs */ + if ((resource = php_url_parse(new_path)) == NULL) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Invalid redirect URL! %s", new_path); + goto out; + } + +#define CHECK_FOR_CNTRL_CHARS(val) { \ + if (val) { \ + unsigned char *s, *e; \ + int l; \ + l = php_url_decode(val, strlen(val)); \ + s = (unsigned char*)val; e = s + l; \ + while (s < e) { \ + if (iscntrl(*s)) { \ + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Invalid redirect URL! %s", new_path); \ + goto out; \ + } \ + s++; \ + } \ + } \ +} + /* check for control characters in login, password & path */ + if (strncasecmp(new_path, "http://", sizeof("http://") - 1) || strncasecmp(new_path, "https://", sizeof("https://") - 1)) { + CHECK_FOR_CNTRL_CHARS(resource->user) + CHECK_FOR_CNTRL_CHARS(resource->pass) + CHECK_FOR_CNTRL_CHARS(resource->path) + } + stream = php_stream_url_wrap_http_ex(wrapper, new_path, mode, options, opened_path, context, --redirect_max, HTTP_WRAPPER_REDIRECTED STREAMS_CC TSRMLS_CC); + } else { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP request failed! %s", tmp_line); + } + } +out: + if (protocol_version) { + efree(protocol_version); + } + + if (http_header_line) { + efree(http_header_line); + } + + if (scratch) { + efree(scratch); + } + + if (resource) { + php_url_free(resource); + } + + if (stream) { + if (header_init) { + zval_add_ref(&response_header); + stream->wrapperdata = response_header; + } + php_stream_notify_progress_init(context, 0, file_size); + + /* Restore original chunk size now that we're done with headers */ + if (options & STREAM_WILL_CAST) + php_stream_set_chunk_size(stream, chunk_size); + + /* restore the users auto-detect-line-endings setting */ + stream->flags |= eol_detect; + + /* as far as streams are concerned, we are now at the start of + * the stream */ + stream->position = 0; + + /* restore mode */ + strlcpy(stream->mode, mode, sizeof(stream->mode)); + + if (transfer_encoding) { + php_stream_filter_append(&stream->readfilters, transfer_encoding); + } + } else if (transfer_encoding) { + php_stream_filter_free(transfer_encoding TSRMLS_CC); + } + + return stream; +} +/* }}} */ + +php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ +{ + return php_stream_url_wrap_http_ex(wrapper, path, mode, options, opened_path, context, PHP_URL_REDIRECT_MAX, HTTP_WRAPPER_HEADER_INIT STREAMS_CC TSRMLS_CC); +} +/* }}} */ + +static int php_stream_http_stream_stat(php_stream_wrapper *wrapper, php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) /* {{{ */ +{ + /* one day, we could fill in the details based on Date: and Content-Length: + * headers. For now, we return with a failure code to prevent the underlying + * file's details from being used instead. */ + return -1; +} +/* }}} */ + +static php_stream_wrapper_ops http_stream_wops = { + php_stream_url_wrap_http, + NULL, /* stream_close */ + php_stream_http_stream_stat, + NULL, /* stat_url */ + NULL, /* opendir */ + "http", + NULL, /* unlink */ + NULL, /* rename */ + NULL, /* mkdir */ + NULL /* rmdir */ +}; + +PHPAPI php_stream_wrapper php_stream_http_wrapper = { + &http_stream_wops, + NULL, + 1 /* is_url */ +}; + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/image.c b/ext/standard/image.c new file mode 100644 index 0000000..4984e40 --- /dev/null +++ b/ext/standard/image.c @@ -0,0 +1,1441 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Marcus Boerger | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#include "php.h" +#include +#if HAVE_FCNTL_H +#include +#endif +#include "fopen_wrappers.h" +#include "ext/standard/fsock.h" +#if HAVE_UNISTD_H +#include +#endif +#include "php_image.h" + +#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB) +#include "zlib.h" +#endif + +/* file type markers */ +PHPAPI const char php_sig_gif[3] = {'G', 'I', 'F'}; +PHPAPI const char php_sig_psd[4] = {'8', 'B', 'P', 'S'}; +PHPAPI const char php_sig_bmp[2] = {'B', 'M'}; +PHPAPI const char php_sig_swf[3] = {'F', 'W', 'S'}; +PHPAPI const char php_sig_swc[3] = {'C', 'W', 'S'}; +PHPAPI const char php_sig_jpg[3] = {(char) 0xff, (char) 0xd8, (char) 0xff}; +PHPAPI const char php_sig_png[8] = {(char) 0x89, (char) 0x50, (char) 0x4e, (char) 0x47, + (char) 0x0d, (char) 0x0a, (char) 0x1a, (char) 0x0a}; +PHPAPI const char php_sig_tif_ii[4] = {'I','I', (char)0x2A, (char)0x00}; +PHPAPI const char php_sig_tif_mm[4] = {'M','M', (char)0x00, (char)0x2A}; +PHPAPI const char php_sig_jpc[3] = {(char)0xff, (char)0x4f, (char)0xff}; +PHPAPI const char php_sig_jp2[12] = {(char)0x00, (char)0x00, (char)0x00, (char)0x0c, + (char)0x6a, (char)0x50, (char)0x20, (char)0x20, + (char)0x0d, (char)0x0a, (char)0x87, (char)0x0a}; +PHPAPI const char php_sig_iff[4] = {'F','O','R','M'}; +PHPAPI const char php_sig_ico[4] = {(char)0x00, (char)0x00, (char)0x01, (char)0x00}; + +/* REMEMBER TO ADD MIME-TYPE TO FUNCTION php_image_type_to_mime_type */ +/* PCX must check first 64bytes and byte 0=0x0a and byte2 < 0x06 */ + +/* return info as a struct, to make expansion easier */ + +struct gfxinfo { + unsigned int width; + unsigned int height; + unsigned int bits; + unsigned int channels; +}; + +/* {{{ PHP_MINIT_FUNCTION(imagetypes) + * Register IMAGETYPE_ constants used by GetImageSize(), image_type_to_mime_type, ext/exif */ +PHP_MINIT_FUNCTION(imagetypes) +{ + REGISTER_LONG_CONSTANT("IMAGETYPE_GIF", IMAGE_FILETYPE_GIF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG", IMAGE_FILETYPE_JPEG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_PNG", IMAGE_FILETYPE_PNG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_SWF", IMAGE_FILETYPE_SWF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_PSD", IMAGE_FILETYPE_PSD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_BMP", IMAGE_FILETYPE_BMP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_II", IMAGE_FILETYPE_TIFF_II, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_MM", IMAGE_FILETYPE_TIFF_MM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JPC", IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JPX", IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, CONST_CS | CONST_PERSISTENT); +#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB) + REGISTER_LONG_CONSTANT("IMAGETYPE_SWC", IMAGE_FILETYPE_SWC, CONST_CS | CONST_PERSISTENT); +#endif + REGISTER_LONG_CONSTANT("IMAGETYPE_IFF", IMAGE_FILETYPE_IFF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_WBMP", IMAGE_FILETYPE_WBMP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG2000",IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); /* keep alias */ + REGISTER_LONG_CONSTANT("IMAGETYPE_XBM", IMAGE_FILETYPE_XBM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_ICO", IMAGE_FILETYPE_ICO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_UNKNOWN", IMAGE_FILETYPE_UNKNOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_COUNT", IMAGE_FILETYPE_COUNT, CONST_CS | CONST_PERSISTENT); + return SUCCESS; +} +/* }}} */ + +/* {{{ php_handle_gif + * routine to handle GIF files. If only everything were that easy... ;} */ +static struct gfxinfo *php_handle_gif (php_stream * stream TSRMLS_DC) +{ + struct gfxinfo *result = NULL; + unsigned char dim[5]; + + if (php_stream_seek(stream, 3, SEEK_CUR)) + return NULL; + + if (php_stream_read(stream, dim, sizeof(dim)) != sizeof(dim)) + return NULL; + + result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo)); + result->width = (unsigned int)dim[0] | (((unsigned int)dim[1])<<8); + result->height = (unsigned int)dim[2] | (((unsigned int)dim[3])<<8); + result->bits = dim[4]&0x80 ? ((((unsigned int)dim[4])&0x07) + 1) : 0; + result->channels = 3; /* allways */ + + return result; +} +/* }}} */ + +/* {{{ php_handle_psd + */ +static struct gfxinfo *php_handle_psd (php_stream * stream TSRMLS_DC) +{ + struct gfxinfo *result = NULL; + unsigned char dim[8]; + + if (php_stream_seek(stream, 11, SEEK_CUR)) + return NULL; + + if (php_stream_read(stream, dim, sizeof(dim)) != sizeof(dim)) + return NULL; + + result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo)); + result->height = (((unsigned int)dim[0]) << 24) + (((unsigned int)dim[1]) << 16) + (((unsigned int)dim[2]) << 8) + ((unsigned int)dim[3]); + result->width = (((unsigned int)dim[4]) << 24) + (((unsigned int)dim[5]) << 16) + (((unsigned int)dim[6]) << 8) + ((unsigned int)dim[7]); + + return result; +} +/* }}} */ + +/* {{{ php_handle_bmp + */ +static struct gfxinfo *php_handle_bmp (php_stream * stream TSRMLS_DC) +{ + struct gfxinfo *result = NULL; + unsigned char dim[16]; + int size; + + if (php_stream_seek(stream, 11, SEEK_CUR)) + return NULL; + + if (php_stream_read(stream, dim, sizeof(dim)) != sizeof(dim)) + return NULL; + + size = (((unsigned int)dim[ 3]) << 24) + (((unsigned int)dim[ 2]) << 16) + (((unsigned int)dim[ 1]) << 8) + ((unsigned int) dim[ 0]); + if (size == 12) { + result = (struct gfxinfo *) ecalloc (1, sizeof(struct gfxinfo)); + result->width = (((unsigned int)dim[ 5]) << 8) + ((unsigned int) dim[ 4]); + result->height = (((unsigned int)dim[ 7]) << 8) + ((unsigned int) dim[ 6]); + result->bits = ((unsigned int)dim[11]); + } else if (size > 12 && (size <= 64 || size == 108 || size == 124)) { + result = (struct gfxinfo *) ecalloc (1, sizeof(struct gfxinfo)); + result->width = (((unsigned int)dim[ 7]) << 24) + (((unsigned int)dim[ 6]) << 16) + (((unsigned int)dim[ 5]) << 8) + ((unsigned int) dim[ 4]); + result->height = (((unsigned int)dim[11]) << 24) + (((unsigned int)dim[10]) << 16) + (((unsigned int)dim[ 9]) << 8) + ((unsigned int) dim[ 8]); + result->bits = (((unsigned int)dim[15]) << 8) + ((unsigned int)dim[14]); + } else { + return NULL; + } + + return result; +} +/* }}} */ + +/* {{{ php_swf_get_bits + * routines to handle SWF files. */ +static unsigned long int php_swf_get_bits (unsigned char* buffer, unsigned int pos, unsigned int count) +{ + unsigned int loop; + unsigned long int result = 0; + + for (loop = pos; loop < pos + count; loop++) + { + result = result + + ((((buffer[loop / 8]) >> (7 - (loop % 8))) & 0x01) << (count - (loop - pos) - 1)); + } + return result; +} +/* }}} */ + +#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB) +/* {{{ php_handle_swc + */ +static struct gfxinfo *php_handle_swc(php_stream * stream TSRMLS_DC) +{ + struct gfxinfo *result = NULL; + + long bits; + unsigned char a[64]; + unsigned long len=64, szlength; + int factor=1,maxfactor=16; + int slength, status=0; + char *b, *buf=NULL, *bufz=NULL; + + b = ecalloc (1, len + 1); + + if (php_stream_seek(stream, 5, SEEK_CUR)) + return NULL; + + if (php_stream_read(stream, a, sizeof(a)) != sizeof(a)) + return NULL; + + if (uncompress(b, &len, a, sizeof(a)) != Z_OK) { + /* failed to decompress the file, will try reading the rest of the file */ + if (php_stream_seek(stream, 8, SEEK_SET)) + return NULL; + + slength = php_stream_copy_to_mem(stream, &bufz, PHP_STREAM_COPY_ALL, 0); + + /* + * zlib::uncompress() wants to know the output data length + * if none was given as a parameter + * we try from input length * 2 up to input length * 2^8 + * doubling it whenever it wasn't big enough + * that should be eneugh for all real life cases + */ + + do { + szlength=slength*(1<width = (php_swf_get_bits (b, 5 + bits, bits) - + php_swf_get_bits (b, 5, bits)) / 20; + result->height = (php_swf_get_bits (b, 5 + (3 * bits), bits) - + php_swf_get_bits (b, 5 + (2 * bits), bits)) / 20; + } else { + result = NULL; + } + + efree (b); + return result; +} +/* }}} */ +#endif + +/* {{{ php_handle_swf + */ +static struct gfxinfo *php_handle_swf (php_stream * stream TSRMLS_DC) +{ + struct gfxinfo *result = NULL; + long bits; + unsigned char a[32]; + + if (php_stream_seek(stream, 5, SEEK_CUR)) + return NULL; + + if (php_stream_read(stream, a, sizeof(a)) != sizeof(a)) + return NULL; + + result = (struct gfxinfo *) ecalloc (1, sizeof (struct gfxinfo)); + bits = php_swf_get_bits (a, 0, 5); + result->width = (php_swf_get_bits (a, 5 + bits, bits) - + php_swf_get_bits (a, 5, bits)) / 20; + result->height = (php_swf_get_bits (a, 5 + (3 * bits), bits) - + php_swf_get_bits (a, 5 + (2 * bits), bits)) / 20; + result->bits = 0; + result->channels = 0; + return result; +} +/* }}} */ + +/* {{{ php_handle_png + * routine to handle PNG files */ +static struct gfxinfo *php_handle_png (php_stream * stream TSRMLS_DC) +{ + struct gfxinfo *result = NULL; + unsigned char dim[9]; +/* Width: 4 bytes + * Height: 4 bytes + * Bit depth: 1 byte + * Color type: 1 byte + * Compression method: 1 byte + * Filter method: 1 byte + * Interlace method: 1 byte + */ + + if (php_stream_seek(stream, 8, SEEK_CUR)) + return NULL; + + if((php_stream_read(stream, dim, sizeof(dim))) < sizeof(dim)) + return NULL; + + result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo)); + result->width = (((unsigned int)dim[0]) << 24) + (((unsigned int)dim[1]) << 16) + (((unsigned int)dim[2]) << 8) + ((unsigned int)dim[3]); + result->height = (((unsigned int)dim[4]) << 24) + (((unsigned int)dim[5]) << 16) + (((unsigned int)dim[6]) << 8) + ((unsigned int)dim[7]); + result->bits = (unsigned int)dim[8]; + return result; +} +/* }}} */ + +/* routines to handle JPEG data */ + +/* some defines for the different JPEG block types */ +#define M_SOF0 0xC0 /* Start Of Frame N */ +#define M_SOF1 0xC1 /* N indicates which compression process */ +#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ +#define M_SOF3 0xC3 +#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ +#define M_SOF6 0xC6 +#define M_SOF7 0xC7 +#define M_SOF9 0xC9 +#define M_SOF10 0xCA +#define M_SOF11 0xCB +#define M_SOF13 0xCD +#define M_SOF14 0xCE +#define M_SOF15 0xCF +#define M_SOI 0xD8 +#define M_EOI 0xD9 /* End Of Image (end of datastream) */ +#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ +#define M_APP0 0xe0 +#define M_APP1 0xe1 +#define M_APP2 0xe2 +#define M_APP3 0xe3 +#define M_APP4 0xe4 +#define M_APP5 0xe5 +#define M_APP6 0xe6 +#define M_APP7 0xe7 +#define M_APP8 0xe8 +#define M_APP9 0xe9 +#define M_APP10 0xea +#define M_APP11 0xeb +#define M_APP12 0xec +#define M_APP13 0xed +#define M_APP14 0xee +#define M_APP15 0xef +#define M_COM 0xFE /* COMment */ + +#define M_PSEUDO 0xFFD8 /* pseudo marker for start of image(byte 0) */ + +/* {{{ php_read2 + */ +static unsigned short php_read2(php_stream * stream TSRMLS_DC) +{ + unsigned char a[2]; + + /* just return 0 if we hit the end-of-file */ + if((php_stream_read(stream, a, sizeof(a))) <= 0) return 0; + + return (((unsigned short)a[0]) << 8) + ((unsigned short)a[1]); +} +/* }}} */ + +/* {{{ php_next_marker + * get next marker byte from file */ +static unsigned int php_next_marker(php_stream * stream, int last_marker, int comment_correction, int ff_read TSRMLS_DC) +{ + int a=0, marker; + + /* get marker byte, swallowing possible padding */ + if (last_marker==M_COM && comment_correction) { + /* some software does not count the length bytes of COM section */ + /* one company doing so is very much envolved in JPEG... so we accept too */ + /* by the way: some of those companies changed their code now... */ + comment_correction = 2; + } else { + last_marker = 0; + comment_correction = 0; + } + if (ff_read) { + a = 1; /* already read 0xff in filetype detection */ + } + do { + if ((marker = php_stream_getc(stream)) == EOF) + { + return M_EOI;/* we hit EOF */ + } + if (last_marker==M_COM && comment_correction>0) + { + if (marker != 0xFF) + { + marker = 0xff; + comment_correction--; + } else { + last_marker = M_PSEUDO; /* stop skipping non 0xff for M_COM */ + } + } + a++; + } while (marker == 0xff); + if (a < 2) + { + return M_EOI; /* at least one 0xff is needed before marker code */ + } + if ( last_marker==M_COM && comment_correction) + { + return M_EOI; /* ah illegal: char after COM section not 0xFF */ + } + return (unsigned int)marker; +} +/* }}} */ + +/* {{{ php_skip_variable + * skip over a variable-length block; assumes proper length marker */ +static int php_skip_variable(php_stream * stream TSRMLS_DC) +{ + off_t length = ((unsigned int)php_read2(stream TSRMLS_CC)); + + if (length < 2) { + return 0; + } + length = length - 2; + php_stream_seek(stream, (long)length, SEEK_CUR); + return 1; +} +/* }}} */ + +/* {{{ php_read_APP + */ +static int php_read_APP(php_stream * stream, unsigned int marker, zval *info TSRMLS_DC) +{ + unsigned short length; + unsigned char *buffer; + unsigned char markername[16]; + zval *tmp; + + length = php_read2(stream TSRMLS_CC); + if (length < 2) { + return 0; + } + length -= 2; /* length includes itself */ + + buffer = emalloc(length); + + if (php_stream_read(stream, buffer, (long) length) <= 0) { + efree(buffer); + return 0; + } + + snprintf(markername, sizeof(markername), "APP%d", marker - M_APP0); + + if (zend_hash_find(Z_ARRVAL_P(info), markername, strlen(markername)+1, (void **) &tmp) == FAILURE) { + /* XXX we onyl catch the 1st tag of it's kind! */ + add_assoc_stringl(info, markername, buffer, length, 1); + } + + efree(buffer); + return 1; +} +/* }}} */ + +/* {{{ php_handle_jpeg + main loop to parse JPEG structure */ +static struct gfxinfo *php_handle_jpeg (php_stream * stream, zval *info TSRMLS_DC) +{ + struct gfxinfo *result = NULL; + unsigned int marker = M_PSEUDO; + unsigned short length, ff_read=1; + + for (;;) { + marker = php_next_marker(stream, marker, 1, ff_read TSRMLS_CC); + ff_read = 0; + switch (marker) { + case M_SOF0: + case M_SOF1: + case M_SOF2: + case M_SOF3: + case M_SOF5: + case M_SOF6: + case M_SOF7: + case M_SOF9: + case M_SOF10: + case M_SOF11: + case M_SOF13: + case M_SOF14: + case M_SOF15: + if (result == NULL) { + /* handle SOFn block */ + result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo)); + length = php_read2(stream TSRMLS_CC); + result->bits = php_stream_getc(stream); + result->height = php_read2(stream TSRMLS_CC); + result->width = php_read2(stream TSRMLS_CC); + result->channels = php_stream_getc(stream); + if (!info || length < 8) { /* if we don't want an extanded info -> return */ + return result; + } + if (php_stream_seek(stream, length - 8, SEEK_CUR)) { /* file error after info */ + return result; + } + } else { + if (!php_skip_variable(stream TSRMLS_CC)) { + return result; + } + } + break; + + case M_APP0: + case M_APP1: + case M_APP2: + case M_APP3: + case M_APP4: + case M_APP5: + case M_APP6: + case M_APP7: + case M_APP8: + case M_APP9: + case M_APP10: + case M_APP11: + case M_APP12: + case M_APP13: + case M_APP14: + case M_APP15: + if (info) { + if (!php_read_APP(stream, marker, info TSRMLS_CC)) { /* read all the app markes... */ + return result; + } + } else { + if (!php_skip_variable(stream TSRMLS_CC)) { + return result; + } + } + break; + + case M_SOS: + case M_EOI: + return result; /* we're about to hit image data, or are at EOF. stop processing. */ + + default: + if (!php_skip_variable(stream TSRMLS_CC)) { /* anything else isn't interesting */ + return result; + } + break; + } + } + + return result; /* perhaps image broken -> no info but size */ +} +/* }}} */ + +/* {{{ php_read4 + */ +static unsigned int php_read4(php_stream * stream TSRMLS_DC) +{ + unsigned char a[4]; + + /* just return 0 if we hit the end-of-file */ + if ((php_stream_read(stream, a, sizeof(a))) != sizeof(a)) return 0; + + return (((unsigned int)a[0]) << 24) + + (((unsigned int)a[1]) << 16) + + (((unsigned int)a[2]) << 8) + + (((unsigned int)a[3])); +} +/* }}} */ + +/* {{{ JPEG 2000 Marker Codes */ +#define JPEG2000_MARKER_PREFIX 0xFF /* All marker codes start with this */ +#define JPEG2000_MARKER_SOC 0x4F /* Start of Codestream */ +#define JPEG2000_MARKER_SOT 0x90 /* Start of Tile part */ +#define JPEG2000_MARKER_SOD 0x93 /* Start of Data */ +#define JPEG2000_MARKER_EOC 0xD9 /* End of Codestream */ +#define JPEG2000_MARKER_SIZ 0x51 /* Image and tile size */ +#define JPEG2000_MARKER_COD 0x52 /* Coding style default */ +#define JPEG2000_MARKER_COC 0x53 /* Coding style component */ +#define JPEG2000_MARKER_RGN 0x5E /* Region of interest */ +#define JPEG2000_MARKER_QCD 0x5C /* Quantization default */ +#define JPEG2000_MARKER_QCC 0x5D /* Quantization component */ +#define JPEG2000_MARKER_POC 0x5F /* Progression order change */ +#define JPEG2000_MARKER_TLM 0x55 /* Tile-part lengths */ +#define JPEG2000_MARKER_PLM 0x57 /* Packet length, main header */ +#define JPEG2000_MARKER_PLT 0x58 /* Packet length, tile-part header */ +#define JPEG2000_MARKER_PPM 0x60 /* Packed packet headers, main header */ +#define JPEG2000_MARKER_PPT 0x61 /* Packed packet headers, tile part header */ +#define JPEG2000_MARKER_SOP 0x91 /* Start of packet */ +#define JPEG2000_MARKER_EPH 0x92 /* End of packet header */ +#define JPEG2000_MARKER_CRG 0x63 /* Component registration */ +#define JPEG2000_MARKER_COM 0x64 /* Comment */ +/* }}} */ + +/* {{{ php_handle_jpc + Main loop to parse JPEG2000 raw codestream structure */ +static struct gfxinfo *php_handle_jpc(php_stream * stream TSRMLS_DC) +{ + struct gfxinfo *result = NULL; + unsigned short dummy_short; + int highest_bit_depth, bit_depth; + unsigned char first_marker_id; + unsigned int i; + + /* JPEG 2000 components can be vastly different from one another. + Each component can be sampled at a different resolution, use + a different colour space, have a seperate colour depth, and + be compressed totally differently! This makes giving a single + "bit depth" answer somewhat problematic. For this implementation + we'll use the highest depth encountered. */ + + /* Get the single byte that remains after the file type indentification */ + first_marker_id = php_stream_getc(stream); + + /* Ensure that this marker is SIZ (as is mandated by the standard) */ + if (first_marker_id != JPEG2000_MARKER_SIZ) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "JPEG2000 codestream corrupt(Expected SIZ marker not found after SOC)"); + return NULL; + } + + result = (struct gfxinfo *)ecalloc(1, sizeof(struct gfxinfo)); + + dummy_short = php_read2(stream TSRMLS_CC); /* Lsiz */ + dummy_short = php_read2(stream TSRMLS_CC); /* Rsiz */ + result->width = php_read4(stream TSRMLS_CC); /* Xsiz */ + result->height = php_read4(stream TSRMLS_CC); /* Ysiz */ + +#if MBO_0 + php_read4(stream TSRMLS_CC); /* XOsiz */ + php_read4(stream TSRMLS_CC); /* YOsiz */ + php_read4(stream TSRMLS_CC); /* XTsiz */ + php_read4(stream TSRMLS_CC); /* YTsiz */ + php_read4(stream TSRMLS_CC); /* XTOsiz */ + php_read4(stream TSRMLS_CC); /* YTOsiz */ +#else + if (php_stream_seek(stream, 24, SEEK_CUR)) { + efree(result); + return NULL; + } +#endif + + result->channels = php_read2(stream TSRMLS_CC); /* Csiz */ + if (result->channels < 0 || result->channels > 256) { + efree(result); + return NULL; + } + + /* Collect bit depth info */ + highest_bit_depth = 0; + for (i = 0; i < result->channels; i++) { + bit_depth = php_stream_getc(stream); /* Ssiz[i] */ + bit_depth++; + if (bit_depth > highest_bit_depth) { + highest_bit_depth = bit_depth; + } + + php_stream_getc(stream); /* XRsiz[i] */ + php_stream_getc(stream); /* YRsiz[i] */ + } + + result->bits = highest_bit_depth; + + return result; +} +/* }}} */ + +/* {{{ php_handle_jp2 + main loop to parse JPEG 2000 JP2 wrapper format structure */ +static struct gfxinfo *php_handle_jp2(php_stream *stream TSRMLS_DC) +{ + struct gfxinfo *result = NULL; + unsigned int box_length; + unsigned int box_type; + char jp2c_box_id[] = {(char)0x6a, (char)0x70, (char)0x32, (char)0x63}; + + /* JP2 is a wrapper format for JPEG 2000. Data is contained within "boxes". + Boxes themselves can be contained within "super-boxes". Super-Boxes can + contain super-boxes which provides us with a hierarchical storage system. + + It is valid for a JP2 file to contain multiple individual codestreams. + We'll just look for the first codestream at the root of the box structure + and handle that. + */ + + for (;;) + { + box_length = php_read4(stream TSRMLS_CC); /* LBox */ + /* TBox */ + if (php_stream_read(stream, (void *)&box_type, sizeof(box_type)) != sizeof(box_type)) { + /* Use this as a general "out of stream" error */ + break; + } + + if (box_length == 1) { + /* We won't handle XLBoxes */ + return NULL; + } + + if (!memcmp(&box_type, jp2c_box_id, 4)) + { + /* Skip the first 3 bytes to emulate the file type examination */ + php_stream_seek(stream, 3, SEEK_CUR); + + result = php_handle_jpc(stream TSRMLS_CC); + break; + } + + /* Stop if this was the last box */ + if ((int)box_length <= 0) { + break; + } + + /* Skip over LBox (Which includes both TBox and LBox itself */ + if (php_stream_seek(stream, box_length - 8, SEEK_CUR)) { + break; + } + } + + if (result == NULL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "JP2 file has no codestreams at root level"); + } + + return result; +} +/* }}} */ + +/* {{{ tiff constants + */ +PHPAPI const int php_tiff_bytes_per_format[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8}; + +/* uncompressed only */ +#define TAG_IMAGEWIDTH 0x0100 +#define TAG_IMAGEHEIGHT 0x0101 +/* compressed images only */ +#define TAG_COMP_IMAGEWIDTH 0xA002 +#define TAG_COMP_IMAGEHEIGHT 0xA003 + +#define TAG_FMT_BYTE 1 +#define TAG_FMT_STRING 2 +#define TAG_FMT_USHORT 3 +#define TAG_FMT_ULONG 4 +#define TAG_FMT_URATIONAL 5 +#define TAG_FMT_SBYTE 6 +#define TAG_FMT_UNDEFINED 7 +#define TAG_FMT_SSHORT 8 +#define TAG_FMT_SLONG 9 +#define TAG_FMT_SRATIONAL 10 +#define TAG_FMT_SINGLE 11 +#define TAG_FMT_DOUBLE 12 +/* }}} */ + +/* {{{ php_ifd_get16u + * Convert a 16 bit unsigned value from file's native byte order */ +static int php_ifd_get16u(void *Short, int motorola_intel) +{ + if (motorola_intel) { + return (((unsigned char *)Short)[0] << 8) | ((unsigned char *)Short)[1]; + } else { + return (((unsigned char *)Short)[1] << 8) | ((unsigned char *)Short)[0]; + } +} +/* }}} */ + +/* {{{ php_ifd_get16s + * Convert a 16 bit signed value from file's native byte order */ +static signed short php_ifd_get16s(void *Short, int motorola_intel) +{ + return (signed short)php_ifd_get16u(Short, motorola_intel); +} +/* }}} */ + +/* {{{ php_ifd_get32s + * Convert a 32 bit signed value from file's native byte order */ +static int php_ifd_get32s(void *Long, int motorola_intel) +{ + if (motorola_intel) { + return ((( char *)Long)[0] << 24) | (((unsigned char *)Long)[1] << 16) + | (((unsigned char *)Long)[2] << 8 ) | (((unsigned char *)Long)[3] << 0 ); + } else { + return ((( char *)Long)[3] << 24) | (((unsigned char *)Long)[2] << 16) + | (((unsigned char *)Long)[1] << 8 ) | (((unsigned char *)Long)[0] << 0 ); + } +} +/* }}} */ + +/* {{{ php_ifd_get32u + * Convert a 32 bit unsigned value from file's native byte order */ +static unsigned php_ifd_get32u(void *Long, int motorola_intel) +{ + return (unsigned)php_ifd_get32s(Long, motorola_intel) & 0xffffffff; +} +/* }}} */ + +/* {{{ php_handle_tiff + main loop to parse TIFF structure */ +static struct gfxinfo *php_handle_tiff (php_stream * stream, zval *info, int motorola_intel TSRMLS_DC) +{ + struct gfxinfo *result = NULL; + int i, num_entries; + unsigned char *dir_entry; + size_t ifd_size, dir_size, entry_value, width=0, height=0, ifd_addr; + int entry_tag , entry_type; + char *ifd_data, ifd_ptr[4]; + + if (php_stream_read(stream, ifd_ptr, 4) != 4) + return NULL; + ifd_addr = php_ifd_get32u(ifd_ptr, motorola_intel); + if (php_stream_seek(stream, ifd_addr-8, SEEK_CUR)) + return NULL; + ifd_size = 2; + ifd_data = emalloc(ifd_size); + if (php_stream_read(stream, ifd_data, 2) != 2) { + efree(ifd_data); + return NULL; + } + num_entries = php_ifd_get16u(ifd_data, motorola_intel); + dir_size = 2/*num dir entries*/ +12/*length of entry*/*num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/; + ifd_size = dir_size; + ifd_data = erealloc(ifd_data,ifd_size); + if (php_stream_read(stream, ifd_data+2, dir_size-2) != dir_size-2) { + efree(ifd_data); + return NULL; + } + /* now we have the directory we can look how long it should be */ + ifd_size = dir_size; + for(i=0;iheight = height; + result->width = width; + result->bits = 0; + result->channels = 0; + return result; + } + return NULL; +} +/* }}} */ + +/* {{{ php_handle_psd + */ +static struct gfxinfo *php_handle_iff(php_stream * stream TSRMLS_DC) +{ + struct gfxinfo * result; + unsigned char a[10]; + int chunkId; + int size; + short width, height, bits; + + if (php_stream_read(stream, a, 8) != 8) { + return NULL; + } + if (strncmp(a+4, "ILBM", 4) && strncmp(a+4, "PBM ", 4)) { + return NULL; + } + + /* loop chunks to find BMHD chunk */ + do { + if (php_stream_read(stream, a, 8) != 8) { + return NULL; + } + chunkId = php_ifd_get32s(a+0, 1); + size = php_ifd_get32s(a+4, 1); + if (size < 0) { + return NULL; + } + if ((size & 1) == 1) { + size++; + } + if (chunkId == 0x424d4844) { /* BMHD chunk */ + if (size < 9 || php_stream_read(stream, a, 9) != 9) { + return NULL; + } + width = php_ifd_get16s(a+0, 1); + height = php_ifd_get16s(a+2, 1); + bits = a[8] & 0xff; + if (width > 0 && height > 0 && bits > 0 && bits < 33) { + result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo)); + result->width = width; + result->height = height; + result->bits = bits; + result->channels = 0; + return result; + } + } else { + if (php_stream_seek(stream, size, SEEK_CUR)) { + return NULL; + } + } + } while (1); +} +/* }}} */ + +/* {{{ php_get_wbmp + * int WBMP file format type + * byte Header Type + * byte Extended Header + * byte Header Data (type 00 = multibyte) + * byte Header Data (type 11 = name/pairs) + * int Number of columns + * int Number of rows + */ +static int php_get_wbmp(php_stream *stream, struct gfxinfo **result, int check TSRMLS_DC) +{ + int i, width = 0, height = 0; + + if (php_stream_rewind(stream)) { + return 0; + } + + /* get type */ + if (php_stream_getc(stream) != 0) { + return 0; + } + + /* skip header */ + do { + i = php_stream_getc(stream); + if (i < 0) { + return 0; + } + } while (i & 0x80); + + /* get width */ + do { + i = php_stream_getc(stream); + if (i < 0) { + return 0; + } + width = (width << 7) | (i & 0x7f); + } while (i & 0x80); + + /* get height */ + do { + i = php_stream_getc(stream); + if (i < 0) { + return 0; + } + height = (height << 7) | (i & 0x7f); + } while (i & 0x80); + + /* maximum valid sizes for wbmp (although 127x127 may be a more accurate one) */ + if (!height || !width || height > 2048 || width > 2048) { + return 0; + } + + if (!check) { + (*result)->width = width; + (*result)->height = height; + } + + return IMAGE_FILETYPE_WBMP; +} +/* }}} */ + +/* {{{ php_handle_wbmp +*/ +static struct gfxinfo *php_handle_wbmp(php_stream * stream TSRMLS_DC) +{ + struct gfxinfo *result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo)); + + if (!php_get_wbmp(stream, &result, 0 TSRMLS_CC)) { + efree(result); + return NULL; + } + + return result; +} +/* }}} */ + +/* {{{ php_get_xbm + */ +static int php_get_xbm(php_stream *stream, struct gfxinfo **result TSRMLS_DC) +{ + char *fline; + char *iname; + char *type; + int value; + unsigned int width = 0, height = 0; + + if (result) { + *result = NULL; + } + if (php_stream_rewind(stream)) { + return 0; + } + while ((fline=php_stream_gets(stream, NULL, 0)) != NULL) { + iname = estrdup(fline); /* simple way to get necessary buffer of required size */ + if (sscanf(fline, "#define %s %d", iname, &value) == 2) { + if (!(type = strrchr(iname, '_'))) { + type = iname; + } else { + type++; + } + + if (!strcmp("width", type)) { + width = (unsigned int) value; + if (height) { + efree(iname); + break; + } + } + if (!strcmp("height", type)) { + height = (unsigned int) value; + if (width) { + efree(iname); + break; + } + } + } + efree(fline); + efree(iname); + } + if (fline) { + efree(fline); + } + + if (width && height) { + if (result) { + *result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo)); + (*result)->width = width; + (*result)->height = height; + } + return IMAGE_FILETYPE_XBM; + } + + return 0; +} +/* }}} */ + +/* {{{ php_handle_xbm + */ +static struct gfxinfo *php_handle_xbm(php_stream * stream TSRMLS_DC) +{ + struct gfxinfo *result; + php_get_xbm(stream, &result TSRMLS_CC); + return result; +} +/* }}} */ + +/* {{{ php_handle_ico + */ +static struct gfxinfo *php_handle_ico(php_stream * stream TSRMLS_DC) +{ + struct gfxinfo *result = NULL; + unsigned char dim[16]; + int num_icons = 0; + + if (php_stream_read(stream, dim, 2) != 2) + return NULL; + + num_icons = (((unsigned int)dim[1]) << 8) + ((unsigned int) dim[0]); + + if (num_icons < 1 || num_icons > 255) + return NULL; + + result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo)); + + while (num_icons > 0) + { + if (php_stream_read(stream, dim, sizeof(dim)) != sizeof(dim)) + break; + + if ((((unsigned int)dim[7]) << 8) + ((unsigned int)dim[6]) >= result->bits) + { + result->width = (unsigned int)dim[0]; + result->height = (unsigned int)dim[1]; + result->bits = (((unsigned int)dim[7]) << 8) + ((unsigned int)dim[6]); + } + num_icons--; + } + + return result; +} +/* }}} */ + +/* {{{ php_image_type_to_mime_type + * Convert internal image_type to mime type */ +PHPAPI char * php_image_type_to_mime_type(int image_type) +{ + switch( image_type) { + case IMAGE_FILETYPE_GIF: + return "image/gif"; + case IMAGE_FILETYPE_JPEG: + return "image/jpeg"; + case IMAGE_FILETYPE_PNG: + return "image/png"; + case IMAGE_FILETYPE_SWF: + case IMAGE_FILETYPE_SWC: + return "application/x-shockwave-flash"; + case IMAGE_FILETYPE_PSD: + return "image/psd"; + case IMAGE_FILETYPE_BMP: + return "image/x-ms-bmp"; + case IMAGE_FILETYPE_TIFF_II: + case IMAGE_FILETYPE_TIFF_MM: + return "image/tiff"; + case IMAGE_FILETYPE_IFF: + return "image/iff"; + case IMAGE_FILETYPE_WBMP: + return "image/vnd.wap.wbmp"; + case IMAGE_FILETYPE_JPC: + return "application/octet-stream"; + case IMAGE_FILETYPE_JP2: + return "image/jp2"; + case IMAGE_FILETYPE_XBM: + return "image/xbm"; + case IMAGE_FILETYPE_ICO: + return "image/vnd.microsoft.icon"; + default: + case IMAGE_FILETYPE_UNKNOWN: + return "application/octet-stream"; /* suppose binary format */ + } +} +/* }}} */ + +/* {{{ proto string image_type_to_mime_type(int imagetype) + Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */ +PHP_FUNCTION(image_type_to_mime_type) +{ + long p_image_type; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &p_image_type) == FAILURE) { + return; + } + + ZVAL_STRING(return_value, (char*)php_image_type_to_mime_type(p_image_type), 1); +} +/* }}} */ + +/* {{{ proto string image_type_to_extension(int imagetype [, bool include_dot]) + Get file extension for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */ +PHP_FUNCTION(image_type_to_extension) +{ + long image_type; + zend_bool inc_dot=1; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|b", &image_type, &inc_dot) == FAILURE) { + RETURN_FALSE; + } + + switch (image_type) { + case IMAGE_FILETYPE_GIF: + RETURN_STRING(".gif" + !inc_dot, 1); + case IMAGE_FILETYPE_JPEG: + RETURN_STRING(".jpeg" + !inc_dot, 1); + case IMAGE_FILETYPE_PNG: + RETURN_STRING(".png" + !inc_dot, 1); + case IMAGE_FILETYPE_SWF: + case IMAGE_FILETYPE_SWC: + RETURN_STRING(".swf" + !inc_dot, 1); + case IMAGE_FILETYPE_PSD: + RETURN_STRING(".psd" + !inc_dot, 1); + case IMAGE_FILETYPE_BMP: + case IMAGE_FILETYPE_WBMP: + RETURN_STRING(".bmp" + !inc_dot, 1); + case IMAGE_FILETYPE_TIFF_II: + case IMAGE_FILETYPE_TIFF_MM: + RETURN_STRING(".tiff" + !inc_dot, 1); + case IMAGE_FILETYPE_IFF: + RETURN_STRING(".iff" + !inc_dot, 1); + case IMAGE_FILETYPE_JPC: + RETURN_STRING(".jpc" + !inc_dot, 1); + case IMAGE_FILETYPE_JP2: + RETURN_STRING(".jp2" + !inc_dot, 1); + case IMAGE_FILETYPE_JPX: + RETURN_STRING(".jpx" + !inc_dot, 1); + case IMAGE_FILETYPE_JB2: + RETURN_STRING(".jb2" + !inc_dot, 1); + case IMAGE_FILETYPE_XBM: + RETURN_STRING(".xbm" + !inc_dot, 1); + case IMAGE_FILETYPE_ICO: + RETURN_STRING(".ico" + !inc_dot, 1); + } + + RETURN_FALSE; +} +/* }}} */ + +/* {{{ php_imagetype + detect filetype from first bytes */ +PHPAPI int php_getimagetype(php_stream * stream, char *filetype TSRMLS_DC) +{ + char tmp[12]; + + if ( !filetype) filetype = tmp; + if((php_stream_read(stream, filetype, 3)) != 3) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Read error!"); + return IMAGE_FILETYPE_UNKNOWN; + } + +/* BYTES READ: 3 */ + if (!memcmp(filetype, php_sig_gif, 3)) { + return IMAGE_FILETYPE_GIF; + } else if (!memcmp(filetype, php_sig_jpg, 3)) { + return IMAGE_FILETYPE_JPEG; + } else if (!memcmp(filetype, php_sig_png, 3)) { + if (php_stream_read(stream, filetype+3, 5) != 5) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Read error!"); + return IMAGE_FILETYPE_UNKNOWN; + } + if (!memcmp(filetype, php_sig_png, 8)) { + return IMAGE_FILETYPE_PNG; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "PNG file corrupted by ASCII conversion"); + return IMAGE_FILETYPE_UNKNOWN; + } + } else if (!memcmp(filetype, php_sig_swf, 3)) { + return IMAGE_FILETYPE_SWF; + } else if (!memcmp(filetype, php_sig_swc, 3)) { + return IMAGE_FILETYPE_SWC; + } else if (!memcmp(filetype, php_sig_psd, 3)) { + return IMAGE_FILETYPE_PSD; + } else if (!memcmp(filetype, php_sig_bmp, 2)) { + return IMAGE_FILETYPE_BMP; + } else if (!memcmp(filetype, php_sig_jpc, 3)) { + return IMAGE_FILETYPE_JPC; + } + + if (php_stream_read(stream, filetype+3, 1) != 1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Read error!"); + return IMAGE_FILETYPE_UNKNOWN; + } +/* BYTES READ: 4 */ + if (!memcmp(filetype, php_sig_tif_ii, 4)) { + return IMAGE_FILETYPE_TIFF_II; + } else if (!memcmp(filetype, php_sig_tif_mm, 4)) { + return IMAGE_FILETYPE_TIFF_MM; + } else if (!memcmp(filetype, php_sig_iff, 4)) { + return IMAGE_FILETYPE_IFF; + } else if (!memcmp(filetype, php_sig_ico, 4)) { + return IMAGE_FILETYPE_ICO; + } + + if (php_stream_read(stream, filetype+4, 8) != 8) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Read error!"); + return IMAGE_FILETYPE_UNKNOWN; + } +/* BYTES READ: 12 */ + if (!memcmp(filetype, php_sig_jp2, 12)) { + return IMAGE_FILETYPE_JP2; + } + +/* AFTER ALL ABOVE FAILED */ + if (php_get_wbmp(stream, NULL, 1 TSRMLS_CC)) { + return IMAGE_FILETYPE_WBMP; + } + if (php_get_xbm(stream, NULL TSRMLS_CC)) { + return IMAGE_FILETYPE_XBM; + } + return IMAGE_FILETYPE_UNKNOWN; +} +/* }}} */ + +static void php_getimagesize_from_stream(php_stream *stream, zval **info, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ +{ + char *temp; + int itype = 0; + struct gfxinfo *result = NULL; + + if (!stream) { + RETURN_FALSE; + } + + itype = php_getimagetype(stream, NULL TSRMLS_CC); + switch( itype) { + case IMAGE_FILETYPE_GIF: + result = php_handle_gif(stream TSRMLS_CC); + break; + case IMAGE_FILETYPE_JPEG: + if (info) { + result = php_handle_jpeg(stream, *info TSRMLS_CC); + } else { + result = php_handle_jpeg(stream, NULL TSRMLS_CC); + } + break; + case IMAGE_FILETYPE_PNG: + result = php_handle_png(stream TSRMLS_CC); + break; + case IMAGE_FILETYPE_SWF: + result = php_handle_swf(stream TSRMLS_CC); + break; + case IMAGE_FILETYPE_SWC: +#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB) + result = php_handle_swc(stream TSRMLS_CC); +#else + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "The image is a compressed SWF file, but you do not have a static version of the zlib extension enabled"); +#endif + break; + case IMAGE_FILETYPE_PSD: + result = php_handle_psd(stream TSRMLS_CC); + break; + case IMAGE_FILETYPE_BMP: + result = php_handle_bmp(stream TSRMLS_CC); + break; + case IMAGE_FILETYPE_TIFF_II: + result = php_handle_tiff(stream, NULL, 0 TSRMLS_CC); + break; + case IMAGE_FILETYPE_TIFF_MM: + result = php_handle_tiff(stream, NULL, 1 TSRMLS_CC); + break; + case IMAGE_FILETYPE_JPC: + result = php_handle_jpc(stream TSRMLS_CC); + break; + case IMAGE_FILETYPE_JP2: + result = php_handle_jp2(stream TSRMLS_CC); + break; + case IMAGE_FILETYPE_IFF: + result = php_handle_iff(stream TSRMLS_CC); + break; + case IMAGE_FILETYPE_WBMP: + result = php_handle_wbmp(stream TSRMLS_CC); + break; + case IMAGE_FILETYPE_XBM: + result = php_handle_xbm(stream TSRMLS_CC); + break; + case IMAGE_FILETYPE_ICO: + result = php_handle_ico(stream TSRMLS_CC); + break; + default: + case IMAGE_FILETYPE_UNKNOWN: + break; + } + + if (result) { + array_init(return_value); + add_index_long(return_value, 0, result->width); + add_index_long(return_value, 1, result->height); + add_index_long(return_value, 2, itype); + spprintf(&temp, 0, "width=\"%d\" height=\"%d\"", result->width, result->height); + add_index_string(return_value, 3, temp, 0); + + if (result->bits != 0) { + add_assoc_long(return_value, "bits", result->bits); + } + if (result->channels != 0) { + add_assoc_long(return_value, "channels", result->channels); + } + add_assoc_string(return_value, "mime", (char*)php_image_type_to_mime_type(itype), 1); + efree(result); + } else { + RETURN_FALSE; + } +} +/* }}} */ + +#define FROM_DATA 0 +#define FROM_PATH 1 + +static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) { /* {{{ */ + zval **info = NULL; + php_stream *stream = NULL; + char *input; + int input_len; + const int argc = ZEND_NUM_ARGS(); + + if (zend_parse_parameters(argc TSRMLS_CC, "s|Z", &input, &input_len, &info) == FAILURE) { + return; + } + + if (argc == 2) { + zval_dtor(*info); + array_init(*info); + } + + + if (mode == FROM_PATH) { + stream = php_stream_open_wrapper(input, "rb", STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH, NULL); + } else { + stream = php_stream_memory_open(TEMP_STREAM_READONLY, input, input_len); + } + + if (!stream) { + RETURN_FALSE; + } + + php_getimagesize_from_stream(stream, info, INTERNAL_FUNCTION_PARAM_PASSTHRU); + php_stream_close(stream); +} +/* }}} */ + +/* {{{ proto array getimagesize(string imagefile [, array info]) + Get the size of an image as 4-element array */ +PHP_FUNCTION(getimagesize) +{ + php_getimagesize_from_any(INTERNAL_FUNCTION_PARAM_PASSTHRU, FROM_PATH); +} +/* }}} */ + +/* {{{ proto array getimagesizefromstring(string data [, array info]) + Get the size of an image as 4-element array */ +PHP_FUNCTION(getimagesizefromstring) +{ + php_getimagesize_from_any(INTERNAL_FUNCTION_PARAM_PASSTHRU, FROM_DATA); +} + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c new file mode 100644 index 0000000..9af70f2 --- /dev/null +++ b/ext/standard/incomplete_class.c @@ -0,0 +1,183 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Sascha Schumann | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "basic_functions.h" +#include "php_incomplete_class.h" + +#define INCOMPLETE_CLASS_MSG \ + "The script tried to execute a method or " \ + "access a property of an incomplete object. " \ + "Please ensure that the class definition \"%s\" of the object " \ + "you are trying to operate on was loaded _before_ " \ + "unserialize() gets called or provide a __autoload() function " \ + "to load the class definition " + +static zend_object_handlers php_incomplete_object_handlers; + +/* {{{ incomplete_class_message + */ +static void incomplete_class_message(zval *object, int error_type TSRMLS_DC) +{ + char *class_name; + zend_bool class_name_alloced = 1; + + class_name = php_lookup_class_name(object, NULL); + + if (!class_name) { + class_name_alloced = 0; + class_name = "unknown"; + } + + php_error_docref(NULL TSRMLS_CC, error_type, INCOMPLETE_CLASS_MSG, class_name); + + if (class_name_alloced) { + efree(class_name); + } +} +/* }}} */ + +static zval *incomplete_class_get_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */ +{ + incomplete_class_message(object, E_NOTICE TSRMLS_CC); + + if (type == BP_VAR_W || type == BP_VAR_RW) { + return EG(error_zval_ptr); + } else { + return EG(uninitialized_zval_ptr); + } +} +/* }}} */ + +static void incomplete_class_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC) /* {{{ */ +{ + incomplete_class_message(object, E_NOTICE TSRMLS_CC); +} +/* }}} */ + +static zval **incomplete_class_get_property_ptr_ptr(zval *object, zval *member, const zend_literal *key TSRMLS_DC) /* {{{ */ +{ + incomplete_class_message(object, E_NOTICE TSRMLS_CC); + return &EG(error_zval_ptr); +} +/* }}} */ + +static void incomplete_class_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC) /* {{{ */ +{ + incomplete_class_message(object, E_NOTICE TSRMLS_CC); +} +/* }}} */ + +static int incomplete_class_has_property(zval *object, zval *member, int check_empty, const zend_literal *key TSRMLS_DC) /* {{{ */ +{ + incomplete_class_message(object, E_NOTICE TSRMLS_CC); + return 0; +} +/* }}} */ + +static union _zend_function *incomplete_class_get_method(zval **object, char *method, int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */ +{ + incomplete_class_message(*object, E_ERROR TSRMLS_CC); + return NULL; +} +/* }}} */ + +/* {{{ php_create_incomplete_class + */ +static zend_object_value php_create_incomplete_object(zend_class_entry *class_type TSRMLS_DC) +{ + zend_object *object; + zend_object_value value; + + value = zend_objects_new(&object, class_type TSRMLS_CC); + value.handlers = &php_incomplete_object_handlers; + + object_properties_init(object, class_type); + + return value; +} + +PHPAPI zend_class_entry *php_create_incomplete_class(TSRMLS_D) +{ + zend_class_entry incomplete_class; + + INIT_CLASS_ENTRY(incomplete_class, INCOMPLETE_CLASS, NULL); + incomplete_class.create_object = php_create_incomplete_object; + + memcpy(&php_incomplete_object_handlers, &std_object_handlers, sizeof(zend_object_handlers)); + php_incomplete_object_handlers.read_property = incomplete_class_get_property; + php_incomplete_object_handlers.has_property = incomplete_class_has_property; + php_incomplete_object_handlers.unset_property = incomplete_class_unset_property; + php_incomplete_object_handlers.write_property = incomplete_class_write_property; + php_incomplete_object_handlers.get_property_ptr_ptr = incomplete_class_get_property_ptr_ptr; + php_incomplete_object_handlers.get_method = incomplete_class_get_method; + + return zend_register_internal_class(&incomplete_class TSRMLS_CC); +} +/* }}} */ + +/* {{{ php_lookup_class_name + */ +PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen) +{ + zval **val; + char *retval = NULL; + HashTable *object_properties; + TSRMLS_FETCH(); + + object_properties = Z_OBJPROP_P(object); + + if (zend_hash_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER), (void **) &val) == SUCCESS) { + retval = estrndup(Z_STRVAL_PP(val), Z_STRLEN_PP(val)); + + if (nlen) { + *nlen = Z_STRLEN_PP(val); + } + } + + return retval; +} +/* }}} */ + +/* {{{ php_store_class_name + */ +PHPAPI void php_store_class_name(zval *object, const char *name, zend_uint len) +{ + zval *val; + TSRMLS_FETCH(); + + MAKE_STD_ZVAL(val); + + Z_TYPE_P(val) = IS_STRING; + Z_STRVAL_P(val) = estrndup(name, len); + Z_STRLEN_P(val) = len; + + zend_hash_update(Z_OBJPROP_P(object), MAGIC_MEMBER, sizeof(MAGIC_MEMBER), &val, sizeof(val), NULL); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/info.c b/ext/standard/info.c new file mode 100644 index 0000000..e171f72 --- /dev/null +++ b/ext/standard/info.c @@ -0,0 +1,1336 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Zeev Suraski | + | Colin Viebrock | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "php_ini.h" +#include "php_globals.h" +#include "ext/standard/head.h" +#include "ext/standard/html.h" +#include "info.h" +#include "credits.h" +#include "css.h" +#include "SAPI.h" +#include +#include "php_main.h" +#include "zend_globals.h" /* needs ELS */ +#include "zend_extensions.h" +#include "zend_highlight.h" +#ifdef HAVE_SYS_UTSNAME_H +#include +#endif + + +#ifdef PHP_WIN32 +typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); +typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); +# include "winver.h" + +# if _MSC_VER < 1300 +# define OSVERSIONINFOEX php_win_OSVERSIONINFOEX +# endif +#endif + +#define SECTION(name) if (!sapi_module.phpinfo_as_text) { \ + php_info_print("

" name "

\n"); \ + } else { \ + php_info_print_table_start(); \ + php_info_print_table_header(1, name); \ + php_info_print_table_end(); \ + } \ + +PHPAPI extern char *php_ini_opened_path; +PHPAPI extern char *php_ini_scanned_path; +PHPAPI extern char *php_ini_scanned_files; + +static int php_info_print_html_esc(const char *str, int len) /* {{{ */ +{ + size_t new_len; + int written; + char *new_str; + TSRMLS_FETCH(); + + new_str = php_escape_html_entities((unsigned char *) str, len, &new_len, 0, ENT_QUOTES, "utf-8" TSRMLS_CC); + written = php_output_write(new_str, new_len TSRMLS_CC); + efree(new_str); + return written; +} +/* }}} */ + +static int php_info_printf(const char *fmt, ...) /* {{{ */ +{ + char *buf; + int len, written; + va_list argv; + TSRMLS_FETCH(); + + va_start(argv, fmt); + len = vspprintf(&buf, 0, fmt, argv); + va_end(argv); + + written = php_output_write(buf, len TSRMLS_CC); + efree(buf); + return written; +} +/* }}} */ + +static void php_info_print_request_uri(TSRMLS_D) /* {{{ */ +{ + if (SG(request_info).request_uri) { + php_info_print_html_esc(SG(request_info).request_uri, strlen(SG(request_info).request_uri)); + } +} +/* }}} */ + +static int php_info_print(const char *str) /* {{{ */ +{ + TSRMLS_FETCH(); + return php_output_write(str, strlen(str) TSRMLS_CC); +} +/* }}} */ + +static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC) /* {{{ */ +{ + char *key; + uint len; + + if (ht) { + if (zend_hash_num_elements(ht)) { + HashPosition pos; + + if (!sapi_module.phpinfo_as_text) { + php_info_printf("Registered %s", name); + } else { + php_info_printf("\nRegistered %s => ", name); + } + + zend_hash_internal_pointer_reset_ex(ht, &pos); + while (zend_hash_get_current_key_ex(ht, &key, &len, NULL, 0, &pos) == HASH_KEY_IS_STRING) + { + php_info_print(key); + zend_hash_move_forward_ex(ht, &pos); + if (zend_hash_get_current_key_ex(ht, &key, &len, NULL, 0, &pos) == HASH_KEY_IS_STRING) { + php_info_print(", "); + } else { + break; + } + } + + if (!sapi_module.phpinfo_as_text) { + php_info_print("\n"); + } + } else { + char reg_name[128]; + snprintf(reg_name, sizeof(reg_name), "Registered %s", name); + php_info_print_table_row(2, reg_name, "none registered"); + } + } else { + php_info_print_table_row(2, name, "disabled"); + } +} +/* }}} */ + +PHPAPI void php_info_print_module(zend_module_entry *zend_module TSRMLS_DC) /* {{{ */ +{ + if (zend_module->info_func || zend_module->version) { + if (!sapi_module.phpinfo_as_text) { + php_info_printf("

%s

\n", zend_module->name, zend_module->name); + } else { + php_info_print_table_start(); + php_info_print_table_header(1, zend_module->name); + php_info_print_table_end(); + } + if (zend_module->info_func) { + zend_module->info_func(zend_module TSRMLS_CC); + } else { + php_info_print_table_start(); + php_info_print_table_row(2, "Version", zend_module->version); + php_info_print_table_end(); + DISPLAY_INI_ENTRIES(); + } + } else { + if (!sapi_module.phpinfo_as_text) { + php_info_printf("%s\n", zend_module->name); + } else { + php_info_printf("%s\n", zend_module->name); + } + } +} +/* }}} */ + +static int _display_module_info_func(zend_module_entry *module TSRMLS_DC) /* {{{ */ +{ + if (module->info_func || module->version) { + php_info_print_module(module TSRMLS_CC); + } + return ZEND_HASH_APPLY_KEEP; +} +/* }}} */ + +static int _display_module_info_def(zend_module_entry *module TSRMLS_DC) /* {{{ */ +{ + if (!module->info_func && !module->version) { + php_info_print_module(module TSRMLS_CC); + } + return ZEND_HASH_APPLY_KEEP; +} +/* }}} */ + +/* {{{ php_print_gpcse_array + */ +static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) +{ + zval **data, **tmp, tmp2; + char *string_key; + uint string_len; + ulong num_key; + + zend_is_auto_global(name, name_length TSRMLS_CC); + + if (zend_hash_find(&EG(symbol_table), name, name_length+1, (void **) &data)!=FAILURE + && (Z_TYPE_PP(data)==IS_ARRAY)) { + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data)); + while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) &tmp) == SUCCESS) { + if (!sapi_module.phpinfo_as_text) { + php_info_print(""); + php_info_print(""); + } + + php_info_print(name); + php_info_print("[\""); + + switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL)) { + case HASH_KEY_IS_STRING: + if (!sapi_module.phpinfo_as_text) { + php_info_print_html_esc(string_key, string_len-1); + } else { + php_info_print(string_key); + } + break; + case HASH_KEY_IS_LONG: + php_info_printf("%ld", num_key); + break; + } + php_info_print("\"]"); + if (!sapi_module.phpinfo_as_text) { + php_info_print(""); + } else { + php_info_print(" => "); + } + if (Z_TYPE_PP(tmp) == IS_ARRAY) { + if (!sapi_module.phpinfo_as_text) { + php_info_print("
");
+					zend_print_zval_r_ex((zend_write_func_t) php_info_print_html_esc, *tmp, 0 TSRMLS_CC);
+					php_info_print("
"); + } else { + zend_print_zval_r(*tmp, 0 TSRMLS_CC); + } + } else { + tmp2 = **tmp; + if (Z_TYPE_PP(tmp) != IS_STRING) { + tmp = NULL; + zval_copy_ctor(&tmp2); + convert_to_string(&tmp2); + } + + if (!sapi_module.phpinfo_as_text) { + if (Z_STRLEN(tmp2) == 0) { + php_info_print("no value"); + } else { + php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRLEN(tmp2)); + } + } else { + php_info_print(Z_STRVAL(tmp2)); + } + + if (!tmp) { + zval_dtor(&tmp2); + } + } + if (!sapi_module.phpinfo_as_text) { + php_info_print("\n"); + } else { + php_info_print("\n"); + } + zend_hash_move_forward(Z_ARRVAL_PP(data)); + } + } +} +/* }}} */ + +/* {{{ php_info_print_style + */ +void php_info_print_style(TSRMLS_D) +{ + php_info_printf("\n"); +} +/* }}} */ + +/* {{{ php_info_html_esc + */ +PHPAPI char *php_info_html_esc(char *string TSRMLS_DC) +{ + size_t new_len; + return php_escape_html_entities(string, strlen(string), &new_len, 0, ENT_QUOTES, NULL TSRMLS_CC); +} +/* }}} */ + +#ifdef PHP_WIN32 +/* {{{ */ + +char* php_get_windows_name() +{ + OSVERSIONINFOEX osvi; + SYSTEM_INFO si; + PGNSI pGNSI; + PGPI pGPI; + BOOL bOsVersionInfoEx; + DWORD dwType; + char *major = NULL, *sub = NULL, *retval; + + ZeroMemory(&si, sizeof(SYSTEM_INFO)); + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + + if (!(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi))) { + return NULL; + } + + pGNSI = (PGNSI) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetNativeSystemInfo"); + if(NULL != pGNSI) { + pGNSI(&si); + } else { + GetSystemInfo(&si); + } + + if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion > 4 ) { + if (osvi.dwMajorVersion == 6) { + if( osvi.dwMinorVersion == 0 ) { + if( osvi.wProductType == VER_NT_WORKSTATION ) { + major = "Windows Vista"; + } else { + major = "Windows Server 2008"; + } + } else + if ( osvi.dwMinorVersion == 1 ) { + if( osvi.wProductType == VER_NT_WORKSTATION ) { + major = "Windows 7"; + } else { + major = "Windows Server 2008 R2"; + } + } else { + major = "Unknown Windows version"; + } + + pGPI = (PGPI) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetProductInfo"); + pGPI(6, 0, 0, 0, &dwType); + + switch (dwType) { + case PRODUCT_ULTIMATE: + sub = "Ultimate Edition"; + break; + case PRODUCT_HOME_PREMIUM: + sub = "Home Premium Edition"; + break; + case PRODUCT_HOME_BASIC: + sub = "Home Basic Edition"; + break; + case PRODUCT_ENTERPRISE: + sub = "Enterprise Edition"; + break; + case PRODUCT_BUSINESS: + sub = "Business Edition"; + break; + case PRODUCT_STARTER: + sub = "Starter Edition"; + break; + case PRODUCT_CLUSTER_SERVER: + sub = "Cluster Server Edition"; + break; + case PRODUCT_DATACENTER_SERVER: + sub = "Datacenter Edition"; + break; + case PRODUCT_DATACENTER_SERVER_CORE: + sub = "Datacenter Edition (core installation)"; + break; + case PRODUCT_ENTERPRISE_SERVER: + sub = "Enterprise Edition"; + break; + case PRODUCT_ENTERPRISE_SERVER_CORE: + sub = "Enterprise Edition (core installation)"; + break; + case PRODUCT_ENTERPRISE_SERVER_IA64: + sub = "Enterprise Edition for Itanium-based Systems"; + break; + case PRODUCT_SMALLBUSINESS_SERVER: + sub = "Small Business Server"; + break; + case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM: + sub = "Small Business Server Premium Edition"; + break; + case PRODUCT_STANDARD_SERVER: + sub = "Standard Edition"; + break; + case PRODUCT_STANDARD_SERVER_CORE: + sub = "Standard Edition (core installation)"; + break; + case PRODUCT_WEB_SERVER: + sub = "Web Server Edition"; + break; + } + } + + if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 ) { + if (GetSystemMetrics(SM_SERVERR2)) + major = "Windows Server 2003 R2"; + else if (osvi.wSuiteMask==VER_SUITE_STORAGE_SERVER) + major = "Windows Storage Server 2003"; + else if (osvi.wSuiteMask==VER_SUITE_WH_SERVER) + major = "Windows Home Server"; + else if (osvi.wProductType == VER_NT_WORKSTATION && + si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64) { + major = "Windows XP Professional x64 Edition"; + } else { + major = "Windows Server 2003"; + } + + /* Test for the server type. */ + if ( osvi.wProductType != VER_NT_WORKSTATION ) { + if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64 ) { + if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) + sub = "Datacenter Edition for Itanium-based Systems"; + else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + sub = "Enterprise Edition for Itanium-based Systems"; + } + + else if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 ) { + if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) + sub = "Datacenter x64 Edition"; + else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + sub = "Enterprise x64 Edition"; + else sub = "Standard x64 Edition"; + } else { + if ( osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER ) + sub = "Compute Cluster Edition"; + else if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) + sub = "Datacenter Edition"; + else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + sub = "Enterprise Edition"; + else if ( osvi.wSuiteMask & VER_SUITE_BLADE ) + sub = "Web Edition"; + else sub = "Standard Edition"; + } + } + } + + if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 ) { + major = "Windows XP"; + if( osvi.wSuiteMask & VER_SUITE_PERSONAL ) { + sub = "Home Edition"; + } else if (GetSystemMetrics(SM_MEDIACENTER)) { + sub = "Media Center Edition"; + } else if (GetSystemMetrics(SM_STARTER)) { + sub = "Starter Edition"; + } else if (GetSystemMetrics(SM_TABLETPC)) { + sub = "Tablet PC Edition"; + } else { + sub = "Professional"; + } + } + + if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 ) { + major = "Windows 2000"; + + if (osvi.wProductType == VER_NT_WORKSTATION ) { + sub = "Professional"; + } else { + if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) + sub = "Datacenter Server"; + else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + sub = "Advanced Server"; + else sub = "Server"; + } + } + } else { + return NULL; + } + + spprintf(&retval, 0, "%s%s%s%s%s", major, sub?" ":"", sub?sub:"", osvi.szCSDVersion[0] != '\0'?" ":"", osvi.szCSDVersion); + return retval; +} +/* }}} */ + +/* {{{ */ +void php_get_windows_cpu(char *buf, int bufsize) +{ + SYSTEM_INFO SysInfo; + GetSystemInfo(&SysInfo); + switch (SysInfo.wProcessorArchitecture) { + case PROCESSOR_ARCHITECTURE_INTEL : + snprintf(buf, bufsize, "i%d", SysInfo.dwProcessorType); + break; + case PROCESSOR_ARCHITECTURE_MIPS : + snprintf(buf, bufsize, "MIPS R%d000", SysInfo.wProcessorLevel); + break; + case PROCESSOR_ARCHITECTURE_ALPHA : + snprintf(buf, bufsize, "Alpha %d", SysInfo.wProcessorLevel); + break; + case PROCESSOR_ARCHITECTURE_PPC : + snprintf(buf, bufsize, "PPC 6%02d", SysInfo.wProcessorLevel); + break; + case PROCESSOR_ARCHITECTURE_IA64 : + snprintf(buf, bufsize, "IA64"); + break; +#if defined(PROCESSOR_ARCHITECTURE_IA32_ON_WIN64) + case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 : + snprintf(buf, bufsize, "IA32"); + break; +#endif +#if defined(PROCESSOR_ARCHITECTURE_AMD64) + case PROCESSOR_ARCHITECTURE_AMD64 : + snprintf(buf, bufsize, "AMD64"); + break; +#endif + case PROCESSOR_ARCHITECTURE_UNKNOWN : + default: + snprintf(buf, bufsize, "Unknown"); + break; + } +} +/* }}} */ +#endif + +/* {{{ php_get_uname + */ +PHPAPI char *php_get_uname(char mode) +{ + char *php_uname; + char tmp_uname[256]; +#ifdef PHP_WIN32 + DWORD dwBuild=0; + DWORD dwVersion = GetVersion(); + DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); + DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); + DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; + char ComputerName[MAX_COMPUTERNAME_LENGTH + 1]; + + GetComputerName(ComputerName, &dwSize); + + if (mode == 's') { + php_uname = "Windows NT"; + } else if (mode == 'r') { + snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d", dwWindowsMajorVersion, dwWindowsMinorVersion); + php_uname = tmp_uname; + } else if (mode == 'n') { + php_uname = ComputerName; + } else if (mode == 'v') { + char *winver = php_get_windows_name(); + dwBuild = (DWORD)(HIWORD(dwVersion)); + if(winver == NULL) { + snprintf(tmp_uname, sizeof(tmp_uname), "build %d", dwBuild); + } else { + snprintf(tmp_uname, sizeof(tmp_uname), "build %d (%s)", dwBuild, winver); + } + php_uname = tmp_uname; + if(winver) { + efree(winver); + } + } else if (mode == 'm') { + php_get_windows_cpu(tmp_uname, sizeof(tmp_uname)); + php_uname = tmp_uname; + } else { /* assume mode == 'a' */ + char *winver = php_get_windows_name(); + char wincpu[20]; + + php_get_windows_cpu(wincpu, sizeof(wincpu)); + dwBuild = (DWORD)(HIWORD(dwVersion)); + snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d build %d (%s) %s", + "Windows NT", ComputerName, + dwWindowsMajorVersion, dwWindowsMinorVersion, dwBuild, winver?winver:"unknown", wincpu); + if(winver) { + efree(winver); + } + php_uname = tmp_uname; + } +#else +#ifdef HAVE_SYS_UTSNAME_H + struct utsname buf; + 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') { + php_uname = buf.release; + } else if (mode == 'n') { + php_uname = buf.nodename; + } else if (mode == 'v') { + php_uname = buf.version; + } else if (mode == 'm') { + php_uname = buf.machine; + } else { /* assume mode == 'a' */ + snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %s %s %s", + buf.sysname, buf.nodename, buf.release, buf.version, + buf.machine); + php_uname = tmp_uname; + } +#endif /* NETWARE */ + } +#else + php_uname = PHP_UNAME; +#endif +#endif + return estrdup(php_uname); +} +/* }}} */ + +/* {{{ php_print_info_htmlhead + */ +PHPAPI void php_print_info_htmlhead(TSRMLS_D) +{ + php_info_print("\n"); + php_info_print(""); + php_info_print("\n"); + php_info_print_style(TSRMLS_C); + php_info_print("phpinfo()"); + php_info_print(""); + php_info_print("\n"); + php_info_print("
\n"); +} +/* }}} */ + +/* {{{ module_name_cmp */ +static int module_name_cmp(const void *a, const void *b TSRMLS_DC) +{ + Bucket *f = *((Bucket **) a); + Bucket *s = *((Bucket **) b); + + return strcasecmp(((zend_module_entry *)f->pData)->name, + ((zend_module_entry *)s->pData)->name); +} +/* }}} */ + +/* {{{ php_print_info + */ +PHPAPI void php_print_info(int flag TSRMLS_DC) +{ + char **env, *tmp1, *tmp2; + char *php_uname; + int expose_php = INI_INT("expose_php"); + + if (!sapi_module.phpinfo_as_text) { + php_print_info_htmlhead(TSRMLS_C); + } else { + php_info_print("phpinfo()\n"); + } + + if (flag & PHP_INFO_GENERAL) { + char *zend_version = get_zend_version(); + char temp_api[10]; + char *logo_guid; + + php_uname = php_get_uname('a'); + + if (!sapi_module.phpinfo_as_text) { + php_info_print_box_start(1); + } + + if (expose_php && !sapi_module.phpinfo_as_text) { + php_info_print("\"PHP"); + } + + if (!sapi_module.phpinfo_as_text) { + php_info_printf("

PHP Version %s

\n", PHP_VERSION); + } else { + php_info_print_table_row(2, "PHP Version", PHP_VERSION); + } + php_info_print_box_end(); + php_info_print_table_start(); + php_info_print_table_row(2, "System", php_uname ); + php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__ ); +#ifdef COMPILER + php_info_print_table_row(2, "Compiler", COMPILER); +#endif +#ifdef ARCHITECTURE + php_info_print_table_row(2, "Architecture", ARCHITECTURE); +#endif +#ifdef CONFIGURE_COMMAND + php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND ); +#endif + + if (sapi_module.pretty_name) { + php_info_print_table_row(2, "Server API", sapi_module.pretty_name ); + } + +#ifdef VIRTUAL_DIR + php_info_print_table_row(2, "Virtual Directory Support", "enabled" ); +#else + php_info_print_table_row(2, "Virtual Directory Support", "disabled" ); +#endif + + php_info_print_table_row(2, "Configuration File (php.ini) Path", PHP_CONFIG_FILE_PATH); + php_info_print_table_row(2, "Loaded Configuration File", php_ini_opened_path ? php_ini_opened_path : "(none)"); + php_info_print_table_row(2, "Scan this dir for additional .ini files", php_ini_scanned_path ? php_ini_scanned_path : "(none)"); + php_info_print_table_row(2, "Additional .ini files parsed", php_ini_scanned_files ? php_ini_scanned_files : "(none)"); + + snprintf(temp_api, sizeof(temp_api), "%d", PHP_API_VERSION); + php_info_print_table_row(2, "PHP API", temp_api); + + snprintf(temp_api, sizeof(temp_api), "%d", ZEND_MODULE_API_NO); + php_info_print_table_row(2, "PHP Extension", temp_api); + + snprintf(temp_api, sizeof(temp_api), "%d", ZEND_EXTENSION_API_NO); + php_info_print_table_row(2, "Zend Extension", temp_api); + + php_info_print_table_row(2, "Zend Extension Build", ZEND_EXTENSION_BUILD_ID); + php_info_print_table_row(2, "PHP Extension Build", ZEND_MODULE_BUILD_ID); + +#if ZEND_DEBUG + php_info_print_table_row(2, "Debug Build", "yes" ); +#else + php_info_print_table_row(2, "Debug Build", "no" ); +#endif + +#ifdef ZTS + php_info_print_table_row(2, "Thread Safety", "enabled" ); +#else + php_info_print_table_row(2, "Thread Safety", "disabled" ); +#endif + +#ifdef ZEND_SIGNALS + php_info_print_table_row(2, "Zend Signal Handling", "enabled" ); +#else + php_info_print_table_row(2, "Zend Signal Handling", "disabled" ); +#endif + + php_info_print_table_row(2, "Zend Memory Manager", is_zend_mm(TSRMLS_C) ? "enabled" : "disabled" ); + + { + const zend_multibyte_functions *functions = zend_multibyte_get_functions(TSRMLS_C); + char *descr; + if (functions) { + spprintf(&descr, 0, "provided by %s", functions->provider_name); + } else { + descr = estrdup("disabled"); + } + php_info_print_table_row(2, "Zend Multibyte Support", descr); + efree(descr); + } + +#if HAVE_IPV6 + php_info_print_table_row(2, "IPv6 Support", "enabled" ); +#else + php_info_print_table_row(2, "IPv6 Support", "disabled" ); +#endif + +#if HAVE_DTRACE + php_info_print_table_row(2, "DTrace Support", "enabled" ); +#else + php_info_print_table_row(2, "DTrace Support", "disabled" ); +#endif + + php_info_print_stream_hash("PHP Streams", php_stream_get_url_stream_wrappers_hash() TSRMLS_CC); + php_info_print_stream_hash("Stream Socket Transports", php_stream_xport_get_hash() TSRMLS_CC); + php_info_print_stream_hash("Stream Filters", php_get_stream_filters_hash() TSRMLS_CC); + + php_info_print_table_end(); + + /* Zend Engine */ + php_info_print_box_start(0); + if (expose_php && !sapi_module.phpinfo_as_text) { + php_info_print("\"Zend\n"); + } + php_info_print("This program makes use of the Zend Scripting Language Engine:"); + php_info_print(!sapi_module.phpinfo_as_text?"
":"\n"); + if (sapi_module.phpinfo_as_text) { + php_info_print(zend_version); + } else { + zend_html_puts(zend_version, strlen(zend_version) TSRMLS_CC); + } + php_info_print_box_end(); + efree(php_uname); + } + + if ((flag & PHP_INFO_CREDITS) && expose_php && !sapi_module.phpinfo_as_text) { + php_info_print_hr(); + php_info_print("

"); + php_info_print("PHP Credits"); + php_info_print("

\n"); + } + + zend_ini_sort_entries(TSRMLS_C); + + if (flag & PHP_INFO_CONFIGURATION) { + php_info_print_hr(); + if (!sapi_module.phpinfo_as_text) { + php_info_print("

Configuration

\n"); + } else { + SECTION("Configuration"); + } + if (!(flag & PHP_INFO_MODULES)) { + SECTION("PHP Core"); + display_ini_entries(NULL); + } + } + + if (flag & PHP_INFO_MODULES) { + HashTable sorted_registry; + zend_module_entry tmp; + + zend_hash_init(&sorted_registry, zend_hash_num_elements(&module_registry), NULL, NULL, 1); + zend_hash_copy(&sorted_registry, &module_registry, NULL, &tmp, sizeof(zend_module_entry)); + zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC); + + zend_hash_apply(&sorted_registry, (apply_func_t) _display_module_info_func TSRMLS_CC); + + SECTION("Additional Modules"); + php_info_print_table_start(); + php_info_print_table_header(1, "Module Name"); + zend_hash_apply(&sorted_registry, (apply_func_t) _display_module_info_def TSRMLS_CC); + php_info_print_table_end(); + + zend_hash_destroy(&sorted_registry); + } + + if (flag & PHP_INFO_ENVIRONMENT) { + SECTION("Environment"); + php_info_print_table_start(); + php_info_print_table_header(2, "Variable", "Value"); + for (env=environ; env!=NULL && *env !=NULL; env++) { + tmp1 = estrdup(*env); + if (!(tmp2=strchr(tmp1,'='))) { /* malformed entry? */ + efree(tmp1); + continue; + } + *tmp2 = 0; + tmp2++; + php_info_print_table_row(2, tmp1, tmp2); + efree(tmp1); + } + php_info_print_table_end(); + } + + if (flag & PHP_INFO_VARIABLES) { + zval **data; + + SECTION("PHP Variables"); + + php_info_print_table_start(); + php_info_print_table_header(2, "Variable", "Value"); + if (zend_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void **) &data) != FAILURE) { + php_info_print_table_row(2, "PHP_SELF", Z_STRVAL_PP(data)); + } + if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE) { + php_info_print_table_row(2, "PHP_AUTH_TYPE", Z_STRVAL_PP(data)); + } + if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE) { + php_info_print_table_row(2, "PHP_AUTH_USER", Z_STRVAL_PP(data)); + } + if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) { + php_info_print_table_row(2, "PHP_AUTH_PW", Z_STRVAL_PP(data)); + } + php_print_gpcse_array(ZEND_STRL("_REQUEST") TSRMLS_CC); + php_print_gpcse_array(ZEND_STRL("_GET") TSRMLS_CC); + php_print_gpcse_array(ZEND_STRL("_POST") TSRMLS_CC); + php_print_gpcse_array(ZEND_STRL("_FILES") TSRMLS_CC); + php_print_gpcse_array(ZEND_STRL("_COOKIE") TSRMLS_CC); + php_print_gpcse_array(ZEND_STRL("_SERVER") TSRMLS_CC); + php_print_gpcse_array(ZEND_STRL("_ENV") TSRMLS_CC); + php_info_print_table_end(); + } + + if (flag & PHP_INFO_LICENSE) { + if (!sapi_module.phpinfo_as_text) { + SECTION("PHP License"); + php_info_print_box_start(0); + php_info_print("

\n"); + php_info_print("This program is free software; you can redistribute it and/or modify "); + php_info_print("it under the terms of the PHP License as published by the PHP Group "); + php_info_print("and included in the distribution in the file: LICENSE\n"); + php_info_print("

\n"); + php_info_print("

"); + php_info_print("This program is distributed in the hope that it will be useful, "); + php_info_print("but WITHOUT ANY WARRANTY; without even the implied warranty of "); + php_info_print("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); + php_info_print("

\n"); + php_info_print("

"); + php_info_print("If you did not receive a copy of the PHP license, or have any questions about "); + php_info_print("PHP licensing, please contact license@php.net.\n"); + php_info_print("

\n"); + php_info_print_box_end(); + } else { + php_info_print("\nPHP License\n"); + php_info_print("This program is free software; you can redistribute it and/or modify\n"); + php_info_print("it under the terms of the PHP License as published by the PHP Group\n"); + php_info_print("and included in the distribution in the file: LICENSE\n"); + php_info_print("\n"); + php_info_print("This program is distributed in the hope that it will be useful,\n"); + php_info_print("but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); + php_info_print("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); + php_info_print("\n"); + php_info_print("If you did not receive a copy of the PHP license, or have any\n"); + php_info_print("questions about PHP licensing, please contact license@php.net.\n"); + } + } + if (!sapi_module.phpinfo_as_text) { + php_info_print("
"); + } +} +/* }}} */ + +PHPAPI void php_info_print_table_start(void) /* {{{ */ +{ + if (!sapi_module.phpinfo_as_text) { + php_info_print("\n"); + } else { + php_info_print("\n"); + } +} +/* }}} */ + +PHPAPI void php_info_print_table_end(void) /* {{{ */ +{ + if (!sapi_module.phpinfo_as_text) { + php_info_print("

\n"); + } + +} +/* }}} */ + +PHPAPI void php_info_print_box_start(int flag) /* {{{ */ +{ + php_info_print_table_start(); + if (flag) { + if (!sapi_module.phpinfo_as_text) { + php_info_print("\n"); + } + } else { + if (!sapi_module.phpinfo_as_text) { + php_info_print("\n"); + } else { + php_info_print("\n"); + } + } +} +/* }}} */ + +PHPAPI void php_info_print_box_end(void) /* {{{ */ +{ + if (!sapi_module.phpinfo_as_text) { + php_info_print("\n"); + } + php_info_print_table_end(); +} +/* }}} */ + +PHPAPI void php_info_print_hr(void) /* {{{ */ +{ + if (!sapi_module.phpinfo_as_text) { + php_info_print("
\n"); + } else { + php_info_print("\n\n _______________________________________________________________________\n\n"); + } +} +/* }}} */ + +PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header) /* {{{ */ +{ + int spaces; + + if (!sapi_module.phpinfo_as_text) { + php_info_printf("%s\n", num_cols, header ); + } else { + spaces = (74 - strlen(header)); + php_info_printf("%*s%s%*s\n", (int)(spaces/2), " ", header, (int)(spaces/2), " "); + } +} +/* }}} */ + +/* {{{ php_info_print_table_header + */ +PHPAPI void php_info_print_table_header(int num_cols, ...) +{ + int i; + va_list row_elements; + char *row_element; + + va_start(row_elements, num_cols); + if (!sapi_module.phpinfo_as_text) { + php_info_print(""); + } + for (i=0; i"); + php_info_print(row_element); + php_info_print(""); + } else { + php_info_print(row_element); + if (i < num_cols-1) { + php_info_print(" => "); + } else { + php_info_print("\n"); + } + } + } + if (!sapi_module.phpinfo_as_text) { + php_info_print("\n"); + } + + va_end(row_elements); +} +/* }}} */ + +/* {{{ php_info_print_table_row_internal + */ +static void php_info_print_table_row_internal(int num_cols, + const char *value_class, va_list row_elements) +{ + int i; + char *row_element; + + if (!sapi_module.phpinfo_as_text) { + php_info_print(""); + } + for (i=0; i", + (i==0 ? "e" : value_class ) + ); + } + row_element = va_arg(row_elements, char *); + if (!row_element || !*row_element) { + if (!sapi_module.phpinfo_as_text) { + php_info_print( "no value" ); + } else { + php_info_print( " " ); + } + } else { + if (!sapi_module.phpinfo_as_text) { + php_info_print_html_esc(row_element, strlen(row_element)); + } else { + php_info_print(row_element); + if (i < num_cols-1) { + php_info_print(" => "); + } + } + } + if (!sapi_module.phpinfo_as_text) { + php_info_print(" "); + } else if (i == (num_cols - 1)) { + php_info_print("\n"); + } + } + if (!sapi_module.phpinfo_as_text) { + php_info_print("\n"); + } +} +/* }}} */ + +/* {{{ php_info_print_table_row + */ +PHPAPI void php_info_print_table_row(int num_cols, ...) +{ + va_list row_elements; + + va_start(row_elements, num_cols); + php_info_print_table_row_internal(num_cols, "v", row_elements); + va_end(row_elements); +} +/* }}} */ + +/* {{{ php_info_print_table_row_ex + */ +PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class, + ...) +{ + va_list row_elements; + + va_start(row_elements, value_class); + php_info_print_table_row_internal(num_cols, value_class, row_elements); + va_end(row_elements); +} +/* }}} */ + +/* {{{ register_phpinfo_constants + */ +void register_phpinfo_constants(INIT_FUNC_ARGS) +{ + REGISTER_LONG_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_GENERAL", PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_SAPI", PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_MODULES", PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_DOCS", PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_FULLPAGE", PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_QA", PHP_CREDITS_QA, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_ALL", PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS); +} +/* }}} */ + +/* {{{ proto void phpinfo([int what]) + Output a page of useful information about PHP and the current request */ +PHP_FUNCTION(phpinfo) +{ + long flag = PHP_INFO_ALL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) { + return; + } + + /* Andale! Andale! Yee-Hah! */ + php_output_start_default(TSRMLS_C); + php_print_info(flag TSRMLS_CC); + php_output_end(TSRMLS_C); + + RETURN_TRUE; +} + +/* }}} */ + +/* {{{ proto string phpversion([string extension]) + Return the current PHP version */ +PHP_FUNCTION(phpversion) +{ + char *ext_name = NULL; + int ext_name_len = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &ext_name, &ext_name_len) == FAILURE) { + return; + } + + if (!ext_name) { + RETURN_STRING(PHP_VERSION, 1); + } else { + const char *version; + version = zend_get_module_version(ext_name); + if (version == NULL) { + RETURN_FALSE; + } + RETURN_STRING(version, 1); + } +} +/* }}} */ + +/* {{{ proto void phpcredits([int flag]) + Prints the list of people who've contributed to the PHP project */ +PHP_FUNCTION(phpcredits) +{ + long flag = PHP_CREDITS_ALL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) { + return; + } + + php_print_credits(flag TSRMLS_CC); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ php_logo_guid + */ +PHPAPI char *php_logo_guid(void) +{ + char *logo_guid; + + time_t the_time; + struct tm *ta, tmbuf; + + the_time = time(NULL); + ta = php_localtime_r(&the_time, &tmbuf); + + if (ta && (ta->tm_mon==3) && (ta->tm_mday==1)) { + logo_guid = PHP_EGG_LOGO_GUID; + } else { + logo_guid = PHP_LOGO_GUID; + } + + return estrdup(logo_guid); + +} +/* }}} */ + +/* {{{ proto string php_logo_guid(void) + Return the special ID used to request the PHP logo in phpinfo screens*/ +PHP_FUNCTION(php_logo_guid) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + RETURN_STRING(php_logo_guid(), 0); +} +/* }}} */ + +/* {{{ proto string php_real_logo_guid(void) + Return the special ID used to request the PHP logo in phpinfo screens*/ +PHP_FUNCTION(php_real_logo_guid) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + RETURN_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1); +} +/* }}} */ + +/* {{{ proto string php_egg_logo_guid(void) + Return the special ID used to request the PHP logo in phpinfo screens*/ +PHP_FUNCTION(php_egg_logo_guid) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + RETURN_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1); +} +/* }}} */ + +/* {{{ proto string zend_logo_guid(void) + Return the special ID used to request the Zend logo in phpinfo screens*/ +PHP_FUNCTION(zend_logo_guid) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + RETURN_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1); +} +/* }}} */ + +/* {{{ proto string php_sapi_name(void) + Return the current SAPI module name */ +PHP_FUNCTION(php_sapi_name) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + if (sapi_module.name) { + RETURN_STRING(sapi_module.name, 1); + } else { + RETURN_FALSE; + } +} + +/* }}} */ + +/* {{{ proto string php_uname(void) + Return information about the system PHP was built on */ +PHP_FUNCTION(php_uname) +{ + char *mode = "a"; + int modelen = sizeof("a")-1; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &mode, &modelen) == FAILURE) { + return; + } + RETURN_STRING(php_get_uname(*mode), 0); +} + +/* }}} */ + +/* {{{ proto string php_ini_scanned_files(void) + Return comma-separated string of .ini files parsed from the additional ini dir */ +PHP_FUNCTION(php_ini_scanned_files) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + if (strlen(PHP_CONFIG_FILE_SCAN_DIR) && php_ini_scanned_files) { + RETURN_STRING(php_ini_scanned_files, 1); + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto string php_ini_loaded_file(void) + Return the actual loaded ini filename */ +PHP_FUNCTION(php_ini_loaded_file) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + if (php_ini_opened_path) { + RETURN_STRING(php_ini_opened_path, 1); + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/info.h b/ext/standard/info.h new file mode 100644 index 0000000..aca2079 --- /dev/null +++ b/ext/standard/info.h @@ -0,0 +1,92 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Zeev Suraski | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef INFO_H +#define INFO_H + +#define PHP_ENTRY_NAME_COLOR "#ccccff" +#define PHP_CONTENTS_COLOR "#cccccc" +#define PHP_HEADER_COLOR "#9999cc" + +#define PHP_INFO_GENERAL (1<<0) +#define PHP_INFO_CREDITS (1<<1) +#define PHP_INFO_CONFIGURATION (1<<2) +#define PHP_INFO_MODULES (1<<3) +#define PHP_INFO_ENVIRONMENT (1<<4) +#define PHP_INFO_VARIABLES (1<<5) +#define PHP_INFO_LICENSE (1<<6) +#define PHP_INFO_ALL 0xFFFFFFFF + +#ifndef HAVE_CREDITS_DEFS +#define HAVE_CREDITS_DEFS + +#define PHP_CREDITS_GROUP (1<<0) +#define PHP_CREDITS_GENERAL (1<<1) +#define PHP_CREDITS_SAPI (1<<2) +#define PHP_CREDITS_MODULES (1<<3) +#define PHP_CREDITS_DOCS (1<<4) +#define PHP_CREDITS_FULLPAGE (1<<5) +#define PHP_CREDITS_QA (1<<6) +#define PHP_CREDITS_WEB (1<<7) +#define PHP_CREDITS_ALL 0xFFFFFFFF + +#endif /* HAVE_CREDITS_DEFS */ + +#define PHP_LOGO_GUID "PHPE9568F34-D428-11d2-A769-00AA001ACF42" +#define PHP_EGG_LOGO_GUID "PHPE9568F36-D428-11d2-A769-00AA001ACF42" +#define ZEND_LOGO_GUID "PHPE9568F35-D428-11d2-A769-00AA001ACF42" +#define PHP_CREDITS_GUID "PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000" + +BEGIN_EXTERN_C() +PHP_FUNCTION(phpversion); +PHP_FUNCTION(phpinfo); +PHP_FUNCTION(phpcredits); +PHP_FUNCTION(php_logo_guid); +PHP_FUNCTION(php_real_logo_guid); +PHP_FUNCTION(zend_logo_guid); +PHP_FUNCTION(php_egg_logo_guid); +PHP_FUNCTION(php_sapi_name); +PHP_FUNCTION(php_uname); +PHP_FUNCTION(php_ini_scanned_files); +PHP_FUNCTION(php_ini_loaded_file); +PHPAPI char *php_info_html_esc(char *string TSRMLS_DC); +PHPAPI void php_info_html_esc_write(char *string, int str_len TSRMLS_DC); +PHPAPI void php_print_info_htmlhead(TSRMLS_D); +PHPAPI void php_print_info(int flag TSRMLS_DC); +PHPAPI void php_print_style(void); +PHPAPI void php_info_print_style(TSRMLS_D); +PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header); +PHPAPI void php_info_print_table_header(int num_cols, ...); +PHPAPI void php_info_print_table_row(int num_cols, ...); +PHPAPI void php_info_print_table_row_ex(int num_cols, const char *, ...); +PHPAPI void php_info_print_table_start(void); +PHPAPI void php_info_print_table_end(void); +PHPAPI void php_info_print_box_start(int bg); +PHPAPI void php_info_print_box_end(void); +PHPAPI void php_info_print_hr(void); +PHPAPI void php_info_print_module(zend_module_entry *module TSRMLS_DC); +PHPAPI char *php_logo_guid(void); +PHPAPI char *php_get_uname(char mode); + +void register_phpinfo_constants(INIT_FUNC_ARGS); +END_EXTERN_C() + +#endif /* INFO_H */ diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c new file mode 100644 index 0000000..729b059 --- /dev/null +++ b/ext/standard/iptc.c @@ -0,0 +1,375 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Thies C. Arntzen | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +/* + * Functions to parse & compse IPTC data. + * PhotoShop >= 3.0 can read and write textual data to JPEG files. + * ... more to come ..... + * + * i know, parts of this is now duplicated in image.c + * but in this case i think it's okay! + */ + +/* + * TODO: + * - add IPTC translation table + */ + +#include "php.h" +#include "php_iptc.h" +#include "ext/standard/head.h" + +#include + + +/* some defines for the different JPEG block types */ +#define M_SOF0 0xC0 /* Start Of Frame N */ +#define M_SOF1 0xC1 /* N indicates which compression process */ +#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ +#define M_SOF3 0xC3 +#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ +#define M_SOF6 0xC6 +#define M_SOF7 0xC7 +#define M_SOF9 0xC9 +#define M_SOF10 0xCA +#define M_SOF11 0xCB +#define M_SOF13 0xCD +#define M_SOF14 0xCE +#define M_SOF15 0xCF +#define M_SOI 0xD8 +#define M_EOI 0xD9 /* End Of Image (end of datastream) */ +#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ +#define M_APP0 0xe0 +#define M_APP1 0xe1 +#define M_APP2 0xe2 +#define M_APP3 0xe3 +#define M_APP4 0xe4 +#define M_APP5 0xe5 +#define M_APP6 0xe6 +#define M_APP7 0xe7 +#define M_APP8 0xe8 +#define M_APP9 0xe9 +#define M_APP10 0xea +#define M_APP11 0xeb +#define M_APP12 0xec +#define M_APP13 0xed +#define M_APP14 0xee +#define M_APP15 0xef + +/* {{{ php_iptc_put1 + */ +static int php_iptc_put1(FILE *fp, int spool, unsigned char c, unsigned char **spoolbuf TSRMLS_DC) +{ + if (spool > 0) + PUTC(c); + + if (spoolbuf) *(*spoolbuf)++ = c; + + return c; +} +/* }}} */ + +/* {{{ php_iptc_get1 + */ +static int php_iptc_get1(FILE *fp, int spool, unsigned char **spoolbuf TSRMLS_DC) +{ + int c; + char cc; + + c = getc(fp); + + if (c == EOF) return EOF; + + if (spool > 0) { + cc = c; + PUTC(cc); + } + + if (spoolbuf) *(*spoolbuf)++ = c; + + return c; +} +/* }}} */ + +/* {{{ php_iptc_read_remaining + */ +static int php_iptc_read_remaining(FILE *fp, int spool, unsigned char **spoolbuf TSRMLS_DC) +{ + while (php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC) != EOF) continue; + + return M_EOI; +} +/* }}} */ + +/* {{{ php_iptc_skip_variable + */ +static int php_iptc_skip_variable(FILE *fp, int spool, unsigned char **spoolbuf TSRMLS_DC) +{ + unsigned int length; + int c1, c2; + + if ((c1 = php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC)) == EOF) return M_EOI; + + if ((c2 = php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC)) == EOF) return M_EOI; + + length = (((unsigned char) c1) << 8) + ((unsigned char) c2); + + length -= 2; + + while (length--) + if (php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC) == EOF) return M_EOI; + + return 0; +} +/* }}} */ + +/* {{{ php_iptc_next_marker + */ +static int php_iptc_next_marker(FILE *fp, int spool, unsigned char **spoolbuf TSRMLS_DC) +{ + int c; + + /* skip unimportant stuff */ + + c = php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC); + + if (c == EOF) return M_EOI; + + while (c != 0xff) { + if ((c = php_iptc_get1(fp, spool, spoolbuf TSRMLS_CC)) == EOF) + return M_EOI; /* we hit EOF */ + } + + /* get marker byte, swallowing possible padding */ + do { + c = php_iptc_get1(fp, 0, 0 TSRMLS_CC); + if (c == EOF) + return M_EOI; /* we hit EOF */ + else + if (c == 0xff) + php_iptc_put1(fp, spool, (unsigned char)c, spoolbuf TSRMLS_CC); + } while (c == 0xff); + + return (unsigned int) c; +} +/* }}} */ + +static char psheader[] = "\xFF\xED\0\0Photoshop 3.0\08BIM\x04\x04\0\0\0\0"; + +/* {{{ proto array iptcembed(string iptcdata, string jpeg_file_name [, int spool]) + Embed binary IPTC data into a JPEG image. */ +PHP_FUNCTION(iptcembed) +{ + char *iptcdata, *jpeg_file; + int iptcdata_len, jpeg_file_len; + long spool = 0; + FILE *fp; + unsigned int marker, done = 0; + int inx; + unsigned char *spoolbuf = NULL, *poi = NULL; + struct stat sb; + zend_bool written = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sp|l", &iptcdata, &iptcdata_len, &jpeg_file, &jpeg_file_len, &spool) != SUCCESS) { + return; + } + + if (php_check_open_basedir(jpeg_file TSRMLS_CC)) { + RETURN_FALSE; + } + + if ((fp = VCWD_FOPEN(jpeg_file, "rb")) == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open %s", jpeg_file); + RETURN_FALSE; + } + + if (spool < 2) { + fstat(fileno(fp), &sb); + + poi = spoolbuf = safe_emalloc(1, iptcdata_len + sizeof(psheader) + sb.st_size + 1024, 1); + memset(poi, 0, iptcdata_len + sizeof(psheader) + sb.st_size + 1024 + 1); + } + + if (php_iptc_get1(fp, spool, poi?&poi:0 TSRMLS_CC) != 0xFF) { + fclose(fp); + if (spoolbuf) { + efree(spoolbuf); + } + RETURN_FALSE; + } + + if (php_iptc_get1(fp, spool, poi?&poi:0 TSRMLS_CC) != 0xD8) { + fclose(fp); + if (spoolbuf) { + efree(spoolbuf); + } + RETURN_FALSE; + } + + while (!done) { + marker = php_iptc_next_marker(fp, spool, poi?&poi:0 TSRMLS_CC); + + if (marker == M_EOI) { /* EOF */ + break; + } else if (marker != M_APP13) { + php_iptc_put1(fp, spool, (unsigned char)marker, poi?&poi:0 TSRMLS_CC); + } + + switch (marker) { + case M_APP13: + /* we are going to write a new APP13 marker, so don't output the old one */ + php_iptc_skip_variable(fp, 0, 0 TSRMLS_CC); + php_iptc_read_remaining(fp, spool, poi?&poi:0 TSRMLS_CC); + done = 1; + break; + + case M_APP0: + /* APP0 is in each and every JPEG, so when we hit APP0 we insert our new APP13! */ + case M_APP1: + if (written) { + /* don't try to write the data twice */ + break; + } + written = 1; + + php_iptc_skip_variable(fp, spool, poi?&poi:0 TSRMLS_CC); + + if (iptcdata_len & 1) { + iptcdata_len++; /* make the length even */ + } + + psheader[ 2 ] = (iptcdata_len+28)>>8; + psheader[ 3 ] = (iptcdata_len+28)&0xff; + + for (inx = 0; inx < 28; inx++) { + php_iptc_put1(fp, spool, psheader[inx], poi?&poi:0 TSRMLS_CC); + } + + php_iptc_put1(fp, spool, (unsigned char)(iptcdata_len>>8), poi?&poi:0 TSRMLS_CC); + php_iptc_put1(fp, spool, (unsigned char)(iptcdata_len&0xff), poi?&poi:0 TSRMLS_CC); + + for (inx = 0; inx < iptcdata_len; inx++) { + php_iptc_put1(fp, spool, iptcdata[inx], poi?&poi:0 TSRMLS_CC); + } + break; + + case M_SOS: + /* we hit data, no more marker-inserting can be done! */ + php_iptc_read_remaining(fp, spool, poi?&poi:0 TSRMLS_CC); + done = 1; + break; + + default: + php_iptc_skip_variable(fp, spool, poi?&poi:0 TSRMLS_CC); + break; + } + } + + fclose(fp); + + if (spool < 2) { + RETVAL_STRINGL(spoolbuf, poi - spoolbuf, 0); + } else { + RETURN_TRUE; + } +} +/* }}} */ + +/* {{{ proto array iptcparse(string iptcdata) + Parse binary IPTC-data into associative array */ +PHP_FUNCTION(iptcparse) +{ + int inx = 0, len; + unsigned int tagsfound = 0; + unsigned char *buffer, recnum, dataset, key[ 16 ]; + char *str; + int str_len; + zval *values, **element; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) != SUCCESS) { + return; + } + + buffer = (unsigned char *)str; + + while (inx < str_len) { /* find 1st tag */ + if ((buffer[inx] == 0x1c) && ((buffer[inx+1] == 0x01) || (buffer[inx+1] == 0x02))){ + break; + } else { + inx++; + } + } + + while (inx < str_len) { + if (buffer[ inx++ ] != 0x1c) { + break; /* we ran against some data which does not conform to IPTC - stop parsing! */ + } + + if ((inx + 4) >= str_len) + break; + + dataset = buffer[ inx++ ]; + recnum = buffer[ inx++ ]; + + if (buffer[ inx ] & (unsigned char) 0x80) { /* long tag */ + len = (((long) buffer[ inx + 2 ]) << 24) + (((long) buffer[ inx + 3 ]) << 16) + + (((long) buffer[ inx + 4 ]) << 8) + (((long) buffer[ inx + 5 ])); + inx += 6; + } else { /* short tag */ + len = (((unsigned short) buffer[ inx ])<<8) | (unsigned short)buffer[ inx+1 ]; + inx += 2; + } + + if ((len < 0) || (len > str_len) || (inx + len) > str_len) { + break; + } + + snprintf(key, sizeof(key), "%d#%03d", (unsigned int) dataset, (unsigned int) recnum); + + if (tagsfound == 0) { /* found the 1st tag - initialize the return array */ + array_init(return_value); + } + + if (zend_hash_find(Z_ARRVAL_P(return_value), key, strlen(key) + 1, (void **) &element) == FAILURE) { + MAKE_STD_ZVAL(values); + array_init(values); + + zend_hash_update(Z_ARRVAL_P(return_value), key, strlen(key) + 1, (void *) &values, sizeof(zval*), (void **) &element); + } + + add_next_index_stringl(*element, buffer+inx, len, 1); + inx += len; + tagsfound++; + } + + if (! tagsfound) { + RETURN_FALSE; + } +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c new file mode 100644 index 0000000..8bbe603 --- /dev/null +++ b/ext/standard/lcg.c @@ -0,0 +1,132 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Sascha Schumann | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "php_lcg.h" + +#if HAVE_UNISTD_H +#include +#endif + +#ifdef PHP_WIN32 +#include "win32/time.h" +#else +#include +#endif + +#ifdef ZTS +int lcg_globals_id; +#else +static php_lcg_globals lcg_globals; +#endif + +#ifdef PHP_WIN32 +#include +#endif + +/* + * combinedLCG() returns a pseudo random number in the range of (0, 1). + * The function combines two CGs with periods of + * 2^31 - 85 and 2^31 - 249. The period of this function + * is equal to the product of both primes. + */ + +#define MODMULT(a, b, c, m, s) q = s/a;s=b*(s-a*q)-c*q;if(s<0)s+=m + +static void lcg_seed(TSRMLS_D); + +PHPAPI double php_combined_lcg(TSRMLS_D) /* {{{ */ +{ + php_int32 q; + php_int32 z; + + if (!LCG(seeded)) { + lcg_seed(TSRMLS_C); + } + + MODMULT(53668, 40014, 12211, 2147483563L, LCG(s1)); + MODMULT(52774, 40692, 3791, 2147483399L, LCG(s2)); + + z = LCG(s1) - LCG(s2); + if (z < 1) { + z += 2147483562; + } + + return z * 4.656613e-10; +} +/* }}} */ + +static void lcg_seed(TSRMLS_D) /* {{{ */ +{ + struct timeval tv; + + if (gettimeofday(&tv, NULL) == 0) { + LCG(s1) = tv.tv_sec ^ (tv.tv_usec<<11); + } else { + LCG(s1) = 1; + } +#ifdef ZTS + LCG(s2) = (long) tsrm_thread_id(); +#else + LCG(s2) = (long) getpid(); +#endif + + /* Add entropy to s2 by calling gettimeofday() again */ + if (gettimeofday(&tv, NULL) == 0) { + LCG(s2) ^= (tv.tv_usec<<11); + } + + LCG(seeded) = 1; +} +/* }}} */ + +static void lcg_init_globals(php_lcg_globals *lcg_globals_p TSRMLS_DC) /* {{{ */ +{ + LCG(seeded) = 0; +} +/* }}} */ + +PHP_MINIT_FUNCTION(lcg) /* {{{ */ +{ +#ifdef ZTS + ts_allocate_id(&lcg_globals_id, sizeof(php_lcg_globals), (ts_allocate_ctor) lcg_init_globals, NULL); +#else + lcg_init_globals(&lcg_globals); +#endif + return SUCCESS; +} +/* }}} */ + +/* {{{ proto float lcg_value() + Returns a value from the combined linear congruential generator */ +PHP_FUNCTION(lcg_value) +{ + RETURN_DOUBLE(php_combined_lcg(TSRMLS_C)); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c new file mode 100644 index 0000000..c492982 --- /dev/null +++ b/ext/standard/levenshtein.c @@ -0,0 +1,142 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Hartmut Holzgraefe | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#include "php.h" +#include +#include +#include +#include "php_string.h" + +#define LEVENSHTEIN_MAX_LENGTH 255 + +/* {{{ reference_levdist + * reference implementation, only optimized for memory usage, not speed */ +static int reference_levdist(const char *s1, int l1, const char *s2, int l2, int cost_ins, int cost_rep, int cost_del ) +{ + int *p1, *p2, *tmp; + int i1, i2, c0, c1, c2; + + if (l1 == 0) { + return l2 * cost_ins; + } + if (l2 == 0) { + return l1 * cost_del; + } + + if ((l1 > LEVENSHTEIN_MAX_LENGTH) || (l2 > LEVENSHTEIN_MAX_LENGTH)) { + return -1; + } + p1 = safe_emalloc((l2 + 1), sizeof(int), 0); + p2 = safe_emalloc((l2 + 1), sizeof(int), 0); + + for (i2 = 0; i2 <= l2; i2++) { + p1[i2] = i2 * cost_ins; + } + for (i1 = 0; i1 < l1 ; i1++) { + p2[0] = p1[0] + cost_del; + + for (i2 = 0; i2 < l2; i2++) { + c0 = p1[i2] + ((s1[i1] == s2[i2]) ? 0 : cost_rep); + c1 = p1[i2 + 1] + cost_del; + if (c1 < c0) { + c0 = c1; + } + c2 = p2[i2] + cost_ins; + if (c2 < c0) { + c0 = c2; + } + p2[i2 + 1] = c0; + } + tmp = p1; + p1 = p2; + p2 = tmp; + } + c0 = p1[l2]; + + efree(p1); + efree(p2); + + return c0; +} +/* }}} */ + +/* {{{ custom_levdist + */ +static int custom_levdist(char *str1, char *str2, char *callback_name TSRMLS_DC) +{ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The general Levenshtein support is not there yet"); + /* not there yet */ + + return -1; +} +/* }}} */ + +/* {{{ proto int levenshtein(string str1, string str2[, int cost_ins, int cost_rep, int cost_del]) + Calculate Levenshtein distance between two strings */ +PHP_FUNCTION(levenshtein) +{ + int argc = ZEND_NUM_ARGS(); + char *str1, *str2; + char *callback_name; + int str1_len, str2_len, callback_len; + long cost_ins, cost_rep, cost_del; + int distance = -1; + + switch (argc) { + case 2: /* just two strings: use maximum performance version */ + if (zend_parse_parameters(2 TSRMLS_CC, "ss", &str1, &str1_len, &str2, &str2_len) == FAILURE) { + return; + } + distance = reference_levdist(str1, str1_len, str2, str2_len, 1, 1, 1); + break; + + case 5: /* more general version: calc cost by ins/rep/del weights */ + if (zend_parse_parameters(5 TSRMLS_CC, "sslll", &str1, &str1_len, &str2, &str2_len, &cost_ins, &cost_rep, &cost_del) == FAILURE) { + return; + } + distance = reference_levdist(str1, str1_len, str2, str2_len, cost_ins, cost_rep, cost_del); + break; + + case 3: /* most general version: calc cost by user-supplied function */ + if (zend_parse_parameters(3 TSRMLS_CC, "sss", &str1, &str1_len, &str2, &str2_len, &callback_name, &callback_len) == FAILURE) { + return; + } + distance = custom_levdist(str1, str2, callback_name TSRMLS_CC); + break; + + default: + WRONG_PARAM_COUNT; + } + + if (distance < 0 && /* TODO */ ZEND_NUM_ARGS() != 3) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument string(s) too long"); + } + + RETURN_LONG(distance); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/link.c b/ext/standard/link.c new file mode 100644 index 0000000..8da6395 --- /dev/null +++ b/ext/standard/link.c @@ -0,0 +1,232 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#include "php.h" +#include "php_filestat.h" +#include "php_globals.h" + +#ifdef HAVE_SYMLINK + +#include +#if HAVE_UNISTD_H +#include +#endif +#include +#include +#if HAVE_PWD_H +#ifdef PHP_WIN32 +#include "win32/pwd.h" +#else +#include +#endif +#endif +#if HAVE_GRP_H +#ifdef PHP_WIN32 +#include "win32/grp.h" +#else +#include +#endif +#endif +#include +#include + +#include "php_link.h" +#include "php_string.h" + +/* {{{ proto string readlink(string filename) + Return the target of a symbolic link */ +PHP_FUNCTION(readlink) +{ + char *link; + int link_len; + char buff[MAXPATHLEN]; + int ret; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &link, &link_len) == FAILURE) { + return; + } + + if (php_check_open_basedir(link TSRMLS_CC)) { + RETURN_FALSE; + } + + ret = php_sys_readlink(link, buff, MAXPATHLEN-1); + + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + RETURN_FALSE; + } + /* Append NULL to the end of the string */ + buff[ret] = '\0'; + + RETURN_STRING(buff, 1); +} +/* }}} */ + +/* {{{ proto int linkinfo(string filename) + Returns the st_dev field of the UNIX C stat structure describing the link */ +PHP_FUNCTION(linkinfo) +{ + char *link; + char *dirname; + int link_len, dir_len; + struct stat sb; + int ret; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &link, &link_len) == FAILURE) { + return; + } + + dirname = estrndup(link, link_len); + dir_len = php_dirname(dirname, link_len); + + if (php_check_open_basedir(dirname TSRMLS_CC)) { + efree(dirname); + RETURN_FALSE; + } + + ret = VCWD_LSTAT(link, &sb); + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + efree(dirname); + RETURN_LONG(-1L); + } + + efree(dirname); + RETURN_LONG((long) sb.st_dev); +} +/* }}} */ + +/* {{{ proto int symlink(string target, string link) + Create a symbolic link */ +PHP_FUNCTION(symlink) +{ + char *topath, *frompath; + int topath_len, frompath_len; + int ret; + char source_p[MAXPATHLEN]; + char dest_p[MAXPATHLEN]; + char dirname[MAXPATHLEN]; + size_t len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &topath, &topath_len, &frompath, &frompath_len) == FAILURE) { + return; + } + + if (!expand_filepath(frompath, source_p TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such file or directory"); + RETURN_FALSE; + } + + memcpy(dirname, source_p, sizeof(source_p)); + len = php_dirname(dirname, strlen(dirname)); + + if (!expand_filepath_ex(topath, dest_p, dirname, len TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such file or directory"); + RETURN_FALSE; + } + + if (php_stream_locate_url_wrapper(source_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) || + php_stream_locate_url_wrapper(dest_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ) + { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to symlink to a URL"); + RETURN_FALSE; + } + + if (php_check_open_basedir(dest_p TSRMLS_CC)) { + RETURN_FALSE; + } + + if (php_check_open_basedir(source_p TSRMLS_CC)) { + RETURN_FALSE; + } + + /* For the source, an expanded path must be used (in ZTS an other thread could have changed the CWD). + * For the target the exact string given by the user must be used, relative or not, existing or not. + * The target is relative to the link itself, not to the CWD. */ + ret = symlink(topath, source_p); + + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + RETURN_FALSE; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto int link(string target, string link) + Create a hard link */ +PHP_FUNCTION(link) +{ + char *topath, *frompath; + int topath_len, frompath_len; + int ret; + char source_p[MAXPATHLEN]; + char dest_p[MAXPATHLEN]; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &topath, &topath_len, &frompath, &frompath_len) == FAILURE) { + return; + } + + if (!expand_filepath(frompath, source_p TSRMLS_CC) || !expand_filepath(topath, dest_p TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such file or directory"); + RETURN_FALSE; + } + + if (php_stream_locate_url_wrapper(source_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) || + php_stream_locate_url_wrapper(dest_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ) + { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to link to a URL"); + RETURN_FALSE; + } + + if (php_check_open_basedir(dest_p TSRMLS_CC)) { + RETURN_FALSE; + } + + if (php_check_open_basedir(source_p TSRMLS_CC)) { + RETURN_FALSE; + } + +#ifndef ZTS + ret = link(topath, frompath); +#else + ret = link(dest_p, source_p); +#endif + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + RETURN_FALSE; + } + + RETURN_TRUE; +} +/* }}} */ + +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/ext/standard/link_win32.c b/ext/standard/link_win32.c new file mode 100644 index 0000000..674745e --- /dev/null +++ b/ext/standard/link_win32.c @@ -0,0 +1,248 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Pierre A. Joye | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ +#ifdef PHP_WIN32 + +#include "php.h" +#include "php_filestat.h" +#include "php_globals.h" + +#include + +#include + +#include +#if HAVE_PWD_H +#include "win32/pwd.h" +#endif + +#if HAVE_GRP_H +#include "win32/grp.h" +#endif + +#include +#include + +#include "php_link.h" +#include "php_string.h" + +/* +TODO: +- Create php_readlink (done), php_link and php_symlink in win32/link.c +- Expose them (PHPAPI) so extensions developers can use them +- define link/readlink/symlink to their php_ equivalent and use them in ext/standart/link.c +- this file is then useless and we have a portable link API +*/ + +#ifndef VOLUME_NAME_NT +#define VOLUME_NAME_NT 0x2 +#endif + +#ifndef VOLUME_NAME_DOS +#define VOLUME_NAME_DOS 0x0 +#endif + +/* {{{ proto string readlink(string filename) + Return the target of a symbolic link */ +PHP_FUNCTION(readlink) +{ + char *link; + int link_len; + char target[MAXPATHLEN]; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &link, &link_len) == FAILURE) { + return; + } + + if (OPENBASEDIR_CHECKPATH(link)) { + RETURN_FALSE; + } + + if (php_sys_readlink(link, target, MAXPATHLEN) == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "readlink failed to read the symbolic link (%s), error %d)", link, GetLastError()); + RETURN_FALSE; + } + RETURN_STRING(target, 1); +} +/* }}} */ + +/* {{{ proto int linkinfo(string filename) + Returns the st_dev field of the UNIX C stat structure describing the link */ +PHP_FUNCTION(linkinfo) +{ + char *link; + int link_len; + struct stat sb; + int ret; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &link, &link_len) == FAILURE) { + return; + } + + ret = VCWD_STAT(link, &sb); + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + RETURN_LONG(-1L); + } + + RETURN_LONG((long) sb.st_dev); +} +/* }}} */ + +/* {{{ proto int symlink(string target, string link) + Create a symbolic link */ +PHP_FUNCTION(symlink) +{ + char *topath, *frompath; + int topath_len, frompath_len; + BOOLEAN ret; + char source_p[MAXPATHLEN]; + char dest_p[MAXPATHLEN]; + char dirname[MAXPATHLEN]; + size_t len; + DWORD attr; + HINSTANCE kernel32; + typedef BOOLEAN (WINAPI *csla_func)(LPCSTR, LPCSTR, DWORD); + csla_func pCreateSymbolicLinkA; + + kernel32 = LoadLibrary("kernel32.dll"); + + if (kernel32) { + pCreateSymbolicLinkA = (csla_func)GetProcAddress(kernel32, "CreateSymbolicLinkA"); + if (pCreateSymbolicLinkA == NULL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't call CreateSymbolicLinkA"); + RETURN_FALSE; + } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't call get a handle on kernel32.dll"); + RETURN_FALSE; + } + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &topath, &topath_len, &frompath, &frompath_len) == FAILURE) { + return; + } + + if (!expand_filepath(frompath, source_p TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such file or directory"); + RETURN_FALSE; + } + + memcpy(dirname, source_p, sizeof(source_p)); + len = php_dirname(dirname, strlen(dirname)); + + if (!expand_filepath_ex(topath, dest_p, dirname, len TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such file or directory"); + RETURN_FALSE; + } + + if (php_stream_locate_url_wrapper(source_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) || + php_stream_locate_url_wrapper(dest_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ) + { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to symlink to a URL"); + RETURN_FALSE; + } + + if (OPENBASEDIR_CHECKPATH(dest_p)) { + RETURN_FALSE; + } + + if (OPENBASEDIR_CHECKPATH(source_p)) { + RETURN_FALSE; + } + + if ((attr = GetFileAttributes(topath)) == INVALID_FILE_ATTRIBUTES) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not fetch file information(error %d)", GetLastError()); + RETURN_FALSE; + } + + /* For the source, an expanded path must be used (in ZTS an other thread could have changed the CWD). + * For the target the exact string given by the user must be used, relative or not, existing or not. + * The target is relative to the link itself, not to the CWD. */ + ret = pCreateSymbolicLinkA(source_p, topath, (attr & FILE_ATTRIBUTE_DIRECTORY ? 1 : 0)); + + if (!ret) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create symlink, error code(%d)", GetLastError()); + RETURN_FALSE; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto int link(string target, string link) + Create a hard link */ +PHP_FUNCTION(link) +{ + char *topath, *frompath; + int topath_len, frompath_len; + int ret; + char source_p[MAXPATHLEN]; + char dest_p[MAXPATHLEN]; + + /*First argument to link function is the target and hence should go to frompath + Second argument to link function is the link itself and hence should go to topath */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &frompath, &frompath_len, &topath, &topath_len) == FAILURE) { + return; + } + + if (!expand_filepath(frompath, source_p TSRMLS_CC) || !expand_filepath(topath, dest_p TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such file or directory"); + RETURN_FALSE; + } + + if (php_stream_locate_url_wrapper(source_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) || + php_stream_locate_url_wrapper(dest_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ) + { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to link to a URL"); + RETURN_FALSE; + } + + if (OPENBASEDIR_CHECKPATH(source_p)) { + RETURN_FALSE; + } + + if (OPENBASEDIR_CHECKPATH(dest_p)) { + RETURN_FALSE; + } + +#ifndef ZTS + ret = CreateHardLinkA(topath, frompath, NULL); +#else + ret = CreateHardLinkA(dest_p, source_p, NULL); +#endif + + if (ret == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); + RETURN_FALSE; + } + + RETURN_TRUE; +} +/* }}} */ + +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/ext/standard/mail.c b/ext/standard/mail.c new file mode 100644 index 0000000..2576681 --- /dev/null +++ b/ext/standard/mail.c @@ -0,0 +1,414 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Rasmus Lerdorf | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#include +#include +#include +#include "php.h" +#include "ext/standard/info.h" +#include "ext/standard/php_string.h" +#include "ext/standard/basic_functions.h" + +#if HAVE_SYSEXITS_H +#include +#endif +#if HAVE_SYS_SYSEXITS_H +#include +#endif + +#if PHP_SIGCHILD +#if HAVE_SIGNAL_H +#include +#endif +#endif + +#include "php_syslog.h" +#include "php_mail.h" +#include "php_ini.h" +#include "php_string.h" +#include "exec.h" + +#ifdef PHP_WIN32 +#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; \ + while (str[pos + 1] == ' ' || str[pos + 1] == '\t') { \ + pos++; \ + } \ + continue; \ + } \ + +#define MAIL_ASCIIZ_CHECK(str, len) \ + p = str; \ + e = p + len; \ + while ((p = memchr(p, '\0', (e - p)))) { \ + *p = ' '; \ + } \ + +extern long php_getuid(TSRMLS_D); + +/* {{{ proto int ezmlm_hash(string addr) + Calculate EZMLM list hash value. */ +PHP_FUNCTION(ezmlm_hash) +{ + char *str = NULL; + unsigned int h = 5381; + int j, str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + return; + } + + for (j = 0; j < str_len; j++) { + h = (h + (h << 5)) ^ (unsigned long) (unsigned char) tolower(str[j]); + } + + h = (h % 53); + + RETURN_LONG((int) h); +} +/* }}} */ + +/* {{{ 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, *headers=NULL, *headers_trimmed=NULL; + char *subject=NULL, *extra_cmd=NULL; + int to_len, message_len, headers_len = 0; + int subject_len, extra_cmd_len = 0, 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() TSRMLS_CC, "sss|ss", &to, &to_len, &subject, &subject_len, &message, &message_len, &headers, &headers_len, &extra_cmd, &extra_cmd_len) == FAILURE) { + return; + } + + /* 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(headers, headers_len); + headers_trimmed = php_trim(headers, headers_len, NULL, 0, NULL, 2 TSRMLS_CC); + } + if (extra_cmd) { + MAIL_ASCIIZ_CHECK(extra_cmd, extra_cmd_len); + } + + if (to_len > 0) { + to_r = estrndup(to, to_len); + for (; to_len; to_len--) { + if (!isspace((unsigned char) to_r[to_len - 1])) { + break; + } + to_r[to_len - 1] = '\0'; + } + for (i = 0; to_r[i]; i++) { + if (iscntrl((unsigned char) to_r[i])) { + /* According to RFC 822, section 3.1.1 long headers may be separated into + * parts using CRLF followed at least one linear-white-space character ('\t' or ' '). + * To prevent these separators from being replaced with a space, we use the + * SKIP_LONG_HEADER_SEP to skip over them. */ + SKIP_LONG_HEADER_SEP(to_r, i); + to_r[i] = ' '; + } + } + } else { + to_r = to; + } + + if (subject_len > 0) { + subject_r = estrndup(subject, subject_len); + for (; subject_len; subject_len--) { + if (!isspace((unsigned char) subject_r[subject_len - 1])) { + break; + } + subject_r[subject_len - 1] = '\0'; + } + for (i = 0; subject_r[i]; i++) { + if (iscntrl((unsigned char) subject_r[i])) { + SKIP_LONG_HEADER_SEP(subject_r, i); + subject_r[i] = ' '; + } + } + } else { + subject_r = subject; + } + + if (force_extra_parameters) { + extra_cmd = php_escape_shell_cmd(force_extra_parameters); + } else if (extra_cmd) { + extra_cmd = php_escape_shell_cmd(extra_cmd); + } + + if (php_mail(to_r, subject_r, message, headers_trimmed, extra_cmd TSRMLS_CC)) { + RETVAL_TRUE; + } else { + RETVAL_FALSE; + } + + if (headers_trimmed) { + efree(headers_trimmed); + } + + if (extra_cmd) { + efree (extra_cmd); + } + if (to_r != to) { + efree(to_r); + } + if (subject_r != subject) { + efree(subject_r); + } +} +/* }}} */ + + +void php_mail_log_crlf_to_spaces(char *message) { + /* Find all instances of carriage returns or line feeds and + * replace them with spaces. Thus, a log line is always one line + * long + */ + char *p = message; + while ((p = strpbrk(p, "\r\n"))) { + *p = ' '; + } +} + +void php_mail_log_to_syslog(char *message) { + /* Write 'message' to syslog. */ +#ifdef HAVE_SYSLOG_H + php_syslog(LOG_NOTICE, "%s", message); +#endif +} + + +void php_mail_log_to_file(char *filename, char *message, size_t message_size TSRMLS_DC) { + /* Write 'message' to the given file. */ + uint 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); + php_stream_close(stream); + } +} + + +/* {{{ php_mail + */ +PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd TSRMLS_DC) +{ +#if (defined PHP_WIN32 || defined NETWARE) + int tsm_err; + char *tsm_errmsg = NULL; +#endif + FILE *sendmail; + int ret; + char *sendmail_path = INI_STR("sendmail_path"); + char *sendmail_cmd = NULL; + char *mail_log = INI_STR("mail.log"); + char *hdr = headers; +#if PHP_SIGCHILD + void (*sig_handler)() = NULL; +#endif + +#define MAIL_RET(val) \ + if (hdr != headers) { \ + efree(hdr); \ + } \ + return val; \ + + if (mail_log && *mail_log) { + char *tmp; + int l = spprintf(&tmp, 0, "mail() on [%s:%d]: To: %s -- Headers: %s\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C), to, hdr ? hdr : ""); + + if (hdr) { + php_mail_log_crlf_to_spaces(tmp); + } + + if (!strcmp(mail_log, "syslog")) { + /* Drop the final space when logging to syslog. */ + tmp[l - 1] = 0; + php_mail_log_to_syslog(tmp); + } + else { + /* Convert the final space to a newline when logging to file. */ + tmp[l - 1] = '\n'; + php_mail_log_to_file(mail_log, tmp, l TSRMLS_CC); + } + + efree(tmp); + } + if (PG(mail_x_header)) { + const char *tmp = zend_get_executed_filename(TSRMLS_C); + char *f; + size_t f_len; + + php_basename(tmp, strlen(tmp), NULL, 0,&f, &f_len TSRMLS_CC); + + if (headers != NULL) { + spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n%s", php_getuid(TSRMLS_C), f, headers); + } else { + spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n", php_getuid(TSRMLS_C), f); + } + efree(f); + } + + if (!sendmail_path) { +#if (defined PHP_WIN32 || defined NETWARE) + /* handle old style win smtp sending */ + if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, hdr, subject, to, message, NULL, NULL, NULL TSRMLS_CC) == FAILURE) { + if (tsm_errmsg) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", tsm_errmsg); + efree(tsm_errmsg); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", GetSMErrorText(tsm_err)); + } + MAIL_RET(0); + } + MAIL_RET(1); +#else + MAIL_RET(0); +#endif + } + if (extra_cmd != NULL) { + spprintf(&sendmail_cmd, 0, "%s %s", sendmail_path, extra_cmd); + } else { + sendmail_cmd = sendmail_path; + } + +#if PHP_SIGCHILD + /* Set signal handler of SIGCHLD to default to prevent other signal handlers + * from being called and reaping the return code when our child exits. + * The original handler needs to be restored after pclose() */ + sig_handler = (void *)signal(SIGCHLD, SIG_DFL); + if (sig_handler == SIG_ERR) { + sig_handler = NULL; + } +#endif + +#ifdef PHP_WIN32 + sendmail = popen_ex(sendmail_cmd, "wb", NULL, NULL TSRMLS_CC); +#else + /* Since popen() doesn't indicate if the internal fork() doesn't work + * (e.g. the shell can't be executed) we explicitely set it to 0 to be + * sure we don't catch any older errno value. */ + errno = 0; + sendmail = popen(sendmail_cmd, "w"); +#endif + if (extra_cmd != NULL) { + efree (sendmail_cmd); + } + + if (sendmail) { +#ifndef PHP_WIN32 + if (EACCES == errno) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Permission denied: unable to execute shell to run mail delivery binary '%s'", sendmail_path); + pclose(sendmail); +#if PHP_SIGCHILD + /* Restore handler in case of error on Windows + Not sure if this applicable on Win but just in case. */ + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif + MAIL_RET(0); + } +#endif + fprintf(sendmail, "To: %s\n", to); + fprintf(sendmail, "Subject: %s\n", subject); + if (hdr != NULL) { + fprintf(sendmail, "%s\n", hdr); + } + fprintf(sendmail, "\n%s\n", message); + ret = pclose(sendmail); + +#if PHP_SIGCHILD + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif + +#ifdef PHP_WIN32 + if (ret == -1) +#else +#if defined(EX_TEMPFAIL) + if ((ret != EX_OK)&&(ret != EX_TEMPFAIL)) +#elif defined(EX_OK) + if (ret != EX_OK) +#else + if (ret != 0) +#endif +#endif + { + MAIL_RET(0); + } else { + MAIL_RET(1); + } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute mail delivery program '%s'", sendmail_path); +#if PHP_SIGCHILD + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif + MAIL_RET(0); + } + + MAIL_RET(1); /* never reached */ +} +/* }}} */ + +/* {{{ PHP_MINFO_FUNCTION + */ +PHP_MINFO_FUNCTION(mail) +{ + char *sendmail_path = INI_STR("sendmail_path"); + +#ifdef PHP_WIN32 + if (!sendmail_path) { + php_info_print_table_row(2, "Internal Sendmail Support for Windows", "enabled"); + } else { + php_info_print_table_row(2, "Path to sendmail", sendmail_path); + } +#else + php_info_print_table_row(2, "Path to sendmail", sendmail_path); +#endif +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/math.c b/ext/standard/math.c new file mode 100644 index 0000000..be2d655 --- /dev/null +++ b/ext/standard/math.c @@ -0,0 +1,1295 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Jim Winstead | + | Stig SÊther Bakken | + | Zeev Suraski | + | PHP 4.0 patches by Thies C. Arntzen | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "php_math.h" +#include "zend_multiply.h" + +#include +#include +#include + +#include "basic_functions.h" + +/* {{{ php_intlog10abs + Returns floor(log10(fabs(val))), uses fast binary search */ +static inline int php_intlog10abs(double value) { + int result; + value = fabs(value); + + if (value < 1e-8 || value > 1e22) { + result = (int)floor(log10(value)); + } else { + static const double values[] = { + 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, + 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, + 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, + 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22}; + /* Do a binary search with 5 steps */ + result = 15; + if (value < values[result]) { + result -= 8; + } else { + result += 8; + } + if (value < values[result]) { + result -= 4; + } else { + result += 4; + } + if (value < values[result]) { + result -= 2; + } else { + result += 2; + } + if (value < values[result]) { + result -= 1; + } else { + result += 1; + } + if (value < values[result]) { + result -= 1; + } + result -= 8; + } + return result; +} +/* }}} */ + +/* {{{ php_intpow10 + Returns pow(10.0, (double)power), uses fast lookup table for exact powers */ +static inline double php_intpow10(int power) { + static const double powers[] = { + 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, + 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, + 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22}; + + /* Not in lookup table */ + if (power < 0 || power > 22) { + return pow(10.0, (double)power); + } + return powers[power]; +} +/* }}} */ + +/* {{{ php_math_is_finite */ +static inline int php_math_is_finite(double value) { +#if defined(PHP_WIN32) + return _finite(value); +#elif defined(isfinite) + return isfinite(value); +#else + return value == value && (value == 0. || value * 2. != value); +#endif +} +/* }}} */ + +/* {{{ php_round_helper + Actually performs the rounding of a value to integer in a certain mode */ +static inline double php_round_helper(double value, int mode) { + double tmp_value; + + if (value >= 0.0) { + tmp_value = floor(value + 0.5); + if ((mode == PHP_ROUND_HALF_DOWN && value == (-0.5 + tmp_value)) || + (mode == PHP_ROUND_HALF_EVEN && value == (0.5 + 2 * floor(tmp_value/2.0))) || + (mode == PHP_ROUND_HALF_ODD && value == (0.5 + 2 * floor(tmp_value/2.0) - 1.0))) + { + tmp_value = tmp_value - 1.0; + } + } else { + tmp_value = ceil(value - 0.5); + if ((mode == PHP_ROUND_HALF_DOWN && value == (0.5 + tmp_value)) || + (mode == PHP_ROUND_HALF_EVEN && value == (-0.5 + 2 * ceil(tmp_value/2.0))) || + (mode == PHP_ROUND_HALF_ODD && value == (-0.5 + 2 * ceil(tmp_value/2.0) + 1.0))) + { + tmp_value = tmp_value + 1.0; + } + } + + return tmp_value; +} +/* }}} */ + +/* {{{ _php_math_round */ +/* + * Rounds a number to a certain number of decimal places in a certain rounding + * mode. For the specifics of the algorithm, see http://wiki.php.net/rfc/rounding + */ +PHPAPI double _php_math_round(double value, int places, int mode) { + double f1, f2; + double tmp_value; + int precision_places; + + if (!php_math_is_finite(value)) { + return value; + } + + precision_places = 14 - php_intlog10abs(value); + + f1 = php_intpow10(abs(places)); + + /* If the decimal precision guaranteed by FP arithmetic is higher than + the requested places BUT is small enough to make sure a non-zero value + is returned, pre-round the result to the precision */ + if (precision_places > places && precision_places - places < 15) { + f2 = php_intpow10(abs(precision_places)); + if (precision_places >= 0) { + tmp_value = value * f2; + } else { + tmp_value = value / f2; + } + /* preround the result (tmp_value will always be something * 1e14, + thus never larger than 1e15 here) */ + tmp_value = php_round_helper(tmp_value, mode); + /* now correctly move the decimal point */ + f2 = php_intpow10(abs(places - precision_places)); + /* because places < precision_places */ + tmp_value = tmp_value / f2; + } else { + /* adjust the value */ + if (places >= 0) { + tmp_value = value * f1; + } else { + tmp_value = value / f1; + } + /* This value is beyond our precision, so rounding it is pointless */ + if (fabs(tmp_value) >= 1e15) { + return value; + } + } + + /* round the temp value */ + tmp_value = php_round_helper(tmp_value, mode); + + /* see if it makes sense to use simple division to round the value */ + if (abs(places) < 23) { + if (places > 0) { + tmp_value = tmp_value / f1; + } else { + tmp_value = tmp_value * f1; + } + } else { + /* Simple division can't be used since that will cause wrong results. + Instead, the number is converted to a string and back again using + strtod(). strtod() will return the nearest possible FP value for + that string. */ + + /* 40 Bytes should be more than enough for this format string. The + float won't be larger than 1e15 anyway. But just in case, use + snprintf() and make sure the buffer is zero-terminated */ + char buf[40]; + snprintf(buf, 39, "%15fe%d", tmp_value, -places); + buf[39] = '\0'; + tmp_value = zend_strtod(buf, NULL); + /* couldn't convert to string and back */ + if (!zend_finite(tmp_value) || zend_isnan(tmp_value)) { + tmp_value = value; + } + } + + return tmp_value; +} +/* }}} */ + +/* {{{ php_asinh +*/ +static double php_asinh(double z) +{ +#ifdef HAVE_ASINH + return(asinh(z)); +#else + return(log(z + sqrt(1 + pow(z, 2))) / log(M_E)); +#endif +} +/* }}} */ + +/* {{{ php_acosh +*/ +static double php_acosh(double x) +{ +#ifdef HAVE_ACOSH + return(acosh(x)); +#else + return(log(x + sqrt(x * x - 1))); +#endif +} +/* }}} */ + +/* {{{ php_atanh +*/ +static double php_atanh(double z) +{ +#ifdef HAVE_ATANH + return(atanh(z)); +#else + return(0.5 * log((1 + z) / (1 - z))); +#endif +} +/* }}} */ + +/* {{{ php_log1p +*/ +static double php_log1p(double x) +{ +#ifdef HAVE_LOG1P + return(log1p(x)); +#else + return(log(1 + x)); +#endif +} +/* }}} */ + +/* {{{ php_expm1 +*/ +static double php_expm1(double x) +{ +#if !defined(PHP_WIN32) && !defined(NETWARE) + return(expm1(x)); +#else + return(exp(x) - 1); +#endif +} +/* }}}*/ + +/* {{{ proto int abs(int number) + Return the absolute value of the number */ +PHP_FUNCTION(abs) +{ + zval **value; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &value) == FAILURE) { + return; + } + convert_scalar_to_number_ex(value); + + if (Z_TYPE_PP(value) == IS_DOUBLE) { + RETURN_DOUBLE(fabs(Z_DVAL_PP(value))); + } else if (Z_TYPE_PP(value) == IS_LONG) { + if (Z_LVAL_PP(value) == LONG_MIN) { + RETURN_DOUBLE(-(double)LONG_MIN); + } else { + RETURN_LONG(Z_LVAL_PP(value) < 0 ? -Z_LVAL_PP(value) : Z_LVAL_PP(value)); + } + } + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto float ceil(float number) + Returns the next highest integer value of the number */ +PHP_FUNCTION(ceil) +{ + zval **value; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &value) == FAILURE) { + return; + } + convert_scalar_to_number_ex(value); + + if (Z_TYPE_PP(value) == IS_DOUBLE) { + RETURN_DOUBLE(ceil(Z_DVAL_PP(value))); + } else if (Z_TYPE_PP(value) == IS_LONG) { + convert_to_double_ex(value); + RETURN_DOUBLE(Z_DVAL_PP(value)); + } + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto float floor(float number) + Returns the next lowest integer value from the number */ +PHP_FUNCTION(floor) +{ + zval **value; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &value) == FAILURE) { + return; + } + convert_scalar_to_number_ex(value); + + if (Z_TYPE_PP(value) == IS_DOUBLE) { + RETURN_DOUBLE(floor(Z_DVAL_PP(value))); + } else if (Z_TYPE_PP(value) == IS_LONG) { + convert_to_double_ex(value); + RETURN_DOUBLE(Z_DVAL_PP(value)); + } + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto float round(float number [, int precision [, int mode]]) + Returns the number rounded to specified precision */ +PHP_FUNCTION(round) +{ + zval **value; + int places = 0; + long precision = 0; + long mode = PHP_ROUND_HALF_UP; + double return_val; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|ll", &value, &precision, &mode) == FAILURE) { + return; + } + + if (ZEND_NUM_ARGS() >= 2) { + places = (int) precision; + } + convert_scalar_to_number_ex(value); + + switch (Z_TYPE_PP(value)) { + case IS_LONG: + /* Simple case - long that doesn't need to be rounded. */ + if (places >= 0) { + RETURN_DOUBLE((double) Z_LVAL_PP(value)); + } + /* break omitted intentionally */ + + case IS_DOUBLE: + return_val = (Z_TYPE_PP(value) == IS_LONG) ? (double)Z_LVAL_PP(value) : Z_DVAL_PP(value); + return_val = _php_math_round(return_val, places, mode); + RETURN_DOUBLE(return_val); + break; + + default: + RETURN_FALSE; + break; + } +} +/* }}} */ + +/* {{{ proto float sin(float number) + Returns the sine of the number in radians */ +PHP_FUNCTION(sin) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(sin(num)); +} +/* }}} */ + +/* {{{ proto float cos(float number) + Returns the cosine of the number in radians */ +PHP_FUNCTION(cos) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(cos(num)); +} +/* }}} */ + +/* {{{ proto float tan(float number) + Returns the tangent of the number in radians */ +PHP_FUNCTION(tan) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(tan(num)); +} +/* }}} */ + +/* {{{ proto float asin(float number) + Returns the arc sine of the number in radians */ +PHP_FUNCTION(asin) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(asin(num)); +} +/* }}} */ + +/* {{{ proto float acos(float number) + Return the arc cosine of the number in radians */ +PHP_FUNCTION(acos) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(acos(num)); +} +/* }}} */ + +/* {{{ proto float atan(float number) + Returns the arc tangent of the number in radians */ +PHP_FUNCTION(atan) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(atan(num)); +} +/* }}} */ + +/* {{{ proto float atan2(float y, float x) + Returns the arc tangent of y/x, with the resulting quadrant determined by the signs of y and x */ +PHP_FUNCTION(atan2) +{ + double num1, num2; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &num1, &num2) == FAILURE) { + return; + } + RETURN_DOUBLE(atan2(num1, num2)); +} +/* }}} */ + +/* {{{ proto float sinh(float number) + Returns the hyperbolic sine of the number, defined as (exp(number) - exp(-number))/2 */ +PHP_FUNCTION(sinh) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(sinh(num)); +} +/* }}} */ + +/* {{{ proto float cosh(float number) + Returns the hyperbolic cosine of the number, defined as (exp(number) + exp(-number))/2 */ +PHP_FUNCTION(cosh) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(cosh(num)); +} +/* }}} */ + +/* {{{ proto float tanh(float number) + Returns the hyperbolic tangent of the number, defined as sinh(number)/cosh(number) */ +PHP_FUNCTION(tanh) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(tanh(num)); +} +/* }}} */ + +/* {{{ proto float asinh(float number) + Returns the inverse hyperbolic sine of the number, i.e. the value whose hyperbolic sine is number */ +PHP_FUNCTION(asinh) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(php_asinh(num)); +} +/* }}} */ + +/* {{{ proto float acosh(float number) + Returns the inverse hyperbolic cosine of the number, i.e. the value whose hyperbolic cosine is number */ +PHP_FUNCTION(acosh) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(php_acosh(num)); +} +/* }}} */ + +/* {{{ proto float atanh(float number) + Returns the inverse hyperbolic tangent of the number, i.e. the value whose hyperbolic tangent is number */ +PHP_FUNCTION(atanh) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(php_atanh(num)); +} +/* }}} */ + +/* {{{ proto float pi(void) + Returns an approximation of pi */ +PHP_FUNCTION(pi) +{ + RETURN_DOUBLE(M_PI); +} +/* }}} */ + +/* {{{ proto bool is_finite(float val) + Returns whether argument is finite */ +PHP_FUNCTION(is_finite) +{ + double dval; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &dval) == FAILURE) { + return; + } + RETURN_BOOL(zend_finite(dval)); +} +/* }}} */ + +/* {{{ proto bool is_infinite(float val) + Returns whether argument is infinite */ +PHP_FUNCTION(is_infinite) +{ + double dval; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &dval) == FAILURE) { + return; + } + RETURN_BOOL(zend_isinf(dval)); +} +/* }}} */ + +/* {{{ proto bool is_nan(float val) + Returns whether argument is not a number */ +PHP_FUNCTION(is_nan) +{ + double dval; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &dval) == FAILURE) { + return; + } + RETURN_BOOL(zend_isnan(dval)); +} +/* }}} */ + +/* {{{ proto number pow(number base, number exponent) + Returns base raised to the power of exponent. Returns integer result when possible */ +PHP_FUNCTION(pow) +{ + zval *zbase, *zexp; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/z/", &zbase, &zexp) == FAILURE) { + return; + } + + /* make sure we're dealing with numbers */ + convert_scalar_to_number(zbase TSRMLS_CC); + convert_scalar_to_number(zexp TSRMLS_CC); + + /* if both base and exponent were longs, we'll try to get a long out */ + if (Z_TYPE_P(zbase) == IS_LONG && Z_TYPE_P(zexp) == IS_LONG && Z_LVAL_P(zexp) >= 0) { + long l1 = 1, l2 = Z_LVAL_P(zbase), i = Z_LVAL_P(zexp); + + if (i == 0) { + RETURN_LONG(1L); + } else if (l2 == 0) { + RETURN_LONG(0); + } + + /* calculate pow(long,long) in O(log exp) operations, bail if overflow */ + while (i >= 1) { + long overflow; + double dval = 0.0; + + if (i % 2) { + --i; + ZEND_SIGNED_MULTIPLY_LONG(l1,l2,l1,dval,overflow); + if (overflow) RETURN_DOUBLE(dval * pow(l2,i)); + } else { + i /= 2; + ZEND_SIGNED_MULTIPLY_LONG(l2,l2,l2,dval,overflow); + if (overflow) RETURN_DOUBLE((double)l1 * pow(dval,i)); + } + if (i == 0) { + RETURN_LONG(l1); + } + } + } + convert_to_double(zbase); + convert_to_double(zexp); + + RETURN_DOUBLE(pow(Z_DVAL_P(zbase), Z_DVAL_P(zexp))); +} +/* }}} */ + +/* {{{ proto float exp(float number) + Returns e raised to the power of the number */ +PHP_FUNCTION(exp) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + + RETURN_DOUBLE(exp(num)); +} +/* }}} */ + +/* {{{ proto float expm1(float number) + Returns exp(number) - 1, computed in a way that accurate even when the value of number is close to zero */ +/* + WARNING: this function is expermental: it could change its name or + disappear in the next version of PHP! +*/ +PHP_FUNCTION(expm1) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(php_expm1(num)); +} +/* }}} */ + +/* {{{ proto float log1p(float number) + Returns log(1 + number), computed in a way that accurate even when the value of number is close to zero */ +/* + WARNING: this function is expermental: it could change its name or + disappear in the next version of PHP! +*/ +PHP_FUNCTION(log1p) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(php_log1p(num)); +} +/* }}} */ + +/* {{{ proto float log(float number, [float base]) + Returns the natural logarithm of the number, or the base log if base is specified */ +PHP_FUNCTION(log) +{ + double num, base = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|d", &num, &base) == FAILURE) { + return; + } + if (ZEND_NUM_ARGS() == 1) { + RETURN_DOUBLE(log(num)); + } + if (base <= 0.0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "base must be greater than 0"); + RETURN_FALSE; + } + if (base == 1) { + RETURN_DOUBLE(php_get_nan()); + } else { + RETURN_DOUBLE(log(num) / log(base)); + } +} +/* }}} */ + +/* {{{ proto float log10(float number) + Returns the base-10 logarithm of the number */ +PHP_FUNCTION(log10) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(log10(num)); +} +/* }}} */ + +/* {{{ proto float sqrt(float number) + Returns the square root of the number */ +PHP_FUNCTION(sqrt) +{ + double num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { + return; + } + RETURN_DOUBLE(sqrt(num)); +} +/* }}} */ + +/* {{{ proto float hypot(float num1, float num2) + Returns sqrt(num1*num1 + num2*num2) */ +PHP_FUNCTION(hypot) +{ + double num1, num2; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &num1, &num2) == FAILURE) { + return; + } +#if HAVE_HYPOT + RETURN_DOUBLE(hypot(num1, num2)); +#elif defined(_MSC_VER) + RETURN_DOUBLE(_hypot(num1, num2)); +#else + RETURN_DOUBLE(sqrt((num1 * num1) + (num2 * num2))); +#endif +} +/* }}} */ + +/* {{{ proto float deg2rad(float number) + Converts the number in degrees to the radian equivalent */ +PHP_FUNCTION(deg2rad) +{ + double deg; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °) == FAILURE) { + return; + } + RETURN_DOUBLE((deg / 180.0) * M_PI); +} +/* }}} */ + +/* {{{ proto float rad2deg(float number) + Converts the radian number to the equivalent number in degrees */ +PHP_FUNCTION(rad2deg) +{ + double rad; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &rad) == FAILURE) { + return; + } + RETURN_DOUBLE((rad / M_PI) * 180); +} +/* }}} */ + +/* {{{ _php_math_basetolong */ +/* + * Convert a string representation of a base(2-36) number to a long. + */ +PHPAPI long _php_math_basetolong(zval *arg, int base) +{ + long num = 0, digit, onum; + int i; + char c, *s; + + if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) { + return 0; + } + + s = Z_STRVAL_P(arg); + + for (i = Z_STRLEN_P(arg); i > 0; i--) { + c = *s++; + + digit = (c >= '0' && c <= '9') ? c - '0' + : (c >= 'A' && c <= 'Z') ? c - 'A' + 10 + : (c >= 'a' && c <= 'z') ? c - 'a' + 10 + : base; + + if (digit >= base) { + continue; + } + + onum = num; + num = num * base + digit; + if (num > onum) + continue; + + { + TSRMLS_FETCH(); + + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number '%s' is too big to fit in long", s); + return LONG_MAX; + } + } + + return num; +} +/* }}} */ + +/* {{{ _php_math_basetozval */ +/* + * Convert a string representation of a base(2-36) number to a zval. + */ +PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) +{ + long num = 0; + double fnum = 0; + int i; + int mode = 0; + char c, *s; + long cutoff; + int cutlim; + + if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) { + return FAILURE; + } + + s = Z_STRVAL_P(arg); + + cutoff = LONG_MAX / base; + cutlim = LONG_MAX % base; + + for (i = Z_STRLEN_P(arg); i > 0; i--) { + c = *s++; + + /* might not work for EBCDIC */ + if (c >= '0' && c <= '9') + c -= '0'; + else if (c >= 'A' && c <= 'Z') + c -= 'A' - 10; + else if (c >= 'a' && c <= 'z') + c -= 'a' - 10; + else + continue; + + if (c >= base) + continue; + + switch (mode) { + case 0: /* Integer */ + if (num < cutoff || (num == cutoff && c <= cutlim)) { + num = num * base + c; + break; + } else { + fnum = num; + mode = 1; + } + /* fall-through */ + case 1: /* Float */ + fnum = fnum * base + c; + } + } + + if (mode == 1) { + ZVAL_DOUBLE(ret, fnum); + } else { + ZVAL_LONG(ret, num); + } + return SUCCESS; +} +/* }}} */ + +/* {{{ _php_math_longtobase */ +/* + * Convert a long to a string containing a base(2-36) representation of + * the number. + */ +PHPAPI char * _php_math_longtobase(zval *arg, int base) +{ + static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; + char buf[(sizeof(unsigned long) << 3) + 1]; + char *ptr, *end; + unsigned long value; + + if (Z_TYPE_P(arg) != IS_LONG || base < 2 || base > 36) { + return STR_EMPTY_ALLOC(); + } + + value = Z_LVAL_P(arg); + + end = ptr = buf + sizeof(buf) - 1; + *ptr = '\0'; + + do { + *--ptr = digits[value % base]; + value /= base; + } while (ptr > buf && value); + + return estrndup(ptr, end - ptr); +} +/* }}} */ + +/* {{{ _php_math_zvaltobase */ +/* + * Convert a zval to a string containing a base(2-36) representation of + * the number. + */ +PHPAPI char * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC) +{ + static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; + + if ((Z_TYPE_P(arg) != IS_LONG && Z_TYPE_P(arg) != IS_DOUBLE) || base < 2 || base > 36) { + return STR_EMPTY_ALLOC(); + } + + if (Z_TYPE_P(arg) == IS_DOUBLE) { + double fvalue = floor(Z_DVAL_P(arg)); /* floor it just in case */ + char *ptr, *end; + char buf[(sizeof(double) << 3) + 1]; + + /* Don't try to convert +/- infinity */ + if (fvalue == HUGE_VAL || fvalue == -HUGE_VAL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number too large"); + return STR_EMPTY_ALLOC(); + } + + end = ptr = buf + sizeof(buf) - 1; + *ptr = '\0'; + + do { + *--ptr = digits[(int) fmod(fvalue, base)]; + fvalue /= base; + } while (ptr > buf && fabs(fvalue) >= 1); + + return estrndup(ptr, end - ptr); + } + + return _php_math_longtobase(arg, base); +} +/* }}} */ + +/* {{{ proto int bindec(string binary_number) + Returns the decimal equivalent of the binary number */ +PHP_FUNCTION(bindec) +{ + zval **arg; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) == FAILURE) { + return; + } + convert_to_string_ex(arg); + if (_php_math_basetozval(*arg, 2, return_value) == FAILURE) { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto int hexdec(string hexadecimal_number) + Returns the decimal equivalent of the hexadecimal number */ +PHP_FUNCTION(hexdec) +{ + zval **arg; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) == FAILURE) { + return; + } + convert_to_string_ex(arg); + if (_php_math_basetozval(*arg, 16, return_value) == FAILURE) { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto int octdec(string octal_number) + Returns the decimal equivalent of an octal string */ +PHP_FUNCTION(octdec) +{ + zval **arg; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) == FAILURE) { + return; + } + convert_to_string_ex(arg); + if (_php_math_basetozval(*arg, 8, return_value) == FAILURE) { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto string decbin(int decimal_number) + Returns a string containing a binary representation of the number */ +PHP_FUNCTION(decbin) +{ + zval **arg; + char *result; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) == FAILURE) { + return; + } + convert_to_long_ex(arg); + result = _php_math_longtobase(*arg, 2); + RETURN_STRING(result, 0); +} +/* }}} */ + +/* {{{ proto string decoct(int decimal_number) + Returns a string containing an octal representation of the given number */ +PHP_FUNCTION(decoct) +{ + zval **arg; + char *result; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) == FAILURE) { + return; + } + convert_to_long_ex(arg); + result = _php_math_longtobase(*arg, 8); + RETURN_STRING(result, 0); +} +/* }}} */ + +/* {{{ proto string dechex(int decimal_number) + Returns a string containing a hexadecimal representation of the given number */ +PHP_FUNCTION(dechex) +{ + zval **arg; + char *result; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) == FAILURE) { + return; + } + convert_to_long_ex(arg); + result = _php_math_longtobase(*arg, 16); + RETURN_STRING(result, 0); +} +/* }}} */ + +/* {{{ proto string base_convert(string number, int frombase, int tobase) + Converts a number in a string from any base <= 36 to any base <= 36 */ +PHP_FUNCTION(base_convert) +{ + zval **number, temp; + long frombase, tobase; + char *result; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zll", &number, &frombase, &tobase) == FAILURE) { + return; + } + convert_to_string_ex(number); + + if (frombase < 2 || frombase > 36) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid `from base' (%ld)", frombase); + RETURN_FALSE; + } + if (tobase < 2 || tobase > 36) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid `to base' (%ld)", tobase); + RETURN_FALSE; + } + + if(_php_math_basetozval(*number, frombase, &temp) == FAILURE) { + RETURN_FALSE; + } + result = _php_math_zvaltobase(&temp, tobase TSRMLS_CC); + RETVAL_STRING(result, 0); +} +/* }}} */ + +/* {{{ _php_math_number_format +*/ +PHPAPI char *_php_math_number_format(double d, int dec, char dec_point, char thousand_sep) +{ + return _php_math_number_format_ex(d, dec, &dec_point, 1, &thousand_sep, 1); +} + +static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point, + size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len, + int *result_len) +{ + char *tmpbuf = NULL, *resbuf; + char *s, *t; /* source, target */ + char *dp; + int integral; + int tmplen, reslen=0; + int count=0; + int is_negative=0; + + if (d < 0) { + is_negative = 1; + d = -d; + } + + dec = MAX(0, dec); + d = _php_math_round(d, dec, PHP_ROUND_HALF_UP); + + tmplen = spprintf(&tmpbuf, 0, "%.*F", dec, d); + + if (tmpbuf == NULL || !isdigit((int)tmpbuf[0])) { + if (result_len) { + *result_len = tmplen; + } + + return tmpbuf; + } + + /* find decimal point, if expected */ + if (dec) { + dp = strpbrk(tmpbuf, ".,"); + } else { + dp = NULL; + } + + /* calculate the length of the return buffer */ + if (dp) { + integral = dp - tmpbuf; + } else { + /* no decimal point was found */ + integral = tmplen; + } + + /* allow for thousand separators */ + if (thousand_sep) { + integral += thousand_sep_len * ((integral-1) / 3); + } + + reslen = integral; + + if (dec) { + reslen += dec; + + if (dec_point) { + reslen += dec_point_len; + } + } + + /* add a byte for minus sign */ + if (is_negative) { + reslen++; + } + resbuf = (char *) emalloc(reslen+1); /* +1 for NUL terminator */ + + s = tmpbuf+tmplen-1; + t = resbuf+reslen; + *t-- = '\0'; + + /* copy the decimal places. + * Take care, as the sprintf implementation may return less places than + * we requested due to internal buffer limitations */ + if (dec) { + int declen = dp ? s - dp : 0; + int topad = dec > declen ? dec - declen : 0; + + /* pad with '0's */ + while (topad--) { + *t-- = '0'; + } + + if (dp) { + s -= declen + 1; /* +1 to skip the point */ + t -= declen; + + /* now copy the chars after the point */ + memcpy(t + 1, dp + 1, declen); + } + + /* add decimal point */ + if (dec_point) { + t -= dec_point_len; + memcpy(t + 1, dec_point, dec_point_len); + } + } + + /* copy the numbers before the decimal point, adding thousand + * separator every three digits */ + while(s >= tmpbuf) { + *t-- = *s--; + if (thousand_sep && (++count%3)==0 && s>=tmpbuf) { + t -= thousand_sep_len; + memcpy(t + 1, thousand_sep, thousand_sep_len); + } + } + + /* and a minus sign, if needed */ + if (is_negative) { + *t-- = '-'; + } + + efree(tmpbuf); + + if (result_len) { + *result_len = reslen; + } + + return resbuf; +} + +PHPAPI char *_php_math_number_format_ex(double d, int dec, char *dec_point, + size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len) +{ + return _php_math_number_format_ex_len(d, dec, dec_point, dec_point_len, + thousand_sep, thousand_sep_len, NULL); +} +/* }}} */ + +/* {{{ proto string number_format(float number [, int num_decimal_places [, string dec_seperator, string thousands_seperator]]) + Formats a number with grouped thousands */ +PHP_FUNCTION(number_format) +{ + double num; + long dec = 0; + char *thousand_sep = NULL, *dec_point = NULL; + char thousand_sep_chr = ',', dec_point_chr = '.'; + int thousand_sep_len = 0, dec_point_len = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|ls!s!", &num, &dec, &dec_point, &dec_point_len, &thousand_sep, &thousand_sep_len) == FAILURE) { + return; + } + + switch(ZEND_NUM_ARGS()) { + case 1: + RETURN_STRING(_php_math_number_format(num, 0, dec_point_chr, thousand_sep_chr), 0); + break; + case 2: + RETURN_STRING(_php_math_number_format(num, dec, dec_point_chr, thousand_sep_chr), 0); + break; + case 4: + if (dec_point == NULL) { + dec_point = &dec_point_chr; + dec_point_len = 1; + } + + if (thousand_sep == NULL) { + thousand_sep = &thousand_sep_chr; + thousand_sep_len = 1; + } + + Z_TYPE_P(return_value) = IS_STRING; + Z_STRVAL_P(return_value) = _php_math_number_format_ex_len(num, dec, + dec_point, dec_point_len, thousand_sep, thousand_sep_len, + &Z_STRLEN_P(return_value)); + break; + default: + WRONG_PARAM_COUNT; + break; + } +} +/* }}} */ + +/* {{{ proto float fmod(float x, float y) + Returns the remainder of dividing x by y as a float */ +PHP_FUNCTION(fmod) +{ + double num1, num2; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &num1, &num2) == FAILURE) { + return; + } + RETURN_DOUBLE(fmod(num1, num2)); +} +/* }}} */ + + + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: fdm=marker + * vim: noet sw=4 ts=4 + */ diff --git a/ext/standard/md5.c b/ext/standard/md5.c new file mode 100644 index 0000000..7fea069 --- /dev/null +++ b/ext/standard/md5.c @@ -0,0 +1,389 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Alexander Peslyak (Solar Designer) | + | Lachlan Roche | + | Alessandro Astarita | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "md5.h" + +PHPAPI void make_digest(char *md5str, const unsigned char *digest) /* {{{ */ +{ + make_digest_ex(md5str, digest, 16); +} +/* }}} */ + +PHPAPI void make_digest_ex(char *md5str, const unsigned char *digest, int len) /* {{{ */ +{ + static const char hexits[17] = "0123456789abcdef"; + int i; + + for (i = 0; i < len; i++) { + md5str[i * 2] = hexits[digest[i] >> 4]; + md5str[(i * 2) + 1] = hexits[digest[i] & 0x0F]; + } + md5str[len * 2] = '\0'; +} +/* }}} */ + +/* {{{ proto string md5(string str, [ bool raw_output]) + Calculate the md5 hash of a string */ +PHP_NAMED_FUNCTION(php_if_md5) +{ + char *arg; + int arg_len; + zend_bool raw_output = 0; + char md5str[33]; + PHP_MD5_CTX context; + unsigned char digest[16]; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) { + return; + } + + md5str[0] = '\0'; + PHP_MD5Init(&context); + PHP_MD5Update(&context, arg, arg_len); + PHP_MD5Final(digest, &context); + if (raw_output) { + RETURN_STRINGL(digest, 16, 1); + } else { + make_digest_ex(md5str, digest, 16); + RETVAL_STRING(md5str, 1); + } + +} +/* }}} */ + +/* {{{ proto string md5_file(string filename [, bool raw_output]) + Calculate the md5 hash of given filename */ +PHP_NAMED_FUNCTION(php_if_md5_file) +{ + char *arg; + int arg_len; + zend_bool raw_output = 0; + char md5str[33]; + unsigned char buf[1024]; + unsigned char digest[16]; + PHP_MD5_CTX context; + int n; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &arg, &arg_len, &raw_output) == FAILURE) { + return; + } + + stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS, NULL); + if (!stream) { + RETURN_FALSE; + } + + PHP_MD5Init(&context); + + while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) { + PHP_MD5Update(&context, buf, n); + } + + PHP_MD5Final(digest, &context); + + php_stream_close(stream); + + if (n<0) { + RETURN_FALSE; + } + + if (raw_output) { + RETURN_STRINGL(digest, 16, 1); + } else { + make_digest_ex(md5str, digest, 16); + RETVAL_STRING(md5str, 1); + } +} +/* }}} */ + +/* + * This is an OpenSSL-compatible implementation of the RSA Data Security, + * Inc. MD5 Message-Digest Algorithm (RFC 1321). + * + * Written by Solar Designer in 2001, and placed + * in the public domain. There's absolutely no warranty. + * + * This differs from Colin Plumb's older public domain implementation in + * that no 32-bit integer data type is required, there's no compile-time + * endianness configuration, and the function prototypes match OpenSSL's. + * The primary goals are portability and ease of use. + * + * This implementation is meant to be fast, but not as fast as possible. + * Some known optimizations are not included to reduce source code size + * and avoid compile-time configuration. + */ + +#include + +/* + * The basic MD5 functions. + * + * F and G are optimized compared to their RFC 1321 definitions for + * architectures that lack an AND-NOT instruction, just like in Colin Plumb's + * implementation. + */ +#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y)))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | ~(z))) + +/* + * The MD5 transformation for all four rounds. + */ +#define STEP(f, a, b, c, d, x, t, s) \ + (a) += f((b), (c), (d)) + (x) + (t); \ + (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \ + (a) += (b); + +/* + * SET reads 4 input bytes in little-endian byte order and stores them + * in a properly aligned word in host byte order. + * + * The check for little-endian architectures that tolerate unaligned + * memory accesses is just an optimization. Nothing will break if it + * doesn't work. + */ +#if defined(__i386__) || defined(__x86_64__) || defined(__vax__) +# define SET(n) \ + (*(php_uint32 *)&ptr[(n) * 4]) +# define GET(n) \ + SET(n) +#else +# define SET(n) \ + (ctx->block[(n)] = \ + (php_uint32)ptr[(n) * 4] | \ + ((php_uint32)ptr[(n) * 4 + 1] << 8) | \ + ((php_uint32)ptr[(n) * 4 + 2] << 16) | \ + ((php_uint32)ptr[(n) * 4 + 3] << 24)) +# define GET(n) \ + (ctx->block[(n)]) +#endif + +/* + * This processes one or more 64-byte data blocks, but does NOT update + * the bit counters. There are no alignment requirements. + */ +static const void *body(PHP_MD5_CTX *ctx, const void *data, size_t size) +{ + const unsigned char *ptr; + php_uint32 a, b, c, d; + php_uint32 saved_a, saved_b, saved_c, saved_d; + + ptr = data; + + a = ctx->a; + b = ctx->b; + c = ctx->c; + d = ctx->d; + + do { + saved_a = a; + saved_b = b; + saved_c = c; + saved_d = d; + +/* Round 1 */ + STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7) + STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12) + STEP(F, c, d, a, b, SET(2), 0x242070db, 17) + STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22) + STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7) + STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12) + STEP(F, c, d, a, b, SET(6), 0xa8304613, 17) + STEP(F, b, c, d, a, SET(7), 0xfd469501, 22) + STEP(F, a, b, c, d, SET(8), 0x698098d8, 7) + STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12) + STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17) + STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22) + STEP(F, a, b, c, d, SET(12), 0x6b901122, 7) + STEP(F, d, a, b, c, SET(13), 0xfd987193, 12) + STEP(F, c, d, a, b, SET(14), 0xa679438e, 17) + STEP(F, b, c, d, a, SET(15), 0x49b40821, 22) + +/* Round 2 */ + STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5) + STEP(G, d, a, b, c, GET(6), 0xc040b340, 9) + STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14) + STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20) + STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5) + STEP(G, d, a, b, c, GET(10), 0x02441453, 9) + STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14) + STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20) + STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5) + STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9) + STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14) + STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20) + STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5) + STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9) + STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14) + STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20) + +/* Round 3 */ + STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4) + STEP(H, d, a, b, c, GET(8), 0x8771f681, 11) + STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16) + STEP(H, b, c, d, a, GET(14), 0xfde5380c, 23) + STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4) + STEP(H, d, a, b, c, GET(4), 0x4bdecfa9, 11) + STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16) + STEP(H, b, c, d, a, GET(10), 0xbebfbc70, 23) + STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4) + STEP(H, d, a, b, c, GET(0), 0xeaa127fa, 11) + STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16) + STEP(H, b, c, d, a, GET(6), 0x04881d05, 23) + STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4) + STEP(H, d, a, b, c, GET(12), 0xe6db99e5, 11) + STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16) + STEP(H, b, c, d, a, GET(2), 0xc4ac5665, 23) + +/* Round 4 */ + STEP(I, a, b, c, d, GET(0), 0xf4292244, 6) + STEP(I, d, a, b, c, GET(7), 0x432aff97, 10) + STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15) + STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21) + STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6) + STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10) + STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15) + STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21) + STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6) + STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10) + STEP(I, c, d, a, b, GET(6), 0xa3014314, 15) + STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21) + STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6) + STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10) + STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15) + STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21) + + a += saved_a; + b += saved_b; + c += saved_c; + d += saved_d; + + ptr += 64; + } while (size -= 64); + + ctx->a = a; + ctx->b = b; + ctx->c = c; + ctx->d = d; + + return ptr; +} + +PHPAPI void PHP_MD5Init(PHP_MD5_CTX *ctx) +{ + ctx->a = 0x67452301; + ctx->b = 0xefcdab89; + ctx->c = 0x98badcfe; + ctx->d = 0x10325476; + + ctx->lo = 0; + ctx->hi = 0; +} + +PHPAPI void PHP_MD5Update(PHP_MD5_CTX *ctx, const void *data, size_t size) +{ + php_uint32 saved_lo; + php_uint32 used, free; + + saved_lo = ctx->lo; + if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) { + ctx->hi++; + } + ctx->hi += size >> 29; + + used = saved_lo & 0x3f; + + if (used) { + free = 64 - used; + + if (size < free) { + memcpy(&ctx->buffer[used], data, size); + return; + } + + memcpy(&ctx->buffer[used], data, free); + data = (unsigned char *)data + free; + size -= free; + body(ctx, ctx->buffer, 64); + } + + if (size >= 64) { + data = body(ctx, data, size & ~(size_t)0x3f); + size &= 0x3f; + } + + memcpy(ctx->buffer, data, size); +} + +PHPAPI void PHP_MD5Final(unsigned char *result, PHP_MD5_CTX *ctx) +{ + php_uint32 used, free; + + used = ctx->lo & 0x3f; + + ctx->buffer[used++] = 0x80; + + free = 64 - used; + + if (free < 8) { + memset(&ctx->buffer[used], 0, free); + body(ctx, ctx->buffer, 64); + used = 0; + free = 64; + } + + memset(&ctx->buffer[used], 0, free - 8); + + ctx->lo <<= 3; + ctx->buffer[56] = ctx->lo; + ctx->buffer[57] = ctx->lo >> 8; + ctx->buffer[58] = ctx->lo >> 16; + ctx->buffer[59] = ctx->lo >> 24; + ctx->buffer[60] = ctx->hi; + ctx->buffer[61] = ctx->hi >> 8; + ctx->buffer[62] = ctx->hi >> 16; + ctx->buffer[63] = ctx->hi >> 24; + + body(ctx, ctx->buffer, 64); + + result[0] = ctx->a; + result[1] = ctx->a >> 8; + result[2] = ctx->a >> 16; + result[3] = ctx->a >> 24; + result[4] = ctx->b; + result[5] = ctx->b >> 8; + result[6] = ctx->b >> 16; + result[7] = ctx->b >> 24; + result[8] = ctx->c; + result[9] = ctx->c >> 8; + result[10] = ctx->c >> 16; + result[11] = ctx->c >> 24; + result[12] = ctx->d; + result[13] = ctx->d >> 8; + result[14] = ctx->d >> 16; + result[15] = ctx->d >> 24; + + memset(ctx, 0, sizeof(*ctx)); +} diff --git a/ext/standard/md5.h b/ext/standard/md5.h new file mode 100644 index 0000000..d783405 --- /dev/null +++ b/ext/standard/md5.h @@ -0,0 +1,55 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Alexander Peslyak (Solar Designer) | + | Rasmus Lerdorf | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef MD5_H +#define MD5_H + +PHPAPI void make_digest(char *md5str, const unsigned char *digest); +PHPAPI void make_digest_ex(char *md5str, const unsigned char *digest, int len); + +PHP_NAMED_FUNCTION(php_if_md5); +PHP_NAMED_FUNCTION(php_if_md5_file); + +#include "ext/standard/basic_functions.h" + +/* + * This is an OpenSSL-compatible implementation of the RSA Data Security, + * Inc. MD5 Message-Digest Algorithm (RFC 1321). + * + * Written by Solar Designer in 2001, and placed + * in the public domain. There's absolutely no warranty. + * + * See md5.c for more information. + */ + +/* MD5 context. */ +typedef struct { + php_uint32 lo, hi; + php_uint32 a, b, c, d; + unsigned char buffer[64]; + php_uint32 block[16]; +} PHP_MD5_CTX; + +PHPAPI void PHP_MD5Init(PHP_MD5_CTX *ctx); +PHPAPI void PHP_MD5Update(PHP_MD5_CTX *ctx, const void *data, size_t size); +PHPAPI void PHP_MD5Final(unsigned char *result, PHP_MD5_CTX *ctx); + +#endif diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c new file mode 100644 index 0000000..62c6df6 --- /dev/null +++ b/ext/standard/metaphone.c @@ -0,0 +1,480 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Thies C. Arntzen | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +/* + Based on CPANs "Text-Metaphone-1.96" by Michael G Schwern +*/ + +#include "php.h" +#include "php_metaphone.h" + +static int metaphone(unsigned char *word, int word_len, long max_phonemes, char **phoned_word, int traditional); + +/* {{{ proto string metaphone(string text[, int phones]) + Break english phrases down into their phonemes */ +PHP_FUNCTION(metaphone) +{ + char *str; + char *result = 0; + int str_len; + long phones = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, + &phones) == FAILURE) { + return; + } + + if (metaphone((unsigned char *)str, str_len, phones, &result, 1) == 0) { + RETVAL_STRING(result, 0); + } else { + if (result) { + efree(result); + } + RETURN_FALSE; + } +} +/* }}} */ + +/* + this is now the original code by Michael G Schwern: + i've changed it just a slightly bit (use emalloc, + get rid of includes etc) + - thies - 13.09.1999 +*/ + +/*----------------------------- */ +/* this used to be "metaphone.h" */ +/*----------------------------- */ + +/* Special encodings */ +#define SH 'X' +#define TH '0' + +/*----------------------------- */ +/* end of "metaphone.h" */ +/*----------------------------- */ + +/*----------------------------- */ +/* this used to be "metachar.h" */ +/*----------------------------- */ + +/* Metachar.h ... little bits about characters for metaphone */ +/*-- Character encoding array & accessing macros --*/ +/* Stolen directly out of the book... */ +char _codes[26] = +{ + 1, 16, 4, 16, 9, 2, 4, 16, 9, 2, 0, 2, 2, 2, 1, 4, 0, 2, 4, 4, 1, 0, 0, 0, 8, 0 +/* a b c d e f g h i j k l m n o p q r s t u v w x y z */ +}; + + +#define ENCODE(c) (isalpha(c) ? _codes[((toupper(c)) - 'A')] : 0) + +#define isvowel(c) (ENCODE(c) & 1) /* AEIOU */ + +/* These letters are passed through unchanged */ +#define NOCHANGE(c) (ENCODE(c) & 2) /* FJMNR */ + +/* These form dipthongs when preceding H */ +#define AFFECTH(c) (ENCODE(c) & 4) /* CGPST */ + +/* These make C and G soft */ +#define MAKESOFT(c) (ENCODE(c) & 8) /* EIY */ + +/* These prevent GH from becoming F */ +#define NOGHTOF(c) (ENCODE(c) & 16) /* BDH */ + +/*----------------------------- */ +/* end of "metachar.h" */ +/*----------------------------- */ + +/* I suppose I could have been using a character pointer instead of + * accesssing the array directly... */ + +/* Look at the next letter in the word */ +#define Next_Letter (toupper(word[w_idx+1])) +/* Look at the current letter in the word */ +#define Curr_Letter (toupper(word[w_idx])) +/* Go N letters back. */ +#define Look_Back_Letter(n) (w_idx >= n ? toupper(word[w_idx-n]) : '\0') +/* Previous letter. I dunno, should this return null on failure? */ +#define Prev_Letter (Look_Back_Letter(1)) +/* Look two letters down. It makes sure you don't walk off the string. */ +#define After_Next_Letter (Next_Letter != '\0' ? toupper(word[w_idx+2]) \ + : '\0') +#define Look_Ahead_Letter(n) (toupper(Lookahead(word+w_idx, n))) + + +/* Allows us to safely look ahead an arbitrary # of letters */ +/* I probably could have just used strlen... */ +static char Lookahead(char *word, int how_far) +{ + char letter_ahead = '\0'; /* null by default */ + int idx; + for (idx = 0; word[idx] != '\0' && idx < how_far; idx++); + /* Edge forward in the string... */ + + letter_ahead = word[idx]; /* idx will be either == to how_far or + * at the end of the string + */ + return letter_ahead; +} + + +/* phonize one letter + * We don't know the buffers size in advance. On way to solve this is to just + * re-allocate the buffer size. We're using an extra of 2 characters (this + * could be one though; or more too). */ +#define Phonize(c) { \ + if (p_idx >= max_buffer_len) { \ + *phoned_word = safe_erealloc(*phoned_word, 2, sizeof(char), max_buffer_len); \ + max_buffer_len += 2; \ + } \ + (*phoned_word)[p_idx++] = c; \ + } +/* Slap a null character on the end of the phoned word */ +#define End_Phoned_Word { \ + if (p_idx == max_buffer_len) { \ + *phoned_word = safe_erealloc(*phoned_word, 1, sizeof(char), max_buffer_len); \ + } \ + (*phoned_word)[p_idx] = '\0'; \ + } +/* How long is the phoned word? */ +#define Phone_Len (p_idx) + +/* Note is a letter is a 'break' in the word */ +#define Isbreak(c) (!isalpha(c)) + +/* {{{ metaphone + */ +static int metaphone(unsigned char *word, int word_len, long max_phonemes, char **phoned_word, int traditional) +{ + int w_idx = 0; /* point in the phonization we're at. */ + int p_idx = 0; /* end of the phoned phrase */ + int max_buffer_len = 0; /* maximum length of the destination buffer */ + +/*-- Parameter checks --*/ + /* Negative phoneme length is meaningless */ + + if (max_phonemes < 0) + return -1; + + /* Empty/null string is meaningless */ + /* Overly paranoid */ + /* assert(word != NULL && word[0] != '\0'); */ + + if (word == NULL) + return -1; + +/*-- Allocate memory for our phoned_phrase --*/ + if (max_phonemes == 0) { /* Assume largest possible */ + max_buffer_len = word_len; + *phoned_word = safe_emalloc(sizeof(char), word_len, 1); + } else { + max_buffer_len = max_phonemes; + *phoned_word = safe_emalloc(sizeof(char), max_phonemes, 1); + } + + +/*-- The first phoneme has to be processed specially. --*/ + /* Find our first letter */ + for (; !isalpha(Curr_Letter); w_idx++) { + /* On the off chance we were given nothing but crap... */ + if (Curr_Letter == '\0') { + End_Phoned_Word + return SUCCESS; /* For testing */ + } + } + + switch (Curr_Letter) { + /* AE becomes E */ + case 'A': + if (Next_Letter == 'E') { + Phonize('E'); + w_idx += 2; + } + /* Remember, preserve vowels at the beginning */ + else { + Phonize('A'); + w_idx++; + } + break; + /* [GKP]N becomes N */ + case 'G': + case 'K': + case 'P': + if (Next_Letter == 'N') { + Phonize('N'); + w_idx += 2; + } + break; + /* WH becomes W, + WR becomes R + W if followed by a vowel */ + case 'W': + if (Next_Letter == 'R') { + Phonize(Next_Letter); + w_idx += 2; + } else if (Next_Letter == 'H' || isvowel(Next_Letter)) { + Phonize('W'); + w_idx += 2; + } + /* else ignore */ + break; + /* X becomes S */ + case 'X': + Phonize('S'); + w_idx++; + break; + /* Vowels are kept */ + /* We did A already + case 'A': + case 'a': + */ + case 'E': + case 'I': + case 'O': + case 'U': + Phonize(Curr_Letter); + w_idx++; + break; + default: + /* do nothing */ + break; + } + + + + /* On to the metaphoning */ + for (; Curr_Letter != '\0' && + (max_phonemes == 0 || Phone_Len < max_phonemes); + w_idx++) { + /* How many letters to skip because an eariler encoding handled + * multiple letters */ + unsigned short int skip_letter = 0; + + + /* THOUGHT: It would be nice if, rather than having things like... + * well, SCI. For SCI you encode the S, then have to remember + * to skip the C. So the phonome SCI invades both S and C. It would + * be better, IMHO, to skip the C from the S part of the encoding. + * Hell, I'm trying it. + */ + + /* Ignore non-alphas */ + if (!isalpha(Curr_Letter)) + continue; + + /* Drop duplicates, except CC */ + if (Curr_Letter == Prev_Letter && + Curr_Letter != 'C') + continue; + + switch (Curr_Letter) { + /* B -> B unless in MB */ + case 'B': + if (Prev_Letter != 'M') + Phonize('B'); + break; + /* 'sh' if -CIA- or -CH, but not SCH, except SCHW. + * (SCHW is handled in S) + * S if -CI-, -CE- or -CY- + * dropped if -SCI-, SCE-, -SCY- (handed in S) + * else K + */ + case 'C': + if (MAKESOFT(Next_Letter)) { /* C[IEY] */ + if (After_Next_Letter == 'A' && + Next_Letter == 'I') { /* CIA */ + Phonize(SH); + } + /* SC[IEY] */ + else if (Prev_Letter == 'S') { + /* Dropped */ + } else { + Phonize('S'); + } + } else if (Next_Letter == 'H') { + if ((!traditional) && (After_Next_Letter == 'R' || Prev_Letter == 'S')) { /* Christ, School */ + Phonize('K'); + } else { + Phonize(SH); + } + skip_letter++; + } else { + Phonize('K'); + } + break; + /* J if in -DGE-, -DGI- or -DGY- + * else T + */ + case 'D': + if (Next_Letter == 'G' && + MAKESOFT(After_Next_Letter)) { + Phonize('J'); + skip_letter++; + } else + Phonize('T'); + break; + /* F if in -GH and not B--GH, D--GH, -H--GH, -H---GH + * else dropped if -GNED, -GN, + * else dropped if -DGE-, -DGI- or -DGY- (handled in D) + * else J if in -GE-, -GI, -GY and not GG + * else K + */ + case 'G': + if (Next_Letter == 'H') { + if (!(NOGHTOF(Look_Back_Letter(3)) || + Look_Back_Letter(4) == 'H')) { + Phonize('F'); + skip_letter++; + } else { + /* silent */ + } + } else if (Next_Letter == 'N') { + if (Isbreak(After_Next_Letter) || + (After_Next_Letter == 'E' && + Look_Ahead_Letter(3) == 'D')) { + /* dropped */ + } else + Phonize('K'); + } else if (MAKESOFT(Next_Letter) && + Prev_Letter != 'G') { + Phonize('J'); + } else { + Phonize('K'); + } + break; + /* H if before a vowel and not after C,G,P,S,T */ + case 'H': + if (isvowel(Next_Letter) && + !AFFECTH(Prev_Letter)) + Phonize('H'); + break; + /* dropped if after C + * else K + */ + case 'K': + if (Prev_Letter != 'C') + Phonize('K'); + break; + /* F if before H + * else P + */ + case 'P': + if (Next_Letter == 'H') { + Phonize('F'); + } else { + Phonize('P'); + } + break; + /* K + */ + case 'Q': + Phonize('K'); + break; + /* 'sh' in -SH-, -SIO- or -SIA- or -SCHW- + * else S + */ + case 'S': + if (Next_Letter == 'I' && + (After_Next_Letter == 'O' || + After_Next_Letter == 'A')) { + Phonize(SH); + } else if (Next_Letter == 'H') { + Phonize(SH); + skip_letter++; + } else if ((!traditional) && (Next_Letter == 'C' && Look_Ahead_Letter(2) == 'H' && Look_Ahead_Letter(3) == 'W')) { + Phonize(SH); + skip_letter += 2; + } else { + Phonize('S'); + } + break; + /* 'sh' in -TIA- or -TIO- + * else 'th' before H + * else T + */ + case 'T': + if (Next_Letter == 'I' && + (After_Next_Letter == 'O' || + After_Next_Letter == 'A')) { + Phonize(SH); + } else if (Next_Letter == 'H') { + Phonize(TH); + skip_letter++; + } else if (!(Next_Letter == 'C' && After_Next_Letter == 'H')) { + Phonize('T'); + } + break; + /* F */ + case 'V': + Phonize('F'); + break; + /* W before a vowel, else dropped */ + case 'W': + if (isvowel(Next_Letter)) + Phonize('W'); + break; + /* KS */ + case 'X': + Phonize('K'); + Phonize('S'); + break; + /* Y if followed by a vowel */ + case 'Y': + if (isvowel(Next_Letter)) + Phonize('Y'); + break; + /* S */ + case 'Z': + Phonize('S'); + break; + /* No transformation */ + case 'F': + case 'J': + case 'L': + case 'M': + case 'N': + case 'R': + Phonize(Curr_Letter); + break; + default: + /* nothing */ + break; + } /* END SWITCH */ + + w_idx += skip_letter; + } /* END FOR */ + + End_Phoned_Word; + + return 0; +} /* END metaphone */ +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c new file mode 100644 index 0000000..219e35d --- /dev/null +++ b/ext/standard/microtime.c @@ -0,0 +1,166 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Paul Panotzki - Bunyip Information Systems | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#include "php.h" + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef PHP_WIN32 +#include "win32/time.h" +#elif defined(NETWARE) +#include +#include +#else +#include +#endif +#ifdef HAVE_SYS_RESOURCE_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include +#include +#include + +#include "microtime.h" +#include "ext/date/php_date.h" + +#define NUL '\0' +#define MICRO_IN_SEC 1000000.00 +#define SEC_IN_MIN 60 + +#ifdef HAVE_GETTIMEOFDAY +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() TSRMLS_CC, "|b", &get_as_float) == FAILURE) { + return; + } + + if (gettimeofday(&tp, NULL)) { + RETURN_FALSE; + } + + if (get_as_float) { + RETURN_DOUBLE((double)(tp.tv_sec + tp.tv_usec / MICRO_IN_SEC)); + } + + if (mode) { + timelib_time_offset *offset; + + offset = timelib_get_time_zone_info(tp.tv_sec, get_timezone_info(TSRMLS_C)); + + array_init(return_value); + add_assoc_long(return_value, "sec", tp.tv_sec); + add_assoc_long(return_value, "usec", tp.tv_usec); + + add_assoc_long(return_value, "minuteswest", -offset->offset / SEC_IN_MIN); + add_assoc_long(return_value, "dsttime", offset->is_dst); + + timelib_time_offset_dtor(offset); + } else { + char ret[100]; + + snprintf(ret, 100, "%.8F %ld", tp.tv_usec / MICRO_IN_SEC, tp.tv_sec); + RETURN_STRING(ret, 1); + } +} + +/* {{{ proto mixed microtime([bool get_as_float]) + Returns either a string or a float containing the current time in seconds and microseconds */ +PHP_FUNCTION(microtime) +{ + _php_gettimeofday(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* {{{ proto array gettimeofday([bool get_as_float]) + Returns the current time as array */ +PHP_FUNCTION(gettimeofday) +{ + _php_gettimeofday(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +#endif +/* }}} */ + +#ifdef HAVE_GETRUSAGE +/* {{{ proto array getrusage([int who]) + Returns an array of usage statistics */ +PHP_FUNCTION(getrusage) +{ + struct rusage usg; + long pwho = 0; + int who = RUSAGE_SELF; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &pwho) == FAILURE) { + return; + } + + if (pwho == 1) { + who = RUSAGE_CHILDREN; + } + + memset(&usg, 0, sizeof(struct rusage)); + + if (getrusage(who, &usg) == -1) { + RETURN_FALSE; + } + + array_init(return_value); +#define PHP_RUSAGE_PARA(a) \ + add_assoc_long(return_value, #a, usg.a) +#if !defined( _OSD_POSIX) && !defined(__BEOS__) /* BS2000 has only a few fields in the rusage struct */ + PHP_RUSAGE_PARA(ru_oublock); + PHP_RUSAGE_PARA(ru_inblock); + PHP_RUSAGE_PARA(ru_msgsnd); + PHP_RUSAGE_PARA(ru_msgrcv); + PHP_RUSAGE_PARA(ru_maxrss); + PHP_RUSAGE_PARA(ru_ixrss); + PHP_RUSAGE_PARA(ru_idrss); + PHP_RUSAGE_PARA(ru_minflt); + PHP_RUSAGE_PARA(ru_majflt); + PHP_RUSAGE_PARA(ru_nsignals); + PHP_RUSAGE_PARA(ru_nvcsw); + PHP_RUSAGE_PARA(ru_nivcsw); + PHP_RUSAGE_PARA(ru_nswap); +#endif /*_OSD_POSIX*/ + PHP_RUSAGE_PARA(ru_utime.tv_usec); + PHP_RUSAGE_PARA(ru_utime.tv_sec); + PHP_RUSAGE_PARA(ru_stime.tv_usec); + PHP_RUSAGE_PARA(ru_stime.tv_sec); +#undef PHP_RUSAGE_PARA +} +#endif /* HAVE_GETRUSAGE */ + +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/microtime.h b/ext/standard/microtime.h new file mode 100644 index 0000000..95d4fab --- /dev/null +++ b/ext/standard/microtime.h @@ -0,0 +1,32 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Paul Panotzki - Bunyip Information Systems | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef MICROTIME_H +#define MICROTIME_H + +#ifdef HAVE_GETTIMEOFDAY +PHP_FUNCTION(microtime); +PHP_FUNCTION(gettimeofday); +#endif +#ifdef HAVE_GETRUSAGE +PHP_FUNCTION(getrusage); +#endif + +#endif /* MICROTIME_H */ diff --git a/ext/standard/pack.c b/ext/standard/pack.c new file mode 100644 index 0000000..29419d2 --- /dev/null +++ b/ext/standard/pack.c @@ -0,0 +1,953 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Chris Schneider | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#include "php.h" + +#include +#include +#include +#include +#include +#include +#ifdef PHP_WIN32 +#define O_RDONLY _O_RDONLY +#include "win32/param.h" +#elif defined(NETWARE) +#ifdef USE_WINSOCK +#include +#else +#include +#endif +#include +#else +#include +#endif +#include "ext/standard/head.h" +#include "php_string.h" +#include "pack.h" +#if HAVE_PWD_H +#ifdef PHP_WIN32 +#include "win32/pwd.h" +#else +#include +#endif +#endif +#include "fsock.h" +#if HAVE_NETINET_IN_H +#include +#endif + +#define INC_OUTPUTPOS(a,b) \ + if ((a) < 0 || ((INT_MAX - outputpos)/((int)b)) < (a)) { \ + efree(argv); \ + efree(formatcodes); \ + efree(formatargs); \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: integer overflow in format string", code); \ + RETURN_FALSE; \ + } \ + outputpos += (a)*(b); + +/* Whether machine is little endian */ +char machine_little_endian; + +/* Mapping of byte from char (8bit) to long for machine endian */ +static int byte_map[1]; + +/* Mappings of bytes from int (machine dependant) to int for machine endian */ +static int int_map[sizeof(int)]; + +/* Mappings of bytes from shorts (16bit) for all endian environments */ +static int machine_endian_short_map[2]; +static int big_endian_short_map[2]; +static int little_endian_short_map[2]; + +/* Mappings of bytes from longs (32bit) for all endian environments */ +static int machine_endian_long_map[4]; +static int big_endian_long_map[4]; +static int little_endian_long_map[4]; + +/* {{{ php_pack + */ +static void php_pack(zval **val, int size, int *map, char *output) +{ + int i; + char *v; + + convert_to_long_ex(val); + v = (char *) &Z_LVAL_PP(val); + + for (i = 0; i < size; i++) { + *output++ = v[map[i]]; + } +} +/* }}} */ + +/* pack() idea stolen from Perl (implemented formats behave the same as there) + * Implemented formats are A, a, h, H, c, C, s, S, i, I, l, L, n, N, f, d, x, X, @. + */ +/* {{{ proto string pack(string format, mixed arg1 [, mixed arg2 [, mixed ...]]) + Takes one or more arguments and packs them into a binary string according to the format argument */ +PHP_FUNCTION(pack) +{ + zval ***argv = NULL; + int num_args, i; + int currentarg; + char *format; + int formatlen; + char *formatcodes; + int *formatargs; + int formatcount = 0; + int outputpos = 0, outputsize = 0; + char *output; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &argv, &num_args) == FAILURE) { + return; + } + + if (Z_ISREF_PP(argv[0])) { + SEPARATE_ZVAL(argv[0]); + } + convert_to_string_ex(argv[0]); + + format = Z_STRVAL_PP(argv[0]); + formatlen = Z_STRLEN_PP(argv[0]); + + /* We have a maximum of format codes to deal with */ + formatcodes = safe_emalloc(formatlen, sizeof(*formatcodes), 0); + formatargs = safe_emalloc(formatlen, sizeof(*formatargs), 0); + currentarg = 1; + + /* Preprocess format into formatcodes and formatargs */ + for (i = 0; i < formatlen; formatcount++) { + char code = format[i++]; + int arg = 1; + + /* Handle format arguments if any */ + if (i < formatlen) { + char c = format[i]; + + if (c == '*') { + arg = -1; + i++; + } + else if (c >= '0' && c <= '9') { + arg = atoi(&format[i]); + + while (format[i] >= '0' && format[i] <= '9' && i < formatlen) { + i++; + } + } + } + + /* Handle special arg '*' for all codes and check argv overflows */ + switch ((int) code) { + /* Never uses any args */ + case 'x': + case 'X': + case '@': + if (arg < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: '*' ignored", code); + arg = 1; + } + break; + + /* Always uses one arg */ + case 'a': + case 'A': + case 'h': + case 'H': + if (currentarg >= num_args) { + efree(argv); + efree(formatcodes); + efree(formatargs); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: not enough arguments", code); + RETURN_FALSE; + } + + if (arg < 0) { + if (Z_ISREF_PP(argv[currentarg])) { + SEPARATE_ZVAL(argv[currentarg]); + } + convert_to_string_ex(argv[currentarg]); + arg = Z_STRLEN_PP(argv[currentarg]); + } + + currentarg++; + break; + + /* Use as many args as specified */ + case 'c': + case 'C': + case 's': + case 'S': + case 'i': + case 'I': + case 'l': + case 'L': + case 'n': + case 'N': + case 'v': + case 'V': + case 'f': + case 'd': + if (arg < 0) { + arg = num_args - currentarg; + } + + currentarg += arg; + + if (currentarg > num_args) { + efree(argv); + efree(formatcodes); + efree(formatargs); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: too few arguments", code); + RETURN_FALSE; + } + break; + + default: + efree(argv); + efree(formatcodes); + efree(formatargs); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: unknown format code", code); + RETURN_FALSE; + } + + formatcodes[formatcount] = code; + formatargs[formatcount] = arg; + } + + if (currentarg < num_args) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d arguments unused", (num_args - currentarg)); + } + + /* Calculate output length and upper bound while processing*/ + for (i = 0; i < formatcount; i++) { + int code = (int) formatcodes[i]; + int arg = formatargs[i]; + + switch ((int) code) { + case 'h': + case 'H': + INC_OUTPUTPOS((arg + (arg % 2)) / 2,1) /* 4 bit per arg */ + break; + + case 'a': + case 'A': + case 'c': + case 'C': + case 'x': + INC_OUTPUTPOS(arg,1) /* 8 bit per arg */ + break; + + case 's': + case 'S': + case 'n': + case 'v': + INC_OUTPUTPOS(arg,2) /* 16 bit per arg */ + break; + + case 'i': + case 'I': + INC_OUTPUTPOS(arg,sizeof(int)) + break; + + case 'l': + case 'L': + case 'N': + case 'V': + INC_OUTPUTPOS(arg,4) /* 32 bit per arg */ + break; + + case 'f': + INC_OUTPUTPOS(arg,sizeof(float)) + break; + + case 'd': + INC_OUTPUTPOS(arg,sizeof(double)) + break; + + case 'X': + outputpos -= arg; + + if (outputpos < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", code); + outputpos = 0; + } + break; + + case '@': + outputpos = arg; + break; + } + + if (outputsize < outputpos) { + outputsize = outputpos; + } + } + + output = emalloc(outputsize + 1); + outputpos = 0; + currentarg = 1; + + /* Do actual packing */ + for (i = 0; i < formatcount; i++) { + int code = (int) formatcodes[i]; + int arg = formatargs[i]; + zval **val; + + switch ((int) code) { + case 'a': + case 'A': + memset(&output[outputpos], (code == 'a') ? '\0' : ' ', arg); + val = argv[currentarg++]; + if (Z_ISREF_PP(val)) { + SEPARATE_ZVAL(val); + } + convert_to_string_ex(val); + memcpy(&output[outputpos], Z_STRVAL_PP(val), + (Z_STRLEN_PP(val) < arg) ? Z_STRLEN_PP(val) : arg); + outputpos += arg; + break; + + case 'h': + case 'H': { + int nibbleshift = (code == 'h') ? 0 : 4; + int first = 1; + char *v; + + val = argv[currentarg++]; + if (Z_ISREF_PP(val)) { + SEPARATE_ZVAL(val); + } + convert_to_string_ex(val); + v = Z_STRVAL_PP(val); + outputpos--; + if(arg > Z_STRLEN_PP(val)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: not enough characters in string", code); + arg = Z_STRLEN_PP(val); + } + + while (arg-- > 0) { + char n = *v++; + + if (n >= '0' && n <= '9') { + n -= '0'; + } else if (n >= 'A' && n <= 'F') { + n -= ('A' - 10); + } else if (n >= 'a' && n <= 'f') { + n -= ('a' - 10); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: illegal hex digit %c", code, n); + n = 0; + } + + if (first--) { + output[++outputpos] = 0; + } else { + first = 1; + } + + output[outputpos] |= (n << nibbleshift); + nibbleshift = (nibbleshift + 4) & 7; + } + + outputpos++; + break; + } + + case 'c': + case 'C': + while (arg-- > 0) { + php_pack(argv[currentarg++], 1, byte_map, &output[outputpos]); + outputpos++; + } + break; + + case 's': + case 'S': + case 'n': + case 'v': { + int *map = machine_endian_short_map; + + if (code == 'n') { + map = big_endian_short_map; + } else if (code == 'v') { + map = little_endian_short_map; + } + + while (arg-- > 0) { + php_pack(argv[currentarg++], 2, map, &output[outputpos]); + outputpos += 2; + } + break; + } + + case 'i': + case 'I': + while (arg-- > 0) { + php_pack(argv[currentarg++], sizeof(int), int_map, &output[outputpos]); + outputpos += sizeof(int); + } + break; + + case 'l': + case 'L': + case 'N': + case 'V': { + int *map = machine_endian_long_map; + + if (code == 'N') { + map = big_endian_long_map; + } else if (code == 'V') { + map = little_endian_long_map; + } + + while (arg-- > 0) { + php_pack(argv[currentarg++], 4, map, &output[outputpos]); + outputpos += 4; + } + break; + } + + case 'f': { + float v; + + while (arg-- > 0) { + val = argv[currentarg++]; + convert_to_double_ex(val); + v = (float) Z_DVAL_PP(val); + memcpy(&output[outputpos], &v, sizeof(v)); + outputpos += sizeof(v); + } + break; + } + + case 'd': { + double v; + + while (arg-- > 0) { + val = argv[currentarg++]; + convert_to_double_ex(val); + v = (double) Z_DVAL_PP(val); + memcpy(&output[outputpos], &v, sizeof(v)); + outputpos += sizeof(v); + } + break; + } + + case 'x': + memset(&output[outputpos], '\0', arg); + outputpos += arg; + break; + + case 'X': + outputpos -= arg; + + if (outputpos < 0) { + outputpos = 0; + } + break; + + case '@': + if (arg > outputpos) { + memset(&output[outputpos], '\0', arg - outputpos); + } + outputpos = arg; + break; + } + } + + efree(argv); + efree(formatcodes); + efree(formatargs); + output[outputpos] = '\0'; + RETVAL_STRINGL(output, outputpos, 1); + efree(output); +} +/* }}} */ + +/* {{{ php_unpack + */ +static long php_unpack(char *data, int size, int issigned, int *map) +{ + long result; + char *cresult = (char *) &result; + int i; + + result = issigned ? -1 : 0; + + for (i = 0; i < size; i++) { + cresult[map[i]] = *data++; + } + + return result; +} +/* }}} */ + +/* unpack() is based on Perl's unpack(), but is modified a bit from there. + * Rather than depending on error-prone ordered lists or syntactically + * unpleasant pass-by-reference, we return an object with named paramters + * (like *_fetch_object()). Syntax is "f[repeat]name/...", where "f" is the + * formatter char (like pack()), "[repeat]" is the optional repeater argument, + * and "name" is the name of the variable to use. + * Example: "c2chars/nints" will return an object with fields + * chars1, chars2, and ints. + * Numeric pack types will return numbers, a and A will return strings, + * f and d will return doubles. + * Implemented formats are A, a, h, H, c, C, s, S, i, I, l, L, n, N, f, d, x, X, @. + */ +/* {{{ proto array unpack(string format, string input) + Unpack binary string into named array elements according to format argument */ +PHP_FUNCTION(unpack) +{ + char *format, *input, *formatarg, *inputarg; + int formatlen, formatarg_len, inputarg_len; + int inputpos, inputlen, i; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &formatarg, &formatarg_len, + &inputarg, &inputarg_len) == FAILURE) { + return; + } + + format = formatarg; + formatlen = formatarg_len; + input = inputarg; + inputlen = inputarg_len; + inputpos = 0; + + array_init(return_value); + + while (formatlen-- > 0) { + char type = *(format++); + char c; + int arg = 1, argb; + char *name; + int namelen; + int size=0; + + /* Handle format arguments if any */ + if (formatlen > 0) { + c = *format; + + if (c >= '0' && c <= '9') { + arg = atoi(format); + + while (formatlen > 0 && *format >= '0' && *format <= '9') { + format++; + formatlen--; + } + } else if (c == '*') { + arg = -1; + format++; + formatlen--; + } + } + + /* Get of new value in array */ + name = format; + argb = arg; + + while (formatlen > 0 && *format != '/') { + formatlen--; + format++; + } + + namelen = format - name; + + if (namelen > 200) + namelen = 200; + + switch ((int) type) { + /* Never use any input */ + case 'X': + size = -1; + break; + + case '@': + size = 0; + break; + + case 'a': + case 'A': + size = arg; + arg = 1; + break; + + case 'h': + case 'H': + size = (arg > 0) ? (arg + (arg % 2)) / 2 : arg; + arg = 1; + break; + + /* Use 1 byte of input */ + case 'c': + case 'C': + case 'x': + size = 1; + break; + + /* Use 2 bytes of input */ + case 's': + case 'S': + case 'n': + case 'v': + size = 2; + break; + + /* Use sizeof(int) bytes of input */ + case 'i': + case 'I': + size = sizeof(int); + break; + + /* Use 4 bytes of input */ + case 'l': + case 'L': + case 'N': + case 'V': + size = 4; + break; + + /* Use sizeof(float) bytes of input */ + case 'f': + size = sizeof(float); + break; + + /* Use sizeof(double) bytes of input */ + case 'd': + size = sizeof(double); + break; + + default: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid format type %c", type); + zval_dtor(return_value); + RETURN_FALSE; + break; + } + + /* Do actual unpacking */ + for (i = 0; i != arg; i++ ) { + /* Space for name + number, safe as namelen is ensured <= 200 */ + char n[256]; + + if (arg != 1 || namelen == 0) { + /* Need to add element number to name */ + snprintf(n, sizeof(n), "%.*s%d", namelen, name, i + 1); + } else { + /* Truncate name to next format code or end of string */ + snprintf(n, sizeof(n), "%.*s", namelen, name); + } + + if (size != 0 && size != -1 && INT_MAX - size + 1 < inputpos) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: integer overflow", type); + inputpos = 0; + } + + if ((inputpos + size) <= inputlen) { + switch ((int) type) { + case 'a': + case 'A': { + char pad = (type == 'a') ? '\0' : ' '; + int len = inputlen - inputpos; /* Remaining string */ + + /* If size was given take minimum of len and size */ + if ((size >= 0) && (len > size)) { + len = size; + } + + size = len; + + /* Remove padding chars from unpacked data */ + while (--len >= 0) { + if (input[inputpos + len] != pad) + break; + } + + add_assoc_stringl(return_value, n, &input[inputpos], len + 1, 1); + break; + } + + case 'h': + case 'H': { + int len = (inputlen - inputpos) * 2; /* Remaining */ + int nibbleshift = (type == 'h') ? 0 : 4; + int first = 1; + char *buf; + int ipos, opos; + + /* If size was given take minimum of len and size */ + if (size >= 0 && len > (size * 2)) { + len = size * 2; + } + + if (argb > 0) { + len -= argb % 2; + } + + buf = emalloc(len + 1); + + for (ipos = opos = 0; opos < len; opos++) { + char cc = (input[inputpos + ipos] >> nibbleshift) & 0xf; + + if (cc < 10) { + cc += '0'; + } else { + cc += 'a' - 10; + } + + buf[opos] = cc; + nibbleshift = (nibbleshift + 4) & 7; + + if (first-- == 0) { + ipos++; + first = 1; + } + } + + buf[len] = '\0'; + add_assoc_stringl(return_value, n, buf, len, 1); + efree(buf); + break; + } + + case 'c': + case 'C': { + int issigned = (type == 'c') ? (input[inputpos] & 0x80) : 0; + long v = php_unpack(&input[inputpos], 1, issigned, byte_map); + add_assoc_long(return_value, n, v); + break; + } + + case 's': + case 'S': + case 'n': + case 'v': { + long v; + int issigned = 0; + int *map = machine_endian_short_map; + + if (type == 's') { + issigned = input[inputpos + (machine_little_endian ? 1 : 0)] & 0x80; + } else if (type == 'n') { + map = big_endian_short_map; + } else if (type == 'v') { + map = little_endian_short_map; + } + + v = php_unpack(&input[inputpos], 2, issigned, map); + add_assoc_long(return_value, n, v); + break; + } + + case 'i': + case 'I': { + long v; + int issigned = 0; + + if (type == 'i') { + issigned = input[inputpos + (machine_little_endian ? (sizeof(int) - 1) : 0)] & 0x80; + } + + v = php_unpack(&input[inputpos], sizeof(int), issigned, int_map); + add_assoc_long(return_value, n, v); + break; + } + + case 'l': + case 'L': + case 'N': + case 'V': { + int issigned = 0; + int *map = machine_endian_long_map; + long v = 0; + + if (type == 'l' || type == 'L') { + issigned = input[inputpos + (machine_little_endian ? 3 : 0)] & 0x80; + } else if (type == 'N') { + issigned = input[inputpos] & 0x80; + map = big_endian_long_map; + } else if (type == 'V') { + issigned = input[inputpos + 3] & 0x80; + map = little_endian_long_map; + } + + if (sizeof(long) > 4 && issigned) { + v = ~INT_MAX; + } + + v |= php_unpack(&input[inputpos], 4, issigned, map); + if (sizeof(long) > 4) { + if (type == 'l') { + v = (signed int) v; + } else { + v = (unsigned int) v; + } + } + add_assoc_long(return_value, n, v); + break; + } + + case 'f': { + float v; + + memcpy(&v, &input[inputpos], sizeof(float)); + add_assoc_double(return_value, n, (double)v); + break; + } + + case 'd': { + double v; + + memcpy(&v, &input[inputpos], sizeof(double)); + add_assoc_double(return_value, n, v); + break; + } + + case 'x': + /* Do nothing with input, just skip it */ + break; + + case 'X': + if (inputpos < size) { + inputpos = -size; + i = arg - 1; /* Break out of for loop */ + + if (arg >= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", type); + } + } + break; + + case '@': + if (arg <= inputlen) { + inputpos = arg; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", type); + } + + i = arg - 1; /* Done, break out of for loop */ + break; + } + + inputpos += size; + if (inputpos < 0) { + if (size != -1) { /* only print warning if not working with * */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", type); + } + inputpos = 0; + } + } else if (arg < 0) { + /* Reached end of input for '*' repeater */ + break; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: not enough input, need %d, have %d", type, size, inputlen - inputpos); + zval_dtor(return_value); + RETURN_FALSE; + } + } + + formatlen--; /* Skip '/' separator, does no harm if inputlen == 0 */ + format++; + } +} +/* }}} */ + +/* {{{ PHP_MINIT_FUNCTION + */ +PHP_MINIT_FUNCTION(pack) +{ + int machine_endian_check = 1; + int i; + + machine_little_endian = ((char *)&machine_endian_check)[0]; + + if (machine_little_endian) { + /* Where to get lo to hi bytes from */ + byte_map[0] = 0; + + for (i = 0; i < (int)sizeof(int); i++) { + int_map[i] = i; + } + + machine_endian_short_map[0] = 0; + machine_endian_short_map[1] = 1; + big_endian_short_map[0] = 1; + big_endian_short_map[1] = 0; + little_endian_short_map[0] = 0; + little_endian_short_map[1] = 1; + + machine_endian_long_map[0] = 0; + machine_endian_long_map[1] = 1; + machine_endian_long_map[2] = 2; + machine_endian_long_map[3] = 3; + big_endian_long_map[0] = 3; + big_endian_long_map[1] = 2; + big_endian_long_map[2] = 1; + big_endian_long_map[3] = 0; + little_endian_long_map[0] = 0; + little_endian_long_map[1] = 1; + little_endian_long_map[2] = 2; + little_endian_long_map[3] = 3; + } + else { + zval val; + int size = sizeof(Z_LVAL(val)); + Z_LVAL(val)=0; /*silence a warning*/ + + /* Where to get hi to lo bytes from */ + byte_map[0] = size - 1; + + for (i = 0; i < (int)sizeof(int); i++) { + int_map[i] = size - (sizeof(int) - i); + } + + machine_endian_short_map[0] = size - 2; + machine_endian_short_map[1] = size - 1; + big_endian_short_map[0] = size - 2; + big_endian_short_map[1] = size - 1; + little_endian_short_map[0] = size - 1; + little_endian_short_map[1] = size - 2; + + machine_endian_long_map[0] = size - 4; + machine_endian_long_map[1] = size - 3; + machine_endian_long_map[2] = size - 2; + machine_endian_long_map[3] = size - 1; + big_endian_long_map[0] = size - 4; + big_endian_long_map[1] = size - 3; + big_endian_long_map[2] = size - 2; + big_endian_long_map[3] = size - 1; + little_endian_long_map[0] = size - 1; + little_endian_long_map[1] = size - 2; + little_endian_long_map[2] = size - 3; + little_endian_long_map[3] = size - 4; + } + + return SUCCESS; +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/ext/standard/pack.h b/ext/standard/pack.h new file mode 100644 index 0000000..2293288 --- /dev/null +++ b/ext/standard/pack.h @@ -0,0 +1,28 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Rasmus Lerdorf | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PACK_H +#define PACK_H + +PHP_MINIT_FUNCTION(pack); +PHP_FUNCTION(pack); +PHP_FUNCTION(unpack); + +#endif /* PACK_H */ diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c new file mode 100644 index 0000000..6add726 --- /dev/null +++ b/ext/standard/pageinfo.c @@ -0,0 +1,201 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Jim Winstead | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "pageinfo.h" +#include "SAPI.h" + +#include +#include +#if HAVE_PWD_H +#ifdef PHP_WIN32 +#include "win32/pwd.h" +#else +#include +#endif +#endif +#if HAVE_GRP_H +# ifdef PHP_WIN32 +# include "win32/grp.h" +# else +# include +# endif +#endif +#ifdef PHP_WIN32 +#undef getgid +#define getgroups(a, b) 0 +#define getgid() 1 +#define getuid() 1 +#endif +#if HAVE_UNISTD_H +#include +#endif +#include +#include +#ifdef PHP_WIN32 +#include +#endif + +#include "ext/standard/basic_functions.h" + +/* {{{ php_statpage + */ +PHPAPI void php_statpage(TSRMLS_D) +{ + struct stat *pstat; + + pstat = sapi_get_stat(TSRMLS_C); + + if (BG(page_uid)==-1 || BG(page_gid)==-1) { + if(pstat) { + BG(page_uid) = pstat->st_uid; + BG(page_gid) = pstat->st_gid; + BG(page_inode) = pstat->st_ino; + BG(page_mtime) = pstat->st_mtime; + } else { /* handler for situations where there is no source file, ex. php -r */ + BG(page_uid) = getuid(); + BG(page_gid) = getgid(); + } + } +} +/* }}} */ + +/* {{{ php_getuid + */ +long php_getuid(TSRMLS_D) +{ + php_statpage(TSRMLS_C); + return (BG(page_uid)); +} +/* }}} */ + +long php_getgid(TSRMLS_D) +{ + php_statpage(TSRMLS_C); + return (BG(page_gid)); +} + +/* {{{ proto int getmyuid(void) + Get PHP script owner's UID */ +PHP_FUNCTION(getmyuid) +{ + long uid; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + uid = php_getuid(TSRMLS_C); + if (uid < 0) { + RETURN_FALSE; + } else { + RETURN_LONG(uid); + } +} +/* }}} */ + +/* {{{ proto int getmygid(void) + Get PHP script owner's GID */ +PHP_FUNCTION(getmygid) +{ + long gid; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + gid = php_getgid(TSRMLS_C); + if (gid < 0) { + RETURN_FALSE; + } else { + RETURN_LONG(gid); + } +} +/* }}} */ + +/* {{{ proto int getmypid(void) + Get current process ID */ +PHP_FUNCTION(getmypid) +{ + int pid; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + pid = getpid(); + if (pid < 0) { + RETURN_FALSE; + } else { + RETURN_LONG((long) pid); + } +} +/* }}} */ + +/* {{{ proto int getmyinode(void) + Get the inode of the current script being parsed */ +PHP_FUNCTION(getmyinode) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + php_statpage(TSRMLS_C); + if (BG(page_inode) < 0) { + RETURN_FALSE; + } else { + RETURN_LONG(BG(page_inode)); + } +} +/* }}} */ + +PHPAPI long php_getlastmod(TSRMLS_D) +{ + php_statpage(TSRMLS_C); + return BG(page_mtime); +} + +/* {{{ proto int getlastmod(void) + Get time of last page modification */ +PHP_FUNCTION(getlastmod) +{ + long lm; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + lm = php_getlastmod(TSRMLS_C); + if (lm < 0) { + RETURN_FALSE; + } else { + RETURN_LONG(lm); + } +} +/* }}} */ + +/*nma + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/pageinfo.h b/ext/standard/pageinfo.h new file mode 100644 index 0000000..9ce7681 --- /dev/null +++ b/ext/standard/pageinfo.h @@ -0,0 +1,35 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Jim Winstead | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PAGEINFO_H +#define PAGEINFO_H + +PHP_FUNCTION(getmyuid); +PHP_FUNCTION(getmygid); +PHP_FUNCTION(getmypid); +PHP_FUNCTION(getmyinode); +PHP_FUNCTION(getlastmod); + +PHPAPI void php_statpage(TSRMLS_D); +PHPAPI long php_getlastmod(TSRMLS_D); +extern long php_getuid(TSRMLS_D); +extern long php_getgid(TSRMLS_D); + +#endif diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h new file mode 100644 index 0000000..942c33f --- /dev/null +++ b/ext/standard/php_array.h @@ -0,0 +1,130 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Andi Gutmans | + | Zeev Suraski | + | Rasmus Lerdorf | + | Andrei Zmievski | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_ARRAY_H +#define PHP_ARRAY_H + +PHP_MINIT_FUNCTION(array); +PHP_MSHUTDOWN_FUNCTION(array); + +PHP_FUNCTION(ksort); +PHP_FUNCTION(krsort); +PHP_FUNCTION(natsort); +PHP_FUNCTION(natcasesort); +PHP_FUNCTION(asort); +PHP_FUNCTION(arsort); +PHP_FUNCTION(sort); +PHP_FUNCTION(rsort); +PHP_FUNCTION(usort); +PHP_FUNCTION(uasort); +PHP_FUNCTION(uksort); +PHP_FUNCTION(array_walk); +PHP_FUNCTION(array_walk_recursive); +PHP_FUNCTION(count); +PHP_FUNCTION(end); +PHP_FUNCTION(prev); +PHP_FUNCTION(next); +PHP_FUNCTION(reset); +PHP_FUNCTION(current); +PHP_FUNCTION(key); +PHP_FUNCTION(min); +PHP_FUNCTION(max); +PHP_FUNCTION(in_array); +PHP_FUNCTION(array_search); +PHP_FUNCTION(extract); +PHP_FUNCTION(compact); +PHP_FUNCTION(array_fill); +PHP_FUNCTION(array_fill_keys); +PHP_FUNCTION(range); +PHP_FUNCTION(shuffle); +PHP_FUNCTION(array_multisort); +PHP_FUNCTION(array_push); +PHP_FUNCTION(array_pop); +PHP_FUNCTION(array_shift); +PHP_FUNCTION(array_unshift); +PHP_FUNCTION(array_splice); +PHP_FUNCTION(array_slice); +PHP_FUNCTION(array_merge); +PHP_FUNCTION(array_merge_recursive); +PHP_FUNCTION(array_replace); +PHP_FUNCTION(array_replace_recursive); +PHP_FUNCTION(array_keys); +PHP_FUNCTION(array_values); +PHP_FUNCTION(array_count_values); +PHP_FUNCTION(array_reverse); +PHP_FUNCTION(array_reduce); +PHP_FUNCTION(array_pad); +PHP_FUNCTION(array_flip); +PHP_FUNCTION(array_change_key_case); +PHP_FUNCTION(array_rand); +PHP_FUNCTION(array_unique); +PHP_FUNCTION(array_intersect); +PHP_FUNCTION(array_intersect_key); +PHP_FUNCTION(array_intersect_ukey); +PHP_FUNCTION(array_uintersect); +PHP_FUNCTION(array_intersect_assoc); +PHP_FUNCTION(array_uintersect_assoc); +PHP_FUNCTION(array_intersect_uassoc); +PHP_FUNCTION(array_uintersect_uassoc); +PHP_FUNCTION(array_diff); +PHP_FUNCTION(array_diff_key); +PHP_FUNCTION(array_diff_ukey); +PHP_FUNCTION(array_udiff); +PHP_FUNCTION(array_diff_assoc); +PHP_FUNCTION(array_udiff_assoc); +PHP_FUNCTION(array_diff_uassoc); +PHP_FUNCTION(array_udiff_uassoc); +PHP_FUNCTION(array_sum); +PHP_FUNCTION(array_product); +PHP_FUNCTION(array_filter); +PHP_FUNCTION(array_map); +PHP_FUNCTION(array_key_exists); +PHP_FUNCTION(array_chunk); +PHP_FUNCTION(array_combine); + +PHPAPI HashTable* php_splice(HashTable *, int, int, zval ***, int, HashTable **); +PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS_DC); +PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC); +PHPAPI int php_multisort_compare(const void *a, const void *b TSRMLS_DC); + +#define PHP_SORT_REGULAR 0 +#define PHP_SORT_NUMERIC 1 +#define PHP_SORT_STRING 2 +#define PHP_SORT_DESC 3 +#define PHP_SORT_ASC 4 +#define PHP_SORT_LOCALE_STRING 5 +#define PHP_SORT_NATURAL 6 +#define PHP_SORT_FLAG_CASE 8 + +ZEND_BEGIN_MODULE_GLOBALS(array) + int *multisort_flags[2]; + int (*compare_func)(zval *result, zval *op1, zval *op2 TSRMLS_DC); +ZEND_END_MODULE_GLOBALS(array) + +#ifdef ZTS +#define ARRAYG(v) TSRMG(array_globals_id, zend_array_globals *, v) +#else +#define ARRAYG(v) (array_globals.v) +#endif + +#endif /* PHP_ARRAY_H */ diff --git a/ext/standard/php_assert.h b/ext/standard/php_assert.h new file mode 100644 index 0000000..02bf277 --- /dev/null +++ b/ext/standard/php_assert.h @@ -0,0 +1,32 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Thies C. Arntzen | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_ASSERT_H +#define PHP_ASSERT_H + +PHP_MINIT_FUNCTION(assert); +PHP_MSHUTDOWN_FUNCTION(assert); +PHP_RINIT_FUNCTION(assert); +PHP_RSHUTDOWN_FUNCTION(assert); +PHP_MINFO_FUNCTION(assert); +PHP_FUNCTION(assert); +PHP_FUNCTION(assert_options); + +#endif /* PHP_ASSERT_H */ diff --git a/ext/standard/php_browscap.h b/ext/standard/php_browscap.h new file mode 100644 index 0000000..da48cce --- /dev/null +++ b/ext/standard/php_browscap.h @@ -0,0 +1,29 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Zeev Suraski | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_BROWSCAP_H +#define PHP_BROWSCAP_H + +PHP_MINIT_FUNCTION(browscap); +PHP_MSHUTDOWN_FUNCTION(browscap); + +PHP_FUNCTION(get_browser); + +#endif /* PHP_BROWSCAP_H */ diff --git a/ext/standard/php_crypt.h b/ext/standard/php_crypt.h new file mode 100644 index 0000000..47d7837 --- /dev/null +++ b/ext/standard/php_crypt.h @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Stig Bakken | + | Zeev Suraski | + | Rasmus Lerdorf | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_CRYPT_H +#define PHP_CRYPT_H + +PHP_FUNCTION(crypt); +#if HAVE_CRYPT +PHP_MINIT_FUNCTION(crypt); +PHP_MSHUTDOWN_FUNCTION(crypt); +PHP_RINIT_FUNCTION(crypt); +#endif + +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c new file mode 100644 index 0000000..8497994 --- /dev/null +++ b/ext/standard/php_crypt_r.c @@ -0,0 +1,428 @@ +/* $Id$ */ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Pierre Alain Joye wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * ---------------------------------------------------------------------------- + * + * from FreeBSD: crypt.c,v 1.5 1996/10/14 08:34:02 phk Exp + * via OpenBSD: md5crypt.c,v 1.9 1997/07/23 20:58:27 kstailey Exp + * via NetBSD: md5crypt.c,v 1.4.2.1 2002/01/22 19:31:59 he Exp + * + */ + +#include "php.h" + +#include + +#if PHP_WIN32 +# include +# include +#endif + +#ifdef HAVE_ATOMIC_H /* Solaris 10 defines atomic API within */ +# include +#else +# include +#endif +#include "php_crypt_r.h" +#include "crypt_freesec.h" + +#if !PHP_WIN32 +#include "ext/standard/md5.h" +#endif + +#ifdef ZTS +MUTEX_T php_crypt_extended_init_lock; +#endif + +/* TODO: enable it when enabling vista/2k8 mode in tsrm */ +#if 0 +CONDITION_VARIABLE initialized; +#endif + +void php_init_crypt_r() +{ +#ifdef ZTS + php_crypt_extended_init_lock = tsrm_mutex_alloc(); +#endif +} + +void php_shutdown_crypt_r() +{ +#ifdef ZTS + tsrm_mutex_free(php_crypt_extended_init_lock); +#endif +} + +void _crypt_extended_init_r(void) +{ +#ifdef PHP_WIN32 + LONG volatile initialized = 0; +#elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */ + volatile unsigned int initialized = 0; +#else + static volatile sig_atomic_t initialized = 0; +#endif + +#ifdef ZTS + tsrm_mutex_lock(php_crypt_extended_init_lock); +#endif + + if (!initialized) { +#ifdef PHP_WIN32 + InterlockedIncrement(&initialized); +#elif defined(HAVE_SYNC_FETCH_AND_ADD) + __sync_fetch_and_add(&initialized, 1); +#elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */ + membar_producer(); + atomic_add_int(&initialized, 1); +#endif + _crypt_extended_init(); + } +#ifdef ZTS + tsrm_mutex_unlock(php_crypt_extended_init_lock); +#endif +} + +/* MD% crypt implementation using the windows CryptoApi */ +#define MD5_MAGIC "$1$" +#define MD5_MAGIC_LEN 3 + +static unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */ + "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +static void +to64(char *s, int32_t v, int n) +{ + while (--n >= 0) { + *s++ = itoa64[v & 0x3f]; + v >>= 6; + } +} + +#if PHP_WIN32 +char * php_md5_crypt_r(const char *pw, const char *salt, char *out) { + HCRYPTPROV hCryptProv; + HCRYPTHASH ctx, ctx1; + unsigned int i, pwl, sl; + const BYTE magic_md5[4] = "$1$"; + const DWORD magic_md5_len = 3; + DWORD dwHashLen; + int pl; + __int32 l; + const char *sp = salt; + const char *ep = salt; + char *p = NULL; + char *passwd = out; + unsigned char final[16]; + + /* Acquire a cryptographic provider context handle. */ + if(!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { + return NULL; + } + + pwl = (unsigned int) strlen(pw); + + /* Refine the salt first */ + sp = salt; + + /* If it starts with the magic string, then skip that */ + if (strncmp(sp, MD5_MAGIC, MD5_MAGIC_LEN) == 0) { + sp += MD5_MAGIC_LEN; + } + + /* It stops at the first '$', max 8 chars */ + for (ep = sp; *ep != '\0' && *ep != '$' && ep < (sp + 8); ep++) { + continue; + } + + /* get the length of the true salt */ + sl = ep - sp; + + /* Create an empty hash object. */ + if(!CryptCreateHash(hCryptProv, CALG_MD5, 0, 0, &ctx)) { + goto _destroyProv; + } + + /* The password first, since that is what is most unknown */ + if(!CryptHashData(ctx, (BYTE *)pw, pwl, 0)) { + goto _destroyCtx0; + } + + /* Then our magic string */ + if(!CryptHashData(ctx, magic_md5, magic_md5_len, 0)) { + goto _destroyCtx0; + } + + /* Then the raw salt */ + if(!CryptHashData( ctx, (BYTE *)sp, sl, 0)) { + goto _destroyCtx0; + } + + /* MD5(pw,salt,pw), valid. */ + /* Then just as many characters of the MD5(pw,salt,pw) */ + if(!CryptCreateHash(hCryptProv, CALG_MD5, 0, 0, &ctx1)) { + goto _destroyCtx0; + } + if(!CryptHashData(ctx1, (BYTE *)pw, pwl, 0)) { + goto _destroyCtx1; + } + if(!CryptHashData(ctx1, (BYTE *)sp, sl, 0)) { + goto _destroyCtx1; + } + if(!CryptHashData(ctx1, (BYTE *)pw, pwl, 0)) { + goto _destroyCtx1; + } + + dwHashLen = 16; + CryptGetHashParam(ctx1, HP_HASHVAL, final, &dwHashLen, 0); + /* MD5(pw,salt,pw). Valid. */ + + for (pl = pwl; pl > 0; pl -= 16) { + CryptHashData(ctx, final, (DWORD)(pl > 16 ? 16 : pl), 0); + } + + /* Don't leave anything around in vm they could use. */ + memset(final, 0, sizeof(final)); + + /* Then something really weird... */ + for (i = pwl; i != 0; i >>= 1) { + if ((i & 1) != 0) { + CryptHashData(ctx, (const BYTE *)final, 1, 0); + } else { + CryptHashData(ctx, (const BYTE *)pw, 1, 0); + } + } + + memcpy(passwd, MD5_MAGIC, MD5_MAGIC_LEN); + + if (strncpy_s(passwd + MD5_MAGIC_LEN, MD5_HASH_MAX_LEN - MD5_MAGIC_LEN, sp, sl + 1) != 0) { + goto _destroyCtx1; + } + passwd[MD5_MAGIC_LEN + sl] = '\0'; + strcat_s(passwd, MD5_HASH_MAX_LEN, "$"); + + dwHashLen = 16; + + /* Fetch the ctx hash value */ + CryptGetHashParam(ctx, HP_HASHVAL, final, &dwHashLen, 0); + + for (i = 0; i < 1000; i++) { + if(!CryptCreateHash(hCryptProv, CALG_MD5, 0, 0, &ctx1)) { + goto _destroyCtx1; + } + + if ((i & 1) != 0) { + if(!CryptHashData(ctx1, (BYTE *)pw, pwl, 0)) { + goto _destroyCtx1; + } + } else { + if(!CryptHashData(ctx1, (BYTE *)final, 16, 0)) { + goto _destroyCtx1; + } + } + + if ((i % 3) != 0) { + if(!CryptHashData(ctx1, (BYTE *)sp, sl, 0)) { + goto _destroyCtx1; + } + } + + if ((i % 7) != 0) { + if(!CryptHashData(ctx1, (BYTE *)pw, pwl, 0)) { + goto _destroyCtx1; + } + } + + if ((i & 1) != 0) { + if(!CryptHashData(ctx1, (BYTE *)final, 16, 0)) { + goto _destroyCtx1; + } + } else { + if(!CryptHashData(ctx1, (BYTE *)pw, pwl, 0)) { + goto _destroyCtx1; + } + } + + /* Fetch the ctx hash value */ + dwHashLen = 16; + CryptGetHashParam(ctx1, HP_HASHVAL, final, &dwHashLen, 0); + if(!(CryptDestroyHash(ctx1))) { + goto _destroyCtx0; + } + } + + ctx1 = (HCRYPTHASH) NULL; + + p = passwd + sl + MD5_MAGIC_LEN + 1; + + l = (final[ 0]<<16) | (final[ 6]<<8) | final[12]; to64(p,l,4); p += 4; + l = (final[ 1]<<16) | (final[ 7]<<8) | final[13]; to64(p,l,4); p += 4; + l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p,l,4); p += 4; + l = (final[ 3]<<16) | (final[ 9]<<8) | final[15]; to64(p,l,4); p += 4; + l = (final[ 4]<<16) | (final[10]<<8) | final[ 5]; to64(p,l,4); p += 4; + l = final[11]; to64(p,l,2); p += 2; + + *p = '\0'; + + memset(final, 0, sizeof(final)); + + +_destroyCtx1: + if (ctx1) { + if (!CryptDestroyHash(ctx1)) { + + } + } + +_destroyCtx0: + CryptDestroyHash(ctx); + +_destroyProv: + /* Release the provider handle.*/ + if(hCryptProv) { + if(!(CryptReleaseContext(hCryptProv, 0))) { + return NULL; + } + } + + return out; +} +#else + +/* + * MD5 password encryption. + */ +char * php_md5_crypt_r(const char *pw, const char *salt, char *out) +{ + static char passwd[MD5_HASH_MAX_LEN], *p; + const char *sp, *ep; + unsigned char final[16]; + unsigned int i, sl, pwl; + PHP_MD5_CTX ctx, ctx1; + php_uint32 l; + int pl; + + pwl = strlen(pw); + + /* Refine the salt first */ + sp = salt; + + /* If it starts with the magic string, then skip that */ + if (strncmp(sp, MD5_MAGIC, MD5_MAGIC_LEN) == 0) + sp += MD5_MAGIC_LEN; + + /* It stops at the first '$', max 8 chars */ + for (ep = sp; *ep != '\0' && *ep != '$' && ep < (sp + 8); ep++) + continue; + + /* get the length of the true salt */ + sl = ep - sp; + + PHP_MD5Init(&ctx); + + /* The password first, since that is what is most unknown */ + PHP_MD5Update(&ctx, (const unsigned char *)pw, pwl); + + /* Then our magic string */ + PHP_MD5Update(&ctx, (const unsigned char *)MD5_MAGIC, MD5_MAGIC_LEN); + + /* Then the raw salt */ + PHP_MD5Update(&ctx, (const unsigned char *)sp, sl); + + /* Then just as many characters of the MD5(pw,salt,pw) */ + PHP_MD5Init(&ctx1); + PHP_MD5Update(&ctx1, (const unsigned char *)pw, pwl); + PHP_MD5Update(&ctx1, (const unsigned char *)sp, sl); + PHP_MD5Update(&ctx1, (const unsigned char *)pw, pwl); + PHP_MD5Final(final, &ctx1); + + for (pl = pwl; pl > 0; pl -= 16) + PHP_MD5Update(&ctx, final, (unsigned int)(pl > 16 ? 16 : pl)); + + /* Don't leave anything around in vm they could use. */ + memset(final, 0, sizeof(final)); + + /* Then something really weird... */ + for (i = pwl; i != 0; i >>= 1) + if ((i & 1) != 0) + PHP_MD5Update(&ctx, final, 1); + else + PHP_MD5Update(&ctx, (const unsigned char *)pw, 1); + + /* Now make the output string */ + memcpy(passwd, MD5_MAGIC, MD5_MAGIC_LEN); + strlcpy(passwd + MD5_MAGIC_LEN, sp, sl + 1); + strcat(passwd, "$"); + + PHP_MD5Final(final, &ctx); + + /* + * And now, just to make sure things don't run too fast. On a 60 MHz + * Pentium this takes 34 msec, so you would need 30 seconds to build + * a 1000 entry dictionary... + */ + for (i = 0; i < 1000; i++) { + PHP_MD5Init(&ctx1); + + if ((i & 1) != 0) + PHP_MD5Update(&ctx1, (const unsigned char *)pw, pwl); + else + PHP_MD5Update(&ctx1, final, 16); + + if ((i % 3) != 0) + PHP_MD5Update(&ctx1, (const unsigned char *)sp, sl); + + if ((i % 7) != 0) + PHP_MD5Update(&ctx1, (const unsigned char *)pw, pwl); + + if ((i & 1) != 0) + PHP_MD5Update(&ctx1, final, 16); + else + PHP_MD5Update(&ctx1, (const unsigned char *)pw, pwl); + + PHP_MD5Final(final, &ctx1); + } + + p = passwd + sl + MD5_MAGIC_LEN + 1; + + l = (final[ 0]<<16) | (final[ 6]<<8) | final[12]; to64(p,l,4); p += 4; + l = (final[ 1]<<16) | (final[ 7]<<8) | final[13]; to64(p,l,4); p += 4; + l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p,l,4); p += 4; + l = (final[ 3]<<16) | (final[ 9]<<8) | final[15]; to64(p,l,4); p += 4; + l = (final[ 4]<<16) | (final[10]<<8) | final[ 5]; to64(p,l,4); p += 4; + l = final[11] ; to64(p,l,2); p += 2; + *p = '\0'; + + /* Don't leave anything around in vm they could use. */ + memset(final, 0, sizeof(final)); + return (passwd); +} + +#undef MD5_MAGIC +#undef MD5_MAGIC_LEN +#endif + diff --git a/ext/standard/php_crypt_r.h b/ext/standard/php_crypt_r.h new file mode 100644 index 0000000..c7f36ea --- /dev/null +++ b/ext/standard/php_crypt_r.h @@ -0,0 +1,59 @@ +/* $Id$ */ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Pierre Alain Joye | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#ifndef PHP_DIR_H +#define PHP_DIR_H + +/* directory functions */ +PHP_MINIT_FUNCTION(dir); +PHP_RINIT_FUNCTION(dir); +PHP_FUNCTION(opendir); +PHP_FUNCTION(closedir); +PHP_FUNCTION(chdir); +#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC +PHP_FUNCTION(chroot); +#endif +PHP_FUNCTION(getcwd); +PHP_FUNCTION(rewinddir); +PHP_NAMED_FUNCTION(php_if_readdir); +PHP_FUNCTION(getdir); +PHP_FUNCTION(glob); +PHP_FUNCTION(scandir); + +#define PHP_SCANDIR_SORT_ASCENDING 0 +#define PHP_SCANDIR_SORT_DESCENDING 1 +#define PHP_SCANDIR_SORT_NONE 2 + +#endif /* PHP_DIR_H */ diff --git a/ext/standard/php_dns.h b/ext/standard/php_dns.h new file mode 100644 index 0000000..0ee8aaa --- /dev/null +++ b/ext/standard/php_dns.h @@ -0,0 +1,81 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: The typical suspects | + | Marcus Boerger | + | Pollita | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_DNS_H +#define PHP_DNS_H + +#if defined(HAVE_DNS_SEARCH) +#define php_dns_search(res, dname, class, type, answer, anslen) \ + ((int)dns_search(res, dname, class, type, answer, anslen, (struct sockaddr *)&from, &fromsize)) +#define php_dns_free_handle(res) \ + dns_free(res) + +#elif defined(HAVE_RES_NSEARCH) +#define php_dns_search(res, dname, class, type, answer, anslen) \ + res_nsearch(res, dname, class, type, answer, anslen); +#define php_dns_free_handle(res) \ + res_nclose(res); \ + php_dns_free_res(*res) + +#elif defined(HAVE_RES_SEARCH) +#define php_dns_search(res, dname, class, type, answer, anslen) \ + res_search(dname, class, type, answer, anslen) +#define php_dns_free_handle(res) /* noop */ + +#endif + +#if defined(HAVE_DNS_SEARCH) || defined(HAVE_RES_NSEARCH) || defined(HAVE_RES_SEARCH) +#define HAVE_DNS_SEARCH_FUNC 1 +#endif + +#if HAVE_DNS_SEARCH_FUNC && HAVE_DN_EXPAND && HAVE_DN_SKIPNAME +#define HAVE_FULL_DNS_FUNCS 1 +#endif + +PHP_FUNCTION(gethostbyaddr); +PHP_FUNCTION(gethostbyname); +PHP_FUNCTION(gethostbynamel); + +#ifdef HAVE_GETHOSTNAME +PHP_FUNCTION(gethostname); +#endif + +#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE))) +PHP_FUNCTION(dns_check_record); + +# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS +PHP_FUNCTION(dns_get_mx); +PHP_FUNCTION(dns_get_record); +PHP_MINIT_FUNCTION(dns); +# endif + +#endif /* defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE))) */ + +#ifndef INT16SZ +#define INT16SZ 2 +#endif + +#ifndef INT32SZ +#define INT32SZ 4 +#endif + +#endif /* PHP_DNS_H */ diff --git a/ext/standard/php_ext_syslog.h b/ext/standard/php_ext_syslog.h new file mode 100644 index 0000000..21d6cd4 --- /dev/null +++ b/ext/standard/php_ext_syslog.h @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Stig Sæther Bakken | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_EXT_SYSLOG_H +#define PHP_EXT_SYSLOG_H + +#ifdef HAVE_SYSLOG_H + +#include "php_syslog.h" + +PHP_MINIT_FUNCTION(syslog); +PHP_RINIT_FUNCTION(syslog); +#ifdef PHP_WIN32 +PHP_RSHUTDOWN_FUNCTION(syslog); +#endif +PHP_MSHUTDOWN_FUNCTION(syslog); + +PHP_FUNCTION(openlog); +PHP_FUNCTION(syslog); +PHP_FUNCTION(closelog); + +#endif + +#endif /* PHP_EXT_SYSLOG_H */ diff --git a/ext/standard/php_filestat.h b/ext/standard/php_filestat.h new file mode 100644 index 0000000..e8e798c --- /dev/null +++ b/ext/standard/php_filestat.h @@ -0,0 +1,115 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Jim Winstead | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_FILESTAT_H +#define PHP_FILESTAT_H + +PHP_RINIT_FUNCTION(filestat); +PHP_RSHUTDOWN_FUNCTION(filestat); + +PHP_FUNCTION(realpath_cache_size); +PHP_FUNCTION(realpath_cache_get); +PHP_FUNCTION(clearstatcache); +PHP_FUNCTION(fileatime); +PHP_FUNCTION(filectime); +PHP_FUNCTION(filegroup); +PHP_FUNCTION(fileinode); +PHP_FUNCTION(filemtime); +PHP_FUNCTION(fileowner); +PHP_FUNCTION(fileperms); +PHP_FUNCTION(filesize); +PHP_FUNCTION(filetype); +PHP_FUNCTION(is_writable); +PHP_FUNCTION(is_readable); +PHP_FUNCTION(is_executable); +PHP_FUNCTION(is_file); +PHP_FUNCTION(is_dir); +PHP_FUNCTION(is_link); +PHP_FUNCTION(file_exists); +PHP_NAMED_FUNCTION(php_if_stat); +PHP_NAMED_FUNCTION(php_if_lstat); +PHP_FUNCTION(disk_total_space); +PHP_FUNCTION(disk_free_space); +PHP_FUNCTION(chown); +PHP_FUNCTION(chgrp); +#if HAVE_LCHOWN +PHP_FUNCTION(lchown); +#endif +#if HAVE_LCHOWN +PHP_FUNCTION(lchgrp); +#endif +PHP_FUNCTION(chmod); +#if HAVE_UTIME +PHP_FUNCTION(touch); +#endif +PHP_FUNCTION(clearstatcache); + +#define MAKE_LONG_ZVAL_INCREF(name, val)\ + MAKE_STD_ZVAL(name); \ + ZVAL_LONG(name, val); \ + Z_ADDREF_P(name); + +#ifdef PHP_WIN32 +#define S_IRUSR S_IREAD +#define S_IWUSR S_IWRITE +#define S_IXUSR S_IEXEC +#define S_IRGRP S_IREAD +#define S_IWGRP S_IWRITE +#define S_IXGRP S_IEXEC +#define S_IROTH S_IREAD +#define S_IWOTH S_IWRITE +#define S_IXOTH S_IEXEC + +#undef getgid +#define getgroups(a, b) 0 +#define getgid() 1 +#define getuid() 1 +#endif + +#ifdef PHP_WIN32 +typedef unsigned int php_stat_len; +#else +typedef int php_stat_len; +#endif + +PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, int filename_len TSRMLS_DC); +PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int type, zval *return_value TSRMLS_DC); + +/* Switches for various filestat functions: */ +#define FS_PERMS 0 +#define FS_INODE 1 +#define FS_SIZE 2 +#define FS_OWNER 3 +#define FS_GROUP 4 +#define FS_ATIME 5 +#define FS_MTIME 6 +#define FS_CTIME 7 +#define FS_TYPE 8 +#define FS_IS_W 9 +#define FS_IS_R 10 +#define FS_IS_X 11 +#define FS_IS_FILE 12 +#define FS_IS_DIR 13 +#define FS_IS_LINK 14 +#define FS_EXISTS 15 +#define FS_LSTAT 16 +#define FS_STAT 17 + +#endif /* PHP_FILESTAT_H */ diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c new file mode 100644 index 0000000..f8d7bda --- /dev/null +++ b/ext/standard/php_fopen_wrapper.c @@ -0,0 +1,409 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Jim Winstead | + | Hartmut Holzgraefe | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#include +#include +#if HAVE_UNISTD_H +#include +#endif + +#include "php.h" +#include "php_globals.h" +#include "php_standard.h" +#include "php_fopen_wrappers.h" +#include "SAPI.h" + +static size_t php_stream_output_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) /* {{{ */ +{ + PHPWRITE(buf, count); + return count; +} +/* }}} */ + +static size_t php_stream_output_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) /* {{{ */ +{ + stream->eof = 1; + return 0; +} +/* }}} */ + +static int php_stream_output_close(php_stream *stream, int close_handle TSRMLS_DC) /* {{{ */ +{ + return 0; +} +/* }}} */ + +php_stream_ops php_stream_output_ops = { + php_stream_output_write, + php_stream_output_read, + php_stream_output_close, + NULL, /* flush */ + "Output", + NULL, /* seek */ + NULL, /* cast */ + NULL, /* stat */ + NULL /* set_option */ +}; + +static size_t php_stream_input_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) /* {{{ */ +{ + return -1; +} +/* }}} */ + +static size_t php_stream_input_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) /* {{{ */ +{ + off_t *position = (off_t*)stream->abstract; + size_t read_bytes = 0; + + if (!stream->eof) { + if (SG(request_info).raw_post_data) { /* data has already been read by a post handler */ + read_bytes = SG(request_info).raw_post_data_length - *position; + if (read_bytes <= count) { + stream->eof = 1; + } else { + read_bytes = count; + } + if (read_bytes) { + memcpy(buf, SG(request_info).raw_post_data + *position, read_bytes); + } + } else if (sapi_module.read_post) { + read_bytes = sapi_module.read_post(buf, count TSRMLS_CC); + if (read_bytes <= 0) { + stream->eof = 1; + read_bytes = 0; + } + /* Increment SG(read_post_bytes) only when something was actually read. */ + SG(read_post_bytes) += read_bytes; + } else { + stream->eof = 1; + } + } + + *position += read_bytes; + + return read_bytes; +} +/* }}} */ + +static int php_stream_input_close(php_stream *stream, int close_handle TSRMLS_DC) /* {{{ */ +{ + efree(stream->abstract); + + return 0; +} +/* }}} */ + +static int php_stream_input_flush(php_stream *stream TSRMLS_DC) /* {{{ */ +{ + return -1; +} +/* }}} */ + +php_stream_ops php_stream_input_ops = { + php_stream_input_write, + php_stream_input_read, + php_stream_input_close, + php_stream_input_flush, + "Input", + NULL, /* seek */ + NULL, /* cast */ + NULL, /* stat */ + NULL /* set_option */ +}; + +static void php_stream_apply_filter_list(php_stream *stream, char *filterlist, int read_chain, int write_chain TSRMLS_DC) /* {{{ */ +{ + char *p, *token; + php_stream_filter *temp_filter; + + p = php_strtok_r(filterlist, "|", &token); + while (p) { + php_url_decode(p, strlen(p)); + if (read_chain) { + if ((temp_filter = php_stream_filter_create(p, NULL, php_stream_is_persistent(stream) TSRMLS_CC))) { + php_stream_filter_append(&stream->readfilters, temp_filter); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create filter (%s)", p); + } + } + if (write_chain) { + if ((temp_filter = php_stream_filter_create(p, NULL, php_stream_is_persistent(stream) TSRMLS_CC))) { + php_stream_filter_append(&stream->writefilters, temp_filter); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create filter (%s)", p); + } + } + p = php_strtok_r(NULL, "|", &token); + } +} +/* }}} */ + +php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ +{ + int fd = -1; + int mode_rw = 0; + php_stream * stream = NULL; + char *p, *token, *pathdup; + long max_memory; + FILE *file = NULL; + + if (!strncasecmp(path, "php://", 6)) { + path += 6; + } + + if (!strncasecmp(path, "temp", 4)) { + path += 4; + max_memory = PHP_STREAM_MAX_MEM; + if (!strncasecmp(path, "/maxmemory:", 11)) { + path += 11; + max_memory = strtol(path, NULL, 10); + if (max_memory < 0) { + php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Max memory must be >= 0"); + return NULL; + } + } + if (strpbrk(mode, "wa+")) { + mode_rw = TEMP_STREAM_DEFAULT; + } else { + mode_rw = TEMP_STREAM_READONLY; + } + return php_stream_temp_create(mode_rw, max_memory); + } + + if (!strcasecmp(path, "memory")) { + if (strpbrk(mode, "wa+")) { + mode_rw = TEMP_STREAM_DEFAULT; + } else { + mode_rw = TEMP_STREAM_READONLY; + } + return php_stream_memory_create(mode_rw); + } + + if (!strcasecmp(path, "output")) { + return php_stream_alloc(&php_stream_output_ops, NULL, 0, "wb"); + } + + if (!strcasecmp(path, "input")) { + if ((options & STREAM_OPEN_FOR_INCLUDE) && !PG(allow_url_include) ) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "URL file-access is disabled in the server configuration"); + } + return NULL; + } + return php_stream_alloc(&php_stream_input_ops, ecalloc(1, sizeof(off_t)), 0, "rb"); + } + + if (!strcasecmp(path, "stdin")) { + if ((options & STREAM_OPEN_FOR_INCLUDE) && !PG(allow_url_include) ) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "URL file-access is disabled in the server configuration"); + } + return NULL; + } + if (!strcmp(sapi_module.name, "cli")) { + static int cli_in = 0; + fd = STDIN_FILENO; + if (cli_in) { + fd = dup(fd); + } else { + cli_in = 1; + file = stdin; + } + } else { + fd = dup(STDIN_FILENO); + } + } else if (!strcasecmp(path, "stdout")) { + if (!strcmp(sapi_module.name, "cli")) { + static int cli_out = 0; + fd = STDOUT_FILENO; + if (cli_out++) { + fd = dup(fd); + } else { + cli_out = 1; + file = stdout; + } + } else { + fd = dup(STDOUT_FILENO); + } + } else if (!strcasecmp(path, "stderr")) { + if (!strcmp(sapi_module.name, "cli")) { + static int cli_err = 0; + fd = STDERR_FILENO; + if (cli_err++) { + fd = dup(fd); + } else { + cli_err = 1; + file = stderr; + } + } else { + fd = dup(STDERR_FILENO); + } + } else if (!strncasecmp(path, "fd/", 3)) { + char *start, + *end; + long fildes_ori; + int dtablesize; + + if (strcmp(sapi_module.name, "cli")) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Direct access to file descriptors is only available from command-line PHP"); + } + return NULL; + } + + if ((options & STREAM_OPEN_FOR_INCLUDE) && !PG(allow_url_include) ) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "URL file-access is disabled in the server configuration"); + } + return NULL; + } + + start = &path[3]; + fildes_ori = strtol(start, &end, 10); + if (end == start || *end != '\0') { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, + "php://fd/ stream must be specified in the form php://fd/"); + return NULL; + } + +#if HAVE_UNISTD_H + dtablesize = getdtablesize(); +#else + dtablesize = INT_MAX; +#endif + + if (fildes_ori < 0 || fildes_ori >= dtablesize) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, + "The file descriptors must be non-negative numbers smaller than %d", dtablesize); + return NULL; + } + + fd = dup(fildes_ori); + if (fd == -1) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, + "Error duping file descriptor %ld; possibly it doesn't exist: " + "[%d]: %s", fildes_ori, errno, strerror(errno)); + return NULL; + } + } else if (!strncasecmp(path, "filter/", 7)) { + /* Save time/memory when chain isn't specified */ + if (strchr(mode, 'r') || strchr(mode, '+')) { + mode_rw |= PHP_STREAM_FILTER_READ; + } + if (strchr(mode, 'w') || strchr(mode, '+') || strchr(mode, 'a')) { + mode_rw |= PHP_STREAM_FILTER_WRITE; + } + pathdup = estrndup(path + 6, strlen(path + 6)); + p = strstr(pathdup, "/resource="); + if (!p) { + php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "No URL resource specified"); + efree(pathdup); + return NULL; + } + if (!(stream = php_stream_open_wrapper(p + 10, mode, options, opened_path))) { + efree(pathdup); + return NULL; + } + + *p = '\0'; + + p = php_strtok_r(pathdup + 1, "/", &token); + while (p) { + if (!strncasecmp(p, "read=", 5)) { + php_stream_apply_filter_list(stream, p + 5, 1, 0 TSRMLS_CC); + } else if (!strncasecmp(p, "write=", 6)) { + php_stream_apply_filter_list(stream, p + 6, 0, 1 TSRMLS_CC); + } else { + php_stream_apply_filter_list(stream, p, mode_rw & PHP_STREAM_FILTER_READ, mode_rw & PHP_STREAM_FILTER_WRITE TSRMLS_CC); + } + p = php_strtok_r(NULL, "/", &token); + } + efree(pathdup); + + return stream; + } else { + /* invalid php://thingy */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid php:// URL specified"); + return NULL; + } + + /* must be stdin, stderr or stdout */ + if (fd == -1) { + /* failed to dup */ + return NULL; + } + +#if defined(S_IFSOCK) && !defined(WIN32) && !defined(__BEOS__) + do { + struct stat st; + memset(&st, 0, sizeof(st)); + if (fstat(fd, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) { + stream = php_stream_sock_open_from_socket(fd, NULL); + if (stream) { + stream->ops = &php_stream_socket_ops; + return stream; + } + } + } while (0); +#endif + + if (file) { + stream = php_stream_fopen_from_file(file, mode); + } else { + stream = php_stream_fopen_from_fd(fd, mode, NULL); + if (stream == NULL) { + close(fd); + } + } + + return stream; +} +/* }}} */ + +static php_stream_wrapper_ops php_stdio_wops = { + php_stream_url_wrap_php, + NULL, /* close */ + NULL, /* fstat */ + NULL, /* stat */ + NULL, /* opendir */ + "PHP", + NULL, /* unlink */ + NULL, /* rename */ + NULL, /* mkdir */ + NULL /* rmdir */ +}; + +php_stream_wrapper php_stream_php_wrapper = { + &php_stdio_wops, + NULL, + 0, /* is_url */ +}; + + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/php_fopen_wrappers.h b/ext/standard/php_fopen_wrappers.h new file mode 100644 index 0000000..5f78256 --- /dev/null +++ b/ext/standard/php_fopen_wrappers.h @@ -0,0 +1,33 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Jim Winstead | + | Hartmut Holzgraefe | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_FOPEN_WRAPPERS_H +#define PHP_FOPEN_WRAPPERS_H + +php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +php_stream *php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +extern PHPAPI php_stream_wrapper php_stream_http_wrapper; +extern PHPAPI php_stream_wrapper php_stream_ftp_wrapper; +extern php_stream_wrapper php_stream_php_wrapper; +extern php_stream_wrapper php_plain_files_wrapper; + +#endif diff --git a/ext/standard/php_ftok.h b/ext/standard/php_ftok.h new file mode 100644 index 0000000..b339349 --- /dev/null +++ b/ext/standard/php_ftok.h @@ -0,0 +1,28 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Andrew Sitnikov | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_FTOK_H +#define PHP_FTOK_H + +#if HAVE_FTOK +PHP_FUNCTION(ftok); +#endif + +#endif /* PHP_FTOK_H */ diff --git a/ext/standard/php_http.h b/ext/standard/php_http.h new file mode 100644 index 0000000..468fd05 --- /dev/null +++ b/ext/standard/php_http.h @@ -0,0 +1,46 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Sara Golemon | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_HTTP_H +#define PHP_HTTP_H + +#include "php.h" +#include "php_smart_str.h" + +PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, + const char *num_prefix, int num_prefix_len, + const char *key_prefix, int key_prefix_len, + const char *key_suffix, int key_suffix_len, + zval *type, char *arg_sep, int enc_type TSRMLS_DC); +#define php_url_encode_hash(ht, formstr) php_url_encode_hash_ex((ht), (formstr), NULL, 0, NULL, 0, NULL, 0, NULL TSRMLS_CC) + +PHP_FUNCTION(http_build_query); + +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ + diff --git a/ext/standard/php_image.h b/ext/standard/php_image.h new file mode 100644 index 0000000..a56e2a0 --- /dev/null +++ b/ext/standard/php_image.h @@ -0,0 +1,66 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Marcus Boerger | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_IMAGE_H +#define PHP_IMAGE_H + +PHP_FUNCTION(getimagesize); +PHP_FUNCTION(getimagesizefromstring); + +PHP_FUNCTION(image_type_to_mime_type); +PHP_FUNCTION(image_type_to_extension); + +/* {{{ enum image_filetype + This enum is used to have ext/standard/image.c and ext/exif/exif.c use + the same constants for file types. +*/ +typedef enum +{ IMAGE_FILETYPE_UNKNOWN=0, + IMAGE_FILETYPE_GIF=1, + IMAGE_FILETYPE_JPEG, + IMAGE_FILETYPE_PNG, + IMAGE_FILETYPE_SWF, + IMAGE_FILETYPE_PSD, + IMAGE_FILETYPE_BMP, + IMAGE_FILETYPE_TIFF_II, /* intel */ + IMAGE_FILETYPE_TIFF_MM, /* motorola */ + IMAGE_FILETYPE_JPC, + IMAGE_FILETYPE_JP2, + IMAGE_FILETYPE_JPX, + IMAGE_FILETYPE_JB2, + IMAGE_FILETYPE_SWC, + IMAGE_FILETYPE_IFF, + IMAGE_FILETYPE_WBMP, + /* IMAGE_FILETYPE_JPEG2000 is a userland alias for IMAGE_FILETYPE_JPC */ + IMAGE_FILETYPE_XBM, + IMAGE_FILETYPE_ICO, +/* WHEN EXTENDING: PLEASE ALSO REGISTER IN image.c:PHP_MINIT_FUNCTION(imagetypes) */ + IMAGE_FILETYPE_COUNT +} image_filetype; +/* }}} */ + +PHP_MINIT_FUNCTION(imagetypes); + +PHPAPI int php_getimagetype(php_stream *stream, char *filetype TSRMLS_DC); + +PHPAPI char * php_image_type_to_mime_type(int image_type); + +#endif /* PHP_IMAGE_H */ diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h new file mode 100644 index 0000000..f998996 --- /dev/null +++ b/ext/standard/php_incomplete_class.h @@ -0,0 +1,68 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Sascha Schumann | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_INCOMPLETE_CLASS_H +#define PHP_INCOMPLETE_CLASS_H + +#include "ext/standard/basic_functions.h" + +#define PHP_IC_ENTRY \ + BG(incomplete_class) + +#define PHP_SET_CLASS_ATTRIBUTES(struc) \ + /* OBJECTS_FIXME: Fix for new object model */ \ + if (Z_OBJ_HT_P(struc)->get_class_entry && \ + Z_OBJCE_P(struc) == BG(incomplete_class)) { \ + class_name = php_lookup_class_name(struc, &name_len); \ + if (!class_name) { \ + name_len = sizeof(INCOMPLETE_CLASS) - 1; \ + class_name = estrndup(INCOMPLETE_CLASS, name_len); \ + } \ + free_class_name = 1; \ + incomplete_class = 1; \ + } else { \ + free_class_name = !zend_get_object_classname(struc, (const char **)&class_name, &name_len TSRMLS_CC);\ + } + +#define PHP_CLEANUP_CLASS_ATTRIBUTES() \ + if (free_class_name) efree(class_name) + +#define PHP_CLASS_ATTRIBUTES \ + char *class_name; \ + zend_uint name_len; \ + zend_bool free_class_name = 0; \ + zend_bool incomplete_class = 0 + +#define INCOMPLETE_CLASS "__PHP_Incomplete_Class" +#define MAGIC_MEMBER "__PHP_Incomplete_Class_Name" + +#ifdef __cplusplus +extern "C" { +#endif + +PHPAPI zend_class_entry *php_create_incomplete_class(TSRMLS_D); +PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen); +PHPAPI void php_store_class_name(zval *object, const char *name, zend_uint len); + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/ext/standard/php_iptc.h b/ext/standard/php_iptc.h new file mode 100644 index 0000000..6b8c50e --- /dev/null +++ b/ext/standard/php_iptc.h @@ -0,0 +1,27 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Thies C. Arntzen | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_IPTC_H +#define PHP_IPTC_H + +PHP_FUNCTION(iptcparse); +PHP_FUNCTION(iptcembed); + +#endif /* PHP_IPTC_H */ diff --git a/ext/standard/php_lcg.h b/ext/standard/php_lcg.h new file mode 100644 index 0000000..3bdab4a --- /dev/null +++ b/ext/standard/php_lcg.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Sascha Schumann | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_LCG_H +#define PHP_LCG_H + +#include "ext/standard/basic_functions.h" + +typedef struct { + php_int32 s1; + php_int32 s2; + int seeded; +} php_lcg_globals; + +PHPAPI double php_combined_lcg(TSRMLS_D); +PHP_FUNCTION(lcg_value); + +PHP_MINIT_FUNCTION(lcg); + +#ifdef ZTS +#define LCG(v) TSRMG(lcg_globals_id, php_lcg_globals *, v) +#else +#define LCG(v) (lcg_globals.v) +#endif + +#endif diff --git a/ext/standard/php_link.h b/ext/standard/php_link.h new file mode 100644 index 0000000..ddc0042 --- /dev/null +++ b/ext/standard/php_link.h @@ -0,0 +1,33 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_LINK_H +#define PHP_LINK_H + +#if defined(HAVE_SYMLINK) || defined(PHP_WIN32) + +PHP_FUNCTION(link); +PHP_FUNCTION(readlink); +PHP_FUNCTION(linkinfo); +PHP_FUNCTION(symlink); + +#endif + +#endif /* PHP_LINK_H */ diff --git a/ext/standard/php_mail.h b/ext/standard/php_mail.h new file mode 100644 index 0000000..092dded --- /dev/null +++ b/ext/standard/php_mail.h @@ -0,0 +1,30 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Rasmus Lerdorf | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_MAIL_H +#define PHP_MAIL_H + +PHP_FUNCTION(mail); +PHP_MINFO_FUNCTION(mail); + +PHP_FUNCTION(ezmlm_hash); +PHPAPI extern int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd TSRMLS_DC); + +#endif /* PHP_MAIL_H */ diff --git a/ext/standard/php_math.h b/ext/standard/php_math.h new file mode 100644 index 0000000..116acd9 --- /dev/null +++ b/ext/standard/php_math.h @@ -0,0 +1,173 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Jim Winstead | + | Stig Sæther Bakken | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_MATH_H +#define PHP_MATH_H + +PHPAPI char *_php_math_number_format(double, int, char, char); +PHPAPI char *_php_math_number_format_ex(double, int, char *, size_t, char *, size_t); +PHPAPI char * _php_math_longtobase(zval *arg, int base); +PHPAPI long _php_math_basetolong(zval *arg, int base); +PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret); +PHPAPI char * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC); + +PHP_FUNCTION(sin); +PHP_FUNCTION(cos); +PHP_FUNCTION(tan); +PHP_FUNCTION(asin); +PHP_FUNCTION(acos); +PHP_FUNCTION(atan); +PHP_FUNCTION(atan2); +PHP_FUNCTION(pi); +PHP_FUNCTION(exp); +PHP_FUNCTION(log); +PHP_FUNCTION(log10); +PHP_FUNCTION(is_finite); +PHP_FUNCTION(is_infinite); +PHP_FUNCTION(is_nan); +PHP_FUNCTION(pow); +PHP_FUNCTION(sqrt); +PHP_FUNCTION(srand); +PHP_FUNCTION(rand); +PHP_FUNCTION(getrandmax); +PHP_FUNCTION(mt_srand); +PHP_FUNCTION(mt_rand); +PHP_FUNCTION(mt_getrandmax); +PHP_FUNCTION(abs); +PHP_FUNCTION(ceil); +PHP_FUNCTION(floor); +PHP_FUNCTION(round); +PHP_FUNCTION(decbin); +PHP_FUNCTION(dechex); +PHP_FUNCTION(decoct); +PHP_FUNCTION(bindec); +PHP_FUNCTION(hexdec); +PHP_FUNCTION(octdec); +PHP_FUNCTION(base_convert); +PHP_FUNCTION(number_format); +PHP_FUNCTION(fmod); +PHP_FUNCTION(deg2rad); +PHP_FUNCTION(rad2deg); + + /* + WARNING: these functions are expermental: they could change their names or + disappear in the next version of PHP! + */ +PHP_FUNCTION(hypot); +PHP_FUNCTION(expm1); +PHP_FUNCTION(log1p); + +PHP_FUNCTION(sinh); +PHP_FUNCTION(cosh); +PHP_FUNCTION(tanh); + +PHP_FUNCTION(asinh); +PHP_FUNCTION(acosh); +PHP_FUNCTION(atanh); + +#include + +#ifndef M_E +#define M_E 2.7182818284590452354 /* e */ +#endif + +#ifndef M_LOG2E +#define M_LOG2E 1.4426950408889634074 /* log_2 e */ +#endif + +#ifndef M_LOG10E +#define M_LOG10E 0.43429448190325182765 /* log_10 e */ +#endif + +#ifndef M_LN2 +#define M_LN2 0.69314718055994530942 /* log_e 2 */ +#endif + +#ifndef M_LN10 +#define M_LN10 2.30258509299404568402 /* log_e 10 */ +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846 /* pi */ +#endif + +#ifndef M_PI_2 +#define M_PI_2 1.57079632679489661923 /* pi/2 */ +#endif + +#ifndef M_PI_4 +#define M_PI_4 0.78539816339744830962 /* pi/4 */ +#endif + +#ifndef M_1_PI +#define M_1_PI 0.31830988618379067154 /* 1/pi */ +#endif + +#ifndef M_2_PI +#define M_2_PI 0.63661977236758134308 /* 2/pi */ +#endif + +#ifndef M_SQRTPI +#define M_SQRTPI 1.77245385090551602729 /* sqrt(pi) */ +#endif + +#ifndef M_2_SQRTPI +#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ +#endif + +#ifndef M_LNPI +#define M_LNPI 1.14472988584940017414 /* ln(pi) */ +#endif + +#ifndef M_EULER +#define M_EULER 0.57721566490153286061 /* Euler constant */ +#endif + +#ifndef M_SQRT2 +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +#endif + +#ifndef M_SQRT1_2 +#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ +#endif + +#ifndef M_SQRT3 +#define M_SQRT3 1.73205080756887729352 /* sqrt(3) */ +#endif + +/* Define rounding modes (all are round-to-nearest) */ +#ifndef PHP_ROUND_HALF_UP +#define PHP_ROUND_HALF_UP 0x01 /* Arithmetic rounding, up == away from zero */ +#endif + +#ifndef PHP_ROUND_HALF_DOWN +#define PHP_ROUND_HALF_DOWN 0x02 /* Down == towards zero */ +#endif + +#ifndef PHP_ROUND_HALF_EVEN +#define PHP_ROUND_HALF_EVEN 0x03 /* Banker's rounding */ +#endif + +#ifndef PHP_ROUND_HALF_ODD +#define PHP_ROUND_HALF_ODD 0x04 +#endif + +#endif /* PHP_MATH_H */ diff --git a/ext/standard/php_metaphone.h b/ext/standard/php_metaphone.h new file mode 100644 index 0000000..6af07bb --- /dev/null +++ b/ext/standard/php_metaphone.h @@ -0,0 +1,26 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Thies C. Arntzen | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#ifndef PHP_METAPHONE_H +#define PHP_METAPHONE_H + +PHP_FUNCTION(metaphone); + +#endif diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h new file mode 100644 index 0000000..e831f32 --- /dev/null +++ b/ext/standard/php_rand.h @@ -0,0 +1,60 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Zeev Suraski | + | Pedro Melo | + | Sterling Hughes | + | | + | Based on code from: Shawn Cokus | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#ifndef PHP_RAND_H +#define PHP_RAND_H + +#include +#include "basic_functions.h" + +/* System Rand functions */ +#ifndef RAND_MAX +#define RAND_MAX (1<<15) +#endif + +/* In ZTS mode we rely on rand_r() so we must use RAND_MAX. */ +#if !defined(ZTS) && (defined(HAVE_LRAND48) || defined(HAVE_RANDOM)) +#define PHP_RAND_MAX 2147483647 +#else +#define PHP_RAND_MAX RAND_MAX +#endif + +#define RAND_RANGE(__n, __min, __max, __tmax) \ + (__n) = (__min) + (long) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0))) + +/* MT Rand */ +#define PHP_MT_RAND_MAX ((long) (0x7FFFFFFF)) /* (1<<31) - 1 */ + +#ifdef PHP_WIN32 +#define GENERATE_SEED() (((long) (time(0) * GetCurrentProcessId())) ^ ((long) (1000000.0 * php_combined_lcg(TSRMLS_C)))) +#else +#define GENERATE_SEED() (((long) (time(0) * getpid())) ^ ((long) (1000000.0 * php_combined_lcg(TSRMLS_C)))) +#endif + +PHPAPI void php_srand(long seed TSRMLS_DC); +PHPAPI long php_rand(TSRMLS_D); +PHPAPI void php_mt_srand(php_uint32 seed TSRMLS_DC); +PHPAPI php_uint32 php_mt_rand(TSRMLS_D); + +#endif /* PHP_RAND_H */ diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h new file mode 100644 index 0000000..2fef1d0 --- /dev/null +++ b/ext/standard/php_smart_str.h @@ -0,0 +1,195 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Sascha Schumann | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#ifndef PHP_SMART_STR_H +#define PHP_SMART_STR_H + +#include "php_smart_str_public.h" + +#include +#ifndef SMART_STR_USE_REALLOC +#include +#endif + +#define smart_str_0(x) do { \ + if ((x)->c) { \ + (x)->c[(x)->len] = '\0'; \ + } \ +} while (0) + +#ifndef SMART_STR_PREALLOC +#define SMART_STR_PREALLOC 128 +#endif + +#ifndef SMART_STR_START_SIZE +#define SMART_STR_START_SIZE 78 +#endif + +#ifdef SMART_STR_USE_REALLOC +#define SMART_STR_REALLOC(a,b,c) realloc((a),(b)) +#else +#define SMART_STR_REALLOC(a,b,c) perealloc((a),(b),(c)) +#endif + +#define SMART_STR_DO_REALLOC(d, what) \ + (d)->c = SMART_STR_REALLOC((d)->c, (d)->a + 1, (what)) + +#define smart_str_alloc4(d, n, what, newlen) do { \ + if (!(d)->c) { \ + (d)->len = 0; \ + newlen = (n); \ + (d)->a = newlen < SMART_STR_START_SIZE \ + ? SMART_STR_START_SIZE \ + : newlen + SMART_STR_PREALLOC; \ + SMART_STR_DO_REALLOC(d, what); \ + } else { \ + newlen = (d)->len + (n); \ + if (newlen >= (d)->a) { \ + (d)->a = newlen + SMART_STR_PREALLOC; \ + SMART_STR_DO_REALLOC(d, what); \ + } \ + } \ +} while (0) + +#define smart_str_alloc(d, n, what) \ + smart_str_alloc4((d), (n), (what), newlen) + +/* wrapper */ + +#define smart_str_appends_ex(dest, src, what) \ + smart_str_appendl_ex((dest), (src), strlen(src), (what)) +#define smart_str_appends(dest, src) \ + smart_str_appendl((dest), (src), strlen(src)) + +#define smart_str_appendc(dest, c) \ + smart_str_appendc_ex((dest), (c), 0) +#define smart_str_free(s) \ + smart_str_free_ex((s), 0) +#define smart_str_appendl(dest, src, len) \ + smart_str_appendl_ex((dest), (src), (len), 0) +#define smart_str_append(dest, src) \ + smart_str_append_ex((dest), (src), 0) +#define smart_str_append_long(dest, val) \ + smart_str_append_long_ex((dest), (val), 0) +#define smart_str_append_off_t(dest, val) \ + smart_str_append_off_t_ex((dest), (val), 0) +#define smart_str_append_unsigned(dest, val) \ + smart_str_append_unsigned_ex((dest), (val), 0) + +#define smart_str_appendc_ex(dest, ch, what) do { \ + register size_t __nl; \ + smart_str_alloc4((dest), 1, (what), __nl); \ + (dest)->len = __nl; \ + ((unsigned char *) (dest)->c)[(dest)->len - 1] = (ch); \ +} while (0) + +#define smart_str_free_ex(s, what) do { \ + smart_str *__s = (smart_str *) (s); \ + if (__s->c) { \ + pefree(__s->c, what); \ + __s->c = NULL; \ + } \ + __s->a = __s->len = 0; \ +} while (0) + +#define smart_str_appendl_ex(dest, src, nlen, what) do { \ + register size_t __nl; \ + smart_str *__dest = (smart_str *) (dest); \ + \ + smart_str_alloc4(__dest, (nlen), (what), __nl); \ + memcpy(__dest->c + __dest->len, (src), (nlen)); \ + __dest->len = __nl; \ +} while (0) + +/* input: buf points to the END of the buffer */ +#define smart_str_print_unsigned4(buf, num, vartype, result) do { \ + char *__p = (buf); \ + vartype __num = (num); \ + *__p = '\0'; \ + do { \ + *--__p = (char) (__num % 10) + '0'; \ + __num /= 10; \ + } while (__num > 0); \ + result = __p; \ +} while (0) + +/* buf points to the END of the buffer */ +#define smart_str_print_long4(buf, num, vartype, result) do { \ + if (num < 0) { \ + /* this might cause problems when dealing with LONG_MIN \ + and machines which don't support long long. Works \ + flawlessly on 32bit x86 */ \ + smart_str_print_unsigned4((buf), -(num), vartype, (result)); \ + *--(result) = '-'; \ + } else { \ + smart_str_print_unsigned4((buf), (num), vartype, (result)); \ + } \ +} while (0) + +/* + * these could be replaced using a braced-group inside an expression + * for GCC compatible compilers, e.g. + * + * #define f(..) ({char *r;..;__r;}) + */ + +static inline char *smart_str_print_long(char *buf, long num) { + char *r; + smart_str_print_long4(buf, num, unsigned long, r); + return r; +} + +static inline char *smart_str_print_unsigned(char *buf, long num) { + char *r; + smart_str_print_unsigned4(buf, num, unsigned long, r); + return r; +} + +#define smart_str_append_generic_ex(dest, num, type, vartype, func) do { \ + char __b[32]; \ + char *__t; \ + smart_str_print##func##4 (__b + sizeof(__b) - 1, (num), vartype, __t); \ + smart_str_appendl_ex((dest), __t, __b + sizeof(__b) - 1 - __t, (type)); \ +} while (0) + +#define smart_str_append_unsigned_ex(dest, num, type) \ + smart_str_append_generic_ex((dest), (num), (type), unsigned long, _unsigned) + +#define smart_str_append_long_ex(dest, num, type) \ + smart_str_append_generic_ex((dest), (num), (type), unsigned long, _long) + +#define smart_str_append_off_t_ex(dest, num, type) \ + smart_str_append_generic_ex((dest), (num), (type), off_t, _long) + +#define smart_str_append_ex(dest, src, what) \ + smart_str_appendl_ex((dest), ((smart_str *)(src))->c, \ + ((smart_str *)(src))->len, (what)); + + +#define smart_str_setl(dest, src, nlen) do { \ + (dest)->len = (nlen); \ + (dest)->a = (nlen) + 1; \ + (dest)->c = (char *) (src); \ +} while (0) + +#define smart_str_sets(dest, src) \ + smart_str_setl((dest), (src), strlen(src)); + +#endif diff --git a/ext/standard/php_smart_str_public.h b/ext/standard/php_smart_str_public.h new file mode 100644 index 0000000..ed36a7a --- /dev/null +++ b/ext/standard/php_smart_str_public.h @@ -0,0 +1,32 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Sascha Schumann | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#ifndef PHP_SMART_STR_PUBLIC_H +#define PHP_SMART_STR_PUBLIC_H + +#include + +typedef struct { + char *c; + size_t len; + size_t a; +} smart_str; + +#endif diff --git a/ext/standard/php_standard.h b/ext/standard/php_standard.h new file mode 100644 index 0000000..2ec8516 --- /dev/null +++ b/ext/standard/php_standard.h @@ -0,0 +1,72 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "basic_functions.h" +#include "php_math.h" +#include "php_string.h" +#include "base64.h" +#include "php_dir.h" +#include "php_dns.h" +#include "php_mail.h" +#include "md5.h" +#include "sha1.h" +#include "html.h" +#include "exec.h" +#include "file.h" +#include "php_ext_syslog.h" +#include "php_filestat.h" +#include "php_browscap.h" +#include "pack.h" +#include "datetime.h" +#include "microtime.h" +#include "url.h" +#include "pageinfo.h" +#include "cyr_convert.h" +#include "php_link.h" +#include "fsock.h" +#include "php_image.h" +#include "php_iptc.h" +#include "info.h" +#include "uniqid.h" +#include "php_var.h" +#include "quot_print.h" +#include "dl.h" +#include "php_crypt.h" +#include "head.h" +#include "php_lcg.h" +#include "php_metaphone.h" +#include "php_output.h" +#include "php_array.h" +#include "php_assert.h" +#include "php_versioning.h" +#include "php_ftok.h" +#include "php_type.h" + +#define phpext_standard_ptr basic_functions_module_ptr +PHP_MINIT_FUNCTION(standard_filters); +PHP_MSHUTDOWN_FUNCTION(standard_filters); + + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h new file mode 100644 index 0000000..65219f2 --- /dev/null +++ b/ext/standard/php_string.h @@ -0,0 +1,167 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Stig Sæther Bakken | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +/* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */ + +#ifndef PHP_STRING_H +#define PHP_STRING_H + +PHP_FUNCTION(strspn); +PHP_FUNCTION(strcspn); +PHP_FUNCTION(str_replace); +PHP_FUNCTION(str_ireplace); +PHP_FUNCTION(rtrim); +PHP_FUNCTION(trim); +PHP_FUNCTION(ltrim); +PHP_FUNCTION(soundex); +PHP_FUNCTION(levenshtein); + +PHP_FUNCTION(count_chars); +PHP_FUNCTION(wordwrap); +PHP_FUNCTION(explode); +PHP_FUNCTION(implode); +PHP_FUNCTION(strtok); +PHP_FUNCTION(strtoupper); +PHP_FUNCTION(strtolower); +PHP_FUNCTION(basename); +PHP_FUNCTION(dirname); +PHP_FUNCTION(pathinfo); +PHP_FUNCTION(strstr); +PHP_FUNCTION(strpos); +PHP_FUNCTION(stripos); +PHP_FUNCTION(strrpos); +PHP_FUNCTION(strripos); +PHP_FUNCTION(strrchr); +PHP_FUNCTION(substr); +PHP_FUNCTION(quotemeta); +PHP_FUNCTION(ucfirst); +PHP_FUNCTION(lcfirst); +PHP_FUNCTION(ucwords); +PHP_FUNCTION(strtr); +PHP_FUNCTION(strrev); +PHP_FUNCTION(hebrev); +PHP_FUNCTION(hebrevc); +PHP_FUNCTION(user_sprintf); +PHP_FUNCTION(user_printf); +PHP_FUNCTION(vprintf); +PHP_FUNCTION(vsprintf); +PHP_FUNCTION(addcslashes); +PHP_FUNCTION(addslashes); +PHP_FUNCTION(stripcslashes); +PHP_FUNCTION(stripslashes); +PHP_FUNCTION(chr); +PHP_FUNCTION(ord); +PHP_FUNCTION(nl2br); +PHP_FUNCTION(setlocale); +PHP_FUNCTION(localeconv); +PHP_FUNCTION(nl_langinfo); +PHP_FUNCTION(stristr); +PHP_FUNCTION(chunk_split); +PHP_FUNCTION(parse_str); +PHP_FUNCTION(str_getcsv); +PHP_FUNCTION(bin2hex); +PHP_FUNCTION(hex2bin); +PHP_FUNCTION(similar_text); +PHP_FUNCTION(strip_tags); +PHP_FUNCTION(str_repeat); +PHP_FUNCTION(substr_replace); +PHP_FUNCTION(strnatcmp); +PHP_FUNCTION(strnatcasecmp); +PHP_FUNCTION(substr_count); +PHP_FUNCTION(str_pad); +PHP_FUNCTION(sscanf); +PHP_FUNCTION(str_shuffle); +PHP_FUNCTION(str_word_count); +PHP_FUNCTION(str_split); +PHP_FUNCTION(strpbrk); +PHP_FUNCTION(substr_compare); +#ifdef HAVE_STRCOLL +PHP_FUNCTION(strcoll); +#endif +#if HAVE_STRFMON +PHP_FUNCTION(money_format); +#endif + +#if defined(HAVE_LOCALECONV) && defined(ZTS) +PHP_MINIT_FUNCTION(localeconv); +PHP_MSHUTDOWN_FUNCTION(localeconv); +#endif +#if HAVE_NL_LANGINFO +PHP_MINIT_FUNCTION(nl_langinfo); +#endif + +#define strnatcmp(a, b) \ + strnatcmp_ex(a, strlen(a), b, strlen(b), 0) +#define strnatcasecmp(a, b) \ + strnatcmp_ex(a, strlen(a), b, strlen(b), 1) +PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case); + +#ifdef HAVE_LOCALECONV +PHPAPI struct lconv *localeconv_r(struct lconv *out); +#endif + +PHPAPI char *php_strtoupper(char *s, size_t len); +PHPAPI char *php_strtolower(char *s, size_t len); +PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen); +PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit TSRMLS_DC); +PHPAPI char *php_addcslashes(const char *str, int length, int *new_length, int freeit, char *what, int wlength TSRMLS_DC); +PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC); +PHPAPI void php_stripcslashes(char *str, int *len); +PHPAPI void php_basename(const char *s, size_t len, char *suffix, size_t sufflen, char **p_ret, size_t *p_len TSRMLS_DC); +PHPAPI size_t php_dirname(char *str, size_t len); +PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len); +PHPAPI char *php_str_to_str_ex(char *haystack, int length, char *needle, + int needle_len, char *str, int str_len, int *_new_length, int case_sensitivity, int *replace_count); +PHPAPI char *php_str_to_str(char *haystack, int length, char *needle, + int needle_len, char *str, int str_len, int *_new_length); +PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_value, int mode TSRMLS_DC); +PHPAPI size_t php_strip_tags(char *rbuf, int len, int *state, char *allow, int allow_len); +PHPAPI size_t php_strip_tags_ex(char *rbuf, int len, int *stateptr, char *allow, int allow_len, zend_bool allow_tag_spaces); +PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_len, zval *result, int case_sensitivity, int *replace_count); +PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, zval *result); +PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC); +PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, long limit); + +PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end); +PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end); + +PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive TSRMLS_DC); +PHPAPI int string_natural_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); +PHPAPI int string_natural_case_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); + +#ifndef HAVE_STRERROR +PHPAPI char *php_strerror(int errnum); +#define strerror php_strerror +#endif + +#ifndef HAVE_MBLEN +# define php_mblen(ptr, len) 1 +#else +# if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T) +# define php_mblen(ptr, len) ((ptr) == NULL ? mbsinit(&BG(mblen_state)): (int)mbrlen(ptr, len, &BG(mblen_state))) +# else +# define php_mblen(ptr, len) mblen(ptr, len) +# endif +#endif + +void register_string_constants(INIT_FUNC_ARGS); + +#endif /* PHP_STRING_H */ diff --git a/ext/standard/php_type.h b/ext/standard/php_type.h new file mode 100644 index 0000000..292b667 --- /dev/null +++ b/ext/standard/php_type.h @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Rasmus Lerdorf | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_TYPE_H +#define PHP_TYPE_H + +PHP_FUNCTION(intval); +PHP_FUNCTION(floatval); +PHP_FUNCTION(strval); +PHP_FUNCTION(gettype); +PHP_FUNCTION(settype); +PHP_FUNCTION(is_null); +PHP_FUNCTION(is_resource); +PHP_FUNCTION(is_bool); +PHP_FUNCTION(is_long); +PHP_FUNCTION(is_float); +PHP_FUNCTION(is_numeric); +PHP_FUNCTION(is_string); +PHP_FUNCTION(is_array); +PHP_FUNCTION(is_object); +PHP_FUNCTION(is_scalar); +PHP_FUNCTION(is_callable); + +#endif diff --git a/ext/standard/php_uuencode.h b/ext/standard/php_uuencode.h new file mode 100644 index 0000000..28bcb09 --- /dev/null +++ b/ext/standard/php_uuencode.h @@ -0,0 +1,37 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Ilia Alshanetsky | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_UUENCODE_H +#define PHP_UUENCODE_H + +PHP_FUNCTION(convert_uudecode); +PHP_FUNCTION(convert_uuencode); + +PHPAPI int php_uudecode(char *src, int src_len, char **dest); +PHPAPI int php_uuencode(char *src, int src_len, char **dest); + +#endif /* PHP_UUENCODE_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h new file mode 100644 index 0000000..35343b3 --- /dev/null +++ b/ext/standard/php_var.h @@ -0,0 +1,169 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Jani LehtimÀki | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_VAR_H +#define PHP_VAR_H + +#include "ext/standard/basic_functions.h" +#include "ext/standard/php_smart_str_public.h" + +PHP_FUNCTION(var_dump); +PHP_FUNCTION(var_export); +PHP_FUNCTION(debug_zval_dump); +PHP_FUNCTION(serialize); +PHP_FUNCTION(unserialize); +PHP_FUNCTION(memory_get_usage); +PHP_FUNCTION(memory_get_peak_usage); + +PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC); +PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC); +PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC); + +PHPAPI void php_debug_zval_dump(zval **struc, int level TSRMLS_DC); + +typedef HashTable* php_serialize_data_t; + +struct php_unserialize_data { + void *first; + void *last; + void *first_dtor; + void *last_dtor; +}; + +typedef struct php_unserialize_data* php_unserialize_data_t; + +PHPAPI void php_var_serialize(smart_str *buf, zval **struc, php_serialize_data_t *var_hash TSRMLS_DC); +PHPAPI int php_var_unserialize(zval **rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC); + +#define PHP_VAR_SERIALIZE_INIT(var_hash_ptr) \ +do { \ + /* fprintf(stderr, "SERIALIZE_INIT == lock: %u, level: %u\n", BG(serialize_lock), BG(serialize).level); */ \ + if (BG(serialize_lock) || !BG(serialize).level) { \ + ALLOC_HASHTABLE(var_hash_ptr); \ + zend_hash_init((var_hash_ptr), 10, NULL, NULL, 0); \ + if (!BG(serialize_lock)) { \ + BG(serialize).var_hash = (void *)(var_hash_ptr); \ + BG(serialize).level = 1; \ + } \ + } else { \ + (var_hash_ptr) = (php_serialize_data_t)BG(serialize).var_hash; \ + ++BG(serialize).level; \ + } \ +} while(0) + +#define PHP_VAR_SERIALIZE_DESTROY(var_hash_ptr) \ +do { \ + /* fprintf(stderr, "SERIALIZE_DESTROY == lock: %u, level: %u\n", BG(serialize_lock), BG(serialize).level); */ \ + if (BG(serialize_lock) || !BG(serialize).level) { \ + zend_hash_destroy((var_hash_ptr)); \ + FREE_HASHTABLE(var_hash_ptr); \ + } else { \ + if (!--BG(serialize).level) { \ + zend_hash_destroy((php_serialize_data_t)BG(serialize).var_hash); \ + FREE_HASHTABLE((php_serialize_data_t)BG(serialize).var_hash); \ + BG(serialize).var_hash = NULL; \ + } \ + } \ +} while (0) + +#define PHP_VAR_UNSERIALIZE_INIT(var_hash_ptr) \ +do { \ + /* fprintf(stderr, "UNSERIALIZE_INIT == lock: %u, level: %u\n", BG(serialize_lock), BG(unserialize).level); */ \ + if (BG(serialize_lock) || !BG(unserialize).level) { \ + (var_hash_ptr) = (php_unserialize_data_t)ecalloc(1, sizeof(struct php_unserialize_data)); \ + if (!BG(serialize_lock)) { \ + BG(unserialize).var_hash = (void *)(var_hash_ptr); \ + BG(unserialize).level = 1; \ + } \ + } else { \ + (var_hash_ptr) = (php_unserialize_data_t)BG(unserialize).var_hash; \ + ++BG(unserialize).level; \ + } \ +} while (0) + +#define PHP_VAR_UNSERIALIZE_DESTROY(var_hash_ptr) \ +do { \ + /* fprintf(stderr, "UNSERIALIZE_DESTROY == lock: %u, level: %u\n", BG(serialize_lock), BG(unserialize).level); */ \ + if (BG(serialize_lock) || !BG(unserialize).level) { \ + var_destroy(&(var_hash_ptr)); \ + efree(var_hash_ptr); \ + } else { \ + if (!--BG(unserialize).level) { \ + var_destroy(&(var_hash_ptr)); \ + efree((var_hash_ptr)); \ + BG(unserialize).var_hash = NULL; \ + } \ + } \ +} while (0) + +PHPAPI void var_replace(php_unserialize_data_t *var_hash, zval *ozval, zval **nzval); +PHPAPI void var_push_dtor(php_unserialize_data_t *var_hash, zval **val); +PHPAPI void var_destroy(php_unserialize_data_t *var_hash); + +#define PHP_VAR_UNSERIALIZE_ZVAL_CHANGED(var_hash, ozval, nzval) \ + var_replace((var_hash), (ozval), &(nzval)) + +PHPAPI zend_class_entry *php_create_empty_class(char *class_name, int len); + +static inline int php_varname_check(char *name, int name_len, zend_bool silent TSRMLS_DC) /* {{{ */ +{ + if (name_len == sizeof("GLOBALS") - 1 && !memcmp(name, "GLOBALS", sizeof("GLOBALS") - 1)) { + if (!silent) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted GLOBALS variable overwrite"); + } + return FAILURE; + } else if (name[0] == '_' && + ( + (name_len == sizeof("_GET") - 1 && !memcmp(name, "_GET", sizeof("_GET") - 1)) || + (name_len == sizeof("_POST") - 1 && !memcmp(name, "_POST", sizeof("_POST") - 1)) || + (name_len == sizeof("_COOKIE") - 1 && !memcmp(name, "_COOKIE", sizeof("_COOKIE") - 1)) || + (name_len == sizeof("_ENV") - 1 && !memcmp(name, "_ENV", sizeof("_ENV") - 1)) || + (name_len == sizeof("_SERVER") - 1 && !memcmp(name, "_SERVER", sizeof("_SERVER") - 1)) || + (name_len == sizeof("_SESSION") - 1 && !memcmp(name, "_SESSION", sizeof("_SESSION") - 1)) || + (name_len == sizeof("_FILES") - 1 && !memcmp(name, "_FILES", sizeof("_FILES") - 1)) || + (name_len == sizeof("_REQUEST") -1 && !memcmp(name, "_REQUEST", sizeof("_REQUEST") - 1)) + ) + ) { + if (!silent) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted super-global (%s) variable overwrite", name); + } + return FAILURE; + } else if (name[0] == 'H' && + ( + (name_len == sizeof("HTTP_POST_VARS") - 1 && !memcmp(name, "HTTP_POST_VARS", sizeof("HTTP_POST_VARS") - 1)) || + (name_len == sizeof("HTTP_GET_VARS") - 1 && !memcmp(name, "HTTP_GET_VARS", sizeof("HTTP_GET_VARS") - 1)) || + (name_len == sizeof("HTTP_COOKIE_VARS") - 1 && !memcmp(name, "HTTP_COOKIE_VARS", sizeof("HTTP_COOKIE_VARS") - 1)) || + (name_len == sizeof("HTTP_ENV_VARS") - 1 && !memcmp(name, "HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS") - 1)) || + (name_len == sizeof("HTTP_SERVER_VARS") - 1 && !memcmp(name, "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS") - 1)) || + (name_len == sizeof("HTTP_SESSION_VARS") - 1 && !memcmp(name, "HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS") - 1)) || + (name_len == sizeof("HTTP_RAW_POST_DATA") - 1 && !memcmp(name, "HTTP_RAW_POST_DATA", sizeof("HTTP_RAW_POST_DATA") - 1)) || + (name_len == sizeof("HTTP_POST_FILES") - 1 && !memcmp(name, "HTTP_POST_FILES", sizeof("HTTP_POST_FILES") - 1)) + ) + ) { + if (!silent) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted long input array (%s) overwrite", name); + } + return FAILURE; + } + return SUCCESS; +} +/* }}} */ + +#endif /* PHP_VAR_H */ diff --git a/ext/standard/php_versioning.h b/ext/standard/php_versioning.h new file mode 100644 index 0000000..fcbedac --- /dev/null +++ b/ext/standard/php_versioning.h @@ -0,0 +1,30 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Stig Sæther Bakken | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_VERSIONING_H +#define PHP_VERSIONING_H + +#include "ext/standard/basic_functions.h" + +PHPAPI char *php_canonicalize_version(const char *); +PHPAPI int php_version_compare(const char *, const char *); +PHP_FUNCTION(version_compare); + +#endif diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c new file mode 100644 index 0000000..6373751 --- /dev/null +++ b/ext/standard/proc_open.c @@ -0,0 +1,982 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Wez Furlong | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#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 _XOPEN_SOURCE 500 /* turn on Unix98 */ +# define __EXTENSIONS__ 1 /* Solaris: uint */ +#endif + +#include "php.h" +#include +#include +#include "php_string.h" +#include "ext/standard/head.h" +#include "ext/standard/basic_functions.h" +#include "ext/standard/file.h" +#include "exec.h" +#include "php_globals.h" +#include "SAPI.h" + +#ifdef NETWARE +#include +#include +#endif + +#if HAVE_SYS_WAIT_H +#include +#endif +#if HAVE_SIGNAL_H +#include +#endif + +#if HAVE_SYS_STAT_H +#include +#endif +#if HAVE_FCNTL_H +#include +#endif + +/* This symbol is defined in ext/standard/config.m4. + * Essentially, it is set if you HAVE_FORK || PHP_WIN32 + * Other platforms may modify that configure check and add suitable #ifdefs + * around the alternate code. + * */ +#ifdef PHP_CAN_SUPPORT_PROC_OPEN + +#if 0 && HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_SYS_IOCTL_H && HAVE_TERMIOS_H +# include +# include +# define PHP_CAN_DO_PTS 1 +#endif + +#include "proc_open.h" + +static int le_proc_open; + +/* {{{ _php_array_to_envp */ +static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent TSRMLS_DC) +{ + zval **element; + php_process_env_t env; + char *string_key, *data; +#ifndef PHP_WIN32 + char **ep; +#endif + char *p; + uint string_length, cnt, l, sizeenv=0, el_len; + ulong num_key; + HashTable *target_hash; + HashPosition pos; + + memset(&env, 0, sizeof(env)); + + if (!environment) { + return env; + } + + cnt = zend_hash_num_elements(Z_ARRVAL_P(environment)); + + if (cnt < 1) { +#ifndef PHP_WIN32 + env.envarray = (char **) pecalloc(1, sizeof(char *), is_persistent); +#endif + env.envp = (char *) pecalloc(4, 1, is_persistent); + return env; + } + + target_hash = HASH_OF(environment); + if (!target_hash) { + return env; + } + + /* first, we have to get the size of all the elements in the hash */ + for (zend_hash_internal_pointer_reset_ex(target_hash, &pos); + zend_hash_get_current_data_ex(target_hash, (void **) &element, &pos) == SUCCESS; + zend_hash_move_forward_ex(target_hash, &pos)) { + + convert_to_string_ex(element); + el_len = Z_STRLEN_PP(element); + if (el_len == 0) { + continue; + } + + sizeenv += el_len+1; + + switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_length, &num_key, 0, &pos)) { + case HASH_KEY_IS_STRING: + if (string_length == 0) { + continue; + } + sizeenv += string_length+1; + break; + } + } + +#ifndef PHP_WIN32 + ep = env.envarray = (char **) pecalloc(cnt + 1, sizeof(char *), is_persistent); +#endif + p = env.envp = (char *) pecalloc(sizeenv + 4, 1, is_persistent); + + for (zend_hash_internal_pointer_reset_ex(target_hash, &pos); + zend_hash_get_current_data_ex(target_hash, (void **) &element, &pos) == SUCCESS; + zend_hash_move_forward_ex(target_hash, &pos)) { + + convert_to_string_ex(element); + el_len = Z_STRLEN_PP(element); + + if (el_len == 0) { + continue; + } + + data = Z_STRVAL_PP(element); + switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_length, &num_key, 0, &pos)) { + case HASH_KEY_IS_STRING: + if (string_length == 0) { + continue; + } + + l = string_length + el_len + 1; + memcpy(p, string_key, string_length); + strncat(p, "=", 1); + strncat(p, data, el_len); + +#ifndef PHP_WIN32 + *ep = p; + ++ep; +#endif + p += l; + break; + case HASH_KEY_IS_LONG: + memcpy(p,data,el_len); +#ifndef PHP_WIN32 + *ep = p; + ++ep; +#endif + p += el_len + 1; + break; + case HASH_KEY_NON_EXISTANT: + break; + } + } + + assert((uint)(p - env.envp) <= sizeenv); + + zend_hash_internal_pointer_reset_ex(target_hash, &pos); + + return env; +} +/* }}} */ + +/* {{{ _php_free_envp */ +static void _php_free_envp(php_process_env_t env, int is_persistent) +{ +#ifndef PHP_WIN32 + if (env.envarray) { + pefree(env.envarray, is_persistent); + } +#endif + if (env.envp) { + pefree(env.envp, is_persistent); + } +} +/* }}} */ + +/* {{{ proc_open_rsrc_dtor */ +static void proc_open_rsrc_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) +{ + struct php_process_handle *proc = (struct php_process_handle*)rsrc->ptr; + int i; +#ifdef PHP_WIN32 + DWORD wstatus; +#elif HAVE_SYS_WAIT_H + int wstatus; + pid_t wait_pid; +#endif + + /* Close all handles to avoid a deadlock */ + for (i = 0; i < proc->npipes; i++) { + if (proc->pipes[i] != 0) { + zend_list_delete(proc->pipes[i]); + proc->pipes[i] = 0; + } + } + +#ifdef PHP_WIN32 + WaitForSingleObject(proc->childHandle, INFINITE); + GetExitCodeProcess(proc->childHandle, &wstatus); + FG(pclose_ret) = wstatus; + CloseHandle(proc->childHandle); + +#elif HAVE_SYS_WAIT_H + + do { + wait_pid = waitpid(proc->child, &wstatus, 0); + } while (wait_pid == -1 && errno == EINTR); + + if (wait_pid == -1) { + FG(pclose_ret) = -1; + } else { + if (WIFEXITED(wstatus)) + wstatus = WEXITSTATUS(wstatus); + FG(pclose_ret) = wstatus; + } + +#else + FG(pclose_ret) = -1; +#endif + _php_free_envp(proc->env, proc->is_persistent); + pefree(proc->command, proc->is_persistent); + pefree(proc, proc->is_persistent); + +} +/* }}} */ + +/* {{{ PHP_MINIT_FUNCTION(proc_open) */ +PHP_MINIT_FUNCTION(proc_open) +{ + le_proc_open = zend_register_list_destructors_ex(proc_open_rsrc_dtor, NULL, "process", module_number); + return SUCCESS; +} +/* }}} */ + +/* {{{ proto bool proc_terminate(resource process [, long signal]) + kill a process opened by proc_open */ +PHP_FUNCTION(proc_terminate) +{ + zval *zproc; + struct php_process_handle *proc; + long sig_no = SIGTERM; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zproc, &sig_no) == FAILURE) { + RETURN_FALSE; + } + + ZEND_FETCH_RESOURCE(proc, struct php_process_handle *, &zproc, -1, "process", le_proc_open); + +#ifdef PHP_WIN32 + if (TerminateProcess(proc->childHandle, 255)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } +#else + if (kill(proc->child, sig_no) == 0) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } +#endif +} +/* }}} */ + +/* {{{ proto int proc_close(resource process) + close a process opened by proc_open */ +PHP_FUNCTION(proc_close) +{ + zval *zproc; + struct php_process_handle *proc; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zproc) == FAILURE) { + RETURN_FALSE; + } + + ZEND_FETCH_RESOURCE(proc, struct php_process_handle *, &zproc, -1, "process", le_proc_open); + + zend_list_delete(Z_LVAL_P(zproc)); + RETURN_LONG(FG(pclose_ret)); +} +/* }}} */ + +/* {{{ proto array proc_get_status(resource process) + get information about a process opened by proc_open */ +PHP_FUNCTION(proc_get_status) +{ + zval *zproc; + struct php_process_handle *proc; +#ifdef PHP_WIN32 + DWORD wstatus; +#elif HAVE_SYS_WAIT_H + int wstatus; + pid_t wait_pid; +#endif + int running = 1, signaled = 0, stopped = 0; + int exitcode = -1, termsig = 0, stopsig = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zproc) == FAILURE) { + RETURN_FALSE; + } + + ZEND_FETCH_RESOURCE(proc, struct php_process_handle *, &zproc, -1, "process", le_proc_open); + + array_init(return_value); + + add_assoc_string(return_value, "command", proc->command, 1); + add_assoc_long(return_value, "pid", (long) proc->child); + +#ifdef PHP_WIN32 + + GetExitCodeProcess(proc->childHandle, &wstatus); + + running = wstatus == STILL_ACTIVE; + exitcode = running ? -1 : wstatus; + +#elif HAVE_SYS_WAIT_H + + errno = 0; + wait_pid = waitpid(proc->child, &wstatus, WNOHANG|WUNTRACED); + + if (wait_pid == proc->child) { + if (WIFEXITED(wstatus)) { + running = 0; + exitcode = WEXITSTATUS(wstatus); + } + if (WIFSIGNALED(wstatus)) { + running = 0; + signaled = 1; +#ifdef NETWARE + termsig = WIFTERMSIG(wstatus); +#else + termsig = WTERMSIG(wstatus); +#endif + } + if (WIFSTOPPED(wstatus)) { + stopped = 1; + stopsig = WSTOPSIG(wstatus); + } + } else if (wait_pid == -1) { + running = 0; + } +#endif + + add_assoc_bool(return_value, "running", running); + add_assoc_bool(return_value, "signaled", signaled); + add_assoc_bool(return_value, "stopped", stopped); + add_assoc_long(return_value, "exitcode", exitcode); + add_assoc_long(return_value, "termsig", termsig); + add_assoc_long(return_value, "stopsig", stopsig); +} +/* }}} */ + +/* {{{ handy definitions for portability/readability */ +#ifdef PHP_WIN32 +# define pipe(pair) (CreatePipe(&pair[0], &pair[1], &security, 0) ? 0 : -1) + +# define COMSPEC_NT "cmd.exe" + +static inline HANDLE dup_handle(HANDLE src, BOOL inherit, BOOL closeorig) +{ + HANDLE copy, self = GetCurrentProcess(); + + if (!DuplicateHandle(self, src, self, ©, 0, inherit, DUPLICATE_SAME_ACCESS | + (closeorig ? DUPLICATE_CLOSE_SOURCE : 0))) + return NULL; + return copy; +} + +static inline HANDLE dup_fd_as_handle(int fd) +{ + return dup_handle((HANDLE)_get_osfhandle(fd), TRUE, FALSE); +} + +# define close_descriptor(fd) CloseHandle(fd) +#else +# define close_descriptor(fd) close(fd) +#endif + +#define DESC_PIPE 1 +#define DESC_FILE 2 +#define DESC_PARENT_MODE_WRITE 8 + +struct php_proc_open_descriptor_item { + int index; /* desired fd number in child process */ + php_file_descriptor_t parentend, childend; /* fds for pipes in parent/child */ + int mode; /* mode for proc_open code */ + int mode_flags; /* mode flags for opening fds */ +}; +/* }}} */ + +/* {{{ proto resource proc_open(string command, array descriptorspec, array &pipes [, string cwd [, array env [, array other_options]]]) + Run a process with more control over it's file descriptors */ +PHP_FUNCTION(proc_open) +{ + char *command, *cwd=NULL; + int command_len, cwd_len = 0; + zval *descriptorspec; + zval *pipes; + zval *environment = NULL; + zval *other_options = NULL; + php_process_env_t env; + int ndesc = 0; + int i; + zval **descitem = NULL; + HashPosition pos; + struct php_proc_open_descriptor_item descriptors[PHP_PROC_OPEN_MAX_DESCRIPTORS]; +#ifdef PHP_WIN32 + PROCESS_INFORMATION pi; + HANDLE childHandle; + STARTUPINFO si; + BOOL newprocok; + SECURITY_ATTRIBUTES security; + DWORD dwCreateFlags = 0; + char *command_with_cmd; + UINT old_error_mode; +#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 */ +#ifdef PHP_WIN32 + int suppress_errors = 0; + int bypass_shell = 0; +#endif +#if PHP_CAN_DO_PTS + php_file_descriptor_t dev_ptmx = -1; /* master */ + php_file_descriptor_t slave_pty = -1; +#endif + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "saz|s!a!a!", &command, + &command_len, &descriptorspec, &pipes, &cwd, &cwd_len, &environment, + &other_options) == FAILURE) { + RETURN_FALSE; + } + + command = pestrdup(command, is_persistent); + +#ifdef PHP_WIN32 + if (other_options) { + zval **item; + if (SUCCESS == zend_hash_find(Z_ARRVAL_P(other_options), "suppress_errors", sizeof("suppress_errors"), (void**)&item)) { + if ((Z_TYPE_PP(item) == IS_BOOL || Z_TYPE_PP(item) == IS_LONG) && + Z_LVAL_PP(item)) { + suppress_errors = 1; + } + } + if (SUCCESS == zend_hash_find(Z_ARRVAL_P(other_options), "bypass_shell", sizeof("bypass_shell"), (void**)&item)) { + if ((Z_TYPE_PP(item) == IS_BOOL || Z_TYPE_PP(item) == IS_LONG) && + Z_LVAL_PP(item)) { + bypass_shell = 1; + } + } + } +#endif + + command_len = strlen(command); + + if (environment) { + env = _php_array_to_envp(environment, is_persistent TSRMLS_CC); + } else { + memset(&env, 0, sizeof(env)); + } + + memset(descriptors, 0, sizeof(descriptors)); + +#ifdef PHP_WIN32 + /* we use this to allow the child to inherit handles */ + memset(&security, 0, sizeof(security)); + security.nLength = sizeof(security); + security.bInheritHandle = TRUE; + security.lpSecurityDescriptor = NULL; +#endif + + /* walk the descriptor spec and set up files/pipes */ + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(descriptorspec), &pos); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(descriptorspec), (void **)&descitem, &pos) == SUCCESS) { + char *str_index; + ulong nindex; + zval **ztype; + + str_index = NULL; + zend_hash_get_current_key_ex(Z_ARRVAL_P(descriptorspec), &str_index, NULL, &nindex, 0, &pos); + + if (str_index) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "descriptor spec must be an integer indexed array"); + goto exit_fail; + } + + descriptors[ndesc].index = nindex; + + if (Z_TYPE_PP(descitem) == IS_RESOURCE) { + /* should be a stream - try and dup the descriptor */ + php_stream *stream; + int fd; + + php_stream_from_zval(stream, descitem); + + if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **)&fd, REPORT_ERRORS)) { + goto exit_fail; + } + +#ifdef PHP_WIN32 + descriptors[ndesc].childend = dup_fd_as_handle(fd); + if (descriptors[ndesc].childend == NULL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to dup File-Handle for descriptor %d", nindex); + goto exit_fail; + } +#else + descriptors[ndesc].childend = dup(fd); + if (descriptors[ndesc].childend < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to dup File-Handle for descriptor %ld - %s", nindex, strerror(errno)); + goto exit_fail; + } +#endif + descriptors[ndesc].mode = DESC_FILE; + + } else if (Z_TYPE_PP(descitem) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Descriptor item must be either an array or a File-Handle"); + goto exit_fail; + } else { + + if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 0, (void **)&ztype) == SUCCESS) { + convert_to_string_ex(ztype); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing handle qualifier in array"); + goto exit_fail; + } + + if (strcmp(Z_STRVAL_PP(ztype), "pipe") == 0) { + php_file_descriptor_t newpipe[2]; + zval **zmode; + + if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 1, (void **)&zmode) == SUCCESS) { + convert_to_string_ex(zmode); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing mode parameter for 'pipe'"); + goto exit_fail; + } + + descriptors[ndesc].mode = DESC_PIPE; + + if (0 != pipe(newpipe)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to create pipe %s", strerror(errno)); + goto exit_fail; + } + + if (strncmp(Z_STRVAL_PP(zmode), "w", 1) != 0) { + descriptors[ndesc].parentend = newpipe[1]; + descriptors[ndesc].childend = newpipe[0]; + descriptors[ndesc].mode |= DESC_PARENT_MODE_WRITE; + } else { + descriptors[ndesc].parentend = newpipe[0]; + descriptors[ndesc].childend = newpipe[1]; + } +#ifdef PHP_WIN32 + /* don't let the child inherit the parent side of the pipe */ + descriptors[ndesc].parentend = dup_handle(descriptors[ndesc].parentend, FALSE, TRUE); +#endif + descriptors[ndesc].mode_flags = descriptors[ndesc].mode & DESC_PARENT_MODE_WRITE ? O_WRONLY : O_RDONLY; +#ifdef PHP_WIN32 + if (Z_STRLEN_PP(zmode) >= 2 && Z_STRVAL_PP(zmode)[1] == 'b') + descriptors[ndesc].mode_flags |= O_BINARY; +#endif + + } else if (strcmp(Z_STRVAL_PP(ztype), "file") == 0) { + zval **zfile, **zmode; + int fd; + php_stream *stream; + + descriptors[ndesc].mode = DESC_FILE; + + if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 1, (void **)&zfile) == SUCCESS) { + convert_to_string_ex(zfile); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing file name parameter for 'file'"); + goto exit_fail; + } + + if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 2, (void **)&zmode) == SUCCESS) { + convert_to_string_ex(zmode); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing mode parameter for 'file'"); + goto exit_fail; + } + + /* try a wrapper */ + stream = php_stream_open_wrapper(Z_STRVAL_PP(zfile), Z_STRVAL_PP(zmode), + REPORT_ERRORS|STREAM_WILL_CAST, NULL); + + /* force into an fd */ + if (stream == NULL || FAILURE == php_stream_cast(stream, + PHP_STREAM_CAST_RELEASE|PHP_STREAM_AS_FD, + (void **)&fd, REPORT_ERRORS)) { + goto exit_fail; + } + +#ifdef PHP_WIN32 + descriptors[ndesc].childend = dup_fd_as_handle(fd); + _close(fd); + + /* simulate the append mode by fseeking to the end of the file + this introduces a potential race-condition, but it is the best we can do, though */ + if (strchr(Z_STRVAL_PP(zmode), 'a')) { + SetFilePointer(descriptors[ndesc].childend, 0, NULL, FILE_END); + } +#else + descriptors[ndesc].childend = fd; +#endif + } else if (strcmp(Z_STRVAL_PP(ztype), "pty") == 0) { +#if PHP_CAN_DO_PTS + if (dev_ptmx == -1) { + /* open things up */ + dev_ptmx = open("/dev/ptmx", O_RDWR); + if (dev_ptmx == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to open /dev/ptmx, errno %d", errno); + goto exit_fail; + } + grantpt(dev_ptmx); + unlockpt(dev_ptmx); + slave_pty = open(ptsname(dev_ptmx), O_RDWR); + + if (slave_pty == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to open slave pty, errno %d", errno); + goto exit_fail; + } + } + descriptors[ndesc].mode = DESC_PIPE; + descriptors[ndesc].childend = dup(slave_pty); + descriptors[ndesc].parentend = dup(dev_ptmx); + descriptors[ndesc].mode_flags = O_RDWR; +#else + php_error_docref(NULL TSRMLS_CC, E_WARNING, "pty pseudo terminal not supported on this system"); + goto exit_fail; +#endif + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a valid descriptor spec/mode", Z_STRVAL_PP(ztype)); + goto exit_fail; + } + } + + zend_hash_move_forward_ex(Z_ARRVAL_P(descriptorspec), &pos); + if (++ndesc == PHP_PROC_OPEN_MAX_DESCRIPTORS) + break; + } + +#ifdef PHP_WIN32 + if (cwd == NULL) { + char cur_cwd[MAXPATHLEN]; + char *getcwd_result; + getcwd_result = VCWD_GETCWD(cur_cwd, MAXPATHLEN); + if (!getcwd_result) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot get current directory"); + goto exit_fail; + } + } + + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + si.dwFlags = STARTF_USESTDHANDLES; + + si.hStdInput = GetStdHandle(STD_INPUT_HANDLE); + si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); + si.hStdError = GetStdHandle(STD_ERROR_HANDLE); + + /* redirect stdin/stdout/stderr if requested */ + for (i = 0; i < ndesc; i++) { + switch(descriptors[i].index) { + case 0: + si.hStdInput = descriptors[i].childend; + break; + case 1: + si.hStdOutput = descriptors[i].childend; + break; + case 2: + si.hStdError = descriptors[i].childend; + break; + } + } + + + memset(&pi, 0, sizeof(pi)); + + if (suppress_errors) { + old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX); + } + + dwCreateFlags = NORMAL_PRIORITY_CLASS; + if(strcmp(sapi_module.name, "cli") != 0) { + dwCreateFlags |= CREATE_NO_WINDOW; + } + + if (bypass_shell) { + newprocok = CreateProcess(NULL, command, &security, &security, TRUE, dwCreateFlags, env.envp, cwd, &si, &pi); + } else { + spprintf(&command_with_cmd, 0, "%s /c %s", COMSPEC_NT, command); + + newprocok = CreateProcess(NULL, command_with_cmd, &security, &security, TRUE, dwCreateFlags, env.envp, cwd, &si, &pi); + + efree(command_with_cmd); + } + + if (suppress_errors) { + SetErrorMode(old_error_mode); + } + + if (FALSE == newprocok) { + DWORD dw = GetLastError(); + + /* clean up all the descriptors */ + for (i = 0; i < ndesc; i++) { + CloseHandle(descriptors[i].childend); + if (descriptors[i].parentend) { + CloseHandle(descriptors[i].parentend); + } + } + php_error_docref(NULL TSRMLS_CC, E_WARNING, "CreateProcess failed, error code - %u", dw); + goto exit_fail; + } + + 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 TSRMLS_CC, E_WARNING, "procve failed - %s", strerror(errno)); + goto exit_fail; + } +#elif HAVE_FORK + /* the unix way */ + child = fork(); + + if (child == 0) { + /* this is the child process */ + +#if PHP_CAN_DO_PTS + if (dev_ptmx >= 0) { + int my_pid = getpid(); + +#ifdef TIOCNOTTY + /* detach from original tty. Might only need this if isatty(0) is true */ + ioctl(0,TIOCNOTTY,NULL); +#else + setsid(); +#endif + /* become process group leader */ + setpgid(my_pid, my_pid); + tcsetpgrp(0, my_pid); + } +#endif + + /* close those descriptors that we just opened for the parent stuff, + * dup new descriptors into required descriptors and close the original + * cruft */ + for (i = 0; i < ndesc; i++) { + switch (descriptors[i].mode & ~DESC_PARENT_MODE_WRITE) { + case DESC_PIPE: + close(descriptors[i].parentend); + break; + } + if (dup2(descriptors[i].childend, descriptors[i].index) < 0) + perror("dup2"); + if (descriptors[i].childend != descriptors[i].index) + close(descriptors[i].childend); + } + +#if PHP_CAN_DO_PTS + if (dev_ptmx >= 0) { + close(dev_ptmx); + close(slave_pty); + } +#endif + + if (cwd) { + php_ignore_value(chdir(cwd)); + } + + if (env.envarray) { + execle("/bin/sh", "sh", "-c", command, NULL, env.envarray); + } else { + execl("/bin/sh", "sh", "-c", command, NULL); + } + _exit(127); + + } else 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 TSRMLS_CC, E_WARNING, "fork failed - %s", strerror(errno)); + + goto exit_fail; + + } +#else +# error You lose (configure should not have let you get here) +#endif + /* we forked/spawned and this is the parent */ + + proc = (struct php_process_handle*)pemalloc(sizeof(struct php_process_handle), is_persistent); + proc->is_persistent = is_persistent; + proc->command = command; + proc->npipes = ndesc; + proc->child = child; +#ifdef PHP_WIN32 + proc->childHandle = childHandle; +#endif + proc->env = env; + + if (pipes != NULL) { + zval_dtor(pipes); + } + array_init(pipes); + +#if PHP_CAN_DO_PTS + if (dev_ptmx >= 0) { + close(dev_ptmx); + close(slave_pty); + } +#endif + + /* clean up all the child ends and then open streams on the parent + * ends, where appropriate */ + for (i = 0; i < ndesc; i++) { + char *mode_string=NULL; + php_stream *stream = NULL; + + close_descriptor(descriptors[i].childend); + + switch (descriptors[i].mode & ~DESC_PARENT_MODE_WRITE) { + case DESC_PIPE: + switch(descriptors[i].mode_flags) { +#ifdef PHP_WIN32 + case O_WRONLY|O_BINARY: + mode_string = "wb"; + break; + case O_RDONLY|O_BINARY: + mode_string = "rb"; + break; +#endif + case O_WRONLY: + mode_string = "w"; + break; + case O_RDONLY: + mode_string = "r"; + break; + case O_RDWR: + mode_string = "r+"; + break; + } +#ifdef PHP_WIN32 + stream = php_stream_fopen_from_fd(_open_osfhandle((zend_intptr_t)descriptors[i].parentend, + descriptors[i].mode_flags), mode_string, NULL); +#else + stream = php_stream_fopen_from_fd(descriptors[i].parentend, mode_string, NULL); +# if defined(F_SETFD) && defined(FD_CLOEXEC) + /* mark the descriptor close-on-exec, so that it won't be inherited by potential other children */ + fcntl(descriptors[i].parentend, F_SETFD, FD_CLOEXEC); +# endif +#endif + if (stream) { + zval *retfp; + + /* nasty hack; don't copy it */ + stream->flags |= PHP_STREAM_FLAG_NO_SEEK; + + MAKE_STD_ZVAL(retfp); + php_stream_to_zval(stream, retfp); + add_index_zval(pipes, descriptors[i].index, retfp); + + proc->pipes[i] = Z_LVAL_P(retfp); + } + break; + default: + proc->pipes[i] = 0; + } + } + + ZEND_REGISTER_RESOURCE(return_value, proc, le_proc_open); + return; + +exit_fail: + _php_free_envp(env, is_persistent); + pefree(command, is_persistent); +#if PHP_CAN_DO_PTS + if (dev_ptmx >= 0) { + close(dev_ptmx); + } + if (slave_pty >= 0) { + close(slave_pty); + } +#endif + RETURN_FALSE; + +} +/* }}} */ + +#endif /* PHP_CAN_SUPPORT_PROC_OPEN */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/proc_open.h b/ext/standard/proc_open.h new file mode 100644 index 0000000..da1519b --- /dev/null +++ b/ext/standard/proc_open.h @@ -0,0 +1,52 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Wez Furlong | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#ifdef PHP_WIN32 +typedef HANDLE php_file_descriptor_t; +typedef DWORD php_process_id_t; +#else +typedef int php_file_descriptor_t; +typedef pid_t php_process_id_t; +#endif + +#define PHP_PROC_OPEN_MAX_DESCRIPTORS 16 + +/* Environment block under win32 is a NUL terminated sequence of NUL terminated + * name=value strings. + * Under unix, it is an argv style array. + * */ +typedef struct _php_process_env { + char *envp; +#ifndef PHP_WIN32 + char **envarray; +#endif +} php_process_env_t; + +struct php_process_handle { + php_process_id_t child; +#ifdef PHP_WIN32 + HANDLE childHandle; +#endif + int npipes; + long pipes[PHP_PROC_OPEN_MAX_DESCRIPTORS]; + char *command; + int is_persistent; + php_process_env_t env; +}; + diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c new file mode 100644 index 0000000..28dcc63 --- /dev/null +++ b/ext/standard/quot_print.c @@ -0,0 +1,289 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Kirill Maximov | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#include + +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include + +#include "php.h" +#include "quot_print.h" + +#include + +/* +* Converting HEX char to INT value +*/ +static char php_hex2int(int c) /* {{{ */ +{ + if (isdigit(c)) { + return c - '0'; + } + else if (c >= 'A' && c <= 'F') { + return c - 'A' + 10; + } + else if (c >= 'a' && c <= 'f') { + return c - 'a' + 10; + } + else { + return -1; + } +} +/* }}} */ + +PHPAPI unsigned char *php_quot_print_decode(const unsigned char *str, size_t length, size_t *ret_length, int replace_us_by_ws) /* {{{ */ +{ + register unsigned int i; + register unsigned const char *p1; + register unsigned char *p2; + register unsigned int h_nbl, l_nbl; + + size_t decoded_len, buf_size; + unsigned char *retval; + + static unsigned int hexval_tbl[256] = { + 64, 64, 64, 64, 64, 64, 64, 64, 64, 32, 16, 64, 64, 16, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 32, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 64, 64, 64, 64, 64, 64, + 64, 10, 11, 12, 13, 14, 15, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 10, 11, 12, 13, 14, 15, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 + }; + + if (replace_us_by_ws) { + replace_us_by_ws = '_'; + } + + i = length, p1 = str; buf_size = length; + + while (i > 1 && *p1 != '\0') { + if (*p1 == '=') { + buf_size -= 2; + p1++; + i--; + } + p1++; + i--; + } + + retval = emalloc(buf_size + 1); + i = length; p1 = str; p2 = retval; + decoded_len = 0; + + while (i > 0 && *p1 != '\0') { + if (*p1 == '=') { + i--, p1++; + if (i == 0 || *p1 == '\0') { + break; + } + h_nbl = hexval_tbl[*p1]; + if (h_nbl < 16) { + /* next char should be a hexadecimal digit */ + if ((--i) == 0 || (l_nbl = hexval_tbl[*(++p1)]) >= 16) { + efree(retval); + return NULL; + } + *(p2++) = (h_nbl << 4) | l_nbl, decoded_len++; + i--, p1++; + } else if (h_nbl < 64) { + /* soft line break */ + while (h_nbl == 32) { + if (--i == 0 || (h_nbl = hexval_tbl[*(++p1)]) == 64) { + efree(retval); + return NULL; + } + } + if (p1[0] == '\r' && i >= 2 && p1[1] == '\n') { + i--, p1++; + } + i--, p1++; + } else { + efree(retval); + return NULL; + } + } else { + *(p2++) = (replace_us_by_ws == *p1 ? '\x20': *p1); + i--, p1++, decoded_len++; + } + } + + *p2 = '\0'; + *ret_length = decoded_len; + return retval; +} +/* }}} */ + +#define PHP_QPRINT_MAXL 75 + +PHPAPI unsigned char *php_quot_print_encode(const unsigned char *str, size_t length, size_t *ret_length) /* {{{ */ +{ + unsigned long lp = 0; + unsigned char c, *ret, *d; + char *hex = "0123456789ABCDEF"; + + ret = safe_emalloc(1, 3 * length + 3 * (((3 * length)/PHP_QPRINT_MAXL) + 1), 0); + d = ret; + + while (length--) { + if (((c = *str++) == '\015') && (*str == '\012') && length > 0) { + *d++ = '\015'; + *d++ = *str++; + length--; + lp = 0; + } else { + if (iscntrl (c) || (c == 0x7f) || (c & 0x80) || (c == '=') || ((c == ' ') && (*str == '\015'))) { + if ((((lp+= 3) > PHP_QPRINT_MAXL) && (c <= 0x7f)) + || ((c > 0x7f) && (c <= 0xdf) && ((lp + 3) > PHP_QPRINT_MAXL)) + || ((c > 0xdf) && (c <= 0xef) && ((lp + 6) > PHP_QPRINT_MAXL)) + || ((c > 0xef) && (c <= 0xf4) && ((lp + 9) > PHP_QPRINT_MAXL))) { + *d++ = '='; + *d++ = '\015'; + *d++ = '\012'; + lp = 3; + } + *d++ = '='; + *d++ = hex[c >> 4]; + *d++ = hex[c & 0xf]; + } else { + if ((++lp) > PHP_QPRINT_MAXL) { + *d++ = '='; + *d++ = '\015'; + *d++ = '\012'; + lp = 1; + } + *d++ = c; + } + } + } + *d = '\0'; + *ret_length = d - ret; + + ret = erealloc(ret, *ret_length + 1); + return ret; +} +/* }}} */ + +/* +* +* Decoding Quoted-printable string. +* +*/ +/* {{{ proto string quoted_printable_decode(string str) + Convert a quoted-printable string to an 8 bit string */ +PHP_FUNCTION(quoted_printable_decode) +{ + char *arg1, *str_in, *str_out; + int arg1_len, i = 0, j = 0, k; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg1, &arg1_len) == FAILURE) { + return; + } + + if (arg1_len == 0) { + /* shortcut */ + RETURN_EMPTY_STRING(); + } + + str_in = arg1; + str_out = emalloc(arg1_len + 1); + while (str_in[i]) { + switch (str_in[i]) { + case '=': + if (str_in[i + 1] && str_in[i + 2] && + isxdigit((int) str_in[i + 1]) && + isxdigit((int) str_in[i + 2])) + { + str_out[j++] = (php_hex2int((int) str_in[i + 1]) << 4) + + php_hex2int((int) str_in[i + 2]); + i += 3; + } else /* check for soft line break according to RFC 2045*/ { + k = 1; + while (str_in[i + k] && ((str_in[i + k] == 32) || (str_in[i + k] == 9))) { + /* Possibly, skip spaces/tabs at the end of line */ + k++; + } + if (!str_in[i + k]) { + /* End of line reached */ + i += k; + } + else if ((str_in[i + k] == 13) && (str_in[i + k + 1] == 10)) { + /* CRLF */ + i += k + 2; + } + else if ((str_in[i + k] == 13) || (str_in[i + k] == 10)) { + /* CR or LF */ + i += k + 1; + } + else { + str_out[j++] = str_in[i++]; + } + } + break; + default: + str_out[j++] = str_in[i++]; + } + } + str_out[j] = '\0'; + + RETVAL_STRINGL(str_out, j, 0); +} +/* }}} */ + +/* {{{ proto string quoted_printable_encode(string str) */ +PHP_FUNCTION(quoted_printable_encode) +{ + char *str, *new_str; + int str_len; + size_t new_str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) != SUCCESS) { + return; + } + + if (!str_len) { + RETURN_EMPTY_STRING(); + } + + new_str = (char *)php_quot_print_encode((unsigned char *)str, (size_t)str_len, &new_str_len); + RETURN_STRINGL(new_str, new_str_len, 0); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ \ No newline at end of file diff --git a/ext/standard/quot_print.h b/ext/standard/quot_print.h new file mode 100644 index 0000000..f621caf --- /dev/null +++ b/ext/standard/quot_print.h @@ -0,0 +1,30 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Kirill Maximov (kir@rus.net) | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef QUOT_PRINT_H +#define QUOT_PRINT_H + +PHPAPI unsigned char *php_quot_print_decode(const unsigned char *str, size_t length, size_t *ret_length, int replace_us_by_ws); +PHPAPI unsigned char *php_quot_print_encode(const unsigned char *str, size_t length, size_t *ret_length); + +PHP_FUNCTION(quoted_printable_decode); +PHP_FUNCTION(quoted_printable_encode); + +#endif /* QUOT_PRINT_H */ diff --git a/ext/standard/rand.c b/ext/standard/rand.c new file mode 100644 index 0000000..5f55a41 --- /dev/null +++ b/ext/standard/rand.c @@ -0,0 +1,383 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Zeev Suraski | + | Pedro Melo | + | Sterling Hughes | + | | + | Based on code from: Richard J. Wagner | + | Makoto Matsumoto | + | Takuji Nishimura | + | Shawn Cokus | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#include + +#include "php.h" +#include "php_math.h" +#include "php_rand.h" +#include "php_lcg.h" + +#include "basic_functions.h" + + +/* SYSTEM RAND FUNCTIONS */ + +/* {{{ php_srand + */ +PHPAPI void php_srand(long seed TSRMLS_DC) +{ +#ifdef ZTS + BG(rand_seed) = (unsigned int) seed; +#else +# if defined(HAVE_SRANDOM) + srandom((unsigned int) seed); +# elif defined(HAVE_SRAND48) + srand48(seed); +# else + srand((unsigned int) seed); +# endif +#endif + + /* Seed only once */ + BG(rand_is_seeded) = 1; +} +/* }}} */ + +/* {{{ php_rand + */ +PHPAPI long php_rand(TSRMLS_D) +{ + long ret; + + if (!BG(rand_is_seeded)) { + php_srand(GENERATE_SEED() TSRMLS_CC); + } + +#ifdef ZTS + ret = php_rand_r(&BG(rand_seed)); +#else +# if defined(HAVE_RANDOM) + ret = random(); +# elif defined(HAVE_LRAND48) + ret = lrand48(); +# else + ret = rand(); +# endif +#endif + + return ret; +} +/* }}} */ + + +/* MT RAND FUNCTIONS */ + +/* + The following php_mt_...() functions are based on a C++ class MTRand by + Richard J. Wagner. For more information see the web page at + http://www-personal.engin.umich.edu/~wagnerr/MersenneTwister.html + + Mersenne Twister random number generator -- a C++ class MTRand + Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus + Richard J. Wagner v1.0 15 May 2003 rjwagner@writeme.com + + The Mersenne Twister is an algorithm for generating random numbers. It + was designed with consideration of the flaws in various other generators. + The period, 2^19937-1, and the order of equidistribution, 623 dimensions, + are far greater. The generator is also fast; it avoids multiplication and + division, and it benefits from caches and pipelines. For more information + see the inventors' web page at http://www.math.keio.ac.jp/~matumoto/emt.html + + Reference + M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally + Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on + Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30. + + Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, + Copyright (C) 2000 - 2003, Richard J. Wagner + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#define N MT_N /* length of state vector */ +#define M (397) /* a period parameter */ +#define hiBit(u) ((u) & 0x80000000U) /* mask all but highest bit of u */ +#define loBit(u) ((u) & 0x00000001U) /* mask all but lowest bit of u */ +#define loBits(u) ((u) & 0x7FFFFFFFU) /* mask the highest bit of u */ +#define mixBits(u, v) (hiBit(u)|loBits(v)) /* move hi bit of u to hi bit of v */ + +#define twist(m,u,v) (m ^ (mixBits(u,v)>>1) ^ ((php_uint32)(-(php_int32)(loBit(u))) & 0x9908b0dfU)) + +/* {{{ php_mt_initialize + */ +static inline void php_mt_initialize(php_uint32 seed, php_uint32 *state) +{ + /* Initialize generator state with seed + See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier. + In previous versions, most significant bits (MSBs) of the seed affect + only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto. */ + + register php_uint32 *s = state; + register php_uint32 *r = state; + register int i = 1; + + *s++ = seed & 0xffffffffU; + for( ; i < N; ++i ) { + *s++ = ( 1812433253U * ( *r ^ (*r >> 30) ) + i ) & 0xffffffffU; + r++; + } +} +/* }}} */ + +/* {{{ php_mt_reload + */ +static inline void php_mt_reload(TSRMLS_D) +{ + /* Generate N new values in state + Made clearer and faster by Matthew Bellew (matthew.bellew@home.com) */ + + register php_uint32 *state = BG(state); + register php_uint32 *p = state; + register int i; + + for (i = N - M; i--; ++p) + *p = twist(p[M], p[0], p[1]); + for (i = M; --i; ++p) + *p = twist(p[M-N], p[0], p[1]); + *p = twist(p[M-N], p[0], state[0]); + BG(left) = N; + BG(next) = state; +} +/* }}} */ + +/* {{{ php_mt_srand + */ +PHPAPI void php_mt_srand(php_uint32 seed TSRMLS_DC) +{ + /* Seed the generator with a simple uint32 */ + php_mt_initialize(seed, BG(state)); + php_mt_reload(TSRMLS_C); + + /* Seed only once */ + BG(mt_rand_is_seeded) = 1; +} +/* }}} */ + +/* {{{ php_mt_rand + */ +PHPAPI php_uint32 php_mt_rand(TSRMLS_D) +{ + /* Pull a 32-bit integer from the generator state + Every other access function simply transforms the numbers extracted here */ + + register php_uint32 s1; + + if (BG(left) == 0) { + php_mt_reload(TSRMLS_C); + } + --BG(left); + + s1 = *BG(next)++; + s1 ^= (s1 >> 11); + s1 ^= (s1 << 7) & 0x9d2c5680U; + s1 ^= (s1 << 15) & 0xefc60000U; + return ( s1 ^ (s1 >> 18) ); +} +/* }}} */ + +/* {{{ proto void srand([int seed]) + Seeds random number generator */ +PHP_FUNCTION(srand) +{ + long seed = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &seed) == FAILURE) + return; + + if (ZEND_NUM_ARGS() == 0) + seed = GENERATE_SEED(); + + php_srand(seed TSRMLS_CC); +} +/* }}} */ + +/* {{{ proto void mt_srand([int seed]) + Seeds Mersenne Twister random number generator */ +PHP_FUNCTION(mt_srand) +{ + long seed = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &seed) == FAILURE) + return; + + if (ZEND_NUM_ARGS() == 0) + seed = GENERATE_SEED(); + + php_mt_srand(seed TSRMLS_CC); +} +/* }}} */ + + +/* + * A bit of tricky math here. We want to avoid using a modulus because + * that simply tosses the high-order bits and might skew the distribution + * of random values over the range. Instead we map the range directly. + * + * We need to map the range from 0...M evenly to the range a...b + * Let n = the random number and n' = the mapped random number + * + * Then we have: n' = a + n(b-a)/M + * + * We have a problem here in that only n==M will get mapped to b which + # means the chances of getting b is much much less than getting any of + # the other values in the range. We can fix this by increasing our range + # artifically and using: + # + # n' = a + n(b-a+1)/M + * + # Now we only have a problem if n==M which would cause us to produce a + # number of b+1 which would be bad. So we bump M up by one to make sure + # this will never happen, and the final algorithm looks like this: + # + # n' = a + n(b-a+1)/(M+1) + * + * -RL + */ + +/* {{{ proto int rand([int min, int max]) + Returns a random number */ +PHP_FUNCTION(rand) +{ + long min; + long max; + long number; + int argc = ZEND_NUM_ARGS(); + + if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) + return; + + number = php_rand(TSRMLS_C); + if (argc == 2) { + RAND_RANGE(number, min, max, PHP_RAND_MAX); + } + + RETURN_LONG(number); +} +/* }}} */ + +/* {{{ proto int mt_rand([int min, int max]) + Returns a random number from Mersenne Twister */ +PHP_FUNCTION(mt_rand) +{ + long min; + long max; + long number; + int argc = ZEND_NUM_ARGS(); + + if (argc != 0) { + if (zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) { + return; + } else if (max < min) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "max(%ld) is smaller than min(%ld)", max, min); + RETURN_FALSE; + } + } + + if (!BG(mt_rand_is_seeded)) { + php_mt_srand(GENERATE_SEED() TSRMLS_CC); + } + + /* + * Melo: hmms.. randomMT() returns 32 random bits... + * Yet, the previous php_rand only returns 31 at most. + * So I put a right shift to loose the lsb. It *seems* + * better than clearing the msb. + * Update: + * I talked with Cokus via email and it won't ruin the algorithm + */ + number = (long) (php_mt_rand(TSRMLS_C) >> 1); + if (argc == 2) { + RAND_RANGE(number, min, max, PHP_MT_RAND_MAX); + } + + RETURN_LONG(number); +} +/* }}} */ + +/* {{{ proto int getrandmax(void) + Returns the maximum value a random number can have */ +PHP_FUNCTION(getrandmax) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + RETURN_LONG(PHP_RAND_MAX); +} +/* }}} */ + +/* {{{ proto int mt_getrandmax(void) + Returns the maximum value a random number from Mersenne Twister can have */ +PHP_FUNCTION(mt_getrandmax) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + /* + * Melo: it could be 2^^32 but we only use 2^^31 to maintain + * compatibility with the previous php_rand + */ + RETURN_LONG(PHP_MT_RAND_MAX); /* 2^^31 */ +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c new file mode 100644 index 0000000..02e2c71 --- /dev/null +++ b/ext/standard/scanf.c @@ -0,0 +1,1233 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Clayton Collie | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +/* + scanf.c -- + + This file contains the base code which implements sscanf and by extension + fscanf. Original code is from TCL8.3.0 and bears the following copyright: + + This software is copyrighted by the Regents of the University of + California, Sun Microsystems, Inc., Scriptics Corporation, + and other parties. The following terms apply to all files associated + with the software unless explicitly disclaimed in individual files. + + The authors hereby grant permission to use, copy, modify, distribute, + and license this software and its documentation for any purpose, provided + that existing copyright notices are retained in all copies and that this + notice is included verbatim in any distributions. No written agreement, + license, or royalty fee is required for any of the authorized uses. + Modifications to this software may be copyrighted by their authors + and need not follow the licensing terms described here, provided that + the new terms are clearly indicated on the first page of each file where + they apply. + + IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY + FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY + DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE + IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE + NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR + MODIFICATIONS. + + GOVERNMENT USE: If you are acquiring this software on behalf of the + U.S. government, the Government shall have only "Restricted Rights" + in the software and related documentation as defined in the Federal + Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you + are acquiring the software on behalf of the Department of Defense, the + software shall be classified as "Commercial Computer Software" and the + Government shall have only "Restricted Rights" as defined in Clause + 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the + authors grant the U.S. Government and others acting in its behalf + permission to use and distribute the software in accordance with the + terms specified in this license. +*/ + +#include +#include +#include +#include "php.h" +#include "php_variables.h" +#ifdef HAVE_LOCALE_H +#include +#endif +#include "zend_execute.h" +#include "zend_operators.h" +#include "zend_strtod.h" +#include "php_globals.h" +#include "basic_functions.h" +#include "scanf.h" + +/* + * Flag values used internally by [f|s]canf. + */ +#define SCAN_NOSKIP 0x1 /* Don't skip blanks. */ +#define SCAN_SUPPRESS 0x2 /* Suppress assignment. */ +#define SCAN_UNSIGNED 0x4 /* Read an unsigned value. */ +#define SCAN_WIDTH 0x8 /* A width value was supplied. */ + +#define SCAN_SIGNOK 0x10 /* A +/- character is allowed. */ +#define SCAN_NODIGITS 0x20 /* No digits have been scanned. */ +#define SCAN_NOZERO 0x40 /* No zero digits have been scanned. */ +#define SCAN_XOK 0x80 /* An 'x' is allowed. */ +#define SCAN_PTOK 0x100 /* Decimal point is allowed. */ +#define SCAN_EXPOK 0x200 /* An exponent is allowed. */ + +#define UCHAR(x) (zend_uchar)(x) + +/* + * The following structure contains the information associated with + * a character set. + */ +typedef struct CharSet { + int exclude; /* 1 if this is an exclusion set. */ + int nchars; + char *chars; + int nranges; + struct Range { + char start; + char end; + } *ranges; +} CharSet; + +/* + * Declarations for functions used only in this file. + */ +static char *BuildCharSet(CharSet *cset, char *format); +static int CharInSet(CharSet *cset, int ch); +static void ReleaseCharSet(CharSet *cset); +static inline void scan_set_error_return(int numVars, zval **return_value); + + +/* {{{ BuildCharSet + *---------------------------------------------------------------------- + * + * BuildCharSet -- + * + * This function examines a character set format specification + * and builds a CharSet containing the individual characters and + * character ranges specified. + * + * Results: + * Returns the next format position. + * + * Side effects: + * Initializes the charset. + * + *---------------------------------------------------------------------- + */ +static char * BuildCharSet(CharSet *cset, char *format) +{ + char *ch, start; + int nranges; + char *end; + + memset(cset, 0, sizeof(CharSet)); + + ch = format; + if (*ch == '^') { + cset->exclude = 1; + ch = ++format; + } + end = format + 1; /* verify this - cc */ + + /* + * Find the close bracket so we can overallocate the set. + */ + if (*ch == ']') { + ch = end++; + } + nranges = 0; + while (*ch != ']') { + if (*ch == '-') { + nranges++; + } + ch = end++; + } + + cset->chars = (char *) safe_emalloc(sizeof(char), (end - format - 1), 0); + if (nranges > 0) { + cset->ranges = (struct Range *) safe_emalloc(sizeof(struct Range), nranges, 0); + } else { + cset->ranges = NULL; + } + + /* + * Now build the character set. + */ + cset->nchars = cset->nranges = 0; + ch = format++; + start = *ch; + if (*ch == ']' || *ch == '-') { + cset->chars[cset->nchars++] = *ch; + ch = format++; + } + while (*ch != ']') { + if (*format == '-') { + /* + * This may be the first character of a range, so don't add + * it yet. + */ + start = *ch; + } else if (*ch == '-') { + /* + * Check to see if this is the last character in the set, in which + * case it is not a range and we should add the previous character + * as well as the dash. + */ + if (*format == ']') { + cset->chars[cset->nchars++] = start; + cset->chars[cset->nchars++] = *ch; + } else { + ch = format++; + + /* + * Check to see if the range is in reverse order. + */ + if (start < *ch) { + cset->ranges[cset->nranges].start = start; + cset->ranges[cset->nranges].end = *ch; + } else { + cset->ranges[cset->nranges].start = *ch; + cset->ranges[cset->nranges].end = start; + } + cset->nranges++; + } + } else { + cset->chars[cset->nchars++] = *ch; + } + ch = format++; + } + return format; +} +/* }}} */ + +/* {{{ CharInSet + *---------------------------------------------------------------------- + * + * CharInSet -- + * + * Check to see if a character matches the given set. + * + * Results: + * Returns non-zero if the character matches the given set. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +static int CharInSet(CharSet *cset, int c) +{ + char ch = (char) c; + int i, match = 0; + + for (i = 0; i < cset->nchars; i++) { + if (cset->chars[i] == ch) { + match = 1; + break; + } + } + if (!match) { + for (i = 0; i < cset->nranges; i++) { + if ((cset->ranges[i].start <= ch) + && (ch <= cset->ranges[i].end)) { + match = 1; + break; + } + } + } + return (cset->exclude ? !match : match); +} +/* }}} */ + +/* {{{ ReleaseCharSet + *---------------------------------------------------------------------- + * + * ReleaseCharSet -- + * + * Free the storage associated with a character set. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +static void ReleaseCharSet(CharSet *cset) +{ + efree((char *)cset->chars); + if (cset->ranges) { + efree((char *)cset->ranges); + } +} +/* }}} */ + +/* {{{ ValidateFormat + *---------------------------------------------------------------------- + * + * ValidateFormat -- + * + * Parse the format string and verify that it is properly formed + * and that there are exactly enough variables on the command line. + * + * Results: + * FAILURE or SUCCESS. + * + * Side effects: + * May set php_error based on abnormal conditions. + * + * Parameters : + * format The format string. + * numVars The number of variables passed to the scan command. + * totalSubs The number of variables that will be required. + * + *---------------------------------------------------------------------- +*/ +PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs) +{ +#define STATIC_LIST_SIZE 16 + int gotXpg, gotSequential, value, i, flags; + char *end, *ch = NULL; + int staticAssign[STATIC_LIST_SIZE]; + int *nassign = staticAssign; + int objIndex, xpgSize, nspace = STATIC_LIST_SIZE; + TSRMLS_FETCH(); + + /* + * Initialize an array that records the number of times a variable + * is assigned to by the format string. We use this to detect if + * a variable is multiply assigned or left unassigned. + */ + if (numVars > nspace) { + nassign = (int*)safe_emalloc(sizeof(int), numVars, 0); + nspace = numVars; + } + for (i = 0; i < nspace; i++) { + nassign[i] = 0; + } + + xpgSize = objIndex = gotXpg = gotSequential = 0; + + while (*format != '\0') { + ch = format++; + flags = 0; + + if (*ch != '%') { + continue; + } + ch = format++; + if (*ch == '%') { + continue; + } + if (*ch == '*') { + flags |= SCAN_SUPPRESS; + ch = format++; + goto xpgCheckDone; + } + + if ( isdigit( (int)*ch ) ) { + /* + * Check for an XPG3-style %n$ specification. Note: there + * must not be a mixture of XPG3 specs and non-XPG3 specs + * in the same format string. + */ + value = strtoul(format-1, &end, 10); + if (*end != '$') { + goto notXpg; + } + format = end+1; + ch = format++; + gotXpg = 1; + if (gotSequential) { + goto mixedXPG; + } + objIndex = value - 1; + if ((objIndex < 0) || (numVars && (objIndex >= numVars))) { + goto badIndex; + } else if (numVars == 0) { + /* + * In the case where no vars are specified, the user can + * specify %9999$ legally, so we have to consider special + * rules for growing the assign array. 'value' is + * guaranteed to be > 0. + */ + + /* set a lower artificial limit on this + * in the interest of security and resource friendliness + * 255 arguments should be more than enough. - cc + */ + if (value > SCAN_MAX_ARGS) { + goto badIndex; + } + + xpgSize = (xpgSize > value) ? xpgSize : value; + } + goto xpgCheckDone; + } + +notXpg: + gotSequential = 1; + if (gotXpg) { +mixedXPG: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "cannot mix \"%\" and \"%n$\" conversion specifiers"); + goto error; + } + +xpgCheckDone: + /* + * Parse any width specifier. + */ + if (isdigit(UCHAR(*ch))) { + value = strtoul(format-1, &format, 10); + flags |= SCAN_WIDTH; + ch = format++; + } + + /* + * Ignore size specifier. + */ + if ((*ch == 'l') || (*ch == 'L') || (*ch == 'h')) { + ch = format++; + } + + if (!(flags & SCAN_SUPPRESS) && numVars && (objIndex >= numVars)) { + goto badIndex; + } + + /* + * Handle the various field types. + */ + switch (*ch) { + case 'n': + case 'd': + case 'D': + case 'i': + case 'o': + case 'x': + case 'X': + case 'u': + case 'f': + case 'e': + case 'E': + case 'g': + case 's': + break; + + case 'c': + /* we differ here with the TCL implementation in allowing for */ + /* a character width specification, to be more consistent with */ + /* ANSI. since Zend auto allocates space for vars, this is no */ + /* problem - cc */ + /* + if (flags & SCAN_WIDTH) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field width may not be specified in %c conversion"); + goto error; + } + */ + break; + + case '[': + if (*format == '\0') { + goto badSet; + } + ch = format++; + if (*ch == '^') { + if (*format == '\0') { + goto badSet; + } + ch = format++; + } + if (*ch == ']') { + if (*format == '\0') { + goto badSet; + } + ch = format++; + } + while (*ch != ']') { + if (*format == '\0') { + goto badSet; + } + ch = format++; + } + break; +badSet: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unmatched [ in format string"); + goto error; + + default: { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad scan conversion character \"%c\"", *ch); + goto error; + } + } + + if (!(flags & SCAN_SUPPRESS)) { + if (objIndex >= nspace) { + /* + * Expand the nassign buffer. If we are using XPG specifiers, + * make sure that we grow to a large enough size. xpgSize is + * guaranteed to be at least one larger than objIndex. + */ + value = nspace; + if (xpgSize) { + nspace = xpgSize; + } else { + nspace += STATIC_LIST_SIZE; + } + if (nassign == staticAssign) { + nassign = (void *)safe_emalloc(nspace, sizeof(int), 0); + for (i = 0; i < STATIC_LIST_SIZE; ++i) { + nassign[i] = staticAssign[i]; + } + } else { + nassign = (void *)erealloc((void *)nassign, nspace * sizeof(int)); + } + for (i = value; i < nspace; i++) { + nassign[i] = 0; + } + } + nassign[objIndex]++; + objIndex++; + } + } /* while (*format != '\0') */ + + /* + * Verify that all of the variable were assigned exactly once. + */ + if (numVars == 0) { + if (xpgSize) { + numVars = xpgSize; + } else { + numVars = objIndex; + } + } + if (totalSubs) { + *totalSubs = numVars; + } + for (i = 0; i < numVars; i++) { + if (nassign[i] > 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "Variable is assigned by multiple \"%n$\" conversion specifiers"); + goto error; + } else if (!xpgSize && (nassign[i] == 0)) { + /* + * If the space is empty, and xpgSize is 0 (means XPG wasn't + * used, and/or numVars != 0), then too many vars were given + */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variable is not assigned by any conversion specifiers"); + goto error; + } + } + + if (nassign != staticAssign) { + efree((char *)nassign); + } + return SCAN_SUCCESS; + +badIndex: + if (gotXpg) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "\"%n$\" argument index out of range"); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Different numbers of variable names and field specifiers"); + } + +error: + if (nassign != staticAssign) { + efree((char *)nassign); + } + return SCAN_ERROR_INVALID_FORMAT; +#undef STATIC_LIST_SIZE +} +/* }}} */ + +/* {{{ php_sscanf_internal + * This is the internal function which does processing on behalf of + * both sscanf() and fscanf() + * + * parameters : + * string literal string to be processed + * format format string + * argCount total number of elements in the args array + * args arguments passed in from user function (f|s)scanf + * varStart offset (in args) of 1st variable passed in to (f|s)scanf + * return_value set with the results of the scan + */ + +PHPAPI int php_sscanf_internal( char *string, char *format, + int argCount, zval ***args, + int varStart, zval **return_value TSRMLS_DC) +{ + int numVars, nconversions, totalVars = -1; + int i, result; + long value; + int objIndex; + char *end, *baseString; + zval **current; + char op = 0; + int base = 0; + int underflow = 0; + size_t width; + long (*fn)() = NULL; + char *ch, sch; + int flags; + char buf[64]; /* Temporary buffer to hold scanned number + * strings before they are passed to strtoul() */ + + /* do some sanity checking */ + if ((varStart > argCount) || (varStart < 0)){ + varStart = SCAN_MAX_ARGS + 1; + } + numVars = argCount - varStart; + if (numVars < 0) { + numVars = 0; + } + +#if 0 + zend_printf("
in sscanf_internal :
string is \"%s\", format = \"%s\"
NumVars = %d. VarStart = %d
-------------------------
", + string, format, numVars, varStart); +#endif + /* + * Check for errors in the format string. + */ + if (ValidateFormat(format, numVars, &totalVars) != SCAN_SUCCESS) { + scan_set_error_return( numVars, return_value ); + return SCAN_ERROR_INVALID_FORMAT; + } + + objIndex = numVars ? varStart : 0; + + /* + * If any variables are passed, make sure they are all passed by reference + */ + if (numVars) { + for (i = varStart;i < argCount;i++){ + if ( ! PZVAL_IS_REF( *args[ i ] ) ) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter %d must be passed by reference", i); + scan_set_error_return(numVars, return_value); + return SCAN_ERROR_VAR_PASSED_BYVAL; + } + } + } + + /* + * Allocate space for the result objects. Only happens when no variables + * are specified + */ + if (!numVars) { + zval *tmp; + + /* allocate an array for return */ + array_init(*return_value); + + for (i = 0; i < totalVars; i++) { + MAKE_STD_ZVAL(tmp); + ZVAL_NULL(tmp); + if (add_next_index_zval(*return_value, tmp) == FAILURE) { + scan_set_error_return(0, return_value); + return FAILURE; + } + } + varStart = 0; /* Array index starts from 0 */ + } + + baseString = string; + + /* + * Iterate over the format string filling in the result objects until + * we reach the end of input, the end of the format string, or there + * is a mismatch. + */ + nconversions = 0; + /* note ! - we need to limit the loop for objIndex to keep it in bounds */ + + while (*format != '\0') { + ch = format++; + flags = 0; + + /* + * If we see whitespace in the format, skip whitespace in the string. + */ + if ( isspace( (int)*ch ) ) { + sch = *string; + while ( isspace( (int)sch ) ) { + if (*string == '\0') { + goto done; + } + string++; + sch = *string; + } + continue; + } + + if (*ch != '%') { +literal: + if (*string == '\0') { + underflow = 1; + goto done; + } + sch = *string; + string++; + if (*ch != sch) { + goto done; + } + continue; + } + + ch = format++; + if (*ch == '%') { + goto literal; + } + + /* + * Check for assignment suppression ('*') or an XPG3-style + * assignment ('%n$'). + */ + if (*ch == '*') { + flags |= SCAN_SUPPRESS; + ch = format++; + } else if ( isdigit(UCHAR(*ch))) { + value = strtoul(format-1, &end, 10); + if (*end == '$') { + format = end+1; + ch = format++; + objIndex = varStart + value - 1; + } + } + + /* + * Parse any width specifier. + */ + if ( isdigit(UCHAR(*ch))) { + width = strtoul(format-1, &format, 10); + ch = format++; + } else { + width = 0; + } + + /* + * Ignore size specifier. + */ + if ((*ch == 'l') || (*ch == 'L') || (*ch == 'h')) { + ch = format++; + } + + /* + * Handle the various field types. + */ + switch (*ch) { + case 'n': + if (!(flags & SCAN_SUPPRESS)) { + if (numVars && objIndex >= argCount) { + break; + } else if (numVars) { + zend_uint refcount; + + current = args[objIndex++]; + refcount = Z_REFCOUNT_PP(current); + zval_dtor( *current ); + ZVAL_LONG( *current, (long)(string - baseString) ); + Z_SET_REFCOUNT_PP(current, refcount); + Z_SET_ISREF_PP(current); + } else { + add_index_long(*return_value, objIndex++, string - baseString); + } + } + nconversions++; + continue; + + case 'd': + case 'D': + op = 'i'; + base = 10; + fn = (long (*)())strtol; + break; + case 'i': + op = 'i'; + base = 0; + fn = (long (*)())strtol; + break; + case 'o': + op = 'i'; + base = 8; + fn = (long (*)())strtol; + break; + case 'x': + case 'X': + op = 'i'; + base = 16; + fn = (long (*)())strtol; + break; + case 'u': + op = 'i'; + base = 10; + flags |= SCAN_UNSIGNED; + fn = (long (*)())strtoul; + break; + + case 'f': + case 'e': + case 'E': + case 'g': + op = 'f'; + break; + + case 's': + op = 's'; + break; + + case 'c': + op = 's'; + flags |= SCAN_NOSKIP; + /*-cc-*/ + if (0 == width) { + width = 1; + } + /*-cc-*/ + break; + case '[': + op = '['; + flags |= SCAN_NOSKIP; + break; + } /* switch */ + + /* + * At this point, we will need additional characters from the + * string to proceed. + */ + if (*string == '\0') { + underflow = 1; + goto done; + } + + /* + * Skip any leading whitespace at the beginning of a field unless + * the format suppresses this behavior. + */ + if (!(flags & SCAN_NOSKIP)) { + while (*string != '\0') { + sch = *string; + if (! isspace((int)sch) ) { + break; + } + string++; + } + if (*string == '\0') { + underflow = 1; + goto done; + } + } + + /* + * Perform the requested scanning operation. + */ + switch (op) { + case 'c': + case 's': + /* + * Scan a string up to width characters or whitespace. + */ + if (width == 0) { + width = (size_t) ~0; + } + end = string; + while (*end != '\0') { + sch = *end; + if ( isspace( (int)sch ) ) { + break; + } + end++; + if (--width == 0) { + break; + } + } + if (!(flags & SCAN_SUPPRESS)) { + if (numVars && objIndex >= argCount) { + break; + } else if (numVars) { + zend_uint refcount; + + current = args[objIndex++]; + refcount = Z_REFCOUNT_PP(current); + zval_dtor( *current ); + ZVAL_STRINGL( *current, string, end-string, 1); + Z_SET_REFCOUNT_PP(current, refcount); + Z_SET_ISREF_PP(current); + } else { + add_index_stringl( *return_value, objIndex++, string, end-string, 1); + } + } + string = end; + break; + + case '[': { + CharSet cset; + + if (width == 0) { + width = (size_t) ~0; + } + end = string; + + format = BuildCharSet(&cset, format); + while (*end != '\0') { + sch = *end; + if (!CharInSet(&cset, (int)sch)) { + break; + } + end++; + if (--width == 0) { + break; + } + } + ReleaseCharSet(&cset); + + if (string == end) { + /* + * Nothing matched the range, stop processing + */ + goto done; + } + if (!(flags & SCAN_SUPPRESS)) { + if (numVars && objIndex >= argCount) { + break; + } else if (numVars) { + current = args[objIndex++]; + zval_dtor( *current ); + ZVAL_STRINGL( *current, string, end-string, 1); + } else { + add_index_stringl(*return_value, objIndex++, string, end-string, 1); + } + } + string = end; + break; + } +/* + case 'c': + / Scan a single character./ + + sch = *string; + string++; + if (!(flags & SCAN_SUPPRESS)) { + if (numVars) { + char __buf[2]; + __buf[0] = sch; + __buf[1] = '\0';; + current = args[objIndex++]; + zval_dtor(*current); + ZVAL_STRINGL( *current, __buf, 1, 1); + } else { + add_index_stringl(*return_value, objIndex++, &sch, 1, 1); + } + } + break; +*/ + case 'i': + /* + * Scan an unsigned or signed integer. + */ + /*-cc-*/ + buf[0] = '\0'; + /*-cc-*/ + if ((width == 0) || (width > sizeof(buf) - 1)) { + width = sizeof(buf) - 1; + } + + flags |= SCAN_SIGNOK | SCAN_NODIGITS | SCAN_NOZERO; + for (end = buf; width > 0; width--) { + switch (*string) { + /* + * The 0 digit has special meaning at the beginning of + * a number. If we are unsure of the base, it + * indicates that we are in base 8 or base 16 (if it is + * followed by an 'x'). + */ + case '0': + /*-cc-*/ + if (base == 16) { + flags |= SCAN_XOK; + } + /*-cc-*/ + if (base == 0) { + base = 8; + flags |= SCAN_XOK; + } + if (flags & SCAN_NOZERO) { + flags &= ~(SCAN_SIGNOK | SCAN_NODIGITS | SCAN_NOZERO); + } else { + flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); + } + goto addToInt; + + case '1': case '2': case '3': case '4': + case '5': case '6': case '7': + if (base == 0) { + base = 10; + } + flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); + goto addToInt; + + case '8': case '9': + if (base == 0) { + base = 10; + } + if (base <= 8) { + break; + } + flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); + goto addToInt; + + case 'A': case 'B': case 'C': + case 'D': case 'E': case 'F': + case 'a': case 'b': case 'c': + case 'd': case 'e': case 'f': + if (base <= 10) { + break; + } + flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); + goto addToInt; + + case '+': case '-': + if (flags & SCAN_SIGNOK) { + flags &= ~SCAN_SIGNOK; + goto addToInt; + } + break; + + case 'x': case 'X': + if ((flags & SCAN_XOK) && (end == buf+1)) { + base = 16; + flags &= ~SCAN_XOK; + goto addToInt; + } + break; + } + + /* + * We got an illegal character so we are done accumulating. + */ + break; + +addToInt: + /* + * Add the character to the temporary buffer. + */ + *end++ = *string++; + if (*string == '\0') { + break; + } + } + + /* + * Check to see if we need to back up because we only got a + * sign or a trailing x after a 0. + */ + if (flags & SCAN_NODIGITS) { + if (*string == '\0') { + underflow = 1; + } + goto done; + } else if (end[-1] == 'x' || end[-1] == 'X') { + end--; + string--; + } + + /* + * Scan the value from the temporary buffer. If we are + * returning a large unsigned value, we have to convert it back + * to a string since PHP only supports signed values. + */ + if (!(flags & SCAN_SUPPRESS)) { + *end = '\0'; + value = (long) (*fn)(buf, NULL, base); + if ((flags & SCAN_UNSIGNED) && (value < 0)) { + snprintf(buf, sizeof(buf), "%lu", value); /* INTL: ISO digit */ + if (numVars && objIndex >= argCount) { + break; + } else if (numVars) { + /* change passed value type to string */ + current = args[objIndex++]; + zval_dtor(*current); + ZVAL_STRING( *current, buf, 1 ); + } else { + add_index_string(*return_value, objIndex++, buf, 1); + } + } else { + if (numVars && objIndex >= argCount) { + break; + } else if (numVars) { + current = args[objIndex++]; + zval_dtor(*current); + ZVAL_LONG(*current, value); + } else { + add_index_long(*return_value, objIndex++, value); + } + } + } + break; + + case 'f': + /* + * Scan a floating point number + */ + buf[0] = '\0'; /* call me pedantic */ + if ((width == 0) || (width > sizeof(buf) - 1)) { + width = sizeof(buf) - 1; + } + flags |= SCAN_SIGNOK | SCAN_NODIGITS | SCAN_PTOK | SCAN_EXPOK; + for (end = buf; width > 0; width--) { + switch (*string) { + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + case '8': case '9': + flags &= ~(SCAN_SIGNOK | SCAN_NODIGITS); + goto addToFloat; + case '+': + case '-': + if (flags & SCAN_SIGNOK) { + flags &= ~SCAN_SIGNOK; + goto addToFloat; + } + break; + case '.': + if (flags & SCAN_PTOK) { + flags &= ~(SCAN_SIGNOK | SCAN_PTOK); + goto addToFloat; + } + break; + case 'e': + case 'E': + /* + * An exponent is not allowed until there has + * been at least one digit. + */ + if ((flags & (SCAN_NODIGITS | SCAN_EXPOK)) == SCAN_EXPOK) { + flags = (flags & ~(SCAN_EXPOK|SCAN_PTOK)) + | SCAN_SIGNOK | SCAN_NODIGITS; + goto addToFloat; + } + break; + } + + /* + * We got an illegal character so we are done accumulating. + */ + break; + +addToFloat: + /* + * Add the character to the temporary buffer. + */ + *end++ = *string++; + if (*string == '\0') { + break; + } + } + + /* + * Check to see if we need to back up because we saw a + * trailing 'e' or sign. + */ + if (flags & SCAN_NODIGITS) { + if (flags & SCAN_EXPOK) { + /* + * There were no digits at all so scanning has + * failed and we are done. + */ + if (*string == '\0') { + underflow = 1; + } + goto done; + } + + /* + * We got a bad exponent ('e' and maybe a sign). + */ + end--; + string--; + if (*end != 'e' && *end != 'E') { + end--; + string--; + } + } + + /* + * Scan the value from the temporary buffer. + */ + if (!(flags & SCAN_SUPPRESS)) { + double dvalue; + *end = '\0'; + dvalue = zend_strtod(buf, NULL); + if (numVars && objIndex >= argCount) { + break; + } else if (numVars) { + current = args[objIndex++]; + zval_dtor(*current); + ZVAL_DOUBLE(*current, dvalue); + } else { + add_index_double( *return_value, objIndex++, dvalue ); + } + } + break; + } /* switch (op) */ + nconversions++; + } /* while (*format != '\0') */ + +done: + result = SCAN_SUCCESS; + + if (underflow && (0==nconversions)) { + scan_set_error_return( numVars, return_value ); + result = SCAN_ERROR_EOF; + } else if (numVars) { + convert_to_long( *return_value ); + Z_LVAL_PP(return_value) = nconversions; + } else if (nconversions < totalVars) { + /* TODO: not all elements converted. we need to prune the list - cc */ + } + return result; +} +/* }}} */ + +/* the compiler choked when i tried to make this a macro */ +static inline void scan_set_error_return(int numVars, zval **return_value) /* {{{ */ +{ + if (numVars) { + Z_TYPE_PP(return_value) = IS_LONG; + Z_LVAL_PP(return_value) = SCAN_ERROR_EOF; /* EOF marker */ + } else { + /* convert_to_null calls destructor */ + convert_to_null( *return_value ); + } +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h new file mode 100644 index 0000000..dbffca9 --- /dev/null +++ b/ext/standard/scanf.h @@ -0,0 +1,49 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Clayton Collie | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef SCANF_H +#define SCANF_H + + +#define SCAN_MAX_ARGS 0xFF /* Maximum number of variable which can be */ + /* passed to (f|s)scanf. This is an artifical */ + /* upper limit to keep resources in check and */ + /* minimize the possibility of exploits */ + +#define SCAN_SUCCESS SUCCESS +#define SCAN_ERROR_EOF -1 /* indicates premature termination of scan */ + /* can be caused by bad parameters or format*/ + /* string. */ +#define SCAN_ERROR_INVALID_FORMAT (SCAN_ERROR_EOF - 1) +#define SCAN_ERROR_VAR_PASSED_BYVAL (SCAN_ERROR_INVALID_FORMAT - 1) +#define SCAN_ERROR_WRONG_PARAM_COUNT (SCAN_ERROR_VAR_PASSED_BYVAL - 1) +#define SCAN_ERROR_INTERNAL (SCAN_ERROR_WRONG_PARAM_COUNT - 1) + + +/* + * The following are here solely for the benefit of the scanf type functions + * e.g. fscanf + */ +PHPAPI int ValidateFormat(char *format, int numVars, int *totalVars); +PHPAPI int php_sscanf_internal(char *string,char *format,int argCount,zval ***args, + int varStart, zval **return_value TSRMLS_DC); + + +#endif /* SCANF_H */ diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c new file mode 100644 index 0000000..4326db9 --- /dev/null +++ b/ext/standard/sha1.c @@ -0,0 +1,412 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Stefan Esser | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" + +/* This code is heavily based on the PHP md5 implementation */ + +#include "sha1.h" +#include "md5.h" + +PHPAPI void make_sha1_digest(char *sha1str, unsigned char *digest) +{ + make_digest_ex(sha1str, digest, 20); +} + +/* {{{ proto string sha1(string str [, bool raw_output]) + Calculate the sha1 hash of a string */ +PHP_FUNCTION(sha1) +{ + char *arg; + int arg_len; + zend_bool raw_output = 0; + char sha1str[41]; + PHP_SHA1_CTX context; + unsigned char digest[20]; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) { + return; + } + + sha1str[0] = '\0'; + PHP_SHA1Init(&context); + PHP_SHA1Update(&context, arg, arg_len); + PHP_SHA1Final(digest, &context); + if (raw_output) { + RETURN_STRINGL(digest, 20, 1); + } else { + make_digest_ex(sha1str, digest, 20); + RETVAL_STRING(sha1str, 1); + } + +} + +/* }}} */ + + +/* {{{ proto string sha1_file(string filename [, bool raw_output]) + Calculate the sha1 hash of given filename */ +PHP_FUNCTION(sha1_file) +{ + char *arg; + int arg_len; + zend_bool raw_output = 0; + char sha1str[41]; + unsigned char buf[1024]; + unsigned char digest[20]; + PHP_SHA1_CTX context; + int n; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &arg, &arg_len, &raw_output) == FAILURE) { + return; + } + + stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS, NULL); + if (!stream) { + RETURN_FALSE; + } + + PHP_SHA1Init(&context); + + while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) { + PHP_SHA1Update(&context, buf, n); + } + + PHP_SHA1Final(digest, &context); + + php_stream_close(stream); + + if (n<0) { + RETURN_FALSE; + } + + if (raw_output) { + RETURN_STRINGL(digest, 20, 1); + } else { + make_digest_ex(sha1str, digest, 20); + RETVAL_STRING(sha1str, 1); + } +} +/* }}} */ + + +static void SHA1Transform(php_uint32[5], const unsigned char[64]); +static void SHA1Encode(unsigned char *, php_uint32 *, unsigned int); +static void SHA1Decode(php_uint32 *, const unsigned char *, unsigned int); + +static unsigned char PADDING[64] = +{ + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* F, G, H and I are basic SHA1 functions. + */ +#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define G(x, y, z) ((x) ^ (y) ^ (z)) +#define H(x, y, z) (((x) & (y)) | ((z) & ((x) | (y)))) +#define I(x, y, z) ((x) ^ (y) ^ (z)) + +/* ROTATE_LEFT rotates x left n bits. + */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* W[i] + */ +#define W(i) ( tmp=x[(i-3)&15]^x[(i-8)&15]^x[(i-14)&15]^x[i&15], \ + (x[i&15]=ROTATE_LEFT(tmp, 1)) ) + +/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. + */ +#define FF(a, b, c, d, e, w) { \ + (e) += F ((b), (c), (d)) + (w) + (php_uint32)(0x5A827999); \ + (e) += ROTATE_LEFT ((a), 5); \ + (b) = ROTATE_LEFT((b), 30); \ + } +#define GG(a, b, c, d, e, w) { \ + (e) += G ((b), (c), (d)) + (w) + (php_uint32)(0x6ED9EBA1); \ + (e) += ROTATE_LEFT ((a), 5); \ + (b) = ROTATE_LEFT((b), 30); \ + } +#define HH(a, b, c, d, e, w) { \ + (e) += H ((b), (c), (d)) + (w) + (php_uint32)(0x8F1BBCDC); \ + (e) += ROTATE_LEFT ((a), 5); \ + (b) = ROTATE_LEFT((b), 30); \ + } +#define II(a, b, c, d, e, w) { \ + (e) += I ((b), (c), (d)) + (w) + (php_uint32)(0xCA62C1D6); \ + (e) += ROTATE_LEFT ((a), 5); \ + (b) = ROTATE_LEFT((b), 30); \ + } + + +/* {{{ PHP_SHA1Init + * SHA1 initialization. Begins an SHA1 operation, writing a new context. + */ +PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX * context) +{ + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. + */ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; + context->state[4] = 0xc3d2e1f0; +} +/* }}} */ + +/* {{{ PHP_SHA1Update + SHA1 block update operation. Continues an SHA1 message-digest + operation, processing another message block, and updating the + context. + */ +PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX * context, const unsigned char *input, + unsigned int inputLen) +{ + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += ((php_uint32) inputLen << 3)) + < ((php_uint32) inputLen << 3)) + context->count[1]++; + context->count[1] += ((php_uint32) inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. + */ + if (inputLen >= partLen) { + memcpy + ((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen); + SHA1Transform(context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + SHA1Transform(context->state, &input[i]); + + index = 0; + } else + i = 0; + + /* Buffer remaining input */ + memcpy + ((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], + inputLen - i); +} +/* }}} */ + +/* {{{ PHP_SHA1Final + SHA1 finalization. Ends an SHA1 message-digest operation, writing the + the message digest and zeroizing the context. + */ +PHPAPI void PHP_SHA1Final(unsigned char digest[20], PHP_SHA1_CTX * context) +{ + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + bits[7] = context->count[0] & 0xFF; + bits[6] = (context->count[0] >> 8) & 0xFF; + bits[5] = (context->count[0] >> 16) & 0xFF; + bits[4] = (context->count[0] >> 24) & 0xFF; + bits[3] = context->count[1] & 0xFF; + bits[2] = (context->count[1] >> 8) & 0xFF; + bits[1] = (context->count[1] >> 16) & 0xFF; + bits[0] = (context->count[1] >> 24) & 0xFF; + + /* Pad out to 56 mod 64. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + PHP_SHA1Update(context, PADDING, padLen); + + /* Append length (before padding) */ + PHP_SHA1Update(context, bits, 8); + + /* Store state in digest */ + SHA1Encode(digest, context->state, 20); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} +/* }}} */ + +/* {{{ SHA1Transform + * SHA1 basic transformation. Transforms state based on block. + */ +static void SHA1Transform(state, block) +php_uint32 state[5]; +const unsigned char block[64]; +{ + php_uint32 a = state[0], b = state[1], c = state[2]; + php_uint32 d = state[3], e = state[4], x[16], tmp; + + SHA1Decode(x, block, 64); + + /* Round 1 */ + FF(a, b, c, d, e, x[0]); /* 1 */ + FF(e, a, b, c, d, x[1]); /* 2 */ + FF(d, e, a, b, c, x[2]); /* 3 */ + FF(c, d, e, a, b, x[3]); /* 4 */ + FF(b, c, d, e, a, x[4]); /* 5 */ + FF(a, b, c, d, e, x[5]); /* 6 */ + FF(e, a, b, c, d, x[6]); /* 7 */ + FF(d, e, a, b, c, x[7]); /* 8 */ + FF(c, d, e, a, b, x[8]); /* 9 */ + FF(b, c, d, e, a, x[9]); /* 10 */ + FF(a, b, c, d, e, x[10]); /* 11 */ + FF(e, a, b, c, d, x[11]); /* 12 */ + FF(d, e, a, b, c, x[12]); /* 13 */ + FF(c, d, e, a, b, x[13]); /* 14 */ + FF(b, c, d, e, a, x[14]); /* 15 */ + FF(a, b, c, d, e, x[15]); /* 16 */ + FF(e, a, b, c, d, W(16)); /* 17 */ + FF(d, e, a, b, c, W(17)); /* 18 */ + FF(c, d, e, a, b, W(18)); /* 19 */ + FF(b, c, d, e, a, W(19)); /* 20 */ + + /* Round 2 */ + GG(a, b, c, d, e, W(20)); /* 21 */ + GG(e, a, b, c, d, W(21)); /* 22 */ + GG(d, e, a, b, c, W(22)); /* 23 */ + GG(c, d, e, a, b, W(23)); /* 24 */ + GG(b, c, d, e, a, W(24)); /* 25 */ + GG(a, b, c, d, e, W(25)); /* 26 */ + GG(e, a, b, c, d, W(26)); /* 27 */ + GG(d, e, a, b, c, W(27)); /* 28 */ + GG(c, d, e, a, b, W(28)); /* 29 */ + GG(b, c, d, e, a, W(29)); /* 30 */ + GG(a, b, c, d, e, W(30)); /* 31 */ + GG(e, a, b, c, d, W(31)); /* 32 */ + GG(d, e, a, b, c, W(32)); /* 33 */ + GG(c, d, e, a, b, W(33)); /* 34 */ + GG(b, c, d, e, a, W(34)); /* 35 */ + GG(a, b, c, d, e, W(35)); /* 36 */ + GG(e, a, b, c, d, W(36)); /* 37 */ + GG(d, e, a, b, c, W(37)); /* 38 */ + GG(c, d, e, a, b, W(38)); /* 39 */ + GG(b, c, d, e, a, W(39)); /* 40 */ + + /* Round 3 */ + HH(a, b, c, d, e, W(40)); /* 41 */ + HH(e, a, b, c, d, W(41)); /* 42 */ + HH(d, e, a, b, c, W(42)); /* 43 */ + HH(c, d, e, a, b, W(43)); /* 44 */ + HH(b, c, d, e, a, W(44)); /* 45 */ + HH(a, b, c, d, e, W(45)); /* 46 */ + HH(e, a, b, c, d, W(46)); /* 47 */ + HH(d, e, a, b, c, W(47)); /* 48 */ + HH(c, d, e, a, b, W(48)); /* 49 */ + HH(b, c, d, e, a, W(49)); /* 50 */ + HH(a, b, c, d, e, W(50)); /* 51 */ + HH(e, a, b, c, d, W(51)); /* 52 */ + HH(d, e, a, b, c, W(52)); /* 53 */ + HH(c, d, e, a, b, W(53)); /* 54 */ + HH(b, c, d, e, a, W(54)); /* 55 */ + HH(a, b, c, d, e, W(55)); /* 56 */ + HH(e, a, b, c, d, W(56)); /* 57 */ + HH(d, e, a, b, c, W(57)); /* 58 */ + HH(c, d, e, a, b, W(58)); /* 59 */ + HH(b, c, d, e, a, W(59)); /* 60 */ + + /* Round 4 */ + II(a, b, c, d, e, W(60)); /* 61 */ + II(e, a, b, c, d, W(61)); /* 62 */ + II(d, e, a, b, c, W(62)); /* 63 */ + II(c, d, e, a, b, W(63)); /* 64 */ + II(b, c, d, e, a, W(64)); /* 65 */ + II(a, b, c, d, e, W(65)); /* 66 */ + II(e, a, b, c, d, W(66)); /* 67 */ + II(d, e, a, b, c, W(67)); /* 68 */ + II(c, d, e, a, b, W(68)); /* 69 */ + II(b, c, d, e, a, W(69)); /* 70 */ + II(a, b, c, d, e, W(70)); /* 71 */ + II(e, a, b, c, d, W(71)); /* 72 */ + II(d, e, a, b, c, W(72)); /* 73 */ + II(c, d, e, a, b, W(73)); /* 74 */ + II(b, c, d, e, a, W(74)); /* 75 */ + II(a, b, c, d, e, W(75)); /* 76 */ + II(e, a, b, c, d, W(76)); /* 77 */ + II(d, e, a, b, c, W(77)); /* 78 */ + II(c, d, e, a, b, W(78)); /* 79 */ + II(b, c, d, e, a, W(79)); /* 80 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + + /* Zeroize sensitive information. */ + memset((unsigned char*) x, 0, sizeof(x)); +} +/* }}} */ + +/* {{{ SHA1Encode + Encodes input (php_uint32) into output (unsigned char). Assumes len is + a multiple of 4. + */ +static void SHA1Encode(output, input, len) +unsigned char *output; +php_uint32 *input; +unsigned int len; +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char) ((input[i] >> 24) & 0xff); + output[j + 1] = (unsigned char) ((input[i] >> 16) & 0xff); + output[j + 2] = (unsigned char) ((input[i] >> 8) & 0xff); + output[j + 3] = (unsigned char) (input[i] & 0xff); + } +} +/* }}} */ + +/* {{{ SHA1Decode + Decodes input (unsigned char) into output (php_uint32). Assumes len is + a multiple of 4. + */ +static void SHA1Decode(output, input, len) +php_uint32 *output; +const unsigned char *input; +unsigned int len; +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((php_uint32) input[j + 3]) | (((php_uint32) input[j + 2]) << 8) | + (((php_uint32) input[j + 1]) << 16) | (((php_uint32) input[j]) << 24); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/sha1.h b/ext/standard/sha1.h new file mode 100644 index 0000000..450d457 --- /dev/null +++ b/ext/standard/sha1.h @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Stefan Esser | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef SHA1_H +#define SHA1_H + +#include "ext/standard/basic_functions.h" + +/* SHA1 context. */ +typedef struct { + php_uint32 state[5]; /* state (ABCD) */ + php_uint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} PHP_SHA1_CTX; + +PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX *); +PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, unsigned int); +PHPAPI void PHP_SHA1Final(unsigned char[20], PHP_SHA1_CTX *); +PHPAPI void make_sha1_digest(char *sha1str, unsigned char *digest); + +PHP_FUNCTION(sha1); +PHP_FUNCTION(sha1_file); + +#endif diff --git a/ext/standard/soundex.c b/ext/standard/soundex.c new file mode 100644 index 0000000..bb6818e --- /dev/null +++ b/ext/standard/soundex.c @@ -0,0 +1,115 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Bjørn Borud - Guardian Networks AS | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#include "php.h" +#include +#include +#include +#include "php_string.h" + +/* Simple soundex algorithm as described by Knuth in TAOCP, vol 3 */ +/* {{{ proto string soundex(string str) + Calculate the soundex key of a string */ +PHP_FUNCTION(soundex) +{ + char *str; + int i, _small, str_len, code, last; + char soundex[4 + 1]; + + static char soundex_table[26] = + {0, /* A */ + '1', /* B */ + '2', /* C */ + '3', /* D */ + 0, /* E */ + '1', /* F */ + '2', /* G */ + 0, /* H */ + 0, /* I */ + '2', /* J */ + '2', /* K */ + '4', /* L */ + '5', /* M */ + '5', /* N */ + 0, /* O */ + '1', /* P */ + '2', /* Q */ + '6', /* R */ + '2', /* S */ + '3', /* T */ + 0, /* U */ + '1', /* V */ + 0, /* W */ + '2', /* X */ + 0, /* Y */ + '2'}; /* Z */ + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + return; + } + if (str_len == 0) { + RETURN_FALSE; + } + + /* build soundex string */ + last = -1; + for (i = 0, _small = 0; i < str_len && _small < 4; i++) { + /* convert chars to upper case and strip non-letter chars */ + /* BUG: should also map here accented letters used in non */ + /* English words or names (also found in English text!): */ + /* esstsett, thorn, n-tilde, c-cedilla, s-caron, ... */ + code = toupper((int)(unsigned char)str[i]); + if (code >= 'A' && code <= 'Z') { + if (_small == 0) { + /* remember first valid char */ + soundex[_small++] = code; + last = soundex_table[code - 'A']; + } + else { + /* ignore sequences of consonants with same soundex */ + /* code in trail, and vowels unless they separate */ + /* consonant letters */ + code = soundex_table[code - 'A']; + if (code != last) { + if (code != 0) { + soundex[_small++] = code; + } + last = code; + } + } + } + } + /* pad with '0' and terminate with 0 ;-) */ + while (_small < 4) { + soundex[_small++] = '0'; + } + soundex[_small] = '\0'; + + RETURN_STRINGL(soundex, _small, 1); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c new file mode 100644 index 0000000..2231a30 --- /dev/null +++ b/ext/standard/streamsfuncs.c @@ -0,0 +1,1638 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Wez Furlong | + | Sara Golemon | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "php_globals.h" +#include "ext/standard/flock_compat.h" +#include "ext/standard/file.h" +#include "ext/standard/php_filestat.h" +#include "php_open_temporary_file.h" +#include "ext/standard/basic_functions.h" +#include "php_ini.h" +#include "streamsfuncs.h" +#include "php_network.h" +#include "php_string.h" + +#ifndef PHP_WIN32 +#define php_select(m, r, w, e, t) select(m, r, w, e, t) +typedef unsigned long long php_timeout_ull; +#else +#include "win32/select.h" +#include "win32/sockets.h" +typedef unsigned __int64 php_timeout_ull; +#endif + +static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC); + +/* Streams based network functions */ + +#if HAVE_SOCKETPAIR +/* {{{ proto array stream_socket_pair(int domain, int type, int protocol) + Creates a pair of connected, indistinguishable socket streams */ +PHP_FUNCTION(stream_socket_pair) +{ + long domain, type, protocol; + php_stream *s1, *s2; + int pair[2]; + + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", + &domain, &type, &protocol)) { + RETURN_FALSE; + } + + if (0 != socketpair(domain, type, protocol, pair)) { + char errbuf[256]; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to create sockets: [%d]: %s", + php_socket_errno(), php_socket_strerror(php_socket_errno(), errbuf, sizeof(errbuf))); + RETURN_FALSE; + } + + array_init(return_value); + + s1 = php_stream_sock_open_from_socket(pair[0], 0); + s2 = php_stream_sock_open_from_socket(pair[1], 0); + + /* set the __exposed flag. + * php_stream_to_zval() does, add_next_index_resource() does not */ + php_stream_auto_cleanup(s1); + php_stream_auto_cleanup(s2); + + add_next_index_resource(return_value, php_stream_get_resource_id(s1)); + add_next_index_resource(return_value, php_stream_get_resource_id(s2)); +} +/* }}} */ +#endif + +/* {{{ proto resource stream_socket_client(string remoteaddress [, long &errcode [, string &errstring [, double timeout [, long flags [, resource context]]]]]) + Open a client connection to a remote address */ +PHP_FUNCTION(stream_socket_client) +{ + char *host; + int host_len; + zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL; + double timeout = FG(default_socket_timeout); + php_timeout_ull conv; + struct timeval tv; + char *hashkey = NULL; + php_stream *stream = NULL; + int err; + long flags = PHP_STREAM_CLIENT_CONNECT; + char *errstr = NULL; + php_stream_context *context = NULL; + + RETVAL_FALSE; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zzdlr", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) { + RETURN_FALSE; + } + + context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); + + if (flags & PHP_STREAM_CLIENT_PERSISTENT) { + spprintf(&hashkey, 0, "stream_socket_client__%s", host); + } + + /* prepare the timeout value for use */ + conv = (php_timeout_ull) (timeout * 1000000.0); +#ifdef PHP_WIN32 + tv.tv_sec = (long)(conv / 1000000); + tv.tv_usec =(long)(conv % 1000000); +#else + tv.tv_sec = conv / 1000000; + tv.tv_usec = conv % 1000000; +#endif + if (zerrno) { + zval_dtor(zerrno); + ZVAL_LONG(zerrno, 0); + } + if (zerrstr) { + zval_dtor(zerrstr); + ZVAL_STRING(zerrstr, "", 1); + } + + stream = php_stream_xport_create(host, host_len, REPORT_ERRORS, + STREAM_XPORT_CLIENT | (flags & PHP_STREAM_CLIENT_CONNECT ? STREAM_XPORT_CONNECT : 0) | + (flags & PHP_STREAM_CLIENT_ASYNC_CONNECT ? STREAM_XPORT_CONNECT_ASYNC : 0), + hashkey, &tv, context, &errstr, &err); + + + if (stream == NULL) { + /* host might contain binary characters */ + char *quoted_host = php_addslashes(host, host_len, NULL, 0 TSRMLS_CC); + + php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s (%s)", quoted_host, errstr == NULL ? "Unknown error" : errstr); + efree(quoted_host); + } + + if (hashkey) { + efree(hashkey); + } + + if (stream == NULL) { + if (zerrno) { + zval_dtor(zerrno); + ZVAL_LONG(zerrno, err); + } + if (zerrstr && errstr) { + /* no need to dup; we need to efree buf anyway */ + zval_dtor(zerrstr); + ZVAL_STRING(zerrstr, errstr, 0); + } else if (errstr) { + efree(errstr); + } + RETURN_FALSE; + } + + if (errstr) { + efree(errstr); + } + + php_stream_to_zval(stream, return_value); + +} +/* }}} */ + +/* {{{ proto resource stream_socket_server(string localaddress [, long &errcode [, string &errstring [, long flags [, resource context]]]]) + Create a server socket bound to localaddress */ +PHP_FUNCTION(stream_socket_server) +{ + char *host; + int host_len; + zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL; + php_stream *stream = NULL; + int err = 0; + long flags = STREAM_XPORT_BIND | STREAM_XPORT_LISTEN; + char *errstr = NULL; + php_stream_context *context = NULL; + + RETVAL_FALSE; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zzlr", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) { + RETURN_FALSE; + } + + context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); + + if (context) { + zend_list_addref(context->rsrc_id); + } + + if (zerrno) { + zval_dtor(zerrno); + ZVAL_LONG(zerrno, 0); + } + if (zerrstr) { + zval_dtor(zerrstr); + ZVAL_STRING(zerrstr, "", 1); + } + + stream = php_stream_xport_create(host, host_len, REPORT_ERRORS, + STREAM_XPORT_SERVER | flags, + NULL, NULL, context, &errstr, &err); + + if (stream == NULL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s (%s)", host, errstr == NULL ? "Unknown error" : errstr); + } + + if (stream == NULL) { + if (zerrno) { + zval_dtor(zerrno); + ZVAL_LONG(zerrno, err); + } + if (zerrstr && errstr) { + /* no need to dup; we need to efree buf anyway */ + zval_dtor(zerrstr); + ZVAL_STRING(zerrstr, errstr, 0); + } else if (errstr) { + efree(errstr); + } + RETURN_FALSE; + } + + if (errstr) { + efree(errstr); + } + + php_stream_to_zval(stream, return_value); +} +/* }}} */ + +/* {{{ proto resource stream_socket_accept(resource serverstream, [ double timeout [, string &peername ]]) + Accept a client connection from a server socket */ +PHP_FUNCTION(stream_socket_accept) +{ + double timeout = FG(default_socket_timeout); + zval *zpeername = NULL; + char *peername = NULL; + int peername_len; + php_timeout_ull conv; + struct timeval tv; + php_stream *stream = NULL, *clistream = NULL; + zval *zstream; + + char *errstr = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|dz", &zstream, &timeout, &zpeername) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, &zstream); + + /* prepare the timeout value for use */ + conv = (php_timeout_ull) (timeout * 1000000.0); +#ifdef PHP_WIN32 + tv.tv_sec = (long)(conv / 1000000); + tv.tv_usec = (long)(conv % 1000000); +#else + tv.tv_sec = conv / 1000000; + tv.tv_usec = conv % 1000000; +#endif + if (zpeername) { + zval_dtor(zpeername); + ZVAL_NULL(zpeername); + } + + if (0 == php_stream_xport_accept(stream, &clistream, + zpeername ? &peername : NULL, + zpeername ? &peername_len : NULL, + NULL, NULL, + &tv, &errstr + TSRMLS_CC) && clistream) { + + if (peername) { + ZVAL_STRINGL(zpeername, peername, peername_len, 0); + } + php_stream_to_zval(clistream, return_value); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "accept failed: %s", errstr ? errstr : "Unknown error"); + RETVAL_FALSE; + } + + if (errstr) { + efree(errstr); + } +} +/* }}} */ + +/* {{{ proto string stream_socket_get_name(resource stream, bool want_peer) + Returns either the locally bound or remote name for a socket stream */ +PHP_FUNCTION(stream_socket_get_name) +{ + php_stream *stream; + zval *zstream; + zend_bool want_peer; + char *name = NULL; + int name_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &zstream, &want_peer) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, &zstream); + + if (0 != php_stream_xport_get_name(stream, want_peer, + &name, + &name_len, + NULL, NULL + TSRMLS_CC)) { + RETURN_FALSE; + } + + RETURN_STRINGL(name, name_len, 0); +} +/* }}} */ + +/* {{{ proto long stream_socket_sendto(resouce stream, string data [, long flags [, string target_addr]]) + Send data to a socket stream. If target_addr is specified it must be in dotted quad (or [ipv6]) format */ +PHP_FUNCTION(stream_socket_sendto) +{ + php_stream *stream; + zval *zstream; + long flags = 0; + char *data, *target_addr = NULL; + int datalen, target_addr_len = 0; + php_sockaddr_storage sa; + socklen_t sl = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ls", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) { + RETURN_FALSE; + } + php_stream_from_zval(stream, &zstream); + + if (target_addr_len) { + /* parse the address */ + if (FAILURE == php_network_parse_network_address_with_port(target_addr, target_addr_len, (struct sockaddr*)&sa, &sl TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse `%s' into a valid network address", target_addr); + RETURN_FALSE; + } + } + + RETURN_LONG(php_stream_xport_sendto(stream, data, datalen, flags, target_addr ? &sa : NULL, sl TSRMLS_CC)); +} +/* }}} */ + +/* {{{ proto string stream_socket_recvfrom(resource stream, long amount [, long flags [, string &remote_addr]]) + Receives data from a socket stream */ +PHP_FUNCTION(stream_socket_recvfrom) +{ + php_stream *stream; + zval *zstream, *zremote = NULL; + char *remote_addr = NULL; + int remote_addr_len; + long to_read = 0; + char *read_buf; + long flags = 0; + int recvd; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|lz", &zstream, &to_read, &flags, &zremote) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, &zstream); + + if (zremote) { + zval_dtor(zremote); + ZVAL_NULL(zremote); + } + + if (to_read <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0"); + RETURN_FALSE; + } + + read_buf = safe_emalloc(1, to_read, 1); + + recvd = php_stream_xport_recvfrom(stream, read_buf, to_read, flags, NULL, NULL, + zremote ? &remote_addr : NULL, + zremote ? &remote_addr_len : NULL + TSRMLS_CC); + + if (recvd >= 0) { + if (zremote) { + ZVAL_STRINGL(zremote, remote_addr, remote_addr_len, 0); + } + read_buf[recvd] = '\0'; + + RETURN_STRINGL(read_buf, recvd, 0); + } + + efree(read_buf); + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto string stream_get_contents(resource source [, long maxlen [, long offset]]) + Reads all remaining bytes (or up to maxlen bytes) from a stream and returns them as a string. */ +PHP_FUNCTION(stream_get_contents) +{ + php_stream *stream; + zval *zsrc; + long maxlen = PHP_STREAM_COPY_ALL, + desiredpos = -1L; + int len; + char *contents = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, &zsrc); + + if (desiredpos >= 0) { + int seek_res = 0; + off_t position; + + position = php_stream_tell(stream); + if (position >= 0 && desiredpos > position) { + /* use SEEK_CUR to allow emulation in streams that don't support seeking */ + seek_res = php_stream_seek(stream, desiredpos - position, SEEK_CUR); + } else if (desiredpos < position) { + /* desired position before position or error on tell */ + seek_res = php_stream_seek(stream, desiredpos, SEEK_SET); + } + + if (seek_res != 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "Failed to seek to position %ld in the stream", desiredpos); + RETURN_FALSE; + } + } + + len = php_stream_copy_to_mem(stream, &contents, maxlen, 0); + + if (contents) { + RETVAL_STRINGL(contents, len, 0); + } else { + RETVAL_EMPTY_STRING(); + } +} +/* }}} */ + +/* {{{ proto long stream_copy_to_stream(resource source, resource dest [, long maxlen [, long pos]]) + Reads up to maxlen bytes from source stream and writes them to dest stream. */ +PHP_FUNCTION(stream_copy_to_stream) +{ + php_stream *src, *dest; + zval *zsrc, *zdest; + long maxlen = PHP_STREAM_COPY_ALL, pos = 0; + size_t len; + int ret; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ll", &zsrc, &zdest, &maxlen, &pos) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(src, &zsrc); + php_stream_from_zval(dest, &zdest); + + if (pos > 0 && php_stream_seek(src, pos, SEEK_SET) < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the stream", pos); + RETURN_FALSE; + } + + ret = php_stream_copy_to_stream_ex(src, dest, maxlen, &len); + + if (ret != SUCCESS) { + RETURN_FALSE; + } + RETURN_LONG(len); +} +/* }}} */ + +/* {{{ proto array stream_get_meta_data(resource fp) + Retrieves header/meta data from streams/file pointers */ +PHP_FUNCTION(stream_get_meta_data) +{ + zval *arg1; + php_stream *stream; + zval *newval; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) { + return; + } + php_stream_from_zval(stream, &arg1); + + array_init(return_value); + + if (stream->wrapperdata) { + MAKE_STD_ZVAL(newval); + MAKE_COPY_ZVAL(&stream->wrapperdata, newval); + + add_assoc_zval(return_value, "wrapper_data", newval); + } + if (stream->wrapper) { + add_assoc_string(return_value, "wrapper_type", (char *)stream->wrapper->wops->label, 1); + } + add_assoc_string(return_value, "stream_type", (char *)stream->ops->label, 1); + + add_assoc_string(return_value, "mode", stream->mode, 1); + +#if 0 /* TODO: needs updating for new filter API */ + if (stream->filterhead) { + php_stream_filter *filter; + + MAKE_STD_ZVAL(newval); + array_init(newval); + + for (filter = stream->filterhead; filter != NULL; filter = filter->next) { + add_next_index_string(newval, (char *)filter->fops->label, 1); + } + + add_assoc_zval(return_value, "filters", newval); + } +#endif + + add_assoc_long(return_value, "unread_bytes", stream->writepos - stream->readpos); + + add_assoc_bool(return_value, "seekable", (stream->ops->seek) && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0); + if (stream->orig_path) { + add_assoc_string(return_value, "uri", stream->orig_path, 1); + } + + if (!php_stream_populate_meta_data(stream, return_value)) { + add_assoc_bool(return_value, "timed_out", 0); + add_assoc_bool(return_value, "blocked", 1); + add_assoc_bool(return_value, "eof", php_stream_eof(stream)); + } + +} +/* }}} */ + +/* {{{ proto array stream_get_transports() + Retrieves list of registered socket transports */ +PHP_FUNCTION(stream_get_transports) +{ + HashTable *stream_xport_hash; + char *stream_xport; + uint stream_xport_len; + ulong num_key; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + if ((stream_xport_hash = php_stream_xport_get_hash())) { + HashPosition pos; + array_init(return_value); + zend_hash_internal_pointer_reset_ex(stream_xport_hash, &pos); + while (zend_hash_get_current_key_ex(stream_xport_hash, + &stream_xport, &stream_xport_len, + &num_key, 0, &pos) == HASH_KEY_IS_STRING) { + add_next_index_stringl(return_value, stream_xport, stream_xport_len - 1, 1); + zend_hash_move_forward_ex(stream_xport_hash, &pos); + } + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto array stream_get_wrappers() + Retrieves list of registered stream wrappers */ +PHP_FUNCTION(stream_get_wrappers) +{ + HashTable *url_stream_wrappers_hash; + char *stream_protocol; + int key_flags; + uint stream_protocol_len = 0; + ulong num_key; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) { + HashPosition pos; + array_init(return_value); + for (zend_hash_internal_pointer_reset_ex(url_stream_wrappers_hash, &pos); + (key_flags = zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &stream_protocol_len, &num_key, 0, &pos)) != HASH_KEY_NON_EXISTANT; + zend_hash_move_forward_ex(url_stream_wrappers_hash, &pos)) { + if (key_flags == HASH_KEY_IS_STRING) { + add_next_index_stringl(return_value, stream_protocol, stream_protocol_len - 1, 1); + } + } + } else { + RETURN_FALSE; + } + +} +/* }}} */ + +/* {{{ stream_select related functions */ +static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t *max_fd TSRMLS_DC) +{ + zval **elem; + php_stream *stream; + php_socket_t this_fd; + int cnt = 0; + + if (Z_TYPE_P(stream_array) != IS_ARRAY) { + return 0; + } + for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array)); + zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) &elem) == SUCCESS; + zend_hash_move_forward(Z_ARRVAL_P(stream_array))) { + + php_stream_from_zval_no_verify(stream, elem); + if (stream == NULL) { + continue; + } + /* get the fd. + * NB: Most other code will NOT use the PHP_STREAM_CAST_INTERNAL flag + * when casting. It is only used here so that the buffered data warning + * is not displayed. + * */ + if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd != -1) { + + PHP_SAFE_FD_SET(this_fd, fds); + + if (this_fd > *max_fd) { + *max_fd = this_fd; + } + cnt++; + } + } + return cnt ? 1 : 0; +} + +static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) +{ + zval **elem, **dest_elem; + php_stream *stream; + HashTable *new_hash; + php_socket_t this_fd; + int ret = 0; + + if (Z_TYPE_P(stream_array) != IS_ARRAY) { + return 0; + } + ALLOC_HASHTABLE(new_hash); + zend_hash_init(new_hash, zend_hash_num_elements(Z_ARRVAL_P(stream_array)), NULL, ZVAL_PTR_DTOR, 0); + + for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array)); + zend_hash_has_more_elements(Z_ARRVAL_P(stream_array)) == SUCCESS; + zend_hash_move_forward(Z_ARRVAL_P(stream_array))) { + + int type; + char *key; + uint key_len; + ulong num_ind; + + type = zend_hash_get_current_key_ex(Z_ARRVAL_P(stream_array), + &key, &key_len, &num_ind, 0, NULL); + if (type == HASH_KEY_NON_EXISTANT || + zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) &elem) == FAILURE) { + continue; /* should not happen */ + } + + php_stream_from_zval_no_verify(stream, elem); + if (stream == NULL) { + continue; + } + /* get the fd + * NB: Most other code will NOT use the PHP_STREAM_CAST_INTERNAL flag + * when casting. It is only used here so that the buffered data warning + * is not displayed. + */ + if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd != -1) { + if (PHP_SAFE_FD_ISSET(this_fd, fds)) { + if (type == HASH_KEY_IS_LONG) { + zend_hash_index_update(new_hash, num_ind, (void *)elem, sizeof(zval *), (void **)&dest_elem); + } else { /* HASH_KEY_IS_STRING */ + zend_hash_update(new_hash, key, key_len, (void *)elem, sizeof(zval *), (void **)&dest_elem); + } + + if (dest_elem) { + zval_add_ref(dest_elem); + } + ret++; + continue; + } + } + } + + /* destroy old array and add new one */ + zend_hash_destroy(Z_ARRVAL_P(stream_array)); + efree(Z_ARRVAL_P(stream_array)); + + zend_hash_internal_pointer_reset(new_hash); + Z_ARRVAL_P(stream_array) = new_hash; + + return ret; +} + +static int stream_array_emulate_read_fd_set(zval *stream_array TSRMLS_DC) +{ + zval **elem, **dest_elem; + php_stream *stream; + HashTable *new_hash; + int ret = 0; + + if (Z_TYPE_P(stream_array) != IS_ARRAY) { + return 0; + } + ALLOC_HASHTABLE(new_hash); + zend_hash_init(new_hash, zend_hash_num_elements(Z_ARRVAL_P(stream_array)), NULL, ZVAL_PTR_DTOR, 0); + + for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array)); + zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) &elem) == SUCCESS; + zend_hash_move_forward(Z_ARRVAL_P(stream_array))) { + + php_stream_from_zval_no_verify(stream, elem); + if (stream == NULL) { + continue; + } + if ((stream->writepos - stream->readpos) > 0) { + /* allow readable non-descriptor based streams to participate in stream_select. + * Non-descriptor streams will only "work" if they have previously buffered the + * data. Not ideal, but better than nothing. + * This branch of code also allows blocking streams with buffered data to + * operate correctly in stream_select. + * */ + zend_hash_next_index_insert(new_hash, (void *)elem, sizeof(zval *), (void **)&dest_elem); + if (dest_elem) { + zval_add_ref(dest_elem); + } + ret++; + continue; + } + } + + if (ret > 0) { + /* destroy old array and add new one */ + zend_hash_destroy(Z_ARRVAL_P(stream_array)); + efree(Z_ARRVAL_P(stream_array)); + + zend_hash_internal_pointer_reset(new_hash); + Z_ARRVAL_P(stream_array) = new_hash; + } else { + zend_hash_destroy(new_hash); + FREE_HASHTABLE(new_hash); + } + + return ret; +} +/* }}} */ + +/* {{{ proto int stream_select(array &read_streams, array &write_streams, array &except_streams, int tv_sec[, int tv_usec]) + Runs the select() system call on the sets of streams with a timeout specified by tv_sec and tv_usec */ +PHP_FUNCTION(stream_select) +{ + zval *r_array, *w_array, *e_array, **sec = NULL; + struct timeval tv; + struct timeval *tv_p = NULL; + fd_set rfds, wfds, efds; + php_socket_t max_fd = 0; + int retval, sets = 0; + long usec = 0; + int set_count, max_set_count = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!a!Z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) + return; + + FD_ZERO(&rfds); + FD_ZERO(&wfds); + FD_ZERO(&efds); + + if (r_array != NULL) { + set_count = stream_array_to_fd_set(r_array, &rfds, &max_fd TSRMLS_CC); + if (set_count > max_set_count) + max_set_count = set_count; + sets += set_count; + } + + if (w_array != NULL) { + set_count = stream_array_to_fd_set(w_array, &wfds, &max_fd TSRMLS_CC); + if (set_count > max_set_count) + max_set_count = set_count; + sets += set_count; + } + + if (e_array != NULL) { + set_count = stream_array_to_fd_set(e_array, &efds, &max_fd TSRMLS_CC); + if (set_count > max_set_count) + max_set_count = set_count; + sets += set_count; + } + + if (!sets) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No stream arrays were passed"); + RETURN_FALSE; + } + + PHP_SAFE_MAX_FD(max_fd, max_set_count); + + /* If seconds is not set to null, build the timeval, else we wait indefinitely */ + if (sec != NULL) { + convert_to_long_ex(sec); + + if (Z_LVAL_PP(sec) < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The seconds parameter must be greater than 0"); + RETURN_FALSE; + } else if (usec < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The microseconds parameter must be greater than 0"); + RETURN_FALSE; + } + + /* Solaris + BSD do not like microsecond values which are >= 1 sec */ + if (usec > 999999) { + tv.tv_sec = Z_LVAL_PP(sec) + (usec / 1000000); + tv.tv_usec = usec % 1000000; + } else { + tv.tv_sec = Z_LVAL_PP(sec); + tv.tv_usec = usec; + } + + tv_p = &tv; + } + + /* slight hack to support buffered data; if there is data sitting in the + * read buffer of any of the streams in the read array, let's pretend + * that we selected, but return only the readable sockets */ + if (r_array != NULL) { + + retval = stream_array_emulate_read_fd_set(r_array TSRMLS_CC); + if (retval > 0) { + if (w_array != NULL) { + zend_hash_clean(Z_ARRVAL_P(w_array)); + } + if (e_array != NULL) { + zend_hash_clean(Z_ARRVAL_P(e_array)); + } + RETURN_LONG(retval); + } + } + + retval = php_select(max_fd+1, &rfds, &wfds, &efds, tv_p); + + if (retval == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to select [%d]: %s (max_fd=%d)", + errno, strerror(errno), max_fd); + RETURN_FALSE; + } + + if (r_array != NULL) stream_array_from_fd_set(r_array, &rfds TSRMLS_CC); + if (w_array != NULL) stream_array_from_fd_set(w_array, &wfds TSRMLS_CC); + if (e_array != NULL) stream_array_from_fd_set(e_array, &efds TSRMLS_CC); + + RETURN_LONG(retval); +} +/* }}} */ + +/* {{{ stream_context related functions */ +static void user_space_stream_notifier(php_stream_context *context, int notifycode, int severity, + char *xmsg, int xcode, size_t bytes_sofar, size_t bytes_max, void * ptr TSRMLS_DC) +{ + zval *callback = (zval*)context->notifier->ptr; + zval *retval = NULL; + zval zvs[6]; + zval *ps[6]; + zval **ptps[6]; + int i; + + for (i = 0; i < 6; i++) { + INIT_ZVAL(zvs[i]); + ps[i] = &zvs[i]; + ptps[i] = &ps[i]; + MAKE_STD_ZVAL(ps[i]); + } + + ZVAL_LONG(ps[0], notifycode); + ZVAL_LONG(ps[1], severity); + if (xmsg) { + ZVAL_STRING(ps[2], xmsg, 1); + } else { + ZVAL_NULL(ps[2]); + } + ZVAL_LONG(ps[3], xcode); + ZVAL_LONG(ps[4], bytes_sofar); + ZVAL_LONG(ps[5], bytes_max); + + if (FAILURE == call_user_function_ex(EG(function_table), NULL, callback, &retval, 6, ptps, 0, NULL TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to call user notifier"); + } + for (i = 0; i < 6; i++) { + zval_ptr_dtor(&ps[i]); + } + if (retval) { + zval_ptr_dtor(&retval); + } +} + +static void user_space_stream_notifier_dtor(php_stream_notifier *notifier) +{ + if (notifier && notifier->ptr) { + zval_ptr_dtor((zval **)&(notifier->ptr)); + notifier->ptr = NULL; + } +} + +static int parse_context_options(php_stream_context *context, zval *options TSRMLS_DC) +{ + HashPosition pos, opos; + zval **wval, **oval; + char *wkey, *okey; + uint wkey_len, okey_len; + int ret = SUCCESS; + ulong num_key; + + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(options), &pos); + while (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_P(options), (void**)&wval, &pos)) { + if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(options), &wkey, &wkey_len, &num_key, 0, &pos) + && Z_TYPE_PP(wval) == IS_ARRAY) { + + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(wval), &opos); + while (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(wval), (void**)&oval, &opos)) { + + if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_PP(wval), &okey, &okey_len, &num_key, 0, &opos)) { + php_stream_context_set_option(context, wkey, okey, *oval); + } + zend_hash_move_forward_ex(Z_ARRVAL_PP(wval), &opos); + } + + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "options should have the form [\"wrappername\"][\"optionname\"] = $value"); + } + zend_hash_move_forward_ex(Z_ARRVAL_P(options), &pos); + } + + return ret; +} + +static int parse_context_params(php_stream_context *context, zval *params TSRMLS_DC) +{ + int ret = SUCCESS; + zval **tmp; + + if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "notification", sizeof("notification"), (void**)&tmp)) { + + if (context->notifier) { + php_stream_notification_free(context->notifier); + context->notifier = NULL; + } + + context->notifier = php_stream_notification_alloc(); + context->notifier->func = user_space_stream_notifier; + context->notifier->ptr = *tmp; + Z_ADDREF_P(*tmp); + context->notifier->dtor = user_space_stream_notifier_dtor; + } + if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "options", sizeof("options"), (void**)&tmp)) { + if (Z_TYPE_PP(tmp) == IS_ARRAY) { + parse_context_options(context, *tmp TSRMLS_CC); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter"); + } + } + + return ret; +} + +/* given a zval which is either a stream or a context, return the underlying + * stream_context. If it is a stream that does not have a context assigned, it + * will create and assign a context and return that. */ +static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC) +{ + php_stream_context *context = NULL; + + context = zend_fetch_resource(&contextresource TSRMLS_CC, -1, NULL, NULL, 1, php_le_stream_context(TSRMLS_C)); + if (context == NULL) { + php_stream *stream; + + stream = zend_fetch_resource(&contextresource TSRMLS_CC, -1, NULL, NULL, 2, php_file_le_stream(), php_file_le_pstream); + + if (stream) { + context = stream->context; + if (context == NULL) { + /* Only way this happens is if file is opened with NO_DEFAULT_CONTEXT + param, but then something is called which requires a context. + Don't give them the default one though since they already said they + didn't want it. */ + context = stream->context = php_stream_context_alloc(TSRMLS_C); + } + } + } + + return context; +} +/* }}} */ + +/* {{{ proto array stream_context_get_options(resource context|resource stream) + Retrieve options for a stream/wrapper/context */ +PHP_FUNCTION(stream_context_get_options) +{ + zval *zcontext; + php_stream_context *context; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zcontext) == FAILURE) { + RETURN_FALSE; + } + context = decode_context_param(zcontext TSRMLS_CC); + if (!context) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter"); + RETURN_FALSE; + } + + RETURN_ZVAL(context->options, 1, 0); +} +/* }}} */ + +/* {{{ proto bool stream_context_set_option(resource context|resource stream, string wrappername, string optionname, mixed value) + Set an option for a wrapper */ +PHP_FUNCTION(stream_context_set_option) +{ + zval *options = NULL, *zcontext = NULL, *zvalue = NULL; + php_stream_context *context; + char *wrappername, *optionname; + int wrapperlen, optionlen; + + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, + "rssz", &zcontext, &wrappername, &wrapperlen, + &optionname, &optionlen, &zvalue) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, + "ra", &zcontext, &options) == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "called with wrong number or type of parameters; please RTM"); + RETURN_FALSE; + } + } + + /* figure out where the context is coming from exactly */ + context = decode_context_param(zcontext TSRMLS_CC); + if (!context) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter"); + RETURN_FALSE; + } + + if (options) { + /* handle the array syntax */ + RETVAL_BOOL(parse_context_options(context, options TSRMLS_CC) == SUCCESS); + } else { + php_stream_context_set_option(context, wrappername, optionname, zvalue); + RETVAL_TRUE; + } +} +/* }}} */ + +/* {{{ proto bool stream_context_set_params(resource context|resource stream, array options) + Set parameters for a file context */ +PHP_FUNCTION(stream_context_set_params) +{ + zval *params, *zcontext; + php_stream_context *context; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra", &zcontext, ¶ms) == FAILURE) { + RETURN_FALSE; + } + + context = decode_context_param(zcontext TSRMLS_CC); + if (!context) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter"); + RETURN_FALSE; + } + + RETVAL_BOOL(parse_context_params(context, params TSRMLS_CC) == SUCCESS); +} +/* }}} */ + +/* {{{ proto array stream_context_get_params(resource context|resource stream) + Get parameters of a file context */ +PHP_FUNCTION(stream_context_get_params) +{ + zval *zcontext, *options; + php_stream_context *context; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zcontext) == FAILURE) { + RETURN_FALSE; + } + + context = decode_context_param(zcontext TSRMLS_CC); + if (!context) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter"); + RETURN_FALSE; + } + + array_init(return_value); + if (context->notifier && context->notifier->ptr && context->notifier->func == user_space_stream_notifier) { + add_assoc_zval_ex(return_value, ZEND_STRS("notification"), context->notifier->ptr); + Z_ADDREF_P(context->notifier->ptr); + } + ALLOC_INIT_ZVAL(options); + ZVAL_ZVAL(options, context->options, 1, 0); + add_assoc_zval_ex(return_value, ZEND_STRS("options"), options); +} +/* }}} */ + +/* {{{ proto resource stream_context_get_default([array options]) + Get a handle on the default file/stream context and optionally set parameters */ +PHP_FUNCTION(stream_context_get_default) +{ + zval *params = NULL; + php_stream_context *context; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a", ¶ms) == FAILURE) { + RETURN_FALSE; + } + + if (FG(default_context) == NULL) { + FG(default_context) = php_stream_context_alloc(TSRMLS_C); + } + context = FG(default_context); + + if (params) { + parse_context_options(context, params TSRMLS_CC); + } + + php_stream_context_to_zval(context, return_value); +} +/* }}} */ + +/* {{{ proto resource stream_context_set_default(array options) + Set default file/stream context, returns the context as a resource */ +PHP_FUNCTION(stream_context_set_default) +{ + zval *options = NULL; + php_stream_context *context; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &options) == FAILURE) { + return; + } + + if (FG(default_context) == NULL) { + FG(default_context) = php_stream_context_alloc(TSRMLS_C); + } + context = FG(default_context); + + parse_context_options(context, options TSRMLS_CC); + + php_stream_context_to_zval(context, return_value); +} +/* }}} */ + +/* {{{ proto resource stream_context_create([array options[, array params]]) + Create a file context and optionally set parameters */ +PHP_FUNCTION(stream_context_create) +{ + zval *options = NULL, *params = NULL; + php_stream_context *context; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!a!", &options, ¶ms) == FAILURE) { + RETURN_FALSE; + } + + context = php_stream_context_alloc(TSRMLS_C); + + if (options) { + parse_context_options(context, options TSRMLS_CC); + } + + if (params) { + parse_context_params(context, params TSRMLS_CC); + } + + RETURN_RESOURCE(context->rsrc_id); +} +/* }}} */ + +/* {{{ streams filter functions */ +static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS) +{ + zval *zstream; + php_stream *stream; + char *filtername; + int filternamelen; + long read_write = 0; + zval *filterparams = NULL; + php_stream_filter *filter = NULL; + int ret; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lz", &zstream, + &filtername, &filternamelen, &read_write, &filterparams) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, &zstream); + + if ((read_write & PHP_STREAM_FILTER_ALL) == 0) { + /* Chain not specified. + * Examine stream->mode to determine which filters are needed + * There's no harm in attaching a filter to an unused chain, + * but why waste the memory and clock cycles? + */ + if (strchr(stream->mode, 'r') || strchr(stream->mode, '+')) { + read_write |= PHP_STREAM_FILTER_READ; + } + if (strchr(stream->mode, 'w') || strchr(stream->mode, '+') || strchr(stream->mode, 'a')) { + read_write |= PHP_STREAM_FILTER_WRITE; + } + } + + if (read_write & PHP_STREAM_FILTER_READ) { + filter = php_stream_filter_create(filtername, filterparams, php_stream_is_persistent(stream) TSRMLS_CC); + if (filter == NULL) { + RETURN_FALSE; + } + + if (append) { + ret = php_stream_filter_append_ex(&stream->readfilters, filter TSRMLS_CC); + } else { + ret = php_stream_filter_prepend_ex(&stream->readfilters, filter TSRMLS_CC); + } + if (ret != SUCCESS) { + php_stream_filter_remove(filter, 1 TSRMLS_CC); + RETURN_FALSE; + } + } + + if (read_write & PHP_STREAM_FILTER_WRITE) { + filter = php_stream_filter_create(filtername, filterparams, php_stream_is_persistent(stream) TSRMLS_CC); + if (filter == NULL) { + RETURN_FALSE; + } + + if (append) { + ret = php_stream_filter_append_ex(&stream->writefilters, filter TSRMLS_CC); + } else { + ret = php_stream_filter_prepend_ex(&stream->writefilters, filter TSRMLS_CC); + } + if (ret != SUCCESS) { + php_stream_filter_remove(filter, 1 TSRMLS_CC); + RETURN_FALSE; + } + } + + if (filter) { + RETURN_RESOURCE(filter->rsrc_id = ZEND_REGISTER_RESOURCE(NULL, filter, php_file_le_stream_filter())); + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto resource stream_filter_prepend(resource stream, string filtername[, int read_write[, string filterparams]]) + Prepend a filter to a stream */ +PHP_FUNCTION(stream_filter_prepend) +{ + apply_filter_to_stream(0, INTERNAL_FUNCTION_PARAM_PASSTHRU); +} +/* }}} */ + +/* {{{ proto resource stream_filter_append(resource stream, string filtername[, int read_write[, string filterparams]]) + Append a filter to a stream */ +PHP_FUNCTION(stream_filter_append) +{ + apply_filter_to_stream(1, INTERNAL_FUNCTION_PARAM_PASSTHRU); +} +/* }}} */ + +/* {{{ proto bool stream_filter_remove(resource stream_filter) + Flushes any data in the filter's internal buffer, removes it from the chain, and frees the resource */ +PHP_FUNCTION(stream_filter_remove) +{ + zval *zfilter; + php_stream_filter *filter; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zfilter) == FAILURE) { + RETURN_FALSE; + } + + filter = zend_fetch_resource(&zfilter TSRMLS_CC, -1, NULL, NULL, 1, php_file_le_stream_filter()); + if (!filter) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid resource given, not a stream filter"); + RETURN_FALSE; + } + + if (php_stream_filter_flush(filter, 1) == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to flush filter, not removing"); + RETURN_FALSE; + } + + if (zend_list_delete(Z_LVAL_P(zfilter)) == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not invalidate filter, not removing"); + RETURN_FALSE; + } else { + php_stream_filter_remove(filter, 1 TSRMLS_CC); + RETURN_TRUE; + } +} +/* }}} */ + +/* {{{ proto string stream_get_line(resource stream, int maxlen [, string ending]) + Read up to maxlen bytes from a stream or until the ending string is found */ +PHP_FUNCTION(stream_get_line) +{ + char *str = NULL; + int str_len = 0; + long max_length; + zval *zstream; + char *buf; + size_t buf_size; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|s", &zstream, &max_length, &str, &str_len) == FAILURE) { + RETURN_FALSE; + } + + if (max_length < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The maximum allowed length must be greater than or equal to zero"); + RETURN_FALSE; + } + if (!max_length) { + max_length = PHP_SOCK_CHUNK_SIZE; + } + + php_stream_from_zval(stream, &zstream); + + if ((buf = php_stream_get_record(stream, max_length, &buf_size, str, str_len TSRMLS_CC))) { + RETURN_STRINGL(buf, buf_size, 0); + } else { + RETURN_FALSE; + } +} + +/* }}} */ + +/* {{{ proto bool stream_set_blocking(resource socket, int mode) + Set blocking/non-blocking mode on a socket or stream */ +PHP_FUNCTION(stream_set_blocking) +{ + zval *arg1; + int block; + long arg2; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) { + return; + } + + php_stream_from_zval(stream, &arg1); + + block = arg2; + + if (php_stream_set_option(stream, PHP_STREAM_OPTION_BLOCKING, block == 0 ? 0 : 1, NULL) == -1) { + RETURN_FALSE; + } + + RETURN_TRUE; +} + +/* }}} */ + +/* {{{ proto bool stream_set_timeout(resource stream, int seconds [, int microseconds]) + Set timeout on stream read to seconds + microseonds */ +#if HAVE_SYS_TIME_H || defined(PHP_WIN32) +PHP_FUNCTION(stream_set_timeout) +{ + zval *socket; + long seconds, microseconds = 0; + struct timeval t; + php_stream *stream; + int argc = ZEND_NUM_ARGS(); + + if (zend_parse_parameters(argc TSRMLS_CC, "rl|l", &socket, &seconds, µseconds) == FAILURE) { + return; + } + + php_stream_from_zval(stream, &socket); + + t.tv_sec = seconds; + + if (argc == 3) { + t.tv_usec = microseconds % 1000000; + t.tv_sec += microseconds / 1000000; + } else { + t.tv_usec = 0; + } + + if (PHP_STREAM_OPTION_RETURN_OK == php_stream_set_option(stream, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &t)) { + RETURN_TRUE; + } + + RETURN_FALSE; +} +#endif /* HAVE_SYS_TIME_H || defined(PHP_WIN32) */ +/* }}} */ + +/* {{{ proto int stream_set_write_buffer(resource fp, int buffer) + Set file write buffer */ +PHP_FUNCTION(stream_set_write_buffer) +{ + zval *arg1; + int ret; + long arg2; + size_t buff; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, &arg1); + + buff = arg2; + + /* if buff is 0 then set to non-buffered */ + if (buff == 0) { + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_WRITE_BUFFER, PHP_STREAM_BUFFER_NONE, NULL); + } else { + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_WRITE_BUFFER, PHP_STREAM_BUFFER_FULL, &buff); + } + + RETURN_LONG(ret == 0 ? 0 : EOF); +} +/* }}} */ + +/* {{{ proto int stream_set_chunk_size(resource fp, int chunk_size) + Set the stream chunk size */ +PHP_FUNCTION(stream_set_chunk_size) +{ + int ret; + long csize; + zval *zstream; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zstream, &csize) == FAILURE) { + RETURN_FALSE; + } + + if (csize <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The chunk size must be a positive integer, given %ld", csize); + RETURN_FALSE; + } + /* stream.chunk_size is actually a size_t, but php_stream_set_option + * can only use an int to accept the new value and return the old one. + * In any case, values larger than INT_MAX for a chunk size make no sense. + */ + if (csize > INT_MAX) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The chunk size cannot be larger than %d", INT_MAX); + RETURN_FALSE; + } + + php_stream_from_zval(stream, &zstream); + + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_SET_CHUNK_SIZE, (int)csize, NULL); + + RETURN_LONG(ret > 0 ? (long)ret : (long)EOF); +} +/* }}} */ + +/* {{{ proto int stream_set_read_buffer(resource fp, int buffer) + Set file read buffer */ +PHP_FUNCTION(stream_set_read_buffer) +{ + zval *arg1; + int ret; + long arg2; + size_t buff; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, &arg1); + + buff = arg2; + + /* if buff is 0 then set to non-buffered */ + if (buff == 0) { + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_READ_BUFFER, PHP_STREAM_BUFFER_NONE, NULL); + } else { + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_READ_BUFFER, PHP_STREAM_BUFFER_FULL, &buff); + } + + RETURN_LONG(ret == 0 ? 0 : EOF); +} +/* }}} */ + +/* {{{ proto int stream_socket_enable_crypto(resource stream, bool enable [, int cryptokind [, resource sessionstream]]) + Enable or disable a specific kind of crypto on the stream */ +PHP_FUNCTION(stream_socket_enable_crypto) +{ + long cryptokind = 0; + zval *zstream, *zsessstream = NULL; + php_stream *stream, *sessstream = NULL; + zend_bool enable; + int ret; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb|lr", &zstream, &enable, &cryptokind, &zsessstream) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, &zstream); + + if (ZEND_NUM_ARGS() >= 3) { + if (zsessstream) { + php_stream_from_zval(sessstream, &zsessstream); + } + + if (php_stream_xport_crypto_setup(stream, cryptokind, sessstream TSRMLS_CC) < 0) { + RETURN_FALSE; + } + } else if (enable) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "When enabling encryption you must specify the crypto type"); + RETURN_FALSE; + } + + ret = php_stream_xport_crypto_enable(stream, enable TSRMLS_CC); + switch (ret) { + case -1: + RETURN_FALSE; + + case 0: + RETURN_LONG(0); + + default: + RETURN_TRUE; + } +} +/* }}} */ + +/* {{{ proto string stream_resolve_include_path(string filename) +Determine what file will be opened by calls to fopen() with a relative path */ +PHP_FUNCTION(stream_resolve_include_path) +{ + char *filename, *resolved_path; + int filename_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + return; + } + + resolved_path = zend_resolve_path(filename, filename_len TSRMLS_CC); + + if (resolved_path) { + RETURN_STRING(resolved_path, 0); + } + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto bool stream_is_local(resource stream|string url) U +*/ +PHP_FUNCTION(stream_is_local) +{ + zval **zstream; + php_stream *stream = NULL; + php_stream_wrapper *wrapper = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &zstream) == FAILURE) { + RETURN_FALSE; + } + + if (Z_TYPE_PP(zstream) == IS_RESOURCE) { + php_stream_from_zval(stream, zstream); + if (stream == NULL) { + RETURN_FALSE; + } + wrapper = stream->wrapper; + } else { + convert_to_string_ex(zstream); + + wrapper = php_stream_locate_url_wrapper(Z_STRVAL_PP(zstream), NULL, 0 TSRMLS_CC); + } + + if (!wrapper) { + RETURN_FALSE; + } + + RETURN_BOOL(wrapper->is_url==0); +} +/* }}} */ + +/* {{{ proto bool stream_supports_lock(resource stream) + Tells wether the stream supports locking through flock(). */ +PHP_FUNCTION(stream_supports_lock) +{ + php_stream *stream; + zval *zsrc; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zsrc) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, &zsrc); + + if (!php_stream_supports_lock(stream)) { + RETURN_FALSE; + } + + RETURN_TRUE; +} + +#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 + with stream to be shut down. If how is SHUT_RD, further receptions will + be disallowed. If how is SHUT_WR, further transmissions will be disallowed. + If how is SHUT_RDWR, further receptions and transmissions will be + disallowed. */ +PHP_FUNCTION(stream_socket_shutdown) +{ + long how; + zval *zstream; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zstream, &how) == FAILURE) { + RETURN_FALSE; + } + + if (how != STREAM_SHUT_RD && + how != STREAM_SHUT_WR && + how != STREAM_SHUT_RDWR) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, &zstream); + + RETURN_BOOL(php_stream_xport_shutdown(stream, (stream_shutdown_t)how TSRMLS_CC) == 0); +} +/* }}} */ +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ + diff --git a/ext/standard/streamsfuncs.h b/ext/standard/streamsfuncs.h new file mode 100644 index 0000000..b662de5 --- /dev/null +++ b/ext/standard/streamsfuncs.h @@ -0,0 +1,77 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Wez Furlong | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +/* Flags for stream_socket_client */ +#define PHP_STREAM_CLIENT_PERSISTENT 1 +#define PHP_STREAM_CLIENT_ASYNC_CONNECT 2 +#define PHP_STREAM_CLIENT_CONNECT 4 + +PHP_FUNCTION(stream_socket_client); +PHP_FUNCTION(stream_socket_server); +PHP_FUNCTION(stream_socket_accept); +PHP_FUNCTION(stream_socket_get_name); +PHP_FUNCTION(stream_socket_recvfrom); +PHP_FUNCTION(stream_socket_sendto); + +PHP_FUNCTION(stream_copy_to_stream); +PHP_FUNCTION(stream_get_contents); + +PHP_FUNCTION(stream_set_blocking); +PHP_FUNCTION(stream_select); +PHP_FUNCTION(stream_set_timeout); +PHP_FUNCTION(stream_set_read_buffer); +PHP_FUNCTION(stream_set_write_buffer); +PHP_FUNCTION(stream_set_chunk_size); +PHP_FUNCTION(stream_get_transports); +PHP_FUNCTION(stream_get_wrappers); +PHP_FUNCTION(stream_get_line); +PHP_FUNCTION(stream_get_meta_data); +PHP_FUNCTION(stream_wrapper_register); +PHP_FUNCTION(stream_wrapper_unregister); +PHP_FUNCTION(stream_wrapper_restore); +PHP_FUNCTION(stream_context_create); +PHP_FUNCTION(stream_context_set_params); +PHP_FUNCTION(stream_context_get_params); +PHP_FUNCTION(stream_context_set_option); +PHP_FUNCTION(stream_context_get_options); +PHP_FUNCTION(stream_context_get_default); +PHP_FUNCTION(stream_context_set_default); +PHP_FUNCTION(stream_filter_prepend); +PHP_FUNCTION(stream_filter_append); +PHP_FUNCTION(stream_filter_remove); +PHP_FUNCTION(stream_socket_enable_crypto); +PHP_FUNCTION(stream_socket_shutdown); +PHP_FUNCTION(stream_resolve_include_path); +PHP_FUNCTION(stream_is_local); +PHP_FUNCTION(stream_supports_lock); + +#if HAVE_SOCKETPAIR +PHP_FUNCTION(stream_socket_pair); +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ + diff --git a/ext/standard/string.c b/ext/standard/string.c new file mode 100644 index 0000000..42bf198 --- /dev/null +++ b/ext/standard/string.c @@ -0,0 +1,5667 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf | + | Stig Sæther Bakken | + | Zeev Suraski | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ + +#include +#ifdef PHP_WIN32 +# include "win32/php_stdint.h" +#else +# include +#endif +#include "php.h" +#include "php_rand.h" +#include "php_string.h" +#include "php_variables.h" +#ifdef HAVE_LOCALE_H +# include +#endif +#ifdef HAVE_LANGINFO_H +# include +#endif +#ifdef HAVE_MONETARY_H +# include +#endif +/* + * This define is here because some versions of libintl redefine setlocale + * to point to libintl_setlocale. That's a ridiculous thing to do as far + * as I am concerned, but with this define and the subsequent undef we + * limit the damage to just the actual setlocale() call in this file + * without turning zif_setlocale into zif_libintl_setlocale. -Rasmus + */ +#define php_my_setlocale setlocale +#ifdef HAVE_LIBINTL +# include /* For LC_MESSAGES */ + #ifdef setlocale + # undef setlocale + #endif +#endif + +#include "scanf.h" +#include "zend_API.h" +#include "zend_execute.h" +#include "php_globals.h" +#include "basic_functions.h" +#include "php_smart_str.h" +#include +#ifdef ZTS +#include "TSRM.h" +#endif + +/* For str_getcsv() support */ +#include "ext/standard/file.h" + +#define STR_PAD_LEFT 0 +#define STR_PAD_RIGHT 1 +#define STR_PAD_BOTH 2 +#define PHP_PATHINFO_DIRNAME 1 +#define PHP_PATHINFO_BASENAME 2 +#define PHP_PATHINFO_EXTENSION 4 +#define PHP_PATHINFO_FILENAME 8 +#define PHP_PATHINFO_ALL (PHP_PATHINFO_DIRNAME | PHP_PATHINFO_BASENAME | PHP_PATHINFO_EXTENSION | PHP_PATHINFO_FILENAME) + +#define STR_STRSPN 0 +#define STR_STRCSPN 1 + +/* {{{ register_string_constants + */ +void register_string_constants(INIT_FUNC_ARGS) +{ + REGISTER_LONG_CONSTANT("STR_PAD_LEFT", STR_PAD_LEFT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STR_PAD_RIGHT", STR_PAD_RIGHT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STR_PAD_BOTH", STR_PAD_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PATHINFO_DIRNAME", PHP_PATHINFO_DIRNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PATHINFO_BASENAME", PHP_PATHINFO_BASENAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PATHINFO_FILENAME", PHP_PATHINFO_FILENAME, CONST_CS | CONST_PERSISTENT); + +#ifdef HAVE_LOCALECONV + /* If last members of struct lconv equal CHAR_MAX, no grouping is done */ + +/* This is bad, but since we are going to be hardcoding in the POSIX stuff anyway... */ +# ifndef HAVE_LIMITS_H +# define CHAR_MAX 127 +# endif + + REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT); +#endif + +#ifdef HAVE_LOCALE_H + REGISTER_LONG_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LC_TIME", LC_TIME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LC_COLLATE", LC_COLLATE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LC_MONETARY", LC_MONETARY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LC_ALL", LC_ALL, CONST_CS | CONST_PERSISTENT); +# ifdef LC_MESSAGES + REGISTER_LONG_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS | CONST_PERSISTENT); +# endif +#endif + +} +/* }}} */ + +int php_tag_find(char *tag, int len, char *set); + +/* this is read-only, so it's ok */ +static char hexconvtab[] = "0123456789abcdef"; + +/* localeconv mutex */ +#ifdef ZTS +static MUTEX_T locale_mutex = NULL; +#endif + +/* {{{ php_bin2hex + */ +static char *php_bin2hex(const unsigned char *old, const size_t oldlen, size_t *newlen) +{ + register unsigned char *result = NULL; + size_t i, j; + + result = (unsigned char *) safe_emalloc(oldlen, 2 * sizeof(char), 1); + + for (i = j = 0; i < oldlen; i++) { + result[j++] = hexconvtab[old[i] >> 4]; + result[j++] = hexconvtab[old[i] & 15]; + } + result[j] = '\0'; + + if (newlen) + *newlen = oldlen * 2 * sizeof(char); + + return (char *)result; +} +/* }}} */ + +/* {{{ php_hex2bin + */ +static char *php_hex2bin(const unsigned char *old, const size_t oldlen, size_t *newlen) +{ + size_t target_length = oldlen >> 1; + register unsigned char *str = (unsigned char *)safe_emalloc(target_length, sizeof(char), 1); + size_t i, j; + for (i = j = 0; i < target_length; i++) { + char c = old[j++]; + if (c >= '0' && c <= '9') { + str[i] = (c - '0') << 4; + } else if (c >= 'a' && c <= 'f') { + str[i] = (c - 'a' + 10) << 4; + } else if (c >= 'A' && c <= 'F') { + str[i] = (c - 'A' + 10) << 4; + } else { + efree(str); + return NULL; + } + c = old[j++]; + if (c >= '0' && c <= '9') { + str[i] |= c - '0'; + } else if (c >= 'a' && c <= 'f') { + str[i] |= c - 'a' + 10; + } else if (c >= 'A' && c <= 'F') { + str[i] |= c - 'A' + 10; + } else { + efree(str); + return NULL; + } + } + str[target_length] = '\0'; + + if (newlen) + *newlen = target_length; + + return (char *)str; +} +/* }}} */ + +#ifdef HAVE_LOCALECONV +/* {{{ localeconv_r + * glibc's localeconv is not reentrant, so lets make it so ... sorta */ +PHPAPI struct lconv *localeconv_r(struct lconv *out) +{ + struct lconv *res; + +# ifdef ZTS + tsrm_mutex_lock( locale_mutex ); +# endif + + /* localeconv doesn't return an error condition */ + res = localeconv(); + + *out = *res; + +# ifdef ZTS + tsrm_mutex_unlock( locale_mutex ); +# endif + + return out; +} +/* }}} */ + +# ifdef ZTS +/* {{{ PHP_MINIT_FUNCTION + */ +PHP_MINIT_FUNCTION(localeconv) +{ + locale_mutex = tsrm_mutex_alloc(); + return SUCCESS; +} +/* }}} */ + +/* {{{ PHP_MSHUTDOWN_FUNCTION + */ +PHP_MSHUTDOWN_FUNCTION(localeconv) +{ + tsrm_mutex_free( locale_mutex ); + locale_mutex = NULL; + return SUCCESS; +} +/* }}} */ +# endif +#endif + +/* {{{ proto string bin2hex(string data) + Converts the binary representation of data to hex */ +PHP_FUNCTION(bin2hex) +{ + char *result, *data; + size_t newlen; + int datalen; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &datalen) == FAILURE) { + return; + } + + result = php_bin2hex((unsigned char *)data, datalen, &newlen); + + if (!result) { + RETURN_FALSE; + } + + RETURN_STRINGL(result, newlen, 0); +} +/* }}} */ + +/* {{{ proto string hex2bin(string data) + Converts the hex representation of data to binary */ +PHP_FUNCTION(hex2bin) +{ + char *result, *data; + size_t newlen; + int datalen; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &datalen) == FAILURE) { + return; + } + + if (datalen % 2 != 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Hexadecimal input string must have an even length"); + RETURN_FALSE; + } + + result = php_hex2bin((unsigned char *)data, datalen, &newlen); + + if (!result) { + RETURN_FALSE; + } + + RETURN_STRINGL(result, newlen, 0); +} +/* }}} */ + +static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ */ +{ + char *s11, *s22; + int len1, len2; + long start = 0, len = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", &s11, &len1, + &s22, &len2, &start, &len) == FAILURE) { + return; + } + + if (ZEND_NUM_ARGS() < 4) { + len = len1; + } + + /* look at substr() function for more information */ + + if (start < 0) { + start += len1; + if (start < 0) { + start = 0; + } + } else if (start > len1) { + RETURN_FALSE; + } + + if (len < 0) { + len += (len1 - start); + if (len < 0) { + len = 0; + } + } + + if (len > len1 - start) { + len = len1 - start; + } + + if(len == 0) { + RETURN_LONG(0); + } + + if (behavior == STR_STRSPN) { + RETURN_LONG(php_strspn(s11 + start /*str1_start*/, + s22 /*str2_start*/, + s11 + start + len /*str1_end*/, + s22 + len2 /*str2_end*/)); + } else if (behavior == STR_STRCSPN) { + RETURN_LONG(php_strcspn(s11 + start /*str1_start*/, + s22 /*str2_start*/, + s11 + start + len /*str1_end*/, + s22 + len2 /*str2_end*/)); + } + +} +/* }}} */ + +/* {{{ proto int strspn(string str, string mask [, start [, len]]) + Finds length of initial segment consisting entirely of characters found in mask. If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) */ +PHP_FUNCTION(strspn) +{ + php_spn_common_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU, STR_STRSPN); +} +/* }}} */ + +/* {{{ proto int strcspn(string str, string mask [, start [, len]]) + Finds length of initial segment consisting entirely of characters not found in mask. If start or/and length is provide works like strcspn(substr($s,$start,$len),$bad_chars) */ +PHP_FUNCTION(strcspn) +{ + php_spn_common_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU, STR_STRCSPN); +} +/* }}} */ + +/* {{{ PHP_MINIT_FUNCTION(nl_langinfo) */ +#if HAVE_NL_LANGINFO +PHP_MINIT_FUNCTION(nl_langinfo) +{ +#define REGISTER_NL_LANGINFO_CONSTANT(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) +#ifdef ABDAY_1 + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_1); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_2); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_3); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_4); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_5); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_6); + REGISTER_NL_LANGINFO_CONSTANT(ABDAY_7); +#endif +#ifdef DAY_1 + REGISTER_NL_LANGINFO_CONSTANT(DAY_1); + REGISTER_NL_LANGINFO_CONSTANT(DAY_2); + REGISTER_NL_LANGINFO_CONSTANT(DAY_3); + REGISTER_NL_LANGINFO_CONSTANT(DAY_4); + REGISTER_NL_LANGINFO_CONSTANT(DAY_5); + REGISTER_NL_LANGINFO_CONSTANT(DAY_6); + REGISTER_NL_LANGINFO_CONSTANT(DAY_7); +#endif +#ifdef ABMON_1 + REGISTER_NL_LANGINFO_CONSTANT(ABMON_1); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_2); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_3); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_4); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_5); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_6); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_7); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_8); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_9); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_10); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_11); + REGISTER_NL_LANGINFO_CONSTANT(ABMON_12); +#endif +#ifdef MON_1 + REGISTER_NL_LANGINFO_CONSTANT(MON_1); + REGISTER_NL_LANGINFO_CONSTANT(MON_2); + REGISTER_NL_LANGINFO_CONSTANT(MON_3); + REGISTER_NL_LANGINFO_CONSTANT(MON_4); + REGISTER_NL_LANGINFO_CONSTANT(MON_5); + REGISTER_NL_LANGINFO_CONSTANT(MON_6); + REGISTER_NL_LANGINFO_CONSTANT(MON_7); + REGISTER_NL_LANGINFO_CONSTANT(MON_8); + REGISTER_NL_LANGINFO_CONSTANT(MON_9); + REGISTER_NL_LANGINFO_CONSTANT(MON_10); + REGISTER_NL_LANGINFO_CONSTANT(MON_11); + REGISTER_NL_LANGINFO_CONSTANT(MON_12); +#endif +#ifdef AM_STR + REGISTER_NL_LANGINFO_CONSTANT(AM_STR); +#endif +#ifdef PM_STR + REGISTER_NL_LANGINFO_CONSTANT(PM_STR); +#endif +#ifdef D_T_FMT + REGISTER_NL_LANGINFO_CONSTANT(D_T_FMT); +#endif +#ifdef D_FMT + REGISTER_NL_LANGINFO_CONSTANT(D_FMT); +#endif +#ifdef T_FMT + REGISTER_NL_LANGINFO_CONSTANT(T_FMT); +#endif +#ifdef T_FMT_AMPM + REGISTER_NL_LANGINFO_CONSTANT(T_FMT_AMPM); +#endif +#ifdef ERA + REGISTER_NL_LANGINFO_CONSTANT(ERA); +#endif +#ifdef ERA_YEAR + REGISTER_NL_LANGINFO_CONSTANT(ERA_YEAR); +#endif +#ifdef ERA_D_T_FMT + REGISTER_NL_LANGINFO_CONSTANT(ERA_D_T_FMT); +#endif +#ifdef ERA_D_FMT + REGISTER_NL_LANGINFO_CONSTANT(ERA_D_FMT); +#endif +#ifdef ERA_T_FMT + REGISTER_NL_LANGINFO_CONSTANT(ERA_T_FMT); +#endif +#ifdef ALT_DIGITS + REGISTER_NL_LANGINFO_CONSTANT(ALT_DIGITS); +#endif +#ifdef INT_CURR_SYMBOL + REGISTER_NL_LANGINFO_CONSTANT(INT_CURR_SYMBOL); +#endif +#ifdef CURRENCY_SYMBOL + REGISTER_NL_LANGINFO_CONSTANT(CURRENCY_SYMBOL); +#endif +#ifdef CRNCYSTR + REGISTER_NL_LANGINFO_CONSTANT(CRNCYSTR); +#endif +#ifdef MON_DECIMAL_POINT + REGISTER_NL_LANGINFO_CONSTANT(MON_DECIMAL_POINT); +#endif +#ifdef MON_THOUSANDS_SEP + REGISTER_NL_LANGINFO_CONSTANT(MON_THOUSANDS_SEP); +#endif +#ifdef MON_GROUPING + REGISTER_NL_LANGINFO_CONSTANT(MON_GROUPING); +#endif +#ifdef POSITIVE_SIGN + REGISTER_NL_LANGINFO_CONSTANT(POSITIVE_SIGN); +#endif +#ifdef NEGATIVE_SIGN + REGISTER_NL_LANGINFO_CONSTANT(NEGATIVE_SIGN); +#endif +#ifdef INT_FRAC_DIGITS + REGISTER_NL_LANGINFO_CONSTANT(INT_FRAC_DIGITS); +#endif +#ifdef FRAC_DIGITS + REGISTER_NL_LANGINFO_CONSTANT(FRAC_DIGITS); +#endif +#ifdef P_CS_PRECEDES + REGISTER_NL_LANGINFO_CONSTANT(P_CS_PRECEDES); +#endif +#ifdef P_SEP_BY_SPACE + REGISTER_NL_LANGINFO_CONSTANT(P_SEP_BY_SPACE); +#endif +#ifdef N_CS_PRECEDES + REGISTER_NL_LANGINFO_CONSTANT(N_CS_PRECEDES); +#endif +#ifdef N_SEP_BY_SPACE + REGISTER_NL_LANGINFO_CONSTANT(N_SEP_BY_SPACE); +#endif +#ifdef P_SIGN_POSN + REGISTER_NL_LANGINFO_CONSTANT(P_SIGN_POSN); +#endif +#ifdef N_SIGN_POSN + REGISTER_NL_LANGINFO_CONSTANT(N_SIGN_POSN); +#endif +#ifdef DECIMAL_POINT + REGISTER_NL_LANGINFO_CONSTANT(DECIMAL_POINT); +#endif +#ifdef RADIXCHAR + REGISTER_NL_LANGINFO_CONSTANT(RADIXCHAR); +#endif +#ifdef THOUSANDS_SEP + REGISTER_NL_LANGINFO_CONSTANT(THOUSANDS_SEP); +#endif +#ifdef THOUSEP + REGISTER_NL_LANGINFO_CONSTANT(THOUSEP); +#endif +#ifdef GROUPING + REGISTER_NL_LANGINFO_CONSTANT(GROUPING); +#endif +#ifdef YESEXPR + REGISTER_NL_LANGINFO_CONSTANT(YESEXPR); +#endif +#ifdef NOEXPR + REGISTER_NL_LANGINFO_CONSTANT(NOEXPR); +#endif +#ifdef YESSTR + REGISTER_NL_LANGINFO_CONSTANT(YESSTR); +#endif +#ifdef NOSTR + REGISTER_NL_LANGINFO_CONSTANT(NOSTR); +#endif +#ifdef CODESET + REGISTER_NL_LANGINFO_CONSTANT(CODESET); +#endif +#undef REGISTER_NL_LANGINFO_CONSTANT + return SUCCESS; +} +/* }}} */ + +/* {{{ proto string nl_langinfo(int item) + Query language and locale information */ +PHP_FUNCTION(nl_langinfo) +{ + long item; + char *value; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &item) == FAILURE) { + return; + } + + switch(item) { /* {{{ */ +#ifdef ABDAY_1 + case ABDAY_1: + case ABDAY_2: + case ABDAY_3: + case ABDAY_4: + case ABDAY_5: + case ABDAY_6: + case ABDAY_7: +#endif +#ifdef DAY_1 + case DAY_1: + case DAY_2: + case DAY_3: + case DAY_4: + case DAY_5: + case DAY_6: + case DAY_7: +#endif +#ifdef ABMON_1 + case ABMON_1: + case ABMON_2: + case ABMON_3: + case ABMON_4: + case ABMON_5: + case ABMON_6: + case ABMON_7: + case ABMON_8: + case ABMON_9: + case ABMON_10: + case ABMON_11: + case ABMON_12: +#endif +#ifdef MON_1 + case MON_1: + case MON_2: + case MON_3: + case MON_4: + case MON_5: + case MON_6: + case MON_7: + case MON_8: + case MON_9: + case MON_10: + case MON_11: + case MON_12: +#endif +#ifdef AM_STR + case AM_STR: +#endif +#ifdef PM_STR + case PM_STR: +#endif +#ifdef D_T_FMT + case D_T_FMT: +#endif +#ifdef D_FMT + case D_FMT: +#endif +#ifdef T_FMT + case T_FMT: +#endif +#ifdef T_FMT_AMPM + case T_FMT_AMPM: +#endif +#ifdef ERA + case ERA: +#endif +#ifdef ERA_YEAR + case ERA_YEAR: +#endif +#ifdef ERA_D_T_FMT + case ERA_D_T_FMT: +#endif +#ifdef ERA_D_FMT + case ERA_D_FMT: +#endif +#ifdef ERA_T_FMT + case ERA_T_FMT: +#endif +#ifdef ALT_DIGITS + case ALT_DIGITS: +#endif +#ifdef INT_CURR_SYMBOL + case INT_CURR_SYMBOL: +#endif +#ifdef CURRENCY_SYMBOL + case CURRENCY_SYMBOL: +#endif +#ifdef CRNCYSTR + case CRNCYSTR: +#endif +#ifdef MON_DECIMAL_POINT + case MON_DECIMAL_POINT: +#endif +#ifdef MON_THOUSANDS_SEP + case MON_THOUSANDS_SEP: +#endif +#ifdef MON_GROUPING + case MON_GROUPING: +#endif +#ifdef POSITIVE_SIGN + case POSITIVE_SIGN: +#endif +#ifdef NEGATIVE_SIGN + case NEGATIVE_SIGN: +#endif +#ifdef INT_FRAC_DIGITS + case INT_FRAC_DIGITS: +#endif +#ifdef FRAC_DIGITS + case FRAC_DIGITS: +#endif +#ifdef P_CS_PRECEDES + case P_CS_PRECEDES: +#endif +#ifdef P_SEP_BY_SPACE + case P_SEP_BY_SPACE: +#endif +#ifdef N_CS_PRECEDES + case N_CS_PRECEDES: +#endif +#ifdef N_SEP_BY_SPACE + case N_SEP_BY_SPACE: +#endif +#ifdef P_SIGN_POSN + case P_SIGN_POSN: +#endif +#ifdef N_SIGN_POSN + case N_SIGN_POSN: +#endif +#ifdef DECIMAL_POINT + case DECIMAL_POINT: +#elif defined(RADIXCHAR) + case RADIXCHAR: +#endif +#ifdef THOUSANDS_SEP + case THOUSANDS_SEP: +#elif defined(THOUSEP) + case THOUSEP: +#endif +#ifdef GROUPING + case GROUPING: +#endif +#ifdef YESEXPR + case YESEXPR: +#endif +#ifdef NOEXPR + case NOEXPR: +#endif +#ifdef YESSTR + case YESSTR: +#endif +#ifdef NOSTR + case NOSTR: +#endif +#ifdef CODESET + case CODESET: +#endif + break; + default: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Item '%ld' is not valid", item); + RETURN_FALSE; + } + /* }}} */ + + value = nl_langinfo(item); + if (value == NULL) { + RETURN_FALSE; + } else { + RETURN_STRING(value, 1); + } +} +#endif +/* }}} */ + +#ifdef HAVE_STRCOLL +/* {{{ proto int strcoll(string str1, string str2) + Compares two strings using the current locale */ +PHP_FUNCTION(strcoll) +{ + char *s1, *s2; + int s1len, s2len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1len, &s2, &s2len) == FAILURE) { + return; + } + + RETURN_LONG(strcoll((const char *) s1, + (const char *) s2)); +} +/* }}} */ +#endif + +/* {{{ php_charmask + * Fills a 256-byte bytemask with input. You can specify a range like 'a..z', + * it needs to be incrementing. + * Returns: FAILURE/SUCCESS whether the input was correct (i.e. no range errors) + */ +static inline int php_charmask(unsigned char *input, int len, char *mask TSRMLS_DC) +{ + unsigned char *end; + unsigned char c; + int result = SUCCESS; + + memset(mask, 0, 256); + for (end = input+len; input < end; input++) { + c=*input; + if ((input+3 < end) && input[1] == '.' && input[2] == '.' + && input[3] >= c) { + memset(mask+c, 1, input[3] - c + 1); + input+=3; + } else if ((input+1 < end) && input[0] == '.' && input[1] == '.') { + /* Error, try to be as helpful as possible: + (a range ending/starting with '.' won't be captured here) */ + if (end-len >= input) { /* there was no 'left' char */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range, no character to the left of '..'"); + result = FAILURE; + continue; + } + if (input+2 >= end) { /* there is no 'right' char */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range, no character to the right of '..'"); + result = FAILURE; + continue; + } + if (input[-1] > input[2]) { /* wrong order */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range, '..'-range needs to be incrementing"); + result = FAILURE; + continue; + } + /* FIXME: better error (a..b..c is the only left possibility?) */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range"); + result = FAILURE; + continue; + } else { + mask[c]=1; + } + } + return result; +} +/* }}} */ + +/* {{{ php_trim() + * mode 1 : trim left + * mode 2 : trim right + * mode 3 : trim left and right + * what indicates which chars are to be trimmed. NULL->default (' \t\n\r\v\0') + */ +PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_value, int mode TSRMLS_DC) +{ + register int i; + int trimmed = 0; + char mask[256]; + + if (what) { + php_charmask((unsigned char*)what, what_len, mask TSRMLS_CC); + } else { + php_charmask((unsigned char*)" \n\r\t\v\0", 6, mask TSRMLS_CC); + } + + if (mode & 1) { + for (i = 0; i < len; i++) { + if (mask[(unsigned char)c[i]]) { + trimmed++; + } else { + break; + } + } + len -= trimmed; + c += trimmed; + } + if (mode & 2) { + for (i = len - 1; i >= 0; i--) { + if (mask[(unsigned char)c[i]]) { + len--; + } else { + break; + } + } + } + + if (return_value) { + RETVAL_STRINGL(c, len, 1); + } else { + return estrndup(c, len); + } + return ""; +} +/* }}} */ + +/* {{{ php_do_trim + * Base for trim(), rtrim() and ltrim() functions. + */ +static void php_do_trim(INTERNAL_FUNCTION_PARAMETERS, int mode) +{ + char *str; + char *what = NULL; + int str_len, what_len = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &what, &what_len) == FAILURE) { + return; + } + + php_trim(str, str_len, what, what_len, return_value, mode TSRMLS_CC); +} +/* }}} */ + +/* {{{ proto string trim(string str [, string character_mask]) + Strips whitespace from the beginning and end of a string */ +PHP_FUNCTION(trim) +{ + php_do_trim(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3); +} +/* }}} */ + +/* {{{ proto string rtrim(string str [, string character_mask]) + Removes trailing whitespace */ +PHP_FUNCTION(rtrim) +{ + php_do_trim(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2); +} +/* }}} */ + +/* {{{ proto string ltrim(string str [, string character_mask]) + Strips whitespace from the beginning of a string */ +PHP_FUNCTION(ltrim) +{ + php_do_trim(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +/* {{{ proto string wordwrap(string str [, int width [, string break [, boolean cut]]]) + Wraps buffer to selected number of characters using string break char */ +PHP_FUNCTION(wordwrap) +{ + const char *text, *breakchar = "\n"; + char *newtext; + int textlen, breakcharlen = 1, newtextlen, chk; + size_t alloced; + long current = 0, laststart = 0, lastspace = 0; + long linelength = 75; + zend_bool docut = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lsb", &text, &textlen, &linelength, &breakchar, &breakcharlen, &docut) == FAILURE) { + return; + } + + if (textlen == 0) { + RETURN_EMPTY_STRING(); + } + + if (breakcharlen == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Break string cannot be empty"); + RETURN_FALSE; + } + + if (linelength == 0 && docut) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't force cut when width is zero"); + RETURN_FALSE; + } + + /* Special case for a single-character break as it needs no + additional storage space */ + if (breakcharlen == 1 && !docut) { + newtext = estrndup(text, textlen); + + laststart = lastspace = 0; + for (current = 0; current < textlen; current++) { + if (text[current] == breakchar[0]) { + laststart = lastspace = current + 1; + } else if (text[current] == ' ') { + if (current - laststart >= linelength) { + newtext[current] = breakchar[0]; + laststart = current + 1; + } + lastspace = current; + } else if (current - laststart >= linelength && laststart != lastspace) { + newtext[lastspace] = breakchar[0]; + laststart = lastspace + 1; + } + } + + RETURN_STRINGL(newtext, textlen, 0); + } else { + /* Multiple character line break or forced cut */ + if (linelength > 0) { + chk = (int)(textlen/linelength + 1); + newtext = safe_emalloc(chk, breakcharlen, textlen + 1); + alloced = textlen + chk * breakcharlen + 1; + } else { + chk = textlen; + alloced = textlen * (breakcharlen + 1) + 1; + newtext = safe_emalloc(textlen, (breakcharlen + 1), 1); + } + + /* now keep track of the actual new text length */ + newtextlen = 0; + + laststart = lastspace = 0; + for (current = 0; current < textlen; current++) { + if (chk <= 0) { + alloced += (int) (((textlen - current + 1)/linelength + 1) * breakcharlen) + 1; + newtext = erealloc(newtext, alloced); + chk = (int) ((textlen - current)/linelength) + 1; + } + /* when we hit an existing break, copy to new buffer, and + * fix up laststart and lastspace */ + if (text[current] == breakchar[0] + && current + breakcharlen < textlen + && !strncmp(text+current, breakchar, breakcharlen)) { + memcpy(newtext+newtextlen, text+laststart, current-laststart+breakcharlen); + newtextlen += current-laststart+breakcharlen; + current += breakcharlen - 1; + laststart = lastspace = current + 1; + chk--; + } + /* if it is a space, check if it is at the line boundary, + * copy and insert a break, or just keep track of it */ + else if (text[current] == ' ') { + if (current - laststart >= linelength) { + memcpy(newtext+newtextlen, text+laststart, current-laststart); + newtextlen += current - laststart; + memcpy(newtext+newtextlen, breakchar, breakcharlen); + newtextlen += breakcharlen; + laststart = current + 1; + chk--; + } + lastspace = current; + } + /* if we are cutting, and we've accumulated enough + * characters, and we haven't see a space for this line, + * copy and insert a break. */ + else if (current - laststart >= linelength + && docut && laststart >= lastspace) { + memcpy(newtext+newtextlen, text+laststart, current-laststart); + newtextlen += current - laststart; + memcpy(newtext+newtextlen, breakchar, breakcharlen); + newtextlen += breakcharlen; + laststart = lastspace = current; + chk--; + } + /* if the current word puts us over the linelength, copy + * back up until the last space, insert a break, and move + * up the laststart */ + else if (current - laststart >= linelength + && laststart < lastspace) { + memcpy(newtext+newtextlen, text+laststart, lastspace-laststart); + newtextlen += lastspace - laststart; + memcpy(newtext+newtextlen, breakchar, breakcharlen); + newtextlen += breakcharlen; + laststart = lastspace = lastspace + 1; + chk--; + } + } + + /* copy over any stragglers */ + if (laststart != current) { + memcpy(newtext+newtextlen, text+laststart, current-laststart); + newtextlen += current - laststart; + } + + newtext[newtextlen] = '\0'; + /* free unused memory */ + newtext = erealloc(newtext, newtextlen+1); + + RETURN_STRINGL(newtext, newtextlen, 0); + } +} +/* }}} */ + +/* {{{ php_explode + */ +PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, long limit) +{ + char *p1, *p2, *endp; + + endp = Z_STRVAL_P(str) + Z_STRLEN_P(str); + + p1 = Z_STRVAL_P(str); + p2 = php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp); + + if (p2 == NULL) { + add_next_index_stringl(return_value, p1, Z_STRLEN_P(str), 1); + } else { + do { + add_next_index_stringl(return_value, p1, p2 - p1, 1); + p1 = p2 + Z_STRLEN_P(delim); + } while ((p2 = php_memnstr(p1, Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp)) != NULL && + --limit > 1); + + if (p1 <= endp) + add_next_index_stringl(return_value, p1, endp-p1, 1); + } +} +/* }}} */ + +/* {{{ php_explode_negative_limit + */ +PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_value, long limit) +{ +#define EXPLODE_ALLOC_STEP 64 + char *p1, *p2, *endp; + + endp = Z_STRVAL_P(str) + Z_STRLEN_P(str); + + p1 = Z_STRVAL_P(str); + p2 = php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp); + + if (p2 == NULL) { + /* + do nothing since limit <= -1, thus if only one chunk - 1 + (limit) <= 0 + by doing nothing we return empty array + */ + } else { + int allocated = EXPLODE_ALLOC_STEP, found = 0; + long i, to_return; + char **positions = emalloc(allocated * sizeof(char *)); + + positions[found++] = p1; + do { + if (found >= allocated) { + allocated = found + EXPLODE_ALLOC_STEP;/* make sure we have enough memory */ + positions = erealloc(positions, allocated*sizeof(char *)); + } + positions[found++] = p1 = p2 + Z_STRLEN_P(delim); + } while ((p2 = php_memnstr(p1, Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp)) != NULL); + + to_return = limit + found; + /* limit is at least -1 therefore no need of bounds checking : i will be always less than found */ + for (i = 0;i < to_return;i++) { /* this checks also for to_return > 0 */ + add_next_index_stringl(return_value, positions[i], + (positions[i+1] - Z_STRLEN_P(delim)) - positions[i], + 1 + ); + } + efree(positions); + } +#undef EXPLODE_ALLOC_STEP +} +/* }}} */ + +/* {{{ proto array explode(string separator, string str [, int limit]) + Splits a string on string separator and return array of components. If limit is positive only limit number of components is returned. If limit is negative all components except the last abs(limit) are returned. */ +PHP_FUNCTION(explode) +{ + char *str, *delim; + int str_len = 0, delim_len = 0; + long limit = LONG_MAX; /* No limit */ + zval zdelim, zstr; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &delim, &delim_len, &str, &str_len, &limit) == FAILURE) { + return; + } + + if (delim_len == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter"); + RETURN_FALSE; + } + + array_init(return_value); + + if (str_len == 0) { + if (limit >= 0) { + add_next_index_stringl(return_value, "", sizeof("") - 1, 1); + } + return; + } + + ZVAL_STRINGL(&zstr, str, str_len, 0); + ZVAL_STRINGL(&zdelim, delim, delim_len, 0); + if (limit > 1) { + php_explode(&zdelim, &zstr, return_value, limit); + } else if (limit < 0) { + php_explode_negative_limit(&zdelim, &zstr, return_value, limit); + } else { + add_index_stringl(return_value, 0, str, str_len, 1); + } +} +/* }}} */ + +/* {{{ proto string join(array src, string glue) + An alias for implode */ +/* }}} */ + +/* {{{ php_implode + */ +PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC) +{ + zval **tmp; + HashPosition pos; + smart_str implstr = {0}; + int numelems, i = 0; + zval tmp_val; + int str_len; + + numelems = zend_hash_num_elements(Z_ARRVAL_P(arr)); + + if (numelems == 0) { + RETURN_EMPTY_STRING(); + } + + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos); + + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **) &tmp, &pos) == SUCCESS) { + switch ((*tmp)->type) { + case IS_STRING: + smart_str_appendl(&implstr, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); + break; + + case IS_LONG: { + char stmp[MAX_LENGTH_OF_LONG + 1]; + str_len = slprintf(stmp, sizeof(stmp), "%ld", Z_LVAL_PP(tmp)); + smart_str_appendl(&implstr, stmp, str_len); + } + break; + + case IS_BOOL: + if (Z_LVAL_PP(tmp) == 1) { + smart_str_appendl(&implstr, "1", sizeof("1")-1); + } + break; + + case IS_NULL: + break; + + case IS_DOUBLE: { + char *stmp; + str_len = spprintf(&stmp, 0, "%.*G", (int) EG(precision), Z_DVAL_PP(tmp)); + smart_str_appendl(&implstr, stmp, str_len); + efree(stmp); + } + break; + + case IS_OBJECT: { + int copy; + zval expr; + zend_make_printable_zval(*tmp, &expr, ©); + smart_str_appendl(&implstr, Z_STRVAL(expr), Z_STRLEN(expr)); + if (copy) { + zval_dtor(&expr); + } + } + break; + + default: + tmp_val = **tmp; + zval_copy_ctor(&tmp_val); + convert_to_string(&tmp_val); + smart_str_appendl(&implstr, Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); + zval_dtor(&tmp_val); + break; + + } + + if (++i != numelems) { + smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRLEN_P(delim)); + } + zend_hash_move_forward_ex(Z_ARRVAL_P(arr), &pos); + } + smart_str_0(&implstr); + + if (implstr.len) { + RETURN_STRINGL(implstr.c, implstr.len, 0); + } else { + smart_str_free(&implstr); + RETURN_EMPTY_STRING(); + } +} +/* }}} */ + +/* {{{ proto string implode([string glue,] array pieces) + Joins array elements placing glue string between items and return one string */ +PHP_FUNCTION(implode) +{ + zval **arg1 = NULL, **arg2 = NULL, *delim, *arr; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|Z", &arg1, &arg2) == FAILURE) { + return; + } + + if (arg2 == NULL) { + if (Z_TYPE_PP(arg1) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument must be an array"); + return; + } + + MAKE_STD_ZVAL(delim); +#define _IMPL_EMPTY "" + ZVAL_STRINGL(delim, _IMPL_EMPTY, sizeof(_IMPL_EMPTY) - 1, 0); + + SEPARATE_ZVAL(arg1); + arr = *arg1; + } else { + if (Z_TYPE_PP(arg1) == IS_ARRAY) { + arr = *arg1; + convert_to_string_ex(arg2); + delim = *arg2; + } else if (Z_TYPE_PP(arg2) == IS_ARRAY) { + arr = *arg2; + convert_to_string_ex(arg1); + delim = *arg1; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid arguments passed"); + return; + } + } + + php_implode(delim, arr, return_value TSRMLS_CC); + + if (arg2 == NULL) { + FREE_ZVAL(delim); + } +} +/* }}} */ + +#define STRTOK_TABLE(p) BG(strtok_table)[(unsigned char) *p] + +/* {{{ proto string strtok([string str,] string token) + Tokenize a string */ +PHP_FUNCTION(strtok) +{ + char *str, *tok = NULL; + int str_len, tok_len = 0; + zval *zv; + + char *token; + char *token_end; + char *p; + char *pe; + int skipped = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &tok, &tok_len) == FAILURE) { + return; + } + + if (ZEND_NUM_ARGS() == 1) { + tok = str; + tok_len = str_len; + } else { + if (BG(strtok_zval)) { + zval_ptr_dtor(&BG(strtok_zval)); + } + MAKE_STD_ZVAL(zv); + ZVAL_STRINGL(zv, str, str_len, 1); + + BG(strtok_zval) = zv; + BG(strtok_last) = BG(strtok_string) = Z_STRVAL_P(zv); + BG(strtok_len) = str_len; + } + + p = BG(strtok_last); /* Where we start to search */ + pe = BG(strtok_string) + BG(strtok_len); + + if (!p || p >= pe) { + RETURN_FALSE; + } + + token = tok; + token_end = token + tok_len; + + while (token < token_end) { + STRTOK_TABLE(token++) = 1; + } + + /* Skip leading delimiters */ + while (STRTOK_TABLE(p)) { + if (++p >= pe) { + /* no other chars left */ + BG(strtok_last) = NULL; + RETVAL_FALSE; + goto restore; + } + skipped++; + } + + /* We know at this place that *p is no delimiter, so skip it */ + while (++p < pe) { + if (STRTOK_TABLE(p)) { + goto return_token; + } + } + + if (p - BG(strtok_last)) { +return_token: + RETVAL_STRINGL(BG(strtok_last) + skipped, (p - BG(strtok_last)) - skipped, 1); + BG(strtok_last) = p + 1; + } else { + RETVAL_FALSE; + BG(strtok_last) = NULL; + } + + /* Restore table -- usually faster then memset'ing the table on every invocation */ +restore: + token = tok; + + while (token < token_end) { + STRTOK_TABLE(token++) = 0; + } +} +/* }}} */ + +/* {{{ php_strtoupper + */ +PHPAPI char *php_strtoupper(char *s, size_t len) +{ + unsigned char *c, *e; + + c = (unsigned char *)s; + e = (unsigned char *)c+len; + + while (c < e) { + *c = toupper(*c); + c++; + } + return s; +} +/* }}} */ + +/* {{{ proto string strtoupper(string str) + Makes a string uppercase */ +PHP_FUNCTION(strtoupper) +{ + char *arg; + int arglen; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arglen) == FAILURE) { + return; + } + + arg = estrndup(arg, arglen); + php_strtoupper(arg, arglen); + RETURN_STRINGL(arg, arglen, 0); +} +/* }}} */ + +/* {{{ php_strtolower + */ +PHPAPI char *php_strtolower(char *s, size_t len) +{ + unsigned char *c, *e; + + c = (unsigned char *)s; + e = c+len; + + while (c < e) { + *c = tolower(*c); + c++; + } + return s; +} +/* }}} */ + +/* {{{ proto string strtolower(string str) + Makes a string lowercase */ +PHP_FUNCTION(strtolower) +{ + char *str; + int arglen; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &arglen) == FAILURE) { + return; + } + + str = estrndup(str, arglen); + php_strtolower(str, arglen); + RETURN_STRINGL(str, arglen, 0); +} +/* }}} */ + +/* {{{ php_basename + */ +PHPAPI void php_basename(const char *s, size_t len, char *suffix, size_t sufflen, char **p_ret, size_t *p_len TSRMLS_DC) +{ + char *ret = NULL, *c, *comp, *cend; + size_t inc_len, cnt; + int state; + + c = comp = cend = (char*)s; + cnt = len; + state = 0; + while (cnt > 0) { + inc_len = (*c == '\0' ? 1: php_mblen(c, cnt)); + + switch (inc_len) { + case -2: + case -1: + inc_len = 1; + php_ignore_value(php_mblen(NULL, 0)); + break; + case 0: + goto quit_loop; + case 1: +#if defined(PHP_WIN32) || defined(NETWARE) + if (*c == '/' || *c == '\\') { +#else + if (*c == '/') { +#endif + if (state == 1) { + state = 0; + cend = c; + } + } else { + if (state == 0) { + comp = c; + state = 1; + } + } + break; + default: + if (state == 0) { + comp = c; + state = 1; + } + break; + } + c += inc_len; + cnt -= inc_len; + } + +quit_loop: + if (state == 1) { + cend = c; + } + if (suffix != NULL && sufflen < (uint)(cend - comp) && + memcmp(cend - sufflen, suffix, sufflen) == 0) { + cend -= sufflen; + } + + len = cend - comp; + + if (p_ret) { + ret = emalloc(len + 1); + memcpy(ret, comp, len); + ret[len] = '\0'; + *p_ret = ret; + } + if (p_len) { + *p_len = len; + } +} +/* }}} */ + +/* {{{ proto string basename(string path [, string suffix]) + Returns the filename component of the path */ +PHP_FUNCTION(basename) +{ + char *string, *suffix = NULL, *ret; + int string_len, suffix_len = 0; + size_t ret_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &string, &string_len, &suffix, &suffix_len) == FAILURE) { + return; + } + + php_basename(string, string_len, suffix, suffix_len, &ret, &ret_len TSRMLS_CC); + RETURN_STRINGL(ret, (int)ret_len, 0); +} +/* }}} */ + +/* {{{ php_dirname + Returns directory name component of path */ +PHPAPI size_t php_dirname(char *path, size_t len) +{ + return zend_dirname(path, len); +} +/* }}} */ + +/* {{{ proto string dirname(string path) + Returns the directory name component of the path */ +PHP_FUNCTION(dirname) +{ + char *str; + char *ret; + int str_len; + size_t ret_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + return; + } + + ret = estrndup(str, str_len); + ret_len = php_dirname(ret, str_len); + + RETURN_STRINGL(ret, ret_len, 0); +} +/* }}} */ + +/* {{{ proto array pathinfo(string path[, int options]) + Returns information about a certain string */ +PHP_FUNCTION(pathinfo) +{ + zval *tmp; + char *path, *ret = NULL; + int path_len, have_basename; + size_t ret_len; + long opt = PHP_PATHINFO_ALL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &path_len, &opt) == FAILURE) { + return; + } + + have_basename = ((opt & PHP_PATHINFO_BASENAME) == PHP_PATHINFO_BASENAME); + + MAKE_STD_ZVAL(tmp); + array_init(tmp); + + if ((opt & PHP_PATHINFO_DIRNAME) == PHP_PATHINFO_DIRNAME) { + ret = estrndup(path, path_len); + php_dirname(ret, path_len); + if (*ret) { + add_assoc_string(tmp, "dirname", ret, 1); + } + efree(ret); + ret = NULL; + } + + if (have_basename) { + php_basename(path, path_len, NULL, 0, &ret, &ret_len TSRMLS_CC); + add_assoc_stringl(tmp, "basename", ret, ret_len, 0); + } + + if ((opt & PHP_PATHINFO_EXTENSION) == PHP_PATHINFO_EXTENSION) { + const char *p; + int idx; + + if (!have_basename) { + php_basename(path, path_len, NULL, 0, &ret, &ret_len TSRMLS_CC); + } + + p = zend_memrchr(ret, '.', ret_len); + + if (p) { + idx = p - ret; + add_assoc_stringl(tmp, "extension", ret + idx + 1, ret_len - idx - 1, 1); + } + } + + if ((opt & PHP_PATHINFO_FILENAME) == PHP_PATHINFO_FILENAME) { + const char *p; + int idx; + + /* Have we alrady looked up the basename? */ + if (!have_basename && !ret) { + php_basename(path, path_len, NULL, 0, &ret, &ret_len TSRMLS_CC); + } + + p = zend_memrchr(ret, '.', ret_len); + + idx = p ? (p - ret) : ret_len; + add_assoc_stringl(tmp, "filename", ret, idx, 1); + } + + if (!have_basename && ret) { + efree(ret); + } + + if (opt == PHP_PATHINFO_ALL) { + RETURN_ZVAL(tmp, 0, 1); + } else { + zval **element; + if (zend_hash_get_current_data(Z_ARRVAL_P(tmp), (void **) &element) == SUCCESS) { + RETVAL_ZVAL(*element, 1, 0); + } else { + ZVAL_EMPTY_STRING(return_value); + } + } + + zval_ptr_dtor(&tmp); +} +/* }}} */ + +/* {{{ php_stristr + case insensitve strstr */ +PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len) +{ + php_strtolower(s, s_len); + php_strtolower(t, t_len); + return php_memnstr(s, t, t_len, s + s_len); +} +/* }}} */ + +/* {{{ php_strspn + */ +PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end) +{ + register const char *p = s1, *spanp; + register char c = *p; + +cont: + for (spanp = s2; p != s1_end && spanp != s2_end;) { + if (*spanp++ == c) { + c = *(++p); + goto cont; + } + } + return (p - s1); +} +/* }}} */ + +/* {{{ php_strcspn + */ +PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end) +{ + register const char *p, *spanp; + register char c = *s1; + + for (p = s1;;) { + spanp = s2; + do { + if (*spanp == c || p == s1_end) { + return p - s1; + } + } while (spanp++ < (s2_end - 1)); + c = *++p; + } + /* NOTREACHED */ +} +/* }}} */ + +/* {{{ php_needle_char + */ +static int php_needle_char(zval *needle, char *target TSRMLS_DC) +{ + switch (Z_TYPE_P(needle)) { + case IS_LONG: + case IS_BOOL: + *target = (char)Z_LVAL_P(needle); + return SUCCESS; + case IS_NULL: + *target = '\0'; + return SUCCESS; + case IS_DOUBLE: + *target = (char)(int)Z_DVAL_P(needle); + return SUCCESS; + case IS_OBJECT: + { + zval holder = *needle; + zval_copy_ctor(&(holder)); + convert_to_long(&(holder)); + if(Z_TYPE(holder) != IS_LONG) { + return FAILURE; + } + *target = (char)Z_LVAL(holder); + return SUCCESS; + } + default: { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "needle is not a string or an integer"); + return FAILURE; + } + } +} +/* }}} */ + +/* {{{ proto string stristr(string haystack, string needle[, bool part]) + Finds first occurrence of a string within another, case insensitive */ +PHP_FUNCTION(stristr) +{ + zval *needle; + char *haystack; + int haystack_len; + char *found = NULL; + int found_offset; + char *haystack_dup; + char needle_char[2]; + zend_bool part = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &haystack, &haystack_len, &needle, &part) == FAILURE) { + return; + } + + haystack_dup = estrndup(haystack, haystack_len); + + if (Z_TYPE_P(needle) == IS_STRING) { + char *orig_needle; + if (!Z_STRLEN_P(needle)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter"); + efree(haystack_dup); + RETURN_FALSE; + } + orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); + found = php_stristr(haystack_dup, orig_needle, haystack_len, Z_STRLEN_P(needle)); + efree(orig_needle); + } else { + if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { + efree(haystack_dup); + RETURN_FALSE; + } + needle_char[1] = 0; + + found = php_stristr(haystack_dup, needle_char, haystack_len, 1); + } + + if (found) { + found_offset = found - haystack_dup; + if (part) { + RETVAL_STRINGL(haystack, found_offset, 1); + } else { + RETVAL_STRINGL(haystack + found_offset, haystack_len - found_offset, 1); + } + } else { + RETVAL_FALSE; + } + + efree(haystack_dup); +} +/* }}} */ + +/* {{{ proto string strstr(string haystack, string needle[, bool part]) + Finds first occurrence of a string within another */ +PHP_FUNCTION(strstr) +{ + zval *needle; + char *haystack; + int haystack_len; + char *found = NULL; + char needle_char[2]; + long found_offset; + zend_bool part = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &haystack, &haystack_len, &needle, &part) == FAILURE) { + return; + } + + if (Z_TYPE_P(needle) == IS_STRING) { + if (!Z_STRLEN_P(needle)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter"); + RETURN_FALSE; + } + + found = php_memnstr(haystack, Z_STRVAL_P(needle), Z_STRLEN_P(needle), haystack + haystack_len); + } else { + if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { + RETURN_FALSE; + } + needle_char[1] = 0; + + found = php_memnstr(haystack, needle_char, 1, haystack + haystack_len); + } + + if (found) { + found_offset = found - haystack; + if (part) { + RETURN_STRINGL(haystack, found_offset, 1); + } else { + RETURN_STRINGL(found, haystack_len - found_offset, 1); + } + } + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto string strchr(string haystack, string needle) + An alias for strstr */ +/* }}} */ + +/* {{{ proto int strpos(string haystack, string needle [, int offset]) + Finds position of first occurrence of a string within another */ +PHP_FUNCTION(strpos) +{ + zval *needle; + char *haystack; + char *found = NULL; + char needle_char[2]; + long offset = 0; + int haystack_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) { + return; + } + + if (offset < 0 || offset > haystack_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string"); + RETURN_FALSE; + } + + if (Z_TYPE_P(needle) == IS_STRING) { + if (!Z_STRLEN_P(needle)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); + RETURN_FALSE; + } + + found = php_memnstr(haystack + offset, + Z_STRVAL_P(needle), + Z_STRLEN_P(needle), + haystack + haystack_len); + } else { + if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { + RETURN_FALSE; + } + needle_char[1] = 0; + + found = php_memnstr(haystack + offset, + needle_char, + 1, + haystack + haystack_len); + } + + if (found) { + RETURN_LONG(found - haystack); + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto int stripos(string haystack, string needle [, int offset]) + Finds position of first occurrence of a string within another, case insensitive */ +PHP_FUNCTION(stripos) +{ + char *found = NULL; + char *haystack; + int haystack_len; + long offset = 0; + char *needle_dup = NULL, *haystack_dup; + char needle_char[2]; + zval *needle; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) { + return; + } + + if (offset < 0 || offset > haystack_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string"); + RETURN_FALSE; + } + + if (haystack_len == 0) { + RETURN_FALSE; + } + + haystack_dup = estrndup(haystack, haystack_len); + php_strtolower(haystack_dup, haystack_len); + + if (Z_TYPE_P(needle) == IS_STRING) { + if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > haystack_len) { + efree(haystack_dup); + RETURN_FALSE; + } + + needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); + php_strtolower(needle_dup, Z_STRLEN_P(needle)); + found = php_memnstr(haystack_dup + offset, needle_dup, Z_STRLEN_P(needle), haystack_dup + haystack_len); + } else { + if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { + efree(haystack_dup); + RETURN_FALSE; + } + needle_char[0] = tolower(needle_char[0]); + needle_char[1] = '\0'; + found = php_memnstr(haystack_dup + offset, + needle_char, + sizeof(needle_char) - 1, + haystack_dup + haystack_len); + } + + efree(haystack_dup); + if (needle_dup) { + efree(needle_dup); + } + + if (found) { + RETURN_LONG(found - haystack_dup); + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto int strrpos(string haystack, string needle [, int offset]) + Finds position of last occurrence of a string within another string */ +PHP_FUNCTION(strrpos) +{ + zval *zneedle; + char *needle, *haystack; + int needle_len, haystack_len; + long offset = 0; + char *p, *e, ord_needle[2]; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &zneedle, &offset) == FAILURE) { + RETURN_FALSE; + } + + if (Z_TYPE_P(zneedle) == IS_STRING) { + needle = Z_STRVAL_P(zneedle); + needle_len = Z_STRLEN_P(zneedle); + } else { + if (php_needle_char(zneedle, ord_needle TSRMLS_CC) != SUCCESS) { + RETURN_FALSE; + } + ord_needle[1] = '\0'; + needle = ord_needle; + needle_len = 1; + } + + if ((haystack_len == 0) || (needle_len == 0)) { + RETURN_FALSE; + } + + if (offset >= 0) { + if (offset > haystack_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string"); + RETURN_FALSE; + } + p = haystack + offset; + e = haystack + haystack_len - needle_len; + } else { + if (offset < -INT_MAX || -offset > haystack_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string"); + RETURN_FALSE; + } + + p = haystack; + if (needle_len > -offset) { + e = haystack + haystack_len - needle_len; + } else { + e = haystack + haystack_len + offset; + } + } + + if (needle_len == 1) { + /* Single character search can shortcut memcmps */ + while (e >= p) { + if (*e == *needle) { + RETURN_LONG(e - p + (offset > 0 ? offset : 0)); + } + e--; + } + RETURN_FALSE; + } + + while (e >= p) { + if (memcmp(e, needle, needle_len) == 0) { + RETURN_LONG(e - p + (offset > 0 ? offset : 0)); + } + e--; + } + + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto int strripos(string haystack, string needle [, int offset]) + Finds position of last occurrence of a string within another string */ +PHP_FUNCTION(strripos) +{ + zval *zneedle; + char *needle, *haystack; + int needle_len, haystack_len; + long offset = 0; + char *p, *e, ord_needle[2]; + char *needle_dup, *haystack_dup; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &zneedle, &offset) == FAILURE) { + RETURN_FALSE; + } + + if (Z_TYPE_P(zneedle) == IS_STRING) { + needle = Z_STRVAL_P(zneedle); + needle_len = Z_STRLEN_P(zneedle); + } else { + if (php_needle_char(zneedle, ord_needle TSRMLS_CC) != SUCCESS) { + RETURN_FALSE; + } + ord_needle[1] = '\0'; + needle = ord_needle; + needle_len = 1; + } + + if ((haystack_len == 0) || (needle_len == 0)) { + RETURN_FALSE; + } + + if (needle_len == 1) { + /* Single character search can shortcut memcmps + Can also avoid tolower emallocs */ + if (offset >= 0) { + if (offset > haystack_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string"); + RETURN_FALSE; + } + p = haystack + offset; + e = haystack + haystack_len - 1; + } else { + p = haystack; + if (offset < -INT_MAX || -offset > haystack_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string"); + RETURN_FALSE; + } + e = haystack + haystack_len + offset; + } + /* Borrow that ord_needle buffer to avoid repeatedly tolower()ing needle */ + *ord_needle = tolower(*needle); + while (e >= p) { + if (tolower(*e) == *ord_needle) { + RETURN_LONG(e - p + (offset > 0 ? offset : 0)); + } + e--; + } + RETURN_FALSE; + } + + needle_dup = estrndup(needle, needle_len); + php_strtolower(needle_dup, needle_len); + haystack_dup = estrndup(haystack, haystack_len); + php_strtolower(haystack_dup, haystack_len); + + if (offset >= 0) { + if (offset > haystack_len) { + efree(needle_dup); + efree(haystack_dup); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string"); + RETURN_FALSE; + } + p = haystack_dup + offset; + e = haystack_dup + haystack_len - needle_len; + } else { + if (offset < -INT_MAX || -offset > haystack_len) { + efree(needle_dup); + efree(haystack_dup); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string"); + RETURN_FALSE; + } + p = haystack_dup; + if (needle_len > -offset) { + e = haystack_dup + haystack_len - needle_len; + } else { + e = haystack_dup + haystack_len + offset; + } + } + + while (e >= p) { + if (memcmp(e, needle_dup, needle_len) == 0) { + efree(haystack_dup); + efree(needle_dup); + RETURN_LONG(e - p + (offset > 0 ? offset : 0)); + } + e--; + } + + efree(haystack_dup); + efree(needle_dup); + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto string strrchr(string haystack, string needle) + Finds the last occurrence of a character in a string within another */ +PHP_FUNCTION(strrchr) +{ + zval *needle; + char *haystack; + const char *found = NULL; + long found_offset; + int haystack_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &haystack, &haystack_len, &needle) == FAILURE) { + return; + } + + if (Z_TYPE_P(needle) == IS_STRING) { + found = zend_memrchr(haystack, *Z_STRVAL_P(needle), haystack_len); + } else { + char needle_chr; + if (php_needle_char(needle, &needle_chr TSRMLS_CC) != SUCCESS) { + RETURN_FALSE; + } + + found = zend_memrchr(haystack, needle_chr, haystack_len); + } + + if (found) { + found_offset = found - haystack; + RETURN_STRINGL(found, haystack_len - found_offset, 1); + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ php_chunk_split + */ +static char *php_chunk_split(char *src, int srclen, char *end, int endlen, int chunklen, int *destlen) +{ + char *dest; + char *p, *q; + int chunks; /* complete chunks! */ + int restlen; + int out_len; + + chunks = srclen / chunklen; + restlen = srclen - chunks * chunklen; /* srclen % chunklen */ + + if(chunks > INT_MAX - 1) { + return NULL; + } + out_len = chunks + 1; + if(endlen !=0 && out_len > INT_MAX/endlen) { + return NULL; + } + out_len *= endlen; + if(out_len > INT_MAX - srclen - 1) { + return NULL; + } + out_len += srclen + 1; + + dest = safe_emalloc((int)out_len, sizeof(char), 0); + + for (p = src, q = dest; p < (src + srclen - chunklen + 1); ) { + memcpy(q, p, chunklen); + q += chunklen; + memcpy(q, end, endlen); + q += endlen; + p += chunklen; + } + + if (restlen) { + memcpy(q, p, restlen); + q += restlen; + memcpy(q, end, endlen); + q += endlen; + } + + *q = '\0'; + if (destlen) { + *destlen = q - dest; + } + + return(dest); +} +/* }}} */ + +/* {{{ proto string chunk_split(string str [, int chunklen [, string ending]]) + Returns split line */ +PHP_FUNCTION(chunk_split) +{ + char *str; + char *result; + char *end = "\r\n"; + int endlen = 2; + long chunklen = 76; + int result_len; + int str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, &chunklen, &end, &endlen) == FAILURE) { + return; + } + + if (chunklen <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Chunk length should be greater than zero"); + RETURN_FALSE; + } + + if (chunklen > str_len) { + /* to maintain BC, we must return original string + ending */ + result_len = endlen + str_len; + result = emalloc(result_len + 1); + memcpy(result, str, str_len); + memcpy(result + str_len, end, endlen); + result[result_len] = '\0'; + RETURN_STRINGL(result, result_len, 0); + } + + if (!str_len) { + RETURN_EMPTY_STRING(); + } + + result = php_chunk_split(str, str_len, end, endlen, chunklen, &result_len); + + if (result) { + RETURN_STRINGL(result, result_len, 0); + } else { + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto string substr(string str, int start [, int length]) + Returns part of a string */ +PHP_FUNCTION(substr) +{ + char *str; + long l = 0, f; + int str_len; + int argc = ZEND_NUM_ARGS(); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", &str, &str_len, &f, &l) == FAILURE) { + return; + } + + if (argc > 2) { + if ((l < 0 && -l > str_len)) { + RETURN_FALSE; + } else if (l > str_len) { + l = str_len; + } + } else { + l = str_len; + } + + if (f > str_len) { + RETURN_FALSE; + } else if (f < 0 && -f > str_len) { + f = 0; + } + + if (l < 0 && (l + str_len - f) < 0) { + RETURN_FALSE; + } + + /* if "from" position is negative, count start position from the end + * of the string + */ + if (f < 0) { + f = str_len + f; + if (f < 0) { + f = 0; + } + } + + /* if "length" position is negative, set it to the length + * needed to stop that many chars from the end of the string + */ + if (l < 0) { + l = (str_len - f) + l; + if (l < 0) { + l = 0; + } + } + + if (f >= str_len) { + RETURN_FALSE; + } + + if ((f + l) > str_len) { + l = str_len - f; + } + + RETURN_STRINGL(str + f, l, 1); +} +/* }}} */ + +/* {{{ proto mixed substr_replace(mixed str, mixed repl, mixed start [, mixed length]) + Replaces part of a string with another string */ +PHP_FUNCTION(substr_replace) +{ + zval **str; + zval **from; + zval **len = NULL; + zval **repl; + char *result; + int result_len; + int l = 0; + int f; + int argc = ZEND_NUM_ARGS(); + + HashPosition pos_str, pos_from, pos_repl, pos_len; + zval **tmp_str = NULL, **tmp_from = NULL, **tmp_repl = NULL, **tmp_len= NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ|Z", &str, &repl, &from, &len) == FAILURE) { + return; + } + + if (Z_TYPE_PP(str) != IS_ARRAY) { + if (Z_ISREF_PP(str)) { + SEPARATE_ZVAL(str); + } + convert_to_string_ex(str); + } + if (Z_TYPE_PP(repl) != IS_ARRAY) { + if (Z_ISREF_PP(repl)) { + SEPARATE_ZVAL(repl); + } + convert_to_string_ex(repl); + } + if (Z_TYPE_PP(from) != IS_ARRAY) { + if (Z_ISREF_PP(from)) { + SEPARATE_ZVAL(from); + } + convert_to_long_ex(from); + } + + if (argc > 3) { + SEPARATE_ZVAL(len); + if (Z_TYPE_PP(len) != IS_ARRAY) { + convert_to_long_ex(len); + l = Z_LVAL_PP(len); + } + } else { + if (Z_TYPE_PP(str) != IS_ARRAY) { + l = Z_STRLEN_PP(str); + } + } + + if (Z_TYPE_PP(str) == IS_STRING) { + if ( + (argc == 3 && Z_TYPE_PP(from) == IS_ARRAY) || + (argc == 4 && Z_TYPE_PP(from) != Z_TYPE_PP(len)) + ) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "'from' and 'len' should be of same type - numerical or array "); + RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1); + } + if (argc == 4 && Z_TYPE_PP(from) == IS_ARRAY) { + if (zend_hash_num_elements(Z_ARRVAL_PP(from)) != zend_hash_num_elements(Z_ARRVAL_PP(len))) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "'from' and 'len' should have the same number of elements"); + RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1); + } + } + } + + if (Z_TYPE_PP(str) != IS_ARRAY) { + if (Z_TYPE_PP(from) != IS_ARRAY) { + int repl_len = 0; + + f = Z_LVAL_PP(from); + + /* if "from" position is negative, count start position from the end + * of the string + */ + if (f < 0) { + f = Z_STRLEN_PP(str) + f; + if (f < 0) { + f = 0; + } + } else if (f > Z_STRLEN_PP(str)) { + f = Z_STRLEN_PP(str); + } + /* if "length" position is negative, set it to the length + * needed to stop that many chars from the end of the string + */ + if (l < 0) { + l = (Z_STRLEN_PP(str) - f) + l; + if (l < 0) { + l = 0; + } + } + + if (f > Z_STRLEN_PP(str) || (f < 0 && -f > Z_STRLEN_PP(str))) { + RETURN_FALSE; + } else if (l > Z_STRLEN_PP(str) || (l < 0 && -l > Z_STRLEN_PP(str))) { + l = Z_STRLEN_PP(str); + } + + if ((f + l) > Z_STRLEN_PP(str)) { + l = Z_STRLEN_PP(str) - f; + } + if (Z_TYPE_PP(repl) == IS_ARRAY) { + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(repl), &pos_repl); + if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(repl), (void **) &tmp_repl, &pos_repl)) { + convert_to_string_ex(tmp_repl); + repl_len = Z_STRLEN_PP(tmp_repl); + } + } else { + repl_len = Z_STRLEN_PP(repl); + } + result_len = Z_STRLEN_PP(str) - l + repl_len; + result = emalloc(result_len + 1); + + memcpy(result, Z_STRVAL_PP(str), f); + if (repl_len) { + memcpy((result + f), (Z_TYPE_PP(repl) == IS_ARRAY ? Z_STRVAL_PP(tmp_repl) : Z_STRVAL_PP(repl)), repl_len); + } + memcpy((result + f + repl_len), Z_STRVAL_PP(str) + f + l, Z_STRLEN_PP(str) - f - l); + result[result_len] = '\0'; + RETURN_STRINGL(result, result_len, 0); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Functionality of 'from' and 'len' as arrays is not implemented"); + RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1); + } + } else { /* str is array of strings */ + char *str_index = NULL; + uint str_index_len; + ulong num_index; + + array_init(return_value); + + if (Z_TYPE_PP(from) == IS_ARRAY) { + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(from), &pos_from); + } + + if (argc > 3 && Z_TYPE_PP(len) == IS_ARRAY) { + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(len), &pos_len); + } + + if (Z_TYPE_PP(repl) == IS_ARRAY) { + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(repl), &pos_repl); + } + + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(str), &pos_str); + while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(str), (void **) &tmp_str, &pos_str) == SUCCESS) { + zval *orig_str; + zval dummy; + ulong refcount; + int was_ref; + + if(Z_TYPE_PP(tmp_str) != IS_STRING) { + dummy = **tmp_str; + orig_str = &dummy; + zval_copy_ctor(orig_str); + convert_to_string(orig_str); + } else { + orig_str = *tmp_str; + } + was_ref = Z_ISREF_P(orig_str); + Z_UNSET_ISREF_P(orig_str); + refcount = Z_REFCOUNT_P(orig_str); + + if (Z_TYPE_PP(from) == IS_ARRAY) { + if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(from), (void **) &tmp_from, &pos_from)) { + if(Z_TYPE_PP(tmp_from) != IS_LONG) { + zval dummy = **tmp_from; + zval_copy_ctor(&dummy); + convert_to_long(&dummy); + f = Z_LVAL(dummy); + } else { + f = Z_LVAL_PP(tmp_from); + } + + if (f < 0) { + f = Z_STRLEN_P(orig_str) + f; + if (f < 0) { + f = 0; + } + } else if (f > Z_STRLEN_P(orig_str)) { + f = Z_STRLEN_P(orig_str); + } + zend_hash_move_forward_ex(Z_ARRVAL_PP(from), &pos_from); + } else { + f = 0; + } + } else { + f = Z_LVAL_PP(from); + if (f < 0) { + f = Z_STRLEN_P(orig_str) + f; + if (f < 0) { + f = 0; + } + } else if (f > Z_STRLEN_P(orig_str)) { + f = Z_STRLEN_P(orig_str); + } + } + + if (argc > 3 && Z_TYPE_PP(len) == IS_ARRAY) { + if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(len), (void **) &tmp_len, &pos_len)) { + if(Z_TYPE_PP(tmp_len) != IS_LONG) { + zval dummy = **tmp_len; + zval_copy_ctor(&dummy); + convert_to_long(&dummy); + l = Z_LVAL(dummy); + } else { + l = Z_LVAL_PP(tmp_len); + } + zend_hash_move_forward_ex(Z_ARRVAL_PP(len), &pos_len); + } else { + l = Z_STRLEN_P(orig_str); + } + } else if (argc > 3) { + l = Z_LVAL_PP(len); + } else { + l = Z_STRLEN_P(orig_str); + } + + if (l < 0) { + l = (Z_STRLEN_P(orig_str) - f) + l; + if (l < 0) { + l = 0; + } + } + + if ((f + l) > Z_STRLEN_P(orig_str)) { + l = Z_STRLEN_P(orig_str) - f; + } + + result_len = Z_STRLEN_P(orig_str) - l; + + if (Z_TYPE_PP(repl) == IS_ARRAY) { + if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(repl), (void **) &tmp_repl, &pos_repl)) { + zval *repl_str; + zval zrepl; + if(Z_TYPE_PP(tmp_repl) != IS_STRING) { + zrepl = **tmp_repl; + repl_str = &zrepl; + zval_copy_ctor(repl_str); + convert_to_string(repl_str); + } else { + repl_str = *tmp_repl; + } + + if(Z_REFCOUNT_P(orig_str) != refcount) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument was modified while replacing"); + if(Z_TYPE_PP(tmp_repl) != IS_STRING) { + zval_dtor(repl_str); + } + break; + } + + result_len += Z_STRLEN_P(repl_str); + zend_hash_move_forward_ex(Z_ARRVAL_PP(repl), &pos_repl); + result = emalloc(result_len + 1); + + memcpy(result, Z_STRVAL_P(orig_str), f); + memcpy((result + f), Z_STRVAL_P(repl_str), Z_STRLEN_P(repl_str)); + memcpy((result + f + Z_STRLEN_P(repl_str)), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); + if(Z_TYPE_PP(tmp_repl) != IS_STRING) { + zval_dtor(repl_str); + } + } else { + result = emalloc(result_len + 1); + + memcpy(result, Z_STRVAL_P(orig_str), f); + memcpy((result + f), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); + } + } else { + result_len += Z_STRLEN_PP(repl); + + result = emalloc(result_len + 1); + + memcpy(result, Z_STRVAL_P(orig_str), f); + memcpy((result + f), Z_STRVAL_PP(repl), Z_STRLEN_PP(repl)); + memcpy((result + f + Z_STRLEN_PP(repl)), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); + } + + result[result_len] = '\0'; + + if (zend_hash_get_current_key_ex(Z_ARRVAL_PP(str), &str_index, &str_index_len, &num_index, 0, &pos_str) == HASH_KEY_IS_STRING) { + add_assoc_stringl_ex(return_value, str_index, str_index_len, result, result_len, 0); + } else { + add_index_stringl(return_value, num_index, result, result_len, 0); + } + + if(Z_TYPE_PP(tmp_str) != IS_STRING) { + zval_dtor(orig_str); + } else { + Z_SET_ISREF_TO_P(orig_str, was_ref); + } + zend_hash_move_forward_ex(Z_ARRVAL_PP(str), &pos_str); + } /*while*/ + } /* if */ +} +/* }}} */ + +/* {{{ proto string quotemeta(string str) + Quotes meta characters */ +PHP_FUNCTION(quotemeta) +{ + char *str, *old; + char *old_end; + char *p, *q; + char c; + int old_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &old, &old_len) == FAILURE) { + return; + } + + old_end = old + old_len; + + if (old == old_end) { + RETURN_FALSE; + } + + str = safe_emalloc(2, old_len, 1); + + for (p = old, q = str; p != old_end; p++) { + c = *p; + switch (c) { + case '.': + case '\\': + case '+': + case '*': + case '?': + case '[': + case '^': + case ']': + case '$': + case '(': + case ')': + *q++ = '\\'; + /* break is missing _intentionally_ */ + default: + *q++ = c; + } + } + *q = 0; + + RETURN_STRINGL(erealloc(str, q - str + 1), q - str, 0); +} +/* }}} */ + +/* {{{ proto int ord(string character) + Returns ASCII value of character */ +PHP_FUNCTION(ord) +{ + char *str; + int str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + return; + } + + RETURN_LONG((unsigned char) str[0]); +} +/* }}} */ + +/* {{{ proto string chr(int ascii) + Converts ASCII code to a character */ +PHP_FUNCTION(chr) +{ + long c; + char temp[2]; + + if (ZEND_NUM_ARGS() != 1) { + WRONG_PARAM_COUNT; + } + + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "l", &c) == FAILURE) { + c = 0; + } + + temp[0] = (char)c; + temp[1] = '\0'; + + RETURN_STRINGL(temp, 1, 1); +} +/* }}} */ + +/* {{{ php_ucfirst + Uppercase the first character of the word in a native string */ +static void php_ucfirst(char *str) +{ + register char *r; + r = str; + *r = toupper((unsigned char) *r); +} +/* }}} */ + +/* {{{ proto string ucfirst(string str) + Makes a string's first character uppercase */ +PHP_FUNCTION(ucfirst) +{ + char *str; + int str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + return; + } + + if (!str_len) { + RETURN_EMPTY_STRING(); + } + + ZVAL_STRINGL(return_value, str, str_len, 1); + php_ucfirst(Z_STRVAL_P(return_value)); +} +/* }}} */ + +/* {{{ + Lowercase the first character of the word in a native string */ +static void php_lcfirst(char *str) +{ + register char *r; + r = str; + *r = tolower((unsigned char) *r); +} +/* }}} */ + +/* {{{ proto string lcfirst(string str) + Make a string's first character lowercase */ +PHP_FUNCTION(lcfirst) +{ + char *str; + int str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + return; + } + + if (!str_len) { + RETURN_EMPTY_STRING(); + } + + ZVAL_STRINGL(return_value, str, str_len, 1); + php_lcfirst(Z_STRVAL_P(return_value)); +} +/* }}} */ + +/* {{{ proto string ucwords(string str) + Uppercase the first character of every word in a string */ +PHP_FUNCTION(ucwords) +{ + char *str; + register char *r, *r_end; + int str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + return; + } + + if (!str_len) { + RETURN_EMPTY_STRING(); + } + + ZVAL_STRINGL(return_value, str, str_len, 1); + r = Z_STRVAL_P(return_value); + + *r = toupper((unsigned char) *r); + for (r_end = r + Z_STRLEN_P(return_value) - 1; r < r_end; ) { + if (isspace((int) *(unsigned char *)r++)) { + *r = toupper((unsigned char) *r); + } + } +} +/* }}} */ + +/* {{{ php_strtr + */ +PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen) +{ + int i; + unsigned char xlat[256]; + + if ((trlen < 1) || (len < 1)) { + return str; + } + + for (i = 0; i < 256; xlat[i] = i, i++); + + for (i = 0; i < trlen; i++) { + xlat[(unsigned char) str_from[i]] = str_to[i]; + } + + for (i = 0; i < len; i++) { + str[i] = xlat[(unsigned char) str[i]]; + } + + return str; +} +/* }}} */ + +/* {{{ Definitions for php_strtr_array */ +typedef size_t STRLEN; /* STRLEN should be unsigned */ +typedef uint16_t HASH; +typedef struct { + HASH table_mask; + STRLEN entries[1]; +} SHIFT_TAB; +typedef struct { + HASH table_mask; + int entries[1]; +} HASH_TAB; +typedef struct { + const char *s; + STRLEN l; +} STR; +typedef struct _pat_and_repl { + STR pat; + STR repl; +} PATNREPL; + +#define S(a) ((a)->s) +#define L(a) ((a)->l) + +#define SHIFT_TAB_BITS 13 +#define HASH_TAB_BITS 10 /* should be less than sizeof(HASH) * 8 */ +#define SHIFT_TAB_SIZE (1U << SHIFT_TAB_BITS) +#define HASH_TAB_SIZE (1U << HASH_TAB_BITS) + +typedef struct { + int B; /* size of suffixes */ + int Bp; /* size of prefixes */ + STRLEN m; /* minimum pattern length */ + int patnum; /* number of patterns */ + SHIFT_TAB *shift; /* table mapping hash to allowed shift */ + HASH_TAB *hash; /* table mapping hash to int (pair of pointers) */ + HASH *prefix; /* array of hashes of prefixes by pattern suffix hash order */ + PATNREPL *patterns; /* array of prefixes by pattern suffix hash order */ +} PPRES; +/* }}} */ + +/* {{{ php_strtr_hash */ +static inline HASH php_strtr_hash(const char *str, int len) +{ + HASH res = 0; + int i; + for (i = 0; i < len; i++) { + res = res * 33 + (unsigned char)str[i]; + } + + return res; +} +/* }}} */ +/* {{{ php_strtr_populate_shift */ +static inline void php_strtr_populate_shift(PATNREPL *patterns, int patnum, int B, STRLEN m, SHIFT_TAB *shift) +{ + int i; + STRLEN j, + max_shift; + + max_shift = m - B + 1; + for (i = 0; i < SHIFT_TAB_SIZE; i++) { + shift->entries[i] = max_shift; + } + for (i = 0; i < patnum; i++) { + for (j = 0; j < m - B + 1; j++) { + HASH h = php_strtr_hash(&S(&patterns[i].pat)[j], B) & shift->table_mask; + assert((long long) m - (long long) j - B >= 0); + shift->entries[h] = MIN(shift->entries[h], m - j - B); + } + } +} +/* }}} */ +/* {{{ php_strtr_compare_hash_suffix */ +static int php_strtr_compare_hash_suffix(const void *a, const void *b, void *ctx_g) +{ + const PPRES *res = ctx_g; + const PATNREPL *pnr_a = a, + *pnr_b = b; + HASH hash_a = php_strtr_hash(&S(&pnr_a->pat)[res->m - res->B], res->B) + & res->hash->table_mask, + hash_b = php_strtr_hash(&S(&pnr_b->pat)[res->m - res->B], res->B) + & res->hash->table_mask; + /* TODO: don't recalculate the hashes all the time */ + if (hash_a > hash_b) { + return 1; + } else if (hash_a < hash_b) { + return -1; + } else { + /* longer patterns must be sorted first */ + if (L(&pnr_a->pat) > L(&pnr_b->pat)) { + return -1; + } else if (L(&pnr_a->pat) < L(&pnr_b->pat)) { + return 1; + } else { + return 0; + } + } +} +/* }}} */ +/* {{{ Sorting (no zend_qsort_r in this PHP version) */ +#define HS_LEFT(i) ((i) * 2 + 1) +#define HS_RIGHT(i) ((i) * 2 + 2) +#define HS_PARENT(i) (((i) - 1) / 2); +#define HS_OFF(data, i) ((void *)(&((data)->arr)[i])) +#define HS_CMP_CALL(data, i1, i2) \ + (php_strtr_compare_hash_suffix(HS_OFF((data), (i1)), HS_OFF((data), (i2)), (data)->res)) +struct hs_data { + PATNREPL *arr; + size_t nel; + size_t heapel; + PPRES *res; +}; +static inline void php_strtr_swap(PATNREPL *a, PATNREPL *b) +{ + PATNREPL tmp = *a; + *a = *b; + *b = tmp; +} +static inline void php_strtr_fix_heap(struct hs_data *data, size_t i) +{ + size_t li = HS_LEFT(i), + ri = HS_RIGHT(i), + largei; + if (li < data->heapel && HS_CMP_CALL(data, li, i) > 0) { + largei = li; + } else { + largei = i; + } + if (ri < data->heapel && HS_CMP_CALL(data, ri, largei) > 0) { + largei = ri; + } + if (largei != i) { + php_strtr_swap(HS_OFF(data, i), HS_OFF(data, largei)); + php_strtr_fix_heap(data, largei); + } +} +static inline void php_strtr_build_heap(struct hs_data *data) +{ + size_t i; + for (i = data->nel / 2; i > 0; i--) { + php_strtr_fix_heap(data, i - 1); + } +} +static inline void php_strtr_heapsort(PATNREPL *arr, size_t nel, PPRES *res) +{ + struct hs_data data = { arr, nel, nel, res }; + size_t i; + php_strtr_build_heap(&data); + for (i = nel; i > 1; i--) { + php_strtr_swap(arr, HS_OFF(&data, i - 1)); + data.heapel--; + php_strtr_fix_heap(&data, 0); + } +} +/* }}} */ +/* {{{ php_strtr_free_strp */ +static void php_strtr_free_strp(void *strp) +{ + STR_FREE(*(char**)strp); +} +/* }}} */ +/* {{{ php_strtr_array_prepare_repls */ +static PATNREPL *php_strtr_array_prepare_repls(int slen, HashTable *pats, zend_llist **allocs, int *outsize) +{ + PATNREPL *patterns; + HashPosition hpos; + zval **entry; + int num_pats = zend_hash_num_elements(pats), + i; + + patterns = safe_emalloc(num_pats, sizeof(*patterns), 0); + *allocs = emalloc(sizeof **allocs); + zend_llist_init(*allocs, sizeof(void*), &php_strtr_free_strp, 0); + + for (i = 0, zend_hash_internal_pointer_reset_ex(pats, &hpos); + zend_hash_get_current_data_ex(pats, (void **)&entry, &hpos) == SUCCESS; + zend_hash_move_forward_ex(pats, &hpos)) { + char *string_key; + uint string_key_len; + ulong num_key; + zval *tzv = NULL; + + switch (zend_hash_get_current_key_ex(pats, &string_key, &string_key_len, &num_key, 0, &hpos)) { + case HASH_KEY_IS_LONG: + string_key_len = 1 + zend_spprintf(&string_key, 0, "%ld", (long)num_key); + zend_llist_add_element(*allocs, &string_key); + /* break missing intentionally */ + + case HASH_KEY_IS_STRING: + string_key_len--; /* exclude final '\0' */ + if (string_key_len == 0) { /* empty string given as pattern */ + efree(patterns); + zend_llist_destroy(*allocs); + efree(*allocs); + *allocs = NULL; + return NULL; + } + if (string_key_len > slen) { /* this pattern can never match */ + continue; + } + + if (Z_TYPE_PP(entry) != IS_STRING) { + tzv = *entry; + zval_addref_p(tzv); + SEPARATE_ZVAL(&tzv); + convert_to_string(tzv); + entry = &tzv; + zend_llist_add_element(*allocs, &Z_STRVAL_PP(entry)); + } + + S(&patterns[i].pat) = string_key; + L(&patterns[i].pat) = string_key_len; + S(&patterns[i].repl) = Z_STRVAL_PP(entry); + L(&patterns[i].repl) = Z_STRLEN_PP(entry); + i++; + + if (tzv) { + efree(tzv); + } + } + } + + *outsize = i; + return patterns; +} +/* }}} */ + +/* {{{ PPRES *php_strtr_array_prepare(STR *text, PATNREPL *patterns, int patnum, int B, int Bp) */ +static PPRES *php_strtr_array_prepare(STR *text, PATNREPL *patterns, int patnum, int B, int Bp) +{ + int i; + PPRES *res = emalloc(sizeof *res); + + res->m = (STRLEN)-1; + for (i = 0; i < patnum; i++) { + if (L(&patterns[i].pat) < res->m) { + res->m = L(&patterns[i].pat); + } + } + assert(res->m > 0); + res->B = B = MIN(B, res->m); + res->Bp = Bp = MIN(Bp, res->m); + + res->shift = safe_emalloc(SHIFT_TAB_SIZE, sizeof(*res->shift->entries), sizeof(*res->shift)); + res->shift->table_mask = SHIFT_TAB_SIZE - 1; + php_strtr_populate_shift(patterns, patnum, B, res->m, res->shift); + + res->hash = safe_emalloc(HASH_TAB_SIZE, sizeof(*res->hash->entries), sizeof(*res->hash)); + res->hash->table_mask = HASH_TAB_SIZE - 1; + + res->patterns = safe_emalloc(patnum, sizeof(*res->patterns), 0); + memcpy(res->patterns, patterns, sizeof(*patterns) * patnum); + php_strtr_heapsort(res->patterns, patnum, res); + + res->prefix = safe_emalloc(patnum, sizeof(*res->prefix), 0); + for (i = 0; i < patnum; i++) { + res->prefix[i] = php_strtr_hash(S(&res->patterns[i].pat), Bp); + } + + /* Initialize the rest of ->hash */ + for (i = 0; i < HASH_TAB_SIZE; i++) { + res->hash->entries[i] = -1; + } + { + HASH last_h = -1; /* assumes not all bits are used in res->hash */ + /* res->patterns is already ordered by hash. + * Make res->hash->entries[h] de index of the first pattern in + * res->patterns that has hash h */ + for (i = 0; i < patnum; i++) { + HASH h = php_strtr_hash(&S(&res->patterns[i].pat)[res->m - res->B], res->B) + & res->hash->table_mask; + if (h != last_h) { + res->hash->entries[h] = i; + last_h = h; + } + } + } + res->hash->entries[HASH_TAB_SIZE] = patnum; /* OK, we effectively allocated SIZE+1 */ + for (i = HASH_TAB_SIZE - 1; i >= 0; i--) { + if (res->hash->entries[i] == -1) { + res->hash->entries[i] = res->hash->entries[i + 1]; + } + } + + res->patnum = patnum; + + return res; +} +/* }}} */ +/* {{{ php_strtr_array_destroy_ppres(PPRES *d) */ +static void php_strtr_array_destroy_ppres(PPRES *d) +{ + efree(d->shift); + efree(d->hash); + efree(d->prefix); + efree(d->patterns); + efree(d); +} +/* }}} */ + +/* {{{ php_strtr_array_do_repl(STR *text, PPRES *d, zval *return_value) */ +static void php_strtr_array_do_repl(STR *text, PPRES *d, zval *return_value) +{ + STRLEN pos = 0, + nextwpos = 0, + lastpos = L(text) - d->m; + smart_str result = {0}; + + while (pos <= lastpos) { + HASH h = php_strtr_hash(&S(text)[pos + d->m - d->B], d->B) & d->shift->table_mask; + STRLEN shift = d->shift->entries[h]; + + if (shift > 0) { + pos += shift; + } else { + HASH h2 = h & d->hash->table_mask, + prefix_h = php_strtr_hash(&S(text)[pos], d->Bp); + + int offset_start = d->hash->entries[h2], + offset_end = d->hash->entries[h2 + 1], /* exclusive */ + i = 0; + + for (i = offset_start; i < offset_end; i++) { + PATNREPL *pnr; + if (d->prefix[i] != prefix_h) + continue; + + pnr = &d->patterns[i]; + if (L(&pnr->pat) > L(text) - pos || + memcmp(S(&pnr->pat), &S(text)[pos], L(&pnr->pat)) != 0) + continue; + + smart_str_appendl(&result, &S(text)[nextwpos], pos - nextwpos); + smart_str_appendl(&result, S(&pnr->repl), L(&pnr->repl)); + pos += L(&pnr->pat); + nextwpos = pos; + goto end_outer_loop; + } + + pos++; +end_outer_loop: ; + } + } + + smart_str_appendl(&result, &S(text)[nextwpos], L(text) - nextwpos); + + if (result.c != NULL) { + smart_str_0(&result); + RETVAL_STRINGL(result.c, result.len, 0); + } else { + RETURN_EMPTY_STRING(); + } +} +/* }}} */ + +/* {{{ php_strtr_array */ +static void php_strtr_array(zval *return_value, char *str, int slen, HashTable *pats) +{ + PPRES *data; + STR text; + PATNREPL *patterns; + int patterns_len; + zend_llist *allocs; + + S(&text) = str; + L(&text) = slen; + + patterns = php_strtr_array_prepare_repls(slen, pats, &allocs, &patterns_len); + if (patterns == NULL) { + RETURN_FALSE; + } + data = php_strtr_array_prepare(&text, patterns, patterns_len, 2, 2); + efree(patterns); + php_strtr_array_do_repl(&text, data, return_value); + php_strtr_array_destroy_ppres(data); + zend_llist_destroy(allocs); + efree(allocs); +} +/* }}} */ + +/* {{{ proto string strtr(string str, string from[, string to]) + Translates characters in str using given translation tables */ +PHP_FUNCTION(strtr) +{ + zval **from; + char *str, *to = NULL; + int str_len, to_len = 0; + int ac = ZEND_NUM_ARGS(); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sZ|s", &str, &str_len, &from, &to, &to_len) == FAILURE) { + return; + } + + if (ac == 2 && Z_TYPE_PP(from) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second argument is not an array"); + RETURN_FALSE; + } + + /* shortcut for empty string */ + if (str_len == 0) { + RETURN_EMPTY_STRING(); + } + + if (ac == 2) { + php_strtr_array(return_value, str, str_len, HASH_OF(*from)); + } else { + convert_to_string_ex(from); + + ZVAL_STRINGL(return_value, str, str_len, 1); + + php_strtr(Z_STRVAL_P(return_value), + Z_STRLEN_P(return_value), + Z_STRVAL_PP(from), + to, + MIN(Z_STRLEN_PP(from), + to_len)); + } +} +/* }}} */ + +/* {{{ proto string strrev(string str) + Reverse a string */ +PHP_FUNCTION(strrev) +{ + char *str; + char *e, *n, *p; + int str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + return; + } + + n = emalloc(str_len+1); + p = n; + + e = str + str_len; + + while (--e>=str) { + *p++ = *e; + } + + *p = '\0'; + + RETVAL_STRINGL(n, str_len, 0); +} +/* }}} */ + +/* {{{ php_similar_str + */ +static void php_similar_str(const char *txt1, int len1, const char *txt2, int len2, int *pos1, int *pos2, int *max) +{ + char *p, *q; + char *end1 = (char *) txt1 + len1; + char *end2 = (char *) txt2 + len2; + int l; + + *max = 0; + for (p = (char *) txt1; p < end1; p++) { + for (q = (char *) txt2; q < end2; q++) { + for (l = 0; (p + l < end1) && (q + l < end2) && (p[l] == q[l]); l++); + if (l > *max) { + *max = l; + *pos1 = p - txt1; + *pos2 = q - txt2; + } + } + } +} +/* }}} */ + +/* {{{ php_similar_char + */ +static int php_similar_char(const char *txt1, int len1, const char *txt2, int len2) +{ + int sum; + int pos1, pos2, max; + + php_similar_str(txt1, len1, txt2, len2, &pos1, &pos2, &max); + if ((sum = max)) { + if (pos1 && pos2) { + sum += php_similar_char(txt1, pos1, + txt2, pos2); + } + if ((pos1 + max < len1) && (pos2 + max < len2)) { + sum += php_similar_char(txt1 + pos1 + max, len1 - pos1 - max, + txt2 + pos2 + max, len2 - pos2 - max); + } + } + + return sum; +} +/* }}} */ + +/* {{{ proto int similar_text(string str1, string str2 [, float percent]) + Calculates the similarity between two strings */ +PHP_FUNCTION(similar_text) +{ + char *t1, *t2; + zval **percent = NULL; + int ac = ZEND_NUM_ARGS(); + int sim; + int t1_len, t2_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|Z", &t1, &t1_len, &t2, &t2_len, &percent) == FAILURE) { + return; + } + + if (ac > 2) { + convert_to_double_ex(percent); + } + + if (t1_len + t2_len == 0) { + if (ac > 2) { + Z_DVAL_PP(percent) = 0; + } + + RETURN_LONG(0); + } + + sim = php_similar_char(t1, t1_len, t2, t2_len); + + if (ac > 2) { + Z_DVAL_PP(percent) = sim * 200.0 / (t1_len + t2_len); + } + + RETURN_LONG(sim); +} +/* }}} */ + +/* {{{ php_stripslashes + * + * be careful, this edits the string in-place */ +PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC) +{ + char *s, *t; + int l; + + if (len != NULL) { + l = *len; + } else { + l = strlen(str); + } + s = str; + t = str; + + while (l > 0) { + if (*t == '\\') { + t++; /* skip the slash */ + if (len != NULL) { + (*len)--; + } + l--; + if (l > 0) { + if (*t == '0') { + *s++='\0'; + t++; + } else { + *s++ = *t++; /* preserve the next character */ + } + l--; + } + } else { + *s++ = *t++; + l--; + } + } + if (s != t) { + *s = '\0'; + } +} +/* }}} */ + +/* {{{ proto string addcslashes(string str, string charlist) + Escapes all chars mentioned in charlist with backslash. It creates octal representations if asked to backslash characters with 8th bit set or with ASCII<32 (except '\n', '\r', '\t' etc...) */ +PHP_FUNCTION(addcslashes) +{ + char *str, *what; + int str_len, what_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &str, &str_len, &what, &what_len) == FAILURE) { + return; + } + + if (str_len == 0) { + RETURN_EMPTY_STRING(); + } + + if (what_len == 0) { + RETURN_STRINGL(str, str_len, 1); + } + + Z_STRVAL_P(return_value) = php_addcslashes(str, str_len, &Z_STRLEN_P(return_value), 0, what, what_len TSRMLS_CC); + RETURN_STRINGL(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), 0); +} +/* }}} */ + +/* {{{ proto string addslashes(string str) + Escapes single quote, double quotes and backslash characters in a string with backslashes */ +PHP_FUNCTION(addslashes) +{ + char *str; + int str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + return; + } + + if (str_len == 0) { + RETURN_EMPTY_STRING(); + } + + RETURN_STRING(php_addslashes(str, + str_len, + &Z_STRLEN_P(return_value), 0 + TSRMLS_CC), 0); +} +/* }}} */ + +/* {{{ proto string stripcslashes(string str) + Strips backslashes from a string. Uses C-style conventions */ +PHP_FUNCTION(stripcslashes) +{ + char *str; + int str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + return; + } + + ZVAL_STRINGL(return_value, str, str_len, 1); + php_stripcslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value)); +} +/* }}} */ + +/* {{{ proto string stripslashes(string str) + Strips backslashes from a string */ +PHP_FUNCTION(stripslashes) +{ + char *str; + int str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + return; + } + + ZVAL_STRINGL(return_value, str, str_len, 1); + php_stripslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value) TSRMLS_CC); +} +/* }}} */ + +#ifndef HAVE_STRERROR +/* {{{ php_strerror + */ +char *php_strerror(int errnum) +{ + extern int sys_nerr; + extern char *sys_errlist[]; + TSRMLS_FETCH(); + + if ((unsigned int) errnum < sys_nerr) { + return(sys_errlist[errnum]); + } + + (void) snprintf(BG(str_ebuf), sizeof(php_basic_globals.str_ebuf), "Unknown error: %d", errnum); + return(BG(str_ebuf)); +} +/* }}} */ +#endif + +/* {{{ php_stripcslashes + */ +PHPAPI void php_stripcslashes(char *str, int *len) +{ + char *source, *target, *end; + int nlen = *len, i; + char numtmp[4]; + + for (source=str, end=str+nlen, target=str; source < end; source++) { + if (*source == '\\' && source+1 < end) { + source++; + switch (*source) { + case 'n': *target++='\n'; nlen--; break; + case 'r': *target++='\r'; nlen--; break; + case 'a': *target++='\a'; nlen--; break; + case 't': *target++='\t'; nlen--; break; + case 'v': *target++='\v'; nlen--; break; + case 'b': *target++='\b'; nlen--; break; + case 'f': *target++='\f'; nlen--; break; + case '\\': *target++='\\'; nlen--; break; + case 'x': + if (source+1 < end && isxdigit((int)(*(source+1)))) { + numtmp[0] = *++source; + if (source+1 < end && isxdigit((int)(*(source+1)))) { + numtmp[1] = *++source; + numtmp[2] = '\0'; + nlen-=3; + } else { + numtmp[1] = '\0'; + nlen-=2; + } + *target++=(char)strtol(numtmp, NULL, 16); + break; + } + /* break is left intentionally */ + default: + i=0; + while (source < end && *source >= '0' && *source <= '7' && i<3) { + numtmp[i++] = *source++; + } + if (i) { + numtmp[i]='\0'; + *target++=(char)strtol(numtmp, NULL, 8); + nlen-=i; + source--; + } else { + *target++=*source; + nlen--; + } + } + } else { + *target++=*source; + } + } + + if (nlen != 0) { + *target='\0'; + } + + *len = nlen; +} +/* }}} */ + +/* {{{ php_addcslashes + */ +PHPAPI char *php_addcslashes(const char *str, int length, int *new_length, int should_free, char *what, int wlength TSRMLS_DC) +{ + char flags[256]; + char *new_str = safe_emalloc(4, (length?length:(length=strlen(str))), 1); + char *source, *target; + char *end; + char c; + int newlen; + + if (!wlength) { + wlength = strlen(what); + } + + php_charmask((unsigned char *)what, wlength, flags TSRMLS_CC); + + for (source = (char*)str, end = source + length, target = new_str; source < end; source++) { + c = *source; + if (flags[(unsigned char)c]) { + if ((unsigned char) c < 32 || (unsigned char) c > 126) { + *target++ = '\\'; + switch (c) { + case '\n': *target++ = 'n'; break; + case '\t': *target++ = 't'; break; + case '\r': *target++ = 'r'; break; + case '\a': *target++ = 'a'; break; + case '\v': *target++ = 'v'; break; + case '\b': *target++ = 'b'; break; + case '\f': *target++ = 'f'; break; + default: target += sprintf(target, "%03o", (unsigned char) c); + } + continue; + } + *target++ = '\\'; + } + *target++ = c; + } + *target = 0; + newlen = target - new_str; + if (target - new_str < length * 4) { + new_str = erealloc(new_str, newlen + 1); + } + if (new_length) { + *new_length = newlen; + } + if (should_free) { + STR_FREE((char*)str); + } + return new_str; +} +/* }}} */ + +/* {{{ php_addslashes + */ +PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_free TSRMLS_DC) +{ + /* maximum string length, worst case situation */ + char *new_str; + char *source, *target; + char *end; + int local_new_length; + + if (!new_length) { + new_length = &local_new_length; + } + if (!str) { + *new_length = 0; + return str; + } + new_str = (char *) safe_emalloc(2, (length ? length : (length = strlen(str))), 1); + source = str; + end = source + length; + target = new_str; + + while (source < end) { + switch (*source) { + case '\0': + *target++ = '\\'; + *target++ = '0'; + break; + case '\'': + case '\"': + case '\\': + *target++ = '\\'; + /* break is missing *intentionally* */ + default: + *target++ = *source; + break; + } + + source++; + } + + *target = 0; + *new_length = target - new_str; + if (should_free) { + STR_FREE(str); + } + new_str = (char *) erealloc(new_str, *new_length + 1); + return new_str; +} +/* }}} */ + +#define _HEB_BLOCK_TYPE_ENG 1 +#define _HEB_BLOCK_TYPE_HEB 2 +#define isheb(c) (((((unsigned char) c) >= 224) && (((unsigned char) c) <= 250)) ? 1 : 0) +#define _isblank(c) (((((unsigned char) c) == ' ' || ((unsigned char) c) == '\t')) ? 1 : 0) +#define _isnewline(c) (((((unsigned char) c) == '\n' || ((unsigned char) c) == '\r')) ? 1 : 0) + +/* {{{ php_char_to_str_ex + */ +PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_len, zval *result, int case_sensitivity, int *replace_count) +{ + int char_count = 0; + int replaced = 0; + char *source, *target, *tmp, *source_end=str+len, *tmp_end = NULL; + + if (case_sensitivity) { + char *p = str, *e = p + len; + while ((p = memchr(p, from, (e - p)))) { + char_count++; + p++; + } + } else { + for (source = str; source < source_end; source++) { + if (tolower(*source) == tolower(from)) { + char_count++; + } + } + } + + if (char_count == 0 && case_sensitivity) { + ZVAL_STRINGL(result, str, len, 1); + return 0; + } + + Z_STRLEN_P(result) = len + (char_count * (to_len - 1)); + Z_STRVAL_P(result) = target = safe_emalloc(char_count, to_len, len + 1); + Z_TYPE_P(result) = IS_STRING; + + if (case_sensitivity) { + char *p = str, *e = p + len, *s = str; + while ((p = memchr(p, from, (e - p)))) { + memcpy(target, s, (p - s)); + target += p - s; + memcpy(target, to, to_len); + target += to_len; + p++; + s = p; + if (replace_count) { + *replace_count += 1; + } + } + if (s < e) { + memcpy(target, s, (e - s)); + target += e - s; + } + } else { + for (source = str; source < source_end; source++) { + if (tolower(*source) == tolower(from)) { + replaced = 1; + if (replace_count) { + *replace_count += 1; + } + for (tmp = to, tmp_end = tmp+to_len; tmp < tmp_end; tmp++) { + *target = *tmp; + target++; + } + } else { + *target = *source; + target++; + } + } + } + *target = 0; + return replaced; +} +/* }}} */ + +/* {{{ php_char_to_str + */ +PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, zval *result) +{ + return php_char_to_str_ex(str, len, from, to, to_len, result, 1, NULL); +} +/* }}} */ + +/* {{{ php_str_to_str_ex + */ +PHPAPI char *php_str_to_str_ex(char *haystack, int length, + char *needle, int needle_len, char *str, int str_len, int *_new_length, int case_sensitivity, int *replace_count) +{ + char *new_str; + + if (needle_len < length) { + char *end, *haystack_dup = NULL, *needle_dup = NULL; + char *e, *s, *p, *r; + + if (needle_len == str_len) { + new_str = estrndup(haystack, length); + *_new_length = length; + + if (case_sensitivity) { + end = new_str + length; + for (p = new_str; (r = php_memnstr(p, needle, needle_len, end)); p = r + needle_len) { + memcpy(r, str, str_len); + if (replace_count) { + (*replace_count)++; + } + } + } else { + haystack_dup = estrndup(haystack, length); + needle_dup = estrndup(needle, needle_len); + php_strtolower(haystack_dup, length); + php_strtolower(needle_dup, needle_len); + end = haystack_dup + length; + for (p = haystack_dup; (r = php_memnstr(p, needle_dup, needle_len, end)); p = r + needle_len) { + memcpy(new_str + (r - haystack_dup), str, str_len); + if (replace_count) { + (*replace_count)++; + } + } + efree(haystack_dup); + efree(needle_dup); + } + return new_str; + } else { + if (!case_sensitivity) { + haystack_dup = estrndup(haystack, length); + needle_dup = estrndup(needle, needle_len); + php_strtolower(haystack_dup, length); + php_strtolower(needle_dup, needle_len); + } + + if (str_len < needle_len) { + new_str = emalloc(length + 1); + } else { + int count = 0; + char *o, *n, *endp; + + if (case_sensitivity) { + o = haystack; + n = needle; + } else { + o = haystack_dup; + n = needle_dup; + } + endp = o + length; + + while ((o = php_memnstr(o, n, needle_len, endp))) { + o += needle_len; + count++; + } + if (count == 0) { + /* Needle doesn't occur, shortcircuit the actual replacement. */ + if (haystack_dup) { + efree(haystack_dup); + } + if (needle_dup) { + efree(needle_dup); + } + new_str = estrndup(haystack, length); + if (_new_length) { + *_new_length = length; + } + return new_str; + } else { + new_str = safe_emalloc(count, str_len - needle_len, length + 1); + } + } + + e = s = new_str; + + if (case_sensitivity) { + end = haystack + length; + for (p = haystack; (r = php_memnstr(p, needle, needle_len, end)); p = r + needle_len) { + memcpy(e, p, r - p); + e += r - p; + memcpy(e, str, str_len); + e += str_len; + if (replace_count) { + (*replace_count)++; + } + } + + if (p < end) { + memcpy(e, p, end - p); + e += end - p; + } + } else { + end = haystack_dup + length; + + for (p = haystack_dup; (r = php_memnstr(p, needle_dup, needle_len, end)); p = r + needle_len) { + memcpy(e, haystack + (p - haystack_dup), r - p); + e += r - p; + memcpy(e, str, str_len); + e += str_len; + if (replace_count) { + (*replace_count)++; + } + } + + if (p < end) { + memcpy(e, haystack + (p - haystack_dup), end - p); + e += end - p; + } + } + + if (haystack_dup) { + efree(haystack_dup); + } + if (needle_dup) { + efree(needle_dup); + } + + *e = '\0'; + *_new_length = e - s; + + new_str = erealloc(new_str, *_new_length + 1); + return new_str; + } + } else if (needle_len > length) { +nothing_todo: + *_new_length = length; + new_str = estrndup(haystack, length); + return new_str; + } else { + if (case_sensitivity && memcmp(haystack, needle, length)) { + goto nothing_todo; + } else if (!case_sensitivity) { + char *l_haystack, *l_needle; + + l_haystack = estrndup(haystack, length); + l_needle = estrndup(needle, length); + + php_strtolower(l_haystack, length); + php_strtolower(l_needle, length); + + if (memcmp(l_haystack, l_needle, length)) { + efree(l_haystack); + efree(l_needle); + goto nothing_todo; + } + efree(l_haystack); + efree(l_needle); + } + + *_new_length = str_len; + new_str = estrndup(str, str_len); + + if (replace_count) { + (*replace_count)++; + } + return new_str; + } + +} +/* }}} */ + +/* {{{ php_str_to_str + */ +PHPAPI char *php_str_to_str(char *haystack, int length, + char *needle, int needle_len, char *str, int str_len, int *_new_length) +{ + return php_str_to_str_ex(haystack, length, needle, needle_len, str, str_len, _new_length, 1, NULL); +} +/* }}} */ + +/* {{{ php_str_replace_in_subject + */ +static void php_str_replace_in_subject(zval *search, zval *replace, zval **subject, zval *result, int case_sensitivity, int *replace_count) +{ + zval **search_entry, + **replace_entry = NULL, + temp_result; + char *replace_value = NULL; + int replace_len = 0; + + /* Make sure we're dealing with strings. */ + convert_to_string_ex(subject); + Z_TYPE_P(result) = IS_STRING; + if (Z_STRLEN_PP(subject) == 0) { + ZVAL_STRINGL(result, "", 0, 1); + return; + } + + /* If search is an array */ + if (Z_TYPE_P(search) == IS_ARRAY) { + /* Duplicate subject string for repeated replacement */ + MAKE_COPY_ZVAL(subject, result); + + zend_hash_internal_pointer_reset(Z_ARRVAL_P(search)); + + if (Z_TYPE_P(replace) == IS_ARRAY) { + zend_hash_internal_pointer_reset(Z_ARRVAL_P(replace)); + } else { + /* Set replacement value to the passed one */ + replace_value = Z_STRVAL_P(replace); + replace_len = Z_STRLEN_P(replace); + } + + /* For each entry in the search array, get the entry */ + while (zend_hash_get_current_data(Z_ARRVAL_P(search), (void **) &search_entry) == SUCCESS) { + /* Make sure we're dealing with strings. */ + SEPARATE_ZVAL(search_entry); + convert_to_string(*search_entry); + if (Z_STRLEN_PP(search_entry) == 0) { + zend_hash_move_forward(Z_ARRVAL_P(search)); + if (Z_TYPE_P(replace) == IS_ARRAY) { + zend_hash_move_forward(Z_ARRVAL_P(replace)); + } + continue; + } + + /* If replace is an array. */ + if (Z_TYPE_P(replace) == IS_ARRAY) { + /* Get current entry */ + if (zend_hash_get_current_data(Z_ARRVAL_P(replace), (void **)&replace_entry) == SUCCESS) { + /* Make sure we're dealing with strings. */ + convert_to_string_ex(replace_entry); + + /* Set replacement value to the one we got from array */ + replace_value = Z_STRVAL_PP(replace_entry); + replace_len = Z_STRLEN_PP(replace_entry); + + zend_hash_move_forward(Z_ARRVAL_P(replace)); + } else { + /* We've run out of replacement strings, so use an empty one. */ + replace_value = ""; + replace_len = 0; + } + } + + if (Z_STRLEN_PP(search_entry) == 1) { + php_char_to_str_ex(Z_STRVAL_P(result), + Z_STRLEN_P(result), + Z_STRVAL_PP(search_entry)[0], + replace_value, + replace_len, + &temp_result, + case_sensitivity, + replace_count); + } else if (Z_STRLEN_PP(search_entry) > 1) { + Z_STRVAL(temp_result) = php_str_to_str_ex(Z_STRVAL_P(result), Z_STRLEN_P(result), + Z_STRVAL_PP(search_entry), Z_STRLEN_PP(search_entry), + replace_value, replace_len, &Z_STRLEN(temp_result), case_sensitivity, replace_count); + } + + str_efree(Z_STRVAL_P(result)); + Z_STRVAL_P(result) = Z_STRVAL(temp_result); + Z_STRLEN_P(result) = Z_STRLEN(temp_result); + + if (Z_STRLEN_P(result) == 0) { + return; + } + + zend_hash_move_forward(Z_ARRVAL_P(search)); + } + } else { + if (Z_STRLEN_P(search) == 1) { + php_char_to_str_ex(Z_STRVAL_PP(subject), + Z_STRLEN_PP(subject), + Z_STRVAL_P(search)[0], + Z_STRVAL_P(replace), + Z_STRLEN_P(replace), + result, + case_sensitivity, + replace_count); + } else if (Z_STRLEN_P(search) > 1) { + Z_STRVAL_P(result) = php_str_to_str_ex(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject), + Z_STRVAL_P(search), Z_STRLEN_P(search), + Z_STRVAL_P(replace), Z_STRLEN_P(replace), &Z_STRLEN_P(result), case_sensitivity, replace_count); + } else { + MAKE_COPY_ZVAL(subject, result); + } + } +} +/* }}} */ + +/* {{{ php_str_replace_common + */ +static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensitivity) +{ + zval **subject, **search, **replace, **subject_entry, **zcount = NULL; + zval *result; + char *string_key; + uint string_key_len; + ulong num_key; + int count = 0; + int argc = ZEND_NUM_ARGS(); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ|Z", &search, &replace, &subject, &zcount) == FAILURE) { + return; + } + + SEPARATE_ZVAL(search); + SEPARATE_ZVAL(replace); + SEPARATE_ZVAL(subject); + + /* Make sure we're dealing with strings and do the replacement. */ + if (Z_TYPE_PP(search) != IS_ARRAY) { + convert_to_string_ex(search); + convert_to_string_ex(replace); + } else if (Z_TYPE_PP(replace) != IS_ARRAY) { + convert_to_string_ex(replace); + } + + /* if subject is an array */ + if (Z_TYPE_PP(subject) == IS_ARRAY) { + array_init(return_value); + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(subject)); + + /* For each subject entry, convert it to string, then perform replacement + and add the result to the return_value array. */ + while (zend_hash_get_current_data(Z_ARRVAL_PP(subject), (void **)&subject_entry) == SUCCESS) { + if (Z_TYPE_PP(subject_entry) != IS_ARRAY && Z_TYPE_PP(subject_entry) != IS_OBJECT) { + MAKE_STD_ZVAL(result); + SEPARATE_ZVAL(subject_entry); + php_str_replace_in_subject(*search, *replace, subject_entry, result, case_sensitivity, (argc > 3) ? &count : NULL); + } else { + ALLOC_ZVAL(result); + Z_ADDREF_P(*subject_entry); + COPY_PZVAL_TO_ZVAL(*result, *subject_entry); + } + /* Add to return array */ + switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(subject), &string_key, + &string_key_len, &num_key, 0, NULL)) { + case HASH_KEY_IS_STRING: + add_assoc_zval_ex(return_value, string_key, string_key_len, result); + break; + + case HASH_KEY_IS_LONG: + add_index_zval(return_value, num_key, result); + break; + } + + zend_hash_move_forward(Z_ARRVAL_PP(subject)); + } + } else { /* if subject is not an array */ + php_str_replace_in_subject(*search, *replace, subject, return_value, case_sensitivity, (argc > 3) ? &count : NULL); + } + if (argc > 3) { + zval_dtor(*zcount); + ZVAL_LONG(*zcount, count); + } +} +/* }}} */ + +/* {{{ proto mixed str_replace(mixed search, mixed replace, mixed subject [, int &replace_count]) + Replaces all occurrences of search in haystack with replace */ +PHP_FUNCTION(str_replace) +{ + php_str_replace_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +/* {{{ proto mixed str_ireplace(mixed search, mixed replace, mixed subject [, int &replace_count]) + Replaces all occurrences of search in haystack with replace / case-insensitive */ +PHP_FUNCTION(str_ireplace) +{ + php_str_replace_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* {{{ php_hebrev + * + * Converts Logical Hebrew text (Hebrew Windows style) to Visual text + * Cheers/complaints/flames - Zeev Suraski + */ +static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) +{ + char *str; + char *heb_str, *tmp, *target, *broken_str; + int block_start, block_end, block_type, block_length, i; + long max_chars=0; + int begin, end, char_count, orig_begin; + int str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &max_chars) == FAILURE) { + return; + } + + if (str_len == 0) { + RETURN_FALSE; + } + + tmp = str; + block_start=block_end=0; + + heb_str = (char *) emalloc(str_len+1); + target = heb_str+str_len; + *target = 0; + target--; + + block_length=0; + + if (isheb(*tmp)) { + block_type = _HEB_BLOCK_TYPE_HEB; + } else { + block_type = _HEB_BLOCK_TYPE_ENG; + } + + do { + if (block_type == _HEB_BLOCK_TYPE_HEB) { + while ((isheb((int)*(tmp+1)) || _isblank((int)*(tmp+1)) || ispunct((int)*(tmp+1)) || (int)*(tmp+1)=='\n' ) && block_end': + *target = '<'; + break; + case '\\': + *target = '/'; + break; + case '/': + *target = '\\'; + break; + default: + break; + } + target--; + } + block_type = _HEB_BLOCK_TYPE_ENG; + } else { + while (!isheb(*(tmp+1)) && (int)*(tmp+1)!='\n' && block_end < str_len-1) { + tmp++; + block_end++; + block_length++; + } + while ((_isblank((int)*tmp) || ispunct((int)*tmp)) && *tmp!='/' && *tmp!='-' && block_end > block_start) { + tmp--; + block_end--; + } + for (i = block_end; i >= block_start; i--) { + *target = str[i]; + target--; + } + block_type = _HEB_BLOCK_TYPE_HEB; + } + block_start=block_end+1; + } while (block_end < str_len-1); + + + broken_str = (char *) emalloc(str_len+1); + begin=end=str_len-1; + target = broken_str; + + while (1) { + char_count=0; + while ((!max_chars || char_count < max_chars) && begin > 0) { + char_count++; + begin--; + if (begin <= 0 || _isnewline(heb_str[begin])) { + while (begin > 0 && _isnewline(heb_str[begin-1])) { + begin--; + char_count++; + } + break; + } + } + if (char_count == max_chars) { /* try to avoid breaking words */ + int new_char_count=char_count, new_begin=begin; + + while (new_char_count > 0) { + if (_isblank(heb_str[new_begin]) || _isnewline(heb_str[new_begin])) { + break; + } + new_begin++; + new_char_count--; + } + if (new_char_count > 0) { + begin=new_begin; + } + } + orig_begin=begin; + + if (_isblank(heb_str[begin])) { + heb_str[begin]='\n'; + } + while (begin <= end && _isnewline(heb_str[begin])) { /* skip leading newlines */ + begin++; + } + for (i = begin; i <= end; i++) { /* copy content */ + *target = heb_str[i]; + target++; + } + for (i = orig_begin; i <= end && _isnewline(heb_str[i]); i++) { + *target = heb_str[i]; + target++; + } + begin=orig_begin; + + if (begin <= 0) { + *target = 0; + break; + } + begin--; + end=begin; + } + efree(heb_str); + + if (convert_newlines) { + php_char_to_str(broken_str, str_len,'\n', "
\n", 7, return_value); + efree(broken_str); + } else { + Z_STRVAL_P(return_value) = broken_str; + Z_STRLEN_P(return_value) = str_len; + Z_TYPE_P(return_value) = IS_STRING; + } +} +/* }}} */ + +/* {{{ proto string hebrev(string str [, int max_chars_per_line]) + Converts logical Hebrew text to visual text */ +PHP_FUNCTION(hebrev) +{ + php_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* {{{ proto string hebrevc(string str [, int max_chars_per_line]) + Converts logical Hebrew text to visual text with newline conversion */ +PHP_FUNCTION(hebrevc) +{ + php_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +/* {{{ proto string nl2br(string str [, bool is_xhtml]) + Converts newlines to HTML line breaks */ +PHP_FUNCTION(nl2br) +{ + /* in brief this inserts
or
before matched regexp \n\r?|\r\n? */ + char *tmp, *str; + int new_length; + char *end, *target; + int repl_cnt = 0; + int str_len; + zend_bool is_xhtml = 1; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &str, &str_len, &is_xhtml) == FAILURE) { + return; + } + + tmp = str; + end = str + str_len; + + /* it is really faster to scan twice and allocate mem once instead of scanning once + and constantly reallocing */ + while (tmp < end) { + if (*tmp == '\r') { + if (*(tmp+1) == '\n') { + tmp++; + } + repl_cnt++; + } else if (*tmp == '\n') { + if (*(tmp+1) == '\r') { + tmp++; + } + repl_cnt++; + } + + tmp++; + } + + if (repl_cnt == 0) { + RETURN_STRINGL(str, str_len, 1); + } + + { + size_t repl_len = is_xhtml ? (sizeof("
") - 1) : (sizeof("
") - 1); + + new_length = str_len + repl_cnt * repl_len; + tmp = target = safe_emalloc(repl_cnt, repl_len, str_len + 1); + } + + while (str < end) { + switch (*str) { + case '\r': + case '\n': + *target++ = '<'; + *target++ = 'b'; + *target++ = 'r'; + + if (is_xhtml) { + *target++ = ' '; + *target++ = '/'; + } + + *target++ = '>'; + + if ((*str == '\r' && *(str+1) == '\n') || (*str == '\n' && *(str+1) == '\r')) { + *target++ = *str++; + } + /* lack of a break; is intentional */ + default: + *target++ = *str; + } + + str++; + } + + *target = '\0'; + + RETURN_STRINGL(tmp, new_length, 0); +} +/* }}} */ + +/* {{{ proto string strip_tags(string str [, string allowable_tags]) + Strips HTML and PHP tags from a string */ +PHP_FUNCTION(strip_tags) +{ + char *buf; + char *str; + zval **allow=NULL; + char *allowed_tags=NULL; + int allowed_tags_len=0; + int str_len; + size_t retval_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|Z", &str, &str_len, &allow) == FAILURE) { + return; + } + + /* To maintain a certain BC, we allow anything for the second parameter and return original string */ + if (allow != NULL) { + convert_to_string_ex(allow); + allowed_tags = Z_STRVAL_PP(allow); + allowed_tags_len = Z_STRLEN_PP(allow); + } + + buf = estrndup(str, str_len); + retval_len = php_strip_tags_ex(buf, str_len, NULL, allowed_tags, allowed_tags_len, 0); + RETURN_STRINGL(buf, retval_len, 0); +} +/* }}} */ + +/* {{{ proto string setlocale(mixed category, string locale [, string ...]) + Set locale information */ +PHP_FUNCTION(setlocale) +{ + zval ***args = NULL; + zval **pcategory, **plocale; + int num_args, cat, i = 0; + char *loc, *retval; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z+", &pcategory, &args, &num_args) == FAILURE) { + return; + } + +#ifdef HAVE_SETLOCALE + if (Z_TYPE_PP(pcategory) == IS_LONG) { + convert_to_long_ex(pcategory); + cat = Z_LVAL_PP(pcategory); + } else { + /* FIXME: The following behaviour should be removed. */ + char *category; + + php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "Passing locale category name as string is deprecated. Use the LC_* -constants instead"); + + convert_to_string_ex(pcategory); + category = Z_STRVAL_PP(pcategory); + + if (!strcasecmp("LC_ALL", category)) { + cat = LC_ALL; + } else if (!strcasecmp("LC_COLLATE", category)) { + cat = LC_COLLATE; + } else if (!strcasecmp("LC_CTYPE", category)) { + cat = LC_CTYPE; +#ifdef LC_MESSAGES + } else if (!strcasecmp("LC_MESSAGES", category)) { + cat = LC_MESSAGES; +#endif + } else if (!strcasecmp("LC_MONETARY", category)) { + cat = LC_MONETARY; + } else if (!strcasecmp("LC_NUMERIC", category)) { + cat = LC_NUMERIC; + } else if (!strcasecmp("LC_TIME", category)) { + cat = LC_TIME; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid locale category name %s, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME", category); + + if (args) { + efree(args); + } + RETURN_FALSE; + } + } + + if (Z_TYPE_PP(args[0]) == IS_ARRAY) { + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(args[0])); + } + + while (1) { + if (Z_TYPE_PP(args[0]) == IS_ARRAY) { + if (!zend_hash_num_elements(Z_ARRVAL_PP(args[0]))) { + break; + } + zend_hash_get_current_data(Z_ARRVAL_PP(args[0]), (void **)&plocale); + } else { + plocale = args[i]; + } + + convert_to_string_ex(plocale); + + if (!strcmp ("0", Z_STRVAL_PP(plocale))) { + loc = NULL; + } else { + loc = Z_STRVAL_PP(plocale); + if (Z_STRLEN_PP(plocale) >= 255) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Specified locale name is too long"); + break; + } + } + + retval = php_my_setlocale(cat, loc); + zend_update_current_locale(); + if (retval) { + /* Remember if locale was changed */ + if (loc) { + STR_FREE(BG(locale_string)); + BG(locale_string) = estrdup(retval); + } + + if (args) { + efree(args); + } + RETURN_STRING(retval, 1); + } + + if (Z_TYPE_PP(args[0]) == IS_ARRAY) { + if (zend_hash_move_forward(Z_ARRVAL_PP(args[0])) == FAILURE) break; + } else { + if (++i >= num_args) break; + } + } + +#endif + if (args) { + efree(args); + } + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto void parse_str(string encoded_string [, array result]) + Parses GET/POST/COOKIE data and sets global variables */ +PHP_FUNCTION(parse_str) +{ + char *arg; + zval *arrayArg = NULL; + char *res = NULL; + int arglen; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &arg, &arglen, &arrayArg) == FAILURE) { + return; + } + + res = estrndup(arg, arglen); + + if (arrayArg == NULL) { + zval tmp; + + if (!EG(active_symbol_table)) { + zend_rebuild_symbol_table(TSRMLS_C); + } + Z_ARRVAL(tmp) = EG(active_symbol_table); + sapi_module.treat_data(PARSE_STRING, res, &tmp TSRMLS_CC); + } else { + zval ret; + + array_init(&ret); + sapi_module.treat_data(PARSE_STRING, res, &ret TSRMLS_CC); + /* Clear out the array that was passed in. */ + zval_dtor(arrayArg); + ZVAL_COPY_VALUE(arrayArg, &ret); + } +} +/* }}} */ + +#define PHP_TAG_BUF_SIZE 1023 + +/* {{{ php_tag_find + * + * Check if tag is in a set of tags + * + * states: + * + * 0 start tag + * 1 first non-whitespace char seen + */ +int php_tag_find(char *tag, int len, char *set) { + char c, *n, *t; + int state=0, done=0; + char *norm; + + if (len <= 0) { + return 0; + } + + norm = emalloc(len+1); + + n = norm; + t = tag; + c = tolower(*t); + /* + normalize the tag removing leading and trailing whitespace + and turn any into just and any + into + */ + while (!done) { + switch (c) { + case '<': + *(n++) = c; + break; + case '>': + done =1; + break; + default: + if (!isspace((int)c)) { + if (state == 0) { + state=1; + } + if (c != '/') { + *(n++) = c; + } + } else { + if (state == 1) + done=1; + } + break; + } + c = tolower(*(++t)); + } + *(n++) = '>'; + *n = '\0'; + if (strstr(set, norm)) { + done=1; + } else { + done=0; + } + efree(norm); + return done; +} +/* }}} */ + +PHPAPI size_t php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int allow_len) /* {{{ */ +{ + return php_strip_tags_ex(rbuf, len, stateptr, allow, allow_len, 0); +} +/* }}} */ + +/* {{{ php_strip_tags + + A simple little state-machine to strip out html and php tags + + State 0 is the output state, State 1 means we are inside a + normal html tag and state 2 means we are inside a php tag. + + The state variable is passed in to allow a function like fgetss + to maintain state across calls to the function. + + lc holds the last significant character read and br is a bracket + counter. + + When an allow string is passed in we keep track of the string + in state 1 and when the tag is closed check it against the + allow string to see if we should allow it. + + swm: Added ability to strip = PHP_TAG_BUF_SIZE) { + pos = tp - tbuf; + tbuf = erealloc(tbuf, (tp - tbuf) + PHP_TAG_BUF_SIZE + 1); + tp = tbuf + pos; + } + *(tp++) = '<'; + } + } else if (state == 1) { + depth++; + } + break; + + case '(': + if (state == 2) { + if (lc != '"' && lc != '\'') { + lc = '('; + br++; + } + } else if (allow && state == 1) { + if (tp - tbuf >= PHP_TAG_BUF_SIZE) { + pos = tp - tbuf; + tbuf = erealloc(tbuf, (tp - tbuf) + PHP_TAG_BUF_SIZE + 1); + tp = tbuf + pos; + } + *(tp++) = c; + } else if (state == 0) { + *(rp++) = c; + } + break; + + case ')': + if (state == 2) { + if (lc != '"' && lc != '\'') { + lc = ')'; + br--; + } + } else if (allow && state == 1) { + if (tp - tbuf >= PHP_TAG_BUF_SIZE) { + pos = tp - tbuf; + tbuf = erealloc(tbuf, (tp - tbuf) + PHP_TAG_BUF_SIZE + 1); + tp = tbuf + pos; + } + *(tp++) = c; + } else if (state == 0) { + *(rp++) = c; + } + break; + + case '>': + if (depth) { + depth--; + break; + } + + if (in_q) { + break; + } + + switch (state) { + case 1: /* HTML/XML */ + lc = '>'; + in_q = state = 0; + if (allow) { + if (tp - tbuf >= PHP_TAG_BUF_SIZE) { + pos = tp - tbuf; + tbuf = erealloc(tbuf, (tp - tbuf) + PHP_TAG_BUF_SIZE + 1); + tp = tbuf + pos; + } + *(tp++) = '>'; + *tp='\0'; + if (php_tag_find(tbuf, tp-tbuf, allow)) { + memcpy(rp, tbuf, tp-tbuf); + rp += tp-tbuf; + } + tp = tbuf; + } + break; + + case 2: /* PHP */ + if (!br && lc != '\"' && *(p-1) == '?') { + in_q = state = 0; + tp = tbuf; + } + break; + + case 3: + in_q = state = 0; + tp = tbuf; + break; + + case 4: /* JavaScript/CSS/etc... */ + if (p >= buf + 2 && *(p-1) == '-' && *(p-2) == '-') { + in_q = state = 0; + tp = tbuf; + } + break; + + default: + *(rp++) = c; + break; + } + break; + + case '"': + case '\'': + if (state == 4) { + /* Inside */ + break; + } else if (state == 2 && *(p-1) != '\\') { + if (lc == c) { + lc = '\0'; + } else if (lc != '\\') { + lc = c; + } + } else if (state == 0) { + *(rp++) = c; + } else if (allow && state == 1) { + if (tp - tbuf >= PHP_TAG_BUF_SIZE) { + pos = tp - tbuf; + tbuf = erealloc(tbuf, (tp - tbuf) + PHP_TAG_BUF_SIZE + 1); + tp = tbuf + pos; + } + *(tp++) = c; + } + if (state && p != buf && (state == 1 || *(p-1) != '\\') && (!in_q || *p == in_q)) { + if (in_q) { + in_q = 0; + } else { + in_q = *p; + } + } + break; + + case '!': + /* JavaScript & Other HTML scripting languages */ + if (state == 1 && *(p-1) == '<') { + state = 3; + lc = c; + } else { + if (state == 0) { + *(rp++) = c; + } else if (allow && state == 1) { + if (tp - tbuf >= PHP_TAG_BUF_SIZE) { + pos = tp - tbuf; + tbuf = erealloc(tbuf, (tp - tbuf) + PHP_TAG_BUF_SIZE + 1); + tp = tbuf + pos; + } + *(tp++) = c; + } + } + break; + + case '-': + if (state == 3 && p >= buf + 2 && *(p-1) == '-' && *(p-2) == '!') { + state = 4; + } else { + goto reg_char; + } + break; + + case '?': + + if (state == 1 && *(p-1) == '<') { + br=0; + state=2; + break; + } + + case 'E': + case 'e': + /* !DOCTYPE exception */ + if (state==3 && p > buf+6 + && tolower(*(p-1)) == 'p' + && tolower(*(p-2)) == 'y' + && tolower(*(p-3)) == 't' + && tolower(*(p-4)) == 'c' + && tolower(*(p-5)) == 'o' + && tolower(*(p-6)) == 'd') { + state = 1; + break; + } + /* fall-through */ + + case 'l': + case 'L': + + /* swm: If we encounter ' buf+2 && strncasecmp(p-2, "xm", 2) == 0) { + state = 1; + break; + } + + /* fall-through */ + default: +reg_char: + if (state == 0) { + *(rp++) = c; + } else if (allow && state == 1) { + if (tp - tbuf >= PHP_TAG_BUF_SIZE) { + pos = tp - tbuf; + tbuf = erealloc(tbuf, (tp - tbuf) + PHP_TAG_BUF_SIZE + 1); + tp = tbuf + pos; + } + *(tp++) = c; + } + break; + } + c = *(++p); + i++; + } + if (rp < rbuf + len) { + *rp = '\0'; + } + efree(buf); + if (allow) { + efree(tbuf); + if (allow_free) { + efree(allow_free); + } + } + if (stateptr) + *stateptr = state; + + return (size_t)(rp - rbuf); +} +/* }}} */ + +/* {{{ proto array str_getcsv(string input[, string delimiter[, string enclosure[, string escape]]]) +Parse a CSV string into an array */ +PHP_FUNCTION(str_getcsv) +{ + char *str, delim = ',', enc = '"', esc = '\\'; + char *delim_str = NULL, *enc_str = NULL, *esc_str = NULL; + int str_len = 0, delim_len = 0, enc_len = 0, esc_len = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sss", &str, &str_len, &delim_str, &delim_len, + &enc_str, &enc_len, &esc_str, &esc_len) == FAILURE) { + return; + } + + delim = delim_len ? delim_str[0] : delim; + enc = enc_len ? enc_str[0] : enc; + esc = esc_len ? esc_str[0] : esc; + + php_fgetcsv(NULL, delim, enc, esc, str_len, str, return_value TSRMLS_CC); +} +/* }}} */ + +/* {{{ proto string str_repeat(string input, int mult) + Returns the input string repeat mult times */ +PHP_FUNCTION(str_repeat) +{ + char *input_str; /* Input string */ + int input_len; + long mult; /* Multiplier */ + char *result; /* Resulting string */ + size_t result_len; /* Length of the resulting string */ + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &input_str, &input_len, &mult) == FAILURE) { + return; + } + + if (mult < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument has to be greater than or equal to 0"); + return; + } + + /* Don't waste our time if it's empty */ + /* ... or if the multiplier is zero */ + if (input_len == 0 || mult == 0) + RETURN_EMPTY_STRING(); + + /* Initialize the result string */ + result_len = input_len * mult; + result = (char *)safe_emalloc(input_len, mult, 1); + + /* Heavy optimization for situations where input string is 1 byte long */ + if (input_len == 1) { + memset(result, *(input_str), mult); + } else { + char *s, *e, *ee; + int l=0; + memcpy(result, input_str, input_len); + s = result; + e = result + input_len; + ee = result + result_len; + + while (e 4) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown mode"); + RETURN_FALSE; + } + + buf = (unsigned char *) input; + memset((void*) chars, 0, sizeof(chars)); + + while (len > 0) { + chars[*buf]++; + buf++; + len--; + } + + if (mymode < 3) { + array_init(return_value); + } + + for (inx = 0; inx < 256; inx++) { + switch (mymode) { + case 0: + add_index_long(return_value, inx, chars[inx]); + break; + case 1: + if (chars[inx] != 0) { + add_index_long(return_value, inx, chars[inx]); + } + break; + case 2: + if (chars[inx] == 0) { + add_index_long(return_value, inx, chars[inx]); + } + break; + case 3: + if (chars[inx] != 0) { + retstr[retlen++] = inx; + } + break; + case 4: + if (chars[inx] == 0) { + retstr[retlen++] = inx; + } + break; + } + } + + if (mymode >= 3 && mymode <= 4) { + RETURN_STRINGL(retstr, retlen, 1); + } +} +/* }}} */ + +/* {{{ php_strnatcmp + */ +static void php_strnatcmp(INTERNAL_FUNCTION_PARAMETERS, int fold_case) +{ + char *s1, *s2; + int s1_len, s2_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1_len, &s2, &s2_len) == FAILURE) { + return; + } + + RETURN_LONG(strnatcmp_ex(s1, s1_len, + s2, s2_len, + fold_case)); +} +/* }}} */ + +PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive TSRMLS_DC) /* {{{ */ +{ + zval op1_copy, op2_copy; + int use_copy1 = 0, use_copy2 = 0; + + if (Z_TYPE_P(op1) != IS_STRING) { + zend_make_printable_zval(op1, &op1_copy, &use_copy1); + } + if (Z_TYPE_P(op2) != IS_STRING) { + zend_make_printable_zval(op2, &op2_copy, &use_copy2); + } + + if (use_copy1) { + op1 = &op1_copy; + } + if (use_copy2) { + op2 = &op2_copy; + } + + ZVAL_LONG(result, strnatcmp_ex(Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2), case_insensitive)); + + if (use_copy1) { + zval_dtor(op1); + } + if (use_copy2) { + zval_dtor(op2); + } + return SUCCESS; +} +/* }}} */ + +PHPAPI int string_natural_case_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ +{ + return string_natural_compare_function_ex(result, op1, op2, 1 TSRMLS_CC); +} +/* }}} */ + +PHPAPI int string_natural_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ +{ + return string_natural_compare_function_ex(result, op1, op2, 0 TSRMLS_CC); +} +/* }}} */ + +/* {{{ proto int strnatcmp(string s1, string s2) + Returns the result of string comparison using 'natural' algorithm */ +PHP_FUNCTION(strnatcmp) +{ + php_strnatcmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* {{{ proto array localeconv(void) + Returns numeric formatting information based on the current locale */ +PHP_FUNCTION(localeconv) +{ + zval *grouping, *mon_grouping; + int len, i; + + /* We don't need no stinkin' parameters... */ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + MAKE_STD_ZVAL(grouping); + MAKE_STD_ZVAL(mon_grouping); + + array_init(return_value); + array_init(grouping); + array_init(mon_grouping); + +#ifdef HAVE_LOCALECONV + { + struct lconv currlocdata; + + localeconv_r( &currlocdata ); + + /* Grab the grouping data out of the array */ + len = strlen(currlocdata.grouping); + + for (i = 0; i < len; i++) { + add_index_long(grouping, i, currlocdata.grouping[i]); + } + + /* Grab the monetary grouping data out of the array */ + len = strlen(currlocdata.mon_grouping); + + for (i = 0; i < len; i++) { + add_index_long(mon_grouping, i, currlocdata.mon_grouping[i]); + } + + add_assoc_string(return_value, "decimal_point", currlocdata.decimal_point, 1); + add_assoc_string(return_value, "thousands_sep", currlocdata.thousands_sep, 1); + add_assoc_string(return_value, "int_curr_symbol", currlocdata.int_curr_symbol, 1); + add_assoc_string(return_value, "currency_symbol", currlocdata.currency_symbol, 1); + add_assoc_string(return_value, "mon_decimal_point", currlocdata.mon_decimal_point, 1); + add_assoc_string(return_value, "mon_thousands_sep", currlocdata.mon_thousands_sep, 1); + add_assoc_string(return_value, "positive_sign", currlocdata.positive_sign, 1); + add_assoc_string(return_value, "negative_sign", currlocdata.negative_sign, 1); + add_assoc_long( return_value, "int_frac_digits", currlocdata.int_frac_digits ); + add_assoc_long( return_value, "frac_digits", currlocdata.frac_digits ); + add_assoc_long( return_value, "p_cs_precedes", currlocdata.p_cs_precedes ); + add_assoc_long( return_value, "p_sep_by_space", currlocdata.p_sep_by_space ); + add_assoc_long( return_value, "n_cs_precedes", currlocdata.n_cs_precedes ); + add_assoc_long( return_value, "n_sep_by_space", currlocdata.n_sep_by_space ); + add_assoc_long( return_value, "p_sign_posn", currlocdata.p_sign_posn ); + add_assoc_long( return_value, "n_sign_posn", currlocdata.n_sign_posn ); + } +#else + /* Ok, it doesn't look like we have locale info floating around, so I guess it + wouldn't hurt to just go ahead and return the POSIX locale information? */ + + add_index_long(grouping, 0, -1); + add_index_long(mon_grouping, 0, -1); + + add_assoc_string(return_value, "decimal_point", "\x2E", 1); + add_assoc_string(return_value, "thousands_sep", "", 1); + add_assoc_string(return_value, "int_curr_symbol", "", 1); + add_assoc_string(return_value, "currency_symbol", "", 1); + add_assoc_string(return_value, "mon_decimal_point", "\x2E", 1); + add_assoc_string(return_value, "mon_thousands_sep", "", 1); + add_assoc_string(return_value, "positive_sign", "", 1); + add_assoc_string(return_value, "negative_sign", "", 1); + add_assoc_long( return_value, "int_frac_digits", CHAR_MAX ); + add_assoc_long( return_value, "frac_digits", CHAR_MAX ); + add_assoc_long( return_value, "p_cs_precedes", CHAR_MAX ); + add_assoc_long( return_value, "p_sep_by_space", CHAR_MAX ); + add_assoc_long( return_value, "n_cs_precedes", CHAR_MAX ); + add_assoc_long( return_value, "n_sep_by_space", CHAR_MAX ); + add_assoc_long( return_value, "p_sign_posn", CHAR_MAX ); + add_assoc_long( return_value, "n_sign_posn", CHAR_MAX ); +#endif + + zend_hash_update(Z_ARRVAL_P(return_value), "grouping", 9, &grouping, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(return_value), "mon_grouping", 13, &mon_grouping, sizeof(zval *), NULL); +} +/* }}} */ + +/* {{{ proto int strnatcasecmp(string s1, string s2) + Returns the result of case-insensitive string comparison using 'natural' algorithm */ +PHP_FUNCTION(strnatcasecmp) +{ + php_strnatcmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +/* {{{ proto int substr_count(string haystack, string needle [, int offset [, int length]]) + Returns the number of times a substring occurs in the string */ +PHP_FUNCTION(substr_count) +{ + char *haystack, *needle; + long offset = 0, length = 0; + int ac = ZEND_NUM_ARGS(); + int count = 0; + int haystack_len, needle_len; + char *p, *endp, cmp; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", &haystack, &haystack_len, &needle, &needle_len, &offset, &length) == FAILURE) { + return; + } + + if (needle_len == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty substring"); + RETURN_FALSE; + } + + p = haystack; + endp = p + haystack_len; + + if (offset < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset should be greater than or equal to 0"); + RETURN_FALSE; + } + + if (offset > haystack_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset value %ld exceeds string length", offset); + RETURN_FALSE; + } + p += offset; + + if (ac == 4) { + + if (length <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length should be greater than 0"); + RETURN_FALSE; + } + if (length > (haystack_len - offset)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length value %ld exceeds string length", length); + RETURN_FALSE; + } + endp = p + length; + } + + if (needle_len == 1) { + cmp = needle[0]; + + while ((p = memchr(p, cmp, endp - p))) { + count++; + p++; + } + } else { + while ((p = php_memnstr(p, needle, needle_len, endp))) { + p += needle_len; + count++; + } + } + + RETURN_LONG(count); +} +/* }}} */ + +/* {{{ proto string str_pad(string input, int pad_length [, string pad_string [, int pad_type]]) + Returns input string padded on the left or right to specified length with pad_string */ +PHP_FUNCTION(str_pad) +{ + /* Input arguments */ + char *input; /* Input string */ + int input_len; + long pad_length; /* Length to pad to */ + + /* Helper variables */ + size_t num_pad_chars; /* Number of padding characters (total - input size) */ + char *result = NULL; /* Resulting string */ + int result_len = 0; /* Length of the resulting string */ + char *pad_str_val = " "; /* Pointer to padding string */ + int pad_str_len = 1; /* Length of the padding string */ + long pad_type_val = STR_PAD_RIGHT; /* The padding type value */ + int i, left_pad=0, right_pad=0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|sl", &input, &input_len, &pad_length, + &pad_str_val, &pad_str_len, &pad_type_val) == FAILURE) { + return; + } + + /* If resulting string turns out to be shorter than input string, + we simply copy the input and return. */ + if (pad_length <= 0 || (pad_length - input_len) <= 0) { + RETURN_STRINGL(input, input_len, 1); + } + + if (pad_str_len == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Padding string cannot be empty"); + return; + } + + if (pad_type_val < STR_PAD_LEFT || pad_type_val > STR_PAD_BOTH) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH"); + return; + } + + num_pad_chars = pad_length - input_len; + if (num_pad_chars >= INT_MAX) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Padding length is too long"); + return; + } + result = (char *)emalloc(input_len + num_pad_chars + 1); + + /* We need to figure out the left/right padding lengths. */ + switch (pad_type_val) { + case STR_PAD_RIGHT: + left_pad = 0; + right_pad = num_pad_chars; + break; + + case STR_PAD_LEFT: + left_pad = num_pad_chars; + right_pad = 0; + break; + + case STR_PAD_BOTH: + left_pad = num_pad_chars / 2; + right_pad = num_pad_chars - left_pad; + break; + } + + /* First we pad on the left. */ + for (i = 0; i < left_pad; i++) + result[result_len++] = pad_str_val[i % pad_str_len]; + + /* Then we copy the input string. */ + memcpy(result + result_len, input, input_len); + result_len += input_len; + + /* Finally, we pad on the right. */ + for (i = 0; i < right_pad; i++) + result[result_len++] = pad_str_val[i % pad_str_len]; + + result[result_len] = '\0'; + + RETURN_STRINGL(result, result_len, 0); +} +/* }}} */ + +/* {{{ proto mixed sscanf(string str, string format [, string ...]) + Implements an ANSI C compatible sscanf */ +PHP_FUNCTION(sscanf) +{ + zval ***args = NULL; + char *str, *format; + int str_len, format_len, result, num_args = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss*", &str, &str_len, &format, &format_len, + &args, &num_args) == FAILURE) { + return; + } + + result = php_sscanf_internal(str, format, num_args, args, 0, &return_value TSRMLS_CC); + + if (args) { + efree(args); + } + + if (SCAN_ERROR_WRONG_PARAM_COUNT == result) { + WRONG_PARAM_COUNT; + } +} +/* }}} */ + +static char rot13_from[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; +static char rot13_to[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM"; + +/* {{{ proto string str_rot13(string str) + Perform the rot13 transform on a string */ +PHP_FUNCTION(str_rot13) +{ + char *arg; + int arglen; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arglen) == FAILURE) { + return; + } + + RETVAL_STRINGL(arg, arglen, 1); + + php_strtr(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), rot13_from, rot13_to, 52); +} +/* }}} */ + +static void php_string_shuffle(char *str, long len TSRMLS_DC) /* {{{ */ +{ + long n_elems, rnd_idx, n_left; + char temp; + /* The implementation is stolen from array_data_shuffle */ + /* Thus the characteristics of the randomization are the same */ + n_elems = len; + + if (n_elems <= 1) { + return; + } + + n_left = n_elems; + + while (--n_left) { + rnd_idx = php_rand(TSRMLS_C); + RAND_RANGE(rnd_idx, 0, n_left, PHP_RAND_MAX); + if (rnd_idx != n_left) { + temp = str[n_left]; + str[n_left] = str[rnd_idx]; + str[rnd_idx] = temp; + } + } +} +/* }}} */ + +/* {{{ proto void str_shuffle(string str) + Shuffles string. One permutation of all possible is created */ +PHP_FUNCTION(str_shuffle) +{ + char *arg; + int arglen; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arglen) == FAILURE) { + return; + } + + RETVAL_STRINGL(arg, arglen, 1); + if (Z_STRLEN_P(return_value) > 1) { + php_string_shuffle(Z_STRVAL_P(return_value), (long) Z_STRLEN_P(return_value) TSRMLS_CC); + } +} +/* }}} */ + +/* {{{ proto mixed str_word_count(string str, [int format [, string charlist]]) + Counts the number of words inside a string. If format of 1 is specified, + then the function will return an array containing all the words + found inside the string. If format of 2 is specified, then the function + will return an associated array where the position of the word is the key + and the word itself is the value. + + For the purpose of this function, 'word' is defined as a locale dependent + string containing alphabetic characters, which also may contain, but not start + with "'" and "-" characters. +*/ +PHP_FUNCTION(str_word_count) +{ + char *buf, *str, *char_list = NULL, *p, *e, *s, ch[256]; + int str_len, char_list_len = 0, word_count = 0; + long type = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, &type, &char_list, &char_list_len) == FAILURE) { + return; + } + + switch(type) { + case 1: + case 2: + array_init(return_value); + if (!str_len) { + return; + } + break; + case 0: + if (!str_len) { + RETURN_LONG(0); + } + /* nothing to be done */ + break; + default: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid format value %ld", type); + RETURN_FALSE; + } + + if (char_list) { + php_charmask((unsigned char *)char_list, char_list_len, ch TSRMLS_CC); + } + + p = str; + e = str + str_len; + + /* first character cannot be ' or -, unless explicitly allowed by the user */ + if ((*p == '\'' && (!char_list || !ch['\''])) || (*p == '-' && (!char_list || !ch['-']))) { + p++; + } + /* last character cannot be -, unless explicitly allowed by the user */ + if (*(e - 1) == '-' && (!char_list || !ch['-'])) { + e--; + } + + while (p < e) { + s = p; + while (p < e && (isalpha((unsigned char)*p) || (char_list && ch[(unsigned char)*p]) || *p == '\'' || *p == '-')) { + p++; + } + if (p > s) { + switch (type) + { + case 1: + buf = estrndup(s, (p-s)); + add_next_index_stringl(return_value, buf, (p-s), 0); + break; + case 2: + buf = estrndup(s, (p-s)); + add_index_stringl(return_value, (s - str), buf, p-s, 0); + break; + default: + word_count++; + break; + } + } + p++; + } + + if (!type) { + RETURN_LONG(word_count); + } +} + +/* }}} */ + +#if HAVE_STRFMON +/* {{{ proto string money_format(string format , float value) + Convert monetary value(s) to string */ +PHP_FUNCTION(money_format) +{ + int format_len = 0, str_len; + char *format, *str, *p, *e; + double value; + zend_bool check = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sd", &format, &format_len, &value) == FAILURE) { + return; + } + + p = format; + e = p + format_len; + while ((p = memchr(p, '%', (e - p)))) { + if (*(p + 1) == '%') { + p += 2; + } else if (!check) { + check = 1; + p++; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only a single %%i or %%n token can be used"); + RETURN_FALSE; + } + } + + str_len = format_len + 1024; + str = emalloc(str_len); + if ((str_len = strfmon(str, str_len, format, value)) < 0) { + efree(str); + RETURN_FALSE; + } + str[str_len] = 0; + + RETURN_STRINGL(erealloc(str, str_len + 1), str_len, 0); +} +/* }}} */ +#endif + +/* {{{ proto array str_split(string str [, int split_length]) + Convert a string to an array. If split_length is specified, break the string down into chunks each split_length characters long. */ +PHP_FUNCTION(str_split) +{ + char *str; + int str_len; + long split_length = 1; + char *p; + int n_reg_segments; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &split_length) == FAILURE) { + return; + } + + if (split_length <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length of each segment must be greater than zero"); + RETURN_FALSE; + } + + array_init_size(return_value, ((str_len - 1) / split_length) + 1); + + if (split_length >= str_len) { + add_next_index_stringl(return_value, str, str_len, 1); + return; + } + + n_reg_segments = str_len / split_length; + p = str; + + while (n_reg_segments-- > 0) { + add_next_index_stringl(return_value, p, split_length, 1); + p += split_length; + } + + if (p != (str + str_len)) { + add_next_index_stringl(return_value, p, (str + str_len - p), 1); + } +} +/* }}} */ + +/* {{{ proto array strpbrk(string haystack, string char_list) + Search a string for any of a set of characters */ +PHP_FUNCTION(strpbrk) +{ + char *haystack, *char_list; + int haystack_len, char_list_len; + char *haystack_ptr, *cl_ptr; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &haystack, &haystack_len, &char_list, &char_list_len) == FAILURE) { + RETURN_FALSE; + } + + if (!char_list_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The character list cannot be empty"); + RETURN_FALSE; + } + + for (haystack_ptr = haystack; haystack_ptr < (haystack + haystack_len); ++haystack_ptr) { + for (cl_ptr = char_list; cl_ptr < (char_list + char_list_len); ++cl_ptr) { + if (*cl_ptr == *haystack_ptr) { + RETURN_STRINGL(haystack_ptr, (haystack + haystack_len - haystack_ptr), 1); + } + } + } + + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto int substr_compare(string main_str, string str, int offset [, int length [, bool case_sensitivity]]) + Binary safe optionally case insensitive comparison of 2 strings from an offset, up to length characters */ +PHP_FUNCTION(substr_compare) +{ + char *s1, *s2; + int s1_len, s2_len; + long offset, len=0; + zend_bool cs=0; + uint cmp_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl|lb", &s1, &s1_len, &s2, &s2_len, &offset, &len, &cs) == FAILURE) { + RETURN_FALSE; + } + + if (ZEND_NUM_ARGS() >= 4 && len <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length must be greater than zero"); + RETURN_FALSE; + } + + if (offset < 0) { + offset = s1_len + offset; + offset = (offset < 0) ? 0 : offset; + } + + if (offset >= s1_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The start position cannot exceed initial string length"); + RETURN_FALSE; + } + + cmp_len = (uint) (len ? len : MAX(s2_len, (s1_len - offset))); + + if (!cs) { + RETURN_LONG(zend_binary_strncmp(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); + } else { + RETURN_LONG(zend_binary_strncasecmp(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); + } +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/ext/standard/strnatcmp.c b/ext/standard/strnatcmp.c new file mode 100644 index 0000000..face191 --- /dev/null +++ b/ext/standard/strnatcmp.c @@ -0,0 +1,189 @@ +/* -*- mode: c; c-file-style: "k&r" -*- + + Modified for PHP by Andrei Zmievski + + strnatcmp.c -- Perform 'natural order' comparisons of strings in C. + Copyright (C) 2000 by Martin Pool + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include +#include +#include +#include + +#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 +compare_right(char const **a, char const *aend, char const **b, char const *bend) +{ + int bias = 0; + + /* The longest run of digits wins. That aside, the greatest + value wins, but we can't know that it will until we've scanned + both numbers to know that they have the same magnitude, so we + remember it in BIAS. */ + for(;; (*a)++, (*b)++) { + if ((*a == aend || !isdigit((int)(unsigned char)**a)) && + (*b == bend || !isdigit((int)(unsigned char)**b))) + return bias; + else if (*a == aend || !isdigit((int)(unsigned char)**a)) + return -1; + else if (*b == bend || !isdigit((int)(unsigned char)**b)) + return +1; + else if (**a < **b) { + if (!bias) + bias = -1; + } else if (**a > **b) { + if (!bias) + bias = +1; + } + } + + return 0; +} +/* }}} */ + +/* {{{ compare_left + */ +static int +compare_left(char const **a, char const *aend, char const **b, char const *bend) +{ + /* Compare two left-aligned numbers: the first to have a + different value wins. */ + for(;; (*a)++, (*b)++) { + if ((*a == aend || !isdigit((int)(unsigned char)**a)) && + (*b == bend || !isdigit((int)(unsigned char)**b))) + return 0; + else if (*a == aend || !isdigit((int)(unsigned char)**a)) + return -1; + else if (*b == bend || !isdigit((int)(unsigned char)**b)) + return +1; + else if (**a < **b) + return -1; + else if (**a > **b) + return +1; + } + + return 0; +} +/* }}} */ + +/* {{{ strnatcmp_ex + */ +PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case) +{ + unsigned char ca, cb; + char const *ap, *bp; + char const *aend = a + a_len, + *bend = b + b_len; + int fractional, result; + short leading = 1; + + if (a_len == 0 || b_len == 0) + return a_len - b_len; + + ap = a; + bp = b; + while (1) { + ca = *ap; cb = *bp; + + /* skip over leading zeros */ + while (leading && ca == '0' && (ap+1 < aend) && isdigit(*(ap+1))) { + ca = *++ap; + } + + while (leading && cb == '0' && (bp+1 < bend) && isdigit(*(bp+1))) { + cb = *++bp; + } + + leading = 0; + + /* Skip consecutive whitespace */ + while (isspace((int)(unsigned char)ca)) { + ca = *++ap; + } + + while (isspace((int)(unsigned char)cb)) { + cb = *++bp; + } + + /* process run of digits */ + if (isdigit((int)(unsigned char)ca) && isdigit((int)(unsigned char)cb)) { + fractional = (ca == '0' || cb == '0'); + + if (fractional) + result = compare_left(&ap, aend, &bp, bend); + else + result = compare_right(&ap, aend, &bp, bend); + + if (result != 0) + return result; + else if (ap == aend && bp == bend) + /* End of the strings. Let caller sort them out. */ + return 0; + else { + /* Keep on comparing from the current point. */ + ca = *ap; cb = *bp; + } + } + + if (fold_case) { + ca = toupper((int)(unsigned char)ca); + cb = toupper((int)(unsigned char)cb); + } + + if (ca < cb) + return -1; + else if (ca > cb) + return +1; + + ++ap; ++bp; + if (ap >= aend && bp >= bend) + /* The strings compare the same. Perhaps the caller + will want to call strcmp to break the tie. */ + return 0; + else if (ap >= aend) + return -1; + else if (bp >= bend) + return 1; + } +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c new file mode 100644 index 0000000..ff98ab8 --- /dev/null +++ b/ext/standard/syslog.c @@ -0,0 +1,201 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Stig Sæther Bakken | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#include "php.h" + +#ifdef HAVE_SYSLOG_H +#include "php_ini.h" +#include "zend_globals.h" + +#include +#if HAVE_UNISTD_H +#include +#endif + +#include +#include + +#include +#include "basic_functions.h" +#include "php_ext_syslog.h" + +/* {{{ PHP_MINIT_FUNCTION + */ +PHP_MINIT_FUNCTION(syslog) +{ + /* error levels */ + REGISTER_LONG_CONSTANT("LOG_EMERG", LOG_EMERG, CONST_CS | CONST_PERSISTENT); /* system unusable */ + REGISTER_LONG_CONSTANT("LOG_ALERT", LOG_ALERT, CONST_CS | CONST_PERSISTENT); /* immediate action required */ + REGISTER_LONG_CONSTANT("LOG_CRIT", LOG_CRIT, CONST_CS | CONST_PERSISTENT); /* critical conditions */ + REGISTER_LONG_CONSTANT("LOG_ERR", LOG_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_WARNING", LOG_WARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_NOTICE", LOG_NOTICE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_INFO", LOG_INFO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_DEBUG", LOG_DEBUG, CONST_CS | CONST_PERSISTENT); + /* facility: type of program logging the message */ + REGISTER_LONG_CONSTANT("LOG_KERN", LOG_KERN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_USER", LOG_USER, CONST_CS | CONST_PERSISTENT); /* generic user level */ + REGISTER_LONG_CONSTANT("LOG_MAIL", LOG_MAIL, CONST_CS | CONST_PERSISTENT); /* log to email */ + REGISTER_LONG_CONSTANT("LOG_DAEMON", LOG_DAEMON, CONST_CS | CONST_PERSISTENT); /* other system daemons */ + REGISTER_LONG_CONSTANT("LOG_AUTH", LOG_AUTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_SYSLOG", LOG_SYSLOG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LPR", LOG_LPR, CONST_CS | CONST_PERSISTENT); +#ifdef LOG_NEWS + /* No LOG_NEWS on HP-UX */ + REGISTER_LONG_CONSTANT("LOG_NEWS", LOG_NEWS, CONST_CS | CONST_PERSISTENT); /* usenet new */ +#endif +#ifdef LOG_UUCP + /* No LOG_UUCP on HP-UX */ + REGISTER_LONG_CONSTANT("LOG_UUCP", LOG_UUCP, CONST_CS | CONST_PERSISTENT); +#endif +#ifdef LOG_CRON + /* apparently some systems don't have this one */ + REGISTER_LONG_CONSTANT("LOG_CRON", LOG_CRON, CONST_CS | CONST_PERSISTENT); +#endif +#ifdef LOG_AUTHPRIV + /* AIX doesn't have LOG_AUTHPRIV */ + REGISTER_LONG_CONSTANT("LOG_AUTHPRIV", LOG_AUTHPRIV, CONST_CS | CONST_PERSISTENT); +#endif +#ifndef PHP_WIN32 + REGISTER_LONG_CONSTANT("LOG_LOCAL0", LOG_LOCAL0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL1", LOG_LOCAL1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL2", LOG_LOCAL2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL3", LOG_LOCAL3, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL4", LOG_LOCAL4, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL5", LOG_LOCAL5, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL6", LOG_LOCAL6, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL7", LOG_LOCAL7, CONST_CS | CONST_PERSISTENT); +#endif + /* options */ + REGISTER_LONG_CONSTANT("LOG_PID", LOG_PID, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_CONS", LOG_CONS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_ODELAY", LOG_ODELAY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_NDELAY", LOG_NDELAY, CONST_CS | CONST_PERSISTENT); +#ifdef LOG_NOWAIT + REGISTER_LONG_CONSTANT("LOG_NOWAIT", LOG_NOWAIT, CONST_CS | CONST_PERSISTENT); +#endif +#ifdef LOG_PERROR + /* AIX doesn't have LOG_PERROR */ + REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/ +#endif + BG(syslog_device)=NULL; + + return SUCCESS; +} +/* }}} */ + +PHP_RINIT_FUNCTION(syslog) +{ + BG(syslog_device) = NULL; + return SUCCESS; +} + + +#ifdef PHP_WIN32 +PHP_RSHUTDOWN_FUNCTION(syslog) +{ + closelog(); + return SUCCESS; +} +#endif + +PHP_MSHUTDOWN_FUNCTION(syslog) +{ + if (BG(syslog_device)) { + free(BG(syslog_device)); + BG(syslog_device) = NULL; + } + return SUCCESS; +} + +/* {{{ proto bool openlog(string ident, int option, int facility) + Open connection to system logger */ +/* + ** OpenLog("nettopp", $LOG_PID, $LOG_LOCAL1); + ** Syslog($LOG_EMERG, "help me!") + ** CloseLog(); + */ +PHP_FUNCTION(openlog) +{ + char *ident; + long option, facility; + int ident_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll", &ident, + &ident_len, &option, &facility) == FAILURE) { + return; + } + if (BG(syslog_device)) { + free(BG(syslog_device)); + } + BG(syslog_device) = zend_strndup(ident, ident_len); + if(BG(syslog_device) == NULL) { + RETURN_FALSE; + } + openlog(BG(syslog_device), option, facility); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool closelog(void) + Close connection to system logger */ +PHP_FUNCTION(closelog) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + closelog(); + if (BG(syslog_device)) { + free(BG(syslog_device)); + BG(syslog_device)=NULL; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool syslog(int priority, string message) + Generate a system log message */ +PHP_FUNCTION(syslog) +{ + long priority; + char *message; + int message_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &priority, + &message, &message_len) == FAILURE) { + return; + } + + php_syslog(priority, "%s", message); + RETURN_TRUE; +} +/* }}} */ + +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/tests/array/001.phpt b/ext/standard/tests/array/001.phpt new file mode 100644 index 0000000..797a797 --- /dev/null +++ b/ext/standard/tests/array/001.phpt @@ -0,0 +1,157 @@ +--TEST-- +Test array_merge and array_walk +--INI-- +precision=14 +--FILE-- + +--EXPECT-- +array(11) { + [0]=> + string(3) "PHP" + [1]=> + string(27) "PHP: Hypertext Preprocessor" + [2]=> + string(4) "Test" + ["test"]=> + int(27) + [3]=> + string(4) "test" + [4]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [5]=> + string(6) "monkey" + [6]=> + float(-0.33333333333333) + [7]=> + array(1) { + [0]=> + array(1) { + [0]=> + array(1) { + [0]=> + int(0) + } + } + } + [8]=> + array(1) { + [0]=> + array(1) { + [0]=> + array(1) { + [0]=> + int(0) + } + } + } + [9]=> + array(1) { + [0]=> + array(1) { + [0]=> + array(1) { + [0]=> + int(0) + } + } + } +} + -- Testing array_walk() -- +int(0) +string(3) "PHP" +int(1) +string(27) "PHP: Hypertext Preprocessor" +int(2) +string(4) "Test" +string(4) "test" +int(27) +int(3) +string(4) "test" +int(4) +array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" +} +int(5) +string(6) "monkey" +int(6) +float(-0.33333333333333) +int(7) +array(1) { + [0]=> + array(1) { + [0]=> + array(1) { + [0]=> + int(0) + } + } +} +int(8) +array(1) { + [0]=> + array(1) { + [0]=> + array(1) { + [0]=> + int(0) + } + } +} +int(9) +array(1) { + [0]=> + array(1) { + [0]=> + array(1) { + [0]=> + int(0) + } + } +} diff --git a/ext/standard/tests/array/002.phpt b/ext/standard/tests/array/002.phpt new file mode 100644 index 0000000..469e862 --- /dev/null +++ b/ext/standard/tests/array/002.phpt @@ -0,0 +1,684 @@ +--TEST-- +Test arsort, asort, krsort, ksort, rsort, and sort +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +Unsorted data: +array(8) { + [0]=> + string(3) "PHP" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [5]=> + string(4) "Test" + ["test"]=> + int(27) + [1000]=> + string(4) "test" + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [1001]=> + string(6) "monkey" + [16777216]=> + float(-0.33333333333333) +} + + -- Testing arsort() -- +No second argument: +array(8) { + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + ["test"]=> + int(27) + [1000]=> + string(4) "test" + [1001]=> + string(6) "monkey" + [5]=> + string(4) "Test" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [0]=> + string(3) "PHP" + [16777216]=> + float(-0.33333333333333) +} +Using SORT_REGULAR: +array(8) { + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + ["test"]=> + int(27) + [1000]=> + string(4) "test" + [1001]=> + string(6) "monkey" + [5]=> + string(4) "Test" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [0]=> + string(3) "PHP" + [16777216]=> + float(-0.33333333333333) +} +Using SORT_NUMERIC: +array(8) { + ["test"]=> + int(27) + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [0]=> + string(3) "PHP" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [1001]=> + string(6) "monkey" + [5]=> + string(4) "Test" + [1000]=> + string(4) "test" + [16777216]=> + float(-0.33333333333333) +} +Using SORT_STRING + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d +array(8) { + [1000]=> + string(4) "test" + [1001]=> + string(6) "monkey" + [5]=> + string(4) "Test" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [0]=> + string(3) "PHP" + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + ["test"]=> + int(27) + [16777216]=> + float(-0.33333333333333) +} + + -- Testing asort() -- +No second argument: +array(8) { + [16777216]=> + float(-0.33333333333333) + [0]=> + string(3) "PHP" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [5]=> + string(4) "Test" + [1001]=> + string(6) "monkey" + [1000]=> + string(4) "test" + ["test"]=> + int(27) + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } +} +Using SORT_REGULAR: +array(8) { + [16777216]=> + float(-0.33333333333333) + [0]=> + string(3) "PHP" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [5]=> + string(4) "Test" + [1001]=> + string(6) "monkey" + [1000]=> + string(4) "test" + ["test"]=> + int(27) + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } +} +Using SORT_NUMERIC: +array(8) { + [16777216]=> + float(-0.33333333333333) + [1001]=> + string(6) "monkey" + [1000]=> + string(4) "test" + [5]=> + string(4) "Test" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [0]=> + string(3) "PHP" + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + ["test"]=> + int(27) +} +Using SORT_STRING + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d +array(8) { + [16777216]=> + float(-0.33333333333333) + ["test"]=> + int(27) + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [0]=> + string(3) "PHP" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [5]=> + string(4) "Test" + [1001]=> + string(6) "monkey" + [1000]=> + string(4) "test" +} + + -- Testing krsort() -- +No second argument: +array(8) { + [16777216]=> + float(-0.33333333333333) + [1001]=> + string(6) "monkey" + [1000]=> + string(4) "test" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [5]=> + string(4) "Test" + ["test"]=> + int(27) + [0]=> + string(3) "PHP" + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } +} +Using SORT_REGULAR: +array(8) { + [16777216]=> + float(-0.33333333333333) + [1001]=> + string(6) "monkey" + [1000]=> + string(4) "test" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [5]=> + string(4) "Test" + [0]=> + string(3) "PHP" + ["test"]=> + int(27) + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } +} +Using SORT_NUMERIC: +array(8) { + [16777216]=> + float(-0.33333333333333) + [1001]=> + string(6) "monkey" + [1000]=> + string(4) "test" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [5]=> + string(4) "Test" + ["test"]=> + int(27) + [0]=> + string(3) "PHP" + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } +} +Using SORT_STRING +array(8) { + ["test"]=> + int(27) + [5]=> + string(4) "Test" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [16777216]=> + float(-0.33333333333333) + [1001]=> + string(6) "monkey" + [1000]=> + string(4) "test" + [0]=> + string(3) "PHP" + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } +} + + -- Testing ksort() -- +No second argument: +array(8) { + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [0]=> + string(3) "PHP" + ["test"]=> + int(27) + [5]=> + string(4) "Test" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [1000]=> + string(4) "test" + [1001]=> + string(6) "monkey" + [16777216]=> + float(-0.33333333333333) +} +Using SORT_REGULAR: +array(8) { + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + ["test"]=> + int(27) + [0]=> + string(3) "PHP" + [5]=> + string(4) "Test" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [1000]=> + string(4) "test" + [1001]=> + string(6) "monkey" + [16777216]=> + float(-0.33333333333333) +} +Using SORT_NUMERIC: +array(8) { + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [0]=> + string(3) "PHP" + ["test"]=> + int(27) + [5]=> + string(4) "Test" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [1000]=> + string(4) "test" + [1001]=> + string(6) "monkey" + [16777216]=> + float(-0.33333333333333) +} +Using SORT_STRING +array(8) { + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [0]=> + string(3) "PHP" + [1000]=> + string(4) "test" + [1001]=> + string(6) "monkey" + [16777216]=> + float(-0.33333333333333) + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [5]=> + string(4) "Test" + ["test"]=> + int(27) +} + + -- Testing rsort() -- +No second argument: +array(8) { + [0]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [1]=> + int(27) + [2]=> + string(4) "test" + [3]=> + string(6) "monkey" + [4]=> + string(4) "Test" + [5]=> + string(27) "PHP: Hypertext Preprocessor" + [6]=> + string(3) "PHP" + [7]=> + float(-0.33333333333333) +} +Using SORT_REGULAR: +array(8) { + [0]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [1]=> + int(27) + [2]=> + string(4) "test" + [3]=> + string(6) "monkey" + [4]=> + string(4) "Test" + [5]=> + string(27) "PHP: Hypertext Preprocessor" + [6]=> + string(3) "PHP" + [7]=> + float(-0.33333333333333) +} +Using SORT_NUMERIC: +array(8) { + [0]=> + int(27) + [1]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [2]=> + string(3) "PHP" + [3]=> + string(27) "PHP: Hypertext Preprocessor" + [4]=> + string(6) "monkey" + [5]=> + string(4) "Test" + [6]=> + string(4) "test" + [7]=> + float(-0.33333333333333) +} +Using SORT_STRING + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d +array(8) { + [0]=> + string(4) "test" + [1]=> + string(6) "monkey" + [2]=> + string(4) "Test" + [3]=> + string(27) "PHP: Hypertext Preprocessor" + [4]=> + string(3) "PHP" + [5]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [6]=> + int(27) + [7]=> + float(-0.33333333333333) +} + + -- Testing sort() -- +No second argument: +array(8) { + [0]=> + float(-0.33333333333333) + [1]=> + string(3) "PHP" + [2]=> + string(27) "PHP: Hypertext Preprocessor" + [3]=> + string(4) "Test" + [4]=> + string(6) "monkey" + [5]=> + string(4) "test" + [6]=> + int(27) + [7]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } +} +Using SORT_REGULAR: +array(8) { + [0]=> + float(-0.33333333333333) + [1]=> + string(3) "PHP" + [2]=> + string(27) "PHP: Hypertext Preprocessor" + [3]=> + string(4) "Test" + [4]=> + string(6) "monkey" + [5]=> + string(4) "test" + [6]=> + int(27) + [7]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } +} +Using SORT_NUMERIC: +array(8) { + [0]=> + float(-0.33333333333333) + [1]=> + string(6) "monkey" + [2]=> + string(4) "test" + [3]=> + string(4) "Test" + [4]=> + string(27) "PHP: Hypertext Preprocessor" + [5]=> + string(3) "PHP" + [6]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [7]=> + int(27) +} +Using SORT_STRING + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d + +Notice: Array to string conversion in %s002.php on line %d +array(8) { + [0]=> + float(-0.33333333333333) + [1]=> + int(27) + [2]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [3]=> + string(3) "PHP" + [4]=> + string(27) "PHP: Hypertext Preprocessor" + [5]=> + string(4) "Test" + [6]=> + string(6) "monkey" + [7]=> + string(4) "test" +} diff --git a/ext/standard/tests/array/003.phpt b/ext/standard/tests/array/003.phpt new file mode 100644 index 0000000..f307186 --- /dev/null +++ b/ext/standard/tests/array/003.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test usort, uksort and uasort +--INI-- +precision=14 +--FILE-- + +--EXPECT-- +-- Testing uasort() -- +array(8) { + [16777216]=> + float(-0.33333333333333) + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + ["test"]=> + int(27) + [0]=> + string(3) "PHP" + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [5]=> + string(4) "Test" + [1001]=> + string(6) "monkey" + [1000]=> + string(4) "test" +} + + -- Testing uksort() -- +array(8) { + [-1000]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [0]=> + string(3) "PHP" + [1000]=> + string(4) "test" + [1001]=> + string(6) "monkey" + [16777216]=> + float(-0.33333333333333) + [17]=> + string(27) "PHP: Hypertext Preprocessor" + [5]=> + string(4) "Test" + ["test"]=> + int(27) +} + + -- Testing usort() -- +array(8) { + [0]=> + float(-0.33333333333333) + [1]=> + array(2) { + [0]=> + string(6) "banana" + [1]=> + string(6) "orange" + } + [2]=> + int(27) + [3]=> + string(3) "PHP" + [4]=> + string(27) "PHP: Hypertext Preprocessor" + [5]=> + string(4) "Test" + [6]=> + string(6) "monkey" + [7]=> + string(4) "test" +} diff --git a/ext/standard/tests/array/004.phpt b/ext/standard/tests/array/004.phpt new file mode 100644 index 0000000..765637b --- /dev/null +++ b/ext/standard/tests/array/004.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test natsort and natcasesort +--INI-- +precision=14 +--FILE-- +0, + 5=>'test2', + 'abc'=>'test10', + 'test21' +); + +var_dump($data); + +natsort($data); +var_dump($data); + +natcasesort($data); +var_dump($data); +?> +--EXPECT-- +array(5) { + [0]=> + string(5) "Test1" + ["teST2"]=> + int(0) + [5]=> + string(5) "test2" + ["abc"]=> + string(6) "test10" + [6]=> + string(6) "test21" +} +array(5) { + ["teST2"]=> + int(0) + [0]=> + string(5) "Test1" + [5]=> + string(5) "test2" + ["abc"]=> + string(6) "test10" + [6]=> + string(6) "test21" +} +array(5) { + ["teST2"]=> + int(0) + [0]=> + string(5) "Test1" + [5]=> + string(5) "test2" + ["abc"]=> + string(6) "test10" + [6]=> + string(6) "test21" +} diff --git a/ext/standard/tests/array/005.phpt b/ext/standard/tests/array/005.phpt new file mode 100644 index 0000000..f724932 --- /dev/null +++ b/ext/standard/tests/array/005.phpt @@ -0,0 +1,291 @@ +--TEST-- +Test array_shift() function +--FILE-- + "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ), + array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), + array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), + array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", + "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + array( 12, "name", 'age', '45' ), + array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), + array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, + 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 ) +); + +/* Testing Error Conditions */ +echo "\n*** Testing Error Conditions ***\n"; + +/* Zero argument */ +var_dump( array_shift() ); + +/* Scalar argument */ +var_dump( array_shift($number) ); + +/* String argument */ +var_dump( array_shift($str) ); + +/* Invalid Number of arguments */ +var_dump( array_shift($mixed_array[1],$mixed_array[2]) ); + +/* Empty Array as argument */ +var_dump( array_shift($empty_array) ); + +/* Loop to test normal functionality with different arrays inputs */ +echo "\n*** Testing with various array inputs ***\n"; + +$counter = 1; +foreach( $mixed_array as $sub_array ) { + echo "\n-- Input Array for Iteration $counter is -- \n"; + print_r( $sub_array ); + echo "\nOutput after shift is :\n"; + var_dump( array_shift($sub_array) ); + $counter++; +} + +/*Checking for internal array pointer beint reset when shift is called */ + +echo"\n*** Checking for internal array pointer being reset when shift is called ***\n"; + +echo "\nCurrent Element is : "; +var_dump( current($mixed_array[1]) ); + +echo "\nNext Element is : "; +var_dump( next($mixed_array[1]) ); + +echo "\nNext Element is : "; +var_dump( next($mixed_array[1]) ); + +echo "\nshifted Element is : "; +var_dump( array_shift($mixed_array[1]) ); + +echo "\nCurrent Element after shift operation is: "; +var_dump( current($mixed_array[1]) ); + +echo"Done"; +?> +--EXPECTF-- +*** Testing Error Conditions *** + +Warning: array_shift() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: array_shift() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_shift() expects exactly 1 parameter, 2 given in %s on line %d +NULL +NULL + +*** Testing with various array inputs *** + +-- Input Array for Iteration 1 is -- +Array +( +) + +Output after shift is : +NULL + +-- Input Array for Iteration 2 is -- +Array +( + [0] => 1 + [1] => 2 + [2] => 3 + [3] => 4 + [4] => 5 + [5] => 6 + [6] => 7 + [7] => 8 + [8] => 9 +) + +Output after shift is : +int(1) + +-- Input Array for Iteration 3 is -- +Array +( + [0] => One + [1] => _Two + [2] => Three + [3] => Four + [4] => Five +) + +Output after shift is : +string(3) "One" + +-- Input Array for Iteration 4 is -- +Array +( + [0] => 6 + [1] => six + [2] => 7 + [3] => seven + [4] => 8 + [5] => eight + [6] => 9 + [7] => nine +) + +Output after shift is : +int(6) + +-- Input Array for Iteration 5 is -- +Array +( + [a] => aaa + [A] => AAA + [c] => ccc + [d] => ddd + [e] => eee +) + +Output after shift is : +string(3) "aaa" + +-- Input Array for Iteration 6 is -- +Array +( + [1] => one + [2] => two + [3] => three + [4] => four + [5] => five +) + +Output after shift is : +string(3) "one" + +-- Input Array for Iteration 7 is -- +Array +( + [1] => one + [2] => two + [3] => 7 + [4] => four + [5] => five +) + +Output after shift is : +string(3) "one" + +-- Input Array for Iteration 8 is -- +Array +( + [f] => fff + [1] => one + [4] => 6 + [] => 3 + [2] => float + [F] => FFF + [blank] => + [3] => 3.7 + [5] => Five + [6] => 8.6 + [4name] => jonny + [a] => +) + +Output after shift is : +string(3) "fff" + +-- Input Array for Iteration 9 is -- +Array +( + [0] => 12 + [1] => name + [2] => age + [3] => 45 +) + +Output after shift is : +int(12) + +-- Input Array for Iteration 10 is -- +Array +( + [0] => Array + ( + [0] => oNe + [1] => tWo + [2] => 4 + ) + + [1] => Array + ( + [0] => 10 + [1] => 20 + [2] => 30 + [3] => 40 + [4] => 50 + ) + + [2] => Array + ( + ) + +) + +Output after shift is : +array(3) { + [0]=> + string(3) "oNe" + [1]=> + string(3) "tWo" + [2]=> + int(4) +} + +-- Input Array for Iteration 11 is -- +Array +( + [one] => 2 + [three] => 3 + [0] => 3 + [1] => 4 + [3] => 33 + [4] => 44 + [5] => 57 + [6] => 6 + [5.4] => 554 + [5.7] => 557 +) + +Output after shift is : +int(2) + +*** Checking for internal array pointer being reset when shift is called *** + +Current Element is : int(1) + +Next Element is : int(2) + +Next Element is : int(3) + +shifted Element is : int(1) + +Current Element after shift operation is: int(2) +Done diff --git a/ext/standard/tests/array/006.phpt b/ext/standard/tests/array/006.phpt new file mode 100644 index 0000000..4893ad3 --- /dev/null +++ b/ext/standard/tests/array/006.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test array_pop behaviour +--FILE-- + "foo", "4" => "bar", "5" => "fubar"); +$c = array("a" => "foo", "b" => "bar", "c" => "fubar"); + +/* simple array */ +echo array_pop($a), "\n"; +array_push($a, "foobar"); +var_dump($a); + +/* numerical assoc indices */ +echo array_pop($b), "\n"; +var_dump($b); + +/* assoc indices */ +echo array_pop($c), "\n"; +var_dump($c); + +?> +--EXPECT-- +fubar +array(3) { + [0]=> + string(3) "foo" + [1]=> + string(3) "bar" + [2]=> + string(6) "foobar" +} +fubar +array(2) { + [3]=> + string(3) "foo" + [4]=> + string(3) "bar" +} +fubar +array(2) { + ["a"]=> + string(3) "foo" + ["b"]=> + string(3) "bar" +} diff --git a/ext/standard/tests/array/007.phpt b/ext/standard/tests/array/007.phpt new file mode 100644 index 0000000..e30b8fe --- /dev/null +++ b/ext/standard/tests/array/007.phpt @@ -0,0 +1,553 @@ +--TEST-- +Test array_diff and array_diff_assoc behaviour +--FILE-- +2,3,6,3,5,3,3,3,3,3,3,3,3,3,3); +$b = array(2,2,3,3,3,3,3,3,3,3,3,3,3,3,3); +$c = array(-1,1); +echo '$a='.var_export($a,TRUE).";\n"; +echo '$b='.var_export($b,TRUE).";\n"; +echo '$c='.var_export($c,TRUE).";\n"; +var_dump(array_diff($a,$b,$c)); +var_dump(array_diff_assoc($a,$b,$c)); +$a = array( +'a'=>2, +'b'=>'some', +'c'=>'done', +'z'=>'foo', +'f'=>5, +'fan'=>'fen', +7=>18, +9=>25, +11=>42, +12=>42, +45=>42, +73=>'foo', +95=>'some', +'som3'=>'some', +'want'=>'wanna'); +$b = array( +'a'=>7, +7=>18, +9=>13, +11=>42, +45=>46, +'som3'=>'some', +'foo'=>'some', +'goo'=>'foo', +'f'=>5, +'z'=>'equal' +); +$c = array( +73=>'foo', +95=>'some'); +echo '$a='.var_export($a,TRUE).";\n"; +echo '$b='.var_export($b,TRUE).";\n"; +echo '$c='.var_export($c,TRUE).";\n"; +echo "Results:\n\n"; +var_dump(array_diff($a,$b,$c)); +var_dump(array_diff_assoc($a,$b,$c)); + +echo "-=-=-=-=-=-=-=-=- New functionality from 5.0.0 -=-=-=-=-=-=-=-\n"; +error_reporting(E_ALL); +class cr { + private $priv_member; + public $public_member; + function cr($val) { + $this->priv_member = $val; + $this->public_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member)? 1:-1; + } +} + +function comp_func($a, $b) { + if ($a === $b) return 0; + return ($a > $b)? 1:-1; + +} + +function comp_func_cr($a, $b) { + if ($a->public_member === $b->public_member) return 0; + return ($a->public_member > $b->public_member)? 1:-1; +} + + +/* +$a = array(1,"big"=>2,3,6,3,5,3,3,3,3,3,3,3,3,3,3); +$b = array(2,2,3,3,3,3,3,3,3,3,3,3,3,3,3); +$c = array(-1,1); +echo '$a='.var_export($a,TRUE).";\n"; +echo '$b='.var_export($b,TRUE).";\n"; +echo '$c='.var_export($c,TRUE).";\n"; +var_dump(array_diff($a,$b,$c)); +var_dump(array_diff_assoc($a,$b,$c)); +var_dump(array_udiff($a, $b, $c, "comp_func")); +var_dump(array_diff_uassoc($a,$b,$c, "comp_func")); +*/ + +/* + $a = array(new cr(9),new cr(12),new cr(23),new cr(4),new cr(-15),); + $b = array(new cr(9),new cr(22),new cr( 3),new cr(4),new cr(-15),); + var_dump(array_udiff($a, $b, "comp_func_cr")); +*/ +$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),); +$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr( 3), 1=> new cr(4), 2 => new cr(-15),); + +echo '$a='.var_export($a,TRUE).";\n"; +echo '$b='.var_export($b,TRUE).";\n"; +echo 'var_dump(array_udiff_uassoc($a, $b, "comp_func_cr", "comp_func"));'."\n"; +var_dump(array_udiff_uassoc($a, $b, "comp_func_cr", "comp_func")); + + +echo '$a='.var_export($a,TRUE).";\n"; +echo '$b='.var_export($b,TRUE).";\n"; +echo 'var_dump(array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), "comp_func"));'."\n"; +var_dump(array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), "comp_func")); + + +echo '$a='.var_export($a,TRUE).";\n"; +echo '$b='.var_export($b,TRUE).";\n"; +echo 'var_dump(array_udiff($a, $b, "comp_func_cr"));'."\n"; +var_dump(array_udiff($a, $b, "comp_func_cr")); + + +echo '$a='.var_export($a,TRUE).";\n"; +echo '$b='.var_export($b,TRUE).";\n"; +echo 'var_dump(array_udiff_assoc($a, $b, "comp_func_cr"));'."\n"; +var_dump(array_udiff_assoc($a, $b, "comp_func_cr")); + +?> +--EXPECTF-- +$a=array ( + 0 => 1, + 'big' => 2, + 1 => 3, + 2 => 6, + 3 => 3, + 4 => 5, + 5 => 3, + 6 => 3, + 7 => 3, + 8 => 3, + 9 => 3, + 10 => 3, + 11 => 3, + 12 => 3, + 13 => 3, + 14 => 3, +); +$b=array ( + 0 => 2, + 1 => 2, + 2 => 3, + 3 => 3, + 4 => 3, + 5 => 3, + 6 => 3, + 7 => 3, + 8 => 3, + 9 => 3, + 10 => 3, + 11 => 3, + 12 => 3, + 13 => 3, + 14 => 3, +); +$c=array ( + 0 => -1, + 1 => 1, +); +array(2) { + [2]=> + int(6) + [4]=> + int(5) +} +array(5) { + [0]=> + int(1) + ["big"]=> + int(2) + [1]=> + int(3) + [2]=> + int(6) + [4]=> + int(5) +} +$a=array ( + 'a' => 2, + 'b' => 'some', + 'c' => 'done', + 'z' => 'foo', + 'f' => 5, + 'fan' => 'fen', + 7 => 18, + 9 => 25, + 11 => 42, + 12 => 42, + 45 => 42, + 73 => 'foo', + 95 => 'some', + 'som3' => 'some', + 'want' => 'wanna', +); +$b=array ( + 'a' => 7, + 7 => 18, + 9 => 13, + 11 => 42, + 45 => 46, + 'som3' => 'some', + 'foo' => 'some', + 'goo' => 'foo', + 'f' => 5, + 'z' => 'equal', +); +$c=array ( + 73 => 'foo', + 95 => 'some', +); +Results: + +array(5) { + ["a"]=> + int(2) + ["c"]=> + string(4) "done" + ["fan"]=> + string(3) "fen" + [9]=> + int(25) + ["want"]=> + string(5) "wanna" +} +array(9) { + ["a"]=> + int(2) + ["b"]=> + string(4) "some" + ["c"]=> + string(4) "done" + ["z"]=> + string(3) "foo" + ["fan"]=> + string(3) "fen" + [9]=> + int(25) + [12]=> + int(42) + [45]=> + int(42) + ["want"]=> + string(5) "wanna" +} +-=-=-=-=-=-=-=-=- New functionality from 5.0.0 -=-=-=-=-=-=-=- +$a=array ( + '0.1' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 12, + 'public_member' => 12, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 23, + 'public_member' => 23, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +$b=array ( + '0.2' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 22, + 'public_member' => 22, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 3, + 'public_member' => 3, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +var_dump(array_udiff_uassoc($a, $b, "comp_func_cr", "comp_func")); +array(3) { + ["0.1"]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(9) + ["public_member"]=> + int(9) + } + ["0.5"]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(12) + ["public_member"]=> + int(12) + } + [0]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(23) + ["public_member"]=> + int(23) + } +} +$a=array ( + '0.1' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 12, + 'public_member' => 12, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 23, + 'public_member' => 23, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +$b=array ( + '0.2' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 22, + 'public_member' => 22, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 3, + 'public_member' => 3, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +var_dump(array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), "comp_func")); +array(3) { + ["0.1"]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(9) + ["public_member"]=> + int(9) + } + ["0.5"]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(12) + ["public_member"]=> + int(12) + } + [0]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(23) + ["public_member"]=> + int(23) + } +} +$a=array ( + '0.1' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 12, + 'public_member' => 12, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 23, + 'public_member' => 23, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +$b=array ( + '0.2' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 22, + 'public_member' => 22, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 3, + 'public_member' => 3, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +var_dump(array_udiff($a, $b, "comp_func_cr")); +array(2) { + ["0.5"]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(12) + ["public_member"]=> + int(12) + } + [0]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(23) + ["public_member"]=> + int(23) + } +} +$a=array ( + '0.1' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 12, + 'public_member' => 12, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 23, + 'public_member' => 23, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +$b=array ( + '0.2' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 22, + 'public_member' => 22, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 3, + 'public_member' => 3, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +var_dump(array_udiff_assoc($a, $b, "comp_func_cr")); +array(3) { + ["0.1"]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(9) + ["public_member"]=> + int(9) + } + ["0.5"]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(12) + ["public_member"]=> + int(12) + } + [0]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(23) + ["public_member"]=> + int(23) + } +} diff --git a/ext/standard/tests/array/008.phpt b/ext/standard/tests/array/008.phpt new file mode 100644 index 0000000..a3dde36 --- /dev/null +++ b/ext/standard/tests/array/008.phpt @@ -0,0 +1,310 @@ +--TEST-- +Test array_intersect and array_intersect_assoc behaviour +--FILE-- +2,2,6,3,5,3,3,454,'some_string',3,3,3,3,3,3,3,3,17); +$b = array(2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,17,25,'some_string',7,8,9,109,78,17); +$c = array(-1,2,1,15,25,17); +echo str_repeat("-=",10)." TEST 1 ".str_repeat("-=",20)."\n"; +echo '$a='.var_export($a,TRUE).";\n"; +echo '$b='.var_export($b,TRUE).";\n"; +echo '$c='.var_export($c,TRUE).";\n"; + +echo 'array_intersect($a,$b,$c);'."\n"; +var_dump(array_intersect($a,$b,$c)); + +echo 'array_intersect_assoc($a,$b,$c);'."\n"; +var_dump(array_intersect_assoc($a,$b,$c)); + +echo 'array_intersect($a,$b);'."\n"; +var_dump(array_intersect($a,$b)); + +echo 'array_intersect_assoc($a,$b);'."\n"; +var_dump(array_intersect_assoc($a,$b)); + +//-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=- TEST 2 -=-=-=-=-=- +$a = array( +'a'=>2, +'b'=>'some', +'c'=>'done', +'z'=>'foo', +'f'=>5, +'fan'=>'fen', +'bad'=>'bed', +'gate'=>'web', +7=>18, +9=>25, +11=>42, +12=>42, +45=>42, +73=>'foo', +95=>'some', +'som3'=>'some', +'want'=>'wanna'); + + +$b = array( +'a'=>7, +7=>18, +9=>13, +11=>42, +45=>46, +'som3'=>'some', +'foo'=>'some', +'goo'=>'foo', +'f'=>5, +'z'=>'equal', +'gate'=>'web' +); +$c = array( +'gate'=>'web', +73=>'foo', +95=>'some' +); + +echo str_repeat("-=",10)." TEST 2 ".str_repeat("-=",20)."\n"; +echo '$a='.var_export($a,TRUE).";\n"; +echo '$b='.var_export($b,TRUE).";\n"; +echo '$c='.var_export($c,TRUE).";\n"; +echo "\n\nResults:\n\n"; + +echo 'array_intersect($a,$b,$c);'."\n"; +var_dump(array_intersect($a,$b,$c)); + +echo 'array_intersect_assoc($a,$b,$c);'."\n"; +var_dump(array_intersect_assoc($a,$b,$c)); + +echo 'array_intersect($a,$b);'."\n"; +var_dump(array_intersect($a,$b)); + +echo 'array_intersect_assoc($a,$b);'."\n"; +var_dump(array_intersect_assoc($a,$b)); +?> +--EXPECT-- +-=-=-=-=-=-=-=-=-=-= TEST 1 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +$a=array ( + 0 => 1, + 'big' => 2, + 1 => 2, + 2 => 6, + 3 => 3, + 4 => 5, + 5 => 3, + 6 => 3, + 7 => 454, + 8 => 'some_string', + 9 => 3, + 10 => 3, + 11 => 3, + 12 => 3, + 13 => 3, + 14 => 3, + 15 => 3, + 16 => 3, + 17 => 17, +); +$b=array ( + 0 => 2, + 1 => 2, + 2 => 3, + 3 => 3, + 4 => 3, + 5 => 3, + 6 => 3, + 7 => 3, + 8 => 3, + 9 => 3, + 10 => 3, + 11 => 3, + 12 => 3, + 13 => 3, + 14 => 3, + 15 => 17, + 16 => 25, + 17 => 'some_string', + 18 => 7, + 19 => 8, + 20 => 9, + 21 => 109, + 22 => 78, + 23 => 17, +); +$c=array ( + 0 => -1, + 1 => 2, + 2 => 1, + 3 => 15, + 4 => 25, + 5 => 17, +); +array_intersect($a,$b,$c); +array(3) { + ["big"]=> + int(2) + [1]=> + int(2) + [17]=> + int(17) +} +array_intersect_assoc($a,$b,$c); +array(1) { + [1]=> + int(2) +} +array_intersect($a,$b); +array(15) { + ["big"]=> + int(2) + [1]=> + int(2) + [3]=> + int(3) + [5]=> + int(3) + [6]=> + int(3) + [8]=> + string(11) "some_string" + [9]=> + int(3) + [10]=> + int(3) + [11]=> + int(3) + [12]=> + int(3) + [13]=> + int(3) + [14]=> + int(3) + [15]=> + int(3) + [16]=> + int(3) + [17]=> + int(17) +} +array_intersect_assoc($a,$b); +array(10) { + [1]=> + int(2) + [3]=> + int(3) + [5]=> + int(3) + [6]=> + int(3) + [9]=> + int(3) + [10]=> + int(3) + [11]=> + int(3) + [12]=> + int(3) + [13]=> + int(3) + [14]=> + int(3) +} +-=-=-=-=-=-=-=-=-=-= TEST 2 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +$a=array ( + 'a' => 2, + 'b' => 'some', + 'c' => 'done', + 'z' => 'foo', + 'f' => 5, + 'fan' => 'fen', + 'bad' => 'bed', + 'gate' => 'web', + 7 => 18, + 9 => 25, + 11 => 42, + 12 => 42, + 45 => 42, + 73 => 'foo', + 95 => 'some', + 'som3' => 'some', + 'want' => 'wanna', +); +$b=array ( + 'a' => 7, + 7 => 18, + 9 => 13, + 11 => 42, + 45 => 46, + 'som3' => 'some', + 'foo' => 'some', + 'goo' => 'foo', + 'f' => 5, + 'z' => 'equal', + 'gate' => 'web', +); +$c=array ( + 'gate' => 'web', + 73 => 'foo', + 95 => 'some', +); + + +Results: + +array_intersect($a,$b,$c); +array(6) { + ["b"]=> + string(4) "some" + ["z"]=> + string(3) "foo" + ["gate"]=> + string(3) "web" + [73]=> + string(3) "foo" + [95]=> + string(4) "some" + ["som3"]=> + string(4) "some" +} +array_intersect_assoc($a,$b,$c); +array(1) { + ["gate"]=> + string(3) "web" +} +array_intersect($a,$b); +array(11) { + ["b"]=> + string(4) "some" + ["z"]=> + string(3) "foo" + ["f"]=> + int(5) + ["gate"]=> + string(3) "web" + [7]=> + int(18) + [11]=> + int(42) + [12]=> + int(42) + [45]=> + int(42) + [73]=> + string(3) "foo" + [95]=> + string(4) "some" + ["som3"]=> + string(4) "some" +} +array_intersect_assoc($a,$b); +array(5) { + ["f"]=> + int(5) + ["gate"]=> + string(3) "web" + [7]=> + int(18) + [11]=> + int(42) + ["som3"]=> + string(4) "some" +} diff --git a/ext/standard/tests/array/009.phpt b/ext/standard/tests/array/009.phpt new file mode 100644 index 0000000..f88f876 --- /dev/null +++ b/ext/standard/tests/array/009.phpt @@ -0,0 +1,535 @@ +--TEST-- +Test key(), current(), next() & reset() functions +--FILE-- + returns the index element of the current array position + mixed current ( array &$array ) -> returns the current element in the array + mixed next ( array &$array ) -> similar to current() but advances the internal pointer to next element + mixed reset ( array &$array ) -> Reset the internal pointer to first element +*/ + +$basic_arrays = array ( + array(0), // array with element as 0 + array(1), // array with single element + array(1,2, 3, -1, -2, -3), // array of integers + array(1.1, 2.2, 3.3, -1.1, -2.2, -3.3), // array of floats + array('a', 'b', 'c', "ab", "ac", "ad"), // string array + array("a" => "apple", "b" => "book", "c" => "cook"), // associative array + array('d' => 'drink', 'p' => 'port', 's' => 'set'), // another associative array + array(1 => 'One', 2 => 'two', 3 => "three") // associative array with key as integers +); + +$varient_arrays = array ( + array(), // empty array + array(""), // array with null string + array(NULL),// array with NULL + array(null),// array with null + array(NULL, true, null, "", 1), // mixed array + array(-1.5 => "test", -2 => "rest", 2.5 => "two", + "" => "string", 0 => "zero", "" => "" ) // mixed array +); + +echo "*** Testing basic operations ***\n"; +$loop_count = 1; +foreach ($basic_arrays as $sub_array ) { + echo "-- Iteration $loop_count --\n"; + $loop_count++; + $c = count ($sub_array); + $c++; // increment by one to create the situation of accessing beyond array size + while ( $c ) { + var_dump( current($sub_array)); // current element + var_dump( key($sub_array) ); // key of the current element + var_dump( next($sub_array) ); // move to next element + $c --; + } + var_dump( reset($sub_array) ); // reset the internal pointer to first element + var_dump( key($sub_array) ); // access the array after reset + var_dump( $sub_array ); // dump the array to see that its intact + + echo "\n"; +} + +echo "\n*** Testing possible variations ***\n"; +$loop_count = 1; +foreach ($varient_arrays as $sub_array ) { + echo "-- Iteration $loop_count --\n"; + $loop_count++; + $c = count ($sub_array); + $c++; // increment by one to create the situation of accessing beyond array size + while ( $c ) { + var_dump( current($sub_array)); // current element + var_dump( key($sub_array) ); // key of the current element + var_dump( next($sub_array) ); // move to next element + $c --; + } + var_dump( reset($sub_array) ); // reset the internal pointer to first element + var_dump( key($sub_array) ); // access the array after reset + var_dump( $sub_array ); // dump the array to see that its intact + echo "\n"; +} + +/*test these functions on array which is already unset */ +echo "\n-- Testing variation: when array is unset --\n"; +$unset_array = array (1); +unset($unset_array); + +var_dump( current($unset_array) ); +var_dump( key($unset_array) ); +var_dump( next($unset_array) ); +var_dump( reset($unset_array) ); + + +echo "\n*** Testing error conditions ***\n"; +//Zero argument, expected 1 argument +var_dump( key() ); +var_dump( current() ); +var_dump( reset() ); +var_dump( next() ); + +// args more than expected, expected 1 argument +$temp_array = array(1); +var_dump( key($temp_array, $temp_array) ); +var_dump( current($temp_array, $temp_array) ); +var_dump( reset($temp_array, $temp_array) ); +var_dump( next($temp_array, $temp_array) ); + +// invalid args type, valid arguement: array +$int_var = 1; +$float_var = 1.5; +$string = "string"; +var_dump( key($int_var) ); +var_dump( key($float_var) ); +var_dump( key($string) ); + +var_dump( current($int_var) ); +var_dump( current($float_var) ); +var_dump( current($string) ); + +var_dump( next($int_var) ); +var_dump( next($float_var) ); +var_dump( next($string) ); + +var_dump( reset($int_var) ); +var_dump( reset($float_var) ); +var_dump( reset($string) ); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing basic operations *** +-- Iteration 1 -- +int(0) +int(0) +bool(false) +bool(false) +NULL +bool(false) +int(0) +int(0) +array(1) { + [0]=> + int(0) +} + +-- Iteration 2 -- +int(1) +int(0) +bool(false) +bool(false) +NULL +bool(false) +int(1) +int(0) +array(1) { + [0]=> + int(1) +} + +-- Iteration 3 -- +int(1) +int(0) +int(2) +int(2) +int(1) +int(3) +int(3) +int(2) +int(-1) +int(-1) +int(3) +int(-2) +int(-2) +int(4) +int(-3) +int(-3) +int(5) +bool(false) +bool(false) +NULL +bool(false) +int(1) +int(0) +array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(-1) + [4]=> + int(-2) + [5]=> + int(-3) +} + +-- Iteration 4 -- +float(1.1) +int(0) +float(2.2) +float(2.2) +int(1) +float(3.3) +float(3.3) +int(2) +float(-1.1) +float(-1.1) +int(3) +float(-2.2) +float(-2.2) +int(4) +float(-3.3) +float(-3.3) +int(5) +bool(false) +bool(false) +NULL +bool(false) +float(1.1) +int(0) +array(6) { + [0]=> + float(1.1) + [1]=> + float(2.2) + [2]=> + float(3.3) + [3]=> + float(-1.1) + [4]=> + float(-2.2) + [5]=> + float(-3.3) +} + +-- Iteration 5 -- +string(1) "a" +int(0) +string(1) "b" +string(1) "b" +int(1) +string(1) "c" +string(1) "c" +int(2) +string(2) "ab" +string(2) "ab" +int(3) +string(2) "ac" +string(2) "ac" +int(4) +string(2) "ad" +string(2) "ad" +int(5) +bool(false) +bool(false) +NULL +bool(false) +string(1) "a" +int(0) +array(6) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + [3]=> + string(2) "ab" + [4]=> + string(2) "ac" + [5]=> + string(2) "ad" +} + +-- Iteration 6 -- +string(5) "apple" +string(1) "a" +string(4) "book" +string(4) "book" +string(1) "b" +string(4) "cook" +string(4) "cook" +string(1) "c" +bool(false) +bool(false) +NULL +bool(false) +string(5) "apple" +string(1) "a" +array(3) { + ["a"]=> + string(5) "apple" + ["b"]=> + string(4) "book" + ["c"]=> + string(4) "cook" +} + +-- Iteration 7 -- +string(5) "drink" +string(1) "d" +string(4) "port" +string(4) "port" +string(1) "p" +string(3) "set" +string(3) "set" +string(1) "s" +bool(false) +bool(false) +NULL +bool(false) +string(5) "drink" +string(1) "d" +array(3) { + ["d"]=> + string(5) "drink" + ["p"]=> + string(4) "port" + ["s"]=> + string(3) "set" +} + +-- Iteration 8 -- +string(3) "One" +int(1) +string(3) "two" +string(3) "two" +int(2) +string(5) "three" +string(5) "three" +int(3) +bool(false) +bool(false) +NULL +bool(false) +string(3) "One" +int(1) +array(3) { + [1]=> + string(3) "One" + [2]=> + string(3) "two" + [3]=> + string(5) "three" +} + + +*** Testing possible variations *** +-- Iteration 1 -- +bool(false) +NULL +bool(false) +bool(false) +NULL +array(0) { +} + +-- Iteration 2 -- +string(0) "" +int(0) +bool(false) +bool(false) +NULL +bool(false) +string(0) "" +int(0) +array(1) { + [0]=> + string(0) "" +} + +-- Iteration 3 -- +NULL +int(0) +bool(false) +bool(false) +NULL +bool(false) +NULL +int(0) +array(1) { + [0]=> + NULL +} + +-- Iteration 4 -- +NULL +int(0) +bool(false) +bool(false) +NULL +bool(false) +NULL +int(0) +array(1) { + [0]=> + NULL +} + +-- Iteration 5 -- +NULL +int(0) +bool(true) +bool(true) +int(1) +NULL +NULL +int(2) +string(0) "" +string(0) "" +int(3) +int(1) +int(1) +int(4) +bool(false) +bool(false) +NULL +bool(false) +NULL +int(0) +array(5) { + [0]=> + NULL + [1]=> + bool(true) + [2]=> + NULL + [3]=> + string(0) "" + [4]=> + int(1) +} + +-- Iteration 6 -- +string(4) "test" +int(-1) +string(4) "rest" +string(4) "rest" +int(-2) +string(3) "two" +string(3) "two" +int(2) +string(0) "" +string(0) "" +string(0) "" +string(4) "zero" +string(4) "zero" +int(0) +bool(false) +bool(false) +NULL +bool(false) +string(4) "test" +int(-1) +array(5) { + [-1]=> + string(4) "test" + [-2]=> + string(4) "rest" + [2]=> + string(3) "two" + [""]=> + string(0) "" + [0]=> + string(4) "zero" +} + + +-- Testing variation: when array is unset -- + +Warning: current() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: key() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: next() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: reset() expects parameter 1 to be array, null given in %s on line %d +NULL + +*** Testing error conditions *** + +Warning: key() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: current() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: reset() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: next() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: key() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: current() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: reset() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: next() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: key() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: key() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: key() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: current() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: current() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: current() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: next() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: next() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: next() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: reset() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: reset() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: reset() expects parameter 1 to be array, string given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_change_key_case.phpt b/ext/standard/tests/array/array_change_key_case.phpt new file mode 100644 index 0000000..3123458 --- /dev/null +++ b/ext/standard/tests/array/array_change_key_case.phpt @@ -0,0 +1,817 @@ +--TEST-- +Test array_change_key_case() function +--FILE-- + 1), + array ("a" => 1), + array ("Z" => 1), + array ("one" => 1), + array ("ONE" => 1), + array ("OnE" => 1), + array ("oNe" => 1), + array ("one" => 1, "two" => 2), + array ("ONE" => 1, "two" => 2), + array ("OnE" => 1, "two" => 2), + array ("oNe" => 1, "two" => 2), + array ("one" => 1, "TWO" => 2), + array ("ONE" => 1, "TWO" => 2), + array ("OnE" => 1, "TWO" => 2), + array ("oNe" => 1, "TWO" => 2), + array ("one" => 1, "TwO" => 2), + array ("ONE" => 1, "TwO" => 2), + array ("OnE" => 1, "TwO" => 2), + array ("oNe" => 1, "TwO" => 2), + array ("one" => 1, "tWo" => 2), + array ("ONE" => 1, "tWo" => 2), + array ("OnE" => 1, "tWo" => 2), + array ("oNe" => 1, "tWo" => 2), + array ("one" => 1, 2), + array ("ONE" => 1, 2), + array ("OnE" => 1, 2), + array ("oNe" => 1, 2), + array ("ONE" => 1, "TWO" => 2, "THREE" => 3, "FOUR" => "four"), + array ("one" => 1, "two" => 2, "three" => 3, "four" => "FOUR"), + array ("ONE" => 1, "TWO" => 2, "three" => 3, "four" => "FOUR"), + array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four") +); + +echo "*** Testing basic operations ***\n"; +$loop_counter = 1; +foreach ($arrays as $item) { + echo "** Iteration $loop_counter **\n"; $loop_counter++; + var_dump(array_change_key_case($item)); + var_dump(array_change_key_case($item, CASE_UPPER)); + var_dump(array_change_key_case($item, CASE_LOWER)); + echo "\n"; +} + +echo "end\n"; +?> +--EXPECTF-- +*** Testing basic operations *** +** Iteration 1 ** +array(0) { +} +array(0) { +} +array(0) { +} + +** Iteration 2 ** +array(1) { + [0]=> + int(0) +} +array(1) { + [0]=> + int(0) +} +array(1) { + [0]=> + int(0) +} + +** Iteration 3 ** +array(1) { + [0]=> + int(1) +} +array(1) { + [0]=> + int(1) +} +array(1) { + [0]=> + int(1) +} + +** Iteration 4 ** +array(1) { + [0]=> + int(-1) +} +array(1) { + [0]=> + int(-1) +} +array(1) { + [0]=> + int(-1) +} + +** Iteration 5 ** +array(5) { + [0]=> + int(0) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) +} +array(5) { + [0]=> + int(0) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) +} +array(5) { + [0]=> + int(0) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) +} + +** Iteration 6 ** +array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) +} +array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) +} +array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) +} + +** Iteration 7 ** +array(1) { + [""]=> + int(1) +} +array(1) { + [""]=> + int(1) +} +array(1) { + [""]=> + int(1) +} + +** Iteration 8 ** +array(1) { + ["a"]=> + int(1) +} +array(1) { + ["A"]=> + int(1) +} +array(1) { + ["a"]=> + int(1) +} + +** Iteration 9 ** +array(1) { + ["z"]=> + int(1) +} +array(1) { + ["Z"]=> + int(1) +} +array(1) { + ["z"]=> + int(1) +} + +** Iteration 10 ** +array(1) { + ["one"]=> + int(1) +} +array(1) { + ["ONE"]=> + int(1) +} +array(1) { + ["one"]=> + int(1) +} + +** Iteration 11 ** +array(1) { + ["one"]=> + int(1) +} +array(1) { + ["ONE"]=> + int(1) +} +array(1) { + ["one"]=> + int(1) +} + +** Iteration 12 ** +array(1) { + ["one"]=> + int(1) +} +array(1) { + ["ONE"]=> + int(1) +} +array(1) { + ["one"]=> + int(1) +} + +** Iteration 13 ** +array(1) { + ["one"]=> + int(1) +} +array(1) { + ["ONE"]=> + int(1) +} +array(1) { + ["one"]=> + int(1) +} + +** Iteration 14 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 15 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 16 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 17 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 18 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 19 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 20 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 21 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 22 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 23 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 24 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 25 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 26 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 27 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 28 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 29 ** +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} + +** Iteration 30 ** +array(2) { + ["one"]=> + int(1) + [0]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + [0]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + [0]=> + int(2) +} + +** Iteration 31 ** +array(2) { + ["one"]=> + int(1) + [0]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + [0]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + [0]=> + int(2) +} + +** Iteration 32 ** +array(2) { + ["one"]=> + int(1) + [0]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + [0]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + [0]=> + int(2) +} + +** Iteration 33 ** +array(2) { + ["one"]=> + int(1) + [0]=> + int(2) +} +array(2) { + ["ONE"]=> + int(1) + [0]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + [0]=> + int(2) +} + +** Iteration 34 ** +array(4) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + ["four"]=> + string(4) "four" +} +array(4) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["THREE"]=> + int(3) + ["FOUR"]=> + string(4) "four" +} +array(4) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + ["four"]=> + string(4) "four" +} + +** Iteration 35 ** +array(4) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + ["four"]=> + string(4) "FOUR" +} +array(4) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["THREE"]=> + int(3) + ["FOUR"]=> + string(4) "FOUR" +} +array(4) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + ["four"]=> + string(4) "FOUR" +} + +** Iteration 36 ** +array(4) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + ["four"]=> + string(4) "FOUR" +} +array(4) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["THREE"]=> + int(3) + ["FOUR"]=> + string(4) "FOUR" +} +array(4) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + ["four"]=> + string(4) "FOUR" +} + +** Iteration 37 ** +array(4) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + ["four"]=> + string(4) "four" +} +array(4) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["THREE"]=> + int(3) + ["FOUR"]=> + string(4) "four" +} +array(4) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + ["four"]=> + string(4) "four" +} + +end diff --git a/ext/standard/tests/array/array_change_key_case_errors.phpt b/ext/standard/tests/array/array_change_key_case_errors.phpt new file mode 100644 index 0000000..ec506f7 --- /dev/null +++ b/ext/standard/tests/array/array_change_key_case_errors.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test array_change_key_case() function - 3 +--FILE-- + 1, "two" => 2, "THREE" => 3, "FOUR" => "four"); + +var_dump( array_change_key_case($int_var) ); // args less than expected +var_dump( array_change_key_case($int_var, CASE_UPPER) ); // invalid first argument +var_dump( array_change_key_case() ); // Zero argument +var_dump( array_change_key_case($item, $item["one"], "CASE_UPPER") ); // more than expected numbers + +echo "end\n"; +?> +--EXPECTF-- +Warning: array_change_key_case() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_change_key_case() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_change_key_case() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: array_change_key_case() expects at most 2 parameters, 3 given in %s on line %d +NULL +end diff --git a/ext/standard/tests/array/array_change_key_case_variation.phpt b/ext/standard/tests/array/array_change_key_case_variation.phpt new file mode 100644 index 0000000..e03b8d5 --- /dev/null +++ b/ext/standard/tests/array/array_change_key_case_variation.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test array_change_key_case() function - 2 +--FILE-- + 1, "two" => 2, "THREE" => 3, "FOUR" => "four"); + +/* use 'case' argument other than CASE_LOWER & CASE_UPPER */ +var_dump(array_change_key_case($item, "CASE_UPPER")); +var_dump(array_change_key_case($item, 5)); + +/* when keys are different in terms of only case */ +/* should return one value key pair with key being in lowercase */ +var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) ); +var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5), "CASE_UPPER" ) ); + +/* should return one value key pair with key being in uppercase */ +var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3), CASE_UPPER ) ); +var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 ) ); + +echo "end\n"; +?> +--EXPECTF-- +Warning: array_change_key_case() expects parameter 2 to be long, string given in %s on line %d +NULL +array(4) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["THREE"]=> + int(3) + ["FOUR"]=> + string(4) "four" +} +array(1) { + ["one"]=> + int(4) +} + +Warning: array_change_key_case() expects parameter 2 to be long, string given in %s on line %d +NULL +array(1) { + ["ONE"]=> + int(3) +} +array(1) { + ["ONE"]=> + int(2) +} +end diff --git a/ext/standard/tests/array/array_change_key_case_variation1.phpt b/ext/standard/tests/array/array_change_key_case_variation1.phpt new file mode 100644 index 0000000..bb490a7 --- /dev/null +++ b/ext/standard/tests/array/array_change_key_case_variation1.phpt @@ -0,0 +1,224 @@ +--TEST-- +Test array_change_key_case() function : usage variations - Pass different data types as $input arg +--FILE-- + + +--EXPECTF-- +*** Testing array_change_key_case() : usage variations *** + +-- Iteration 1 -- + +Warning: array_change_key_case() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: array_change_key_case() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: array_change_key_case() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: array_change_key_case() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: array_change_key_case() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: array_change_key_case() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_change_key_case() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_change_key_case() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_change_key_case() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_change_key_case() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_change_key_case() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: array_change_key_case() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: array_change_key_case() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: array_change_key_case() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: array_change_key_case() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: array_change_key_case() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_change_key_case() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +array(0) { +} + +-- Iteration 19 -- + +Warning: array_change_key_case() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_change_key_case() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_change_key_case() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: array_change_key_case() expects parameter 1 to be array, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: array_change_key_case() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: array_change_key_case() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: array_change_key_case() expects parameter 1 to be array, resource given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_change_key_case_variation2.phpt b/ext/standard/tests/array/array_change_key_case_variation2.phpt new file mode 100644 index 0000000..929ccb1 --- /dev/null +++ b/ext/standard/tests/array/array_change_key_case_variation2.phpt @@ -0,0 +1,288 @@ +--TEST-- +Test array_change_key_case() function : usage variations - Pass different data types as $case arg +--FILE-- + 1, 'TWO' => 2, 'Three' => 3); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// heredoc string +$heredoc = << + +--EXPECTF-- +*** Testing array_change_key_case() : usage variations *** + +-- Iteration 1 -- +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) +} + +-- Iteration 2 -- +array(3) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["THREE"]=> + int(3) +} + +-- Iteration 3 -- +array(3) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["THREE"]=> + int(3) +} + +-- Iteration 4 -- +array(3) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["THREE"]=> + int(3) +} + +-- Iteration 5 -- +array(3) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["THREE"]=> + int(3) +} + +-- Iteration 6 -- +array(3) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["THREE"]=> + int(3) +} + +-- Iteration 7 -- +array(3) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["THREE"]=> + int(3) +} + +-- Iteration 8 -- +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) +} + +-- Iteration 9 -- +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) +} + +-- Iteration 10 -- +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) +} + +-- Iteration 11 -- +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) +} + +-- Iteration 12 -- +array(3) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["THREE"]=> + int(3) +} + +-- Iteration 13 -- +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) +} + +-- Iteration 14 -- +array(3) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["THREE"]=> + int(3) +} + +-- Iteration 15 -- +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) +} + +-- Iteration 16 -- + +Warning: array_change_key_case() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_change_key_case() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: array_change_key_case() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: array_change_key_case() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_change_key_case() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_change_key_case() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 22 -- +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) +} + +-- Iteration 23 -- +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_change_key_case_variation3.phpt b/ext/standard/tests/array/array_change_key_case_variation3.phpt new file mode 100644 index 0000000..5967033 --- /dev/null +++ b/ext/standard/tests/array/array_change_key_case_variation3.phpt @@ -0,0 +1,197 @@ +--TEST-- +Test array_change_key_case() function : usage variations - different data types as keys +--FILE-- + array( + 0 => 'zero', + 1 => 'one', + 12345 => 'positive', + -2345 => 'negative', + ), + + // float data +/*2*/ 'float' => array( + 10.5 => 'positive', + -10.5 => 'negative', + .5 => 'half', + ), + + 'extreme floats' => array( + 12.3456789000e6 => 'large', + 12.3456789000E-10 => 'small', + ), + + // null data +/*3*/ 'null uppercase' => array( + NULL => 'null 1', + ), + 'null lowercase' => array( + null => 'null 2', + ), + + // boolean data +/*4*/ 'bool lowercase' => array( + true => 'lowert', + false => 'lowerf', + ), + 'bool uppercase' => array( + TRUE => 'uppert', + FALSE => 'upperf', + ), + + // empty data +/*5*/ 'empty double quotes' => array( + "" => 'emptyd', + ), + 'empty single quotes' => array( + '' => 'emptys', + ), + + // string data +/*6*/ 'string' => array( + "stringd" => 'stringd', + 'strings' => 'strings', + $heredoc => 'stringh', + ), + + // undefined data +/*8*/ 'undefined' => array( + @$undefined_var => 'undefined', + ), + + // unset data +/*9*/ 'unset' => array( + @$unset_var => 'unset', + ), +); + +// loop through each sub-array of $inputs to check the behavior of array_change_key_case() +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator : $key data --\n"; + var_dump( array_change_key_case($input, CASE_UPPER) ); + $iterator++; +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_change_key_case() : usage variations *** + +-- Iteration 1 : int data -- +array(4) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [12345]=> + string(8) "positive" + [-2345]=> + string(8) "negative" +} + +-- Iteration 2 : float data -- +array(3) { + [10]=> + string(8) "positive" + [-10]=> + string(8) "negative" + [0]=> + string(4) "half" +} + +-- Iteration 3 : extreme floats data -- +array(2) { + [12345678]=> + string(5) "large" + [0]=> + string(5) "small" +} + +-- Iteration 4 : null uppercase data -- +array(1) { + [""]=> + string(6) "null 1" +} + +-- Iteration 5 : null lowercase data -- +array(1) { + [""]=> + string(6) "null 2" +} + +-- Iteration 6 : bool lowercase data -- +array(2) { + [1]=> + string(6) "lowert" + [0]=> + string(6) "lowerf" +} + +-- Iteration 7 : bool uppercase data -- +array(2) { + [1]=> + string(6) "uppert" + [0]=> + string(6) "upperf" +} + +-- Iteration 8 : empty double quotes data -- +array(1) { + [""]=> + string(6) "emptyd" +} + +-- Iteration 9 : empty single quotes data -- +array(1) { + [""]=> + string(6) "emptys" +} + +-- Iteration 10 : string data -- +array(3) { + ["STRINGD"]=> + string(7) "stringd" + ["STRINGS"]=> + string(7) "strings" + ["HELLO WORLD"]=> + string(7) "stringh" +} + +-- Iteration 11 : undefined data -- +array(1) { + [""]=> + string(9) "undefined" +} + +-- Iteration 12 : unset data -- +array(1) { + [""]=> + string(5) "unset" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_change_key_case_variation4.phpt b/ext/standard/tests/array/array_change_key_case_variation4.phpt new file mode 100644 index 0000000..ad9ad75 --- /dev/null +++ b/ext/standard/tests/array/array_change_key_case_variation4.phpt @@ -0,0 +1,138 @@ +--TEST-- +Test array_change_key_case() function : usage variations - different int values for $case +--FILE-- + 'un', 'TWO' => 'deux', 'three' => 'trois'); +for ($i = -5; $i <=5; $i += 1){ + echo "\n-- \$sort argument is $i --\n"; + $temp = $input; + var_dump(array_change_key_case($temp, $i)); +} + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_change_key_case() : usage variations *** + +-- $sort argument is -5 -- +array(3) { + ["ONE"]=> + string(2) "un" + ["TWO"]=> + string(4) "deux" + ["THREE"]=> + string(5) "trois" +} + +-- $sort argument is -4 -- +array(3) { + ["ONE"]=> + string(2) "un" + ["TWO"]=> + string(4) "deux" + ["THREE"]=> + string(5) "trois" +} + +-- $sort argument is -3 -- +array(3) { + ["ONE"]=> + string(2) "un" + ["TWO"]=> + string(4) "deux" + ["THREE"]=> + string(5) "trois" +} + +-- $sort argument is -2 -- +array(3) { + ["ONE"]=> + string(2) "un" + ["TWO"]=> + string(4) "deux" + ["THREE"]=> + string(5) "trois" +} + +-- $sort argument is -1 -- +array(3) { + ["ONE"]=> + string(2) "un" + ["TWO"]=> + string(4) "deux" + ["THREE"]=> + string(5) "trois" +} + +-- $sort argument is 0 -- +array(3) { + ["one"]=> + string(2) "un" + ["two"]=> + string(4) "deux" + ["three"]=> + string(5) "trois" +} + +-- $sort argument is 1 -- +array(3) { + ["ONE"]=> + string(2) "un" + ["TWO"]=> + string(4) "deux" + ["THREE"]=> + string(5) "trois" +} + +-- $sort argument is 2 -- +array(3) { + ["ONE"]=> + string(2) "un" + ["TWO"]=> + string(4) "deux" + ["THREE"]=> + string(5) "trois" +} + +-- $sort argument is 3 -- +array(3) { + ["ONE"]=> + string(2) "un" + ["TWO"]=> + string(4) "deux" + ["THREE"]=> + string(5) "trois" +} + +-- $sort argument is 4 -- +array(3) { + ["ONE"]=> + string(2) "un" + ["TWO"]=> + string(4) "deux" + ["THREE"]=> + string(5) "trois" +} + +-- $sort argument is 5 -- +array(3) { + ["ONE"]=> + string(2) "un" + ["TWO"]=> + string(4) "deux" + ["THREE"]=> + string(5) "trois" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_change_key_case_variation5.phpt b/ext/standard/tests/array/array_change_key_case_variation5.phpt new file mode 100644 index 0000000..aa3852a --- /dev/null +++ b/ext/standard/tests/array/array_change_key_case_variation5.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test array_change_key_case() function : usage variations - position of internal pointer +--FILE-- + 'un', 'two' => 'deux', 'three' => 'trois'); + +echo "\n-- Call array_change_key_case() --\n"; +var_dump($result = array_change_key_case($input, CASE_UPPER)); + +echo "-- Position of Internal Pointer in Result: --\n"; +echo key($result) . " => " . current($result) . "\n"; +echo "\n-- Position of Internal Pointer in Original Array: --\n"; +echo key($input) . " => " . current ($input) . "\n"; + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_change_key_case() : usage variations *** + +-- Call array_change_key_case() -- +array(3) { + ["ONE"]=> + string(2) "un" + ["TWO"]=> + string(4) "deux" + ["THREE"]=> + string(5) "trois" +} +-- Position of Internal Pointer in Result: -- +ONE => un + +-- Position of Internal Pointer in Original Array: -- +one => un +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_change_key_case_variation6.phpt b/ext/standard/tests/array/array_change_key_case_variation6.phpt new file mode 100644 index 0000000..d4371d3 --- /dev/null +++ b/ext/standard/tests/array/array_change_key_case_variation6.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test array_change_key_case() function : usage variations - multidimensional arrays +--FILE-- + array('one' => 1, 'two' => 2, 'three' => 3), + 'French' => array('un' => 1, 'deux' => 2, 'trois' => 3), + 'German' => array('eins' => 1, 'zwei' => 2, 'drei' => 3)); + +echo "\n-- Pass a two-dimensional array as \$input argument --\n"; +var_dump(array_change_key_case($input, CASE_UPPER)); + +echo "\n-- Pass a sub-arry as \$input argument --\n"; +var_dump(array_change_key_case($input['English'], CASE_UPPER)); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_change_key_case() : usage variations *** + +-- Pass a two-dimensional array as $input argument -- +array(3) { + ["ENGLISH"]=> + array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + } + ["FRENCH"]=> + array(3) { + ["un"]=> + int(1) + ["deux"]=> + int(2) + ["trois"]=> + int(3) + } + ["GERMAN"]=> + array(3) { + ["eins"]=> + int(1) + ["zwei"]=> + int(2) + ["drei"]=> + int(3) + } +} + +-- Pass a sub-arry as $input argument -- +array(3) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["THREE"]=> + int(3) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_change_key_case_variation7.phpt b/ext/standard/tests/array/array_change_key_case_variation7.phpt new file mode 100644 index 0000000..8cbc23a --- /dev/null +++ b/ext/standard/tests/array/array_change_key_case_variation7.phpt @@ -0,0 +1,64 @@ +--TEST-- +Test array_change_key_case() function : usage variations - referenced variables +--FILE-- + 1, 'two' => 2, 'ABC' => 'xyz'); + +echo "\n-- \$input argument is a reference to array --\n"; +$new_input = &$input; +echo "Result:\n"; +var_dump(array_change_key_case($new_input, CASE_UPPER)); +echo "Original:\n"; +var_dump($input); +echo "Referenced:\n"; +var_dump($new_input); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_change_key_case() : usage variations *** + +-- $input argument is a reference to array -- +Result: +array(3) { + ["ONE"]=> + int(1) + ["TWO"]=> + int(2) + ["ABC"]=> + string(3) "xyz" +} +Original: +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["ABC"]=> + string(3) "xyz" +} +Referenced: +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["ABC"]=> + string(3) "xyz" +} +Done + diff --git a/ext/standard/tests/array/array_change_key_case_variation8.phpt b/ext/standard/tests/array/array_change_key_case_variation8.phpt new file mode 100644 index 0000000..3614800 --- /dev/null +++ b/ext/standard/tests/array/array_change_key_case_variation8.phpt @@ -0,0 +1,133 @@ +--TEST-- +Test array_change_key_case() function : usage variations - Different strings as keys +--SKIPIF-- + 1, NULL => 2, "\a" => 3, "\cx" => 4, "\e" => 5, "\f" => 6, "\n" => 7, "\t" => 8, "\xhh" => 9, "\ddd" => 10, "\v" => 11), + + // array contains combination of capital/small letters + array("lemoN" => 1, "Orange" => 2, "banana" => 3, "apple" => 4, "Test" => 5, "TTTT" => 6, "ttt" => 7, "ww" => 8, "x" => 9, "X" => 10, "oraNGe" => 11, "BANANA" => 12) +); + +foreach($inputs as $input) { + echo "\n-- \$case = default --\n"; + var_dump(array_change_key_case($input)); + echo "-- \$case = upper --\n"; + var_dump(array_change_key_case($input, CASE_UPPER)); +} + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_change_key_case() : usage variations *** + +-- $case = default -- +array(10) { + [""]=> + int(2) + ["\a"]=> + int(3) + ["\cx"]=> + int(4) + [""]=> + int(5) + [" "]=> + int(6) + [" +"]=> + int(7) + [" "]=> + int(8) + ["\xhh"]=> + int(9) + ["\ddd"]=> + int(10) + [" "]=> + int(11) +} +-- $case = upper -- +array(10) { + [""]=> + int(2) + ["\A"]=> + int(3) + ["\CX"]=> + int(4) + [""]=> + int(5) + [" "]=> + int(6) + [" +"]=> + int(7) + [" "]=> + int(8) + ["\XHH"]=> + int(9) + ["\DDD"]=> + int(10) + [" "]=> + int(11) +} + +-- $case = default -- +array(9) { + ["lemon"]=> + int(1) + ["orange"]=> + int(11) + ["banana"]=> + int(12) + ["apple"]=> + int(4) + ["test"]=> + int(5) + ["tttt"]=> + int(6) + ["ttt"]=> + int(7) + ["ww"]=> + int(8) + ["x"]=> + int(10) +} +-- $case = upper -- +array(9) { + ["LEMON"]=> + int(1) + ["ORANGE"]=> + int(11) + ["BANANA"]=> + int(12) + ["APPLE"]=> + int(4) + ["TEST"]=> + int(5) + ["TTTT"]=> + int(6) + ["TTT"]=> + int(7) + ["WW"]=> + int(8) + ["X"]=> + int(10) +} +Done diff --git a/ext/standard/tests/array/array_chunk.phpt b/ext/standard/tests/array/array_chunk.phpt new file mode 100644 index 0000000..2ee77e1 --- /dev/null +++ b/ext/standard/tests/array/array_chunk.phpt @@ -0,0 +1,21 @@ +--TEST-- +array_chunk() +--FILE-- + +--EXPECT-- +array(0) { +} +[0] +NULL +NULL +NULL diff --git a/ext/standard/tests/array/array_chunk2.phpt b/ext/standard/tests/array/array_chunk2.phpt new file mode 100644 index 0000000..2560332 --- /dev/null +++ b/ext/standard/tests/array/array_chunk2.phpt @@ -0,0 +1,146 @@ +--TEST-- +basic array_chunk test +--FILE-- + +--EXPECTF-- +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL +array(5) { + [0]=> + array(1) { + [0]=> + string(1) "a" + } + [1]=> + array(1) { + [0]=> + string(1) "b" + } + [2]=> + array(1) { + [0]=> + string(1) "c" + } + [3]=> + array(1) { + [0]=> + string(1) "d" + } + [4]=> + array(1) { + [0]=> + string(1) "e" + } +} +array(5) { + [0]=> + array(1) { + [0]=> + string(1) "a" + } + [1]=> + array(1) { + [1]=> + string(1) "b" + } + [2]=> + array(1) { + [2]=> + string(1) "c" + } + [3]=> + array(1) { + [3]=> + string(1) "d" + } + [4]=> + array(1) { + [4]=> + string(1) "e" + } +} +array(3) { + [0]=> + array(2) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + } + [1]=> + array(2) { + [0]=> + string(1) "c" + [1]=> + string(1) "d" + } + [2]=> + array(1) { + [0]=> + string(1) "e" + } +} +array(3) { + [0]=> + array(2) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + } + [1]=> + array(2) { + [2]=> + string(1) "c" + [3]=> + string(1) "d" + } + [2]=> + array(1) { + [4]=> + string(1) "e" + } +} +array(1) { + [0]=> + array(5) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + [3]=> + string(1) "d" + [4]=> + string(1) "e" + } +} +array(1) { + [0]=> + array(5) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + [3]=> + string(1) "d" + [4]=> + string(1) "e" + } +} diff --git a/ext/standard/tests/array/array_chunk_basic1.phpt b/ext/standard/tests/array/array_chunk_basic1.phpt new file mode 100644 index 0000000..56a90f4 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_basic1.phpt @@ -0,0 +1,138 @@ +--TEST-- +Test array_chunk() function : basic functionality - defualt 'preserve_keys' +--FILE-- + 1, "key2" => 2, "key3" => 3), + + // associative arrays - key as numeric + array(1 => 'one', 2 => "two", 3 => "three"), + + // array containing elements with/witout keys + array(1 => 'one','two', 3 => 'three', 4, "five" => 5) + +); + +$count = 1; +// loop through each element of the array for input +foreach ($input_arrays as $input_array){ + echo "\n-- Iteration $count --\n"; + var_dump( array_chunk($input_array, $size) ); + $count++; +} + +echo "Done" +?> +--EXPECTF-- +*** Testing array_chunk() : basic functionality *** + +-- Iteration 1 -- +array(3) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(2) { + [0]=> + int(3) + [1]=> + int(4) + } + [2]=> + array(1) { + [0]=> + int(5) + } +} + +-- Iteration 2 -- +array(2) { + [0]=> + array(2) { + [0]=> + string(6) "value1" + [1]=> + string(6) "value2" + } + [1]=> + array(1) { + [0]=> + string(6) "value3" + } +} + +-- Iteration 3 -- +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(1) { + [0]=> + int(3) + } +} + +-- Iteration 4 -- +array(2) { + [0]=> + array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + } + [1]=> + array(1) { + [0]=> + string(5) "three" + } +} + +-- Iteration 5 -- +array(3) { + [0]=> + array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + } + [1]=> + array(2) { + [0]=> + string(5) "three" + [1]=> + int(4) + } + [2]=> + array(1) { + [0]=> + int(5) + } +} +Done diff --git a/ext/standard/tests/array/array_chunk_basic2.phpt b/ext/standard/tests/array/array_chunk_basic2.phpt new file mode 100644 index 0000000..f96d863 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_basic2.phpt @@ -0,0 +1,222 @@ +--TEST-- +Test array_chunk() function : basic functionality - 'preserve_keys' as true/false +--FILE-- + 1, "key2" => 2, "key3" => 3), + + // associative arrays - key as numeric + array(1 => 'one', 2 => "two", 3 => "three"), + + // array containing elements with/without keys + array(1 => 'one','two', 3 => 'three', 4, "five" => 5) +); + +$count = 1; +// loop through each element of the array for input +foreach ($input_arrays as $input_array){ + echo "\n-- Iteration $count --\n"; + var_dump( array_chunk($input_array, $size, true) ); + var_dump( array_chunk($input_array, $size, false) ); + $count++; +} + +echo "Done" +?> +--EXPECTF-- +*** Testing array_chunk() : basic functionality *** + +-- Iteration 1 -- +array(3) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(2) { + [2]=> + int(3) + [3]=> + int(4) + } + [2]=> + array(1) { + [4]=> + int(5) + } +} +array(3) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(2) { + [0]=> + int(3) + [1]=> + int(4) + } + [2]=> + array(1) { + [0]=> + int(5) + } +} + +-- Iteration 2 -- +array(2) { + [0]=> + array(2) { + [0]=> + string(6) "value1" + [1]=> + string(6) "value2" + } + [1]=> + array(1) { + [2]=> + string(6) "value3" + } +} +array(2) { + [0]=> + array(2) { + [0]=> + string(6) "value1" + [1]=> + string(6) "value2" + } + [1]=> + array(1) { + [0]=> + string(6) "value3" + } +} + +-- Iteration 3 -- +array(2) { + [0]=> + array(2) { + ["key1"]=> + int(1) + ["key2"]=> + int(2) + } + [1]=> + array(1) { + ["key3"]=> + int(3) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(1) { + [0]=> + int(3) + } +} + +-- Iteration 4 -- +array(2) { + [0]=> + array(2) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + } + [1]=> + array(1) { + [3]=> + string(5) "three" + } +} +array(2) { + [0]=> + array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + } + [1]=> + array(1) { + [0]=> + string(5) "three" + } +} + +-- Iteration 5 -- +array(3) { + [0]=> + array(2) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + } + [1]=> + array(2) { + [3]=> + string(5) "three" + [4]=> + int(4) + } + [2]=> + array(1) { + ["five"]=> + int(5) + } +} +array(3) { + [0]=> + array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + } + [1]=> + array(2) { + [0]=> + string(5) "three" + [1]=> + int(4) + } + [2]=> + array(1) { + [0]=> + int(5) + } +} +Done diff --git a/ext/standard/tests/array/array_chunk_error.phpt b/ext/standard/tests/array/array_chunk_error.phpt new file mode 100644 index 0000000..5197945 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_error.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test array_chunk() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_chunk() : error conditions *** + +-- Testing array_chunk() function with zero arguments -- + +Warning: array_chunk() expects at least 2 parameters, 0 given in %s on line %d +NULL + +-- Testing array_chunk() function with more than expected no. of arguments -- + +Warning: array_chunk() expects at most 3 parameters, 4 given in %s on line %d +NULL + +-- Testing array_chunk() function with less than expected no. of arguments -- + +Warning: array_chunk() expects at least 2 parameters, 1 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_chunk_variation1.phpt b/ext/standard/tests/array/array_chunk_variation1.phpt new file mode 100644 index 0000000..caaf274 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation1.phpt @@ -0,0 +1,325 @@ +--TEST-- +Test array_chunk() function : usage variations - unexpected values for 'array' argument +--FILE-- + +--EXPECTF-- +*** Testing array_chunk() : usage variations *** + +-- Iteration 1 -- + +Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_chunk() expects parameter 1 to be array, object given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, object given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, object given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_chunk_variation10.phpt b/ext/standard/tests/array/array_chunk_variation10.phpt new file mode 100644 index 0000000..7b4bee1 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation10.phpt @@ -0,0 +1,159 @@ +--TEST-- +array_chunk() - variation 10 +--FILE-- + 1, 2 => 2, 3 => 3); +var_dump ($array); +for ($i = 0; $i < (sizeof($array) + 1); $i++) { + echo "[$i]\n"; + var_dump (@array_chunk ($array, $i)); + var_dump (@array_chunk ($array, $i, TRUE)); + var_dump (@array_chunk ($array, $i, FALSE)); + echo "\n"; +} +?> +--EXPECT-- +array(3) { + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) +} +[0] +NULL +NULL +NULL + +[1] +array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } +} +array(3) { + [0]=> + array(1) { + [1]=> + int(1) + } + [1]=> + array(1) { + [2]=> + int(2) + } + [2]=> + array(1) { + [3]=> + int(3) + } +} +array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } +} + +[2] +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(1) { + [0]=> + int(3) + } +} +array(2) { + [0]=> + array(2) { + [1]=> + int(1) + [2]=> + int(2) + } + [1]=> + array(1) { + [3]=> + int(3) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(1) { + [0]=> + int(3) + } +} + +[3] +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} +array(1) { + [0]=> + array(3) { + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + } +} +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation11.phpt b/ext/standard/tests/array/array_chunk_variation11.phpt new file mode 100644 index 0000000..dca3666 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation11.phpt @@ -0,0 +1,93 @@ +--TEST-- +array_chunk() - variation 11 +--FILE-- + 0, 3 => 2); + +var_dump ($array); +for ($i = 0; $i < (sizeof($array) + 1); $i++) { + echo "[$i]\n"; + var_dump (@array_chunk ($array, $i)); + var_dump (@array_chunk ($array, $i, TRUE)); + var_dump (@array_chunk ($array, $i, FALSE)); + echo "\n"; +} +?> +--EXPECT-- +array(2) { + [0]=> + int(0) + [3]=> + int(2) +} +[0] +NULL +NULL +NULL + +[1] +array(2) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} +array(2) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [3]=> + int(2) + } +} +array(2) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} + +[2] +array(1) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(2) + } +} +array(1) { + [0]=> + array(2) { + [0]=> + int(0) + [3]=> + int(2) + } +} +array(1) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(2) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation12.phpt b/ext/standard/tests/array/array_chunk_variation12.phpt new file mode 100644 index 0000000..3b87dba --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation12.phpt @@ -0,0 +1,159 @@ +--TEST-- +array_chunk() - variation 12 +--FILE-- + 1, 5 => 2, 8 => 3); +var_dump ($array); +for ($i = 0; $i < (sizeof($array) + 1); $i++) { + echo "[$i]\n"; + var_dump (@array_chunk ($array, $i)); + var_dump (@array_chunk ($array, $i, TRUE)); + var_dump (@array_chunk ($array, $i, FALSE)); + echo "\n"; +} +?> +--EXPECT-- +array(3) { + [1]=> + int(1) + [5]=> + int(2) + [8]=> + int(3) +} +[0] +NULL +NULL +NULL + +[1] +array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } +} +array(3) { + [0]=> + array(1) { + [1]=> + int(1) + } + [1]=> + array(1) { + [5]=> + int(2) + } + [2]=> + array(1) { + [8]=> + int(3) + } +} +array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } +} + +[2] +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(1) { + [0]=> + int(3) + } +} +array(2) { + [0]=> + array(2) { + [1]=> + int(1) + [5]=> + int(2) + } + [1]=> + array(1) { + [8]=> + int(3) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(1) { + [0]=> + int(3) + } +} + +[3] +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} +array(1) { + [0]=> + array(3) { + [1]=> + int(1) + [5]=> + int(2) + [8]=> + int(3) + } +} +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation13.phpt b/ext/standard/tests/array/array_chunk_variation13.phpt new file mode 100644 index 0000000..f6369df --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation13.phpt @@ -0,0 +1,92 @@ +--TEST-- +array_chunk() - variation 13 +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +[0] +NULL +NULL +NULL + +[1] +array(2) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} +array(2) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [1]=> + int(2) + } +} +array(2) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} + +[2] +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation14.phpt b/ext/standard/tests/array/array_chunk_variation14.phpt new file mode 100644 index 0000000..f8d1b11 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation14.phpt @@ -0,0 +1,159 @@ +--TEST-- +array_chunk() - variation 14 +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) +} +[0] +NULL +NULL +NULL + +[1] +array(3) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(1) + } + [2]=> + array(1) { + [0]=> + int(2) + } +} +array(3) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [1]=> + int(1) + } + [2]=> + array(1) { + [2]=> + int(2) + } +} +array(3) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(1) + } + [2]=> + array(1) { + [0]=> + int(2) + } +} + +[2] +array(2) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(1) + } + [1]=> + array(1) { + [2]=> + int(2) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} + +[3] +array(1) { + [0]=> + array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + } +} +array(1) { + [0]=> + array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + } +} +array(1) { + [0]=> + array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation15.phpt b/ext/standard/tests/array/array_chunk_variation15.phpt new file mode 100644 index 0000000..abec754 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation15.phpt @@ -0,0 +1,159 @@ +--TEST-- +array_chunk() - variation 15 +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +[0] +NULL +NULL +NULL + +[1] +array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } +} +array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [1]=> + int(2) + } + [2]=> + array(1) { + [2]=> + int(3) + } +} +array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } +} + +[2] +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(1) { + [0]=> + int(3) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(1) { + [2]=> + int(3) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(1) { + [0]=> + int(3) + } +} + +[3] +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation16.phpt b/ext/standard/tests/array/array_chunk_variation16.phpt new file mode 100644 index 0000000..18179c8 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation16.phpt @@ -0,0 +1,238 @@ +--TEST-- +array_chunk() - variation 16 +--FILE-- + +--EXPECT-- +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) +} +[0] +NULL +NULL +NULL + +[1] +array(4) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(1) + } + [2]=> + array(1) { + [0]=> + int(2) + } + [3]=> + array(1) { + [0]=> + int(3) + } +} +array(4) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [1]=> + int(1) + } + [2]=> + array(1) { + [2]=> + int(2) + } + [3]=> + array(1) { + [3]=> + int(3) + } +} +array(4) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(1) + } + [2]=> + array(1) { + [0]=> + int(2) + } + [3]=> + array(1) { + [0]=> + int(3) + } +} + +[2] +array(2) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(1) + } + [1]=> + array(2) { + [0]=> + int(2) + [1]=> + int(3) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(1) + } + [1]=> + array(2) { + [2]=> + int(2) + [3]=> + int(3) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(1) + } + [1]=> + array(2) { + [0]=> + int(2) + [1]=> + int(3) + } +} + +[3] +array(2) { + [0]=> + array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + } + [1]=> + array(1) { + [0]=> + int(3) + } +} +array(2) { + [0]=> + array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + } + [1]=> + array(1) { + [3]=> + int(3) + } +} +array(2) { + [0]=> + array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + } + [1]=> + array(1) { + [0]=> + int(3) + } +} + +[4] +array(1) { + [0]=> + array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + } +} +array(1) { + [0]=> + array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + } +} +array(1) { + [0]=> + array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation17.phpt b/ext/standard/tests/array/array_chunk_variation17.phpt new file mode 100644 index 0000000..27507ea --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation17.phpt @@ -0,0 +1,238 @@ +--TEST-- +array_chunk() - variation 17 +--FILE-- + +--EXPECT-- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) +} +[0] +NULL +NULL +NULL + +[1] +array(4) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } + [3]=> + array(1) { + [0]=> + int(4) + } +} +array(4) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [1]=> + int(2) + } + [2]=> + array(1) { + [2]=> + int(3) + } + [3]=> + array(1) { + [3]=> + int(4) + } +} +array(4) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } + [3]=> + array(1) { + [0]=> + int(4) + } +} + +[2] +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(2) { + [0]=> + int(3) + [1]=> + int(4) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(2) { + [2]=> + int(3) + [3]=> + int(4) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(2) { + [0]=> + int(3) + [1]=> + int(4) + } +} + +[3] +array(2) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [1]=> + array(1) { + [0]=> + int(4) + } +} +array(2) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [1]=> + array(1) { + [3]=> + int(4) + } +} +array(2) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [1]=> + array(1) { + [0]=> + int(4) + } +} + +[4] +array(1) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + } +} +array(1) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + } +} +array(1) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation18.phpt b/ext/standard/tests/array/array_chunk_variation18.phpt new file mode 100644 index 0000000..7f0946f --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation18.phpt @@ -0,0 +1,338 @@ +--TEST-- +array_chunk() - variation 18 +--FILE-- + +--EXPECT-- +array(5) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) +} +[0] +NULL +NULL +NULL + +[1] +array(5) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(1) + } + [2]=> + array(1) { + [0]=> + int(2) + } + [3]=> + array(1) { + [0]=> + int(3) + } + [4]=> + array(1) { + [0]=> + int(4) + } +} +array(5) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [1]=> + int(1) + } + [2]=> + array(1) { + [2]=> + int(2) + } + [3]=> + array(1) { + [3]=> + int(3) + } + [4]=> + array(1) { + [4]=> + int(4) + } +} +array(5) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(1) + } + [2]=> + array(1) { + [0]=> + int(2) + } + [3]=> + array(1) { + [0]=> + int(3) + } + [4]=> + array(1) { + [0]=> + int(4) + } +} + +[2] +array(3) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(1) + } + [1]=> + array(2) { + [0]=> + int(2) + [1]=> + int(3) + } + [2]=> + array(1) { + [0]=> + int(4) + } +} +array(3) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(1) + } + [1]=> + array(2) { + [2]=> + int(2) + [3]=> + int(3) + } + [2]=> + array(1) { + [4]=> + int(4) + } +} +array(3) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(1) + } + [1]=> + array(2) { + [0]=> + int(2) + [1]=> + int(3) + } + [2]=> + array(1) { + [0]=> + int(4) + } +} + +[3] +array(2) { + [0]=> + array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + } + [1]=> + array(2) { + [0]=> + int(3) + [1]=> + int(4) + } +} +array(2) { + [0]=> + array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + } + [1]=> + array(2) { + [3]=> + int(3) + [4]=> + int(4) + } +} +array(2) { + [0]=> + array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + } + [1]=> + array(2) { + [0]=> + int(3) + [1]=> + int(4) + } +} + +[4] +array(2) { + [0]=> + array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + } + [1]=> + array(1) { + [0]=> + int(4) + } +} +array(2) { + [0]=> + array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + } + [1]=> + array(1) { + [4]=> + int(4) + } +} +array(2) { + [0]=> + array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + } + [1]=> + array(1) { + [0]=> + int(4) + } +} + +[5] +array(1) { + [0]=> + array(5) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + } +} +array(1) { + [0]=> + array(5) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + } +} +array(1) { + [0]=> + array(5) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation19.phpt b/ext/standard/tests/array/array_chunk_variation19.phpt new file mode 100644 index 0000000..d51389c --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation19.phpt @@ -0,0 +1,1018 @@ +--TEST-- +array_chunk() - variation 19 +--FILE-- + +--EXPECT-- +array(10) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + [9]=> + int(10) +} +[0] +NULL +NULL +NULL + +[1] +array(10) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } + [3]=> + array(1) { + [0]=> + int(4) + } + [4]=> + array(1) { + [0]=> + int(5) + } + [5]=> + array(1) { + [0]=> + int(6) + } + [6]=> + array(1) { + [0]=> + int(7) + } + [7]=> + array(1) { + [0]=> + int(8) + } + [8]=> + array(1) { + [0]=> + int(9) + } + [9]=> + array(1) { + [0]=> + int(10) + } +} +array(10) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [1]=> + int(2) + } + [2]=> + array(1) { + [2]=> + int(3) + } + [3]=> + array(1) { + [3]=> + int(4) + } + [4]=> + array(1) { + [4]=> + int(5) + } + [5]=> + array(1) { + [5]=> + int(6) + } + [6]=> + array(1) { + [6]=> + int(7) + } + [7]=> + array(1) { + [7]=> + int(8) + } + [8]=> + array(1) { + [8]=> + int(9) + } + [9]=> + array(1) { + [9]=> + int(10) + } +} +array(10) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } + [3]=> + array(1) { + [0]=> + int(4) + } + [4]=> + array(1) { + [0]=> + int(5) + } + [5]=> + array(1) { + [0]=> + int(6) + } + [6]=> + array(1) { + [0]=> + int(7) + } + [7]=> + array(1) { + [0]=> + int(8) + } + [8]=> + array(1) { + [0]=> + int(9) + } + [9]=> + array(1) { + [0]=> + int(10) + } +} + +[2] +array(5) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(2) { + [0]=> + int(3) + [1]=> + int(4) + } + [2]=> + array(2) { + [0]=> + int(5) + [1]=> + int(6) + } + [3]=> + array(2) { + [0]=> + int(7) + [1]=> + int(8) + } + [4]=> + array(2) { + [0]=> + int(9) + [1]=> + int(10) + } +} +array(5) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(2) { + [2]=> + int(3) + [3]=> + int(4) + } + [2]=> + array(2) { + [4]=> + int(5) + [5]=> + int(6) + } + [3]=> + array(2) { + [6]=> + int(7) + [7]=> + int(8) + } + [4]=> + array(2) { + [8]=> + int(9) + [9]=> + int(10) + } +} +array(5) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(2) { + [0]=> + int(3) + [1]=> + int(4) + } + [2]=> + array(2) { + [0]=> + int(5) + [1]=> + int(6) + } + [3]=> + array(2) { + [0]=> + int(7) + [1]=> + int(8) + } + [4]=> + array(2) { + [0]=> + int(9) + [1]=> + int(10) + } +} + +[3] +array(4) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [1]=> + array(3) { + [0]=> + int(4) + [1]=> + int(5) + [2]=> + int(6) + } + [2]=> + array(3) { + [0]=> + int(7) + [1]=> + int(8) + [2]=> + int(9) + } + [3]=> + array(1) { + [0]=> + int(10) + } +} +array(4) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [1]=> + array(3) { + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + } + [2]=> + array(3) { + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + } + [3]=> + array(1) { + [9]=> + int(10) + } +} +array(4) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [1]=> + array(3) { + [0]=> + int(4) + [1]=> + int(5) + [2]=> + int(6) + } + [2]=> + array(3) { + [0]=> + int(7) + [1]=> + int(8) + [2]=> + int(9) + } + [3]=> + array(1) { + [0]=> + int(10) + } +} + +[4] +array(3) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + } + [1]=> + array(4) { + [0]=> + int(5) + [1]=> + int(6) + [2]=> + int(7) + [3]=> + int(8) + } + [2]=> + array(2) { + [0]=> + int(9) + [1]=> + int(10) + } +} +array(3) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + } + [1]=> + array(4) { + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + } + [2]=> + array(2) { + [8]=> + int(9) + [9]=> + int(10) + } +} +array(3) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + } + [1]=> + array(4) { + [0]=> + int(5) + [1]=> + int(6) + [2]=> + int(7) + [3]=> + int(8) + } + [2]=> + array(2) { + [0]=> + int(9) + [1]=> + int(10) + } +} + +[5] +array(2) { + [0]=> + array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + } + [1]=> + array(5) { + [0]=> + int(6) + [1]=> + int(7) + [2]=> + int(8) + [3]=> + int(9) + [4]=> + int(10) + } +} +array(2) { + [0]=> + array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + } + [1]=> + array(5) { + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + [9]=> + int(10) + } +} +array(2) { + [0]=> + array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + } + [1]=> + array(5) { + [0]=> + int(6) + [1]=> + int(7) + [2]=> + int(8) + [3]=> + int(9) + [4]=> + int(10) + } +} + +[6] +array(2) { + [0]=> + array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + } + [1]=> + array(4) { + [0]=> + int(7) + [1]=> + int(8) + [2]=> + int(9) + [3]=> + int(10) + } +} +array(2) { + [0]=> + array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + } + [1]=> + array(4) { + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + [9]=> + int(10) + } +} +array(2) { + [0]=> + array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + } + [1]=> + array(4) { + [0]=> + int(7) + [1]=> + int(8) + [2]=> + int(9) + [3]=> + int(10) + } +} + +[7] +array(2) { + [0]=> + array(7) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + } + [1]=> + array(3) { + [0]=> + int(8) + [1]=> + int(9) + [2]=> + int(10) + } +} +array(2) { + [0]=> + array(7) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + } + [1]=> + array(3) { + [7]=> + int(8) + [8]=> + int(9) + [9]=> + int(10) + } +} +array(2) { + [0]=> + array(7) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + } + [1]=> + array(3) { + [0]=> + int(8) + [1]=> + int(9) + [2]=> + int(10) + } +} + +[8] +array(2) { + [0]=> + array(8) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + } + [1]=> + array(2) { + [0]=> + int(9) + [1]=> + int(10) + } +} +array(2) { + [0]=> + array(8) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + } + [1]=> + array(2) { + [8]=> + int(9) + [9]=> + int(10) + } +} +array(2) { + [0]=> + array(8) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + } + [1]=> + array(2) { + [0]=> + int(9) + [1]=> + int(10) + } +} + +[9] +array(2) { + [0]=> + array(9) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + } + [1]=> + array(1) { + [0]=> + int(10) + } +} +array(2) { + [0]=> + array(9) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + } + [1]=> + array(1) { + [9]=> + int(10) + } +} +array(2) { + [0]=> + array(9) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + } + [1]=> + array(1) { + [0]=> + int(10) + } +} + +[10] +array(1) { + [0]=> + array(10) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + [9]=> + int(10) + } +} +array(1) { + [0]=> + array(10) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + [9]=> + int(10) + } +} +array(1) { + [0]=> + array(10) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + [9]=> + int(10) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation2.phpt b/ext/standard/tests/array/array_chunk_variation2.phpt new file mode 100644 index 0000000..8cfe994 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation2.phpt @@ -0,0 +1,427 @@ +--TEST-- +Test array_chunk() function : usage variations - unexpected values for 'size' argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data +/*11*/ NULL, + null, + + // boolean data +/*13*/ true, + false, + TRUE, + FALSE, + + // empty data +/*17*/ "", + '', + + // string data +/*19*/ "string", + 'string', + + // object data +/*21*/ new stdclass(), + + // undefined data +/*22*/ @undefined_var, + + // unset data +/*23*/ @unset_var + +); + +// loop through each element of the array for size +$count = 1; +foreach($values as $value){ + echo "\n-- Iteration $count --\n"; + var_dump( array_chunk($input, $value) ); + var_dump( array_chunk($input, $value, true) ); + var_dump( array_chunk($input, $value, false) ); + $count++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_chunk() : usage variations *** + +-- Iteration 1 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 2 -- + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +-- Iteration 3 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 4 -- + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +-- Iteration 13 -- +array(2) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} +array(2) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [1]=> + int(2) + } +} +array(2) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} + +-- Iteration 14 -- + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +-- Iteration 15 -- +array(2) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} +array(2) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [1]=> + int(2) + } +} +array(2) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} + +-- Iteration 16 -- + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_chunk() expects parameter 2 to be long, object given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, object given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, object given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_chunk_variation20.phpt b/ext/standard/tests/array/array_chunk_variation20.phpt new file mode 100644 index 0000000..cd5314f --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation20.phpt @@ -0,0 +1,1199 @@ +--TEST-- +array_chunk() - variation 20 +--FILE-- + +--EXPECT-- +array(11) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + [8]=> + int(8) + [9]=> + int(9) + [10]=> + int(10) +} +[0] +NULL +NULL +NULL + +[1] +array(11) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(1) + } + [2]=> + array(1) { + [0]=> + int(2) + } + [3]=> + array(1) { + [0]=> + int(3) + } + [4]=> + array(1) { + [0]=> + int(4) + } + [5]=> + array(1) { + [0]=> + int(5) + } + [6]=> + array(1) { + [0]=> + int(6) + } + [7]=> + array(1) { + [0]=> + int(7) + } + [8]=> + array(1) { + [0]=> + int(8) + } + [9]=> + array(1) { + [0]=> + int(9) + } + [10]=> + array(1) { + [0]=> + int(10) + } +} +array(11) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [1]=> + int(1) + } + [2]=> + array(1) { + [2]=> + int(2) + } + [3]=> + array(1) { + [3]=> + int(3) + } + [4]=> + array(1) { + [4]=> + int(4) + } + [5]=> + array(1) { + [5]=> + int(5) + } + [6]=> + array(1) { + [6]=> + int(6) + } + [7]=> + array(1) { + [7]=> + int(7) + } + [8]=> + array(1) { + [8]=> + int(8) + } + [9]=> + array(1) { + [9]=> + int(9) + } + [10]=> + array(1) { + [10]=> + int(10) + } +} +array(11) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(1) + } + [2]=> + array(1) { + [0]=> + int(2) + } + [3]=> + array(1) { + [0]=> + int(3) + } + [4]=> + array(1) { + [0]=> + int(4) + } + [5]=> + array(1) { + [0]=> + int(5) + } + [6]=> + array(1) { + [0]=> + int(6) + } + [7]=> + array(1) { + [0]=> + int(7) + } + [8]=> + array(1) { + [0]=> + int(8) + } + [9]=> + array(1) { + [0]=> + int(9) + } + [10]=> + array(1) { + [0]=> + int(10) + } +} + +[2] +array(6) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(1) + } + [1]=> + array(2) { + [0]=> + int(2) + [1]=> + int(3) + } + [2]=> + array(2) { + [0]=> + int(4) + [1]=> + int(5) + } + [3]=> + array(2) { + [0]=> + int(6) + [1]=> + int(7) + } + [4]=> + array(2) { + [0]=> + int(8) + [1]=> + int(9) + } + [5]=> + array(1) { + [0]=> + int(10) + } +} +array(6) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(1) + } + [1]=> + array(2) { + [2]=> + int(2) + [3]=> + int(3) + } + [2]=> + array(2) { + [4]=> + int(4) + [5]=> + int(5) + } + [3]=> + array(2) { + [6]=> + int(6) + [7]=> + int(7) + } + [4]=> + array(2) { + [8]=> + int(8) + [9]=> + int(9) + } + [5]=> + array(1) { + [10]=> + int(10) + } +} +array(6) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(1) + } + [1]=> + array(2) { + [0]=> + int(2) + [1]=> + int(3) + } + [2]=> + array(2) { + [0]=> + int(4) + [1]=> + int(5) + } + [3]=> + array(2) { + [0]=> + int(6) + [1]=> + int(7) + } + [4]=> + array(2) { + [0]=> + int(8) + [1]=> + int(9) + } + [5]=> + array(1) { + [0]=> + int(10) + } +} + +[3] +array(4) { + [0]=> + array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + } + [1]=> + array(3) { + [0]=> + int(3) + [1]=> + int(4) + [2]=> + int(5) + } + [2]=> + array(3) { + [0]=> + int(6) + [1]=> + int(7) + [2]=> + int(8) + } + [3]=> + array(2) { + [0]=> + int(9) + [1]=> + int(10) + } +} +array(4) { + [0]=> + array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + } + [1]=> + array(3) { + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + } + [2]=> + array(3) { + [6]=> + int(6) + [7]=> + int(7) + [8]=> + int(8) + } + [3]=> + array(2) { + [9]=> + int(9) + [10]=> + int(10) + } +} +array(4) { + [0]=> + array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + } + [1]=> + array(3) { + [0]=> + int(3) + [1]=> + int(4) + [2]=> + int(5) + } + [2]=> + array(3) { + [0]=> + int(6) + [1]=> + int(7) + [2]=> + int(8) + } + [3]=> + array(2) { + [0]=> + int(9) + [1]=> + int(10) + } +} + +[4] +array(3) { + [0]=> + array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + } + [1]=> + array(4) { + [0]=> + int(4) + [1]=> + int(5) + [2]=> + int(6) + [3]=> + int(7) + } + [2]=> + array(3) { + [0]=> + int(8) + [1]=> + int(9) + [2]=> + int(10) + } +} +array(3) { + [0]=> + array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + } + [1]=> + array(4) { + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + } + [2]=> + array(3) { + [8]=> + int(8) + [9]=> + int(9) + [10]=> + int(10) + } +} +array(3) { + [0]=> + array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + } + [1]=> + array(4) { + [0]=> + int(4) + [1]=> + int(5) + [2]=> + int(6) + [3]=> + int(7) + } + [2]=> + array(3) { + [0]=> + int(8) + [1]=> + int(9) + [2]=> + int(10) + } +} + +[5] +array(3) { + [0]=> + array(5) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + } + [1]=> + array(5) { + [0]=> + int(5) + [1]=> + int(6) + [2]=> + int(7) + [3]=> + int(8) + [4]=> + int(9) + } + [2]=> + array(1) { + [0]=> + int(10) + } +} +array(3) { + [0]=> + array(5) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + } + [1]=> + array(5) { + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + [8]=> + int(8) + [9]=> + int(9) + } + [2]=> + array(1) { + [10]=> + int(10) + } +} +array(3) { + [0]=> + array(5) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + } + [1]=> + array(5) { + [0]=> + int(5) + [1]=> + int(6) + [2]=> + int(7) + [3]=> + int(8) + [4]=> + int(9) + } + [2]=> + array(1) { + [0]=> + int(10) + } +} + +[6] +array(2) { + [0]=> + array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + } + [1]=> + array(5) { + [0]=> + int(6) + [1]=> + int(7) + [2]=> + int(8) + [3]=> + int(9) + [4]=> + int(10) + } +} +array(2) { + [0]=> + array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + } + [1]=> + array(5) { + [6]=> + int(6) + [7]=> + int(7) + [8]=> + int(8) + [9]=> + int(9) + [10]=> + int(10) + } +} +array(2) { + [0]=> + array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + } + [1]=> + array(5) { + [0]=> + int(6) + [1]=> + int(7) + [2]=> + int(8) + [3]=> + int(9) + [4]=> + int(10) + } +} + +[7] +array(2) { + [0]=> + array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + } + [1]=> + array(4) { + [0]=> + int(7) + [1]=> + int(8) + [2]=> + int(9) + [3]=> + int(10) + } +} +array(2) { + [0]=> + array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + } + [1]=> + array(4) { + [7]=> + int(7) + [8]=> + int(8) + [9]=> + int(9) + [10]=> + int(10) + } +} +array(2) { + [0]=> + array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + } + [1]=> + array(4) { + [0]=> + int(7) + [1]=> + int(8) + [2]=> + int(9) + [3]=> + int(10) + } +} + +[8] +array(2) { + [0]=> + array(8) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + } + [1]=> + array(3) { + [0]=> + int(8) + [1]=> + int(9) + [2]=> + int(10) + } +} +array(2) { + [0]=> + array(8) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + } + [1]=> + array(3) { + [8]=> + int(8) + [9]=> + int(9) + [10]=> + int(10) + } +} +array(2) { + [0]=> + array(8) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + } + [1]=> + array(3) { + [0]=> + int(8) + [1]=> + int(9) + [2]=> + int(10) + } +} + +[9] +array(2) { + [0]=> + array(9) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + [8]=> + int(8) + } + [1]=> + array(2) { + [0]=> + int(9) + [1]=> + int(10) + } +} +array(2) { + [0]=> + array(9) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + [8]=> + int(8) + } + [1]=> + array(2) { + [9]=> + int(9) + [10]=> + int(10) + } +} +array(2) { + [0]=> + array(9) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + [8]=> + int(8) + } + [1]=> + array(2) { + [0]=> + int(9) + [1]=> + int(10) + } +} + +[10] +array(2) { + [0]=> + array(10) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + [8]=> + int(8) + [9]=> + int(9) + } + [1]=> + array(1) { + [0]=> + int(10) + } +} +array(2) { + [0]=> + array(10) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + [8]=> + int(8) + [9]=> + int(9) + } + [1]=> + array(1) { + [10]=> + int(10) + } +} +array(2) { + [0]=> + array(10) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + [8]=> + int(8) + [9]=> + int(9) + } + [1]=> + array(1) { + [0]=> + int(10) + } +} + +[11] +array(1) { + [0]=> + array(11) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + [8]=> + int(8) + [9]=> + int(9) + [10]=> + int(10) + } +} +array(1) { + [0]=> + array(11) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + [8]=> + int(8) + [9]=> + int(9) + [10]=> + int(10) + } +} +array(1) { + [0]=> + array(11) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) + [7]=> + int(7) + [8]=> + int(8) + [9]=> + int(9) + [10]=> + int(10) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation21.phpt b/ext/standard/tests/array/array_chunk_variation21.phpt new file mode 100644 index 0000000..678bf16 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation21.phpt @@ -0,0 +1,46 @@ +--TEST-- +array_chunk() - variation 21 +--FILE-- + 1); +var_dump ($array); +for ($i = 0; $i < (sizeof($array) + 1); $i++) { + echo "[$i]\n"; + var_dump (@array_chunk ($array, $i)); + var_dump (@array_chunk ($array, $i, TRUE)); + var_dump (@array_chunk ($array, $i, FALSE)); + echo "\n"; +} +?> +--EXPECT-- +array(1) { + ["a"]=> + int(1) +} +[0] +NULL +NULL +NULL + +[1] +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} +array(1) { + [0]=> + array(1) { + ["a"]=> + int(1) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation22.phpt b/ext/standard/tests/array/array_chunk_variation22.phpt new file mode 100644 index 0000000..45c458e --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation22.phpt @@ -0,0 +1,92 @@ +--TEST-- +array_chunk() - variation 22 +--FILE-- + 1, "c" => 2); +var_dump ($array); +for ($i = 0; $i < (sizeof($array) + 1); $i++) { + echo "[$i]\n"; + var_dump (@array_chunk ($array, $i)); + var_dump (@array_chunk ($array, $i, TRUE)); + var_dump (@array_chunk ($array, $i, FALSE)); + echo "\n"; +} +?> +--EXPECT-- +array(2) { + ["b"]=> + int(1) + ["c"]=> + int(2) +} +[0] +NULL +NULL +NULL + +[1] +array(2) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} +array(2) { + [0]=> + array(1) { + ["b"]=> + int(1) + } + [1]=> + array(1) { + ["c"]=> + int(2) + } +} +array(2) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} + +[2] +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} +array(1) { + [0]=> + array(2) { + ["b"]=> + int(1) + ["c"]=> + int(2) + } +} +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation23.phpt b/ext/standard/tests/array/array_chunk_variation23.phpt new file mode 100644 index 0000000..80b9298 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation23.phpt @@ -0,0 +1,441 @@ +--TEST-- +array_chunk() - variation 23 +--FILE-- + 1, "q" => 2, "r" => 3, "s" => 4, "u" => 5, "v" => 6); +var_dump ($array); +for ($i = 0; $i < (sizeof($array) + 1); $i++) { + echo "[$i]\n"; + var_dump (@array_chunk ($array, $i)); + var_dump (@array_chunk ($array, $i, TRUE)); + var_dump (@array_chunk ($array, $i, FALSE)); + echo "\n"; +} +?> +--EXPECT-- +array(6) { + ["p"]=> + int(1) + ["q"]=> + int(2) + ["r"]=> + int(3) + ["s"]=> + int(4) + ["u"]=> + int(5) + ["v"]=> + int(6) +} +[0] +NULL +NULL +NULL + +[1] +array(6) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } + [3]=> + array(1) { + [0]=> + int(4) + } + [4]=> + array(1) { + [0]=> + int(5) + } + [5]=> + array(1) { + [0]=> + int(6) + } +} +array(6) { + [0]=> + array(1) { + ["p"]=> + int(1) + } + [1]=> + array(1) { + ["q"]=> + int(2) + } + [2]=> + array(1) { + ["r"]=> + int(3) + } + [3]=> + array(1) { + ["s"]=> + int(4) + } + [4]=> + array(1) { + ["u"]=> + int(5) + } + [5]=> + array(1) { + ["v"]=> + int(6) + } +} +array(6) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } + [3]=> + array(1) { + [0]=> + int(4) + } + [4]=> + array(1) { + [0]=> + int(5) + } + [5]=> + array(1) { + [0]=> + int(6) + } +} + +[2] +array(3) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(2) { + [0]=> + int(3) + [1]=> + int(4) + } + [2]=> + array(2) { + [0]=> + int(5) + [1]=> + int(6) + } +} +array(3) { + [0]=> + array(2) { + ["p"]=> + int(1) + ["q"]=> + int(2) + } + [1]=> + array(2) { + ["r"]=> + int(3) + ["s"]=> + int(4) + } + [2]=> + array(2) { + ["u"]=> + int(5) + ["v"]=> + int(6) + } +} +array(3) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(2) { + [0]=> + int(3) + [1]=> + int(4) + } + [2]=> + array(2) { + [0]=> + int(5) + [1]=> + int(6) + } +} + +[3] +array(2) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [1]=> + array(3) { + [0]=> + int(4) + [1]=> + int(5) + [2]=> + int(6) + } +} +array(2) { + [0]=> + array(3) { + ["p"]=> + int(1) + ["q"]=> + int(2) + ["r"]=> + int(3) + } + [1]=> + array(3) { + ["s"]=> + int(4) + ["u"]=> + int(5) + ["v"]=> + int(6) + } +} +array(2) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [1]=> + array(3) { + [0]=> + int(4) + [1]=> + int(5) + [2]=> + int(6) + } +} + +[4] +array(2) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + } + [1]=> + array(2) { + [0]=> + int(5) + [1]=> + int(6) + } +} +array(2) { + [0]=> + array(4) { + ["p"]=> + int(1) + ["q"]=> + int(2) + ["r"]=> + int(3) + ["s"]=> + int(4) + } + [1]=> + array(2) { + ["u"]=> + int(5) + ["v"]=> + int(6) + } +} +array(2) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + } + [1]=> + array(2) { + [0]=> + int(5) + [1]=> + int(6) + } +} + +[5] +array(2) { + [0]=> + array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + } + [1]=> + array(1) { + [0]=> + int(6) + } +} +array(2) { + [0]=> + array(5) { + ["p"]=> + int(1) + ["q"]=> + int(2) + ["r"]=> + int(3) + ["s"]=> + int(4) + ["u"]=> + int(5) + } + [1]=> + array(1) { + ["v"]=> + int(6) + } +} +array(2) { + [0]=> + array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + } + [1]=> + array(1) { + [0]=> + int(6) + } +} + +[6] +array(1) { + [0]=> + array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + } +} +array(1) { + [0]=> + array(6) { + ["p"]=> + int(1) + ["q"]=> + int(2) + ["r"]=> + int(3) + ["s"]=> + int(4) + ["u"]=> + int(5) + ["v"]=> + int(6) + } +} +array(1) { + [0]=> + array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation24.phpt b/ext/standard/tests/array/array_chunk_variation24.phpt new file mode 100644 index 0000000..e25f53f --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation24.phpt @@ -0,0 +1,46 @@ +--TEST-- +array_chunk() - variation 24 +--FILE-- + "A"); +var_dump ($array); +for ($i = 0; $i < (sizeof($array) + 1); $i++) { + echo "[$i]\n"; + var_dump (@array_chunk ($array, $i)); + var_dump (@array_chunk ($array, $i, TRUE)); + var_dump (@array_chunk ($array, $i, FALSE)); + echo "\n"; +} +?> +--EXPECT-- +array(1) { + ["a"]=> + string(1) "A" +} +[0] +NULL +NULL +NULL + +[1] +array(1) { + [0]=> + array(1) { + [0]=> + string(1) "A" + } +} +array(1) { + [0]=> + array(1) { + ["a"]=> + string(1) "A" + } +} +array(1) { + [0]=> + array(1) { + [0]=> + string(1) "A" + } +} diff --git a/ext/standard/tests/array/array_chunk_variation25.phpt b/ext/standard/tests/array/array_chunk_variation25.phpt new file mode 100644 index 0000000..eae89e9 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation25.phpt @@ -0,0 +1,441 @@ +--TEST-- +array_chunk() - variation 25 +--FILE-- + "A", "q" => "B", "r" => "C", "s" => "D", "u" => "E", "v" => "F"); +var_dump ($array); +for ($i = 0; $i < (sizeof($array) + 1); $i++) { + echo "[$i]\n"; + var_dump (@array_chunk ($array, $i)); + var_dump (@array_chunk ($array, $i, TRUE)); + var_dump (@array_chunk ($array, $i, FALSE)); + echo "\n"; +} +?> +--EXPECT-- +array(6) { + ["p"]=> + string(1) "A" + ["q"]=> + string(1) "B" + ["r"]=> + string(1) "C" + ["s"]=> + string(1) "D" + ["u"]=> + string(1) "E" + ["v"]=> + string(1) "F" +} +[0] +NULL +NULL +NULL + +[1] +array(6) { + [0]=> + array(1) { + [0]=> + string(1) "A" + } + [1]=> + array(1) { + [0]=> + string(1) "B" + } + [2]=> + array(1) { + [0]=> + string(1) "C" + } + [3]=> + array(1) { + [0]=> + string(1) "D" + } + [4]=> + array(1) { + [0]=> + string(1) "E" + } + [5]=> + array(1) { + [0]=> + string(1) "F" + } +} +array(6) { + [0]=> + array(1) { + ["p"]=> + string(1) "A" + } + [1]=> + array(1) { + ["q"]=> + string(1) "B" + } + [2]=> + array(1) { + ["r"]=> + string(1) "C" + } + [3]=> + array(1) { + ["s"]=> + string(1) "D" + } + [4]=> + array(1) { + ["u"]=> + string(1) "E" + } + [5]=> + array(1) { + ["v"]=> + string(1) "F" + } +} +array(6) { + [0]=> + array(1) { + [0]=> + string(1) "A" + } + [1]=> + array(1) { + [0]=> + string(1) "B" + } + [2]=> + array(1) { + [0]=> + string(1) "C" + } + [3]=> + array(1) { + [0]=> + string(1) "D" + } + [4]=> + array(1) { + [0]=> + string(1) "E" + } + [5]=> + array(1) { + [0]=> + string(1) "F" + } +} + +[2] +array(3) { + [0]=> + array(2) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + } + [1]=> + array(2) { + [0]=> + string(1) "C" + [1]=> + string(1) "D" + } + [2]=> + array(2) { + [0]=> + string(1) "E" + [1]=> + string(1) "F" + } +} +array(3) { + [0]=> + array(2) { + ["p"]=> + string(1) "A" + ["q"]=> + string(1) "B" + } + [1]=> + array(2) { + ["r"]=> + string(1) "C" + ["s"]=> + string(1) "D" + } + [2]=> + array(2) { + ["u"]=> + string(1) "E" + ["v"]=> + string(1) "F" + } +} +array(3) { + [0]=> + array(2) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + } + [1]=> + array(2) { + [0]=> + string(1) "C" + [1]=> + string(1) "D" + } + [2]=> + array(2) { + [0]=> + string(1) "E" + [1]=> + string(1) "F" + } +} + +[3] +array(2) { + [0]=> + array(3) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" + } + [1]=> + array(3) { + [0]=> + string(1) "D" + [1]=> + string(1) "E" + [2]=> + string(1) "F" + } +} +array(2) { + [0]=> + array(3) { + ["p"]=> + string(1) "A" + ["q"]=> + string(1) "B" + ["r"]=> + string(1) "C" + } + [1]=> + array(3) { + ["s"]=> + string(1) "D" + ["u"]=> + string(1) "E" + ["v"]=> + string(1) "F" + } +} +array(2) { + [0]=> + array(3) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" + } + [1]=> + array(3) { + [0]=> + string(1) "D" + [1]=> + string(1) "E" + [2]=> + string(1) "F" + } +} + +[4] +array(2) { + [0]=> + array(4) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" + [3]=> + string(1) "D" + } + [1]=> + array(2) { + [0]=> + string(1) "E" + [1]=> + string(1) "F" + } +} +array(2) { + [0]=> + array(4) { + ["p"]=> + string(1) "A" + ["q"]=> + string(1) "B" + ["r"]=> + string(1) "C" + ["s"]=> + string(1) "D" + } + [1]=> + array(2) { + ["u"]=> + string(1) "E" + ["v"]=> + string(1) "F" + } +} +array(2) { + [0]=> + array(4) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" + [3]=> + string(1) "D" + } + [1]=> + array(2) { + [0]=> + string(1) "E" + [1]=> + string(1) "F" + } +} + +[5] +array(2) { + [0]=> + array(5) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" + [3]=> + string(1) "D" + [4]=> + string(1) "E" + } + [1]=> + array(1) { + [0]=> + string(1) "F" + } +} +array(2) { + [0]=> + array(5) { + ["p"]=> + string(1) "A" + ["q"]=> + string(1) "B" + ["r"]=> + string(1) "C" + ["s"]=> + string(1) "D" + ["u"]=> + string(1) "E" + } + [1]=> + array(1) { + ["v"]=> + string(1) "F" + } +} +array(2) { + [0]=> + array(5) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" + [3]=> + string(1) "D" + [4]=> + string(1) "E" + } + [1]=> + array(1) { + [0]=> + string(1) "F" + } +} + +[6] +array(1) { + [0]=> + array(6) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" + [3]=> + string(1) "D" + [4]=> + string(1) "E" + [5]=> + string(1) "F" + } +} +array(1) { + [0]=> + array(6) { + ["p"]=> + string(1) "A" + ["q"]=> + string(1) "B" + ["r"]=> + string(1) "C" + ["s"]=> + string(1) "D" + ["u"]=> + string(1) "E" + ["v"]=> + string(1) "F" + } +} +array(1) { + [0]=> + array(6) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" + [3]=> + string(1) "D" + [4]=> + string(1) "E" + [5]=> + string(1) "F" + } +} diff --git a/ext/standard/tests/array/array_chunk_variation26.phpt b/ext/standard/tests/array/array_chunk_variation26.phpt new file mode 100644 index 0000000..487f6b4 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation26.phpt @@ -0,0 +1,46 @@ +--TEST-- +array_chunk() - variation 26 +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + int(0) +} +[0] +NULL +NULL +NULL + +[1] +array(1) { + [0]=> + array(1) { + [0]=> + int(0) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(0) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(0) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation27.phpt b/ext/standard/tests/array/array_chunk_variation27.phpt new file mode 100644 index 0000000..a83a16b --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation27.phpt @@ -0,0 +1,46 @@ +--TEST-- +array_chunk() - variation 27 +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + int(1) +} +[0] +NULL +NULL +NULL + +[1] +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation28.phpt b/ext/standard/tests/array/array_chunk_variation28.phpt new file mode 100644 index 0000000..bdbaf45 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation28.phpt @@ -0,0 +1,46 @@ +--TEST-- +array_chunk() - variation 28 +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + int(-1) +} +[0] +NULL +NULL +NULL + +[1] +array(1) { + [0]=> + array(1) { + [0]=> + int(-1) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(-1) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(-1) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation29.phpt b/ext/standard/tests/array/array_chunk_variation29.phpt new file mode 100644 index 0000000..12f50c1 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation29.phpt @@ -0,0 +1,92 @@ +--TEST-- +array_chunk() - variation 29 +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + int(0) + [1]=> + int(2) +} +[0] +NULL +NULL +NULL + +[1] +array(2) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} +array(2) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [1]=> + int(2) + } +} +array(2) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} + +[2] +array(1) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(2) + } +} +array(1) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(2) + } +} +array(1) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(2) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation3.phpt b/ext/standard/tests/array/array_chunk_variation3.phpt new file mode 100644 index 0000000..452006a --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation3.phpt @@ -0,0 +1,268 @@ +--TEST-- +Test array_chunk() function : usage variations - unexpected values for 'preserve_keys' +--FILE-- + +--EXPECTF-- +*** Testing array_chunk() : usage variations *** + +-- Iteration 1 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 2 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 3 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 4 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 5 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 6 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 7 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 8 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 9 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 10 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 11 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 12 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 13 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 14 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 15 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 16 -- + +Warning: array_chunk() expects parameter 3 to be boolean, object given in %s on line %d +NULL + +-- Iteration 17 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +-- Iteration 18 -- +array(1) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} +Done diff --git a/ext/standard/tests/array/array_chunk_variation30.phpt b/ext/standard/tests/array/array_chunk_variation30.phpt new file mode 100644 index 0000000..281537a --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation30.phpt @@ -0,0 +1,159 @@ +--TEST-- +array_chunk() - variation 30 +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +[0] +NULL +NULL +NULL + +[1] +array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } +} +array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [1]=> + int(2) + } + [2]=> + array(1) { + [2]=> + int(3) + } +} +array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } +} + +[2] +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(1) { + [0]=> + int(3) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(1) { + [2]=> + int(3) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(1) { + [0]=> + int(3) + } +} + +[3] +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation31.phpt b/ext/standard/tests/array/array_chunk_variation31.phpt new file mode 100644 index 0000000..1592679 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation31.phpt @@ -0,0 +1,46 @@ +--TEST-- +array_chunk() - variation 31 +--FILE-- + 0); +var_dump ($array); +for ($i = 0; $i < (sizeof($array) + 1); $i++) { + echo "[$i]\n"; + var_dump (@array_chunk ($array, $i)); + var_dump (@array_chunk ($array, $i, TRUE)); + var_dump (@array_chunk ($array, $i, FALSE)); + echo "\n"; +} +?> +--EXPECT-- +array(1) { + [1]=> + int(0) +} +[0] +NULL +NULL +NULL + +[1] +array(1) { + [0]=> + array(1) { + [0]=> + int(0) + } +} +array(1) { + [0]=> + array(1) { + [1]=> + int(0) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(0) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation32.phpt b/ext/standard/tests/array/array_chunk_variation32.phpt new file mode 100644 index 0000000..cf65993 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation32.phpt @@ -0,0 +1,46 @@ +--TEST-- +array_chunk() - variation 32 +--FILE-- + 1); +var_dump ($array); +for ($i = 0; $i < (sizeof($array) + 1); $i++) { + echo "[$i]\n"; + var_dump (@array_chunk ($array, $i)); + var_dump (@array_chunk ($array, $i, TRUE)); + var_dump (@array_chunk ($array, $i, FALSE)); + echo "\n"; +} +?> +--EXPECT-- +array(1) { + [2]=> + int(1) +} +[0] +NULL +NULL +NULL + +[1] +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} +array(1) { + [0]=> + array(1) { + [2]=> + int(1) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation4.phpt b/ext/standard/tests/array/array_chunk_variation4.phpt new file mode 100644 index 0000000..7f04f51 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation4.phpt @@ -0,0 +1,120 @@ +--TEST-- +Test array_chunk() function : usage variations - array with diff. sub arrays +--FILE-- + array(), + "array2" => array(1, 2, 3), + "array3" => array(1) +); + +echo "\n-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' as defualt --\n"; +var_dump( array_chunk($input_array, $size) ); + +echo "\n-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' = true --\n"; +var_dump( array_chunk($input_array, $size, true) ); + +echo "\n-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' = false --\n"; +var_dump( array_chunk($input_array, $size, false) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_chunk() : usage variations *** + +-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' as defualt -- +array(2) { + [0]=> + array(2) { + [0]=> + array(0) { + } + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + } + [1]=> + array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } + } +} + +-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' = true -- +array(2) { + [0]=> + array(2) { + ["array1"]=> + array(0) { + } + ["array2"]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + } + [1]=> + array(1) { + ["array3"]=> + array(1) { + [0]=> + int(1) + } + } +} + +-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' = false -- +array(2) { + [0]=> + array(2) { + [0]=> + array(0) { + } + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + } + [1]=> + array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } + } +} +Done diff --git a/ext/standard/tests/array/array_chunk_variation5.phpt b/ext/standard/tests/array/array_chunk_variation5.phpt new file mode 100644 index 0000000..8d36092 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation5.phpt @@ -0,0 +1,148 @@ +--TEST-- +Test array_chunk() function : usage variations - different 'size' values +--FILE-- + +--EXPECTF-- +*** Testing array_chunk() : usage variations *** + +-- Testing array_chunk() when size = -1 -- + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +-- Testing array_chunk() when size = 4 -- +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} + +-- Testing array_chunk() when size = 0 -- + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d +NULL + +-- Testing array_chunk() when size = 1.5 -- +array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } +} +array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [1]=> + int(2) + } + [2]=> + array(1) { + [2]=> + int(3) + } +} +array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(3) + } +} +Done diff --git a/ext/standard/tests/array/array_chunk_variation6.phpt b/ext/standard/tests/array/array_chunk_variation6.phpt new file mode 100644 index 0000000..f44eb39 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation6.phpt @@ -0,0 +1,135 @@ +--TEST-- +Test array_chunk() function : usage variations - different arrays +--FILE-- + array(), + + // array with one element + "array2" => array(1), + + // associative array with duplicate keys + "array3" => array("a" => 1, "b" => 2, "c" => 3, "a" => 4, "d" => 5) + +); + +$size = 2; +$count = 1; + +echo "\n-- Testing array_chunk() by supplying various arrays --\n"; + +// loop through the array for 'array' argument +foreach ($input_arrays as $input_array){ + echo "\n-- Iteration $count --\n"; + var_dump( array_chunk($input_array, $size) ); + var_dump( array_chunk($input_array, $size, true) ); + var_dump( array_chunk($input_array, $size, false) ); + $count++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_chunk() : usage variations *** + +-- Testing array_chunk() by supplying various arrays -- + +-- Iteration 1 -- +array(0) { +} +array(0) { +} +array(0) { +} + +-- Iteration 2 -- +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} + +-- Iteration 3 -- +array(2) { + [0]=> + array(2) { + [0]=> + int(4) + [1]=> + int(2) + } + [1]=> + array(2) { + [0]=> + int(3) + [1]=> + int(5) + } +} +array(2) { + [0]=> + array(2) { + ["a"]=> + int(4) + ["b"]=> + int(2) + } + [1]=> + array(2) { + ["c"]=> + int(3) + ["d"]=> + int(5) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(4) + [1]=> + int(2) + } + [1]=> + array(2) { + [0]=> + int(3) + [1]=> + int(5) + } +} +Done diff --git a/ext/standard/tests/array/array_chunk_variation7.phpt b/ext/standard/tests/array/array_chunk_variation7.phpt new file mode 100644 index 0000000..c8a7196 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation7.phpt @@ -0,0 +1,89 @@ +--TEST-- +Test array_chunk() function : usage variations - references +--FILE-- + &$numbers[0], + "two" => &$numbers[1], + "three" => &$numbers[2], + "four" => &$numbers[3] +); + +var_dump( array_chunk($input_array, $size) ); +var_dump( array_chunk($input_array, $size, true) ); +var_dump( array_chunk($input_array, $size, false) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_chunk() : usage variations *** + +-- Testing array_chunk(), input array containing references +array(2) { + [0]=> + array(2) { + [0]=> + &int(1) + [1]=> + &int(2) + } + [1]=> + array(2) { + [0]=> + &int(3) + [1]=> + &int(4) + } +} +array(2) { + [0]=> + array(2) { + ["one"]=> + &int(1) + ["two"]=> + &int(2) + } + [1]=> + array(2) { + ["three"]=> + &int(3) + ["four"]=> + &int(4) + } +} +array(2) { + [0]=> + array(2) { + [0]=> + &int(1) + [1]=> + &int(2) + } + [1]=> + array(2) { + [0]=> + &int(3) + [1]=> + &int(4) + } +} +Done diff --git a/ext/standard/tests/array/array_chunk_variation8.phpt b/ext/standard/tests/array/array_chunk_variation8.phpt new file mode 100644 index 0000000..6a6e752 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation8.phpt @@ -0,0 +1,46 @@ +--TEST-- +array_chunk() - variation 8 +--FILE-- + -1); +var_dump ($array); +for ($i = 0; $i < (sizeof($array) + 1); $i++) { + echo "[$i]\n"; + var_dump (@array_chunk ($array, $i)); + var_dump (@array_chunk ($array, $i, TRUE)); + var_dump (@array_chunk ($array, $i, FALSE)); + echo "\n"; +} +?> +--EXPECT-- +array(1) { + [3]=> + int(-1) +} +[0] +NULL +NULL +NULL + +[1] +array(1) { + [0]=> + array(1) { + [0]=> + int(-1) + } +} +array(1) { + [0]=> + array(1) { + [3]=> + int(-1) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(-1) + } +} diff --git a/ext/standard/tests/array/array_chunk_variation9.phpt b/ext/standard/tests/array/array_chunk_variation9.phpt new file mode 100644 index 0000000..ec57da4 --- /dev/null +++ b/ext/standard/tests/array/array_chunk_variation9.phpt @@ -0,0 +1,92 @@ +--TEST-- +array_chunk() - variation 9 +--FILE-- + 0, 2 => 2); +var_dump ($array); +for ($i = 0; $i < (sizeof($array) + 1); $i++) { + echo "[$i]\n"; + var_dump (@array_chunk ($array, $i)); + var_dump (@array_chunk ($array, $i, TRUE)); + var_dump (@array_chunk ($array, $i, FALSE)); + echo "\n"; +} +?> +--EXPECT-- +array(2) { + [1]=> + int(0) + [2]=> + int(2) +} +[0] +NULL +NULL +NULL + +[1] +array(2) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} +array(2) { + [0]=> + array(1) { + [1]=> + int(0) + } + [1]=> + array(1) { + [2]=> + int(2) + } +} +array(2) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} + +[2] +array(1) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(2) + } +} +array(1) { + [0]=> + array(2) { + [1]=> + int(0) + [2]=> + int(2) + } +} +array(1) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(2) + } +} diff --git a/ext/standard/tests/array/array_combine.phpt b/ext/standard/tests/array/array_combine.phpt new file mode 100644 index 0000000..34d4ff8 --- /dev/null +++ b/ext/standard/tests/array/array_combine.phpt @@ -0,0 +1,122 @@ +--TEST-- +basic array_combine test +--FILE-- + +--EXPECT-- +Array +( + [green] => green + [red] => red + [yellow] => yellow +) +Array +( + [green] => 1 + [red] => 2 + [yellow] => 3 +) +Array +( + [green] => 0 + [red] => 1 + [yellow] => 2 +) +Array +( + [green] => 1 + [red] => + [yellow] => +) +Array +( + [1] => green + [2] => red + [3] => yellow +) +Array +( + [1] => 1 + [2] => 2 + [3] => 3 +) +Array +( + [1] => 0 + [2] => 1 + [3] => 2 +) +Array +( + [1] => 1 + [2] => + [3] => +) +Array +( + [0] => green + [1] => red + [2] => yellow +) +Array +( + [0] => 1 + [1] => 2 + [2] => 3 +) +Array +( + [0] => 0 + [1] => 1 + [2] => 2 +) +Array +( + [0] => 1 + [1] => + [2] => +) +Array +( + [1] => green + [] => yellow +) +Array +( + [1] => 1 + [] => 3 +) +Array +( + [1] => 0 + [] => 2 +) +Array +( + [1] => 1 + [] => +) \ No newline at end of file diff --git a/ext/standard/tests/array/array_combine_basic.phpt b/ext/standard/tests/array/array_combine_basic.phpt new file mode 100644 index 0000000..5d855cf --- /dev/null +++ b/ext/standard/tests/array/array_combine_basic.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test array_combine() function : basic functionality +--FILE-- + "a", 2 => 'b'); +$values_array = array(3 => 'c', 4 => "d"); +var_dump( array_combine($keys_array, $values_array) ); + +// mixed array for $keys and $values arguments +$keys_array = array(1, 2 => "b"); +$values_array = array(3 => 'c', 4); +var_dump( array_combine($keys_array, $values_array) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_combine() : basic functionality *** +array(2) { + [1]=> + int(3) + [2]=> + int(4) +} +array(2) { + ["a"]=> + string(1) "c" + ["b"]=> + string(1) "d" +} +array(2) { + [1]=> + string(1) "c" + ["b"]=> + int(4) +} +Done diff --git a/ext/standard/tests/array/array_combine_error1.phpt b/ext/standard/tests/array/array_combine_error1.phpt new file mode 100644 index 0000000..aa5a1af --- /dev/null +++ b/ext/standard/tests/array/array_combine_error1.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test array_combine() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_combine() : error conditions *** + +-- Testing array_combine() function with Zero arguments -- + +Warning: array_combine() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +-- Testing array_combine() function with more than expected no. of arguments -- + +Warning: array_combine() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing array_combine() function with less than expected no. of arguments -- + +Warning: array_combine() expects exactly 2 parameters, 1 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_combine_error2.phpt b/ext/standard/tests/array/array_combine_error2.phpt new file mode 100644 index 0000000..4224f1c --- /dev/null +++ b/ext/standard/tests/array/array_combine_error2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test array_combine() function : error conditions - empty array +--FILE-- + +--EXPECTF-- +*** Testing array_combine() : error conditions specific to array_combine() *** + +-- Testing array_combine() function with empty arrays -- +array(0) { +} + +-- Testing array_combine() function with empty array for $keys argument -- + +Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d +bool(false) + +-- Testing array_combine() function with empty array for $values argument -- + +Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d +bool(false) + +-- Testing array_combine() function by passing array with unequal number of elements -- + +Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/array/array_combine_variation1.phpt b/ext/standard/tests/array/array_combine_variation1.phpt new file mode 100644 index 0000000..c69d4eb --- /dev/null +++ b/ext/standard/tests/array/array_combine_variation1.phpt @@ -0,0 +1,198 @@ +--TEST-- +Test array_combine() function : usage variations - unexpected values for 'keys' argument +--FILE-- + +--EXPECTF-- +*** Testing array_combine() : Passing non-array values to $keys argument *** +-- Iteration 1 -- + +Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 2 -- + +Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 3 -- + +Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 4 -- + +Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_combine() expects parameter 1 to be array, object given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 23 -- + +Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 24 -- + +Warning: array_combine() expects parameter 1 to be array, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_combine_variation2.phpt b/ext/standard/tests/array/array_combine_variation2.phpt new file mode 100644 index 0000000..e58893b --- /dev/null +++ b/ext/standard/tests/array/array_combine_variation2.phpt @@ -0,0 +1,198 @@ +--TEST-- +Test array_combine() function : usage variations - unexpected values for 'values' argument +--FILE-- + +--EXPECTF-- +*** Testing array_combine() : Passing non-array values to $values argument *** +-- Iteration 1 -- + +Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d +NULL +-- Iteration 2 -- + +Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d +NULL +-- Iteration 3 -- + +Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d +NULL +-- Iteration 4 -- + +Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_combine() expects parameter 2 to be array, object given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d +NULL +-- Iteration 23 -- + +Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d +NULL +-- Iteration 24 -- + +Warning: array_combine() expects parameter 2 to be array, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_combine_variation3.phpt b/ext/standard/tests/array/array_combine_variation3.phpt new file mode 100644 index 0000000..03de632 --- /dev/null +++ b/ext/standard/tests/array/array_combine_variation3.phpt @@ -0,0 +1,278 @@ +--TEST-- +Test array_combine() function : usage variations - different arrays(Bug#43424) +--FILE-- +22 +'single quoted string' +"double quoted string" +2222 != 1111.\t 0000 = 0000\n +EOT; + +// arrays passed to $keys argument +$arrays = array ( +/*1*/ array(1, 2), // with default keys and numeric values + array(1.1, 2.2), // with default keys & float values + array(false,true), // with default keys and boolean values + array(), // empty array +/*5*/ array(NULL), // with NULL + array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings + array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings + array("h1" => $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $numeric_string), // with heredocs + + // associative arrays +/*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values + array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values + array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values + array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value + array("one" => 1, 2 => "two", 4 => "four"), //mixed + + // associative array, containing null/empty/boolean values as key/value +/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), + array(true => "true", false => "false", "false" => false, "true" => true), + array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), + array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), + array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + + // array with repetative keys +/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) +); + +// loop through each sub-array within $arrays to check the behavior of array_combine() +// same arrays are passed to both $keys and $values +$iterator = 1; +foreach($arrays as $array) { + echo "-- Iteration $iterator --\n"; + var_dump( array_combine($array, $array) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_combine() : Passing different types of arrays to both $keys and $values argument *** +-- Iteration 1 -- +array(2) { + [1]=> + int(1) + [2]=> + int(2) +} +-- Iteration 2 -- +array(2) { + ["1.1"]=> + float(1.1) + ["2.2"]=> + float(2.2) +} +-- Iteration 3 -- +array(2) { + [""]=> + bool(false) + [1]=> + bool(true) +} +-- Iteration 4 -- +array(0) { +} +-- Iteration 5 -- +array(1) { + [""]=> + NULL +} +-- Iteration 6 -- +array(6) { + ["a "]=> + string(3) "a " + ["aaaa "]=> + string(5) "aaaa " + ["b"]=> + string(1) "b" + ["b bbb"]=> + string(5) "b bbb" + ["c"]=> + string(1) "c" + ["\[\]\!\@\#$\%\^\&\*\(\)\{\}"]=> + string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}" +} +-- Iteration 7 -- +array(6) { + ["a\v\f"]=> + string(5) "a\v\f" + ["aaaa\r"]=> + string(6) "aaaa\r" + ["b"]=> + string(1) "b" + ["b\tbbb"]=> + string(6) "b\tbbb" + ["c"]=> + string(1) "c" + ["\[\]\!\@\#\$\%\^\&\*\(\)\{\}"]=> + string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}" +} +-- Iteration 8 -- +array(4) { + [" +"]=> + string(1) " +" + ["hello world +The quick brown fox jumped over; +the lazy dog +This is a double quoted string"]=> + string(88) "hello world +The quick brown fox jumped over; +the lazy dog +This is a double quoted string" + ["hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces"]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" + ["11 < 12. 123 >22 +'single quoted string' +"double quoted string" +2222 != 1111. 0000 = 0000 +"]=> + string(90) "11 < 12. 123 >22 +'single quoted string' +"double quoted string" +2222 != 1111. 0000 = 0000 +" +} +-- Iteration 9 -- +array(3) { + ["one"]=> + string(3) "one" + ["two"]=> + string(3) "two" + ["three"]=> + string(5) "three" +} +-- Iteration 10 -- +array(3) { + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) +} +-- Iteration 11 -- +array(4) { + [10]=> + int(10) + [20]=> + int(20) + [40]=> + int(40) + [30]=> + int(30) +} +-- Iteration 12 -- +array(3) { + ["ten"]=> + string(3) "ten" + ["twenty"]=> + string(6) "twenty" + ["thirty"]=> + string(6) "thirty" +} +-- Iteration 13 -- +array(3) { + [1]=> + int(1) + ["two"]=> + string(3) "two" + ["four"]=> + string(4) "four" +} +-- Iteration 14 -- +array(2) { + ["null"]=> + string(4) "null" + [""]=> + NULL +} +-- Iteration 15 -- +array(4) { + ["true"]=> + string(4) "true" + ["false"]=> + string(5) "false" + [""]=> + bool(false) + [1]=> + bool(true) +} +-- Iteration 16 -- +array(2) { + ["emptys"]=> + string(6) "emptys" + [""]=> + string(0) "" +} +-- Iteration 17 -- +array(2) { + [""]=> + bool(false) + [1]=> + bool(true) +} +-- Iteration 18 -- +array(3) { + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) +} +-- Iteration 19 -- +array(3) { + [10]=> + int(10) + [20]=> + int(20) + [3]=> + int(3) +} +Done diff --git a/ext/standard/tests/array/array_combine_variation4.phpt b/ext/standard/tests/array/array_combine_variation4.phpt new file mode 100644 index 0000000..bcd8428 --- /dev/null +++ b/ext/standard/tests/array/array_combine_variation4.phpt @@ -0,0 +1,191 @@ +--TEST-- +Test array_combine() function : usage variations - associative array with different keys(Bug#43424) +--FILE-- + "0"), + array(1 => "1"), + array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), + + // arrays with float keys +/*5*/ array(2.3333 => "float"), + array(1.2 => "f1", 3.33 => "f2", + 4.89999922839999 => "f3", + 33333333.333333 => "f4"), + + // arrays with string keys +/*7*/ array('\tHello' => 111, 're\td' => "color", + '\v\fworld' => 2.2, 'pen\n' => 33), + array("\tHello" => 111, "re\td" => "color", + "\v\fworld" => 2.2, "pen\n" => 33), + array("hello", $heredoc => "string"), // heredoc + + // array with object, unset variable and resource variable +/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), + + // array with mixed keys +/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, + $fp => 'resource', 133 => "int", 444.432 => "float", + @$unset_var => "unset", $heredoc => "heredoc") +); + +// array to be passsed to $arr2 argument +$arr2 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4", + "\tHello" => 111, 2.2, 'color', "Hello world" => "string", + "pen\n" => 33, new classA() => 11, 133 => "int"); + +// loop through each sub-array within $arrays to check the behavior of array_combine() +// same arrays are passed to both $keys and $values +$iterator = 1; +foreach($arrays as $array) { + echo "-- Iteration $iterator --\n"; + var_dump( array_combine($array, $array) ); + $iterator++; +} + +// close the file resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_combine() : assoc array with diff keys to both $keys and $values argument *** + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d +-- Iteration 1 -- +array(0) { +} +-- Iteration 2 -- +array(1) { + [0]=> + string(1) "0" +} +-- Iteration 3 -- +array(1) { + [1]=> + string(1) "1" +} +-- Iteration 4 -- +array(4) { + [1]=> + string(1) "1" + [2]=> + string(1) "2" + [3]=> + string(1) "3" + [4]=> + string(1) "4" +} +-- Iteration 5 -- +array(1) { + ["float"]=> + string(5) "float" +} +-- Iteration 6 -- +array(4) { + ["f1"]=> + string(2) "f1" + ["f2"]=> + string(2) "f2" + ["f3"]=> + string(2) "f3" + ["f4"]=> + string(2) "f4" +} +-- Iteration 7 -- +array(4) { + [111]=> + int(111) + ["color"]=> + string(5) "color" + ["2.2"]=> + float(2.2) + [33]=> + int(33) +} +-- Iteration 8 -- +array(4) { + [111]=> + int(111) + ["color"]=> + string(5) "color" + ["2.2"]=> + float(2.2) + [33]=> + int(33) +} +-- Iteration 9 -- +array(2) { + ["hello"]=> + string(5) "hello" + ["string"]=> + string(6) "string" +} +-- Iteration 10 -- +array(1) { + ["hello"]=> + string(5) "hello" +} +-- Iteration 11 -- +array(6) { + [1]=> + int(1) + ["2.2"]=> + float(2.2) + ["int"]=> + string(3) "int" + ["float"]=> + string(5) "float" + ["unset"]=> + string(5) "unset" + ["heredoc"]=> + string(7) "heredoc" +} +Done diff --git a/ext/standard/tests/array/array_combine_variation5.phpt b/ext/standard/tests/array/array_combine_variation5.phpt new file mode 100644 index 0000000..4d9f185 --- /dev/null +++ b/ext/standard/tests/array/array_combine_variation5.phpt @@ -0,0 +1,185 @@ +--TEST-- +Test array_combine() function : usage variations - associative array with different values(Bug#43424) +--FILE-- + 0), + array("1" => 1), + array("one" => 1, 'two' => 2, "three" => 3, 4 => 4), + + // arrays with float values +/*5*/ array("float" => 2.3333), + array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333), + + // arrays with string values +/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), + array(1 => "hello", "heredoc" => $heredoc), + + // array with object, unset variable and resource variable +/*10*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp), + + // array with mixed values +/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit", + 'resource' => $fp, "int" => 133, "float" => 444.432, + "unset" => @$unset_var, "heredoc" => $heredoc) +); + + +// loop through each sub-array within $arrays to check the behavior of array_combine() +$iterator = 1; +foreach($arrays as $array) { + echo "-- Iteration $iterator --\n"; + var_dump( array_combine($array, $array) ); + $iterator++; +} + +// close the file resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_combine() : assoc array with diff values to both $keys and $values argument *** +-- Iteration 1 -- +array(0) { +} +-- Iteration 2 -- +array(1) { + [0]=> + int(0) +} +-- Iteration 3 -- +array(1) { + [1]=> + int(1) +} +-- Iteration 4 -- +array(4) { + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) +} +-- Iteration 5 -- +array(1) { + ["2.3333"]=> + float(2.3333) +} +-- Iteration 6 -- +array(4) { + ["1.2"]=> + float(1.2) + ["3.33"]=> + float(3.33) + ["4.8999992284"]=> + float(4.8999992284) + ["33333333.333"]=> + float(33333333.333) +} +-- Iteration 7 -- +array(4) { + [" Hello"]=> + string(6) " Hello" + ["col or"]=> + string(6) "col or" + [" world"]=> + string(7) " world" + ["pen +"]=> + string(4) "pen +" +} +-- Iteration 8 -- +array(4) { + ["\tHello"]=> + string(7) "\tHello" + ["col\tor"]=> + string(7) "col\tor" + ["\v\fworld"]=> + string(9) "\v\fworld" + ["pen\n"]=> + string(5) "pen\n" +} +-- Iteration 9 -- +array(2) { + ["hello"]=> + string(5) "hello" + ["Hello world"]=> + string(11) "Hello world" +} +-- Iteration 10 -- +array(3) { + ["Class A object"]=> + object(classA)#%d (0) { + } + [""]=> + NULL + ["Resource id #%d"]=> + resource(%d) of type (stream) +} +-- Iteration 11 -- +array(8) { + ["hello"]=> + string(5) "hello" + ["Class A object"]=> + object(classA)#%d (0) { + } + ["fruit"]=> + string(5) "fruit" + ["Resource id #%d"]=> + resource(%d) of type (stream) + [133]=> + int(133) + ["444.432"]=> + float(444.432) + [""]=> + NULL + ["Hello world"]=> + string(11) "Hello world" +} +Done diff --git a/ext/standard/tests/array/array_combine_variation6.phpt b/ext/standard/tests/array/array_combine_variation6.phpt new file mode 100644 index 0000000..94c7b4d --- /dev/null +++ b/ext/standard/tests/array/array_combine_variation6.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test array_combine() function : usage variations - binary safe checking +--FILE-- + +--EXPECTF-- +*** Testing array_combine() : binary safe checking *** +array(2) { + ["hello"]=> + string(5) "hello" + ["world"]=> + string(5) "world" +} +array(2) { + ["hello"]=> + string(5) "hello" + ["world"]=> + string(5) "world" +} +array(2) { + ["hello"]=> + string(5) "hello" + ["world"]=> + string(5) "world" +} +Done diff --git a/ext/standard/tests/array/array_count_values.phpt b/ext/standard/tests/array/array_count_values.phpt new file mode 100644 index 0000000..a6424aa --- /dev/null +++ b/ext/standard/tests/array/array_count_values.phpt @@ -0,0 +1,94 @@ +--TEST-- +array_count_values() +--FILE-- + +--EXPECT-- +array(0) { +} + +array(1) { + [0]=> + int(1) +} + +array(1) { + [1]=> + int(1) +} + +array(1) { + [-1]=> + int(1) +} + +array(1) { + [0]=> + int(2) +} + +array(2) { + [0]=> + int(1) + [1]=> + int(1) +} + +array(1) { + [1]=> + int(2) +} + +array(3) { + [1]=> + int(2) + ["hello"]=> + int(2) + ["world"]=> + int(1) +} + +array(2) { + ["hello"]=> + int(2) + ["world"]=> + int(1) +} + +array(3) { + [""]=> + int(2) + ["world"]=> + int(3) + ["hello"]=> + int(4) +} + +array(1) { + [0]=> + int(1) +} + +array(1) { + [1]=> + int(1) +} diff --git a/ext/standard/tests/array/array_count_values2.phpt b/ext/standard/tests/array/array_count_values2.phpt new file mode 100644 index 0000000..8dc9b23 --- /dev/null +++ b/ext/standard/tests/array/array_count_values2.phpt @@ -0,0 +1,43 @@ +--TEST-- +basic array_count_values test +--FILE-- + +--EXPECTF-- +Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %s + +Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %s + +Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %s +array(8) { + [1]=> + int(2) + ["hello"]=> + int(2) + ["world"]=> + int(1) + [""]=> + int(1) + ["rabbit"]=> + int(1) + ["foo"]=> + int(1) + ["Foo"]=> + int(1) + [0]=> + int(1) +} diff --git a/ext/standard/tests/array/array_count_values_error.phpt b/ext/standard/tests/array/array_count_values_error.phpt new file mode 100644 index 0000000..843e34e --- /dev/null +++ b/ext/standard/tests/array/array_count_values_error.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test array_count_values() function : Invalid parameters +--FILE-- + +--EXPECTF-- +*** Testing array_count_values() : error conditions *** + +-- Testing array_count_values() function with Zero arguments -- + +Warning: array_count_values() expects exactly 1 parameter, 0 given in %sarray_count_values_error.php on line 16 +NULL + +-- Testing array_count_values() function with more than expected no. of arguments -- + +Warning: array_count_values() expects exactly 1 parameter, 2 given in %sarray_count_values_error.php on line 22 +NULL + +-- Testing array_count_values() function integer arguments -- + +Warning: array_count_values() expects parameter 1 to be array, integer given in %sarray_count_values_error.php on line 26 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_count_values_variation.phpt b/ext/standard/tests/array/array_count_values_variation.phpt new file mode 100644 index 0000000..89d7f37 --- /dev/null +++ b/ext/standard/tests/array/array_count_values_variation.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test array_count_values() function : Test all normal paramter variations +--FILE-- + "bobv", "val", 6 => "val6", $fp, $ob); + +var_dump (@array_count_values ($arrays)); +echo "\n"; + + +echo "Done"; +?> + +--CLEAN-- + +--EXPECTF-- +*** Testing array_count_values() : parameter variations *** +array(3) { + ["bobv"]=> + int(1) + ["val"]=> + int(1) + ["val6"]=> + int(1) +} + +Done diff --git a/ext/standard/tests/array/array_diff_1.phpt b/ext/standard/tests/array/array_diff_1.phpt new file mode 100644 index 0000000..a25d19d --- /dev/null +++ b/ext/standard/tests/array/array_diff_1.phpt @@ -0,0 +1,15 @@ +--TEST-- +Test array_diff when non-array is passed +--FILE-- + +--EXPECTF-- +Warning: array_diff(): Argument #2 is not an array in %s +OK! diff --git a/ext/standard/tests/array/array_diff_assoc.phpt b/ext/standard/tests/array/array_diff_assoc.phpt new file mode 100644 index 0000000..29db107 --- /dev/null +++ b/ext/standard/tests/array/array_diff_assoc.phpt @@ -0,0 +1,49 @@ +--TEST-- +basic array_diff_assoc test +--FILE-- + "green", "b" => "brown", "c" => "blue", "red", ""); +$array2 = array("a" => "green", "yellow", "red", TRUE); +$array3 = array("red", "a"=>"brown", ""); +$result[] = array_diff_assoc($array1, $array2); +$result[] = array_diff_assoc($array1, $array3); +$result[] = array_diff_assoc($array2, $array3); +$result[] = array_diff_assoc($array1, $array2, $array3); +print_r($result) +?> +--EXPECT-- +Array +( + [0] => Array + ( + [b] => brown + [c] => blue + [0] => red + [1] => + ) + + [1] => Array + ( + [a] => green + [b] => brown + [c] => blue + ) + + [2] => Array + ( + [a] => green + [0] => yellow + [1] => red + [2] => 1 + ) + + [3] => Array + ( + [b] => brown + [c] => blue + ) + +) + + + diff --git a/ext/standard/tests/array/array_diff_assoc_basic.phpt b/ext/standard/tests/array/array_diff_assoc_basic.phpt new file mode 100644 index 0000000..c6b3aef --- /dev/null +++ b/ext/standard/tests/array/array_diff_assoc_basic.phpt @@ -0,0 +1,90 @@ +--TEST-- +Test array_diff_assoc() function : basic functionality +--FILE-- + 'one', 2=> 'two', 3 => 4); +$array_string_key = array('one' => 1, 'two' => '2', '3' => 'three'); + + + +echo "-- Compare Default keys to numeric keys --\n"; +var_dump(array_diff_assoc($array_default_key, $array_numeric_key)); +var_dump(array_diff_assoc($array_numeric_key, $array_default_key)); + + +echo "\n-- Compare Default keys to string keys --\n"; +var_dump(array_diff_assoc($array_default_key, $array_numeric_key)); +var_dump(array_diff_assoc($array_numeric_key, $array_default_key)); + + +echo "\n-- Compare numeric keys to string keys --\n"; +var_dump(array_diff_assoc($array_numeric_key, $array_string_key)); +var_dump(array_diff_assoc($array_string_key, $array_numeric_key)); + + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_diff_assoc() : basic functionality *** +-- Compare Default keys to numeric keys -- +array(3) { + [0]=> + string(3) "one" + [1]=> + int(2) + [2]=> + string(5) "three" +} +array(2) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" +} + +-- Compare Default keys to string keys -- +array(3) { + [0]=> + string(3) "one" + [1]=> + int(2) + [2]=> + string(5) "three" +} +array(2) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" +} + +-- Compare numeric keys to string keys -- +array(3) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + int(4) +} +array(3) { + ["one"]=> + int(1) + ["two"]=> + string(1) "2" + [3]=> + string(5) "three" +} +Done diff --git a/ext/standard/tests/array/array_diff_assoc_error.phpt b/ext/standard/tests/array/array_diff_assoc_error.phpt new file mode 100644 index 0000000..211907c --- /dev/null +++ b/ext/standard/tests/array/array_diff_assoc_error.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test array_diff_assoc() function : error conditions - pass array_diff_assoc() too few/zero arguments +--FILE-- + +--EXPECTF-- +*** Testing array_diff_assoc() : error conditions *** + +-- Testing array_diff_assoc() function with zero arguments -- + +Warning: array_diff_assoc(): at least 2 parameters are required, 0 given in %s on line %d +NULL + +-- Testing array_diff_assoc() function with less than expected no. of arguments -- + +Warning: array_diff_assoc(): at least 2 parameters are required, 1 given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_assoc_variation1.phpt b/ext/standard/tests/array/array_diff_assoc_variation1.phpt new file mode 100644 index 0000000..b6c6379 --- /dev/null +++ b/ext/standard/tests/array/array_diff_assoc_variation1.phpt @@ -0,0 +1,234 @@ +--TEST-- +Test array_diff_assoc() function : usage variations - unexpected values for 'arr1' argument +--FILE-- + + +--EXPECTF-- +*** Testing array_diff_assoc() : usage variations *** + +-- Iteration 1 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 26 -- + +Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_assoc_variation10.phpt b/ext/standard/tests/array/array_diff_assoc_variation10.phpt new file mode 100644 index 0000000..0687ed8 --- /dev/null +++ b/ext/standard/tests/array/array_diff_assoc_variation10.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test array_diff_assoc() function : usage variations - binary safe check +--FILE-- + "hello", + "str2" => "world"); + +$array2 = array( b"1" => 'hello', + b"world", + "hello", + 'test'); + +var_dump(array_diff_assoc($array1, $array2)); +var_dump(array_diff_assoc($array2, $array1)); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_diff_assoc() : usage variations *** +array(3) { + [0]=> + string(1) "1" + ["str1"]=> + string(5) "hello" + ["str2"]=> + string(5) "world" +} +array(2) { + [3]=> + string(5) "hello" + [4]=> + string(4) "test" +} +Done diff --git a/ext/standard/tests/array/array_diff_assoc_variation2.phpt b/ext/standard/tests/array/array_diff_assoc_variation2.phpt new file mode 100644 index 0000000..5de9442 --- /dev/null +++ b/ext/standard/tests/array/array_diff_assoc_variation2.phpt @@ -0,0 +1,235 @@ +--TEST-- +Test array_diff_assoc() function : usage variations - unexpected values for 'arr1' argument +--FILE-- + + +--EXPECTF-- + +*** Testing array_diff_assoc() : usage variations *** + +-- Iteration 1 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 26 -- + +Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_assoc_variation3.phpt b/ext/standard/tests/array/array_diff_assoc_variation3.phpt new file mode 100644 index 0000000..1d4aaf2 --- /dev/null +++ b/ext/standard/tests/array/array_diff_assoc_variation3.phpt @@ -0,0 +1,206 @@ +--TEST-- +Test array_diff_assoc() function : variation - array containing different data types +--FILE-- + array( + 0, + 1, + 12345, + -2345), + + // float data +/*2*/ +'float' => array( + 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5), + + // null data +/*3*/ +'null' => array( + NULL, + null), + + // boolean data +/*4*/ +'bool' => array( + true, + false, + TRUE, + FALSE), + + // empty data +/*5*/ +'empty' => array( + "", + ''), + + // string data +/*6*/ +'string' => array( + "string", + 'string', + $heredoc), + + // binary data +/*7*/ +'binary' => array( + b"binary", + (binary)"binary"), + + // object data +/*8*/ +'object' => array( + new classA()), + + // undefined data +/*9*/ +'undefined' => array( + @$undefined_var), + + // unset data +/*10*/ +'unset' => array( + @$unset_var), +); + +// loop through each element of $inputs to check the behavior of array_diff_assoc +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator --\n"; + var_dump( array_diff_assoc($input, $array)); + $iterator++; +}; +echo "Done"; +?> +--EXPECTF-- + +*** Testing array_diff_assoc() : usage variations *** + +-- Iteration 1 -- +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(12345) + [3]=> + int(-2345) +} + +-- Iteration 2 -- +array(5) { + [0]=> + float(10.5) + [1]=> + float(-10.5) + [2]=> + float(123456789000) + [3]=> + float(1.23456789E-9) + [4]=> + float(0.5) +} + +-- Iteration 3 -- +array(2) { + [0]=> + NULL + [1]=> + NULL +} + +-- Iteration 4 -- +array(3) { + [1]=> + bool(false) + [2]=> + bool(true) + [3]=> + bool(false) +} + +-- Iteration 5 -- +array(2) { + [0]=> + string(0) "" + [1]=> + string(0) "" +} + +-- Iteration 6 -- +array(3) { + [0]=> + string(6) "string" + [1]=> + string(6) "string" + [2]=> + string(11) "hello world" +} + +-- Iteration 7 -- +array(2) { + [0]=> + string(6) "binary" + [1]=> + string(6) "binary" +} + +-- Iteration 8 -- +array(1) { + [0]=> + object(classA)#%d (0) { + } +} + +-- Iteration 9 -- +array(1) { + [0]=> + NULL +} + +-- Iteration 10 -- +array(1) { + [0]=> + NULL +} +Done diff --git a/ext/standard/tests/array/array_diff_assoc_variation4.phpt b/ext/standard/tests/array/array_diff_assoc_variation4.phpt new file mode 100644 index 0000000..34e979a --- /dev/null +++ b/ext/standard/tests/array/array_diff_assoc_variation4.phpt @@ -0,0 +1,177 @@ +--TEST-- +Test array_diff_assoc() function : usage variations - arrays with different data types as keys +--FILE-- + + array( + 0 => 'zero', + 1 => 'one', + 12345 => 'positive', + -2345 => 'negative'), + + // float data +/*2*/ +'float' => array( + 10.5 => 'float 1', + -10.5 => 'float 2', + .5 => 'float 3'), + + // null data +/*3*/ +'null' => array( + NULL => 'null 1', + null => 'null 2'), + + // boolean data +/*4*/ +'bool' => array( + true => 'boolt', + false => 'boolf', + TRUE => 'boolT', + FALSE => 'boolF'), + + // empty data +/*5*/ +'empty' => array( + "" => 'emptyd', + '' => 'emptys'), + + // string data +/*6*/ +'string' => array( + "string" => 'stringd', + 'string' => 'strings', + $heredoc => 'stringh'), + + // binary data +/*7*/ +'binary' => array( + b"binary1" => 'binary 1', + (binary)"binary2" => 'binary 2'), + + // undefined data +/*8*/ +'undefined' => array( + @$undefined_var => 'undefined'), + + // unset data +/*9*/ +'unset' => array( + @$unset_var => 'unset'), + +); + +// loop through each element of $inputs to check the behavior of array_diff_assoc +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator --\n"; + var_dump( array_diff_assoc($input, $array)); + $iterator++; +}; + +echo "Done"; +?> + +--EXPECTF-- + +*** Testing array_diff_assoc() : usage variations *** + +-- Iteration 1 -- +array(4) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [12345]=> + string(8) "positive" + [-2345]=> + string(8) "negative" +} + +-- Iteration 2 -- +array(3) { + [10]=> + string(7) "float 1" + [-10]=> + string(7) "float 2" + [0]=> + string(7) "float 3" +} + +-- Iteration 3 -- +array(1) { + [""]=> + string(6) "null 2" +} + +-- Iteration 4 -- +array(2) { + [1]=> + string(5) "boolT" + [0]=> + string(5) "boolF" +} + +-- Iteration 5 -- +array(1) { + [""]=> + string(6) "emptys" +} + +-- Iteration 6 -- +array(2) { + ["string"]=> + string(7) "strings" + ["hello world"]=> + string(7) "stringh" +} + +-- Iteration 7 -- +array(2) { + ["binary1"]=> + string(8) "binary 1" + ["binary2"]=> + string(8) "binary 2" +} + +-- Iteration 8 -- +array(1) { + [""]=> + string(9) "undefined" +} + +-- Iteration 9 -- +array(1) { + [""]=> + string(5) "unset" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_assoc_variation5.phpt b/ext/standard/tests/array/array_diff_assoc_variation5.phpt new file mode 100644 index 0000000..c89c656 --- /dev/null +++ b/ext/standard/tests/array/array_diff_assoc_variation5.phpt @@ -0,0 +1,148 @@ +--TEST-- +Test array_diff_assoc() function : usage variations - compare integers, floats and strings +--FILE-- + 1.00, 1.00 => 2.00, 2.00 => 3.00, 'b'); +$arr_string = array('1', '2', '3', 'c'); +$arr_string_float = array('0' => '1.00', '1.00' => '2.00', '2.00' => '3.00', 'd'); + +echo "-- Result of comparing integers and floating point numbers: --\n"; +var_dump(array_diff_assoc($arr_default_int, $arr_float)); +var_dump(array_diff_assoc($arr_float, $arr_default_int)); + +echo "-- Result of comparing integers and strings containing an integers : --\n"; +var_dump(array_diff_assoc($arr_default_int, $arr_string)); +var_dump(array_diff_assoc($arr_string, $arr_default_int)); + +echo "-- Result of comparing integers and strings containing floating points : --\n"; +var_dump(array_diff_assoc($arr_default_int, $arr_string_float)); +var_dump(array_diff_assoc($arr_string_float, $arr_default_int)); + +echo "-- Result of comparing floating points and strings containing integers : --\n"; +var_dump(array_diff_assoc($arr_float, $arr_string)); +var_dump(array_diff_assoc($arr_string, $arr_float)); + +echo "-- Result of comparing floating points and strings containing floating point: --\n"; +var_dump(array_diff_assoc($arr_float, $arr_string_float)); +var_dump(array_diff_assoc($arr_string_float, $arr_float)); + +echo "-- Result of comparing strings containing integers and strings containing floating points : --\n"; +var_dump(array_diff_assoc($arr_string, $arr_string_float)); +var_dump(array_diff_assoc($arr_string_float, $arr_string)); + +echo "-- Result of comparing more than two arrays: --\n"; +var_dump(array_diff_assoc($arr_default_int, $arr_float, $arr_string, $arr_string_float)); + +echo "Done"; +?> +--EXPECTF-- + +*** Testing array_diff_assoc() : usage variations *** +-- Result of comparing integers and floating point numbers: -- +array(1) { + [3]=> + string(1) "a" +} +array(1) { + [3]=> + string(1) "b" +} +-- Result of comparing integers and strings containing an integers : -- +array(1) { + [3]=> + string(1) "a" +} +array(1) { + [3]=> + string(1) "c" +} +-- Result of comparing integers and strings containing floating points : -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + string(1) "a" +} +array(4) { + [0]=> + string(4) "1.00" + ["1.00"]=> + string(4) "2.00" + ["2.00"]=> + string(4) "3.00" + [1]=> + string(1) "d" +} +-- Result of comparing floating points and strings containing integers : -- +array(1) { + [3]=> + string(1) "b" +} +array(1) { + [3]=> + string(1) "c" +} +-- Result of comparing floating points and strings containing floating point: -- +array(4) { + [0]=> + float(1) + [1]=> + float(2) + [2]=> + float(3) + [3]=> + string(1) "b" +} +array(4) { + [0]=> + string(4) "1.00" + ["1.00"]=> + string(4) "2.00" + ["2.00"]=> + string(4) "3.00" + [1]=> + string(1) "d" +} +-- Result of comparing strings containing integers and strings containing floating points : -- +array(4) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" + [2]=> + string(1) "3" + [3]=> + string(1) "c" +} +array(4) { + [0]=> + string(4) "1.00" + ["1.00"]=> + string(4) "2.00" + ["2.00"]=> + string(4) "3.00" + [1]=> + string(1) "d" +} +-- Result of comparing more than two arrays: -- +array(1) { + [3]=> + string(1) "a" +} +Done diff --git a/ext/standard/tests/array/array_diff_assoc_variation6.phpt b/ext/standard/tests/array/array_diff_assoc_variation6.phpt new file mode 100644 index 0000000..d6190b6 --- /dev/null +++ b/ext/standard/tests/array/array_diff_assoc_variation6.phpt @@ -0,0 +1,196 @@ +--TEST-- +Test array_diff_assoc() function : usage variations - strict string comparison check +--FILE-- + 1, + 'two' => 2.00000000000001); + +$inputs = array ( + +//default keys => string values +/*1*/ array('2.00000000000001', '1', 'zero', 'a'), + +//numeric keys => string values +/*2*/ array(2 => '2.00000000000001', + 1 => '1', + 0 => 'zero', + 3 => 'a'), + +//string keys => string values +/*3*/ array('2' => '2.00000000000001', + '1' => '1', + '0' => 'zero', + '3' => 'a') , + +//default keys => numeric values +/*4*/ array(2, 1, 0), + +//numeric keys => numeric values +/*5*/ array(2 => 2, + 1 => 1, + 0 => 0), + +//string keys => numeric values +/*6*/ array('two' => 2, + '1' => 1, + '0' => 0), + +//defualt keys => float values +/*7*/ array(2.00000000000001, 1.00, 0.01E-9), + +//numeric keys => float values +/*8*/ array(2 => 2.00000000000001, + 1 => 1.00, + 0 => 0.01E-9), + +//string keys => float values +/*9*/ array ('two' => 2.00000000000001, + '1' => 1.00, + '0' =>0.01E-9) +); + +// loop through each element of $inputs to check the behavior of array_diff_assoc +$iterator = 1; +foreach($inputs as $input) { + echo "\n-- Iteration $iterator --\n"; + var_dump(array_diff_assoc($array, $input)); + var_dump(array_diff_assoc($input, $array)); + $iterator++; +}; +echo "Done"; +?> +--EXPECTF-- +*** Testing array_diff_assoc() : usage variations *** + +-- Iteration 1 -- +array(2) { + [0]=> + string(4) "zero" + ["two"]=> + float(2) +} +array(3) { + [0]=> + string(16) "2.00000000000001" + [2]=> + string(4) "zero" + [3]=> + string(1) "a" +} + +-- Iteration 2 -- +array(1) { + ["two"]=> + float(2) +} +array(2) { + [2]=> + string(16) "2.00000000000001" + [3]=> + string(1) "a" +} + +-- Iteration 3 -- +array(1) { + ["two"]=> + float(2) +} +array(2) { + [2]=> + string(16) "2.00000000000001" + [3]=> + string(1) "a" +} + +-- Iteration 4 -- +array(2) { + [0]=> + string(4) "zero" + ["two"]=> + float(2) +} +array(2) { + [0]=> + int(2) + [2]=> + int(0) +} + +-- Iteration 5 -- +array(2) { + [0]=> + string(4) "zero" + ["two"]=> + float(2) +} +array(2) { + [2]=> + int(2) + [0]=> + int(0) +} + +-- Iteration 6 -- +array(1) { + [0]=> + string(4) "zero" +} +array(1) { + [0]=> + int(0) +} + +-- Iteration 7 -- +array(2) { + [0]=> + string(4) "zero" + ["two"]=> + float(2) +} +array(2) { + [0]=> + float(2) + [2]=> + float(1.0E-11) +} + +-- Iteration 8 -- +array(2) { + [0]=> + string(4) "zero" + ["two"]=> + float(2) +} +array(2) { + [2]=> + float(2) + [0]=> + float(1.0E-11) +} + +-- Iteration 9 -- +array(1) { + [0]=> + string(4) "zero" +} +array(1) { + [0]=> + float(1.0E-11) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_assoc_variation7.phpt b/ext/standard/tests/array/array_diff_assoc_variation7.phpt new file mode 100644 index 0000000..6fab0ae --- /dev/null +++ b/ext/standard/tests/array/array_diff_assoc_variation7.phpt @@ -0,0 +1,101 @@ +--TEST-- +Test array_diff_assoc() function : usage variations - arrays containing referenced variables +--FILE-- + + 1, 'b' => 2, 'c' => 3, &$a); + +echo "-- Results when \$a = $a: --\n"; +var_dump(array_diff_assoc($arr1, $arr2)); +var_dump(array_diff_assoc($arr2, $arr1)); + +$a = 4; + +echo "-- Results when \$a has been changed to $a: --\n"; +var_dump(array_diff_assoc($arr1, $arr2)); +var_dump(array_diff_assoc($arr2, $arr1)); + +$arr2 = &$arr1; + +echo "-- Results when \$arr2 is referenced to \$arr1 --\n"; +var_dump(array_diff_assoc($arr1, $arr2)); +var_dump(array_diff_assoc($arr2, $arr1)); + +$arr1 = array('zero' => 'x', 'one' => 'y', 'two' => 'z'); + +echo "-- Results when \$arr1 is changed --\n"; +var_dump(array_diff_assoc($arr1, $arr2)); +var_dump(array_diff_assoc($arr2, $arr1)); + +echo "Done"; +?> + +--EXPECTF-- + +*** Testing array_diff_assoc() : usage variations *** +-- Results when $a = a: -- +array(3) { + [1]=> + string(1) "b" + [2]=> + string(1) "c" + [3]=> + string(1) "a" +} +array(3) { + ["a"]=> + int(1) + ["b"]=> + int(2) + ["c"]=> + int(3) +} +-- Results when $a has been changed to 4: -- +array(4) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + [3]=> + string(1) "a" +} +array(4) { + ["a"]=> + int(1) + ["b"]=> + int(2) + ["c"]=> + int(3) + [0]=> + &int(4) +} +-- Results when $arr2 is referenced to $arr1 -- +array(0) { +} +array(0) { +} +-- Results when $arr1 is changed -- +array(0) { +} +array(0) { +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_assoc_variation8.phpt b/ext/standard/tests/array/array_diff_assoc_variation8.phpt new file mode 100644 index 0000000..3189c11 --- /dev/null +++ b/ext/standard/tests/array/array_diff_assoc_variation8.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test array_diff_assoc() function : usage variations - array containing duplicate keys and values +--FILE-- + 'd', 'b'); //duplicate key (0), duplicate value (b) +$array_assoc = array ('2' => 'c', //same key=>value pair, different order + '1' => 'b', + '0' => 'a', + 'b' => '3', //key and value from array_index swapped + 'c' => 2); //same as above, using integer + +var_dump(array_diff_assoc($array_index, $array_assoc)); +var_dump(array_diff_assoc($array_assoc, $array_index)); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_diff_assoc() : variation *** +array(2) { + [0]=> + string(1) "d" + [3]=> + string(1) "b" +} +array(3) { + [0]=> + string(1) "a" + ["b"]=> + string(1) "3" + ["c"]=> + int(2) +} +Done diff --git a/ext/standard/tests/array/array_diff_assoc_variation9.phpt b/ext/standard/tests/array/array_diff_assoc_variation9.phpt new file mode 100644 index 0000000..5ab6232 --- /dev/null +++ b/ext/standard/tests/array/array_diff_assoc_variation9.phpt @@ -0,0 +1,141 @@ +--TEST-- +Test array_diff_assoc() function : usage variations - compare multidimensional arrays +--FILE-- + array (1, 2, 3), + 'sub_array2' => array ('a', 'b', 'c')); +$array2 = array('sub_arraya' => array (1, 3, 5), + 'sub_arrayb' => array ('a', 'z', 'y')); + +echo "-- Compare two 2-D arrays --\n"; +var_dump(array_diff_assoc($array1, $array2)); +var_dump(array_diff_assoc($array2, $array1)); + +echo "\n-- Compare subarrays from two 2-D arrays --\n"; +var_dump(array_diff_assoc($array1['sub_array1'], $array2['sub_arraya'])); +var_dump(array_diff_assoc($array2['sub_arraya'], $array1['sub_array1'])); +var_dump(array_diff_assoc($array1['sub_array2'], $array2['sub_arrayb'])); +var_dump(array_diff_assoc($array2['sub_arrayb'], $array1['sub_array1'])); + +echo "\n-- Compare a subarray from one 2-D array and one 2-D array --\n"; +var_dump(array_diff_assoc($array1['sub_array1'], $array2)); +var_dump(array_diff_assoc($array1, $array2['sub_arraya'])); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_diff_assoc() : usage variations *** +-- Compare two 2-D arrays -- +array(2) { + ["sub_array1"]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + ["sub_array2"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +array(2) { + ["sub_arraya"]=> + array(3) { + [0]=> + int(1) + [1]=> + int(3) + [2]=> + int(5) + } + ["sub_arrayb"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "z" + [2]=> + string(1) "y" + } +} + +-- Compare subarrays from two 2-D arrays -- +array(2) { + [1]=> + int(2) + [2]=> + int(3) +} +array(2) { + [1]=> + int(3) + [2]=> + int(5) +} +array(2) { + [1]=> + string(1) "b" + [2]=> + string(1) "c" +} +array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "z" + [2]=> + string(1) "y" +} + +-- Compare a subarray from one 2-D array and one 2-D array -- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(2) { + ["sub_array1"]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + ["sub_array2"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_basic.phpt b/ext/standard/tests/array/array_diff_basic.phpt new file mode 100644 index 0000000..30aead6 --- /dev/null +++ b/ext/standard/tests/array/array_diff_basic.phpt @@ -0,0 +1,116 @@ +--TEST-- +Test array_diff() function : basic functionality +--FILE-- + 1, 'two' => 2, 'three' => 3, 'four' => 4); +$array_assoc_int2 = array ('three' => 3, 'four' => 4, 'five' => 5, 'six' => 6); + +echo "-- Test associative array with strings as keys and integers as elements --\n"; +var_dump(array_diff($array_assoc_int1, $array_assoc_int2)); +var_dump(array_diff($array_assoc_int2, $array_assoc_int1)); + +//Test associative array with strings as keys and elements +$array_assoc_str1 = array ('one' => 'un', 'two' => 'deux', 'three' => 'trois', 'four' => 'quatre'); +$array_assoc_str2 = array ('three' => 'trois', 'four' => 'quatre', 'five' => 'cinq', 'six' => 'six'); + +echo "-- Test associative array with strings as keys and integers as elements --\n"; +var_dump(array_diff($array_assoc_str1, $array_assoc_str2)); +var_dump(array_diff($array_assoc_str2, $array_assoc_str1)); + +echo "-- Test array_diff with more than 2 arguments --\n"; +var_dump(array_diff($array_int1, $array_int2, $array_string1, $array_string2)); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_diff() : basic functionality *** +-- Test indexed array with integers as elements -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +array(2) { + [2]=> + int(5) + [3]=> + int(6) +} +-- Test indexed array with strings as elements -- +array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" +} +array(2) { + [2]=> + string(4) "five" + [3]=> + string(3) "six" +} +-- Test associative array with strings as keys and integers as elements -- +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["five"]=> + int(5) + ["six"]=> + int(6) +} +-- Test associative array with strings as keys and integers as elements -- +array(2) { + ["one"]=> + string(2) "un" + ["two"]=> + string(4) "deux" +} +array(2) { + ["five"]=> + string(4) "cinq" + ["six"]=> + string(3) "six" +} +-- Test array_diff with more than 2 arguments -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +Done diff --git a/ext/standard/tests/array/array_diff_error.phpt b/ext/standard/tests/array/array_diff_error.phpt new file mode 100644 index 0000000..019cffb --- /dev/null +++ b/ext/standard/tests/array/array_diff_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test array_diff() function : error conditions - too few arguments passed to function +--FILE-- + +--EXPECTF-- +*** Testing array_diff() : error conditions *** + +-- Testing array_diff() function with zero arguments -- + +Warning: array_diff(): at least 2 parameters are required, 0 given in %s on line %d +NULL + +-- Testing array_diff() function with less than expected no. of arguments -- + +Warning: array_diff(): at least 2 parameters are required, 1 given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key.phpt b/ext/standard/tests/array/array_diff_key.phpt new file mode 100644 index 0000000..765431f --- /dev/null +++ b/ext/standard/tests/array/array_diff_key.phpt @@ -0,0 +1,250 @@ +--TEST-- +Test of the array_diff_key() and array_diff_ukey() +--FILE-- + &$a_f_el) { $a_f_el =$k*2;} +foreach ($b_f as $k=> &$b_f_el) { $b_f_el =$k*2;} +foreach ($c_f as $k=> &$c_f_el) { $c_f_el =$k*2;} +foreach ($d_f as $k=> &$d_f_el) { $d_f_el =$k*2;} + +echo "------ Test $i --------\n";$i++;// 1 +var_dump(array_diff_key($a_f, $b_f));// keys -> 1, 6, 15, 1200 +var_dump(array_diff_ukey($a_f, $b_f, "comp_func"));// 1, 6, 15, 1200 + +echo "------ Test $i --------\n";$i++;// 2 +var_dump(array_diff_key($a_f, $c_f));// keys -> 1, 15, 1200 +var_dump(array_diff_ukey($a_f, $c_f, "comp_func"));// 1, 15, 1200 + +echo "------ Test $i --------\n";$i++;// 3 +var_dump(array_diff_key($a_f, $d_f));// 1, 6, 2, 15, 1200, -2500 +var_dump(array_diff_ukey($a_f, $d_f, "comp_func"));// 1, 6, 2, 15, 1200, -2500 + +echo "------ Test $i --------\n";$i++;// 4 +var_dump(array_diff_key($a_f, $b_f, $c_f));// 1, 15, 1200 +var_dump(array_diff_ukey($a_f, $b_f, $c_f, "comp_func"));// 1, 15, 1200 + +echo "------ Test $i --------\n";$i++;// 5 +var_dump(array_diff_key($a_f, $b_f, $d_f));// 1, 6, 15, 1200 +var_dump(array_diff_ukey($a_f, $b_f, $d_f, "comp_func"));// 1, 6, 15, 1200 + + +echo "------ Test $i --------\n";$i++;// 6 +var_dump(array_diff_key($a_f, $b_f, $c_f, $d_f));// 1, 15, 1200 +var_dump(array_diff_ukey($a_f, $b_f, $c_f, $d_f, "comp_func"));//1, 15, 1200 + + +echo "------ Test $i --------\n";$i++;// 7 +var_dump(array_diff_key($b_f, $c_f));// 7, 11, 1100 +var_dump(array_diff_ukey($b_f, $c_f, "comp_func"));//7, 11, 1100 + +echo "------ Test $i --------\n";$i++;// 8 +var_dump(array_diff_key($b_f, $d_f));//0, 7, 2, 11, 1100, -2500 +var_dump(array_diff_ukey($b_f, $d_f, "comp_func"));//0, 7, 2, 11, 1100, -2500 + + +echo "------ Test $i --------\n";$i++;// 9 +var_dump(array_diff_key($b_f, $c_f, $d_f));// 7, 11, 1100 +var_dump(array_diff_ukey($b_f, $c_f, $d_f, "comp_func"));// 7, 11, 1000 + +function comp_func($a, $b) { + if ($a === $b) return 0; + return ($a > $b)? 1:-1; + +} +?> +--EXPECTF-- +------ Test 1 -------- +array(4) { + [1]=> + int(2) + [6]=> + int(12) + [15]=> + int(30) + [1200]=> + int(2400) +} +array(4) { + [1]=> + int(2) + [6]=> + int(12) + [15]=> + int(30) + [1200]=> + int(2400) +} +------ Test 2 -------- +array(3) { + [1]=> + int(2) + [15]=> + int(30) + [1200]=> + int(2400) +} +array(3) { + [1]=> + int(2) + [15]=> + int(30) + [1200]=> + int(2400) +} +------ Test 3 -------- +array(6) { + [1]=> + int(2) + [6]=> + int(12) + [2]=> + int(4) + [15]=> + int(30) + [1200]=> + int(2400) + [-2500]=> + &int(-5000) +} +array(6) { + [1]=> + int(2) + [6]=> + int(12) + [2]=> + int(4) + [15]=> + int(30) + [1200]=> + int(2400) + [-2500]=> + &int(-5000) +} +------ Test 4 -------- +array(3) { + [1]=> + int(2) + [15]=> + int(30) + [1200]=> + int(2400) +} +array(3) { + [1]=> + int(2) + [15]=> + int(30) + [1200]=> + int(2400) +} +------ Test 5 -------- +array(4) { + [1]=> + int(2) + [6]=> + int(12) + [15]=> + int(30) + [1200]=> + int(2400) +} +array(4) { + [1]=> + int(2) + [6]=> + int(12) + [15]=> + int(30) + [1200]=> + int(2400) +} +------ Test 6 -------- +array(3) { + [1]=> + int(2) + [15]=> + int(30) + [1200]=> + int(2400) +} +array(3) { + [1]=> + int(2) + [15]=> + int(30) + [1200]=> + int(2400) +} +------ Test 7 -------- +array(3) { + [7]=> + int(14) + [11]=> + int(22) + [1100]=> + int(2200) +} +array(3) { + [7]=> + int(14) + [11]=> + int(22) + [1100]=> + int(2200) +} +------ Test 8 -------- +array(6) { + [0]=> + int(0) + [7]=> + int(14) + [2]=> + int(4) + [11]=> + int(22) + [1100]=> + int(2200) + [-2500]=> + &int(-5000) +} +array(6) { + [0]=> + int(0) + [7]=> + int(14) + [2]=> + int(4) + [11]=> + int(22) + [1100]=> + int(2200) + [-2500]=> + &int(-5000) +} +------ Test 9 -------- +array(3) { + [7]=> + int(14) + [11]=> + int(22) + [1100]=> + int(2200) +} +array(3) { + [7]=> + int(14) + [11]=> + int(22) + [1100]=> + int(2200) +} diff --git a/ext/standard/tests/array/array_diff_key2.phpt b/ext/standard/tests/array/array_diff_key2.phpt new file mode 100644 index 0000000..b7ef7f3 --- /dev/null +++ b/ext/standard/tests/array/array_diff_key2.phpt @@ -0,0 +1,44 @@ +--TEST-- +basic array_diff_key test +--FILE-- + "green", "b" => "brown", "c" => "blue", "red", ""); +$array2 = array("a" => "green", "yellow", "red", TRUE); +$array3 = array("red", "a"=>"brown", ""); +$result[] = array_diff_key($array1, $array2); +$result[] = array_diff_key($array1, $array3); +$result[] = array_diff_key($array2, $array3); +$result[] = array_diff_key($array1, $array2, $array3); + +var_dump($result); + +?> +--EXPECT-- +array(4) { + [0]=> + array(2) { + ["b"]=> + string(5) "brown" + ["c"]=> + string(4) "blue" + } + [1]=> + array(2) { + ["b"]=> + string(5) "brown" + ["c"]=> + string(4) "blue" + } + [2]=> + array(1) { + [2]=> + bool(true) + } + [3]=> + array(2) { + ["b"]=> + string(5) "brown" + ["c"]=> + string(4) "blue" + } +} diff --git a/ext/standard/tests/array/array_diff_key_basic.phpt b/ext/standard/tests/array/array_diff_key_basic.phpt new file mode 100644 index 0000000..6f6fcb9 --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_basic.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test array_diff_key() : basic functionality +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +var_dump(array_diff_key($array1, $array2)); +?> +--EXPECT-- +array(2) { + ["red"]=> + int(2) + ["purple"]=> + int(4) +} \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_error.phpt b/ext/standard/tests/array/array_diff_key_error.phpt new file mode 100644 index 0000000..90168f5 --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_error.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_diff_key() function : error conditions +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); + +// Testing array_diff_key with one less than the expected number of arguments +echo "\n-- Testing array_diff_key() function with less than expected no. of arguments --\n"; +var_dump( array_diff_key($array1) ); + +// Testing array_diff_key with no arguments +echo "\n-- Testing array_diff_key() function with no arguments --\n"; +var_dump( array_diff_key() ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : error conditions *** + +-- Testing array_diff_key() function with less than expected no. of arguments -- + +Warning: array_diff_key(): at least 2 parameters are required, 1 given in %s on line %d +NULL + +-- Testing array_diff_key() function with no arguments -- + +Warning: array_diff_key(): at least 2 parameters are required, 0 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_diff_key_variation1.phpt b/ext/standard/tests/array/array_diff_key_variation1.phpt new file mode 100644 index 0000000..52b703f --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation1.phpt @@ -0,0 +1,310 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing unexpected values to first argument +--FILE-- + 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array3 = array(1, 2, 3, 4, 5); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for arr1 +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_key($value, $array2) ); + var_dump( array_diff_key($value, $array2, $array3) ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +--int 0-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_variation2.phpt b/ext/standard/tests/array/array_diff_key_variation2.phpt new file mode 100644 index 0000000..737ee2e --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation2.phpt @@ -0,0 +1,311 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing unexpected values to second argument +--FILE-- + 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array3 = array(1, 2, 3, 4, 5); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_key($array1, $value) ); + var_dump( array_diff_key($array1, $value, $array3) ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +--int 0-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_variation3.phpt b/ext/standard/tests/array/array_diff_key_variation3.phpt new file mode 100644 index 0000000..28f4c05 --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation3.phpt @@ -0,0 +1,232 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing unexpected values to third optional argument +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_key($array1, $array2, $value) ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +--int 0-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_variation4.phpt b/ext/standard/tests/array/array_diff_key_variation4.phpt new file mode 100644 index 0000000..d3ef45c --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation4.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing integer indexed array +--FILE-- + '-07', 0xA => '0xA'); + +$input_arrays = array( + 'decimal indexed' => array(10 => '10', '-17' => '-17'), + 'octal indexed' => array(-011 => '-011', 012 => '012'), + 'hexa indexed' => array(0x12 => '0x12', -0x7 => '-0x7', ), +); + +// loop through each element of the array for arr1 +foreach($input_arrays as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_key($input_array, $value) ); + var_dump( array_diff_key($value, $input_array) ); +} +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +--decimal indexed-- +array(1) { + [-7]=> + string(3) "-07" +} +array(1) { + [-17]=> + string(3) "-17" +} + +--octal indexed-- +array(1) { + [-7]=> + string(3) "-07" +} +array(1) { + [-9]=> + string(4) "-011" +} + +--hexa indexed-- +array(1) { + [10]=> + string(3) "0xA" +} +array(1) { + [18]=> + string(4) "0x12" +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_variation5.phpt b/ext/standard/tests/array/array_diff_key_variation5.phpt new file mode 100644 index 0000000..f777953 --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation5.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing float indexed array +--FILE-- + '0', 10 => '10', -10 => '-10', 20 =>'20', -20 => '-20'); +$float_indx_array = array(0.0 => '0.0', 10.5 => '10.5', -10.5 => '-10.5', 0.5 => '0.5'); + +echo "\n-- Testing array_diff_key() function with float indexed array --\n"; +// loop through each element of the array for arr1 +var_dump( array_diff_key($input_array, $float_indx_array) ); +var_dump( array_diff_key($float_indx_array, $input_array) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +-- Testing array_diff_key() function with float indexed array -- +array(2) { + [20]=> + string(2) "20" + [-20]=> + string(3) "-20" +} +array(0) { +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_variation6.phpt b/ext/standard/tests/array/array_diff_key_variation6.phpt new file mode 100644 index 0000000..48334fc --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation6.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing boolean indexed array +--FILE-- + '0', 1 => '1', -10 => '-10', 'true' => 1, 'false' => 0); +$boolean_indx_array = array(true => 'boolt', false => 'boolf', TRUE => 'boolT', FALSE => 'boolF'); + +echo "\n-- Testing array_diff_key() function with boolean indexed array --\n"; +// loop through each element of the array for arr1 +var_dump( array_diff_key($input_array, $boolean_indx_array) ); +var_dump( array_diff_key($boolean_indx_array, $input_array) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +-- Testing array_diff_key() function with boolean indexed array -- +array(3) { + [-10]=> + string(3) "-10" + ["true"]=> + int(1) + ["false"]=> + int(0) +} +array(0) { +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_variation7.phpt b/ext/standard/tests/array/array_diff_key_variation7.phpt new file mode 100644 index 0000000..c2e806c --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation7.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing null,unset and undefined variable indexed array +--FILE-- + '10', "" => 'empty'); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$input_arrays = array( + 'null indexed' => array(NULL => 'null 1', null => 'null 2'), + 'undefined indexed' => array(@$undefined_var => 'undefined'), + 'unset indexed' => array(@$unset_var => 'unset'), +); + +foreach($input_arrays as $key =>$value) { + echo "\n--$key--\n"; + // loop through each element of the array for arr1 + var_dump( array_diff_key($input_array, $value) ); + var_dump( array_diff_key($value, $input_array) ); +} +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +--null indexed-- +array(1) { + [10]=> + string(2) "10" +} +array(0) { +} + +--undefined indexed-- +array(1) { + [10]=> + string(2) "10" +} +array(0) { +} + +--unset indexed-- +array(1) { + [10]=> + string(2) "10" +} +array(0) { +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_variation8.phpt b/ext/standard/tests/array/array_diff_key_variation8.phpt new file mode 100644 index 0000000..3242e69 --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation8.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing multi-dimensional array +--FILE-- + array('blue' => 1, 'red' => 2), + + 'second' => array('yellow' => 7), + + 'third' => array(0 => 'zero'), +); + +$array2 = array ( + + 'first' => array('blue' => 1, 'red' => 2,), + + 'second' => array('cyan' => 8), + + 'fourth' => array(2 => 'two'), +); + +echo "\n-- Testing array_diff_key() function with multi dimensional array --\n"; +var_dump( array_diff_key($array1, $array2) ); +var_dump( array_diff_key($array2, $array1) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +-- Testing array_diff_key() function with multi dimensional array -- +array(1) { + ["third"]=> + array(1) { + [0]=> + string(4) "zero" + } +} +array(1) { + ["fourth"]=> + array(1) { + [2]=> + string(3) "two" + } +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_uassoc_basic.phpt b/ext/standard/tests/array/array_diff_uassoc_basic.phpt new file mode 100644 index 0000000..6a96be6 --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_basic.phpt @@ -0,0 +1,28 @@ +--TEST-- +array_diff_uassoc(): Basic test +--FILE-- + $b) ? 1 : -1; +} +$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); +$result = array_diff_uassoc($array1, $array2, "key_compare_func"); +var_dump($result); +?> +--EXPECT-- +array(3) { + ["b"]=> + string(5) "brown" + ["c"]=> + string(4) "blue" + [0]=> + string(3) "red" +} \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_uassoc_error.phpt b/ext/standard/tests/array/array_diff_uassoc_error.phpt new file mode 100644 index 0000000..0f9f824 --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_error.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test array_diff_uassoc() function : error conditions +--FILE-- + "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); +$array3 = array("a" => "green", "red"); +$array4 = array(); +$extra_arg = array(1, 2, 3, 4); + +function key_compare_func($a, $b) +{ + if ($a === $b) { + return 0; + } + return ($a > $b)? 1:-1; +} + +//Test array_diff_uassoc with one more than the expected number of arguments +echo "\n-- Testing array_diff_uassoc() function with more than expected no. of arguments --\n"; +var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) ); +var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) ); + +// Testing array_diff_uassoc with one less than the expected number of arguments +echo "\n-- Testing array_diff_uassoc() function with less than expected no. of arguments --\n"; +var_dump( array_diff_uassoc($array1, $array2) ); + +// Testing array_diff_uassoc with no arguments +echo "\n-- Testing array_diff_uassoc() function with no arguments --\n"; +var_dump( array_diff_uassoc() ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : error conditions *** + +-- Testing array_diff_uassoc() function with more than expected no. of arguments -- + +Warning: array_diff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +Warning: array_diff_uassoc() expects parameter 6 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +-- Testing array_diff_uassoc() function with less than expected no. of arguments -- + +Warning: array_diff_uassoc(): at least 3 parameters are required, 2 given in %s on line %d +NULL + +-- Testing array_diff_uassoc() function with no arguments -- + +Warning: array_diff_uassoc(): at least 3 parameters are required, 0 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation1.phpt b/ext/standard/tests/array/array_diff_uassoc_variation1.phpt new file mode 100644 index 0000000..75494c7 --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation1.phpt @@ -0,0 +1,244 @@ +--TEST-- +Test array_diff_uassoc() function : usage variation - Passing unexpected values to first argument +--FILE-- + "green", "yellow", "red"); + +function key_compare_func($a, $b) +{ + if ($a === $b) { + return 0; + } + return ($a > $b)? 1:-1; +} + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_uassoc($value, $array2, "key_compare_func") ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** + +--int 0-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_diff_uassoc(): Argument #1 is not an array in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation10.phpt b/ext/standard/tests/array/array_diff_uassoc_variation10.phpt new file mode 100644 index 0000000..57b17d1 --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation10.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test array_diff_uassoc() function : usage variation - Passing float indexed array +--FILE-- + '0', 10 => '10', -10 => '-10', 20 =>'20', -20 => '-20'); +$float_indx_array = array(0.0 => '0.0', 10.5 => '10.5', -10.5 => '-10.5', 0.5 => '0.5'); + +echo "\n-- Testing array_diff_key() function with float indexed array --\n"; +var_dump( array_diff_uassoc($input_array, $float_indx_array, "strcasecmp") ); +var_dump( array_diff_uassoc($float_indx_array, $input_array, "strcasecmp") ); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** + +-- Testing array_diff_key() function with float indexed array -- +array(5) { + [0]=> + string(1) "0" + [10]=> + string(2) "10" + [-10]=> + string(3) "-10" + [20]=> + string(2) "20" + [-20]=> + string(3) "-20" +} +array(3) { + [0]=> + string(3) "0.5" + [10]=> + string(4) "10.5" + [-10]=> + string(5) "-10.5" +} +===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation11.phpt b/ext/standard/tests/array/array_diff_uassoc_variation11.phpt new file mode 100644 index 0000000..b77df32 --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation11.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test array_diff_uassoc() function : usage variation - Passing boolean indexed array +--FILE-- + '0', 1 => '1', -10 => '-10', 'true' => 1, 'false' => 0); +$boolean_indx_array = array(true => 'boolt', false => 'boolf', TRUE => 'boolT', FALSE => 'boolF'); + +echo "\n-- Testing array_diff_key() function with float indexed array --\n"; +var_dump( array_diff_uassoc($input_array, $boolean_indx_array, "strcasecmp") ); +var_dump( array_diff_uassoc($boolean_indx_array, $input_array, "strcasecmp") ); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** + +-- Testing array_diff_key() function with float indexed array -- +array(5) { + [0]=> + string(1) "0" + [1]=> + string(1) "1" + [-10]=> + string(3) "-10" + ["true"]=> + int(1) + ["false"]=> + int(0) +} +array(2) { + [1]=> + string(5) "boolT" + [0]=> + string(5) "boolF" +} +===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation12.phpt b/ext/standard/tests/array/array_diff_uassoc_variation12.phpt new file mode 100644 index 0000000..9d48231 --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation12.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test array_diff_uassoc() function : usage variation - Passing null,unset and undefined variable indexed array +--FILE-- + '10', "" => ''); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$input_arrays = array( + 'null indexed' => array(NULL => NULL, null => null), + 'undefined indexed' => array(@$undefined_var => @$undefined_var), + 'unset indexed' => array(@$unset_var => @$unset_var), +); + +foreach($input_arrays as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_uassoc($input_array, $value, "strcasecmp") ); + var_dump( array_diff_uassoc($value, $input_array, "strcasecmp") ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** + +--null indexed-- +array(1) { + [10]=> + string(2) "10" +} +array(0) { +} + +--undefined indexed-- +array(1) { + [10]=> + string(2) "10" +} +array(0) { +} + +--unset indexed-- +array(1) { + [10]=> + string(2) "10" +} +array(0) { +} +===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation13.phpt b/ext/standard/tests/array/array_diff_uassoc_variation13.phpt new file mode 100644 index 0000000..9219426 --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation13.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test array_diff_uassoc() function : usage variations - arrays containing referenced variables +--FILE-- + 1, &$ref_var); + +echo "\n-- Testing array_diff_uassoc() function with referenced variable \$ref_var has value '$ref_var' --\n"; +var_dump( array_diff_uassoc($array1, $array2, "strcasecmp") ); +var_dump( array_diff_uassoc($array2, $array1, "strcasecmp") ); + +// re-assign reference variable to different value +$ref_var = 10.00; +echo "\n-- Testing array_diff_uassoc() function with referenced variable \$ref_var value changed to $ref_var --\n"; +var_dump( array_diff_uassoc($array1, $array2, "strcasecmp") ); +var_dump( array_diff_uassoc($array2, $array1, "strcasecmp") ); + +//When array are refenced +$array2 = &$array1; +echo "\n-- Testing array_diff_uassoc() function when \$array2 is referenced to \$array1 --\n"; +var_dump( array_diff_uassoc($array1, $array2, "strcasecmp") ); +var_dump( array_diff_uassoc($array2, $array1, "strcasecmp") ); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** + +-- Testing array_diff_uassoc() function with referenced variable $ref_var has value 'a' -- +array(1) { + [1]=> + string(1) "a" +} +array(1) { + ["a"]=> + int(1) +} + +-- Testing array_diff_uassoc() function with referenced variable $ref_var value changed to 10 -- +array(2) { + [0]=> + string(1) "a" + [1]=> + string(1) "a" +} +array(2) { + ["a"]=> + int(1) + [0]=> + &float(10) +} + +-- Testing array_diff_uassoc() function when $array2 is referenced to $array1 -- +array(0) { +} +array(0) { +} +===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation14.phpt b/ext/standard/tests/array/array_diff_uassoc_variation14.phpt new file mode 100644 index 0000000..a98a280 --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation14.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test array_diff_uassoc() function : usage variation -Passing classWithoutToString (handling fatal error) to callback +--FILE-- + "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); + +class classWithoutToString +{ +} + +// Define error handler +function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { + if (error_reporting() != 0) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } +} +set_error_handler('test_error_handler'); + +$value = new classWithoutToString(); +var_dump( array_diff_uassoc($array1, $array2, $value) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** +Error: 2 - array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given, %s(%d) +NULL +===DONE=== + diff --git a/ext/standard/tests/array/array_diff_uassoc_variation2.phpt b/ext/standard/tests/array/array_diff_uassoc_variation2.phpt new file mode 100644 index 0000000..1d3f6a4 --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation2.phpt @@ -0,0 +1,244 @@ +--TEST-- +Test array_diff_uassoc() function : usage variation -Passing unexpected values to second argument +--FILE-- + "green", "b" => "brown", "c" => "blue", "red"); + +function key_compare_func($a, $b) +{ + if ($a === $b) { + return 0; + } + return ($a > $b)? 1:-1; +} + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_uassoc($array1, $value, "key_compare_func") ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** + +--int 0-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_diff_uassoc(): Argument #2 is not an array in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation3.phpt b/ext/standard/tests/array/array_diff_uassoc_variation3.phpt new file mode 100644 index 0000000..3218dd3 --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation3.phpt @@ -0,0 +1,263 @@ +--TEST-- +Test array_diff_uassoc() function : usage variation -Passing unexpected values to callback argument +--FILE-- + "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for key_comp_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_uassoc($array1, $array2, $value) ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** + +--int 0-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--int 1-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--int 12345-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--int -12345-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--float 10.5-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--float -10.5-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--float .5-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--empty array-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +--int indexed array-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +--associative array-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL + +--nested arrays-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--lowercase null-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--lowercase true-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--lowercase false-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL + +--string DQ-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %s on line %d +NULL + +--string SQ-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %s on line %d +NULL + +--mixed case string-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, function 'sTrInG' not found or invalid function name in %s on line %d +NULL + +--heredoc-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, function 'hello world' not found or invalid function name in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--undefined var-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--unset var-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +--resource-- + +Warning: array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation4.phpt b/ext/standard/tests/array/array_diff_uassoc_variation4.phpt new file mode 100644 index 0000000..ab87449 --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation4.phpt @@ -0,0 +1,246 @@ +--TEST-- +Test array_diff_uassoc() function : usage variation -Passing unexpected values as third optional argument +--FILE-- + "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); + + +function key_compare_func($a, $b) +{ + if ($a === $b) { + return 0; + } + return ($a > $b)? 1:-1; +} + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_uassoc($array1, $array2, $value, "key_compare_func") ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** + +--int 0-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_diff_uassoc(): Argument #3 is not an array in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation5.phpt b/ext/standard/tests/array/array_diff_uassoc_variation5.phpt new file mode 100644 index 0000000..c35b2eb --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation5.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test array_diff_uassoc() function : usage variation - Comparing integers and floating point numbers +--FILE-- + 1.00, 1.00 => 2.00, 2.00 => 3.00, 3.00 => 4.00); + + +function key_compare_func($key1, $key2) +{ + if ($key1 === $key2) { + return 0; + } + return ($key1 > $key2)? 1:-1; +} + +echo "\n-- Result of comparing integers and floating point numbers --\n"; +var_dump( array_diff_uassoc($arr_default_int, $arr_float, "key_compare_func") ); +var_dump( array_diff_uassoc($arr_float, $arr_default_int, "key_compare_func") ); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** + +-- Result of comparing integers and floating point numbers -- +array(0) { +} +array(0) { +} +===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation6.phpt b/ext/standard/tests/array/array_diff_uassoc_variation6.phpt new file mode 100644 index 0000000..ad4e8ff --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation6.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test array_diff_uassoc() function : usage variation - Comparing floating points with strings having integers and float +--FILE-- + 1.00, 1.00 => 2.00); +$arr_string_int = array('1', '2'); +$arr_string_float = array('0' => '1.00', '1.00' => '2.00'); + +function key_compare_func($key1, $key2) +{ + if ($key1 === $key2) { + return 0; + } + return ($key1 > $key2)? 1:-1; +} + +echo "\n-- Result of comparing floating points and strings containing integers --\n"; +var_dump( array_diff_uassoc($arr_float, $arr_string_int, "key_compare_func") ); +var_dump( array_diff_uassoc($arr_string_int, $arr_float, "key_compare_func") ); + +echo "\n-- Result of comparing floating points and strings containing floating point --\n"; +var_dump( array_diff_uassoc($arr_float, $arr_string_float, "key_compare_func") ); +var_dump( array_diff_uassoc($arr_string_float, $arr_float, "key_compare_func") ); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** + +-- Result of comparing floating points and strings containing integers -- +array(0) { +} +array(0) { +} + +-- Result of comparing floating points and strings containing floating point -- +array(2) { + [0]=> + float(1) + [1]=> + float(2) +} +array(2) { + [0]=> + string(4) "1.00" + ["1.00"]=> + string(4) "2.00" +} +===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation7.phpt b/ext/standard/tests/array/array_diff_uassoc_variation7.phpt new file mode 100644 index 0000000..da2030c --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation7.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test array_diff_uassoc() function : usage variation - Comparing strings containing integers and float +--FILE-- + '1.00', '1.00' => '2.00'); + +function key_compare_func($key1, $key2) +{ + if ($key1 === $key2) { + return 0; + } + return ($key1 > $key2)? 1:-1; +} + +echo "\n-- Result of comparing strings containing integers and strings containing floating points --\n"; +var_dump( array_diff_uassoc($arr_string_int, $arr_string_float, "key_compare_func") ); +var_dump( array_diff_uassoc($arr_string_float, $arr_string_int, "key_compare_func") ); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** + +-- Result of comparing strings containing integers and strings containing floating points -- +array(2) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" +} +array(2) { + [0]=> + string(4) "1.00" + ["1.00"]=> + string(4) "2.00" +} +===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation8.phpt b/ext/standard/tests/array/array_diff_uassoc_variation8.phpt new file mode 100644 index 0000000..d450def --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation8.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test array_diff_uassoc() function : usage variation - Comparing integers with strings containing integers and float +--FILE-- + '1.00', '1.00' => '2.00'); + +function key_compare_func($key1, $key2) +{ + if ($key1 === $key2) { + return 0; + } + return ($key1 > $key2)? 1:-1; +} + +echo "\n-- Result of comparing integers and strings containing an integers --\n"; +var_dump( array_diff_uassoc($arr_default_int, $arr_string_int, "key_compare_func") ); +var_dump( array_diff_uassoc($arr_string_int, $arr_default_int, "key_compare_func") ); + +echo "\n-- Result of comparing integers and strings containing floating points --\n"; +var_dump( array_diff_uassoc($arr_default_int, $arr_string_float, "key_compare_func") ); +var_dump( array_diff_uassoc($arr_string_float, $arr_default_int, "key_compare_func") ); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** + +-- Result of comparing integers and strings containing an integers -- +array(1) { + [2]=> + int(3) +} +array(0) { +} + +-- Result of comparing integers and strings containing floating points -- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(2) { + [0]=> + string(4) "1.00" + ["1.00"]=> + string(4) "2.00" +} +===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation9.phpt b/ext/standard/tests/array/array_diff_uassoc_variation9.phpt new file mode 100644 index 0000000..72746bb --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation9.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test array_diff_uassoc() function : usage variation - Passing integer indexed array +--FILE-- + 10, 12 => 12); + +$input_arrays = array( + 'decimal indexed' => array(10 => 10, -17 => -17), + 'octal indexed' => array( 012 => 10, -011 => -011,), + 'hexa indexed' => array(0xA => 10, -0x7 => -0x7 ), +); + +foreach($input_arrays as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_uassoc($input_array, $value, "strcasecmp") ); + var_dump( array_diff_uassoc($value, $input_array, "strcasecmp") ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** + +--decimal indexed-- +array(1) { + [12]=> + int(12) +} +array(1) { + [-17]=> + int(-17) +} + +--octal indexed-- +array(1) { + [12]=> + int(12) +} +array(1) { + [-9]=> + int(-9) +} + +--hexa indexed-- +array(1) { + [12]=> + int(12) +} +array(1) { + [-7]=> + int(-7) +} +===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_basic.phpt b/ext/standard/tests/array/array_diff_ukey_basic.phpt new file mode 100644 index 0000000..7ac309a --- /dev/null +++ b/ext/standard/tests/array/array_diff_ukey_basic.phpt @@ -0,0 +1,24 @@ +--TEST-- +array_diff_ukey() : Basic test. +--FILE-- + $key2) return 1; + else return -1; +} +$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +var_dump(array_diff_ukey($array1, $array2, 'key_compare_func')); +?> +--EXPECT-- +array(2) { + ["red"]=> + int(2) + ["purple"]=> + int(4) +} diff --git a/ext/standard/tests/array/array_diff_ukey_error.phpt b/ext/standard/tests/array/array_diff_ukey_error.phpt new file mode 100644 index 0000000..1a73bdf --- /dev/null +++ b/ext/standard/tests/array/array_diff_ukey_error.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test array_diff_ukey() function : error conditions +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$extra_arg = 10; + +function key_compare_func($key1, $key2) +{ + if ($key1 == $key2) { + return 0; + } + return ($key1 > $key2)? 1:-1; +} + +//Test array_diff_ukey with one more than the expected number of arguments +echo "\n-- Testing array_diff_ukey() function with more than expected no. of arguments --\n"; +var_dump( array_diff_ukey($array1, $array2, 'key_compare_func', $extra_arg) ); + +// Testing array_diff_ukey with one less than the expected number of arguments +echo "\n-- Testing array_diff_ukey() function with less than expected no. of arguments --\n"; +var_dump( array_diff_ukey($array1, $array2) ); + +// Testing array_diff_ukey with one less than the expected number of arguments +echo "\n-- Testing array_diff_ukey() function with no arguments --\n"; +var_dump( array_diff_ukey() ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_ukey() : error conditions *** + +-- Testing array_diff_ukey() function with more than expected no. of arguments -- + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Testing array_diff_ukey() function with less than expected no. of arguments -- + +Warning: array_diff_ukey(): at least 3 parameters are required, 2 given in %s on line %d +NULL + +-- Testing array_diff_ukey() function with no arguments -- + +Warning: array_diff_ukey(): at least 3 parameters are required, 0 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation1.phpt b/ext/standard/tests/array/array_diff_ukey_variation1.phpt new file mode 100644 index 0000000..9a849e0 --- /dev/null +++ b/ext/standard/tests/array/array_diff_ukey_variation1.phpt @@ -0,0 +1,318 @@ +--TEST-- +Test array_diff_ukey() function : usage variation - Passing unexpected values to first argument +--FILE-- + 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array3 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); + +function key_compare_func($key1, $key2) +{ + if ($key1 == $key2) { + return 0; + } + return ($key1 > $key2)? 1:-1; +} + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for arr1 +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_ukey($value, $array2, 'key_compare_func') ); + var_dump( array_diff_ukey($value, $array2, $array3, 'key_compare_func') ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_ukey() : usage variation *** + +--int 0-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #1 is not an array in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation10.phpt b/ext/standard/tests/array/array_diff_ukey_variation10.phpt new file mode 100644 index 0000000..0d93928 --- /dev/null +++ b/ext/standard/tests/array/array_diff_ukey_variation10.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test array_diff_ukey() function : usage variation - Passing non-existing function name to callback +--FILE-- + "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); + +//function name within double quotes +var_dump( array_diff_ukey($array1, $array1, "unknown_function") ); + +//function name within single quotes +var_dump( array_diff_ukey($array1, $array1, 'unknown_function') ); + +//function name without quotes +var_dump( array_diff_ukey($array1, $array1, unknown_function) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_ukey() : usage variation *** + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d +NULL + +Notice: Use of undefined constant unknown_function - assumed 'unknown_function' in %s on line %d + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation11.phpt b/ext/standard/tests/array/array_diff_ukey_variation11.phpt new file mode 100644 index 0000000..0ad3fba --- /dev/null +++ b/ext/standard/tests/array/array_diff_ukey_variation11.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test array_diff_ukey() function : usage variation - Passing class without string to callback (Handling fatal error) +--FILE-- + 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array2 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array3 = array(1, 2, 3, 4, 5); + +// Define error handler +function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { + if (error_reporting() != 0) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } +} +set_error_handler('test_error_handler'); + + +class classWithoutToString +{ +} + +$value = new classWithoutToString(); + +var_dump( array_diff_ukey($array1, $array2, $value) ); +var_dump( array_diff_ukey($array1, $array2, $array3, $value) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_ukey() : usage variation *** +Error: 2 - array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given, %s(%d) +NULL +Error: 2 - array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given, %s(%d) +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_ukey_variation2.phpt b/ext/standard/tests/array/array_diff_ukey_variation2.phpt new file mode 100644 index 0000000..19eab4d --- /dev/null +++ b/ext/standard/tests/array/array_diff_ukey_variation2.phpt @@ -0,0 +1,322 @@ +--TEST-- +Test array_diff_ukey() function : usage variation - Passing unexpected values to second argument +--FILE-- + 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array3 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); + + +//Initialize key_comp_func of type callback +function key_compare_func($key1, $key2) +{ + if ($key1 == $key2) { + return 0; + } + return ($key1 > $key2)? 1:-1; +} + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, + +); + +// loop through each element of the array for arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_ukey($array1, $value, 'key_compare_func') ); + var_dump( array_diff_ukey($array1, $value, $array3, 'key_compare_func') ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_ukey() : usage variation *** + +--int 0-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_ukey(): Argument #2 is not an array in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation3.phpt b/ext/standard/tests/array/array_diff_ukey_variation3.phpt new file mode 100644 index 0000000..f7a2ea8 --- /dev/null +++ b/ext/standard/tests/array/array_diff_ukey_variation3.phpt @@ -0,0 +1,240 @@ +--TEST-- +Test array_diff_ukey() function : usage variation - Passing unexpected values to third optional argument +--FILE-- + 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array2 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); + +function key_compare_func($key1, $key2) +{ + if ($key1 == $key2) { + return 0; + } + return ($key1 > $key2)? 1:-1; +} + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for key_comp_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_ukey($array1, $array2, $value, 'key_compare_func') ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_ukey() : usage variation *** + +--int 0-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_diff_ukey(): Argument #3 is not an array in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation4.phpt b/ext/standard/tests/array/array_diff_ukey_variation4.phpt new file mode 100644 index 0000000..a0399c2 --- /dev/null +++ b/ext/standard/tests/array/array_diff_ukey_variation4.phpt @@ -0,0 +1,254 @@ +--TEST-- +Test array_diff_ukey() function : usage variation - Passing unexpected values to callback argument +--FILE-- + 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array2 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array3 = array(1, 2, 3, 4, 5); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for ... + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_ukey($array1, $array2, $value) ); + var_dump( array_diff_ukey($array1, $array2, $array3, $value) ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_ukey() : usage variation *** + +--int 0-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--int 1-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--int 12345-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--int -12345-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float 10.5-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float -10.5-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float .5-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--lowercase null-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--lowercase true-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--lowercase false-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--undefined var-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--unset var-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--resource-- + +Warning: array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation5.phpt b/ext/standard/tests/array/array_diff_ukey_variation5.phpt new file mode 100644 index 0000000..fb0c97a --- /dev/null +++ b/ext/standard/tests/array/array_diff_ukey_variation5.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test array_diff_ukey() function : usage variation - Passing multi-dimensional array +--FILE-- + array('blue' => 1, 'red' => 2), + + 'second' => array('yellow' => 7), + + 'third' => array(0 => 'zero'), +); + +$array2 = array ( + + 'first' => array('blue' => 1, 'red' => 2,), + + 'second' => array('cyan' => 8), + + 'fourth' => array(2 => 'two'), +); + +echo "\n-- Testing array_diff_ukey() function with multi dimensional array --\n"; +var_dump( array_diff_ukey($array1, $array2, 'strcasecmp') ); +var_dump( array_diff_ukey($array2, $array1, 'strcasecmp') ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_ukey() : usage variation *** + +-- Testing array_diff_ukey() function with multi dimensional array -- +array(1) { + ["third"]=> + array(1) { + [0]=> + string(4) "zero" + } +} +array(1) { + ["fourth"]=> + array(1) { + [2]=> + string(3) "two" + } +} +===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation6.phpt b/ext/standard/tests/array/array_diff_ukey_variation6.phpt new file mode 100644 index 0000000..2188a88 --- /dev/null +++ b/ext/standard/tests/array/array_diff_ukey_variation6.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test array_diff_ukey() function : usage variation - Passing integer indexed array +--FILE-- + '-07', 0xA => '0xA'); + +$input_arrays = array( + 'decimal indexed' => array(10 => '10', '-17' => '-17'), + 'octal indexed' => array(-011 => '-011', 012 => '012'), + 'hexa indexed' => array(0x12 => '0x12', -0x7 => '-0x7', ), +); + +function key_compare_func($key1, $key2) +{ + return strcasecmp($key1, $key2); +} + +foreach($input_arrays as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_ukey($value, $input_array, 'key_compare_func') ); + var_dump( array_diff_ukey($input_array, $value, 'key_compare_func') ); +} +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_ukey() : usage variation *** + +--decimal indexed-- +array(1) { + [-17]=> + string(3) "-17" +} +array(1) { + [-7]=> + string(3) "-07" +} + +--octal indexed-- +array(1) { + [-9]=> + string(4) "-011" +} +array(1) { + [-7]=> + string(3) "-07" +} + +--hexa indexed-- +array(1) { + [18]=> + string(4) "0x12" +} +array(1) { + [10]=> + string(3) "0xA" +} +===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation7.phpt b/ext/standard/tests/array/array_diff_ukey_variation7.phpt new file mode 100644 index 0000000..88888d6 --- /dev/null +++ b/ext/standard/tests/array/array_diff_ukey_variation7.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test array_diff_ukey() function : usage variation - Passing float indexed array +--FILE-- + '0', 10 => '10', -10 => '-10', 20 =>'20'); +$float_indx_array = array(0.0 => '0.0', 10.5 => '10.5', -30.5 => '-30.5'); + +function key_compare_func($key1, $key2) +{ + return strcasecmp($key1, $key2); +} + +echo "\n-- Testing array_diff_ukey() function with float indexed array --\n"; + +var_dump( array_diff_ukey($float_indx_array, $input_array, 'key_compare_func') ); +var_dump( array_diff_ukey($input_array, $float_indx_array, 'key_compare_func') ); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_ukey() : usage variation *** + +-- Testing array_diff_ukey() function with float indexed array -- +array(1) { + [-30]=> + string(5) "-30.5" +} +array(2) { + [-10]=> + string(3) "-10" + [20]=> + string(2) "20" +} +===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation8.phpt b/ext/standard/tests/array/array_diff_ukey_variation8.phpt new file mode 100644 index 0000000..9bb9498 --- /dev/null +++ b/ext/standard/tests/array/array_diff_ukey_variation8.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test array_diff_ukey() function : usage variation - Passing boolean indexed array +--FILE-- + '0', 1 => '1', -10 => '-10', 'true' => 1, 'false' => 0); +$boolean_indx_array = array(true => 'boolt', false => 'boolf', TRUE => 'boolT', FALSE => 'boolF'); + +function key_compare_func($key1, $key2) +{ + return strcasecmp($key1, $key2); +} + +echo "\n-- Testing array_diff_ukey() function with boolean indexed array --\n"; + +var_dump( array_diff_ukey($boolean_indx_array, $input_array, 'key_compare_func') ); +var_dump( array_diff_ukey($input_array, $boolean_indx_array, 'key_compare_func') ); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_ukey() : usage variation *** + +-- Testing array_diff_ukey() function with boolean indexed array -- +array(0) { +} +array(3) { + [-10]=> + string(3) "-10" + ["true"]=> + int(1) + ["false"]=> + int(0) +} +===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation9.phpt b/ext/standard/tests/array/array_diff_ukey_variation9.phpt new file mode 100644 index 0000000..024f5f4 --- /dev/null +++ b/ext/standard/tests/array/array_diff_ukey_variation9.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test array_diff_ukey() function : usage variation - Passing null,unset and undefined variable indexed array +--FILE-- + '10', "" => 'empty'); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$input_arrays = array( + 'null indexed' => array(NULL => 'null 1', null => 'null 2'), + 'undefined indexed' => array(@$undefined_var => 'undefined'), + 'unset indexed' => array(@$unset_var => 'unset'), +); + +foreach($input_arrays as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_ukey($value, $input_array, 'strcasecmp') ); + var_dump( array_diff_ukey($input_array, $value, 'strcasecmp') ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_ukey() : usage variation *** + +--null indexed-- +array(0) { +} +array(1) { + [10]=> + string(2) "10" +} + +--undefined indexed-- +array(0) { +} +array(1) { + [10]=> + string(2) "10" +} + +--unset indexed-- +array(0) { +} +array(1) { + [10]=> + string(2) "10" +} +===DONE=== diff --git a/ext/standard/tests/array/array_diff_variation1.phpt b/ext/standard/tests/array/array_diff_variation1.phpt new file mode 100644 index 0000000..f9a34b0 --- /dev/null +++ b/ext/standard/tests/array/array_diff_variation1.phpt @@ -0,0 +1,208 @@ +--TEST-- +Test array_diff() function : usage variations - unexpected values for 'arr1' argument +--FILE-- + +--EXPECTF-- +*** Testing array_diff() : usage variations *** + +-- Iteration 1 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 2 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 3 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 4 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 5 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 6 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 7 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 8 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 9 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 10 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 11 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 12 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 13 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 14 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 15 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 16 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 17 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 18 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 19 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 20 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 21 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 22 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 23 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 24 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 25 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 26 -- +Warning: array_diff(): Argument #1 is not an array in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_variation10.phpt b/ext/standard/tests/array/array_diff_variation10.phpt new file mode 100644 index 0000000..9442b94 --- /dev/null +++ b/ext/standard/tests/array/array_diff_variation10.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test array_diff() function : usage variations - binary safe checking +--FILE-- + "hello", + "str2" => "world"); + +$array2 = array( b"1" => 'hello', + b"world", + "hello", + 'test'); + +var_dump(array_diff($array1, $array2)); +var_dump(array_diff($array2, $array1)); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_diff() : usage variations *** +array(1) { + [0]=> + string(1) "1" +} +array(1) { + [4]=> + string(4) "test" +} +Done diff --git a/ext/standard/tests/array/array_diff_variation2.phpt b/ext/standard/tests/array/array_diff_variation2.phpt new file mode 100644 index 0000000..be68c40 --- /dev/null +++ b/ext/standard/tests/array/array_diff_variation2.phpt @@ -0,0 +1,207 @@ +--TEST-- +Test array_diff() function : usage variations - unexpected values for 'arr2' argument +--FILE-- + +--EXPECTF-- +*** Testing array_diff() : usage variations *** + +-- Iteration 1 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 2 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 3 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 4 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 5 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 6 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 7 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 8 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 9 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 10 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 11 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 12 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 13 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 14 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 15 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 16 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 17 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 18 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 19 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 20 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 21 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 22 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 23 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 24 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 25 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 26 -- +Warning: array_diff(): Argument #2 is not an array in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_variation3.phpt b/ext/standard/tests/array/array_diff_variation3.phpt new file mode 100644 index 0000000..84f73fd --- /dev/null +++ b/ext/standard/tests/array/array_diff_variation3.phpt @@ -0,0 +1,190 @@ +--TEST-- +Test array_diff() function : usage variations - array with different data types as values +--FILE-- + array(), + +/*2*/ +"int" => array( + // int data + 0, + 1, + 12345, + -2345), + +/*3*/ +"float" => array( + // float data + 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5), + +/*4*/ +"null" => array( + // null data + NULL, + null), + +/*5*/ +"boolean" => array( + // boolean data + true, + false, + TRUE, + FALSE), + +/*6*/ +"empty" => array( + // empty data + "", + ''), + +/*7*/ +"string" => array( + // string data + "string", + 'string', + $heredoc), + +/*8*/ +"binary" => array( + // binary data + b"binary", + (binary)"binary"), + +/*9*/ +"undefined" => array( + // undefined data + @$undefined_var), + +/*10*/ +"unset" => array( + // unset data + @$unset_var) +); + +// loop through each element of the array for arr1 +$iterator = 1; +foreach($values as $value) { + echo "\n Iteration: $iterator \n"; + var_dump( array_diff($value, $array) ); + $iterator++; +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_diff() : usage variations *** + + Iteration: 1 +array(0) { +} + + Iteration: 2 +array(3) { + [0]=> + int(0) + [2]=> + int(12345) + [3]=> + int(-2345) +} + + Iteration: 3 +array(5) { + [0]=> + float(10.5) + [1]=> + float(-10.5) + [2]=> + float(123456789000) + [3]=> + float(1.23456789E-9) + [4]=> + float(0.5) +} + + Iteration: 4 +array(2) { + [0]=> + NULL + [1]=> + NULL +} + + Iteration: 5 +array(2) { + [1]=> + bool(false) + [3]=> + bool(false) +} + + Iteration: 6 +array(2) { + [0]=> + string(0) "" + [1]=> + string(0) "" +} + + Iteration: 7 +array(3) { + [0]=> + string(6) "string" + [1]=> + string(6) "string" + [2]=> + string(17) "This is a heredoc" +} + + Iteration: 8 +array(2) { + [0]=> + string(6) "binary" + [1]=> + string(6) "binary" +} + + Iteration: 9 +array(1) { + [0]=> + NULL +} + + Iteration: 10 +array(1) { + [0]=> + NULL +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_variation4.phpt b/ext/standard/tests/array/array_diff_variation4.phpt new file mode 100644 index 0000000..75b01ad --- /dev/null +++ b/ext/standard/tests/array/array_diff_variation4.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test array_diff() function : usage variations - array with different data types as values +--FILE-- + array(), + +/*2*/ +"int" => array( + // int data + 0, + 1, + 12345, + -2345), + +/*3*/ +"float" => array( + // float data + 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5), + +/*4*/ +"null" => array( + // null data + NULL, + null), + +/*5*/ +"boolean" => array( + // boolean data + true, + false, + TRUE, + FALSE), + +/*6*/ +"empty" => array( + // empty data + "", + ''), + +/*7*/ +"string" => array( + // string data + "string", + 'string', + $heredoc), + +/*8*/ +"binary" => array( + // binary data + b"binary", + (binary)"binary"), + +/*9*/ +"undefined" => array( + // undefined data + @$undefined_var), + +/*10*/ +"unset" => array( + // unset data + @$unset_var) +); + +// loop through each element of the array for $arr2 +$iterator = 1; +foreach($values as $value) { + echo "\n Iteration: $iterator \n"; + var_dump( array_diff($array, $value) ); + $iterator++; +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_diff() : usage variations *** + + Iteration: 1 +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + + Iteration: 2 +array(1) { + [1]=> + int(2) +} + + Iteration: 3 +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + + Iteration: 4 +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + + Iteration: 5 +array(1) { + [1]=> + int(2) +} + + Iteration: 6 +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + + Iteration: 7 +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + + Iteration: 8 +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + + Iteration: 9 +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + + Iteration: 10 +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_variation5.phpt b/ext/standard/tests/array/array_diff_variation5.phpt new file mode 100644 index 0000000..cb6b5d3 --- /dev/null +++ b/ext/standard/tests/array/array_diff_variation5.phpt @@ -0,0 +1,119 @@ +--TEST-- +Test array_diff() function : usage variations - comparing integers, float +and string array values +--FILE-- + +--EXPECTF-- +*** Testing array_diff() : usage variations *** +-- Compare integers and floats: -- +array(0) { +} +array(0) { +} +-- Compare integers and strings containing an integers: -- +array(0) { +} +array(0) { +} +-- Compare integers and strings containing floats: -- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(3) { + [0]=> + string(4) "1.00" + [1]=> + string(4) "2.00" + [2]=> + string(4) "3.00" +} +-- Compare floats and strings containing integers: -- +array(0) { +} +array(0) { +} +-- Compare floats and strings containing floats: -- +array(3) { + [0]=> + float(1) + [1]=> + float(2) + [2]=> + float(3) +} +array(3) { + [0]=> + string(4) "1.00" + [1]=> + string(4) "2.00" + [2]=> + string(4) "3.00" +} +-- Compare strings containing integers and strings containing floats: -- +array(3) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" + [2]=> + string(1) "3" +} +array(3) { + [0]=> + string(4) "1.00" + [1]=> + string(4) "2.00" + [2]=> + string(4) "3.00" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_variation6.phpt b/ext/standard/tests/array/array_diff_variation6.phpt new file mode 100644 index 0000000..8ea84bb --- /dev/null +++ b/ext/standard/tests/array/array_diff_variation6.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test array_diff() function : usage variations - array containing duplicate keys and values +--FILE-- + 'd', 'b'); //duplicate key (0), duplicate value (b) +$array_assoc = array ('2' => 'c', //same key=>value pair, different order + '1' => 'b', + '0' => 'a', + 'b' => '3', //key and value from array_index swapped + 'c' => 2); //same as above, using integer + +var_dump(array_diff($array_index, $array_assoc)); +var_dump(array_diff($array_assoc, $array_index)); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_diff() : usage variations *** +array(1) { + [0]=> + string(1) "d" +} +array(3) { + [0]=> + string(1) "a" + ["b"]=> + string(1) "3" + ["c"]=> + int(2) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_variation7.phpt b/ext/standard/tests/array/array_diff_variation7.phpt new file mode 100644 index 0000000..c53cbb3 --- /dev/null +++ b/ext/standard/tests/array/array_diff_variation7.phpt @@ -0,0 +1,95 @@ +--TEST-- +Test array_diff() function : usage variations - arrays containing referenced variables +--FILE-- + + +--EXPECTF-- + +*** Testing array_diff() : usage variations *** +-- Basic Comparison -- +array(3) { + [0]=> + string(2) "&a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +-- $a changed -- +array(3) { + [0]=> + string(2) "&a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +-- Arrays referenced to each other -- +array(0) { +} +array(0) { +} +-- $arr1 changed -- +array(0) { +} +array(0) { +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_variation8.phpt b/ext/standard/tests/array/array_diff_variation8.phpt new file mode 100644 index 0000000..99f9614 --- /dev/null +++ b/ext/standard/tests/array/array_diff_variation8.phpt @@ -0,0 +1,207 @@ +--TEST-- +Test array_diff() function : usage variations - associative arrays contianing different data types +--FILE-- + '1', 'b' => '2', 'c' => '3'); + +// get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a resource variable +$fp = fopen(__FILE__, "r"); + +// get a class +class classA +{ + public function __toString() { + return "Class A object"; + } +} + +// get a heredoc string +$heredoc = << 0, '1' => 0), + array("one" => 1, 'two' => 2, "three" => 1, 4 => 1), + + // arrays with float values +/*3*/ array("float1" => 2.3333, "float2" => 2.3333), + array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 1.2), + + // arrays with string values +/*5*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "\tHello"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => '\tHello'), + array(1 => "hello", "heredoc" => $heredoc, $heredoc), + + // array with object, unset variable and resource variable +/*8*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp, new classA(), $fp), +); + +// loop through each sub-array of $inputs to check the behavior of array_unique() +$iterator = 1; +foreach($inputs as $input) { + echo "-- Iteration $iterator --\n"; + var_dump( array_diff($array, $input) ); + var_dump( array_diff($input, $array) ); + $iterator++; +} + +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_diff() : usage variations *** +-- Iteration 1 -- +array(3) { + ["a"]=> + string(1) "1" + ["b"]=> + string(1) "2" + ["c"]=> + string(1) "3" +} +array(2) { + [0]=> + int(0) + [1]=> + int(0) +} +-- Iteration 2 -- +array(1) { + ["c"]=> + string(1) "3" +} +array(0) { +} +-- Iteration 3 -- +array(3) { + ["a"]=> + string(1) "1" + ["b"]=> + string(1) "2" + ["c"]=> + string(1) "3" +} +array(2) { + ["float1"]=> + float(2.3333) + ["float2"]=> + float(2.3333) +} +-- Iteration 4 -- +array(3) { + ["a"]=> + string(1) "1" + ["b"]=> + string(1) "2" + ["c"]=> + string(1) "3" +} +array(4) { + ["f1"]=> + float(1.2) + ["f2"]=> + float(3.33) + [3]=> + float(4.8999992284) + ["f4"]=> + float(1.2) +} +-- Iteration 5 -- +array(3) { + ["a"]=> + string(1) "1" + ["b"]=> + string(1) "2" + ["c"]=> + string(1) "3" +} +array(4) { + [111]=> + string(6) " Hello" + ["red"]=> + string(6) "col or" + [2]=> + string(7) " world" + [3]=> + string(6) " Hello" +} +-- Iteration 6 -- +array(3) { + ["a"]=> + string(1) "1" + ["b"]=> + string(1) "2" + ["c"]=> + string(1) "3" +} +array(4) { + [111]=> + string(7) "\tHello" + ["red"]=> + string(7) "col\tor" + [2]=> + string(9) "\v\fworld" + [3]=> + string(7) "\tHello" +} +-- Iteration 7 -- +array(3) { + ["a"]=> + string(1) "1" + ["b"]=> + string(1) "2" + ["c"]=> + string(1) "3" +} +array(3) { + [1]=> + string(5) "hello" + ["heredoc"]=> + string(11) "Hello world" + [2]=> + string(11) "Hello world" +} +-- Iteration 8 -- +array(3) { + ["a"]=> + string(1) "1" + ["b"]=> + string(1) "2" + ["c"]=> + string(1) "3" +} +array(5) { + [11]=> + object(classA)#%d (0) { + } + ["unset"]=> + NULL + ["resource"]=> + resource(%d) of type (stream) + [12]=> + object(classA)#%d (0) { + } + [13]=> + resource(%d) of type (stream) +} +Done diff --git a/ext/standard/tests/array/array_diff_variation9.phpt b/ext/standard/tests/array/array_diff_variation9.phpt new file mode 100644 index 0000000..1bf1f1c --- /dev/null +++ b/ext/standard/tests/array/array_diff_variation9.phpt @@ -0,0 +1,156 @@ +--TEST-- +Test array_diff() function : usage variations - multidimensional arrays +--FILE-- + array (1, 2, 3), + 'sub_array2' => array ('a', 'b', 'c')); +$array2 = array('sub_arraya' => array (1, 3, 5), + 'sub_arrayb' => array ('a', 'z', 'y')); + +echo "-- Compare two 2-D arrays --\n"; +var_dump(array_diff($array1, $array2)); +var_dump(array_diff($array2, $array1)); + +echo "\n-- Compare subarrays from two 2-D arrays --\n"; +var_dump(array_diff($array1['sub_array1'], $array2['sub_arraya'])); +var_dump(array_diff($array2['sub_arraya'], $array1['sub_array1'])); + +var_dump(array_diff($array1['sub_array2'], $array2['sub_arrayb'])); +var_dump(array_diff($array2['sub_arrayb'], $array1['sub_array1'])); + +echo "\n-- Compare a subarray from one 2-D array and one 2-D array --\n"; +var_dump(array_diff($array1['sub_array1'], $array2)); +var_dump(array_diff($array1, $array2['sub_arraya'])); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_diff() : usage variations *** +-- Compare two 2-D arrays -- + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d +array(0) { +} + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d +array(0) { +} + +-- Compare subarrays from two 2-D arrays -- +array(1) { + [1]=> + int(2) +} +array(1) { + [2]=> + int(5) +} +array(2) { + [1]=> + string(1) "b" + [2]=> + string(1) "c" +} +array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "z" + [2]=> + string(1) "y" +} + +-- Compare a subarray from one 2-D array and one 2-D array -- + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d + +Notice: Array to string conversion in %sarray_diff_variation9.php on line %d +array(2) { + ["sub_array1"]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + ["sub_array2"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_fill.phpt b/ext/standard/tests/array/array_fill.phpt new file mode 100644 index 0000000..1de7c31 --- /dev/null +++ b/ext/standard/tests/array/array_fill.phpt @@ -0,0 +1,366 @@ +--TEST-- +basic array_fill test +--FILE-- + +===============Done==================== +--EXPECTF-- +=========================== +start: 0 num: 0 value: 1 + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 0 num: 0 value: + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 0 num: 0 value: + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 0 num: 0 value: d + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 0 num: 0 value: e + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 0 num: 0 value: f + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 0 num: 1 value: 1 +array(1) { + [0]=> + bool(true) +} +=========================== +start: 0 num: 1 value: +array(1) { + [0]=> + bool(false) +} +=========================== +start: 0 num: 1 value: +array(1) { + [0]=> + NULL +} +=========================== +start: 0 num: 1 value: d +array(1) { + [0]=> + string(1) "d" +} +=========================== +start: 0 num: 1 value: e +array(1) { + [0]=> + string(1) "e" +} +=========================== +start: 0 num: 1 value: f +array(1) { + [0]=> + string(1) "f" +} +=========================== +start: 0 num: 2.5 value: 1 +array(2) { + [0]=> + bool(true) + [1]=> + bool(true) +} +=========================== +start: 0 num: 2.5 value: +array(2) { + [0]=> + bool(false) + [1]=> + bool(false) +} +=========================== +start: 0 num: 2.5 value: +array(2) { + [0]=> + NULL + [1]=> + NULL +} +=========================== +start: 0 num: 2.5 value: d +array(2) { + [0]=> + string(1) "d" + [1]=> + string(1) "d" +} +=========================== +start: 0 num: 2.5 value: e +array(2) { + [0]=> + string(1) "e" + [1]=> + string(1) "e" +} +=========================== +start: 0 num: 2.5 value: f +array(2) { + [0]=> + string(1) "f" + [1]=> + string(1) "f" +} +=========================== +start: 1 num: 0 value: 1 + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 1 num: 0 value: + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 1 num: 0 value: + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 1 num: 0 value: d + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 1 num: 0 value: e + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 1 num: 0 value: f + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 1 num: 1 value: 1 +array(1) { + [1]=> + bool(true) +} +=========================== +start: 1 num: 1 value: +array(1) { + [1]=> + bool(false) +} +=========================== +start: 1 num: 1 value: +array(1) { + [1]=> + NULL +} +=========================== +start: 1 num: 1 value: d +array(1) { + [1]=> + string(1) "d" +} +=========================== +start: 1 num: 1 value: e +array(1) { + [1]=> + string(1) "e" +} +=========================== +start: 1 num: 1 value: f +array(1) { + [1]=> + string(1) "f" +} +=========================== +start: 1 num: 2.5 value: 1 +array(2) { + [1]=> + bool(true) + [2]=> + bool(true) +} +=========================== +start: 1 num: 2.5 value: +array(2) { + [1]=> + bool(false) + [2]=> + bool(false) +} +=========================== +start: 1 num: 2.5 value: +array(2) { + [1]=> + NULL + [2]=> + NULL +} +=========================== +start: 1 num: 2.5 value: d +array(2) { + [1]=> + string(1) "d" + [2]=> + string(1) "d" +} +=========================== +start: 1 num: 2.5 value: e +array(2) { + [1]=> + string(1) "e" + [2]=> + string(1) "e" +} +=========================== +start: 1 num: 2.5 value: f +array(2) { + [1]=> + string(1) "f" + [2]=> + string(1) "f" +} +=========================== +start: 2.5 num: 0 value: 1 + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 2.5 num: 0 value: + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 2.5 num: 0 value: + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 2.5 num: 0 value: d + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 2.5 num: 0 value: e + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 2.5 num: 0 value: f + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +=========================== +start: 2.5 num: 1 value: 1 +array(1) { + [2]=> + bool(true) +} +=========================== +start: 2.5 num: 1 value: +array(1) { + [2]=> + bool(false) +} +=========================== +start: 2.5 num: 1 value: +array(1) { + [2]=> + NULL +} +=========================== +start: 2.5 num: 1 value: d +array(1) { + [2]=> + string(1) "d" +} +=========================== +start: 2.5 num: 1 value: e +array(1) { + [2]=> + string(1) "e" +} +=========================== +start: 2.5 num: 1 value: f +array(1) { + [2]=> + string(1) "f" +} +=========================== +start: 2.5 num: 2.5 value: 1 +array(2) { + [2]=> + bool(true) + [3]=> + bool(true) +} +=========================== +start: 2.5 num: 2.5 value: +array(2) { + [2]=> + bool(false) + [3]=> + bool(false) +} +=========================== +start: 2.5 num: 2.5 value: +array(2) { + [2]=> + NULL + [3]=> + NULL +} +=========================== +start: 2.5 num: 2.5 value: d +array(2) { + [2]=> + string(1) "d" + [3]=> + string(1) "d" +} +=========================== +start: 2.5 num: 2.5 value: e +array(2) { + [2]=> + string(1) "e" + [3]=> + string(1) "e" +} +=========================== +start: 2.5 num: 2.5 value: f +array(2) { + [2]=> + string(1) "f" + [3]=> + string(1) "f" +} +== Done =================Done==================== diff --git a/ext/standard/tests/array/array_fill_basic.phpt b/ext/standard/tests/array/array_fill_basic.phpt new file mode 100644 index 0000000..8623f8e --- /dev/null +++ b/ext/standard/tests/array/array_fill_basic.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test array_fill() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing array_fill() : basic functionality *** +-- Iteration 1 -- +array(2) { + [0]=> + NULL + [1]=> + NULL +} +-- Iteration 2 -- +array(2) { + [0]=> + int(0) + [1]=> + int(0) +} +-- Iteration 3 -- +array(2) { + [0]=> + int(1) + [1]=> + int(1) +} +-- Iteration 4 -- +array(2) { + [0]=> + float(1.5) + [1]=> + float(1.5) +} +-- Iteration 5 -- +array(2) { + [0]=> + string(2) "hi" + [1]=> + string(2) "hi" +} +-- Iteration 6 -- +array(2) { + [0]=> + string(2) "hi" + [1]=> + string(2) "hi" +} +-- Iteration 7 -- +array(2) { + [0]=> + string(5) "Hello" + [1]=> + string(5) "Hello" +} +Done diff --git a/ext/standard/tests/array/array_fill_error.phpt b/ext/standard/tests/array/array_fill_error.phpt new file mode 100644 index 0000000..1671632 --- /dev/null +++ b/ext/standard/tests/array/array_fill_error.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test array_fill() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_fill() : error conditions *** +-- Testing array_fill() function with Zero arguments -- + +Warning: array_fill() expects exactly 3 parameters, 0 given in %s on line %d +NULL +-- Testing array_fill() function with more than expected no. of arguments -- + +Warning: array_fill() expects exactly 3 parameters, 4 given in %s on line %d +NULL +-- Testing array_fill() function with less than expected no. of arguments -- + +Warning: array_fill() expects exactly 3 parameters, 2 given in %s on line %d +NULL + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/array/array_fill_keys.phpt b/ext/standard/tests/array/array_fill_keys.phpt new file mode 100644 index 0000000..b4d5168 --- /dev/null +++ b/ext/standard/tests/array/array_fill_keys.phpt @@ -0,0 +1,44 @@ +--TEST-- +basic array_fill_keys test +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- + +Warning: array_fill_keys() expects parameter 1 to be array, string given in %s on line %d +NULL +array(0) { +} +array(2) { + ["foo"]=> + NULL + ["bar"]=> + NULL +} +array(4) { + [5]=> + int(123) + ["foo"]=> + int(123) + [10]=> + int(123) + ["1.23"]=> + int(123) +} +array(4) { + ["test"]=> + string(0) "" + [1]=> + string(0) "" + [10]=> + string(0) "" + [100]=> + string(0) "" +} diff --git a/ext/standard/tests/array/array_fill_keys_error.phpt b/ext/standard/tests/array/array_fill_keys_error.phpt new file mode 100644 index 0000000..31a03e7 --- /dev/null +++ b/ext/standard/tests/array/array_fill_keys_error.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test array_fill_keys() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_fill_keys() : error conditions *** + +-- Testing array_fill_keys() function with more than expected no. of arguments -- + +Warning: array_fill_keys() expects exactly 2 parameters, 3 given in %sarray_fill_keys_error.php on line %d +NULL + +-- Testing array_fill_keys() function with less than expected no. of arguments -- + +Warning: array_fill_keys() expects exactly 2 parameters, 1 given in %sarray_fill_keys_error.php on line %d +NULL + +-- Testing array_fill_keys() function with no argumets -- + +Warning: array_fill_keys() expects exactly 2 parameters, 0 given in %sarray_fill_keys_error.php on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_fill_keys_variation1.phpt b/ext/standard/tests/array/array_fill_keys_variation1.phpt new file mode 100644 index 0000000..9fab89d --- /dev/null +++ b/ext/standard/tests/array/array_fill_keys_variation1.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test array_fill_keys() function : variation of parameter +--FILE-- + 2, "strk1" => "strv1", 4, $simpleStr); +var_dump( array_fill_keys($keyedArray, $simpleStr) ); + +echo "\n-- Testing array_fill_keys() function with mixed array --\n"; +$mixedArray = array($fp, $obj, $simpleStr, $emptyArr, 2, $bool, $float); +var_dump( array_fill_keys($mixedArray, $simpleStr) ); + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing array_fill_keys() : parameter variations *** + +-- Testing array_fill_keys() function with empty arguments -- +array(0) { +} + +-- Testing array_fill_keys() function with keyed array -- +array(4) { + [2]=> + string(6) "simple" + ["strv1"]=> + string(6) "simple" + [4]=> + string(6) "simple" + ["simple"]=> + string(6) "simple" +} + +-- Testing array_fill_keys() function with mixed array -- + +Notice: Array to string conversion in %sarray_fill_keys_variation1.php on line %d +array(7) { + ["Resource id #%d"]=> + string(6) "simple" + ["Class A object"]=> + string(6) "simple" + ["simple"]=> + string(6) "simple" + ["Array"]=> + string(6) "simple" + [2]=> + string(6) "simple" + [""]=> + string(6) "simple" + ["2.4"]=> + string(6) "simple" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_fill_keys_variation2.phpt b/ext/standard/tests/array/array_fill_keys_variation2.phpt new file mode 100644 index 0000000..4f3681a --- /dev/null +++ b/ext/standard/tests/array/array_fill_keys_variation2.phpt @@ -0,0 +1,81 @@ +--TEST-- +Test array_fill_keys() function : variation of parameter +--FILE-- + +--EXPECTF-- +*** Testing array_fill_keys() : parameter variations *** + +-- Testing array_fill_keys() function with reference value -- +array(2) { + ["one"]=> + string(6) "simple" + ["two"]=> + string(6) "simple" +} + +-- Testing array_fill_keys() function with reference keys -- +array(2) { + ["one"]=> + string(6) "simple" + ["simple"]=> + string(6) "simple" +} +array(2) { + ["one"]=> + string(6) "simple" + ["simple"]=> + string(6) "simple" +} + +-- Testing array_fill_keys() function with reference array input -- +array(2) { + ["one"]=> + string(3) "bob" + ["two"]=> + string(3) "bob" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_fill_keys_variation3.phpt b/ext/standard/tests/array/array_fill_keys_variation3.phpt new file mode 100644 index 0000000..5c57823 --- /dev/null +++ b/ext/standard/tests/array/array_fill_keys_variation3.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test array_fill_keys() function : variation of parameter +--FILE-- + +--EXPECTF-- +*** Testing array_fill_keys() : parameter variations *** + +-- Testing array_fill_keys() function with both wrong arguments -- + +Warning: array_fill_keys() expects parameter 1 to be array, boolean given in %sarray_fill_keys_variation3.php on line %d +NULL + +-- Testing array_fill_keys() function with unusual second arguments -- +array(2) { + ["one"]=> + resource(%d) of type (stream) + ["two"]=> + resource(%d) of type (stream) +} + +-- Testing array_fill_keys() function with mixed array -- + +Warning: array_fill_keys() expects parameter 1 to be array, null given in %sarray_fill_keys_variation3.php on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_fill_keys_variation4.phpt b/ext/standard/tests/array/array_fill_keys_variation4.phpt new file mode 100644 index 0000000..209443d --- /dev/null +++ b/ext/standard/tests/array/array_fill_keys_variation4.phpt @@ -0,0 +1,91 @@ +--TEST-- +Test array_fill_keys() function : variation of parameter +--FILE-- + +--EXPECTF-- +*** Testing array_fill_keys() : parameter variations *** + +-- Testing array_fill_keys() function with float -- +array(1) { + ["one"]=> + float(2.4) +} + +-- Testing array_fill_keys() function with null -- +array(1) { + ["one"]=> + NULL +} + +-- Testing array_fill_keys() function with object -- +array(1) { + ["one"]=> + object(classA)#%d (0) { + } +} + +-- Testing array_fill_keys() function with boolean -- +array(1) { + ["one"]=> + bool(false) +} + +-- Testing array_fill_keys() function with resource -- +array(1) { + ["one"]=> + resource(%d) of type (stream) +} + +-- Testing array_fill_keys() function with unset var -- + +Notice: Undefined variable: unset_var in %sarray_fill_keys_variation4.php on line %d +array(1) { + ["one"]=> + NULL +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_fill_object.phpt b/ext/standard/tests/array/array_fill_object.phpt new file mode 100644 index 0000000..86773b1 --- /dev/null +++ b/ext/standard/tests/array/array_fill_object.phpt @@ -0,0 +1,434 @@ +--TEST-- +Test array_fill() function : usage variations - various object values for 'val' argument +--SKIPIF-- +=')) die('skip ZendEngine 2.3 or below needed'); ?> +--FILE-- +member1 = $value1; + $this->var2 = $value2; + } +} + +// child class which inherits parent class test1 +class Child_test1 extends Test1 +{ + public $member2; + + function __construct($value1 , $value2 , $value3) + { + parent::__construct($value1 , $value2); + $this->member2 = $value3; + } +} + +//class with private member, static member, constant and constructor to initialize the private member +class Test2 +{ + const test2_constant = "test2"; + public static $test2_static = 0; + private $member1; + var $var1 = 30; + var $var2; + + function __construct($value1 , $value2) + { + $this->member1 = $value1; + $this->var2 = $value2; + } +} + +// child class which inherits parent class test2 +class Child_test2 extends Test2 +{ + private $member1; + + function __construct($value1 , $value2 , $value3) + { + parent::__construct($value1 , $value2); + $this->member1 = $value3; + } +} + +// class with protected member, static member, constant and consturctor to initialize the protected member +class Test3 +{ + const test3_constant = "test3"; + public static $test3_static = 0; + protected $member1; + var $var1 = 30; + var $var2; + + function __construct($value1 , $value2) + { + $this->member1 = $value1; + $this->var2 = $value2; + } +} + +// child class which inherits parent class test3 +class Child_test3 extends Test3 +{ + protected $member1; + + function __construct($value1 , $value2 , $value3) + { + parent::__construct($value1 , $value2); + $this->member1 = $value3; + } +} + +// class with public, private, protected members, static, constant members and constructor to initialize all the members +class Test4 +{ + const test4_constant = "test4"; + public static $test4_static = 0; + public $member1; + private $member2; + protected $member3; + + function __construct($value1 , $value2 , $value3) + { + $this->member1 = $value1; + $this->member2 = $value2; + $this->member3 = $value3; + } +} + +// child class which inherits parent class test4 +class Child_test4 extends Test4 +{ + var $var1; + + function __construct($value1 , $value2 , $value3 , $value4) + { + parent::__construct($value1 , $value2 , $value3); + $this->var1 = $value4; + } +} + +// abstract class with public, private, protected members +abstract class AbstractClass +{ + public $member1; + private $member2; + protected $member3; + var $var1 = 30; + + abstract protected function display(); +} + +// implement abstract 'AbstractClass' class +class ConcreteClass1 extends AbstractClass +{ + protected function display() + { + echo "class name is ConcreteClass1 \n"; + } +} + + +// declarationn of the interface 'iTemplate' +interface iTemplate +{ + public function display(); +} + +// implement the interface 'iTemplate' +class Template1 implements iTemplate +{ + public function display() + { + echo "class name is Template1\n"; + } +} + +//array of object values for 'val' argument +$objects = array( + + /* 1 */ new Test(), + new Test1(100 , 101), + new Child_test1(100 , 101 , 102), + new Test2(100 , 101), + /* 5 */ new Child_test2(100 , 101 , 102), + new Test3(100 , 101), + new Child_test3(100 , 101 , 102), + new Test4( 100 , 101 , 102), + new Child_test4(100 , 101 , 102 , 103), + new ConcreteClass1(), + /* 11 */ new Template1() +); + +// loop through each element of the array for 'val' argument +// check the working of array_fill() +echo "--- Testing array_fill() with different object values for 'val' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($objects); $index ++) +{ + echo "-- Iteration $counter --\n"; + $val = $objects[$index]; + + var_dump( array_fill($start_key,$num,$val) ); + + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_fill() : usage variations *** +--- Testing array_fill() with different object values for 'val' argument --- +-- Iteration 1 -- +array(2) { + [0]=> + object(Test)#%d (0) { + } + [1]=> + object(Test)#%d (0) { + } +} +-- Iteration 2 -- +array(2) { + [0]=> + object(Test1)#%d (3) { + ["member1"]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } + [1]=> + object(Test1)#%d (3) { + ["member1"]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } +} +-- Iteration 3 -- +array(2) { + [0]=> + object(Child_test1)#%d (4) { + ["member2"]=> + int(102) + ["member1"]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } + [1]=> + object(Child_test1)#%d (4) { + ["member2"]=> + int(102) + ["member1"]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } +} +-- Iteration 4 -- +array(2) { + [0]=> + object(Test2)#%d (3) { + ["member1":"Test2":private]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } + [1]=> + object(Test2)#%d (3) { + ["member1":"Test2":private]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } +} +-- Iteration 5 -- +array(2) { + [0]=> + object(Child_test2)#%d (4) { + ["member1":"Child_test2":private]=> + int(102) + ["member1":"Test2":private]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } + [1]=> + object(Child_test2)#%d (4) { + ["member1":"Child_test2":private]=> + int(102) + ["member1":"Test2":private]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } +} +-- Iteration 6 -- +array(2) { + [0]=> + object(Test3)#%d (3) { + ["member1":protected]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } + [1]=> + object(Test3)#%d (3) { + ["member1":protected]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } +} +-- Iteration 7 -- +array(2) { + [0]=> + object(Child_test3)#%d (3) { + ["member1":protected]=> + int(102) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } + [1]=> + object(Child_test3)#%d (3) { + ["member1":protected]=> + int(102) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } +} +-- Iteration 8 -- +array(2) { + [0]=> + object(Test4)#%d (3) { + ["member1"]=> + int(100) + ["member2":"Test4":private]=> + int(101) + ["member3":protected]=> + int(102) + } + [1]=> + object(Test4)#%d (3) { + ["member1"]=> + int(100) + ["member2":"Test4":private]=> + int(101) + ["member3":protected]=> + int(102) + } +} +-- Iteration 9 -- +array(2) { + [0]=> + object(Child_test4)#%d (4) { + ["var1"]=> + int(103) + ["member1"]=> + int(100) + ["member2":"Test4":private]=> + int(101) + ["member3":protected]=> + int(102) + } + [1]=> + object(Child_test4)#%d (4) { + ["var1"]=> + int(103) + ["member1"]=> + int(100) + ["member2":"Test4":private]=> + int(101) + ["member3":protected]=> + int(102) + } +} +-- Iteration 10 -- +array(2) { + [0]=> + object(ConcreteClass1)#%d (4) { + ["member1"]=> + NULL + ["member2":"AbstractClass":private]=> + NULL + ["member3":protected]=> + NULL + ["var1"]=> + int(30) + } + [1]=> + object(ConcreteClass1)#%d (4) { + ["member1"]=> + NULL + ["member2":"AbstractClass":private]=> + NULL + ["member3":protected]=> + NULL + ["var1"]=> + int(30) + } +} +-- Iteration 11 -- +array(2) { + [0]=> + object(Template1)#%d (0) { + } + [1]=> + object(Template1)#%d (0) { + } +} +Done diff --git a/ext/standard/tests/array/array_fill_object_2_4.phpt b/ext/standard/tests/array/array_fill_object_2_4.phpt new file mode 100644 index 0000000..fb81797 --- /dev/null +++ b/ext/standard/tests/array/array_fill_object_2_4.phpt @@ -0,0 +1,434 @@ +--TEST-- +Test array_fill() function : usage variations - various object values for 'val' argument +--SKIPIF-- + +--FILE-- +member1 = $value1; + $this->var2 = $value2; + } +} + +// child class which inherits parent class test1 +class Child_test1 extends Test1 +{ + public $member2; + + function __construct($value1 , $value2 , $value3) + { + parent::__construct($value1 , $value2); + $this->member2 = $value3; + } +} + +//class with private member, static member, constant and constructor to initialize the private member +class Test2 +{ + const test2_constant = "test2"; + public static $test2_static = 0; + private $member1; + var $var1 = 30; + var $var2; + + function __construct($value1 , $value2) + { + $this->member1 = $value1; + $this->var2 = $value2; + } +} + +// child class which inherits parent class test2 +class Child_test2 extends Test2 +{ + private $member1; + + function __construct($value1 , $value2 , $value3) + { + parent::__construct($value1 , $value2); + $this->member1 = $value3; + } +} + +// class with protected member, static member, constant and consturctor to initialize the protected member +class Test3 +{ + const test3_constant = "test3"; + public static $test3_static = 0; + protected $member1; + var $var1 = 30; + var $var2; + + function __construct($value1 , $value2) + { + $this->member1 = $value1; + $this->var2 = $value2; + } +} + +// child class which inherits parent class test3 +class Child_test3 extends Test3 +{ + protected $member1; + + function __construct($value1 , $value2 , $value3) + { + parent::__construct($value1 , $value2); + $this->member1 = $value3; + } +} + +// class with public, private, protected members, static, constant members and constructor to initialize all the members +class Test4 +{ + const test4_constant = "test4"; + public static $test4_static = 0; + public $member1; + private $member2; + protected $member3; + + function __construct($value1 , $value2 , $value3) + { + $this->member1 = $value1; + $this->member2 = $value2; + $this->member3 = $value3; + } +} + +// child class which inherits parent class test4 +class Child_test4 extends Test4 +{ + var $var1; + + function __construct($value1 , $value2 , $value3 , $value4) + { + parent::__construct($value1 , $value2 , $value3); + $this->var1 = $value4; + } +} + +// abstract class with public, private, protected members +abstract class AbstractClass +{ + public $member1; + private $member2; + protected $member3; + var $var1 = 30; + + abstract protected function display(); +} + +// implement abstract 'AbstractClass' class +class ConcreteClass1 extends AbstractClass +{ + protected function display() + { + echo "class name is ConcreteClass1 \n"; + } +} + + +// declarationn of the interface 'iTemplate' +interface iTemplate +{ + public function display(); +} + +// implement the interface 'iTemplate' +class Template1 implements iTemplate +{ + public function display() + { + echo "class name is Template1\n"; + } +} + +//array of object values for 'val' argument +$objects = array( + + /* 1 */ new Test(), + new Test1(100 , 101), + new Child_test1(100 , 101 , 102), + new Test2(100 , 101), + /* 5 */ new Child_test2(100 , 101 , 102), + new Test3(100 , 101), + new Child_test3(100 , 101 , 102), + new Test4( 100 , 101 , 102), + new Child_test4(100 , 101 , 102 , 103), + new ConcreteClass1(), + /* 11 */ new Template1() +); + +// loop through each element of the array for 'val' argument +// check the working of array_fill() +echo "--- Testing array_fill() with different object values for 'val' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($objects); $index ++) +{ + echo "-- Iteration $counter --\n"; + $val = $objects[$index]; + + var_dump( array_fill($start_key,$num,$val) ); + + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_fill() : usage variations *** +--- Testing array_fill() with different object values for 'val' argument --- +-- Iteration 1 -- +array(2) { + [0]=> + object(Test)#%d (0) { + } + [1]=> + object(Test)#%d (0) { + } +} +-- Iteration 2 -- +array(2) { + [0]=> + object(Test1)#%d (3) { + ["member1"]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } + [1]=> + object(Test1)#%d (3) { + ["member1"]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } +} +-- Iteration 3 -- +array(2) { + [0]=> + object(Child_test1)#%d (4) { + ["member2"]=> + int(102) + ["member1"]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } + [1]=> + object(Child_test1)#%d (4) { + ["member2"]=> + int(102) + ["member1"]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } +} +-- Iteration 4 -- +array(2) { + [0]=> + object(Test2)#%d (3) { + ["member1":"Test2":private]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } + [1]=> + object(Test2)#%d (3) { + ["member1":"Test2":private]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } +} +-- Iteration 5 -- +array(2) { + [0]=> + object(Child_test2)#%d (4) { + ["member1":"Child_test2":private]=> + int(102) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + ["member1":"Test2":private]=> + int(100) + } + [1]=> + object(Child_test2)#%d (4) { + ["member1":"Child_test2":private]=> + int(102) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + ["member1":"Test2":private]=> + int(100) + } +} +-- Iteration 6 -- +array(2) { + [0]=> + object(Test3)#%d (3) { + ["member1":protected]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } + [1]=> + object(Test3)#%d (3) { + ["member1":protected]=> + int(100) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } +} +-- Iteration 7 -- +array(2) { + [0]=> + object(Child_test3)#%d (3) { + ["member1":protected]=> + int(102) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } + [1]=> + object(Child_test3)#%d (3) { + ["member1":protected]=> + int(102) + ["var1"]=> + int(30) + ["var2"]=> + int(101) + } +} +-- Iteration 8 -- +array(2) { + [0]=> + object(Test4)#%d (3) { + ["member1"]=> + int(100) + ["member2":"Test4":private]=> + int(101) + ["member3":protected]=> + int(102) + } + [1]=> + object(Test4)#%d (3) { + ["member1"]=> + int(100) + ["member2":"Test4":private]=> + int(101) + ["member3":protected]=> + int(102) + } +} +-- Iteration 9 -- +array(2) { + [0]=> + object(Child_test4)#%d (4) { + ["var1"]=> + int(103) + ["member1"]=> + int(100) + ["member2":"Test4":private]=> + int(101) + ["member3":protected]=> + int(102) + } + [1]=> + object(Child_test4)#%d (4) { + ["var1"]=> + int(103) + ["member1"]=> + int(100) + ["member2":"Test4":private]=> + int(101) + ["member3":protected]=> + int(102) + } +} +-- Iteration 10 -- +array(2) { + [0]=> + object(ConcreteClass1)#%d (4) { + ["member1"]=> + NULL + ["member2":"AbstractClass":private]=> + NULL + ["member3":protected]=> + NULL + ["var1"]=> + int(30) + } + [1]=> + object(ConcreteClass1)#%d (4) { + ["member1"]=> + NULL + ["member2":"AbstractClass":private]=> + NULL + ["member3":protected]=> + NULL + ["var1"]=> + int(30) + } +} +-- Iteration 11 -- +array(2) { + [0]=> + object(Template1)#%d (0) { + } + [1]=> + object(Template1)#%d (0) { + } +} +Done diff --git a/ext/standard/tests/array/array_fill_variation1.phpt b/ext/standard/tests/array/array_fill_variation1.phpt new file mode 100644 index 0000000..e2d0b6f --- /dev/null +++ b/ext/standard/tests/array/array_fill_variation1.phpt @@ -0,0 +1,247 @@ +--TEST-- +Test array_fill() function : usage variations - unexpected values for 'start_key' argument +--SKIPIF-- + +--FILE-- + 'red', 'item' => 'pen'), + + // null values + /* 11 */ NULL, + null, + + // boolean values + /* 13 */ true, + false, + TRUE, + FALSE, + + // empty string + /* 17 */ "", + '', + + // string values + /* 19 */ "string", + 'string', + + // objects + /* 21 */ new test(), + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var, + + // resource variable + /* 24 */ $fp +); + +// loop through each element of the array for start_key +// check the working of array_fill() +echo "--- Testing array_fill() with different values for 'start_key' arg ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) +{ + echo "-- Iteration $counter --\n"; + $start_key = $values[$index]; + + var_dump( array_fill($start_key,$num,$val) ); + + $counter ++; +} + +// close the resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_fill() : usage variations *** +--- Testing array_fill() with different values for 'start_key' arg --- +-- Iteration 1 -- +array(2) { + [10]=> + int(100) + [11]=> + int(100) +} +-- Iteration 2 -- +array(2) { + [-10]=> + int(100) + [0]=> + int(100) +} +-- Iteration 3 -- +array(2) { + [-1097262584]=> + int(100) + [0]=> + int(100) +} +-- Iteration 4 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 5 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 6 -- + +Warning: array_fill() expects parameter 1 to be long, array given in %sarray_fill_variation1.php on line %d +NULL +-- Iteration 7 -- + +Warning: array_fill() expects parameter 1 to be long, array given in %sarray_fill_variation1.php on line %d +NULL +-- Iteration 8 -- + +Warning: array_fill() expects parameter 1 to be long, array given in %sarray_fill_variation1.php on line %d +NULL +-- Iteration 9 -- + +Warning: array_fill() expects parameter 1 to be long, array given in %sarray_fill_variation1.php on line %d +NULL +-- Iteration 10 -- + +Warning: array_fill() expects parameter 1 to be long, array given in %sarray_fill_variation1.php on line %d +NULL +-- Iteration 11 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 12 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 13 -- +array(2) { + [1]=> + int(100) + [2]=> + int(100) +} +-- Iteration 14 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 15 -- +array(2) { + [1]=> + int(100) + [2]=> + int(100) +} +-- Iteration 16 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 17 -- + +Warning: array_fill() expects parameter 1 to be long, string given in %sarray_fill_variation1.php on line %d +NULL +-- Iteration 18 -- + +Warning: array_fill() expects parameter 1 to be long, string given in %sarray_fill_variation1.php on line %d +NULL +-- Iteration 19 -- + +Warning: array_fill() expects parameter 1 to be long, string given in %sarray_fill_variation1.php on line %d +NULL +-- Iteration 20 -- + +Warning: array_fill() expects parameter 1 to be long, string given in %sarray_fill_variation1.php on line %d +NULL +-- Iteration 21 -- + +Warning: array_fill() expects parameter 1 to be long, object given in %sarray_fill_variation1.php on line %d +NULL +-- Iteration 22 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 23 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 24 -- + +Warning: array_fill() expects parameter 1 to be long, resource given in %sarray_fill_variation1.php on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_fill_variation1_64bit.phpt b/ext/standard/tests/array/array_fill_variation1_64bit.phpt new file mode 100644 index 0000000..650e97d --- /dev/null +++ b/ext/standard/tests/array/array_fill_variation1_64bit.phpt @@ -0,0 +1,247 @@ +--TEST-- +Test array_fill() function : usage variations - unexpected values for 'start_key' argument +--SKIPIF-- + +--FILE-- + 'red', 'item' => 'pen'), + + // null values + /* 11 */ NULL, + null, + + // boolean values + /* 13 */ true, + false, + TRUE, + FALSE, + + // empty string + /* 17 */ "", + '', + + // string values + /* 19 */ "string", + 'string', + + // objects + /* 21 */ new test(), + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var, + + // resource variable + /* 24 */ $fp +); + +// loop through each element of the array for start_key +// check the working of array_fill() +echo "--- Testing array_fill() with different values for 'start_key' arg ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) +{ + echo "-- Iteration $counter --\n"; + $start_key = $values[$index]; + + var_dump( array_fill($start_key,$num,$val) ); + + $counter ++; +} + +// close the resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_fill() : usage variations *** +--- Testing array_fill() with different values for 'start_key' arg --- +-- Iteration 1 -- +array(2) { + [10]=> + int(100) + [11]=> + int(100) +} +-- Iteration 2 -- +array(2) { + [-10]=> + int(100) + [0]=> + int(100) +} +-- Iteration 3 -- +array(2) { + [123456789000]=> + int(100) + [123456789001]=> + int(100) +} +-- Iteration 4 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 5 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 6 -- + +Warning: array_fill() expects parameter 1 to be long, array given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_fill() expects parameter 1 to be long, array given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_fill() expects parameter 1 to be long, array given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_fill() expects parameter 1 to be long, array given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_fill() expects parameter 1 to be long, array given in %s on line %d +NULL +-- Iteration 11 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 12 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 13 -- +array(2) { + [1]=> + int(100) + [2]=> + int(100) +} +-- Iteration 14 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 15 -- +array(2) { + [1]=> + int(100) + [2]=> + int(100) +} +-- Iteration 16 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 17 -- + +Warning: array_fill() expects parameter 1 to be long, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: array_fill() expects parameter 1 to be long, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_fill() expects parameter 1 to be long, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_fill() expects parameter 1 to be long, string given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_fill() expects parameter 1 to be long, object given in %s on line %d +NULL +-- Iteration 22 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 23 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 24 -- + +Warning: array_fill() expects parameter 1 to be long, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_fill_variation2.phpt b/ext/standard/tests/array/array_fill_variation2.phpt new file mode 100644 index 0000000..9e9df29 --- /dev/null +++ b/ext/standard/tests/array/array_fill_variation2.phpt @@ -0,0 +1,206 @@ +--TEST-- +Test array_fill() function : usage variations - unexpected values for 'num' argument +--FILE-- + 'red', 'item' => 'pen'), + + // null values + /* 11 */ NULL, + null, + + // boolean values + /* 13 */ true, + false, + TRUE, + FALSE, + + // empty string + /* 17 */ "", + '', + + // string values + /* 19 */ "string", + 'string', + + // objects + /* 21 */ new test(), + + // undefined variable + @$undefined_var, + + // unset variable + /* 24 */ @$unset_var, + +); + +// loop through each element of the array for num +// check the working of array_fill +echo "--- Testing array_fill() with different values for 'num' arg ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) +{ + echo "-- Iteration $counter --\n"; + $num = $values[$index]; + + var_dump( array_fill($start_key,$num,$val) ); + + $counter ++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_fill() : usage variations *** +--- Testing array_fill() with different values for 'num' arg --- +-- Iteration 1 -- +array(2) { + [0]=> + int(100) + [1]=> + int(100) +} +-- Iteration 2 -- + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +-- Iteration 3 -- +array(5) { + [0]=> + int(100) + [1]=> + int(100) + [2]=> + int(100) + [3]=> + int(100) + [4]=> + int(100) +} +-- Iteration 4 -- + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: array_fill() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_fill() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_fill() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_fill() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_fill() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +-- Iteration 13 -- +array(1) { + [0]=> + int(100) +} +-- Iteration 14 -- + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +-- Iteration 15 -- +array(1) { + [0]=> + int(100) +} +-- Iteration 16 -- + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +-- Iteration 17 -- + +Warning: array_fill() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: array_fill() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_fill() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_fill() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_fill() expects parameter 2 to be long, object given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +-- Iteration 23 -- + +Warning: array_fill(): Number of elements must be positive in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/array/array_fill_variation3.phpt b/ext/standard/tests/array/array_fill_variation3.phpt new file mode 100644 index 0000000..4a463a9 --- /dev/null +++ b/ext/standard/tests/array/array_fill_variation3.phpt @@ -0,0 +1,110 @@ +--TEST-- +Test array_fill() function : usage variations - unexpected values for 'val' argument +--FILE-- + +--EXPECTF-- +*** Testing array_fill() : usage variations *** +--- Testing array_fill() with different values for 'val' argument --- +-- Iteration 1 -- +array(2) { + [0]=> + string(0) "" + [1]=> + string(0) "" +} +-- Iteration 2 -- +array(2) { + [0]=> + string(0) "" + [1]=> + string(0) "" +} +-- Iteration 3 -- +array(2) { + [0]=> + object(test)#%d (1) { + ["t"]=> + int(10) + } + [1]=> + object(test)#%d (1) { + ["t"]=> + int(10) + } +} +-- Iteration 4 -- +array(2) { + [0]=> + NULL + [1]=> + NULL +} +-- Iteration 5 -- +array(2) { + [0]=> + NULL + [1]=> + NULL +} +Done diff --git a/ext/standard/tests/array/array_fill_variation4.phpt b/ext/standard/tests/array/array_fill_variation4.phpt new file mode 100644 index 0000000..9e1f50c --- /dev/null +++ b/ext/standard/tests/array/array_fill_variation4.phpt @@ -0,0 +1,168 @@ +--TEST-- +Test array_fill() function : usage variations - using return value of array_fill for 'val' argument +--FILE-- + +--EXPECTF-- +*** Testing array_fill() : variation *** +*** Filling 2 dimensional array with all basic valid values *** +-- Iteration 1 -- +array(2) { + [0]=> + array(2) { + [0]=> + NULL + [1]=> + NULL + } + [1]=> + array(2) { + [0]=> + NULL + [1]=> + NULL + } +} +-- Iteration 2 -- +array(2) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + int(0) + } + [1]=> + array(2) { + [0]=> + int(0) + [1]=> + int(0) + } +} +-- Iteration 3 -- +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(1) + } + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + int(1) + } +} +-- Iteration 4 -- +array(2) { + [0]=> + array(2) { + [0]=> + float(1) + [1]=> + float(1) + } + [1]=> + array(2) { + [0]=> + float(1) + [1]=> + float(1) + } +} +-- Iteration 5 -- +array(2) { + [0]=> + array(2) { + [0]=> + string(2) "hi" + [1]=> + string(2) "hi" + } + [1]=> + array(2) { + [0]=> + string(2) "hi" + [1]=> + string(2) "hi" + } +} +-- Iteration 6 -- +array(2) { + [0]=> + array(2) { + [0]=> + string(2) "hi" + [1]=> + string(2) "hi" + } + [1]=> + array(2) { + [0]=> + string(2) "hi" + [1]=> + string(2) "hi" + } +} +-- Iteration 7 -- +array(2) { + [0]=> + array(2) { + [0]=> + string(5) "Hello" + [1]=> + string(5) "Hello" + } + [1]=> + array(2) { + [0]=> + string(5) "Hello" + [1]=> + string(5) "Hello" + } +} +Done diff --git a/ext/standard/tests/array/array_fill_variation5.phpt b/ext/standard/tests/array/array_fill_variation5.phpt new file mode 100644 index 0000000..10fcc9c --- /dev/null +++ b/ext/standard/tests/array/array_fill_variation5.phpt @@ -0,0 +1,291 @@ +--TEST-- +Test array_fill() function : usage variations - different types of array values for 'val' argument +--FILE-- + "Hi" , 2 => "Hello"), + array("Saffron" , "White" , "Green"), + /* 5 */ array('color' => 'red' , 'item' => 'pen'), + array( 'color' => 'red' , 2 => 'green ' ), + array("colour" => "red" , "item" => "pen"), + array( TRUE => "red" , FALSE => "green" ), + array( true => "red" , FALSE => "green" ), + /* 10 */ array( 1 => "Hi" , "color" => "red" , 'item' => 'pen'), + array( NULL => "Hi", '1' => "Hello" , "1" => "Green"), + array( ""=>1, "color" => "green"), + /* 13 */ array('Saffron' , 'White' , 'Green') +); + +// loop through each element of the values array for 'val' argument +// check the working of array_fill() +echo "--- Testing array_fill() with different types of array values for 'val' argument ---\n"; +$counter = 1; +for($i = 0; $i < count($values); $i++) +{ + echo "-- Iteration $counter --\n"; + $val = $values[$i]; + + var_dump( array_fill($start_key , $num , $val) ); + + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_fill() : usage variations *** +--- Testing array_fill() with different types of array values for 'val' argument --- +-- Iteration 1 -- +array(2) { + [0]=> + array(0) { + } + [1]=> + array(0) { + } +} +-- Iteration 2 -- +array(2) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + } + [1]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + } +} +-- Iteration 3 -- +array(2) { + [0]=> + array(2) { + [1]=> + string(2) "Hi" + [2]=> + string(5) "Hello" + } + [1]=> + array(2) { + [1]=> + string(2) "Hi" + [2]=> + string(5) "Hello" + } +} +-- Iteration 4 -- +array(2) { + [0]=> + array(3) { + [0]=> + string(7) "Saffron" + [1]=> + string(5) "White" + [2]=> + string(5) "Green" + } + [1]=> + array(3) { + [0]=> + string(7) "Saffron" + [1]=> + string(5) "White" + [2]=> + string(5) "Green" + } +} +-- Iteration 5 -- +array(2) { + [0]=> + array(2) { + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + } + [1]=> + array(2) { + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + } +} +-- Iteration 6 -- +array(2) { + [0]=> + array(2) { + ["color"]=> + string(3) "red" + [2]=> + string(6) "green " + } + [1]=> + array(2) { + ["color"]=> + string(3) "red" + [2]=> + string(6) "green " + } +} +-- Iteration 7 -- +array(2) { + [0]=> + array(2) { + ["colour"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + } + [1]=> + array(2) { + ["colour"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + } +} +-- Iteration 8 -- +array(2) { + [0]=> + array(2) { + [1]=> + string(3) "red" + [0]=> + string(5) "green" + } + [1]=> + array(2) { + [1]=> + string(3) "red" + [0]=> + string(5) "green" + } +} +-- Iteration 9 -- +array(2) { + [0]=> + array(2) { + [1]=> + string(3) "red" + [0]=> + string(5) "green" + } + [1]=> + array(2) { + [1]=> + string(3) "red" + [0]=> + string(5) "green" + } +} +-- Iteration 10 -- +array(2) { + [0]=> + array(3) { + [1]=> + string(2) "Hi" + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + } + [1]=> + array(3) { + [1]=> + string(2) "Hi" + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + } +} +-- Iteration 11 -- +array(2) { + [0]=> + array(2) { + [""]=> + string(2) "Hi" + [1]=> + string(5) "Green" + } + [1]=> + array(2) { + [""]=> + string(2) "Hi" + [1]=> + string(5) "Green" + } +} +-- Iteration 12 -- +array(2) { + [0]=> + array(2) { + [""]=> + int(1) + ["color"]=> + string(5) "green" + } + [1]=> + array(2) { + [""]=> + int(1) + ["color"]=> + string(5) "green" + } +} +-- Iteration 13 -- +array(2) { + [0]=> + array(3) { + [0]=> + string(7) "Saffron" + [1]=> + string(5) "White" + [2]=> + string(5) "Green" + } + [1]=> + array(3) { + [0]=> + string(7) "Saffron" + [1]=> + string(5) "White" + [2]=> + string(5) "Green" + } +} +Done diff --git a/ext/standard/tests/array/array_filter.phpt b/ext/standard/tests/array/array_filter.phpt new file mode 100644 index 0000000..94f8e39 --- /dev/null +++ b/ext/standard/tests/array/array_filter.phpt @@ -0,0 +1,93 @@ +--TEST-- +basic array_filter test +--FILE-- +1, "b"=>2, "c"=>3, "d"=>4, "e"=>5); +$array2 = array(6, 7, 8, 9, 10, 11, 12, 0); +$array3 = array(TRUE, FALSE, NULL); + +echo "Odd :\n"; +var_dump(array_filter($array1, "odd")); +var_dump(array_filter($array2, "odd")); +var_dump(array_filter($array3, "odd")); +echo "Even:\n"; +var_dump(array_filter($array1, "even")); +var_dump(array_filter($array2, "even")); +var_dump(array_filter($array3, "even")); + +var_dump(array_filter(array())); +var_dump(array_filter(array(), array())); +var_dump(array_filter("", null)); +var_dump(array_filter($array1, 1)); + +echo '== DONE =='; +?> +--EXPECTF-- +Odd : +array(3) { + ["a"]=> + int(1) + ["c"]=> + int(3) + ["e"]=> + int(5) +} +array(3) { + [1]=> + int(7) + [3]=> + int(9) + [5]=> + int(11) +} +array(1) { + [0]=> + bool(true) +} +Even: +array(2) { + ["b"]=> + int(2) + ["d"]=> + int(4) +} +array(5) { + [0]=> + int(6) + [2]=> + int(8) + [4]=> + int(10) + [6]=> + int(12) + [7]=> + int(0) +} +array(2) { + [1]=> + bool(false) + [2]=> + NULL +} +array(0) { +} + +Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +== DONE == diff --git a/ext/standard/tests/array/array_filter_basic.phpt b/ext/standard/tests/array/array_filter_basic.phpt new file mode 100644 index 0000000..daec07b --- /dev/null +++ b/ext/standard/tests/array/array_filter_basic.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test array_filter() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing array_filter() : basic functionality *** +array(2) { + [1]=> + int(2) + [3]=> + int(0) +} +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [4]=> + int(-1) +} +Done diff --git a/ext/standard/tests/array/array_filter_error.phpt b/ext/standard/tests/array/array_filter_error.phpt new file mode 100644 index 0000000..20e89aa --- /dev/null +++ b/ext/standard/tests/array/array_filter_error.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test array_filter() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_filter() : error conditions *** +-- Testing array_filter() function with Zero arguments -- +Warning: array_filter() expects at least 1 parameter, 0 given in %s on line %d +NULL +-- Testing array_filter() function with more than expected no. of arguments -- +Warning: array_filter() expects at most 2 parameters, 3 given in %s on line %d +NULL +-- Testing array_filter() function with incorrect callback -- +Warning: array_filter() expects parameter 2 to be a valid callback, function 'even' not found or invalid function name in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_filter_object.phpt b/ext/standard/tests/array/array_filter_object.phpt new file mode 100644 index 0000000..de782fe --- /dev/null +++ b/ext/standard/tests/array/array_filter_object.phpt @@ -0,0 +1,155 @@ +--TEST-- +Test array_filter() function : object functionality +--FILE-- + +--EXPECTF-- +*** Testing array_filter() : object functionality *** +array(5) { + [0]=> + object(SimpleClass)#%d (1) { + ["var1"]=> + int(10) + } + [1]=> + object(EmptyClass)#%d (0) { + } + [2]=> + object(ChildClass)#%d (2) { + ["var3":"ChildClass":private]=> + NULL + ["var2":protected]=> + int(5) + } + [3]=> + object(FinalClass)#%d (1) { + ["var4":"FinalClass":private]=> + NULL + } + [4]=> + object(StaticClass)#%d (0) { + } +} +array(5) { + [0]=> + object(SimpleClass)#%d (1) { + ["var1"]=> + int(10) + } + [1]=> + object(EmptyClass)#%d (0) { + } + [2]=> + object(ChildClass)#%d (2) { + ["var3":"ChildClass":private]=> + NULL + ["var2":protected]=> + int(5) + } + [3]=> + object(FinalClass)#%d (1) { + ["var4":"FinalClass":private]=> + NULL + } + [4]=> + object(StaticClass)#%d (0) { + } +} +array(0) { +} +Done diff --git a/ext/standard/tests/array/array_filter_variation1.phpt b/ext/standard/tests/array/array_filter_variation1.phpt new file mode 100644 index 0000000..108b3dc --- /dev/null +++ b/ext/standard/tests/array/array_filter_variation1.phpt @@ -0,0 +1,195 @@ +--TEST-- +Test array_filter() function : usage variations - Unexpected values for 'input' argument +--FILE-- + +--EXPECTF-- +*** Testing array_filter() : usage variations - unexpected values for 'input'*** +-- Iteration 1 -- + +Warning: array_filter() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 2 -- + +Warning: array_filter() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 3 -- + +Warning: array_filter() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 4 -- + +Warning: array_filter() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: array_filter() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: array_filter() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_filter() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_filter() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_filter() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_filter() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_filter() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: array_filter() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: array_filter() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: array_filter() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: array_filter() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_filter() expects parameter 1 to be array, object given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_filter() expects parameter 1 to be array, resource given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: array_filter() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 23 -- + +Warning: array_filter() expects parameter 1 to be array, null given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_filter_variation2.phpt b/ext/standard/tests/array/array_filter_variation2.phpt new file mode 100644 index 0000000..1aa262b --- /dev/null +++ b/ext/standard/tests/array/array_filter_variation2.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test array_filter() function : usage variations - Unexpected values for 'callback' function argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data +/*15*/ NULL, + null, + + // boolean data +/*17*/ true, + false, + TRUE, + FALSE, + + // empty data +/*21*/ "", + '', + + // string data +/*23*/ "string", + 'string', + + // object data +/*25*/ new MyClass(), + + // resource data + $fp, + + // undefined data + @$undefined_var, + + // unset data +/*28*/ @$unset_var, +); + +// loop through each element of the 'values' for callback +for($count = 0; $count < count($values); $count++) { + echo "-- Iteration ".($count + 1)." --"; + var_dump( array_filter($input, $values[$count]) ); +}; + +// closing resource +fclose($fp); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_filter() : usage variations - unexpected values for 'callback' function*** +-- Iteration 1 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 2 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 3 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 4 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 5 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 6 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 7 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 8 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 9 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 10 -- +Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL +-- Iteration 11 -- +Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL +-- Iteration 12 -- +Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL +-- Iteration 13 -- +Warning: array_filter() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL +-- Iteration 14 -- +Warning: array_filter() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL +-- Iteration 15 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 16 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 17 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 18 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 19 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 20 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 21 -- +Warning: array_filter() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL +-- Iteration 22 -- +Warning: array_filter() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL +-- Iteration 23 -- +Warning: array_filter() expects parameter 2 to be a valid callback, function 'string' not found or invalid function name in %s on line %d +NULL +-- Iteration 24 -- +Warning: array_filter() expects parameter 2 to be a valid callback, function 'string' not found or invalid function name in %s on line %d +NULL +-- Iteration 25 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 26 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 27 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 28 -- +Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_filter_variation3.phpt b/ext/standard/tests/array/array_filter_variation3.phpt new file mode 100644 index 0000000..e22697a --- /dev/null +++ b/ext/standard/tests/array/array_filter_variation3.phpt @@ -0,0 +1,216 @@ +--TEST-- +Test array_filter() function : usage variations - Different types of array for 'input' argument +--FILE-- + 'one', 'zero' => 0, -2 => "value"), //associative array + array("one" => 1, null => 'null', 5.2 => "float", true => 1, "" => 'empty'), // associative array with different keys + array(1 => 'one', 2, "key" => 'value') // combinition of associative and non-associative array + +); + +// loop through each element of 'input' with default callback +for($count = 0; $count < count($input_values); $count++) +{ + echo "-- Iteration ".($count + 1). " --\n"; + var_dump( array_filter($input_values[$count]) ); + var_dump( array_filter($input_values[$count], 'always_true') ); + var_dump( array_filter($input_values[$count], 'always_false') ); +} + +echo "Done" +?> +--EXPECTF-- +*** Testing array_filter() : usage variations - different types of array for 'input' argument*** +-- Iteration 1 -- +array(5) { + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(-1) + [4]=> + int(28) + [5]=> + int(74) +} +array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(-1) + [4]=> + int(28) + [5]=> + int(74) +} +array(0) { +} +-- Iteration 2 -- +array(3) { + [1]=> + float(1.2) + [2]=> + float(1200) + [3]=> + float(0.0012) +} +array(4) { + [0]=> + float(0) + [1]=> + float(1.2) + [2]=> + float(1200) + [3]=> + float(0.0012) +} +array(0) { +} +-- Iteration 3 -- +array(3) { + [0]=> + string(6) "value1" + [1]=> + string(6) "value2" + [3]=> + string(1) " " +} +array(5) { + [0]=> + string(6) "value1" + [1]=> + string(6) "value2" + [2]=> + string(0) "" + [3]=> + string(1) " " + [4]=> + string(0) "" +} +array(0) { +} +-- Iteration 4 -- +array(2) { + [0]=> + bool(true) + [2]=> + bool(true) +} +array(4) { + [0]=> + bool(true) + [1]=> + bool(false) + [2]=> + bool(true) + [3]=> + bool(false) +} +array(0) { +} +-- Iteration 5 -- +array(0) { +} +array(2) { + [0]=> + NULL + [1]=> + NULL +} +array(0) { +} +-- Iteration 6 -- +array(2) { + [1]=> + string(3) "one" + [-2]=> + string(5) "value" +} +array(3) { + [1]=> + string(3) "one" + ["zero"]=> + int(0) + [-2]=> + string(5) "value" +} +array(0) { +} +-- Iteration 7 -- +array(4) { + ["one"]=> + int(1) + [""]=> + string(5) "empty" + [5]=> + string(5) "float" + [1]=> + int(1) +} +array(4) { + ["one"]=> + int(1) + [""]=> + string(5) "empty" + [5]=> + string(5) "float" + [1]=> + int(1) +} +array(0) { +} +-- Iteration 8 -- +array(3) { + [1]=> + string(3) "one" + [2]=> + int(2) + ["key"]=> + string(5) "value" +} +array(3) { + [1]=> + string(3) "one" + [2]=> + int(2) + ["key"]=> + string(5) "value" +} +array(0) { +} +Done diff --git a/ext/standard/tests/array/array_filter_variation4.phpt b/ext/standard/tests/array/array_filter_variation4.phpt new file mode 100644 index 0000000..7f028b1 --- /dev/null +++ b/ext/standard/tests/array/array_filter_variation4.phpt @@ -0,0 +1,97 @@ +--TEST-- +Test array_filter() function : usage variations - Different types of 'callback' function +--FILE-- + 4, 'null' => NULL); + +// callback function without parameters and with return value +function callback1() +{ + return 1; +} +echo "-- Callback function without parameter and with return --\n"; +var_dump( array_filter($input, "callback1") ); + +// callback function with parameter and without return value +function callback2($input) +{ +} +echo "-- Callback funciton with parameter and without return --\n"; +var_dump( array_filter($input, "callback2") ); + + +// callback function without parameter and without return value +function callback3() +{ +} +echo "-- Callback function without parameter and return --\n"; +var_dump( array_filter($input, "callback3") ); + +// callback function with parameter and with return value +function callback4($input) +{ + if($input > 0 ) { + return true; + } + else { + return false; + } +} +echo "-- Callback function with parameter and return --\n"; +var_dump( array_filter($input, "callback4") ); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_filter() : usage variation - different 'callback' functions*** +-- Callback function without parameter and with return -- +array(8) { + [0]=> + int(0) + [1]=> + int(-1) + [2]=> + int(2) + [3]=> + float(0.0034) + [4]=> + string(5) "hello" + [5]=> + string(5) "value" + ["key"]=> + int(4) + ["null"]=> + NULL +} +-- Callback funciton with parameter and without return -- +array(0) { +} +-- Callback function without parameter and return -- +array(0) { +} +-- Callback function with parameter and return -- +array(3) { + [2]=> + int(2) + [3]=> + float(0.0034) + ["key"]=> + int(4) +} +Done diff --git a/ext/standard/tests/array/array_filter_variation5.phpt b/ext/standard/tests/array/array_filter_variation5.phpt new file mode 100644 index 0000000..66b140a --- /dev/null +++ b/ext/standard/tests/array/array_filter_variation5.phpt @@ -0,0 +1,109 @@ +--TEST-- +Test array_filter() function : usage variations - 'input' argument with different false entries +--FILE-- + +--EXPECTF-- +*** Testing array_filter() : usage variations - different false elements in 'input' *** +array(0) { +} +array(16) { + [0]=> + bool(false) + [1]=> + bool(false) + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + int(0) + [5]=> + float(0) + [6]=> + NULL + [7]=> + NULL + [8]=> + string(1) "0" + [9]=> + string(1) "0" + [10]=> + array(0) { + } + [11]=> + bool(false) + [12]=> + bool(false) + [13]=> + string(0) "" + [14]=> + NULL + [15]=> + NULL +} +array(0) { +} +Done diff --git a/ext/standard/tests/array/array_filter_variation6.phpt b/ext/standard/tests/array/array_filter_variation6.phpt new file mode 100644 index 0000000..1020c28 --- /dev/null +++ b/ext/standard/tests/array/array_filter_variation6.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test array_filter() function : usage variations - 'input' array containing references +--FILE-- + 5 then + * returns true else returns false + */ +function callback($input) +{ + if($input > 5) { + return true; + } + else { + return false; + } +} + +// initializing variables +$value1 = array(1, 2, 8); +$value2 = array(5, 6, 4); +$input = array(&$value1, 10, &$value2, 'value'); + +// with 'callback' argument +var_dump( array_filter($input, 'callback') ); + +// with default 'callback' argument +var_dump( array_filter($input) ); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_filter() : usage variations - 'input' containing references *** +array(3) { + [0]=> + &array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(8) + } + [1]=> + int(10) + [2]=> + &array(3) { + [0]=> + int(5) + [1]=> + int(6) + [2]=> + int(4) + } +} +array(4) { + [0]=> + &array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(8) + } + [1]=> + int(10) + [2]=> + &array(3) { + [0]=> + int(5) + [1]=> + int(6) + [2]=> + int(4) + } + [3]=> + string(5) "value" +} +Done diff --git a/ext/standard/tests/array/array_filter_variation7.phpt b/ext/standard/tests/array/array_filter_variation7.phpt new file mode 100644 index 0000000..cb856f7 --- /dev/null +++ b/ext/standard/tests/array/array_filter_variation7.phpt @@ -0,0 +1,80 @@ +--TEST-- +Test array_filter() function : usage variations - anonymous callback functions +--FILE-- + 1);') ) ); + +// anonymous callback function with reference +echo "Anonymous callback function with reference parameter\n"; +var_dump( array_filter($input, create_function('&$input', 'return ($input < 1);') ) ); + +// anonymous callback function with null argument +echo "Anonymous callback funciton with null argument\n"; +var_dump( array_filter($input, create_function(null, 'return true;') ) ); + +// anonymous callback function with argument and null statement +echo "Anonymous callback function with regular argument and null statement\n"; +var_dump( array_filter($input, create_function('$input', null) ) ); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_filter() : usage variations - Anonymous callback functions *** +Anonymous callback function with regular parameter and statement +array(3) { + [3]=> + int(10) + [4]=> + int(100) + [5]=> + int(1000) +} +Anonymous callback function with reference parameter +array(4) { + [0]=> + int(0) + [2]=> + int(-1) + [6]=> + string(5) "Hello" + [7]=> + NULL +} +Anonymous callback funciton with null argument +array(8) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(-1) + [3]=> + int(10) + [4]=> + int(100) + [5]=> + int(1000) + [6]=> + string(5) "Hello" + [7]=> + NULL +} +Anonymous callback function with regular argument and null statement +array(0) { +} +Done diff --git a/ext/standard/tests/array/array_filter_variation8.phpt b/ext/standard/tests/array/array_filter_variation8.phpt new file mode 100644 index 0000000..4440b33 --- /dev/null +++ b/ext/standard/tests/array/array_filter_variation8.phpt @@ -0,0 +1,151 @@ +--TEST-- +Test array_filter() function : usage variations - Callback function with different return values +--FILE-- + +--EXPECTF-- +*** Testing array_filter() : usage variations - callback function with different return values*** +callback function with int return value +array(9) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(-1) + [3]=> + int(10) + [4]=> + int(100) + [5]=> + int(1000) + [6]=> + string(5) "Hello" + [7]=> + NULL + [8]=> + bool(true) +} +callback function with float return value +array(9) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(-1) + [3]=> + int(10) + [4]=> + int(100) + [5]=> + int(1000) + [6]=> + string(5) "Hello" + [7]=> + NULL + [8]=> + bool(true) +} +callback function with string return value +array(9) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(-1) + [3]=> + int(10) + [4]=> + int(100) + [5]=> + int(1000) + [6]=> + string(5) "Hello" + [7]=> + NULL + [8]=> + bool(true) +} +callback function with null return value +array(0) { +} +callback function with array as return value +array(9) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(-1) + [3]=> + int(10) + [4]=> + int(100) + [5]=> + int(1000) + [6]=> + string(5) "Hello" + [7]=> + NULL + [8]=> + bool(true) +} +Done diff --git a/ext/standard/tests/array/array_filter_variation9.phpt b/ext/standard/tests/array/array_filter_variation9.phpt new file mode 100644 index 0000000..81554f1 --- /dev/null +++ b/ext/standard/tests/array/array_filter_variation9.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test array_filter() function : usage variations - built-in functions as 'callback' argument +--FILE-- + +--EXPECTF-- +*** Testing array_filter() : usage variations - built-in functions as 'callback' argument *** +array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(-1) + [3]=> + int(10) + [4]=> + int(100) + [5]=> + int(1000) +} +array(8) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(-1) + [3]=> + int(10) + [4]=> + int(100) + [5]=> + int(1000) + [6]=> + string(5) "Hello" + [7]=> + NULL +} + +Warning: array_filter() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d +NULL + +Warning: array_filter() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_flip.phpt b/ext/standard/tests/array/array_flip.phpt new file mode 100644 index 0000000..c268f5a --- /dev/null +++ b/ext/standard/tests/array/array_flip.phpt @@ -0,0 +1,37 @@ +--TEST-- +basic array_flip test +--FILE-- + 1, + "b" => 1, + "c" => 2, + "z" => 0, + "d" => TRUE, + "E" => FALSE, + "F" => NULL, + 0 => "G", + 1 => "h", + 2 => "i"); +$trans = array_flip($trans); +var_dump($trans); +?> +--EXPECTF-- +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d + +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d + +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +array(6) { + [1]=> + string(1) "b" + [2]=> + string(1) "c" + [0]=> + string(1) "z" + ["G"]=> + int(0) + ["h"]=> + int(1) + ["i"]=> + int(2) +} diff --git a/ext/standard/tests/array/array_flip_basic.phpt b/ext/standard/tests/array/array_flip_basic.phpt new file mode 100644 index 0000000..08a63fb --- /dev/null +++ b/ext/standard/tests/array/array_flip_basic.phpt @@ -0,0 +1,71 @@ +--TEST-- +Test array_flip() function : basic functionality +--FILE-- + value flipped + * Source code: ext/standard/array.c +*/ + +echo "*** Testing array_flip() : basic functionality ***\n"; + +// array with default keys - numeric values +$input = array(1, 2); +var_dump( array_flip($input) ); + +// array with default keys - string values +$input = array('value1', "value2"); +var_dump( array_flip($input) ); + +// associative arrays - key as string +$input = array('key1' => 1, "key2" => 2); +var_dump( array_flip($input) ); + +// associative arrays - key as numeric +$input = array(1 => 'one', 2 => "two"); +var_dump( array_flip($input) ); + +// combination of associative and non-associative array +$input = array(1 => 'one','two', 3 => 'three', 4, "five" => 5); +var_dump( array_flip($input) ); +echo "Done" +?> +--EXPECTF-- +*** Testing array_flip() : basic functionality *** +array(2) { + [1]=> + int(0) + [2]=> + int(1) +} +array(2) { + ["value1"]=> + int(0) + ["value2"]=> + int(1) +} +array(2) { + [1]=> + string(4) "key1" + [2]=> + string(4) "key2" +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(5) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + [4]=> + int(4) + [5]=> + string(4) "five" +} +Done diff --git a/ext/standard/tests/array/array_flip_error.phpt b/ext/standard/tests/array/array_flip_error.phpt new file mode 100644 index 0000000..3aa0f98 --- /dev/null +++ b/ext/standard/tests/array/array_flip_error.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test array_flip() function : error conditions +--FILE-- + value flipped + * Source code: ext/standard/array.c +*/ + +echo "*** Testing array_flip() : error conditions ***\n"; + +// Zero arguments +echo "-- Testing array_flip() function with Zero arguments --\n"; +var_dump( array_flip() ); + +//one more than the expected number of arguments +echo "-- Testing array_flip() function with more than expected no. of arguments --\n"; +$input = array(1 => 'one', 2 => 'two'); +$extra_arg = 10; +var_dump( array_flip($input, $extra_arg) ); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_flip() : error conditions *** +-- Testing array_flip() function with Zero arguments -- + +Warning: array_flip() expects exactly 1 parameter, 0 given in %s on line %d +NULL +-- Testing array_flip() function with more than expected no. of arguments -- + +Warning: array_flip() expects exactly 1 parameter, 2 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_flip_variation1.phpt b/ext/standard/tests/array/array_flip_variation1.phpt new file mode 100644 index 0000000..6ba558f --- /dev/null +++ b/ext/standard/tests/array/array_flip_variation1.phpt @@ -0,0 +1,179 @@ +--TEST-- +Test array_flip() function : usage variations - unexpected values for 'input' argument +--FILE-- + value flipped + * Source code: ext/standard/array.c +*/ + +echo "*** Testing array_flip() : usage variations - unexpected values for 'input' ***\n"; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//class definition for object variable +class MyClass +{ + public function __toString() + { + return 'object'; + } +} + +//resource variable +$fp = fopen(__FILE__,'r'); + +//array of values for 'input' argument +$values = array( + // int data + /*1*/ 0, + 1, + 12345, + -2345, + + // float data + /*5*/ 10.5, + -10.5, + 10.5e10, + 10.6E-10, + .5, + + // null data + /*10*/ NULL, + null, + + // boolean data + /*12*/ true, + false, + TRUE, + /*15*/ FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + /*20*/ new MyClass(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + //resource data + /*23*/ $fp +); + +// loop through each element of $values for 'input' argument +for($count = 0; $count < count($values); $count++) { + echo "-- Iteration ".($count + 1). " --\n"; + var_dump( array_flip($values[$count]) ); +}; + +//closing resource +fclose($fp); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_flip() : usage variations - unexpected values for 'input' *** +-- Iteration 1 -- + +Warning: array_flip() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 2 -- + +Warning: array_flip() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 3 -- + +Warning: array_flip() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 4 -- + +Warning: array_flip() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: array_flip() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: array_flip() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_flip() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_flip() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_flip() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_flip() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_flip() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: array_flip() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: array_flip() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: array_flip() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: array_flip() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: array_flip() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: array_flip() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: array_flip() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_flip() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_flip() expects parameter 1 to be array, object given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_flip() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: array_flip() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 23 -- + +Warning: array_flip() expects parameter 1 to be array, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_flip_variation2.phpt b/ext/standard/tests/array/array_flip_variation2.phpt new file mode 100644 index 0000000..997c391 Binary files /dev/null and b/ext/standard/tests/array/array_flip_variation2.phpt differ diff --git a/ext/standard/tests/array/array_flip_variation3.phpt b/ext/standard/tests/array/array_flip_variation3.phpt new file mode 100644 index 0000000..1d56dfa Binary files /dev/null and b/ext/standard/tests/array/array_flip_variation3.phpt differ diff --git a/ext/standard/tests/array/array_flip_variation4.phpt b/ext/standard/tests/array/array_flip_variation4.phpt new file mode 100644 index 0000000..2420c7e --- /dev/null +++ b/ext/standard/tests/array/array_flip_variation4.phpt @@ -0,0 +1,90 @@ +--TEST-- +Test array_flip() function : usage variations - 'input' argument with different invalid values for keys +--FILE-- + value flipped + * Source code: ext/standard/array.c +*/ + +/* +* Trying different invalid values for 'input' array argument +*/ + +echo "*** Testing array_flip() : different invalid values in 'input' array argument ***\n"; + +// class definition for object data +class MyClass +{ + public function __toString() + { + return 'object'; + } +} +$obj = new MyClass(); + +// resource data +$fp = fopen(__FILE__, 'r'); + +$input = array( + // float values + 'float_value1' => 1.2, + 'float_value2' => 0.5, + 'flaot_value3' => 3.4E3, + 'flaot_value4' => 5.6E-6, + + // bool values + 'bool_value1' => true, + 'bool_value2' => false, + 'bool_value3' => TRUE, + 'bool_value4' => FALSE, + + // null values + 'null_value1' => null, + + // array value + 'array_value' => array(1), + + // object value + 'obj_value' => $obj, + + // resource value + 'resource_value' => $fp, +); + +var_dump( array_flip($input) ); + +// closing resource +fclose($fp); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_flip() : different invalid values in 'input' array argument *** + +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d + +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d + +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d + +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d + +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d + +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d + +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d + +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d + +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d + +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d + +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d + +Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +array(0) { +} +Done diff --git a/ext/standard/tests/array/array_flip_variation5.phpt b/ext/standard/tests/array/array_flip_variation5.phpt new file mode 100644 index 0000000..29222a1 --- /dev/null +++ b/ext/standard/tests/array/array_flip_variation5.phpt @@ -0,0 +1,82 @@ +--TEST-- +Test array_flip() function : usage variations - 'input' argument with repeatitive keys and values +--FILE-- + value flipped + * Source code: ext/standard/array.c +*/ + +/* +* Using different types of repeatitive keys as well as values for 'input' array +*/ + +echo "*** Testing array_flip() : 'input' array with repeatitive keys/values ***\n"; + +// array with numeric key repeatition +$input = array(1 => 'value', 2 => 'VALUE', 1 => "VaLuE", 3.4 => 4, 3.4 => 5); +var_dump( array_flip($input) ); + +// array with string key repeatition +$input = array("key" => 1, "two" => 'TWO', 'three' => 3, 'key' => "FOUR"); +var_dump( array_flip($input) ); + +// array with bool key repeatition +$input = array(true => 1, false => 0, TRUE => -1); +var_dump( array_flip($input) ); + +// array with null key repeatition +$input = array(null => "Hello", NULL => 0); +var_dump( array_flip($input) ); + +// array with numeric value repeatition +$input = array('one' => 1, 'two' => 2, 3 => 1, "index" => 1); +var_dump( array_flip($input) ); + +//array with string value repeatition +$input = array('key1' => "value1", "key2" => '2', 'key3' => 'value1'); +var_dump( array_flip($input) ); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_flip() : 'input' array with repeatitive keys/values *** +array(3) { + ["VaLuE"]=> + int(1) + ["VALUE"]=> + int(2) + [5]=> + int(3) +} +array(3) { + ["FOUR"]=> + string(3) "key" + ["TWO"]=> + string(3) "two" + [3]=> + string(5) "three" +} +array(2) { + [-1]=> + int(1) + [0]=> + int(0) +} +array(1) { + [0]=> + string(0) "" +} +array(2) { + [1]=> + string(5) "index" + [2]=> + string(3) "two" +} +array(2) { + ["value1"]=> + string(4) "key3" + [2]=> + string(4) "key2" +} +Done diff --git a/ext/standard/tests/array/array_intersect_1.phpt b/ext/standard/tests/array/array_intersect_1.phpt new file mode 100644 index 0000000..41f2033 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_1.phpt @@ -0,0 +1,364 @@ +--TEST-- +Test of the *intersect* bunch of functions (both assoc and non-assoc) +--FILE-- +priv_member = $val; + $this->public_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member)? 1:-1; + } +} + +function comp_func($a, $b) { + if ($a === $b) return 0; + return ($a > $b)? 1:-1; + +} + +function comp_func_cr($a, $b) { + if ($a->public_member === $b->public_member) return 0; + return ($a->public_member > $b->public_member)? 1:-1; +} + +$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),); +$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr( 3), 1=> new cr(4), 2 => new cr(-15),); + +/* array_uintersect() */ +echo "begin ------------ array_uintersect() ---------------------------\n"; +echo '$a='.var_export($a,TRUE).";\n"; +echo '$b='.var_export($b,TRUE).";\n"; +echo 'var_dump(array_uintersect($a, $b, "comp_func_cr"));'."\n"; +var_dump(array_uintersect($a, $b, "comp_func_cr")); +echo "end ------------ array_uintersect() ---------------------------\n"; + +/* array_uintersect_assoc() */ +echo "begin ------------ array_uintersect_assoc() ---------------------\n"; +echo '$a='.var_export($a,TRUE).";\n"; +echo '$b='.var_export($b,TRUE).";\n"; +echo 'var_dump(array_uintersect_assoc($a, $b, "comp_func_cr"));'."\n"; +var_dump(array_uintersect_assoc($a, $b, "comp_func_cr")); +echo "end ------------ array_uintersect_assoc() ---------------------\n"; + +/* array_uintersect_uassoc() - with ordinary function */ +echo "begin ------------ array_uintersect_uassoc() with ordinary func -\n"; +echo '$a='.var_export($a,TRUE).";\n"; +echo '$b='.var_export($b,TRUE).";\n"; +echo 'var_dump(array_uintersect_uassoc($a, $b, "comp_func_cr", "comp_func"));'."\n"; +var_dump(array_uintersect_uassoc($a, $b, "comp_func_cr", "comp_func")); +echo "end ------------ array_uintersect_uassoc() with ordinary func -\n"; + +/* array_uintersect_uassoc() - by method call */ +echo "begin ------------ array_uintersect_uassoc() with method --------\n"; +echo '$a='.var_export($a,TRUE).";\n"; +echo '$b='.var_export($b,TRUE).";\n"; +echo 'var_dump(array_uintersect_uassoc($a, $b, array("cr", "comp_func_cr"), "comp_func"));'."\n"; +var_dump(array_uintersect_uassoc($a, $b, array("cr", "comp_func_cr"), "comp_func")); +echo "end ------------ array_uintersect_uassoc() with method --------\n"; +?> +--EXPECTF-- +begin ------------ array_uintersect() --------------------------- +$a=array ( + '0.1' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 12, + 'public_member' => 12, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 23, + 'public_member' => 23, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +$b=array ( + '0.2' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 22, + 'public_member' => 22, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 3, + 'public_member' => 3, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +var_dump(array_uintersect($a, $b, "comp_func_cr")); +array(3) { + ["0.1"]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(9) + ["public_member"]=> + int(9) + } + [1]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(4) + ["public_member"]=> + int(4) + } + [2]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(-15) + ["public_member"]=> + int(-15) + } +} +end ------------ array_uintersect() --------------------------- +begin ------------ array_uintersect_assoc() --------------------- +$a=array ( + '0.1' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 12, + 'public_member' => 12, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 23, + 'public_member' => 23, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +$b=array ( + '0.2' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 22, + 'public_member' => 22, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 3, + 'public_member' => 3, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +var_dump(array_uintersect_assoc($a, $b, "comp_func_cr")); +array(2) { + [1]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(4) + ["public_member"]=> + int(4) + } + [2]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(-15) + ["public_member"]=> + int(-15) + } +} +end ------------ array_uintersect_assoc() --------------------- +begin ------------ array_uintersect_uassoc() with ordinary func - +$a=array ( + '0.1' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 12, + 'public_member' => 12, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 23, + 'public_member' => 23, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +$b=array ( + '0.2' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 22, + 'public_member' => 22, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 3, + 'public_member' => 3, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +var_dump(array_uintersect_uassoc($a, $b, "comp_func_cr", "comp_func")); +array(2) { + [1]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(4) + ["public_member"]=> + int(4) + } + [2]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(-15) + ["public_member"]=> + int(-15) + } +} +end ------------ array_uintersect_uassoc() with ordinary func - +begin ------------ array_uintersect_uassoc() with method -------- +$a=array ( + '0.1' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 12, + 'public_member' => 12, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 23, + 'public_member' => 23, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +$b=array ( + '0.2' => + cr::__set_state(array( + 'priv_member' => 9, + 'public_member' => 9, + )), + '0.5' => + cr::__set_state(array( + 'priv_member' => 22, + 'public_member' => 22, + )), + 0 => + cr::__set_state(array( + 'priv_member' => 3, + 'public_member' => 3, + )), + 1 => + cr::__set_state(array( + 'priv_member' => 4, + 'public_member' => 4, + )), + 2 => + cr::__set_state(array( + 'priv_member' => -15, + 'public_member' => -15, + )), +); +var_dump(array_uintersect_uassoc($a, $b, array("cr", "comp_func_cr"), "comp_func")); +array(2) { + [1]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(4) + ["public_member"]=> + int(4) + } + [2]=> + object(cr)#%d (2) { + ["priv_member":"cr":private]=> + int(-15) + ["public_member"]=> + int(-15) + } +} +end ------------ array_uintersect_uassoc() with method -------- diff --git a/ext/standard/tests/array/array_intersect_assoc_basic.phpt b/ext/standard/tests/array/array_intersect_assoc_basic.phpt new file mode 100644 index 0000000..bf0f219 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_assoc_basic.phpt @@ -0,0 +1,69 @@ +--TEST-- +Test array_intersect_assoc() function : basic functionality +--FILE-- + 1, "two" => 2); + +// default key array for both $arr1 and $arr2 argument +var_dump( array_intersect_assoc($arr_default_keys, $arr_default_keys) ); + +// default key array for $arr1 and associative array for $arr2 argument +var_dump( array_intersect_assoc($arr_default_keys, $arr_associative) ); + +// associative array for $arr1 and default key array for $arr2 +var_dump( array_intersect_assoc($arr_associative, $arr_default_keys) ); + +// associative array for both $arr1 and $arr2 argument +var_dump( array_intersect_assoc($arr_associative, $arr_associative) ); + +// more arrays to be intersected +$arr3 = array(2, 3, 4); +var_dump( array_intersect_assoc($arr_default_keys, $arr_associative, $arr3) ); +var_dump( array_intersect_assoc($arr_associative, $arr_default_keys, $arr3, $arr_associative) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect_assoc() : basic functionality *** +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(5) "hello" + [3]=> + string(5) "world" +} +array(0) { +} +array(0) { +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(0) { +} +array(0) { +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_assoc_error.phpt b/ext/standard/tests/array/array_intersect_assoc_error.phpt new file mode 100644 index 0000000..c371071 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_assoc_error.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_intersect_assoc() function : error conditions(Bug#43197) +--FILE-- + +--EXPECTF-- +*** Testing array_intersect_assoc() : error conditions *** + +-- Testing array_intersect_assoc() function with Zero arguments -- + +Warning: array_intersect_assoc(): at least 2 parameters are required, 0 given in %s on line %d +NULL + +-- Testing array_intersect_assoc() function with less than expected no. of arguments -- + +Warning: array_intersect_assoc(): at least 2 parameters are required, 1 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation1.phpt b/ext/standard/tests/array/array_intersect_assoc_variation1.phpt new file mode 100644 index 0000000..713ed82 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_assoc_variation1.phpt @@ -0,0 +1,281 @@ +--TEST-- +Test array_intersect_assoc() function : usage variations - unexpected values for 'arr1' argument(Bug#43196) +--FILE-- + 1, "two" => 2); + +// get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a class +class classA +{ + public function __toString() { + return "Class A object"; + } +} + +// heredoc string +$heredoc = << +--EXPECTF-- +*** Testing array_intersect_assoc() : Passing non-array values to $arr1 argument *** + +-- Iteration 1 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 2 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 3 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 4 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 5 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 6 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 7 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 8 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 9 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 10 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 11 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 12 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 13 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 14 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 15 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 16 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 17 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 18 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 19 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 20 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 21 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 22 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 23 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 24 -- +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation10.phpt b/ext/standard/tests/array/array_intersect_assoc_variation10.phpt new file mode 100644 index 0000000..9bce974 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_assoc_variation10.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test array_intersect_assoc() function : usage variations - binary safe checking +--FILE-- + +--EXPECTF-- +*** Testing array_intersect_assoc() : binary safe checking *** +array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" +} +array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" +} +array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_assoc_variation2.phpt b/ext/standard/tests/array/array_intersect_assoc_variation2.phpt new file mode 100644 index 0000000..e82e7cf --- /dev/null +++ b/ext/standard/tests/array/array_intersect_assoc_variation2.phpt @@ -0,0 +1,282 @@ +--TEST-- +Test array_intersect_assoc() function : usage variations - unexpected values for 'arr2' argument(Bug#43196) +--FILE-- + 1, "two" => 2); + +// get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a class +class classA +{ + public function __toString() { + return "Class A object"; + } +} + +// heredoc string +$heredoc = << +--EXPECTF-- +*** Testing array_intersect_assoc() : Passing non-array values to $arr2 argument *** + +-- Iteration 1 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 2 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 3 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 4 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 5 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 6 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 7 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 8 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 9 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 10 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 11 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 12 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 13 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 14 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 15 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 16 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 17 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 18 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 19 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 20 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 21 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 22 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 23 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 24 -- +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation3.phpt b/ext/standard/tests/array/array_intersect_assoc_variation3.phpt new file mode 100644 index 0000000..50be080 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_assoc_variation3.phpt @@ -0,0 +1,243 @@ +--TEST-- +Test array_intersect_assoc() function : usage variations - different arrays for 'arr1' argument +--FILE-- +22 +'single quoted string' +"double quoted string" +2222 != 1111.\t 0000 = 0000\n +EOT; + +// arrays to be passed to $arr1 argument +$arrays = array ( +/*1*/ array(1, 2), // with default keys and numeric values + array(1.1, 2.2), // with default keys & float values + array(false,true), // with default keys and boolean values + array(), // empty array +/*5*/ array(NULL), // with NULL + array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings + array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings + array("h1" => $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $numeric_string), // with heredocs + + // associative arrays +/*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values + array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values + array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values + array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value + array("one" => 1, 2 => "two", 4 => "four"), //mixed + + // associative array, containing null/empty/boolean values as key/value +/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), + array(true => "true", false => "false", "false" => false, "true" => true), + array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), + array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), + array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + + // array with repetative keys +/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) +); + + +// array to be passsed to $arr2 argument +$arr2 = array ( + 1, 1.1, 2.2, "hello", "one", NULL, 2, + 'world', true,5 => false, 1 => 'aaaa\r', "aaaa\r", + 'h3' => $diff_whitespaces, $numeric_string, + "one" => "ten", 4 => "four", "two" => 2, + '', null => "null", '' => 'emptys', "emptyd" => "", +); + +// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc() +$iterator = 1; +foreach($arrays as $arr1) { + echo "-- Iteration $iterator --\n"; + + // Calling array_intersect_assoc() with default arguments + var_dump( array_intersect_assoc($arr1, $arr2) ); + + // Calling array_intersect_assoc() with more arguments. + // additional argument passed is the same as $arr1 argument + var_dump( array_intersect_assoc($arr1, $arr2, $arr1) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect_assoc() : Passing different types of arrays to $arr1 argument *** +-- Iteration 1 -- +array(1) { + [0]=> + int(1) +} +array(1) { + [0]=> + int(1) +} +-- Iteration 2 -- +array(0) { +} +array(0) { +} +-- Iteration 3 -- +array(0) { +} +array(0) { +} +-- Iteration 4 -- +array(0) { +} +array(0) { +} +-- Iteration 5 -- +array(0) { +} +array(0) { +} +-- Iteration 6 -- +array(0) { +} +array(0) { +} +-- Iteration 7 -- +array(1) { + [1]=> + string(6) "aaaa\r" +} +array(1) { + [1]=> + string(6) "aaaa\r" +} +-- Iteration 8 -- +array(1) { + ["h3"]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" +} +array(1) { + ["h3"]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" +} +-- Iteration 9 -- +array(0) { +} +array(0) { +} +-- Iteration 10 -- +array(1) { + ["two"]=> + int(2) +} +array(1) { + ["two"]=> + int(2) +} +-- Iteration 11 -- +array(0) { +} +array(0) { +} +-- Iteration 12 -- +array(1) { + ["one"]=> + string(3) "ten" +} +array(1) { + ["one"]=> + string(3) "ten" +} +-- Iteration 13 -- +array(1) { + [4]=> + string(4) "four" +} +array(1) { + [4]=> + string(4) "four" +} +-- Iteration 14 -- +array(0) { +} +array(0) { +} +-- Iteration 15 -- +array(0) { +} +array(0) { +} +-- Iteration 16 -- +array(2) { + [""]=> + string(6) "emptys" + ["emptyd"]=> + string(0) "" +} +array(2) { + [""]=> + string(6) "emptys" + ["emptyd"]=> + string(0) "" +} +-- Iteration 17 -- +array(1) { + [5]=> + bool(false) +} +array(1) { + [5]=> + bool(false) +} +-- Iteration 18 -- +array(0) { +} +array(0) { +} +-- Iteration 19 -- +array(0) { +} +array(0) { +} +Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation4.phpt b/ext/standard/tests/array/array_intersect_assoc_variation4.phpt new file mode 100644 index 0000000..ed2e3d9 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_assoc_variation4.phpt @@ -0,0 +1,254 @@ +--TEST-- +Test array_intersect_assoc() function : usage variations - different arrays for 'arr2' argument +--FILE-- +22 +'single quoted string' +"double quoted string" +2222 != 1111.\t 0000 = 0000\n +EOT; + +// array to be passsed to $arr1 argument +$arr1 = array ( + 1, 1.1, 1.3, 1 => true, "hello", "one", NULL, 2, + 'world', true, false, 3 => "b\tbbb", "aaaa\r", + $numeric_string, "h3" => $diff_whitespaces, "true" => true, + "one" => "ten", 4 => "four", "two" => 2, 6 => "six", + '', null => "null", '' => 'emptys' +); + +// arrays to be passed to $arr2 argument +$arrays = array ( +/*1*/ array(1, 2), // array with default keys and numeric values + array(1.1, 1.2, 1.3), // array with default keys & float values + array(false,true), // array with default keys and boolean values + array(), // empty array +/*5*/ array(NULL), // array with NULL + array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // array with double quoted strings + array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // array with single quoted strings + array($blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $numeric_string), // array with heredocs + + // associative arrays +/*9*/ array(1 => "one", 2 => "two", 6 => "six"), // explicit numeric keys, string values + array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values + array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values + array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value + array("one" => 1, 2 => "two", 4 => "four"), //mixed + + // associative array, containing null/empty/boolean values as key/value +/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), + array(true => "true", false => "false", "false" => false, "true" => true), + array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), + array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), + array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + + // array with repetative keys +/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) +); + +// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc() +$iterator = 1; +foreach($arrays as $arr2) { + echo "-- Iteration $iterator --\n"; + + // Calling array_intersect_assoc() with default arguments + var_dump( array_intersect_assoc($arr1, $arr2) ); + + // Calling array_intersect_assoc() with more arguments + // additional argument passed is the same as $arr1 argument + var_dump( array_intersect_assoc($arr1, $arr2, $arr1) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect_assoc() : Passing different types of arrays to $arr2 argument *** +-- Iteration 1 -- +array(1) { + [0]=> + int(1) +} +array(1) { + [0]=> + int(1) +} +-- Iteration 2 -- +array(1) { + [2]=> + float(1.3) +} +array(1) { + [2]=> + float(1.3) +} +-- Iteration 3 -- +array(1) { + [1]=> + bool(true) +} +array(1) { + [1]=> + bool(true) +} +-- Iteration 4 -- +array(0) { +} +array(0) { +} +-- Iteration 5 -- +array(0) { +} +array(0) { +} +-- Iteration 6 -- +array(1) { + [3]=> + string(5) "b bbb" +} +array(1) { + [3]=> + string(5) "b bbb" +} +-- Iteration 7 -- +array(0) { +} +array(0) { +} +-- Iteration 8 -- +array(1) { + ["h3"]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" +} +array(1) { + ["h3"]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" +} +-- Iteration 9 -- +array(1) { + [6]=> + string(3) "six" +} +array(1) { + [6]=> + string(3) "six" +} +-- Iteration 10 -- +array(1) { + ["two"]=> + int(2) +} +array(1) { + ["two"]=> + int(2) +} +-- Iteration 11 -- +array(0) { +} +array(0) { +} +-- Iteration 12 -- +array(1) { + ["one"]=> + string(3) "ten" +} +array(1) { + ["one"]=> + string(3) "ten" +} +-- Iteration 13 -- +array(1) { + [4]=> + string(4) "four" +} +array(1) { + [4]=> + string(4) "four" +} +-- Iteration 14 -- +array(0) { +} +array(0) { +} +-- Iteration 15 -- +array(1) { + ["true"]=> + bool(true) +} +array(1) { + ["true"]=> + bool(true) +} +-- Iteration 16 -- +array(1) { + [""]=> + string(6) "emptys" +} +array(1) { + [""]=> + string(6) "emptys" +} +-- Iteration 17 -- +array(1) { + [5]=> + NULL +} +array(1) { + [5]=> + NULL +} +-- Iteration 18 -- +array(0) { +} +array(0) { +} +-- Iteration 19 -- +array(0) { +} +array(0) { +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_assoc_variation5.phpt b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt new file mode 100644 index 0000000..7d8e09e --- /dev/null +++ b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt @@ -0,0 +1,173 @@ +--TEST-- +Test array_intersect_assoc() function : usage variations - assoc array with diff keys for 'arr1' argument +--FILE-- + "0"), + array(1 => "1"), + array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), + + // arrays with float keys +/*5*/ array(2.3333 => "float"), + array(1.2 => "f1", 3.33 => "f2", + 4.89999922839999 => "f3", + 33333333.333333 => "f4"), + + // arrays with string keys +/*7*/ array('\tHello' => 111, 're\td' => "color", + '\v\fworld' => 2.2, 'pen\n' => 33), + array("\tHello" => 111, "re\td" => "color", + "\v\fworld" => 2.2, "pen\n" => 33), + array("hello", $heredoc => "string"), // heredoc + + // array with object, unset variable and resource variable +/*10*/ array(@$unset_var => "hello"), + + // array with mixed keys +/*11*/ array('hello' => 1, "fruit" => 2.2, + 133 => "int", 444.432 => "float", + @$unset_var => "unset", $heredoc => "heredoc") +); + +// array to be passsed to $arr2 argument +$arr2 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4", + "\tHello" => 111, 2.2, 'color', "Hello world" => "string", + "pen\n" => 33, 133 => "int"); + +// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc() +$iterator = 1; +foreach($arrays as $arr1) { + echo "-- Iteration $iterator --\n"; + + // Calling array_intersect_assoc() with default arguments + var_dump( array_intersect_assoc($arr1, $arr2) ); + + // Calling array_intersect_assoc() with more arguments. + // additional argument passed is the same as $arr1 argument + var_dump( array_intersect_assoc($arr1, $arr2, $arr1) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect_assoc() : assoc array with diff keys to $arr1 argument *** +-- Iteration 1 -- +array(0) { +} +array(0) { +} +-- Iteration 2 -- +array(1) { + [0]=> + string(1) "0" +} +array(1) { + [0]=> + string(1) "0" +} +-- Iteration 3 -- +array(0) { +} +array(0) { +} +-- Iteration 4 -- +array(0) { +} +array(0) { +} +-- Iteration 5 -- +array(1) { + [2]=> + string(5) "float" +} +array(1) { + [2]=> + string(5) "float" +} +-- Iteration 6 -- +array(2) { + [4]=> + string(2) "f3" + [33333333]=> + string(2) "f4" +} +array(2) { + [4]=> + string(2) "f3" + [33333333]=> + string(2) "f4" +} +-- Iteration 7 -- +array(0) { +} +array(0) { +} +-- Iteration 8 -- +array(2) { + [" Hello"]=> + int(111) + ["pen +"]=> + int(33) +} +array(2) { + [" Hello"]=> + int(111) + ["pen +"]=> + int(33) +} +-- Iteration 9 -- +array(1) { + ["Hello world"]=> + string(6) "string" +} +array(1) { + ["Hello world"]=> + string(6) "string" +} +-- Iteration 10 -- +array(0) { +} +array(0) { +} +-- Iteration 11 -- +array(1) { + [133]=> + string(3) "int" +} +array(1) { + [133]=> + string(3) "int" +} +Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation6.phpt b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt new file mode 100644 index 0000000..7580622 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt @@ -0,0 +1,173 @@ +--TEST-- +Test array_intersect_assoc() function : usage variations - assoc array with diff keys for 'arr2' argument +--FILE-- + "0"), + array(1 => "1"), + array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), + + // arrays with float keys +/*5*/ array(2.3333 => "float"), + array(1.2 => "f1", 3.33 => "f2", + 4.89999922839999 => "f3", + 33333333.333333 => "f4"), + + // arrays with string keys +/*7*/ array('\tHello' => 111, 're\td' => "color", + '\v\fworld' => 2.2, 'pen\n' => 33), + array("\tHello" => 111, "re\td" => "color", + "\v\fworld" => 2.2, "pen\n" => 33), + array("hello", $heredoc => "string"), // heredoc + + // array with unset variable +/*10*/ array( @$unset_var => "hello"), + + // array with mixed keys +/*11*/ array('hello' => 1, "fruit" => 2.2, + 133 => "int", 444.432 => "float", + @$unset_var => "unset", $heredoc => "heredoc") +); + +// array to be passsed to $arr1 argument +$arr1 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4", + "\tHello" => 111, 2.2, 'color', "Hello world" => "string", + "pen\n" => 33, 133 => "int"); + +// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc() +$iterator = 1; +foreach($arrays as $arr2) { + echo "-- Iteration $iterator --\n"; + + // Calling array_intersect_assoc() with default arguments + var_dump( array_intersect_assoc($arr1, $arr2) ); + + // Calling array_intersect_assoc() with more arguments. + // additional argument passed is the same as $arr1 argument + var_dump( array_intersect_assoc($arr1, $arr2, $arr1) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect_assoc() : assoc array with diff keys to $arr2 argument *** +-- Iteration 1 -- +array(0) { +} +array(0) { +} +-- Iteration 2 -- +array(1) { + [0]=> + int(0) +} +array(1) { + [0]=> + int(0) +} +-- Iteration 3 -- +array(0) { +} +array(0) { +} +-- Iteration 4 -- +array(0) { +} +array(0) { +} +-- Iteration 5 -- +array(1) { + [2]=> + string(5) "float" +} +array(1) { + [2]=> + string(5) "float" +} +-- Iteration 6 -- +array(2) { + [4]=> + string(2) "f3" + [33333333]=> + string(2) "f4" +} +array(2) { + [4]=> + string(2) "f3" + [33333333]=> + string(2) "f4" +} +-- Iteration 7 -- +array(0) { +} +array(0) { +} +-- Iteration 8 -- +array(2) { + [" Hello"]=> + int(111) + ["pen +"]=> + int(33) +} +array(2) { + [" Hello"]=> + int(111) + ["pen +"]=> + int(33) +} +-- Iteration 9 -- +array(1) { + ["Hello world"]=> + string(6) "string" +} +array(1) { + ["Hello world"]=> + string(6) "string" +} +-- Iteration 10 -- +array(0) { +} +array(0) { +} +-- Iteration 11 -- +array(1) { + [133]=> + string(3) "int" +} +array(1) { + [133]=> + string(3) "int" +} +Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation7.phpt b/ext/standard/tests/array/array_intersect_assoc_variation7.phpt new file mode 100644 index 0000000..ba2f79a --- /dev/null +++ b/ext/standard/tests/array/array_intersect_assoc_variation7.phpt @@ -0,0 +1,212 @@ +--TEST-- +Test array_intersect_assoc() function : usage variations - assoc array with diff values for 'arr1' argument +--FILE-- + 0), + array("1" => 1), + array("one" => 1, 'two' => 2, "three" => 3, 4 => 4), + + // arrays with float values +/*5*/ array("float" => 2.3333), + array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333), + + // arrays with string values +/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), + array(1 => "hello", "heredoc" => $heredoc), + + // array with object, unset variable and resource variable +/*10*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp), + + // array with mixed values +/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit", + 'resource' => $fp, "int" => 133, "float" => 444.432, + "unset" => @$unset_var, "heredoc" => $heredoc) +); + +// array to be passsed to $arr2 argument +$arr2 = array(0 => "0", 1, "two" => 2, "float" => 2.3333, "f1" => 1.2, + "f4" => 33333333.333, 111 => "\tHello", 3.3 => 'pen\n', '\v\fworld', + "heredoc" => "Hello world", 11 => new classA(), "resource" => $fp, + "int" => 133, 222 => "fruit"); + +// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc() +$iterator = 1; +foreach($arrays as $arr1) { + echo "-- Iteration $iterator --\n"; + + // Calling array_intersect_assoc() with default arguments + var_dump( array_intersect_assoc($arr1, $arr2) ); + + // Calling array_intersect_assoc() with more arguments. + // additional argument passed is the same as $arr1 argument + var_dump( array_intersect_assoc($arr1, $arr2, $arr1) ); + $iterator++; +} + +// close the file resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect_assoc() : assoc array with diff values to $arr1 argument *** +-- Iteration 1 -- +array(0) { +} +array(0) { +} +-- Iteration 2 -- +array(1) { + [0]=> + int(0) +} +array(1) { + [0]=> + int(0) +} +-- Iteration 3 -- +array(1) { + [1]=> + int(1) +} +array(1) { + [1]=> + int(1) +} +-- Iteration 4 -- +array(1) { + ["two"]=> + int(2) +} +array(1) { + ["two"]=> + int(2) +} +-- Iteration 5 -- +array(1) { + ["float"]=> + float(2.3333) +} +array(1) { + ["float"]=> + float(2.3333) +} +-- Iteration 6 -- +array(2) { + ["f1"]=> + float(1.2) + ["f4"]=> + float(33333333.333) +} +array(2) { + ["f1"]=> + float(1.2) + ["f4"]=> + float(33333333.333) +} +-- Iteration 7 -- +array(1) { + [111]=> + string(6) " Hello" +} +array(1) { + [111]=> + string(6) " Hello" +} +-- Iteration 8 -- +array(1) { + [3]=> + string(5) "pen\n" +} +array(1) { + [3]=> + string(5) "pen\n" +} +-- Iteration 9 -- +array(1) { + ["heredoc"]=> + string(11) "Hello world" +} +array(1) { + ["heredoc"]=> + string(11) "Hello world" +} +-- Iteration 10 -- +array(2) { + [11]=> + object(classA)#%d (0) { + } + ["resource"]=> + resource(%d) of type (stream) +} +array(2) { + [11]=> + object(classA)#%d (0) { + } + ["resource"]=> + resource(%d) of type (stream) +} +-- Iteration 11 -- +array(4) { + [222]=> + string(5) "fruit" + ["resource"]=> + resource(%d) of type (stream) + ["int"]=> + int(133) + ["heredoc"]=> + string(11) "Hello world" +} +array(4) { + [222]=> + string(5) "fruit" + ["resource"]=> + resource(%d) of type (stream) + ["int"]=> + int(133) + ["heredoc"]=> + string(11) "Hello world" +} +Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation8.phpt b/ext/standard/tests/array/array_intersect_assoc_variation8.phpt new file mode 100644 index 0000000..6ec8fb0 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_assoc_variation8.phpt @@ -0,0 +1,212 @@ +--TEST-- +Test array_intersect_assoc() function : usage variations - assoc array with diff values for 'arr2' argument +--FILE-- + 0), + array("1" => 1), + array("one" => 1, 'two' => 2, "three" => 3, 4 => 4), + + // arrays with float values +/*5*/ array("float" => 2.3333), + array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333), + + // arrays with string values +/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), + array(1 => "hello", "heredoc" => $heredoc), + + // array with object, unset variable and resource variable +/*10*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp), + + // array with mixed values +/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit", + 'resource' => $fp, "int" => 133, "float" => 444.432, + "unset" => @$unset_var, "heredoc" => $heredoc) +); + +// array to be passsed to $arr1 argument +$arr1 = array(0 => "0", 1, "two" => 2, "float" => 2.3333, "f1" => 1.2, + "f4" => 33333333.333, 111 => "\tHello", 3.3 => 'pen\n', '\v\fworld', + "heredoc" => "Hello world", 11 => new classA(), "resource" => $fp, + "int" => 133, 222 => "fruit"); + +// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc() +$iterator = 1; +foreach($arrays as $arr2) { + echo "-- Iteration $iterator --\n"; + + // Calling array_intersect_assoc() with default arguments + var_dump( array_intersect_assoc($arr1, $arr2) ); + + // Calling array_intersect_assoc() with more arguments. + // additional argument passed is the same as $arr1 argument + var_dump( array_intersect_assoc($arr1, $arr2, $arr1) ); + $iterator++; +} + +// close the file resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect_assoc() : assoc array with diff values to $arr2 argument *** +-- Iteration 1 -- +array(0) { +} +array(0) { +} +-- Iteration 2 -- +array(1) { + [0]=> + string(1) "0" +} +array(1) { + [0]=> + string(1) "0" +} +-- Iteration 3 -- +array(1) { + [1]=> + int(1) +} +array(1) { + [1]=> + int(1) +} +-- Iteration 4 -- +array(1) { + ["two"]=> + int(2) +} +array(1) { + ["two"]=> + int(2) +} +-- Iteration 5 -- +array(1) { + ["float"]=> + float(2.3333) +} +array(1) { + ["float"]=> + float(2.3333) +} +-- Iteration 6 -- +array(2) { + ["f1"]=> + float(1.2) + ["f4"]=> + float(33333333.333) +} +array(2) { + ["f1"]=> + float(1.2) + ["f4"]=> + float(33333333.333) +} +-- Iteration 7 -- +array(1) { + [111]=> + string(6) " Hello" +} +array(1) { + [111]=> + string(6) " Hello" +} +-- Iteration 8 -- +array(1) { + [3]=> + string(5) "pen\n" +} +array(1) { + [3]=> + string(5) "pen\n" +} +-- Iteration 9 -- +array(1) { + ["heredoc"]=> + string(11) "Hello world" +} +array(1) { + ["heredoc"]=> + string(11) "Hello world" +} +-- Iteration 10 -- +array(2) { + [11]=> + object(classA)#%d (0) { + } + ["resource"]=> + resource(%d) of type (stream) +} +array(2) { + [11]=> + object(classA)#%d (0) { + } + ["resource"]=> + resource(%d) of type (stream) +} +-- Iteration 11 -- +array(4) { + ["heredoc"]=> + string(11) "Hello world" + ["resource"]=> + resource(%d) of type (stream) + ["int"]=> + int(133) + [222]=> + string(5) "fruit" +} +array(4) { + ["heredoc"]=> + string(11) "Hello world" + ["resource"]=> + resource(%d) of type (stream) + ["int"]=> + int(133) + [222]=> + string(5) "fruit" +} +Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation9.phpt b/ext/standard/tests/array/array_intersect_assoc_variation9.phpt new file mode 100644 index 0000000..338d409 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_assoc_variation9.phpt @@ -0,0 +1,152 @@ +--TEST-- +Test array_intersect_assoc() function : usage variations - two dimensional arrays for $arr1 and $arr2 arguments +--FILE-- + "one", 2 => "two", 3 => "three"), + array("ten" => 10, "twenty" => 20.00, "thirty" => 30) +); + +$arr2 = array ( + array(1, 2, 3, 4), + array(1 => "one", 2 => "two", 3 => "three") +); + +/* Passing the entire array as argument to $arr1 and $arr2 */ +// Calling array_intersect_assoc() with default arguments +echo "-- Passing the entire 2-D array to \$arr1 and \$arr2 --\n"; +echo "- With default arguments -\n"; +var_dump( array_intersect_assoc($arr1, $arr2) ); + +// Calling array_intersect_assoc() with more arguments +// additional argument passed is the same as $arr1 +echo "- With more arguments -\n"; +var_dump( array_intersect_assoc($arr1, $arr2, $arr1) ); + +/* Passing the sub-array as argument to $arr1 and $arr2 */ +// Calling array_intersect_assoc() with default arguments +echo "-- Passing the sub-array to \$arr1 and \$arr2 --\n"; +echo "- With default arguments -\n"; +var_dump( array_intersect_assoc($arr1[0], $arr2[0]) ); + +// Calling array_intersect_assoc() with more arguments +// additional argument passed is the same as $arr1 +echo "- With more arguments -\n"; +var_dump( array_intersect_assoc($arr1[0], $arr2[0], $arr1[0]) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect_assoc() : passing two dimensional array to both $arr1 and $arr2 arguments *** +-- Passing the entire 2-D array to $arr1 and $arr2 -- +- With default arguments - + +Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d +array(2) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(5) "hello" + [3]=> + string(5) "world" + } + [1]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + } +} +- With more arguments - + +Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d +array(2) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(5) "hello" + [3]=> + string(5) "world" + } + [1]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + } +} +-- Passing the sub-array to $arr1 and $arr2 -- +- With default arguments - +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +- With more arguments - +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +Done diff --git a/ext/standard/tests/array/array_intersect_basic.phpt b/ext/standard/tests/array/array_intersect_basic.phpt new file mode 100644 index 0000000..fde5782 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_basic.phpt @@ -0,0 +1,80 @@ +--TEST-- +Test array_intersect() function : basic functionality +--FILE-- + 1, "two" => 2); + +// default key array for both $arr1 and $arr2 argument +var_dump( array_intersect($arr_default_keys, $arr_default_keys) ); + +// default key array for $arr1 and associative array for $arr2 argument +var_dump( array_intersect($arr_default_keys, $arr_associative) ); + +// associative array for $arr1 and default key array for $arr2 +var_dump( array_intersect($arr_associative, $arr_default_keys) ); + +// associative array for both $arr1 and $arr2 argument +var_dump( array_intersect($arr_associative, $arr_associative) ); + +// more arrays to be intersected +$arr3 = array(2, 3, 4); +var_dump( array_intersect($arr_default_keys, $arr_associative, $arr3) ); +var_dump( array_intersect($arr_associative, $arr_default_keys, $arr3, $arr_associative) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect() : basic functionality *** +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(5) "hello" + [3]=> + string(5) "world" +} +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(1) { + [1]=> + int(2) +} +array(1) { + ["two"]=> + int(2) +} +Done diff --git a/ext/standard/tests/array/array_intersect_error.phpt b/ext/standard/tests/array/array_intersect_error.phpt new file mode 100644 index 0000000..46f77ac --- /dev/null +++ b/ext/standard/tests/array/array_intersect_error.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test array_intersect() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_intersect() : error conditions *** + +-- Testing array_intersect() function with Zero arguments -- + +Warning: array_intersect(): at least 2 parameters are required, 0 given in %s on line %d +NULL + +-- Testing array_intersect() function with less than expected no. of arguments -- + +Warning: array_intersect(): at least 2 parameters are required, 1 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_intersect_key.phpt b/ext/standard/tests/array/array_intersect_key.phpt new file mode 100644 index 0000000..6d27839 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_key.phpt @@ -0,0 +1,209 @@ +--TEST-- +Test of the array_intersect_key() and array_intersect_ukey() +--FILE-- + &$a_f_el) { $a_f_el =$k*2;} +foreach ($b_f as $k=> &$b_f_el) { $b_f_el =$k*2;} +foreach ($c_f as $k=> &$c_f_el) { $c_f_el =$k*2;} +foreach ($d_f as $k=> &$d_f_el) { $d_f_el =$k*2;} + +var_dump(array_intersect_key($a_f, $b_f));// keys -> 2, -20, -2500 +var_dump(array_intersect_ukey($a_f, $b_f, "comp_func"));// 2, 20, -2500 +var_dump(array_intersect_key($a_f, $c_f));// keys -> 6, 2, -20, -2500 +var_dump(array_intersect_ukey($a_f, $c_f, "comp_func"));// 6, 2, -20, -2500 +var_dump(array_intersect_key($a_f, $d_f));// -20 +var_dump(array_intersect_ukey($a_f, $d_f, "comp_func"));// -20 + +var_dump(array_intersect_key($a_f, $b_f, $c_f));// 2, -20, -2500 +var_dump(array_intersect_ukey($a_f, $b_f, $c_f, "comp_func"));// 2, -20, -2500 +var_dump(array_intersect_key($a_f, $b_f, $d_f));// -20 +var_dump(array_intersect_ukey($a_f, $b_f, $d_f, "comp_func"));// -20 + +var_dump(array_intersect_key($a_f, $b_f, $c_f, $d_f));// -20 +var_dump(array_intersect_ukey($a_f, $b_f, $c_f, $d_f, "comp_func"));//-20 + + +var_dump(array_intersect_key($b_f, $c_f));// 0, 2, -20, -2500 +var_dump(array_intersect_ukey($b_f, $c_f, "comp_func"));//0, 2, -20, 2500 + +var_dump(array_intersect_key($b_f, $d_f));// -20 +var_dump(array_intersect_ukey($b_f, $d_f, "comp_func"));// -20 + +var_dump(array_intersect_key($b_f, $c_f, $d_f));// -20 +var_dump(array_intersect_ukey($b_f, $c_f, $d_f, "comp_func"));// -20 + + +echo "----- Now testing array_intersect() ------- \n"; +var_dump(array_intersect($a, $b_f)); +var_dump(array_uintersect($a, $b, "comp_func")); +var_dump(array_intersect($a, $b, $c)); +var_dump(array_uintersect($a, $b, $c, "comp_func")); +var_dump(array_intersect($a, $b, $c, $d)); +var_dump(array_uintersect($a, $b, $c, $d, "comp_func")); + +/////////////////////////////////////////////////////////////////////// +function comp_func($a, $b) { + if ($a === $b) return 0; + return ($a > $b)? 1:-1; + +} +?> +--EXPECTF-- +array(3) { + [2]=> + int(4) + [-20]=> + int(-40) + [-2500]=> + &int(-5000) +} +array(3) { + [2]=> + int(4) + [-20]=> + int(-40) + [-2500]=> + &int(-5000) +} +array(4) { + [6]=> + int(12) + [2]=> + int(4) + [-20]=> + int(-40) + [-2500]=> + &int(-5000) +} +array(4) { + [6]=> + int(12) + [2]=> + int(4) + [-20]=> + int(-40) + [-2500]=> + &int(-5000) +} +array(1) { + [-20]=> + int(-40) +} +array(1) { + [-20]=> + int(-40) +} +array(3) { + [2]=> + int(4) + [-20]=> + int(-40) + [-2500]=> + &int(-5000) +} +array(3) { + [2]=> + int(4) + [-20]=> + int(-40) + [-2500]=> + &int(-5000) +} +array(1) { + [-20]=> + int(-40) +} +array(1) { + [-20]=> + int(-40) +} +array(1) { + [-20]=> + int(-40) +} +array(1) { + [-20]=> + int(-40) +} +array(4) { + [0]=> + int(0) + [2]=> + int(4) + [-20]=> + int(-40) + [-2500]=> + &int(-5000) +} +array(4) { + [0]=> + int(0) + [2]=> + int(4) + [-20]=> + int(-40) + [-2500]=> + &int(-5000) +} +array(1) { + [-20]=> + int(-40) +} +array(1) { + [-20]=> + int(-40) +} +array(1) { + [-20]=> + int(-40) +} +array(1) { + [-20]=> + int(-40) +} +----- Now testing array_intersect() ------- +array(0) { +} +array(3) { + [2]=> + int(2) + [3]=> + int(-20) + [6]=> + int(-2500) +} +array(3) { + [2]=> + int(2) + [3]=> + int(-20) + [6]=> + int(-2500) +} +array(3) { + [2]=> + int(2) + [3]=> + int(-20) + [6]=> + int(-2500) +} +array(1) { + [3]=> + int(-20) +} +array(1) { + [3]=> + int(-20) +} diff --git a/ext/standard/tests/array/array_intersect_key_basic.phpt b/ext/standard/tests/array/array_intersect_key_basic.phpt new file mode 100644 index 0000000..fc6e177 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_key_basic.phpt @@ -0,0 +1,19 @@ +--TEST-- +array_intersect_key(): Basic Test +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +var_dump(array_intersect_key($array1, $array2)); +?> +--EXPECT-- +array(2) { + ["blue"]=> + int(1) + ["green"]=> + int(3) +} \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_key_error.phpt b/ext/standard/tests/array/array_intersect_key_error.phpt new file mode 100644 index 0000000..9509e97 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_key_error.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_intersect_key() function : error conditions +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); + +// Testing array_intersect_key with one less than the expected number of arguments +echo "\n-- Testing array_intersect_key() function with less than expected no. of arguments --\n"; +var_dump( array_intersect_key($array1) ); + +// Testing array_intersect_key with one less than the expected number of arguments +echo "\n-- Testing array_intersect_key() function with no arguments --\n"; +var_dump( array_intersect_key() ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_key() : error conditions *** + +-- Testing array_intersect_key() function with less than expected no. of arguments -- + +Warning: array_intersect_key(): at least 2 parameters are required, 1 given in %s on line %d +NULL + +-- Testing array_intersect_key() function with no arguments -- + +Warning: array_intersect_key(): at least 2 parameters are required, 0 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_key_variation1.phpt b/ext/standard/tests/array/array_intersect_key_variation1.phpt new file mode 100644 index 0000000..8c245e4 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_key_variation1.phpt @@ -0,0 +1,314 @@ +--TEST-- +Test array_intersect_key() function : usage variation - Passing unexpected values to first argument +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array3 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource var' => $fp, +); + +// loop through each element of the array for arr1 +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_intersect_key($value, $array2) ); + var_dump( array_intersect_key($value, $array2, $array3) ); +} + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_key() : usage variation *** + +--int 0-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +--resource var-- + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #1 is not an array in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_key_variation2.phpt b/ext/standard/tests/array/array_intersect_key_variation2.phpt new file mode 100644 index 0000000..3c33deb --- /dev/null +++ b/ext/standard/tests/array/array_intersect_key_variation2.phpt @@ -0,0 +1,315 @@ +--TEST-- +Test array_intersect_key() function : usage variation - Passing unexpected values to second argument +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array3 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource var' => $fp, +); + +// loop through each element of the array for arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_intersect_key($array1, $value) ); + var_dump( array_intersect_key($array1, $value, $array3) ); +} + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_key() : usage variation *** + +--int 0-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +--resource var-- + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_key(): Argument #2 is not an array in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_key_variation3.phpt b/ext/standard/tests/array/array_intersect_key_variation3.phpt new file mode 100644 index 0000000..8fd3d3c --- /dev/null +++ b/ext/standard/tests/array/array_intersect_key_variation3.phpt @@ -0,0 +1,235 @@ +--TEST-- +Test array_intersect_key() function : usage variation - Passing unexpected values to optional argument +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource var' => $fp, +); + +// loop through each element of the array for arr2 +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_intersect_key($array1, $array2, $value) ); +} + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_key() : usage variation *** + +--int 0-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL + +--resource var-- + +Warning: array_intersect_key(): Argument #3 is not an array in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_key_variation4.phpt b/ext/standard/tests/array/array_intersect_key_variation4.phpt new file mode 100644 index 0000000..1d3d976 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_key_variation4.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test array_intersect_key() function : usage variation - Passing integer indexed array +--FILE-- + '0', -1 => '-1' , 02 => 'two', -07 => '-07', 0xA => '0xA', -0xC => '-0xc'); + +$input_arrays = array( + 'decimal indexed' => array(10 => '10', '-17' => '-17'), + 'octal indexed' => array(-011 => '-011', 012 => '012'), + 'hexa indexed' => array(0x12 => '0x12', -0x7 => '-0x7', ), +); + +foreach($input_arrays as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_intersect_key($input_array, $value) ); + var_dump( array_intersect_key($value,$input_array ) ); +} +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_key() : usage variation *** + +--decimal indexed-- +array(1) { + [10]=> + string(3) "0xA" +} +array(1) { + [10]=> + string(2) "10" +} + +--octal indexed-- +array(1) { + [10]=> + string(3) "0xA" +} +array(1) { + [10]=> + string(3) "012" +} + +--hexa indexed-- +array(1) { + [-7]=> + string(3) "-07" +} +array(1) { + [-7]=> + string(4) "-0x7" +} +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_key_variation5.phpt b/ext/standard/tests/array/array_intersect_key_variation5.phpt new file mode 100644 index 0000000..c286de6 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_key_variation5.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test array_intersect_key() function : usage variation - Passing float indexed array +--FILE-- + '0', 10 => '10' , -10 => '-10'); +$float_indx_array = array(0.0 => '0.0', 10.5 => '10.5' , -10.5 => '-10.5', 0.5 => '0.5'); + +echo "\n-- Testing array_intersect_key() function with float indexed array --\n"; +var_dump( array_intersect_key($input_array, $float_indx_array) ); +var_dump( array_intersect_key($float_indx_array,$input_array ) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_key() : usage variation *** + +-- Testing array_intersect_key() function with float indexed array -- +array(3) { + [0]=> + string(1) "0" + [10]=> + string(2) "10" + [-10]=> + string(3) "-10" +} +array(3) { + [0]=> + string(3) "0.5" + [10]=> + string(4) "10.5" + [-10]=> + string(5) "-10.5" +} +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_key_variation6.phpt b/ext/standard/tests/array/array_intersect_key_variation6.phpt new file mode 100644 index 0000000..823b070 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_key_variation6.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test array_intersect_key() function : usage variation - Passing boolean indexed array +--FILE-- + '0', 1 => '1' , -10 => '-10'); +$boolean_indx_array = array(true => 'boolt', false => 'boolf', TRUE => 'boolT', FALSE => 'boolF'); + +echo "\n-- Testing array_intersect_key() function with boolean indexed array --\n"; +var_dump( array_intersect_key($input_array, $boolean_indx_array) ); +var_dump( array_intersect_key($boolean_indx_array,$input_array ) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_key() : usage variation *** + +-- Testing array_intersect_key() function with boolean indexed array -- +array(2) { + [0]=> + string(1) "0" + [1]=> + string(1) "1" +} +array(2) { + [1]=> + string(5) "boolT" + [0]=> + string(5) "boolF" +} +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_key_variation7.phpt b/ext/standard/tests/array/array_intersect_key_variation7.phpt new file mode 100644 index 0000000..fe4446a --- /dev/null +++ b/ext/standard/tests/array/array_intersect_key_variation7.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test array_intersect_key() function : usage variation - Passing null,unset and undefeined variable indexed array +--FILE-- + '0', 1 => '1' , -10 => '-10' , null => 'null'); +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$input_arrays = array( + 'null indexed' => array(NULL => 'null 1', null => 'null 2'), + 'undefined indexed' => array(@$undefined_var => 'undefined'), + 'unset indexed' => array(@$unset_var => 'unset'), +); + +foreach($input_arrays as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_intersect_key($input_array, $value) ); + var_dump( array_intersect_key($value,$input_array ) ); +} +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_key() : usage variation *** + +--null indexed-- +array(1) { + [""]=> + string(4) "null" +} +array(1) { + [""]=> + string(6) "null 2" +} + +--undefined indexed-- +array(1) { + [""]=> + string(4) "null" +} +array(1) { + [""]=> + string(9) "undefined" +} + +--unset indexed-- +array(1) { + [""]=> + string(4) "null" +} +array(1) { + [""]=> + string(5) "unset" +} +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_key_variation8.phpt b/ext/standard/tests/array/array_intersect_key_variation8.phpt new file mode 100644 index 0000000..2b889b5 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_key_variation8.phpt @@ -0,0 +1,64 @@ +--TEST-- +Test array_intersect_key() function : usage variation - Passing Multi dimensional array +--FILE-- + array('blue' => 1, 'red' => 2), + + 'second' => array('yellow' => 7), + + 'third' => array(0 =>'zero'), +); + +$array2 = array ( + + 'first' => array('blue' => 1, 'red' => 2,), + + 'second' => array('cyan' => 8), + + 'fourth' => array(2 => 'two'), +); +var_dump( array_intersect_key($array1, $array2) ); +var_dump( array_intersect_key($array2,$array1 ) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_key() : usage variation *** +array(2) { + ["first"]=> + array(2) { + ["blue"]=> + int(1) + ["red"]=> + int(2) + } + ["second"]=> + array(1) { + ["yellow"]=> + int(7) + } +} +array(2) { + ["first"]=> + array(2) { + ["blue"]=> + int(1) + ["red"]=> + int(2) + } + ["second"]=> + array(1) { + ["cyan"]=> + int(8) + } +} +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_basic.phpt b/ext/standard/tests/array/array_intersect_uassoc_basic.phpt new file mode 100644 index 0000000..1a2d57e --- /dev/null +++ b/ext/standard/tests/array/array_intersect_uassoc_basic.phpt @@ -0,0 +1,24 @@ +--TEST-- +array_intersect_uassoc(): Basic test +--FILE-- + $b) ? 1 : -1; +} +$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); +$result = array_intersect_uassoc($array1, $array2, "key_compare_func"); +var_dump($result); +?> +--EXPECT-- +array(1) { + ["a"]=> + string(5) "green" +} \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_uassoc_error.phpt b/ext/standard/tests/array/array_intersect_uassoc_error.phpt new file mode 100644 index 0000000..ae7acb1 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_uassoc_error.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test array_intersect_uassoc() function : error conditions +--FILE-- + "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); +$array3 = array("a"=>"green", "brown"); +$extra_arg = 10; + +//Callback function +function key_compare_func($a, $b) { + if ($a === $b) { + return 0; + } + return ($a > $b) ? 1 : -1; +} + +//Test array_intersect_uassoc with one more than the expected number of arguments +echo "\n-- Testing array_intersect_uassoc() function with more than expected no. of arguments --\n"; +var_dump( array_intersect_uassoc($array1, $array2, 'key_compare_func',$extra_arg) ); + +// Testing array_intersect_uassoc with one less than the expected number of arguments +echo "\n-- Testing array_intersect_uassoc() function with less than expected no. of arguments --\n"; +var_dump( array_intersect_uassoc($array1, $array2) ); +var_dump( array_intersect_uassoc($array1, $array2, $array3) ); + +// Testing array_intersect_uassoc with no arguments +echo "\n-- Testing array_intersect_uassoc() function with no arguments --\n"; +var_dump( array_intersect_uassoc() ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_uassoc() : error conditions *** + +-- Testing array_intersect_uassoc() function with more than expected no. of arguments -- + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Testing array_intersect_uassoc() function with less than expected no. of arguments -- + +Warning: array_intersect_uassoc(): at least 3 parameters are required, 2 given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, second array member is not a valid method in %s on line %d +NULL + +-- Testing array_intersect_uassoc() function with no arguments -- + +Warning: array_intersect_uassoc(): at least 3 parameters are required, 0 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt new file mode 100644 index 0000000..86dec03 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt @@ -0,0 +1,323 @@ +--TEST-- +Test array_intersect_uassoc() function : usage variation - Passing unexpected values to first argument +--FILE-- + "green", "yellow", "red"); +$array3 = array("a"=>"green", "brown"); + +//Callback function +function key_compare_func($a, $b) { + if ($a === $b) { + return 0; + } + return ($a > $b) ? 1 : -1; +} + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for arr1 +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_intersect_uassoc($value, $array2, 'key_compare_func') ); + var_dump( array_intersect_uassoc($value, $array2, $array3, 'key_compare_func') ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- + +*** Testing array_intersect_uassoc() : usage variation *** + +--int 0-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt new file mode 100644 index 0000000..aa0c82d --- /dev/null +++ b/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test array_intersect_uassoc() function : usage variation - Passing class/object methods to callback +--FILE-- + "green", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); +// define some class with method +class MyClass +{ + static function static_compare_func($a, $b) { + return strcasecmp($a, $b); + } + + public function class_compare_func($a, $b) { + return strcasecmp($a, $b); + } + +} + +echo "\n-- Testing array_intersect_uassoc() function using class with static method as callback --\n"; +var_dump( array_intersect_uassoc($array1, $array2, array('MyClass','static_compare_func')) ); +var_dump( array_intersect_uassoc($array1, $array2, 'MyClass::static_compare_func')); + +echo "\n-- Testing array_intersect_uassoc() function using class with regular method as callback --\n"; +$obj = new MyClass(); +var_dump( array_intersect_uassoc($array1, $array2, array($obj,'class_compare_func')) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_uassoc() : usage variation *** + +-- Testing array_intersect_uassoc() function using class with static method as callback -- +array(1) { + ["a"]=> + string(5) "green" +} +array(1) { + ["a"]=> + string(5) "green" +} + +-- Testing array_intersect_uassoc() function using class with regular method as callback -- +array(1) { + ["a"]=> + string(5) "green" +} +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation11.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation11.phpt new file mode 100644 index 0000000..cf2611a --- /dev/null +++ b/ext/standard/tests/array/array_intersect_uassoc_variation11.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test array_intersect_uassoc() function : usage variation - Passing class without string to callback (Handling fatal error) +--FILE-- + "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); +$array3 = array("a"=>"green", "brown"); +// Define error handler +function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { + if (error_reporting() != 0) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } +} +set_error_handler('test_error_handler'); + + +class classWithoutToString +{ +} + +$value = new classWithoutToString(); + +var_dump( array_intersect_uassoc($array1, $array2, $value) ); +var_dump( array_intersect_uassoc($array1, $array2, $array3, $value) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_uassoc() : usage variation *** +Error: 2 - array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given, %s(%d) +NULL +Error: 2 - array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given, %s(%d) +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt new file mode 100644 index 0000000..51341bb --- /dev/null +++ b/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt @@ -0,0 +1,323 @@ +--TEST-- +Test array_intersect_uassoc() function : usage variation - Passing unexpected values to second argument +--FILE-- + "green", "b" => "brown", "c" => "blue", "red"); +$array3 = array("a"=>"green", "brown"); + +//Callback function +function key_compare_func($a, $b) { + if ($a === $b) { + return 0; + } + return ($a > $b) ? 1 : -1; +} + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for arr1 +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_intersect_uassoc($array1, $value, 'key_compare_func') ); + var_dump( array_intersect_uassoc($array1, $value, $array3, 'key_compare_func') ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- + +*** Testing array_intersect_uassoc() : usage variation *** + +--int 0-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt new file mode 100644 index 0000000..f596e9c --- /dev/null +++ b/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt @@ -0,0 +1,244 @@ +--TEST-- +Test array_intersect_uassoc() function : usage variation - Passing unexpected values to optional third argument +--FILE-- + "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); + +//Callback function +function key_compare_func($a, $b) { + if ($a === $b) { + return 0; + } + return ($a > $b) ? 1 : -1; +} + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for arr1 +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_intersect_uassoc($array1, $array2, $value, 'key_compare_func') ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- + +*** Testing array_intersect_uassoc() : usage variation *** + +--int 0-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation4.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation4.phpt new file mode 100644 index 0000000..e5d0f56 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_uassoc_variation4.phpt @@ -0,0 +1,257 @@ +--TEST-- +Test array_intersect_uassoc() function : usage variation - Passing unexpected values to mandatory third argument +--FILE-- + "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); +$array3 = array("a"=>"green", "brown"); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for arr1 +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_intersect_uassoc($array1, $array2, $value) ); + var_dump( array_intersect_uassoc($array1, $array2, $array3, $value) ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_uassoc() : usage variation *** + +--int 0-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--int 1-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--int 12345-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--int -12345-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float 10.5-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float -10.5-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float .5-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--lowercase null-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--lowercase true-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--lowercase false-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--undefined var-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--unset var-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--resource-- + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation5.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation5.phpt new file mode 100644 index 0000000..ec7ee81 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_uassoc_variation5.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test array_intersect_uassoc() function : usage variation - Intersection of integers with floats and strings. +--FILE-- + 1.00, 1.00 => 2.00, 2.00 => 3.00); +$arr_string = array('1', '2', '3'); +$arr_string_float = array('1.00', '2.00'); + +function key_compare_func($a, $b) +{ + if ($a === $b) { + return 0; + } + return ($a > $b)? 1:-1; +} + +echo "\n-- Result of integers and floating point intersection --\n"; +var_dump( array_intersect_uassoc($arr_default_int, $arr_float, "key_compare_func") ); + +echo "\n-- Result of integers and strings containing integers intersection --\n"; +var_dump( array_intersect_uassoc($arr_default_int, $arr_string, "key_compare_func") ); + +echo "\n-- Result of integers and strings containing floating points intersection --\n"; +var_dump( array_intersect_uassoc($arr_default_int, $arr_string_float, "key_compare_func") ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_uassoc() : usage variation *** + +-- Result of integers and floating point intersection -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + +-- Result of integers and strings containing integers intersection -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + +-- Result of integers and strings containing floating points intersection -- +array(0) { +} +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation6.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation6.phpt new file mode 100644 index 0000000..55dd46d --- /dev/null +++ b/ext/standard/tests/array/array_intersect_uassoc_variation6.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test array_intersect_uassoc() function : usage variation - Intersection of floating points with strings. +--FILE-- + 1.00, 1.00 => 2.00); +$arr_string = array('1', '2', '3'); +$arr_string_float = array('1.00', '2.00'); + +function key_compare_func($a, $b) +{ + if ($a === $b) { + return 0; + } + return ($a > $b)? 1:-1; +} + +echo "\n-- Result of floating points and strings containing integers intersection --\n"; +var_dump( array_intersect_uassoc($arr_float, $arr_string, "key_compare_func") ); + +echo "\n-- Result of floating points and strings containing floating point intersection --\n"; +var_dump( array_intersect_uassoc($arr_float, $arr_string_float, "key_compare_func") ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_uassoc() : usage variation *** + +-- Result of floating points and strings containing integers intersection -- +array(2) { + [0]=> + float(1) + [1]=> + float(2) +} + +-- Result of floating points and strings containing floating point intersection -- +array(0) { +} +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation7.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation7.phpt new file mode 100644 index 0000000..7fa053a --- /dev/null +++ b/ext/standard/tests/array/array_intersect_uassoc_variation7.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test array_intersect_uassoc() function : usage variation - Intersection of strings containing integers, float +--FILE-- + $b)? 1:-1; +} + +echo "\n-- Result of strings containing integers intersection --\n"; +var_dump( array_intersect_uassoc($arr1_string_int, $arr2_string_int, "key_compare_func") ); + +echo "\n-- Result of strings containing floating points intersection --\n"; +var_dump( array_intersect_uassoc($arr1_string_float, $arr2_string_float, "key_compare_func") ); + +echo "\n-- Result of strings containing integers and strings containing floating points intersection --\n"; +var_dump( array_intersect_uassoc($arr1_string_int, $arr2_string_float, "key_compare_func") ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_uassoc() : usage variation *** + +-- Result of strings containing integers intersection -- +array(1) { + [0]=> + string(1) "1" +} + +-- Result of strings containing floating points intersection -- +array(1) { + [0]=> + string(4) "1.00" +} + +-- Result of strings containing integers and strings containing floating points intersection -- +array(0) { +} +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation8.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation8.phpt new file mode 100644 index 0000000..7b218f7 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_uassoc_variation8.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test array_intersect_uassoc() function : usage variation - arrays containing referenced variables +--FILE-- + 1, &$ref_var); + +echo "\n-- Testing array_intersect_uassoc() function with referenced variable \$ref_var has value '$ref_var' --\n"; +var_dump( array_intersect_uassoc($array1, $array2, "strcasecmp") ); + +// re-assign reference variable to different value +$ref_var = 10; +echo "\n-- Testing array_intersect_uassoc() function with referenced variable \$ref_var value changed to $ref_var --\n"; +var_dump( array_intersect_uassoc($array1, $array2, "strcasecmp") ); + +//When array are referenced +$array2 = &$array1; +echo "\n-- Testing array_intersect_uassoc() function when \$array2 is referencd to \$array1 --\n"; +var_dump( array_intersect_uassoc($array1, $array2, "strcasecmp") ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_uassoc() : usage variation *** + +-- Testing array_intersect_uassoc() function with referenced variable $ref_var has value 'a' -- +array(1) { + [0]=> + string(1) "a" +} + +-- Testing array_intersect_uassoc() function with referenced variable $ref_var value changed to 10 -- +array(0) { +} + +-- Testing array_intersect_uassoc() function when $array2 is referencd to $array1 -- +array(2) { + [0]=> + string(1) "a" + [1]=> + string(1) "a" +} +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt new file mode 100644 index 0000000..64f58a6 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test array_intersect_uassoc() function : usage variation - Passing non-existing function name to callback +--FILE-- + "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); + +//function name within double quotes +var_dump( array_intersect_uassoc($array1, $array2, "unknown_function") ); + +//function name within single quotes +var_dump( array_intersect_uassoc($array1, $array2, 'unknown_function') ); + +//function name without quotes +var_dump( array_intersect_uassoc($array1, $array2, unknown_function) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_uassoc() : usage variation *** + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d +NULL + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d +NULL + +Notice: Use of undefined constant unknown_function - assumed 'unknown_function' in %s on line %d + +Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_ukey_basic.phpt b/ext/standard/tests/array/array_intersect_ukey_basic.phpt new file mode 100644 index 0000000..db21b9b --- /dev/null +++ b/ext/standard/tests/array/array_intersect_ukey_basic.phpt @@ -0,0 +1,24 @@ +--TEST-- +array_intersect_ukey(): Basic test. +--FILE-- + $key2) return 1; + else return -1; +} +$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +var_dump(array_intersect_ukey($array1, $array2, 'key_compare_func')); +?> +--EXPECT-- +array(2) { + ["blue"]=> + int(1) + ["green"]=> + int(3) +} diff --git a/ext/standard/tests/array/array_intersect_ukey_error.phpt b/ext/standard/tests/array/array_intersect_ukey_error.phpt new file mode 100644 index 0000000..bb052fb --- /dev/null +++ b/ext/standard/tests/array/array_intersect_ukey_error.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test array_intersect_ukey() function : error conditions +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); + +//Call back function +function key_compare_func($key1, $key2) +{ + if ($key1 == $key2) + return 0; + else + return ($key1 > $key2)? 1:-1; +} + +//Test array_intersect_ukey with one more than the expected number of arguments +echo "\n-- Testing array_intersect_ukey() function with more than expected no. of arguments --\n"; +$extra_arg = 10; +var_dump( array_intersect_ukey($array1, $array2, 'key_compare_func',$extra_arg) ); + +// Testing array_intersect_ukey with one less than the expected number of arguments +echo "\n-- Testing array_intersect_ukey() function with less than expected no. of arguments --\n"; +var_dump( array_intersect_ukey($array1, $array2) ); + +// Testing array_intersect_ukey with no arguments +echo "\n-- Testing array_intersect_ukey() function with no arguments --\n"; +var_dump( array_intersect_ukey() ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_ukey() : error conditions *** + +-- Testing array_intersect_ukey() function with more than expected no. of arguments -- + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Testing array_intersect_ukey() function with less than expected no. of arguments -- + +Warning: array_intersect_ukey(): at least 3 parameters are required, 2 given in %s on line %d +NULL + +-- Testing array_intersect_ukey() function with no arguments -- + +Warning: array_intersect_ukey(): at least 3 parameters are required, 0 given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_ukey_variation1.phpt b/ext/standard/tests/array/array_intersect_ukey_variation1.phpt new file mode 100644 index 0000000..7012057 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_ukey_variation1.phpt @@ -0,0 +1,320 @@ +--TEST-- +Test array_intersect_ukey() function : usage variation - Passing unexpected values to first argument +--FILE-- + 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array3 = array('green' => 5, 'cyan' => 8); + +//Call back function +function key_compare_func($key1, $key2) +{ + if ($key1 == $key2) + return 0; + else + return ($key1 > $key2)? 1:-1; +} + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource var' => $fp, +); + +// loop through each element of the array for arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_intersect_ukey($value, $array2, 'key_compare_func') ); + var_dump( array_intersect_ukey($value, $array2, $array3, 'key_compare_func') ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_ukey() : usage variation *** + +--int 0-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +--resource var-- + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #1 is not an array in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_ukey_variation10.phpt b/ext/standard/tests/array/array_intersect_ukey_variation10.phpt new file mode 100644 index 0000000..69a6500 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_ukey_variation10.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test array_intersect_ukey() function : usage variation - Passing class without string to callback (Handling fatal error) +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array3 = array("a"=>"green", "cyan"); + +// Define error handler +function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { + if (error_reporting() != 0) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } +} +set_error_handler('test_error_handler'); + + +class classWithoutToString +{ +} + +$value = new classWithoutToString(); + +var_dump( array_intersect_ukey($array1, $array2, $value) ); +var_dump( array_intersect_ukey($array1, $array2, $array3, $value) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_uassoc() : usage variation *** +Error: 2 - array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given, %s(%d) +NULL +Error: 2 - array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given, %s(%d) +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt new file mode 100644 index 0000000..b7a1b07 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt @@ -0,0 +1,320 @@ +--TEST-- +Test array_intersect_ukey() function : usage variation - Passing unexpected values to second argument +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array3 = array('green' => 5, 'cyan' => 8); + +//Call back function +function key_compare_func($key1, $key2) +{ + if ($key1 == $key2) + return 0; + else + return ($key1 > $key2)? 1:-1; +} + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource var' => $fp, +); + +// loop through each element of the array for arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_intersect_ukey($array1, $value, 'key_compare_func') ); + var_dump( array_intersect_ukey($array1, $value, $array3, 'key_compare_func') ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_ukey() : usage variation *** + +--int 0-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +--resource var-- + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #2 is not an array in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_ukey_variation3.phpt b/ext/standard/tests/array/array_intersect_ukey_variation3.phpt new file mode 100644 index 0000000..1236bcd --- /dev/null +++ b/ext/standard/tests/array/array_intersect_ukey_variation3.phpt @@ -0,0 +1,290 @@ +--TEST-- +Test array_intersect_ukey() function : usage variation - Passing unexpected values to callback argument +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array3 = array('green' => 5, 'cyan' => 8); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// add arrays +$index_array = array (1, 2, 3); +$assoc_array = array ('one' => 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource var' => $fp, +); + +// loop through each element of the array for key_compare_func +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_intersect_ukey($array1, $array2, $value) ); + var_dump( array_intersect_ukey($array1, $array2, $array3, $value) ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_ukey() : usage variation *** + +--int 0-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--int 1-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--int 12345-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--int -12345-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float 10.5-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float -10.5-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--float .5-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--empty array-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +--int indexed array-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +--associative array-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL + +--nested arrays-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--lowercase null-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--lowercase true-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--lowercase false-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--undefined var-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--unset var-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL + +--resource var-- + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_ukey_variation4.phpt b/ext/standard/tests/array/array_intersect_ukey_variation4.phpt new file mode 100644 index 0000000..88eff1e --- /dev/null +++ b/ext/standard/tests/array/array_intersect_ukey_variation4.phpt @@ -0,0 +1,321 @@ +--TEST-- +Test array_intersect_ukey() function : usage variation - Passing unexpected values to optional third argument +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array4 = array('green' => 5, 'cyan' => 8); + +//Call back function +function key_compare_func($key1, $key2) +{ + if ($key1 == $key2) + return 0; + else + return ($key1 > $key2)? 1:-1; +} + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource var' => $fp, +); + +// loop through each element of the array for arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_intersect_ukey($array1, $array2, $value, 'key_compare_func') ); + var_dump( array_intersect_ukey($array1, $array2, $value, $array4, 'key_compare_func') ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_ukey() : usage variation *** + +--int 0-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +--resource var-- + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL + +Warning: array_intersect_ukey(): Argument #3 is not an array in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_ukey_variation5.phpt b/ext/standard/tests/array/array_intersect_ukey_variation5.phpt new file mode 100644 index 0000000..c1520fb --- /dev/null +++ b/ext/standard/tests/array/array_intersect_ukey_variation5.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test array_intersect_ukey() function : usage variation - Intersection of integers with floats and strings. +--FILE-- + 1.00, 1.00 => 2.00, 2.00 => 3.00); +$arr_string = array('0' => '1', '1' => '2', '2' => '3'); +$arr_string_float = array('0.00' => '1.00', '1.00' => '2.00'); + +//Call back function +function key_compare_func($key1, $key2) +{ + if ($key1 == $key2) + return 0; + else + return ($key1 > $key2)? 1:-1; +} + +echo "\n-- Result of integers and floating point intersection --\n"; +var_dump( array_intersect_ukey($arr_default_int, $arr_float, "key_compare_func") ); + +echo "\n-- Result of integers and strings containing integers intersection --\n"; +var_dump( array_intersect_ukey($arr_default_int, $arr_string, "key_compare_func") ); + +echo "\n-- Result of integers and strings containing floating points intersection --\n"; +var_dump( array_intersect_ukey($arr_default_int, $arr_string_float, "key_compare_func") ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_ukey() : usage variation *** + +-- Result of integers and floating point intersection -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + +-- Result of integers and strings containing integers intersection -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + +-- Result of integers and strings containing floating points intersection -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_ukey_variation6.phpt b/ext/standard/tests/array/array_intersect_ukey_variation6.phpt new file mode 100644 index 0000000..a918660 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_ukey_variation6.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test array_intersect_ukey() function : usage variation - Intersection of floating points with strings. +--FILE-- + 1.00, 1.00 => 2.00); +$arr_string = array('0' => '1', '1' => '2', '2' => '3'); +$arr_string_float = array('0.00' => '1.00', '1.00' => '2.00'); + +//Call back function +function key_compare_func($key1, $key2) +{ + if ($key1 == $key2) + return 0; + else + return ($key1 > $key2)? 1:-1; +} + +echo "\n-- Result of floating points and strings containing integers intersection --\n"; +var_dump( array_intersect_ukey($arr_float, $arr_string, 'key_compare_func') ); + +echo "\n-- Result of floating points and strings containing floating point intersection --\n"; +var_dump( array_intersect_ukey($arr_float, $arr_string_float, 'key_compare_func') ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_ukey() : usage variation *** + +-- Result of floating points and strings containing integers intersection -- +array(2) { + [0]=> + float(1) + [1]=> + float(2) +} + +-- Result of floating points and strings containing floating point intersection -- +array(2) { + [0]=> + float(1) + [1]=> + float(2) +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_ukey_variation7.phpt b/ext/standard/tests/array/array_intersect_ukey_variation7.phpt new file mode 100644 index 0000000..75b601c --- /dev/null +++ b/ext/standard/tests/array/array_intersect_ukey_variation7.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test array_intersect_ukey() function : usage variation - Intersection of strings containing integer and float +--FILE-- + '1', '1' => '2'); +$arr2_string_int = array('0' => '1', '1' => '3'); +$arr1_string_float = array('0.00' => '1.00', '1.00' => '2.00'); +$arr2_string_float = array('0.00' => '1.00', '1.00' => '3.00'); + +//Call back function +function key_compare_func($key1, $key2) +{ + if ($key1 == $key2) + return 0; + else + return ($key1 > $key2)? 1:-1; +} + +echo "\n-- Result of strings containing integers intersection --\n"; +var_dump( array_intersect_ukey($arr1_string_int, $arr2_string_int, 'key_compare_func') ); + +echo "\n-- Result of strings containing floating points intersection --\n"; +var_dump( array_intersect_ukey($arr1_string_float, $arr2_string_float, 'key_compare_func') ); + +echo "\n-- Result of strings containing integers and strings containing floating points intersection --\n"; +var_dump( array_intersect_ukey($arr1_string_int, $arr2_string_float, 'key_compare_func') ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_ukey() : usage variation *** + +-- Result of strings containing integers intersection -- +array(2) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" +} + +-- Result of strings containing floating points intersection -- +array(2) { + ["0.00"]=> + string(4) "1.00" + ["1.00"]=> + string(4) "2.00" +} + +-- Result of strings containing integers and strings containing floating points intersection -- +array(2) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt new file mode 100644 index 0000000..3d580e1 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test array_intersect_ukey() function : usage variation - Passing non-existing function name to callback +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); + +//function name within double quotes +var_dump( array_intersect_ukey($array1, $array2, "unknown_function") ); + +//function name within single quotes +var_dump( array_intersect_ukey($array1, $array2, 'unknown_function') ); + +//function name without quotes +var_dump( array_intersect_ukey($array1, $array2, unknown_function) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_ukey() : usage variation *** + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d +NULL + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d +NULL + +Notice: Use of undefined constant unknown_function - assumed 'unknown_function' in %s on line %d + +Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_ukey_variation9.phpt b/ext/standard/tests/array/array_intersect_ukey_variation9.phpt new file mode 100644 index 0000000..fe130a8 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_ukey_variation9.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test array_intersect_ukey() function : usage variation - Passing class/object methods to callback +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); + +class MyClass +{ + static function static_compare_func($key1, $key2) { + return strcasecmp($key1, $key2); + } + + public function class_compare_func($key1, $key2) { + return strcasecmp($key1, $key2); + } + +} + +echo "\n-- Testing array_intersect_ukey() function using class with static method as callback --\n"; +var_dump( array_intersect_ukey($array1, $array2, array('MyClass','static_compare_func')) ); +var_dump( array_intersect_ukey($array1, $array2, 'MyClass::static_compare_func') ); + +echo "\n-- Testing array_intersect_uassoc() function using class with regular method as callback --\n"; +$obj = new MyClass(); +var_dump( array_intersect_ukey($array1, $array2, array($obj,'class_compare_func')) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_ukey() : usage variation *** + +-- Testing array_intersect_ukey() function using class with static method as callback -- +array(2) { + ["blue"]=> + int(1) + ["green"]=> + int(3) +} +array(2) { + ["blue"]=> + int(1) + ["green"]=> + int(3) +} + +-- Testing array_intersect_uassoc() function using class with regular method as callback -- +array(2) { + ["blue"]=> + int(1) + ["green"]=> + int(3) +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_variation1.phpt b/ext/standard/tests/array/array_intersect_variation1.phpt new file mode 100644 index 0000000..ca203ff --- /dev/null +++ b/ext/standard/tests/array/array_intersect_variation1.phpt @@ -0,0 +1,280 @@ +--TEST-- +Test array_intersect() function : usage variations - unexpected values for 'arr1' argument +--FILE-- + 1, "two" => 2); + +// get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a class +class classA +{ + public function __toString() { + return "Class A object"; + } +} + +// heredoc string +$heredoc = << +--EXPECTF-- +*** Testing array_intersect() : Passing non-array values to $arr1 argument *** + +-- Iterator 1 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 2 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 3 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 4 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 5 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 6 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 7 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 8 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 9 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 10 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 11 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 12 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 13 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 14 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 15 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 16 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 17 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 18 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 19 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 20 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 21 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 22 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 23 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +-- Iterator 24 -- +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #1 is not an array in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_intersect_variation10.phpt b/ext/standard/tests/array/array_intersect_variation10.phpt new file mode 100644 index 0000000..e193f97 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_variation10.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test array_intersect() function : usage variations - binary safe checking +--FILE-- + +--EXPECTF-- +*** Testing array_intersect() : binary safe checking *** +array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" +} +array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" +} +array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" +} +Done diff --git a/ext/standard/tests/array/array_intersect_variation2.phpt b/ext/standard/tests/array/array_intersect_variation2.phpt new file mode 100644 index 0000000..b690fc9 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_variation2.phpt @@ -0,0 +1,281 @@ +--TEST-- +Test array_intersect() function : usage variations - unexpected values for 'arr2' argument +--FILE-- + 1, "two" => 2); + +// get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a class +class classA +{ + public function __toString() { + return "Class A object"; + } +} + +// heredoc string +$heredoc = << +--EXPECTF-- +*** Testing array_intersect() : Passing non-array values to $arr2 argument *** + +-- Iterator 1 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 2 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 3 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 4 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 5 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 6 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 7 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 8 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 9 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 10 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 11 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 12 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 13 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 14 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 15 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 16 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 17 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 18 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 19 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 20 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 21 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 22 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 23 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +-- Iterator 24 -- +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_intersect(): Argument #2 is not an array in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_intersect_variation3.phpt b/ext/standard/tests/array/array_intersect_variation3.phpt new file mode 100644 index 0000000..b2b7d8a --- /dev/null +++ b/ext/standard/tests/array/array_intersect_variation3.phpt @@ -0,0 +1,342 @@ +--TEST-- +Test array_intersect() function : usage variations - different arrays for 'arr1' argument +--FILE-- +22 +'single quoted string' +"double quoted string" +2222 != 1111.\t 0000 = 0000\n +EOT; + +// arrays to be passed to $arr1 argument +$arrays = array ( +/*1*/ array(1, 2), // array with default keys and numeric values + array(1.1, 2.2), // array with default keys & float values + array(false,true), // array with default keys and boolean values + array(), // empty array +/*5*/ array(NULL), // array with NULL + array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // array with double quoted strings + array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // array with single quoted strings + array($blank_line, $multiline_string, $diff_whitespaces, $numeric_string), // array with heredocs + + // associative arrays +/*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values + array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values + array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values + array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value + array("one" => 1, 2 => "two", 4 => "four"), //mixed + + // associative array, containing null/empty/boolean values as key/value +/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), + array(true => "true", false => "false", "false" => false, "true" => true), + array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), + array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), + array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + + // array with repetative keys +/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) +); + + +// array to be passsed to $arr2 argument +$arr2 = array ( + 1, 1.1, "hello", "one", NULL, 2, + 'world', true, false, false => 5, 'aaaa\r', "aaaa\r", + $numeric_string, $diff_whitespaces, + "one" => "ten", 4 => "four", "two" => 2, 2 => "two", + '', null => "null", '' => 'emptys' +); + +// loop through each sub-array within $arrrays to check the behavior of array_intersect() +$iterator = 1; +foreach($arrays as $arr1) { + echo "-- Iterator $iterator --\n"; + + // Calling array_intersect() with default arguments + var_dump( array_intersect($arr1, $arr2) ); + + // Calling array_intersect() with more arguments. + // additional argument passed is the same as $arr1 argument + var_dump( array_intersect($arr1, $arr2, $arr1) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect() : Passing different types of arrays to $arr1 argument *** +-- Iterator 1 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- Iterator 2 -- +array(1) { + [0]=> + float(1.1) +} +array(1) { + [0]=> + float(1.1) +} +-- Iterator 3 -- +array(2) { + [0]=> + bool(false) + [1]=> + bool(true) +} +array(2) { + [0]=> + bool(false) + [1]=> + bool(true) +} +-- Iterator 4 -- +array(0) { +} +array(0) { +} +-- Iterator 5 -- +array(1) { + [0]=> + NULL +} +array(1) { + [0]=> + NULL +} +-- Iterator 6 -- +array(1) { + [1]=> + string(5) "aaaa " +} +array(1) { + [1]=> + string(5) "aaaa " +} +-- Iterator 7 -- +array(1) { + [1]=> + string(6) "aaaa\r" +} +array(1) { + [1]=> + string(6) "aaaa\r" +} +-- Iterator 8 -- +array(2) { + [2]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" + [3]=> + string(90) "11 < 12. 123 >22 +'single quoted string' +"double quoted string" +2222 != 1111. 0000 = 0000 +" +} +array(2) { + [2]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" + [3]=> + string(90) "11 < 12. 123 >22 +'single quoted string' +"double quoted string" +2222 != 1111. 0000 = 0000 +" +} +-- Iterator 9 -- +array(2) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" +} +array(2) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" +} +-- Iterator 10 -- +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +-- Iterator 11 -- +array(0) { +} +array(0) { +} +-- Iterator 12 -- +array(1) { + ["one"]=> + string(3) "ten" +} +array(1) { + ["one"]=> + string(3) "ten" +} +-- Iterator 13 -- +array(3) { + ["one"]=> + int(1) + [2]=> + string(3) "two" + [4]=> + string(4) "four" +} +array(3) { + ["one"]=> + int(1) + [2]=> + string(3) "two" + [4]=> + string(4) "four" +} +-- Iterator 14 -- +array(2) { + ["NULL"]=> + NULL + ["null"]=> + NULL +} +array(2) { + ["NULL"]=> + NULL + ["null"]=> + NULL +} +-- Iterator 15 -- +array(2) { + ["false"]=> + bool(false) + ["true"]=> + bool(true) +} +array(2) { + ["false"]=> + bool(false) + ["true"]=> + bool(true) +} +-- Iterator 16 -- +array(3) { + [""]=> + string(6) "emptys" + ["emptyd"]=> + string(0) "" + ["emptys"]=> + string(0) "" +} +array(3) { + [""]=> + string(6) "emptys" + ["emptyd"]=> + string(0) "" + ["emptys"]=> + string(0) "" +} +-- Iterator 17 -- +array(6) { + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + NULL + [4]=> + NULL + [5]=> + bool(false) + [6]=> + bool(true) +} +array(6) { + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + NULL + [4]=> + NULL + [5]=> + bool(false) + [6]=> + bool(true) +} +-- Iterator 18 -- +array(1) { + [0]=> + int(5) +} +array(1) { + [0]=> + int(5) +} +-- Iterator 19 -- +array(0) { +} +array(0) { +} +Done diff --git a/ext/standard/tests/array/array_intersect_variation4.phpt b/ext/standard/tests/array/array_intersect_variation4.phpt new file mode 100644 index 0000000..4f1d6f3 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_variation4.phpt @@ -0,0 +1,349 @@ +--TEST-- +Test array_intersect() function : usage variations - different arrays for 'arr2' argument +--FILE-- +22 +'single quoted string' +"double quoted string" +2222 != 1111.\t 0000 = 0000\n +EOT; + +// array to be passsed to $arr1 argument +$arr1 = array ( + 1, 1.1, "hello", "one", NULL, 2, + 'world', true, false, false => 5, 'aaaa\r', "aaaa\r", + $numeric_string, $diff_whitespaces, + "one" => "ten", 4 => "four", "two" => 2, 2 => "two", + '', null => "null", '' => 'emptys' +); + +// arrays to be passed to $arr2 argument +$arrays = array ( +/*1*/ array(1, 2), // array with default keys and numeric values + array(1.1, 2.2), // array with default keys & float values + array(false,true), // array with default keys and boolean values + array(), // empty array +/*5*/ array(NULL), // array with NULL + array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // array with double quoted strings + array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // array with single quoted strings + array($blank_line, $multiline_string, $diff_whitespaces, $numeric_string), // array with heredocs + + // associative arrays +/*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values + array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values + array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values + array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value + array("one" => 1, 2 => "two", 4 => "four"), //mixed + + // associative array, containing null/empty/boolean values as key/value +/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), + array(true => "true", false => "false", "false" => false, "true" => true), + array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), + array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), + array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + + // array with repetative keys +/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) +); + +// loop through each sub-array within $arrrays to check the behavior of array_intersect() +$iterator = 1; +foreach($arrays as $arr2) { + echo "-- Iteration $iterator --\n"; + + // Calling array_intersect() with default arguments + var_dump( array_intersect($arr1, $arr2) ); + + // Calling array_intersect() with more arguments + // additional argument passed is the same as $arr1 argument + var_dump( array_intersect($arr1, $arr2, $arr1) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect() : Passing different types of arrays to $arr2 argument *** +-- Iteration 1 -- +array(3) { + [5]=> + int(2) + [7]=> + bool(true) + ["two"]=> + int(2) +} +array(3) { + [5]=> + int(2) + [7]=> + bool(true) + ["two"]=> + int(2) +} +-- Iteration 2 -- +array(1) { + [1]=> + float(1.1) +} +array(1) { + [1]=> + float(1.1) +} +-- Iteration 3 -- +array(3) { + [7]=> + bool(true) + [8]=> + bool(false) + [13]=> + string(0) "" +} +array(3) { + [7]=> + bool(true) + [8]=> + bool(false) + [13]=> + string(0) "" +} +-- Iteration 4 -- +array(0) { +} +array(0) { +} +-- Iteration 5 -- +array(2) { + [8]=> + bool(false) + [13]=> + string(0) "" +} +array(2) { + [8]=> + bool(false) + [13]=> + string(0) "" +} +-- Iteration 6 -- +array(1) { + [10]=> + string(5) "aaaa " +} +array(1) { + [10]=> + string(5) "aaaa " +} +-- Iteration 7 -- +array(1) { + [9]=> + string(6) "aaaa\r" +} +array(1) { + [9]=> + string(6) "aaaa\r" +} +-- Iteration 8 -- +array(2) { + [11]=> + string(90) "11 < 12. 123 >22 +'single quoted string' +"double quoted string" +2222 != 1111. 0000 = 0000 +" + [12]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" +} +array(2) { + [11]=> + string(90) "11 < 12. 123 >22 +'single quoted string' +"double quoted string" +2222 != 1111. 0000 = 0000 +" + [12]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" +} +-- Iteration 9 -- +array(2) { + [2]=> + string(3) "two" + [3]=> + string(3) "one" +} +array(2) { + [2]=> + string(3) "two" + [3]=> + string(3) "one" +} +-- Iteration 10 -- +array(3) { + [5]=> + int(2) + [7]=> + bool(true) + ["two"]=> + int(2) +} +array(3) { + [5]=> + int(2) + [7]=> + bool(true) + ["two"]=> + int(2) +} +-- Iteration 11 -- +array(0) { +} +array(0) { +} +-- Iteration 12 -- +array(1) { + ["one"]=> + string(3) "ten" +} +array(1) { + ["one"]=> + string(3) "ten" +} +-- Iteration 13 -- +array(3) { + [2]=> + string(3) "two" + [4]=> + string(4) "four" + [7]=> + bool(true) +} +array(3) { + [2]=> + string(3) "two" + [4]=> + string(4) "four" + [7]=> + bool(true) +} +-- Iteration 14 -- +array(2) { + [8]=> + bool(false) + [13]=> + string(0) "" +} +array(2) { + [8]=> + bool(false) + [13]=> + string(0) "" +} +-- Iteration 15 -- +array(3) { + [7]=> + bool(true) + [8]=> + bool(false) + [13]=> + string(0) "" +} +array(3) { + [7]=> + bool(true) + [8]=> + bool(false) + [13]=> + string(0) "" +} +-- Iteration 16 -- +array(3) { + [8]=> + bool(false) + [13]=> + string(0) "" + [""]=> + string(6) "emptys" +} +array(3) { + [8]=> + bool(false) + [13]=> + string(0) "" + [""]=> + string(6) "emptys" +} +-- Iteration 17 -- +array(3) { + [7]=> + bool(true) + [8]=> + bool(false) + [13]=> + string(0) "" +} +array(3) { + [7]=> + bool(true) + [8]=> + bool(false) + [13]=> + string(0) "" +} +-- Iteration 18 -- +array(1) { + [0]=> + int(5) +} +array(1) { + [0]=> + int(5) +} +-- Iteration 19 -- +array(0) { +} +array(0) { +} +Done diff --git a/ext/standard/tests/array/array_intersect_variation5.phpt b/ext/standard/tests/array/array_intersect_variation5.phpt new file mode 100644 index 0000000..9aaedeb --- /dev/null +++ b/ext/standard/tests/array/array_intersect_variation5.phpt @@ -0,0 +1,192 @@ +--TEST-- +Test array_intersect() function : usage variations - assoc array with diff keys for 'arr1' argument +--FILE-- + "0"), + array(1 => "1"), + array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), + + // arrays with float keys +/*5*/ array(2.3333 => "float"), + array(1.2 => "f1", 3.33 => "f2", + 4.89999922839999 => "f3", + 33333333.333333 => "f4"), + + // arrays with string keys +/*7*/ array('\tHello' => 111, 're\td' => "color", + '\v\fworld' => 2.2, 'pen\n' => 33), + array("\tHello" => 111, "re\td" => "color", + "\v\fworld" => 2.2, "pen\n" => 33), + array("hello", $heredoc => "string"), // heredoc + + // array with unset variable +/*10*/ array( @$unset_var => "hello"), + + // array with mixed keys +/*11*/ array('hello' => 1, "fruit" => 2.2, + 133 => "int", 444.432 => "float", + @$unset_var => "unset", $heredoc => "heredoc") +); + +// array to be passsed to $arr2 argument +$arr2 = array(1, "float", "f4", "hello", 2.2, 'color', "string", "pen\n", 11); + +// loop through each sub-array within $arrrays to check the behavior of array_intersect() +$iterator = 1; +foreach($arrays as $arr1) { + echo "-- Iterator $iterator --\n"; + + // Calling array_intersect() with default arguments + var_dump( array_intersect($arr1, $arr2) ); + + // Calling array_intersect() with more arguments. + // additional argument passed is the same as $arr1 argument + var_dump( array_intersect($arr1, $arr2, $arr1) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect() : assoc array with diff keys to $arr1 argument *** +-- Iterator 1 -- +array(0) { +} +array(0) { +} +-- Iterator 2 -- +array(0) { +} +array(0) { +} +-- Iterator 3 -- +array(1) { + [1]=> + string(1) "1" +} +array(1) { + [1]=> + string(1) "1" +} +-- Iterator 4 -- +array(1) { + [1]=> + string(1) "1" +} +array(1) { + [1]=> + string(1) "1" +} +-- Iterator 5 -- +array(1) { + [2]=> + string(5) "float" +} +array(1) { + [2]=> + string(5) "float" +} +-- Iterator 6 -- +array(1) { + [33333333]=> + string(2) "f4" +} +array(1) { + [33333333]=> + string(2) "f4" +} +-- Iterator 7 -- +array(2) { + ["re\td"]=> + string(5) "color" + ["\v\fworld"]=> + float(2.2) +} +array(2) { + ["re\td"]=> + string(5) "color" + ["\v\fworld"]=> + float(2.2) +} +-- Iterator 8 -- +array(2) { + ["re d"]=> + string(5) "color" + [" world"]=> + float(2.2) +} +array(2) { + ["re d"]=> + string(5) "color" + [" world"]=> + float(2.2) +} +-- Iterator 9 -- +array(2) { + [0]=> + string(5) "hello" + ["Hello world"]=> + string(6) "string" +} +array(2) { + [0]=> + string(5) "hello" + ["Hello world"]=> + string(6) "string" +} +-- Iterator 10 -- +array(1) { + [""]=> + string(5) "hello" +} +array(1) { + [""]=> + string(5) "hello" +} +-- Iterator 11 -- +array(3) { + ["hello"]=> + int(1) + ["fruit"]=> + float(2.2) + [444]=> + string(5) "float" +} +array(3) { + ["hello"]=> + int(1) + ["fruit"]=> + float(2.2) + [444]=> + string(5) "float" +} +Done diff --git a/ext/standard/tests/array/array_intersect_variation6.phpt b/ext/standard/tests/array/array_intersect_variation6.phpt new file mode 100644 index 0000000..48d01f7 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_variation6.phpt @@ -0,0 +1,192 @@ +--TEST-- +Test array_intersect() function : usage variations - assoc array with diff keys for 'arr2' argument +--FILE-- + "0"), + array(1 => "1"), + array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), + + // arrays with float keys +/*5*/ array(2.3333 => "float"), + array(1.2 => "f1", 3.33 => "f2", + 4.89999922839999 => "f3", + 33333333.333333 => "f4"), + + // arrays with string keys +/*7*/ array('\tHello' => 111, 're\td' => "color", + '\v\fworld' => 2.2, 'pen\n' => 33), + array("\tHello" => 111, "re\td" => "color", + "\v\fworld" => 2.2, "pen\n" => 33), + array("hello", $heredoc => "string"), // heredoc + + // array with unset variable +/*10*/ array( @$unset_var => "hello"), + + // array with mixed keys +/*11*/ array('hello' => 1, "fruit" => 2.2, + 133 => "int", 444.432 => "float", + @$unset_var => "unset", $heredoc => "heredoc") +); + +// array to be passsed to $arr1 argument +$arr1 = array(1, "float", "f4", "hello", 2.2, 'color', "string", "pen\n", 11); + +// loop through each sub-array within $arrrays to check the behavior of array_intersect() +$iterator = 1; +foreach($arrays as $arr2) { + echo "-- Iterator $iterator --\n"; + + // Calling array_intersect() with default arguments + var_dump( array_intersect($arr1, $arr2) ); + + // Calling array_intersect() with more arguments. + // additional argument passed is the same as $arr1 argument + var_dump( array_intersect($arr1, $arr2, $arr1) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect() : assoc array with diff keys to $arr2 argument *** +-- Iterator 1 -- +array(0) { +} +array(0) { +} +-- Iterator 2 -- +array(0) { +} +array(0) { +} +-- Iterator 3 -- +array(1) { + [0]=> + int(1) +} +array(1) { + [0]=> + int(1) +} +-- Iterator 4 -- +array(1) { + [0]=> + int(1) +} +array(1) { + [0]=> + int(1) +} +-- Iterator 5 -- +array(1) { + [1]=> + string(5) "float" +} +array(1) { + [1]=> + string(5) "float" +} +-- Iterator 6 -- +array(1) { + [2]=> + string(2) "f4" +} +array(1) { + [2]=> + string(2) "f4" +} +-- Iterator 7 -- +array(2) { + [4]=> + float(2.2) + [5]=> + string(5) "color" +} +array(2) { + [4]=> + float(2.2) + [5]=> + string(5) "color" +} +-- Iterator 8 -- +array(2) { + [4]=> + float(2.2) + [5]=> + string(5) "color" +} +array(2) { + [4]=> + float(2.2) + [5]=> + string(5) "color" +} +-- Iterator 9 -- +array(2) { + [3]=> + string(5) "hello" + [6]=> + string(6) "string" +} +array(2) { + [3]=> + string(5) "hello" + [6]=> + string(6) "string" +} +-- Iterator 10 -- +array(1) { + [3]=> + string(5) "hello" +} +array(1) { + [3]=> + string(5) "hello" +} +-- Iterator 11 -- +array(3) { + [0]=> + int(1) + [1]=> + string(5) "float" + [4]=> + float(2.2) +} +array(3) { + [0]=> + int(1) + [1]=> + string(5) "float" + [4]=> + float(2.2) +} +Done diff --git a/ext/standard/tests/array/array_intersect_variation7.phpt b/ext/standard/tests/array/array_intersect_variation7.phpt new file mode 100644 index 0000000..da1088c --- /dev/null +++ b/ext/standard/tests/array/array_intersect_variation7.phpt @@ -0,0 +1,211 @@ +--TEST-- +Test array_intersect() function : usage variations - assoc array with diff values for 'arr1' argument +--FILE-- + 0), + array("1" => 1), + array("one" => 1, 'two' => 2, "three" => 3, 4 => 4), + + // arrays with float values +/*5*/ array("float" => 2.3333), + array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333333), + + // arrays with string values +/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), + array(1 => "hello", "heredoc" => $heredoc), + + // array with object, unset variable and resource variable +/*10*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp), + + // array with mixed values +/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit", + 'resource' => $fp, "int" => 133, "float" => 444.432, + "unset" => @$unset_var, "heredoc" => $heredoc) +); + +// array to be passsed to $arr2 argument +$arr2 = array(1, 2, 1.2, 2.3333, "col\tor", '\v\fworld', $fp, + "Hello world", $heredoc, new classA(), 444.432, "fruit"); + +// loop through each sub-array within $arrrays to check the behavior of array_intersect() +$iterator = 1; +foreach($arrays as $arr1) { + echo "-- Iterator $iterator --\n"; + + // Calling array_intersect() with default arguments + var_dump( array_intersect($arr1, $arr2) ); + + // Calling array_intersect() with more arguments. + // additional argument passed is the same as $arr1 argument + var_dump( array_intersect($arr1, $arr2, $arr1) ); + $iterator++; +} + +// close the file resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect() : assoc array with diff values to $arr1 argument *** +-- Iterator 1 -- +array(0) { +} +array(0) { +} +-- Iterator 2 -- +array(0) { +} +array(0) { +} +-- Iterator 3 -- +array(1) { + [1]=> + int(1) +} +array(1) { + [1]=> + int(1) +} +-- Iterator 4 -- +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +-- Iterator 5 -- +array(1) { + ["float"]=> + float(2.3333) +} +array(1) { + ["float"]=> + float(2.3333) +} +-- Iterator 6 -- +array(1) { + ["f1"]=> + float(1.2) +} +array(1) { + ["f1"]=> + float(1.2) +} +-- Iterator 7 -- +array(1) { + ["red"]=> + string(6) "col or" +} +array(1) { + ["red"]=> + string(6) "col or" +} +-- Iterator 8 -- +array(1) { + [2]=> + string(9) "\v\fworld" +} +array(1) { + [2]=> + string(9) "\v\fworld" +} +-- Iterator 9 -- +array(1) { + ["heredoc"]=> + string(11) "Hello world" +} +array(1) { + ["heredoc"]=> + string(11) "Hello world" +} +-- Iterator 10 -- +array(2) { + [11]=> + object(classA)#%d (0) { + } + ["resource"]=> + resource(%d) of type (stream) +} +array(2) { + [11]=> + object(classA)#%d (0) { + } + ["resource"]=> + resource(%d) of type (stream) +} +-- Iterator 11 -- +array(5) { + [2]=> + object(classA)#%d (0) { + } + [222]=> + string(5) "fruit" + ["resource"]=> + resource(%d) of type (stream) + ["float"]=> + float(444.432) + ["heredoc"]=> + string(11) "Hello world" +} +array(5) { + [2]=> + object(classA)#%d (0) { + } + [222]=> + string(5) "fruit" + ["resource"]=> + resource(%d) of type (stream) + ["float"]=> + float(444.432) + ["heredoc"]=> + string(11) "Hello world" +} +Done diff --git a/ext/standard/tests/array/array_intersect_variation8.phpt b/ext/standard/tests/array/array_intersect_variation8.phpt new file mode 100644 index 0000000..91eae49 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_variation8.phpt @@ -0,0 +1,219 @@ +--TEST-- +Test array_intersect() function : usage variations - assoc array with diff values for 'arr2' argument +--FILE-- + 0), + array("1" => 1), + array("one" => 1, 'two' => 2, "three" => 3, 4 => 4), + + // arrays with float values +/*5*/ array("float" => 2.3333), + array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333333), + + // arrays with string values +/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), + array(1 => "hello", "heredoc" => $heredoc), + + // array with object, unset variable and resource variable +/*10*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp), + + // array with mixed values +/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit", + 'resource' => $fp, "int" => 133, "float" => 444.432, + "unset" => @$unset_var, "heredoc" => $heredoc) +); + +// array to be passsed to $arr1 argument +$arr1 = array(1, 2, 1.2, 2.3333, "col\tor", '\v\fworld', $fp, + "Hello world", $heredoc, new classA(), 444.432, "fruit"); + +// loop through each sub-array within $arrrays to check the behavior of array_intersect() +$iterator = 1; +foreach($arrays as $arr2) { + echo "-- Iterator $iterator --\n"; + + // Calling array_intersect() with default arguments + var_dump( array_intersect($arr1, $arr2) ); + + // Calling array_intersect() with more arguments. + // additional argument passed is the same as $arr1 argument + var_dump( array_intersect($arr1, $arr2, $arr1) ); + $iterator++; +} + +// close the file resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect() : assoc array with diff values to $arr2 argument *** +-- Iterator 1 -- +array(0) { +} +array(0) { +} +-- Iterator 2 -- +array(0) { +} +array(0) { +} +-- Iterator 3 -- +array(1) { + [0]=> + int(1) +} +array(1) { + [0]=> + int(1) +} +-- Iterator 4 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- Iterator 5 -- +array(1) { + [3]=> + float(2.3333) +} +array(1) { + [3]=> + float(2.3333) +} +-- Iterator 6 -- +array(1) { + [2]=> + float(1.2) +} +array(1) { + [2]=> + float(1.2) +} +-- Iterator 7 -- +array(1) { + [4]=> + string(6) "col or" +} +array(1) { + [4]=> + string(6) "col or" +} +-- Iterator 8 -- +array(1) { + [5]=> + string(9) "\v\fworld" +} +array(1) { + [5]=> + string(9) "\v\fworld" +} +-- Iterator 9 -- +array(2) { + [7]=> + string(11) "Hello world" + [8]=> + string(11) "Hello world" +} +array(2) { + [7]=> + string(11) "Hello world" + [8]=> + string(11) "Hello world" +} +-- Iterator 10 -- +array(2) { + [6]=> + resource(%d) of type (stream) + [9]=> + object(classA)#%d (0) { + } +} +array(2) { + [6]=> + resource(%d) of type (stream) + [9]=> + object(classA)#%d (0) { + } +} +-- Iterator 11 -- +array(6) { + [6]=> + resource(%d) of type (stream) + [7]=> + string(11) "Hello world" + [8]=> + string(11) "Hello world" + [9]=> + object(classA)#%d (0) { + } + [10]=> + float(444.432) + [11]=> + string(5) "fruit" +} +array(6) { + [6]=> + resource(%d) of type (stream) + [7]=> + string(11) "Hello world" + [8]=> + string(11) "Hello world" + [9]=> + object(classA)#%d (0) { + } + [10]=> + float(444.432) + [11]=> + string(5) "fruit" +} +Done diff --git a/ext/standard/tests/array/array_intersect_variation9.phpt b/ext/standard/tests/array/array_intersect_variation9.phpt new file mode 100644 index 0000000..fda63dd --- /dev/null +++ b/ext/standard/tests/array/array_intersect_variation9.phpt @@ -0,0 +1,255 @@ +--TEST-- +Test array_intersect() function : usage variations - two dimensional arrays for $arr1 and $arr2 arguments(Bug#43109) +--FILE-- + "one", 2 => "two", 3 => "three"), + array("ten" => 10, "twenty" => 20.00, "thirty" => 30) +); + +$arr2 = array ( + array(1, 2, 3, 4), + array(1 => "one", 2 => "two", 3 => "three") +); + +/* Passing the entire array as argument to $arr1 and $arr2 */ +// Calling array_intersect() with default arguments +echo "-- Passing the entire 2-D array to \$arr1 and \$arr2 --\n"; +echo "- With default arguments -\n"; +var_dump( array_intersect($arr1, $arr2) ); + +// Calling array_intersect() with more arguments +// additional argument passed is the same as $arr1 +echo "- With more arguments -\n"; +var_dump( array_intersect($arr1, $arr2, $arr1) ); + +/* Passing the sub-array as argument to $arr1 and $arr2 */ +// Calling array_intersect() with default arguments +echo "-- Passing the sub-array to \$arr1 and \$arr2 --\n"; +echo "- With default arguments -\n"; +var_dump( array_intersect($arr1[0], $arr2[0]) ); + +// Calling array_intersect() with more arguments +// additional argument passed is the same as $arr1 +echo "- With more arguments -\n"; +var_dump( array_intersect($arr1[0], $arr2[0], $arr1[0]) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_intersect() : passing two dimensional array to both $arr1 and $arr2 arguments *** +-- Passing the entire 2-D array to $arr1 and $arr2 -- +- With default arguments - + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d +array(4) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(5) "hello" + [3]=> + string(5) "world" + } + [1]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + } + [2]=> + array(3) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" + } + [3]=> + array(3) { + ["ten"]=> + int(10) + ["twenty"]=> + float(20) + ["thirty"]=> + int(30) + } +} +- With more arguments - + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d + +Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d +array(4) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(5) "hello" + [3]=> + string(5) "world" + } + [1]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + } + [2]=> + array(3) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" + } + [3]=> + array(3) { + ["ten"]=> + int(10) + ["twenty"]=> + float(20) + ["thirty"]=> + int(30) + } +} +-- Passing the sub-array to $arr1 and $arr2 -- +- With default arguments - +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +- With more arguments - +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +Done diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt new file mode 100644 index 0000000..f433e12 --- /dev/null +++ b/ext/standard/tests/array/array_key_exists.phpt @@ -0,0 +1,292 @@ +--TEST-- +Test array_key_exists() function +--FILE-- + "Jack", "Loc" => "Mars", "Id" => "MS123"), + array('Red' => 'Rose', 'I' => 'You'), + array(0 => 'Zero', 1 => 'One', 2 => 'Two', 3 => "Three" ), + array(0.1 => 'Zero', 1.1 => 'One', 2.2 => 'Two', 3.3 => "Three" ) + ); +/* keys to search in $search_arrays. $keys[0] + is the key to be searched in $search_arrays[0] and so on */ +$keys = array( 1, 'a', 2, 4, "Name", "Red", 0, 3 ); + +$key_counter = 0; +foreach ($search_arrays as $search_array) { + $key = $keys[ $key_counter++ ]; + echo "-- Iteration $key_counter --\n"; + var_dump( array_key_exists($key, $search_array) ); +} + +echo "\n*** Testing possible variations ***\n"; +// use different keys on each sub array of $search_arrays +$key_variations = array ("", NULL, null, " ", '', "test", 1); +$key_counter = 0; +$key_count = count ( $key_variations ); +echo "\n** Variation loop 1 **\n"; +$out_loop_count = 0; +foreach ($search_arrays as $search_array) { + $key_counter = 0; + $out_loop_count ++; echo "-- Iteration $out_loop_count --\n"; + while ( $key_counter < $key_count ) { + $key = $key_variations[ $key_counter++ ]; + var_dump( array_key_exists($key, $search_array) ); + } +} +// arrays with variation in elements +$search_arrays_v = array ( + array(), + array(NULL), + array(array(), 1, 2), + array(1,2,3, "" => "value", NULL => "value", true => "value" ), + array( array(2,4,5), array ("a","b","d") ) + ); +// search for $key_variations in each sub array of $search_arrays_v +echo "\n** Variation loop 2 **\n"; +$out_loop_count = 0; +foreach ($search_arrays_v as $search_array) { + $key_counter = 0; + $out_loop_count ++; echo "-- Iteration $out_loop_count --\n"; + while ( $key_counter < $key_count ) { + $key = $key_variations[ $key_counter++ ]; + var_dump( array_key_exists($key, $search_array) ); + } +} + +echo "\n*** Testing error conditions ***\n"; +//Zeor args +var_dump( array_key_exists() ); +// first args as array +var_dump( array_key_exists(array(), array()) ); +// second args as string +var_dump( array_key_exists("", "") ); +// second args a integer +var_dump( array_key_exists(1, 1) ); +// second args as NULL +var_dump( array_key_exists(1, NULL) ); +// second args as boolean +var_dump( array_key_exists(1, true) ); +// first args as boolean +var_dump( array_key_exists(false, true) ); +// second args as float +var_dump( array_key_exists(false, 17.5) ); +// args more than expected +var_dump( array_key_exists(1, array(), array()) ); +// first argument as floating point value +var_dump( array_key_exists(17.5, array(1,23) ) ) ; + +echo "\n*** Testing operation on objects ***\n"; +class key_check +{ + private $private_var = "Priviate var"; + protected $protected_var = "Protected var"; + public $public_var = "Public var"; + public $arr = array("var" => "value", "1" => "one", ""=>"value"); + public function print_member() + { + echo $this->$private_var."\n"; + echo $this->$protected_var."\n"; + echo $this->$public_var."\n"; + } +} + +$key_check_obj = new key_check; //new object +/* array_key_exists() on an object, it should work on only public member variables */ +var_dump(array_key_exists("private_var", $key_check_obj)); // not found, private member +var_dump(array_key_exists("protected_var", $key_check_obj)); // not found, private member +var_dump(array_key_exists("public_var", $key_check_obj)); // found, public member +var_dump(array_key_exists("print_member", $key_check_obj)); // not found, its a function +var_dump(array_key_exists("arr", $key_check_obj)); //found, public member +var_dump(array_key_exists("var", $key_check_obj->arr)); //found, key is in member array + +/* error condition, first arguemnt as object */ +var_dump( array_key_exists($key_check_obj, $key_check_obj) ); +echo "Done\n"; +?> +--EXPECTF-- +*** Testing basic functionalities *** +-- Iteration 1 -- +bool(true) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(true) +-- Iteration 4 -- +bool(false) +-- Iteration 5 -- +bool(true) +-- Iteration 6 -- +bool(true) +-- Iteration 7 -- +bool(true) +-- Iteration 8 -- +bool(true) + +*** Testing possible variations *** + +** Variation loop 1 ** +-- Iteration 1 -- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +-- Iteration 2 -- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +-- Iteration 3 -- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +-- Iteration 4 -- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +-- Iteration 5 -- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 6 -- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +-- Iteration 8 -- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) + +** Variation loop 2 ** +-- Iteration 1 -- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 2 -- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 3 -- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +-- Iteration 4 -- +bool(true) +bool(true) +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) +-- Iteration 5 -- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) + +*** Testing error conditions *** + +Warning: array_key_exists() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) + +Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d +NULL + +Warning: array_key_exists() expects parameter 2 to be array, integer given in %s on line %d +NULL + +Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d +NULL + +Warning: array_key_exists() expects parameter 2 to be array, boolean given in %s on line %d +NULL + +Warning: array_key_exists() expects parameter 2 to be array, boolean given in %s on line %d +NULL + +Warning: array_key_exists() expects parameter 2 to be array, double given in %s on line %d +NULL + +Warning: array_key_exists() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) + +*** Testing operation on objects *** +bool(false) +bool(false) +bool(true) +bool(false) +bool(true) +bool(true) + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/array/array_key_exists_basic.phpt b/ext/standard/tests/array/array_key_exists_basic.phpt new file mode 100644 index 0000000..6fbd415 --- /dev/null +++ b/ext/standard/tests/array/array_key_exists_basic.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test array_key_exists() function : basic functionality +--FILE-- + 'value', 'val'); +var_dump(array_key_exists($key1, $search)); +var_dump(array_key_exists($key2, $search)); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_key_exists() : basic functionality *** +bool(true) +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_key_exists_error.phpt b/ext/standard/tests/array/array_key_exists_error.phpt new file mode 100644 index 0000000..8b189c8 --- /dev/null +++ b/ext/standard/tests/array/array_key_exists_error.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test array_key_exists() function : error conditions - Pass incorrect number of args +--FILE-- + + +--EXPECTF-- +*** Testing array_key_exists() : error conditions *** + +-- Testing array_key_exists() function with more than expected no. of arguments -- + +Warning: array_key_exists() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing array_key_exists() function with less than expected no. of arguments -- + +Warning: array_key_exists() expects exactly 2 parameters, 1 given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_key_exists_object1.phpt b/ext/standard/tests/array/array_key_exists_object1.phpt new file mode 100644 index 0000000..4ffafc4 --- /dev/null +++ b/ext/standard/tests/array/array_key_exists_object1.phpt @@ -0,0 +1,80 @@ +--TEST-- +Test array_key_exists() function : object functionality +--FILE-- +var1 = $a; + $this->var2 = $b; + if (!is_null($c)) { + $this->var3 = $c; + } + } +} + +echo "\n-- Do not assign a value to \$class1->var3 --\n"; +$class1 = new myClass ('a', 'b'); +echo "\$key = var1:\n"; +var_dump(array_key_exists('var1', $class1)); +echo "\$key = var3:\n"; +var_dump(array_key_exists('var3', $class1)); +echo "\$class1:\n"; +var_dump($class1); + +echo "\n-- Assign a value to \$class2->var3 --\n"; +$class2 = new myClass('x', 'y', 'z'); +echo "\$key = var3:\n"; +var_dump(array_key_exists('var3', $class2)); +echo "\$class2:\n"; +var_dump($class2); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_key_exists() : object functionality *** + +-- Do not assign a value to $class1->var3 -- +$key = var1: +bool(true) +$key = var3: +bool(true) +$class1: +object(myClass)#1 (3) { + [%b|u%"var1"]=> + %unicode|string%(1) "a" + [%b|u%"var2"]=> + %unicode|string%(1) "b" + [%b|u%"var3"]=> + NULL +} + +-- Assign a value to $class2->var3 -- +$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" +} +Done diff --git a/ext/standard/tests/array/array_key_exists_object2.phpt b/ext/standard/tests/array/array_key_exists_object2.phpt new file mode 100644 index 0000000..39bb129 --- /dev/null +++ b/ext/standard/tests/array/array_key_exists_object2.phpt @@ -0,0 +1,84 @@ +--TEST-- +Test array_key_exists() function : object functionality - different visibilities +--FILE-- +var1 = $a; + $this->var2 = $b; + if (!is_null($c)) { + $this->var3 = $c; + } + } +} + +echo "\n-- Do not assign a value to \$class1->var3 --\n"; +$class1 = new myClass ('a', 'b'); +echo "\$key = var1:\n"; +var_dump(array_key_exists('var1', $class1)); +echo "\$key = var2:\n"; +var_dump(array_key_exists('var2', $class1)); +echo "\$key = var3:\n"; +var_dump(array_key_exists('var3', $class1)); +echo "\$class1:\n"; +var_dump($class1); + +echo "\n-- Assign a value to \$class2->var3 --\n"; +$class2 = new myClass('x', 'y', 'z'); +echo "\$key = var3:\n"; +var_dump(array_key_exists('var3', $class2)); +echo "\$class2:\n"; +var_dump($class2); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_key_exists() : object functionality *** + +-- Do not assign a value to $class1->var3 -- +$key = var1: +bool(true) +$key = var2: +bool(false) +$key = var3: +bool(false) +$class1: +object(myClass)#1 (3) { + [%b|u%"var1"]=> + %unicode|string%(1) "a" + [%b|u%"var2":protected]=> + %unicode|string%(1) "b" + [%b|u%"var3":%b|u%"myClass":private]=> + NULL +} + +-- Assign a value to $class2->var3 -- +$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" +} +Done diff --git a/ext/standard/tests/array/array_key_exists_variation1.phpt b/ext/standard/tests/array/array_key_exists_variation1.phpt new file mode 100644 index 0000000..2f50d3e --- /dev/null +++ b/ext/standard/tests/array/array_key_exists_variation1.phpt @@ -0,0 +1,203 @@ +--TEST-- +Test array_key_exists() function : usage variations - Pass different data types as $key arg +--FILE-- + 'val', 'two'); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a class +class classA +{ + public function __toString() { + return "key"; + } +} + +// heredoc string +$heredoc = << + +--EXPECTF-- +*** Testing array_key_exists() : usage variations *** + +-- Iteration 1 -- +bool(true) + +-- Iteration 2 -- +bool(true) + +-- Iteration 3 -- +bool(false) + +-- Iteration 4 -- +bool(false) + +-- Iteration 5 -- + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) + +-- Iteration 7 -- + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) + +-- Iteration 8 -- + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) + +-- Iteration 9 -- + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) + +-- Iteration 10 -- +bool(false) + +-- Iteration 11 -- +bool(false) + +-- Iteration 12 -- + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) + +-- Iteration 15 -- + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) + +-- Iteration 16 -- +bool(false) + +-- Iteration 17 -- +bool(false) + +-- Iteration 18 -- + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) + +-- Iteration 19 -- +bool(true) + +-- Iteration 20 -- +bool(true) + +-- Iteration 21 -- +bool(true) + +-- Iteration 22 -- + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) + +-- Iteration 23 -- +bool(false) + +-- Iteration 24 -- +bool(false) + +-- Iteration 25 -- + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_key_exists_variation2.phpt b/ext/standard/tests/array/array_key_exists_variation2.phpt new file mode 100644 index 0000000..a6e9cd2 --- /dev/null +++ b/ext/standard/tests/array/array_key_exists_variation2.phpt @@ -0,0 +1,225 @@ +--TEST-- +Test array_key_exists() function : usage variations - Pass differnt data types to $search arg +--FILE-- + + +--EXPECTF-- +*** Testing array_key_exists() : usage variations *** + +-- Iteration 1 -- + +Warning: array_key_exists() expects parameter 2 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: array_key_exists() expects parameter 2 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: array_key_exists() expects parameter 2 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: array_key_exists() expects parameter 2 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: array_key_exists() expects parameter 2 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: array_key_exists() expects parameter 2 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_key_exists() expects parameter 2 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_key_exists() expects parameter 2 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_key_exists() expects parameter 2 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: array_key_exists() expects parameter 2 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: array_key_exists() expects parameter 2 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: array_key_exists() expects parameter 2 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: array_key_exists() expects parameter 2 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +bool(false) + +-- Iteration 19 -- + +Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- +bool(false) + +-- Iteration 23 -- + +Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: array_key_exists() expects parameter 2 to be array, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_key_exists_variation3.phpt b/ext/standard/tests/array/array_key_exists_variation3.phpt new file mode 100644 index 0000000..e8a52a7 --- /dev/null +++ b/ext/standard/tests/array/array_key_exists_variation3.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test array_key_exists() function : usage variations - floats and casting to ints +--FILE-- + + +--EXPECTF-- +*** Testing array_key_exists() : usage variations *** + +-- Iteration 1 -- +Pass float as $key: + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) +Cast float to int: +bool(true) + +-- Iteration 1 -- +Pass float as $key: + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) +Cast float to int: +bool(true) + +-- Iteration 1 -- +Pass float as $key: + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) +Cast float to int: +bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_key_exists_variation4.phpt b/ext/standard/tests/array/array_key_exists_variation4.phpt new file mode 100644 index 0000000..84dfeb9 --- /dev/null +++ b/ext/standard/tests/array/array_key_exists_variation4.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test array_key_exists() function : usage variations - referenced variables +--FILE-- + 1, 'two' => 2, 'three' => 3); + +echo "\n-- \$search is a reference to \$array --\n"; +$search = &$array; +var_dump(array_key_exists('one', $search)); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_key_exists() : usage variations *** + +-- $search is a reference to $array -- +bool(true) +Done diff --git a/ext/standard/tests/array/array_key_exists_variation5.phpt b/ext/standard/tests/array/array_key_exists_variation5.phpt new file mode 100644 index 0000000..9c15759 --- /dev/null +++ b/ext/standard/tests/array/array_key_exists_variation5.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test array_key_exists() function : usage variations - multidimensional arrays +--FILE-- + 'val1', + 'one' => 'val2', + 'sub1' => array (1, 2, 3)); + +echo "\n-- Attempt to match key in sub-array --\n"; +// this key is in the sub-array +var_dump(array_key_exists(0, $multi_array)); + +echo "\n-- \$search arg points to sub-array --\n"; +var_dump(array_key_exists(0, $multi_array['sub1'])); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_key_exists() : usage variations *** + +-- Attempt to match key in sub-array -- +bool(false) + +-- $search arg points to sub-array -- +bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_key_exists_variation6.phpt b/ext/standard/tests/array/array_key_exists_variation6.phpt new file mode 100644 index 0000000..d19e58e --- /dev/null +++ b/ext/standard/tests/array/array_key_exists_variation6.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test array_key_exists() function : usage variations - equality test for certain data types +--FILE-- + null, + 'NULL' => NULL, + 'empty single quoted string' => '', + "empty double quoted string" => "", + 'undefined variable' => @$undefined, + 'unset variable' => @$unset); + +//iterate through original array +foreach($array as $name => $input) { + $iterator = 1; + echo "\n-- Key in \$search array is : $name --\n"; + $search[$input] = 'test'; + + //iterate through array again to see which values are considered equal + foreach($array as $key) { + echo "Iteration $iterator: "; + var_dump(array_key_exists($key, $search)); + $iterator++; + } + $search = null; +} + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_key_exists() : usage variations *** + +-- Key in $search array is : null -- +Iteration 1: bool(true) +Iteration 2: bool(true) +Iteration 3: bool(true) +Iteration 4: bool(true) +Iteration 5: bool(true) +Iteration 6: bool(true) + +-- Key in $search array is : NULL -- +Iteration 1: bool(true) +Iteration 2: bool(true) +Iteration 3: bool(true) +Iteration 4: bool(true) +Iteration 5: bool(true) +Iteration 6: bool(true) + +-- Key in $search array is : empty single quoted string -- +Iteration 1: bool(true) +Iteration 2: bool(true) +Iteration 3: bool(true) +Iteration 4: bool(true) +Iteration 5: bool(true) +Iteration 6: bool(true) + +-- Key in $search array is : empty double quoted string -- +Iteration 1: bool(true) +Iteration 2: bool(true) +Iteration 3: bool(true) +Iteration 4: bool(true) +Iteration 5: bool(true) +Iteration 6: bool(true) + +-- Key in $search array is : undefined variable -- +Iteration 1: bool(true) +Iteration 2: bool(true) +Iteration 3: bool(true) +Iteration 4: bool(true) +Iteration 5: bool(true) +Iteration 6: bool(true) + +-- Key in $search array is : unset variable -- +Iteration 1: bool(true) +Iteration 2: bool(true) +Iteration 3: bool(true) +Iteration 4: bool(true) +Iteration 5: bool(true) +Iteration 6: bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_key_exists_variation7.phpt b/ext/standard/tests/array/array_key_exists_variation7.phpt new file mode 100644 index 0000000..845c1e5 --- /dev/null +++ b/ext/standard/tests/array/array_key_exists_variation7.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_key_exists() function : usage variations - position of internal array pointer +--FILE-- + 'un', 'two' => 'deux', 'three' => 'trois'); + +echo "\n-- Call array_key_exists() --\n"; +var_dump($result = array_key_exists('one', $input)); + +echo "\n-- Position of Internal Pointer in Original Array: --\n"; +echo key($input) . " => " . current ($input) . "\n"; + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_key_exists() : usage variations *** + +-- Call array_key_exists() -- +bool(true) + +-- Position of Internal Pointer in Original Array: -- +one => un +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_key_exists_variation8.phpt b/ext/standard/tests/array/array_key_exists_variation8.phpt new file mode 100644 index 0000000..d5bad62 --- /dev/null +++ b/ext/standard/tests/array/array_key_exists_variation8.phpt @@ -0,0 +1,547 @@ +--TEST-- +Test array_key_exists() function : usage variations - array keys are different data types +--FILE-- + array( + 0 => 'zero', + 1 => 'one', + 12345 => 'positive', + -2345 => 'negative', + ), + + // float data +/*2*/ 'float' => array( + 10.5 => 'positive', + -10.5 => 'negative', + .5 => 'half', + ), + + 'extreme floats' => array( + 12.3456789000e10 => 'large', + 12.3456789000E-10 => 'small', + ), + + // null data +/*3*/ 'null uppercase' => array( + NULL => 'null 1', + ), + 'null lowercase' => array( + null => 'null 2', + ), + + // boolean data +/*4*/ 'bool lowercase' => array( + true => 'lowert', + false => 'lowerf', + ), + 'bool uppercase' => array( + TRUE => 'uppert', + FALSE => 'upperf', + ), + + // empty data +/*5*/ 'empty double quotes' => array( + "" => 'emptyd', + ), + 'empty single quotes' => array( + '' => 'emptys', + ), + + // string data +/*6*/ 'string' => array( + "stringd" => 'stringd', + 'strings' => 'strings', + $heredoc => 'stringh', + ), + + // undefined data +/*8*/ 'undefined' => array( + @$undefined_var => 'undefined', + ), + + // unset data +/*9*/ 'unset' => array( + @$unset_var => 'unset', + ), +); + +// loop through each element of $inputs to check the behavior of array_key_exists() +$iterator = 1; +foreach($inputs as $type => $input) { + echo "\n-- Iteration $iterator: $type data --\n"; + + //iterate over again to get all different key values + foreach ($inputs as $new_type => $new_input) { + echo "-- \$key arguments are $new_type data:\n"; + foreach ($new_input as $key => $search) { + var_dump(array_key_exists($key, $input)); + } + } + $iterator++; +}; + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_key_exists() : usage variations *** + +-- Iteration 1: int data -- +-- $key arguments are int data: +bool(true) +bool(true) +bool(true) +bool(true) +-- $key arguments are float data: +bool(false) +bool(false) +bool(true) +-- $key arguments are extreme floats data: +bool(false) +bool(true) +-- $key arguments are null uppercase data: +bool(false) +-- $key arguments are null lowercase data: +bool(false) +-- $key arguments are bool lowercase data: +bool(true) +bool(true) +-- $key arguments are bool uppercase data: +bool(true) +bool(true) +-- $key arguments are empty double quotes data: +bool(false) +-- $key arguments are empty single quotes data: +bool(false) +-- $key arguments are string data: +bool(false) +bool(false) +bool(false) +-- $key arguments are undefined data: +bool(false) +-- $key arguments are unset data: +bool(false) + +-- Iteration 2: float data -- +-- $key arguments are int data: +bool(true) +bool(false) +bool(false) +bool(false) +-- $key arguments are float data: +bool(true) +bool(true) +bool(true) +-- $key arguments are extreme floats data: +bool(false) +bool(true) +-- $key arguments are null uppercase data: +bool(false) +-- $key arguments are null lowercase data: +bool(false) +-- $key arguments are bool lowercase data: +bool(false) +bool(true) +-- $key arguments are bool uppercase data: +bool(false) +bool(true) +-- $key arguments are empty double quotes data: +bool(false) +-- $key arguments are empty single quotes data: +bool(false) +-- $key arguments are string data: +bool(false) +bool(false) +bool(false) +-- $key arguments are undefined data: +bool(false) +-- $key arguments are unset data: +bool(false) + +-- Iteration 3: extreme floats data -- +-- $key arguments are int data: +bool(true) +bool(false) +bool(false) +bool(false) +-- $key arguments are float data: +bool(false) +bool(false) +bool(true) +-- $key arguments are extreme floats data: +bool(true) +bool(true) +-- $key arguments are null uppercase data: +bool(false) +-- $key arguments are null lowercase data: +bool(false) +-- $key arguments are bool lowercase data: +bool(false) +bool(true) +-- $key arguments are bool uppercase data: +bool(false) +bool(true) +-- $key arguments are empty double quotes data: +bool(false) +-- $key arguments are empty single quotes data: +bool(false) +-- $key arguments are string data: +bool(false) +bool(false) +bool(false) +-- $key arguments are undefined data: +bool(false) +-- $key arguments are unset data: +bool(false) + +-- Iteration 4: null uppercase data -- +-- $key arguments are int data: +bool(false) +bool(false) +bool(false) +bool(false) +-- $key arguments are float data: +bool(false) +bool(false) +bool(false) +-- $key arguments are extreme floats data: +bool(false) +bool(false) +-- $key arguments are null uppercase data: +bool(true) +-- $key arguments are null lowercase data: +bool(true) +-- $key arguments are bool lowercase data: +bool(false) +bool(false) +-- $key arguments are bool uppercase data: +bool(false) +bool(false) +-- $key arguments are empty double quotes data: +bool(true) +-- $key arguments are empty single quotes data: +bool(true) +-- $key arguments are string data: +bool(false) +bool(false) +bool(false) +-- $key arguments are undefined data: +bool(true) +-- $key arguments are unset data: +bool(true) + +-- Iteration 5: null lowercase data -- +-- $key arguments are int data: +bool(false) +bool(false) +bool(false) +bool(false) +-- $key arguments are float data: +bool(false) +bool(false) +bool(false) +-- $key arguments are extreme floats data: +bool(false) +bool(false) +-- $key arguments are null uppercase data: +bool(true) +-- $key arguments are null lowercase data: +bool(true) +-- $key arguments are bool lowercase data: +bool(false) +bool(false) +-- $key arguments are bool uppercase data: +bool(false) +bool(false) +-- $key arguments are empty double quotes data: +bool(true) +-- $key arguments are empty single quotes data: +bool(true) +-- $key arguments are string data: +bool(false) +bool(false) +bool(false) +-- $key arguments are undefined data: +bool(true) +-- $key arguments are unset data: +bool(true) + +-- Iteration 6: bool lowercase data -- +-- $key arguments are int data: +bool(true) +bool(true) +bool(false) +bool(false) +-- $key arguments are float data: +bool(false) +bool(false) +bool(true) +-- $key arguments are extreme floats data: +bool(false) +bool(true) +-- $key arguments are null uppercase data: +bool(false) +-- $key arguments are null lowercase data: +bool(false) +-- $key arguments are bool lowercase data: +bool(true) +bool(true) +-- $key arguments are bool uppercase data: +bool(true) +bool(true) +-- $key arguments are empty double quotes data: +bool(false) +-- $key arguments are empty single quotes data: +bool(false) +-- $key arguments are string data: +bool(false) +bool(false) +bool(false) +-- $key arguments are undefined data: +bool(false) +-- $key arguments are unset data: +bool(false) + +-- Iteration 7: bool uppercase data -- +-- $key arguments are int data: +bool(true) +bool(true) +bool(false) +bool(false) +-- $key arguments are float data: +bool(false) +bool(false) +bool(true) +-- $key arguments are extreme floats data: +bool(false) +bool(true) +-- $key arguments are null uppercase data: +bool(false) +-- $key arguments are null lowercase data: +bool(false) +-- $key arguments are bool lowercase data: +bool(true) +bool(true) +-- $key arguments are bool uppercase data: +bool(true) +bool(true) +-- $key arguments are empty double quotes data: +bool(false) +-- $key arguments are empty single quotes data: +bool(false) +-- $key arguments are string data: +bool(false) +bool(false) +bool(false) +-- $key arguments are undefined data: +bool(false) +-- $key arguments are unset data: +bool(false) + +-- Iteration 8: empty double quotes data -- +-- $key arguments are int data: +bool(false) +bool(false) +bool(false) +bool(false) +-- $key arguments are float data: +bool(false) +bool(false) +bool(false) +-- $key arguments are extreme floats data: +bool(false) +bool(false) +-- $key arguments are null uppercase data: +bool(true) +-- $key arguments are null lowercase data: +bool(true) +-- $key arguments are bool lowercase data: +bool(false) +bool(false) +-- $key arguments are bool uppercase data: +bool(false) +bool(false) +-- $key arguments are empty double quotes data: +bool(true) +-- $key arguments are empty single quotes data: +bool(true) +-- $key arguments are string data: +bool(false) +bool(false) +bool(false) +-- $key arguments are undefined data: +bool(true) +-- $key arguments are unset data: +bool(true) + +-- Iteration 9: empty single quotes data -- +-- $key arguments are int data: +bool(false) +bool(false) +bool(false) +bool(false) +-- $key arguments are float data: +bool(false) +bool(false) +bool(false) +-- $key arguments are extreme floats data: +bool(false) +bool(false) +-- $key arguments are null uppercase data: +bool(true) +-- $key arguments are null lowercase data: +bool(true) +-- $key arguments are bool lowercase data: +bool(false) +bool(false) +-- $key arguments are bool uppercase data: +bool(false) +bool(false) +-- $key arguments are empty double quotes data: +bool(true) +-- $key arguments are empty single quotes data: +bool(true) +-- $key arguments are string data: +bool(false) +bool(false) +bool(false) +-- $key arguments are undefined data: +bool(true) +-- $key arguments are unset data: +bool(true) + +-- Iteration 10: string data -- +-- $key arguments are int data: +bool(false) +bool(false) +bool(false) +bool(false) +-- $key arguments are float data: +bool(false) +bool(false) +bool(false) +-- $key arguments are extreme floats data: +bool(false) +bool(false) +-- $key arguments are null uppercase data: +bool(false) +-- $key arguments are null lowercase data: +bool(false) +-- $key arguments are bool lowercase data: +bool(false) +bool(false) +-- $key arguments are bool uppercase data: +bool(false) +bool(false) +-- $key arguments are empty double quotes data: +bool(false) +-- $key arguments are empty single quotes data: +bool(false) +-- $key arguments are string data: +bool(true) +bool(true) +bool(true) +-- $key arguments are undefined data: +bool(false) +-- $key arguments are unset data: +bool(false) + +-- Iteration 11: undefined data -- +-- $key arguments are int data: +bool(false) +bool(false) +bool(false) +bool(false) +-- $key arguments are float data: +bool(false) +bool(false) +bool(false) +-- $key arguments are extreme floats data: +bool(false) +bool(false) +-- $key arguments are null uppercase data: +bool(true) +-- $key arguments are null lowercase data: +bool(true) +-- $key arguments are bool lowercase data: +bool(false) +bool(false) +-- $key arguments are bool uppercase data: +bool(false) +bool(false) +-- $key arguments are empty double quotes data: +bool(true) +-- $key arguments are empty single quotes data: +bool(true) +-- $key arguments are string data: +bool(false) +bool(false) +bool(false) +-- $key arguments are undefined data: +bool(true) +-- $key arguments are unset data: +bool(true) + +-- Iteration 12: unset data -- +-- $key arguments are int data: +bool(false) +bool(false) +bool(false) +bool(false) +-- $key arguments are float data: +bool(false) +bool(false) +bool(false) +-- $key arguments are extreme floats data: +bool(false) +bool(false) +-- $key arguments are null uppercase data: +bool(true) +-- $key arguments are null lowercase data: +bool(true) +-- $key arguments are bool lowercase data: +bool(false) +bool(false) +-- $key arguments are bool uppercase data: +bool(false) +bool(false) +-- $key arguments are empty double quotes data: +bool(true) +-- $key arguments are empty single quotes data: +bool(true) +-- $key arguments are string data: +bool(false) +bool(false) +bool(false) +-- $key arguments are undefined data: +bool(true) +-- $key arguments are unset data: +bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_keys_basic.phpt b/ext/standard/tests/array/array_keys_basic.phpt new file mode 100644 index 0000000..80b624b --- /dev/null +++ b/ext/standard/tests/array/array_keys_basic.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test array_keys() function (basic) +--FILE-- + 1, "b" => 2, 2.0 => 2.0, -23.45 => "asdasd", + array(1,2,3)); +var_dump(array_keys($basic_arr)); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing array_keys() on basic array operation *** +array(5) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + int(2) + [3]=> + int(-23) + [4]=> + int(3) +} +Done diff --git a/ext/standard/tests/array/array_keys_error.phpt b/ext/standard/tests/array/array_keys_error.phpt new file mode 100644 index 0000000..316e91d --- /dev/null +++ b/ext/standard/tests/array/array_keys_error.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test array_keys() function (error conditions) +--FILE-- + expected +var_dump(array_keys(array(1,2,3, array() => array()))); // (W)illegal offset + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing error conditions *** +Warning: array_keys() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_keys() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_keys() expects parameter 1 to be array, object given in %s on line %d +NULL + +Warning: array_keys() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: array_keys() expects at most 3 parameters, 4 given in %s on line %d +NULL + +Warning: Illegal offset type in %s on line %d +array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) +} +Done diff --git a/ext/standard/tests/array/array_keys_variation_001.phpt b/ext/standard/tests/array/array_keys_variation_001.phpt new file mode 100644 index 0000000..1891c13 --- /dev/null +++ b/ext/standard/tests/array/array_keys_variation_001.phpt @@ -0,0 +1,147 @@ +--TEST-- +Test array_keys() function (variation - 1) +--FILE-- + "World"), + array("" => ""), + array(1,2,3, "d" => array(4,6, "d")), + array("a" => 1, "b" => 2, "c" =>3, "d" => array()), + array(0 => 0, 1 => 1, 2 => 2, 3 => 3), + array(0.001=>3.000, 1.002=>2, 1.999=>3, "a"=>3, 3=>5, "5"=>3.000), + array(TRUE => TRUE, FALSE => FALSE, NULL => NULL, "\x000", "\000"), + array("a" => "abcd", "a" => "", "ab" => -6, "cd" => -0.5 ), + array(0 => array(), 1=> array(0), 2 => array(1), ""=> array(),""=>"" ) +); + +$i = 0; +/* loop through to test array_keys() with different arrays */ +foreach ($arrays as $array) { + echo "\n-- Iteration $i --\n"; + var_dump(array_keys($array)); + $i++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing array_keys() on various arrays *** +-- Iteration 0 -- +array(0) { +} + +-- Iteration 1 -- +array(1) { + [0]=> + int(0) +} + +-- Iteration 2 -- +array(1) { + [0]=> + int(0) +} + +-- Iteration 3 -- +array(1) { + [0]=> + string(5) "Hello" +} + +-- Iteration 4 -- +array(1) { + [0]=> + string(0) "" +} + +-- Iteration 5 -- +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + string(1) "d" +} + +-- Iteration 6 -- +array(4) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + [3]=> + string(1) "d" +} + +-- Iteration 7 -- +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) +} + +-- Iteration 8 -- +array(5) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + string(1) "a" + [3]=> + int(3) + [4]=> + int(5) +} + +-- Iteration 9 -- +array(5) { + [0]=> + int(1) + [1]=> + int(0) + [2]=> + string(0) "" + [3]=> + int(2) + [4]=> + int(3) +} + +-- Iteration 10 -- +array(3) { + [0]=> + string(1) "a" + [1]=> + string(2) "ab" + [2]=> + string(2) "cd" +} + +-- Iteration 11 -- +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + string(0) "" +} +Done diff --git a/ext/standard/tests/array/array_keys_variation_002.phpt b/ext/standard/tests/array/array_keys_variation_002.phpt new file mode 100644 index 0000000..d5df95b --- /dev/null +++ b/ext/standard/tests/array/array_keys_variation_002.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test array_keys() function (variation - 2) +--SKIPIF-- + +--FILE-- + 1, + 2147483648 => 2, + -2147483647 => 3, + -2147483648 => 4, + -2147483649 => 5, + -0 => 6, + 0 => 7 +); +var_dump(array_keys($arr_range)); + +echo "\n*** Testing array_keys() on an array created on the fly ***\n"; +var_dump(array_keys(array("a" => 1, "b" => 2, "c" => 3))); +var_dump(array_keys(array())); // null array + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing array_keys() on range of values *** +array(4) { + [0]=> + int(2147483647) + [1]=> + int(-2147483648) + [2]=> + int(-2147483647) + [3]=> + int(0) +} + +*** Testing array_keys() on an array created on the fly *** +array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" +} +array(0) { +} +Done diff --git a/ext/standard/tests/array/array_keys_variation_002_64bit.phpt b/ext/standard/tests/array/array_keys_variation_002_64bit.phpt new file mode 100644 index 0000000..c0a034e --- /dev/null +++ b/ext/standard/tests/array/array_keys_variation_002_64bit.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test array_keys() function (variation - 2) +--SKIPIF-- + +--FILE-- + 1, + 2147483648 => 2, + -2147483647 => 3, + -2147483648 => 4, + -2147483649 => 5, + -0 => 6, + 0 => 7 +); +var_dump(array_keys($arr_range)); + +echo "\n*** Testing array_keys() on an array created on the fly ***\n"; +var_dump(array_keys(array("a" => 1, "b" => 2, "c" => 3))); +var_dump(array_keys(array())); // null array + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing array_keys() on range of values *** +array(6) { + [0]=> + int(2147483647) + [1]=> + int(2147483648) + [2]=> + int(-2147483647) + [3]=> + int(-2147483648) + [4]=> + int(-2147483649) + [5]=> + int(0) +} + +*** Testing array_keys() on an array created on the fly *** +array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" +} +array(0) { +} +Done diff --git a/ext/standard/tests/array/array_keys_variation_003.phpt b/ext/standard/tests/array/array_keys_variation_003.phpt new file mode 100644 index 0000000..5ccf542 --- /dev/null +++ b/ext/standard/tests/array/array_keys_variation_003.phpt @@ -0,0 +1,116 @@ +--TEST-- +Test array_keys() function (variation - 3) +--FILE-- + TRUE, + FALSE => FALSE, + 1 => 1, + 0 => 0, + -1 => -1, + "1" => "1", + "0" => "0", + "-1" => "-1", + NULL, + array(), + "php" => "php", + "" => "" +); +$values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "php", ""); +foreach ($values as $value){ + var_dump($value); + var_dump(array_keys($types_arr, $value)); +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing array_keys() on all the types other than arrays *** +bool(true) +array(3) { + [0]=> + int(1) + [1]=> + int(-1) + [2]=> + string(3) "php" +} +bool(false) +array(4) { + [0]=> + int(0) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + string(0) "" +} +int(1) +array(1) { + [0]=> + int(1) +} +int(0) +array(4) { + [0]=> + int(0) + [1]=> + int(2) + [2]=> + string(3) "php" + [3]=> + string(0) "" +} +int(-1) +array(1) { + [0]=> + int(-1) +} +string(1) "1" +array(1) { + [0]=> + int(1) +} +string(1) "0" +array(1) { + [0]=> + int(0) +} +string(2) "-1" +array(1) { + [0]=> + int(-1) +} +NULL +array(3) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + string(0) "" +} +array(0) { +} +array(2) { + [0]=> + int(2) + [1]=> + int(3) +} +string(3) "php" +array(1) { + [0]=> + string(3) "php" +} +string(0) "" +array(2) { + [0]=> + int(2) + [1]=> + string(0) "" +} +Done diff --git a/ext/standard/tests/array/array_keys_variation_004.phpt b/ext/standard/tests/array/array_keys_variation_004.phpt new file mode 100644 index 0000000..1a4f0fc --- /dev/null +++ b/ext/standard/tests/array/array_keys_variation_004.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test array_keys() function (variation - 4) +--FILE-- + TRUE, + FALSE => FALSE, + 1 => 1, + 0 => 0, + -1 => -1, + "1" => "1", + "0" => "0", + "-1" => "-1", + NULL, + array(), + "php" => "php", + "" => "" +); +$values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "php", ""); +foreach ($values as $value){ + var_dump(array_keys($types_arr, $value, TRUE)); +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing array_keys() on all the types other than arrays *** +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} +array(1) { + [0]=> + int(1) +} +array(1) { + [0]=> + int(0) +} +array(1) { + [0]=> + int(-1) +} +array(1) { + [0]=> + int(2) +} +array(1) { + [0]=> + int(3) +} +array(1) { + [0]=> + string(3) "php" +} +array(1) { + [0]=> + string(0) "" +} +Done diff --git a/ext/standard/tests/array/array_keys_variation_005.phpt b/ext/standard/tests/array/array_keys_variation_005.phpt new file mode 100644 index 0000000..9a912d6 --- /dev/null +++ b/ext/standard/tests/array/array_keys_variation_005.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test array_keys() function (variation - 5) +--FILE-- + +--EXPECTF-- +*** Testing array_keys() with resource type *** +array(1) { + [0]=> + int(0) +} +array(1) { + [0]=> + int(0) +} +array(1) { + [0]=> + int(1) +} +array(1) { + [0]=> + int(1) +} diff --git a/ext/standard/tests/array/array_map_001.phpt b/ext/standard/tests/array/array_map_001.phpt new file mode 100644 index 0000000..646eb76 --- /dev/null +++ b/ext/standard/tests/array/array_map_001.phpt @@ -0,0 +1,23 @@ +--TEST-- +array_map() and exceptions in the callback +--FILE-- + +--EXPECTF-- +Warning: array_map(): An error occurred while invoking the map callback in %s on line %d +string(17) "exception caught!" +Done diff --git a/ext/standard/tests/array/array_map_basic.phpt b/ext/standard/tests/array/array_map_basic.phpt new file mode 100644 index 0000000..53a7bb4 --- /dev/null +++ b/ext/standard/tests/array/array_map_basic.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test array_map() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing array_map() : basic functionality *** +-- With two integer array -- +array(3) { + [0]=> + int(4) + [1]=> + int(10) + [2]=> + int(18) +} +-- With single integer array -- +array(3) { + [0]=> + int(1) + [1]=> + int(4) + [2]=> + int(9) +} +-- With string array -- +array(2) { + [0]=> + string(12) "one = single" + [1]=> + string(12) "two = double" +} +Done diff --git a/ext/standard/tests/array/array_map_error.phpt b/ext/standard/tests/array/array_map_error.phpt new file mode 100644 index 0000000..7c623ec --- /dev/null +++ b/ext/standard/tests/array/array_map_error.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test array_map() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_map() : error conditions *** + +-- Testing array_map() function with Zero arguments -- + +Warning: array_map() expects at least 2 parameters, 0 given in %s on line %d%d +NULL + +-- Testing array_map() function with one less than expected no. of arguments -- + +Warning: array_map() expects at least 2 parameters, 1 given in %s on line %d%d +NULL + +-- Testing array_map() function with less no. of arrays than callback function arguments -- + +Warning: Missing argument 2 for callback2() in %s on line %d%d + +Notice: Undefined variable: q in %s on line %d%d + +Warning: Missing argument 2 for callback2() in %s on line %d%d + +Notice: Undefined variable: q in %s on line %d%d +array(2) { + [0]=> + int(0) + [1]=> + int(0) +} + +-- Testing array_map() function with more no. of arrays than callback function arguments -- +array(2) { + [0]=> + int(3) + [1]=> + int(8) +} +Done diff --git a/ext/standard/tests/array/array_map_object1.phpt b/ext/standard/tests/array/array_map_object1.phpt new file mode 100644 index 0000000..b96338c --- /dev/null +++ b/ext/standard/tests/array/array_map_object1.phpt @@ -0,0 +1,206 @@ +--TEST-- +Test array_map() function : usage variations - object functionality +--FILE-- + +===DONE=== + +--EXPECTF-- +*** Testing array_map() : object functionality *** +-- simple class with public variable and method -- +SimpleClass::square + +Strict Standards: array_map() expects parameter 1 to be a valid callback, non-static method SimpleClass::square() should not be called statically in %sarray_map_object1.php on line %d +array(2) { + [0]=> + int(1) + [1]=> + int(4) +} + +-- simple class with private variable and method -- +SimpleClassPri::add + +Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add() in %sarray_map_object1.php on line %d +NULL + +-- simple class with protected variable and method -- +SimpleClassPro::mul + +Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul() in %sarray_map_object1.php on line %d +NULL + +-- class without members -- +EmptyClass + +Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %sarray_map_object1.php on line %d +NULL + +-- abstract class -- +ChildClass::emptyFunction + +Strict Standards: array_map() expects parameter 1 to be a valid callback, non-static method ChildClass::emptyFunction() should not be called statically in %sarray_map_object1.php on line %d +defined in child +defined in child +array(2) { + [0]=> + NULL + [1]=> + NULL +} + +-- class with final method -- +FinalClass::finalMethod + +Strict Standards: array_map() expects parameter 1 to be a valid callback, non-static method FinalClass::finalMethod() should not be called statically in %sarray_map_object1.php on line %d +This function can't be overloaded +This function can't be overloaded +array(2) { + [0]=> + NULL + [1]=> + NULL +} + +-- class with static members -- +StaticClass::square +array(2) { + [0]=> + int(1) + [1]=> + int(4) +} +StaticClass::cube + +Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube() in %sarray_map_object1.php on line %d +NULL +StaticClass::retVal + +Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal() in %sarray_map_object1.php on line %d +NULL +-- class implementing an interface -- +InterClass::square +array(2) { + [0]=> + int(1) + [1]=> + int(4) +} +===DONE=== diff --git a/ext/standard/tests/array/array_map_object2.phpt b/ext/standard/tests/array/array_map_object2.phpt new file mode 100644 index 0000000..c98b2cf --- /dev/null +++ b/ext/standard/tests/array/array_map_object2.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test array_map() function : object functionality - with non-existent class and method +--FILE-- + +--EXPECTF-- +*** Testing array_map() : with non-existent class and method *** +-- with non-existent class -- + +Warning: array_map() expects parameter 1 to be a valid callback, class 'non-existent' not found in %s on line %d +NULL +-- with existent class and non-existent method -- + +Warning: array_map() expects parameter 1 to be a valid callback, class 'SimpleClass' does not have a method 'non-existent' in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_map_object3.phpt b/ext/standard/tests/array/array_map_object3.phpt new file mode 100644 index 0000000..9424c44 --- /dev/null +++ b/ext/standard/tests/array/array_map_object3.phpt @@ -0,0 +1,92 @@ +--TEST-- +Test array_map() function : object functionality - class methods as callback function +--FILE-- +parent_obj = new ParentClass(); + } + public $var2 = 5; + public static function staticChild($n) { + return $n; + } + public function nonstaticChild($n) { + return $n; + } +} + +$childobj = new ChildClass(); +$parentobj = new ParentClass(); + +echo "-- accessing parent method from child class --\n"; +var_dump( array_map(array('ChildClass', 'staticParent1'), $arr1) ); + +echo "-- accessing child method from parent class --\n"; +var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) ); + +echo "-- accessing parent method using child class object --\n"; +var_dump( array_map(array($childobj, 'staticParent1'), $arr1) ); + +echo "-- accessing child method using parent class object --\n"; +var_dump( array_map(array($parentobj, 'staticChild'), $arr1) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_map() : class methods as callback function *** +-- accessing parent method from child class -- +array(3) { + [0]=> + int(1) + [1]=> + int(5) + [2]=> + int(7) +} +-- accessing child method from parent class -- + +Warning: array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' in %s on line %d +NULL +-- accessing parent method using child class object -- +array(3) { + [0]=> + int(1) + [1]=> + int(5) + [2]=> + int(7) +} +-- accessing child method using parent class object -- + +Warning: array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_map_variation1.phpt b/ext/standard/tests/array/array_map_variation1.phpt new file mode 100644 index 0000000..cd09be7 --- /dev/null +++ b/ext/standard/tests/array/array_map_variation1.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test array_map() function : usage variations - string keys +--FILE-- + "value"); +function cb1 ($a) {return array ($a);}; +function cb2 ($a,$b) {return array ($a,$b);}; +var_dump( array_map("cb1", $arr)); +var_dump( array_map("cb2", $arr,$arr)); +var_dump( array_map(null, $arr)); +var_dump( array_map(null, $arr, $arr)); +echo "Done"; +?> + +--EXPECT-- +*** Testing array_map() : string keys *** +array(1) { + ["stringkey"]=> + array(1) { + [0]=> + string(5) "value" + } +} +array(1) { + [0]=> + array(2) { + [0]=> + string(5) "value" + [1]=> + string(5) "value" + } +} +array(1) { + ["stringkey"]=> + string(5) "value" +} +array(1) { + [0]=> + array(2) { + [0]=> + string(5) "value" + [1]=> + string(5) "value" + } +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_map_variation10.phpt b/ext/standard/tests/array/array_map_variation10.phpt new file mode 100644 index 0000000..cc75436 --- /dev/null +++ b/ext/standard/tests/array/array_map_variation10.phpt @@ -0,0 +1,120 @@ +--TEST-- +Test array_map() function : usage variations - anonymous callback function +--FILE-- + +--EXPECTF-- +*** Testing array_map() : anonymous callback function *** +-- anonymous function with all parameters and body -- +array(3) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(3) + } + [1]=> + array(2) { + [0]=> + int(2) + [1]=> + int(4) + } + [2]=> + array(2) { + [0]=> + int(3) + [1]=> + int(5) + } +} +-- anonymous function with two parameters and passing one array -- + +Warning: Missing argument 2 for __lambda_func() in %s(20) : runtime-created function on line %d + +Notice: Undefined variable: b in %s(20) : runtime-created function on line %d + +Warning: Missing argument 2 for __lambda_func() in %s(20) : runtime-created function on line %d + +Notice: Undefined variable: b in %s(20) : runtime-created function on line %d + +Warning: Missing argument 2 for __lambda_func() in %s(20) : runtime-created function on line %d + +Notice: Undefined variable: b in %s(20) : runtime-created function on line %d +array(3) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + NULL + } + [1]=> + array(2) { + [0]=> + int(2) + [1]=> + NULL + } + [2]=> + array(2) { + [0]=> + int(3) + [1]=> + NULL + } +} +-- anonymous function with NULL parameter -- +array(3) { + [0]=> + NULL + [1]=> + NULL + [2]=> + NULL +} +-- anonymous function with NULL body -- +array(3) { + [0]=> + NULL + [1]=> + NULL + [2]=> + NULL +} +-- passing NULL as 'arr1' -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_map_variation11.phpt b/ext/standard/tests/array/array_map_variation11.phpt new file mode 100644 index 0000000..9cad366 --- /dev/null +++ b/ext/standard/tests/array/array_map_variation11.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test array_map() function : usage variations - with recursive callback +--FILE-- + +--EXPECTF-- +*** Testing array_map() : recursive callback function *** +array(3) { + [0]=> + int(1) + [1]=> + array(3) { + [0]=> + int(4) + [1]=> + int(9) + [2]=> + array(1) { + [0]=> + int(25) + } + } + [2]=> + array(1) { + [0]=> + int(16) + } +} +Done diff --git a/ext/standard/tests/array/array_map_variation12.phpt b/ext/standard/tests/array/array_map_variation12.phpt new file mode 100644 index 0000000..5c6d9fb --- /dev/null +++ b/ext/standard/tests/array/array_map_variation12.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test array_map() function : usage variations - built-in function as callback +--FILE-- + +--EXPECTF-- +*** Testing array_map() : built-in function *** +-- with built-in function 'pow' and two parameters -- +array(3) { + [0]=> + int(1) + [1]=> + int(16) + [2]=> + int(243) +} +-- with built-in function 'pow' and one parameter -- + +Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d + +Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d + +Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d +array(3) { + [0]=> + NULL + [1]=> + NULL + [2]=> + NULL +} +-- with language construct -- + +Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_map_variation13.phpt b/ext/standard/tests/array/array_map_variation13.phpt new file mode 100644 index 0000000..94babdf --- /dev/null +++ b/ext/standard/tests/array/array_map_variation13.phpt @@ -0,0 +1,107 @@ +--TEST-- +Test array_map() function : usage variations - callback function with different return types +--FILE-- + +--EXPECTF-- +*** Testing array_map() : callback with diff return value *** +-- with integer return value -- +array(3) { + [0]=> + int(4) + [1]=> + int(6) + [2]=> + int(8) +} +-- with string return value -- +array(3) { + [0]=> + string(2) "13" + [1]=> + string(2) "24" + [2]=> + string(2) "35" +} +-- with bool return value -- +array(3) { + [0]=> + bool(true) + [1]=> + bool(true) + [2]=> + bool(true) +} +-- with null return value -- +array(3) { + [0]=> + NULL + [1]=> + NULL + [2]=> + NULL +} +-- with no return value -- +callback_without_ret called +callback_without_ret called +callback_without_ret called +array(3) { + [0]=> + NULL + [1]=> + NULL + [2]=> + NULL +} +Done diff --git a/ext/standard/tests/array/array_map_variation14.phpt b/ext/standard/tests/array/array_map_variation14.phpt new file mode 100644 index 0000000..771d3f9 --- /dev/null +++ b/ext/standard/tests/array/array_map_variation14.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test array_map() function : usage variations - null value for 'callback' argument +--FILE-- + +--EXPECTF-- +*** Testing array_map() : null value for 'callback' argument *** +-- with null -- +array(2) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + string(3) "one" + [2]=> + float(1.1) + } + [1]=> + array(3) { + [0]=> + int(2) + [1]=> + string(3) "two" + [2]=> + float(2.2) + } +} +array(2) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + string(3) "one" + [2]=> + float(1.1) + } + [1]=> + array(3) { + [0]=> + int(2) + [1]=> + string(3) "two" + [2]=> + float(2.2) + } +} +-- with unset variable -- +array(2) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + string(3) "one" + [2]=> + float(1.1) + } + [1]=> + array(3) { + [0]=> + int(2) + [1]=> + string(3) "two" + [2]=> + float(2.2) + } +} +-- with undefined variable -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- with empty string -- + +Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL +-- with empty array -- + +Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_map_variation15.phpt b/ext/standard/tests/array/array_map_variation15.phpt new file mode 100644 index 0000000..b29af47 --- /dev/null +++ b/ext/standard/tests/array/array_map_variation15.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test array_map() function : usage variations - non existent 'callback' function +--FILE-- + +--EXPECTF-- +*** Testing array_map() : non existent 'callback' function *** + +Warning: array_map() expects parameter 1 to be a valid callback, function 'non_existent' not found or invalid function name in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_map_variation16.phpt b/ext/standard/tests/array/array_map_variation16.phpt new file mode 100644 index 0000000..c4987cb --- /dev/null +++ b/ext/standard/tests/array/array_map_variation16.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test array_map() function : usage variations - failing built-in functions & language constructs +--FILE-- + +--EXPECTF-- +*** Testing array_map() : non-permmited built-in functions *** +-- Iteration 1 -- + +Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d +NULL +-- Iteration 2 -- + +Warning: array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name in %s on line %d +NULL +-- Iteration 3 -- + +Warning: array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name in %s on line %d +NULL +-- Iteration 4 -- + +Warning: array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name in %s on line %d +NULL +-- Iteration 5 -- + +Warning: array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d +NULL +-- Iteration 6 -- + +Warning: array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_map_variation17.phpt b/ext/standard/tests/array/array_map_variation17.phpt new file mode 100644 index 0000000..d9440bb --- /dev/null +++ b/ext/standard/tests/array/array_map_variation17.phpt @@ -0,0 +1,158 @@ +--TEST-- +Test array_map() function : usage variations - unexpected values for 'callback' argument +--FILE-- + +--EXPECTF-- +*** Testing array_map() : unexpected values for 'callback' argument *** + +-- Iteration 1 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 2 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 3 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 4 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 5 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 6 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 7 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 8 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 9 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 10 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 11 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 12 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 13 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 14 -- +Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL + +-- Iteration 15 -- +Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL + +-- Iteration 16 -- +Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +-- Iteration 17 -- +Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL + +-- Iteration 18 -- +Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL + +-- Iteration 19 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 20 -- +Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_map_variation18.phpt b/ext/standard/tests/array/array_map_variation18.phpt new file mode 100644 index 0000000..d0a23d7 --- /dev/null +++ b/ext/standard/tests/array/array_map_variation18.phpt @@ -0,0 +1,205 @@ +--TEST-- +Test array_map() function : usage variations - unexpected values for 'arr1' argument +--FILE-- + +--EXPECTF-- +*** Testing array_map() : unexpected values for 'arr1' *** +-- Iteration 1 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 2 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 3 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 4 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 5 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 6 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 7 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 8 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 9 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 10 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 11 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 12 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 13 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 14 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 15 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 16 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 17 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 18 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 19 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 20 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 21 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 22 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 23 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 24 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +-- Iteration 25 -- + +Warning: array_map(): Argument #2 should be an array in %s on line %d%d +NULL +Done diff --git a/ext/standard/tests/array/array_map_variation19.phpt b/ext/standard/tests/array/array_map_variation19.phpt new file mode 100644 index 0000000..0e56428 --- /dev/null +++ b/ext/standard/tests/array/array_map_variation19.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test array_map() function : usage variations - callback pass semantics +--FILE-- + +--EXPECTF-- +array(2) { + [0]=> + string(10) "original.0" + [1]=> + string(10) "original.1" +} +array(2) { + [0]=> + &string(10) "original.0" + [1]=> + string(10) "original.1" +} \ No newline at end of file diff --git a/ext/standard/tests/array/array_map_variation2.phpt b/ext/standard/tests/array/array_map_variation2.phpt new file mode 100644 index 0000000..16561ab --- /dev/null +++ b/ext/standard/tests/array/array_map_variation2.phpt @@ -0,0 +1,213 @@ +--TEST-- +Test array_map() function : usage variations - references +--FILE-- + "v1","k2"=>"v2"); +$arr[]=&$arr["k1"]; +$arr[]=&$arr; +function cb1 ($a) {var_dump ($a);return array ($a);}; +function cb2 (&$a) {var_dump ($a);return array (&$a);}; +var_dump( array_map("cb1", $arr)); +var_dump( array_map("cb2", $arr,$arr)); +var_dump( array_map(null, $arr)); +var_dump( array_map(null, $arr, $arr)); + +// break cycles +$arr[0] = null; +$arr[1] = null; + +echo "Done"; +?> + +--EXPECT-- +*** Testing array_map() : references *** +string(2) "v1" +string(2) "v2" +string(2) "v1" +array(4) { + ["k1"]=> + &string(2) "v1" + ["k2"]=> + string(2) "v2" + [0]=> + &string(2) "v1" + [1]=> + &array(4) { + ["k1"]=> + &string(2) "v1" + ["k2"]=> + string(2) "v2" + [0]=> + &string(2) "v1" + [1]=> + *RECURSION* + } +} +array(4) { + ["k1"]=> + array(1) { + [0]=> + string(2) "v1" + } + ["k2"]=> + array(1) { + [0]=> + string(2) "v2" + } + [0]=> + array(1) { + [0]=> + string(2) "v1" + } + [1]=> + array(1) { + [0]=> + array(4) { + ["k1"]=> + &string(2) "v1" + ["k2"]=> + string(2) "v2" + [0]=> + &string(2) "v1" + [1]=> + &array(4) { + ["k1"]=> + &string(2) "v1" + ["k2"]=> + string(2) "v2" + [0]=> + &string(2) "v1" + [1]=> + *RECURSION* + } + } + } +} +string(2) "v1" +string(2) "v2" +string(2) "v1" +array(4) { + ["k1"]=> + &string(2) "v1" + ["k2"]=> + string(2) "v2" + [0]=> + &string(2) "v1" + [1]=> + &array(4) { + ["k1"]=> + &string(2) "v1" + ["k2"]=> + string(2) "v2" + [0]=> + &string(2) "v1" + [1]=> + *RECURSION* + } +} +array(4) { + [0]=> + array(1) { + [0]=> + &string(2) "v1" + } + [1]=> + array(1) { + [0]=> + string(2) "v2" + } + [2]=> + array(1) { + [0]=> + &string(2) "v1" + } + [3]=> + array(1) { + [0]=> + &array(4) { + ["k1"]=> + &string(2) "v1" + ["k2"]=> + string(2) "v2" + [0]=> + &string(2) "v1" + [1]=> + *RECURSION* + } + } +} +array(4) { + ["k1"]=> + &string(2) "v1" + ["k2"]=> + string(2) "v2" + [0]=> + &string(2) "v1" + [1]=> + &array(4) { + ["k1"]=> + &string(2) "v1" + ["k2"]=> + string(2) "v2" + [0]=> + &string(2) "v1" + [1]=> + *RECURSION* + } +} +array(4) { + [0]=> + array(2) { + [0]=> + &string(2) "v1" + [1]=> + &string(2) "v1" + } + [1]=> + array(2) { + [0]=> + string(2) "v2" + [1]=> + string(2) "v2" + } + [2]=> + array(2) { + [0]=> + &string(2) "v1" + [1]=> + &string(2) "v1" + } + [3]=> + array(2) { + [0]=> + &array(4) { + ["k1"]=> + &string(2) "v1" + ["k2"]=> + string(2) "v2" + [0]=> + &string(2) "v1" + [1]=> + *RECURSION* + } + [1]=> + &array(4) { + ["k1"]=> + &string(2) "v1" + ["k2"]=> + string(2) "v2" + [0]=> + &string(2) "v1" + [1]=> + *RECURSION* + } + } +} +Done diff --git a/ext/standard/tests/array/array_map_variation3.phpt b/ext/standard/tests/array/array_map_variation3.phpt new file mode 100644 index 0000000..a071550 --- /dev/null +++ b/ext/standard/tests/array/array_map_variation3.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_map() function : usage variations - different arrays for 'arr1' argument +--FILE-- + "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values + array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values + array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values + array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value + array("one" => 1, 2 => "two", 4 => "four"), //mixed + + // associative array, containing null/empty/boolean values as key/value +/*13*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), + array(true => "true", false => "false", "false" => false, "true" => true), + array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), + array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), + array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + + // array with repetative keys +/*18*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) +); + +// loop through the various elements of $arrays to test array_map() +$iterator = 1; +foreach($arrays as $arr1) { + echo "-- Iteration $iterator --\n"; + var_dump( array_map('callback', $arr1) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_map() : different arrays for 'arr1' argument *** +-- Iteration 1 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- Iteration 2 -- +array(2) { + [0]=> + float(1.1) + [1]=> + float(2.2) +} +-- Iteration 3 -- +array(2) { + [0]=> + array(1) { + [0]=> + int(2) + } + [1]=> + array(1) { + [0]=> + int(1) + } +} +-- Iteration 4 -- +array(2) { + [0]=> + bool(false) + [1]=> + bool(true) +} +-- Iteration 5 -- +array(0) { +} +-- Iteration 6 -- +array(1) { + [0]=> + NULL +} +-- Iteration 7 -- +array(6) { + [0]=> + string(1) "a" + [1]=> + string(4) "aaaa" + [2]=> + string(1) "b" + [3]=> + string(4) "bbbb" + [4]=> + string(1) "c" + [5]=> + string(5) "ccccc" +} +-- Iteration 8 -- +array(3) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" +} +-- Iteration 9 -- +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) +} +-- Iteration 10 -- +array(4) { + [1]=> + int(10) + [2]=> + int(20) + [4]=> + int(40) + [3]=> + int(30) +} +-- Iteration 11 -- +array(3) { + ["one"]=> + string(3) "ten" + ["two"]=> + string(6) "twenty" + ["three"]=> + string(6) "thirty" +} +-- Iteration 12 -- +array(3) { + ["one"]=> + int(1) + [2]=> + string(3) "two" + [4]=> + string(4) "four" +} +-- Iteration 13 -- +array(3) { + [""]=> + string(4) "null" + ["NULL"]=> + NULL + ["null"]=> + NULL +} +-- Iteration 14 -- +array(4) { + [1]=> + string(4) "true" + [0]=> + string(5) "false" + ["false"]=> + bool(false) + ["true"]=> + bool(true) +} +-- Iteration 15 -- +array(3) { + [""]=> + string(6) "emptys" + ["emptyd"]=> + string(0) "" + ["emptys"]=> + string(0) "" +} +-- Iteration 16 -- +array(6) { + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + NULL + [4]=> + NULL + [5]=> + bool(false) + [6]=> + bool(true) +} +-- Iteration 17 -- +array(3) { + [""]=> + int(4) + [0]=> + int(5) + [1]=> + int(6) +} +-- Iteration 18 -- +array(3) { + ["One"]=> + int(10) + ["two"]=> + int(20) + ["three"]=> + int(3) +} +Done diff --git a/ext/standard/tests/array/array_map_variation4.phpt b/ext/standard/tests/array/array_map_variation4.phpt new file mode 100644 index 0000000..fcc4090 --- /dev/null +++ b/ext/standard/tests/array/array_map_variation4.phpt @@ -0,0 +1,179 @@ +--TEST-- +Test array_map() function : usage variations - associative array with different keys +--FILE-- + "0"), + array(1 => "1"), + array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), + + // arrays with float keys +/*5*/ array(2.3333 => "float"), + array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => "f3", 33333333.333333 => "f4"), + + // arrays with string keys + array('\tHello' => 111, 're\td' => 'color', '\v\fworld' => 2.2, 'pen\n' => 33), +/*8*/ array("\tHello" => 111, "re\td" => "color", "\v\fworld" => 2.2, "pen\n" => 33), + array("hello", $heredoc => "string"), // heredoc + + // array with object, unset variable and resource variable + array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), + + // array with mixed values +/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, + $fp => 'resource', 133 => "int", 444.432 => "float", + @$unset_var => "unset", $heredoc => "heredoc") +); + +// loop through the various elements of $arrays to test array_map() +$iterator = 1; +foreach($arrays as $arr1) { + echo "-- Iteration $iterator --\n"; + var_dump( array_map('callback', $arr1) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_map() : associative array with diff. keys for 'arr1' argument *** + +Warning: Illegal offset type in %s on line %d%d + +Warning: Illegal offset type in %s on line %d%d + +Warning: Illegal offset type in %s on line %d%d + +Warning: Illegal offset type in %s on line %d%d +-- Iteration 1 -- +array(0) { +} +-- Iteration 2 -- +array(1) { + [0]=> + string(1) "0" +} +-- Iteration 3 -- +array(1) { + [1]=> + string(1) "1" +} +-- Iteration 4 -- +array(4) { + [1]=> + string(1) "1" + [2]=> + string(1) "2" + [3]=> + string(1) "3" + [4]=> + string(1) "4" +} +-- Iteration 5 -- +array(1) { + [2]=> + string(5) "float" +} +-- Iteration 6 -- +array(4) { + [1]=> + string(2) "f1" + [3]=> + string(2) "f2" + [4]=> + string(2) "f3" + [33333333]=> + string(2) "f4" +} +-- Iteration 7 -- +array(4) { + ["\tHello"]=> + int(111) + ["re\td"]=> + string(5) "color" + ["\v\fworld"]=> + float(2.2) + ["pen\n"]=> + int(33) +} +-- Iteration 8 -- +array(4) { + [" Hello"]=> + int(111) + ["re d"]=> + string(5) "color" + [" world"]=> + float(2.2) + ["pen +"]=> + int(33) +} +-- Iteration 9 -- +array(2) { + [0]=> + string(5) "hello" + ["Hello world"]=> + string(6) "string" +} +-- Iteration 10 -- +array(1) { + [""]=> + string(5) "hello" +} +-- Iteration 11 -- +array(6) { + ["hello"]=> + int(1) + ["fruit"]=> + float(2.2) + [133]=> + string(3) "int" + [444]=> + string(5) "float" + [""]=> + string(5) "unset" + ["Hello world"]=> + string(7) "heredoc" +} +Done diff --git a/ext/standard/tests/array/array_map_variation5.phpt b/ext/standard/tests/array/array_map_variation5.phpt new file mode 100644 index 0000000..55f1569 --- /dev/null +++ b/ext/standard/tests/array/array_map_variation5.phpt @@ -0,0 +1,181 @@ +--TEST-- +Test array_map() function : usage variations - associative array with different values +--FILE-- + 0), + array("1" => 1), + array("one" => 1, 'two' => 2, "three" => 3, 4 => 4), + + // arrays with float values +/*5*/ array("float" => 2.3333), + array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.3333), + + // arrays with string values + array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), +/*8*/ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), + array(1 => "hello", "heredoc" => $heredoc), + + // array with object, unset variable and resource variable + array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp), + + // array with mixed values +/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit", + 'resource' => $fp, "int" => 133, "float" => 444.432, + "unset" => @$unset_var, "heredoc" => $heredoc) +); + +// loop through the various elements of $arrays to test array_map() +$iterator = 1; +foreach($arrays as $arr1) { + echo "-- Iteration $iterator --\n"; + var_dump( array_map('callback', $arr1) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_map() : associative array with diff. values for 'arr1' argument *** +-- Iteration 1 -- +array(0) { +} +-- Iteration 2 -- +array(1) { + [0]=> + int(0) +} +-- Iteration 3 -- +array(1) { + [1]=> + int(1) +} +-- Iteration 4 -- +array(4) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + [4]=> + int(4) +} +-- Iteration 5 -- +array(1) { + ["float"]=> + float(2.3333) +} +-- Iteration 6 -- +array(4) { + ["f1"]=> + float(1.2) + ["f2"]=> + float(3.33) + [3]=> + float(4.8999992284) + ["f4"]=> + float(33333333.3333) +} +-- Iteration 7 -- +array(4) { + [111]=> + string(6) " Hello" + ["red"]=> + string(6) "col or" + [2]=> + string(7) " world" + [3]=> + string(4) "pen +" +} +-- Iteration 8 -- +array(4) { + [111]=> + string(7) "\tHello" + ["red"]=> + string(7) "col\tor" + [2]=> + string(9) "\v\fworld" + [3]=> + string(5) "pen\n" +} +-- Iteration 9 -- +array(2) { + [1]=> + string(5) "hello" + ["heredoc"]=> + string(11) "Hello world" +} +-- Iteration 10 -- +array(3) { + [11]=> + object(classA)#%d (0) { + } + ["unset"]=> + NULL + ["resource"]=> + resource(%d) of type (stream) +} +-- Iteration 11 -- +array(8) { + [1]=> + string(5) "hello" + [2]=> + object(classA)#%d (0) { + } + [222]=> + string(5) "fruit" + ["resource"]=> + resource(%d) of type (stream) + ["int"]=> + int(133) + ["float"]=> + float(444.432) + ["unset"]=> + NULL + ["heredoc"]=> + string(11) "Hello world" +} +Done diff --git a/ext/standard/tests/array/array_map_variation6.phpt b/ext/standard/tests/array/array_map_variation6.phpt new file mode 100644 index 0000000..2409a57 --- /dev/null +++ b/ext/standard/tests/array/array_map_variation6.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test array_map() function : usage variations - array having subarrays +--FILE-- + 'a', 'b' => 2) +); + +var_dump( array_map('callback', $arr1)); +echo "Done"; +?> +--EXPECTF-- +*** Testing array_map() : array having subarrays *** +array(5) { + [0]=> + array(0) { + } + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [2]=> + array(2) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + } + [3]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(1) "a" + [3]=> + string(1) "b" + } + [4]=> + array(2) { + [1]=> + string(1) "a" + ["b"]=> + int(2) + } +} +Done diff --git a/ext/standard/tests/array/array_map_variation7.phpt b/ext/standard/tests/array/array_map_variation7.phpt new file mode 100644 index 0000000..8f88a0f --- /dev/null +++ b/ext/standard/tests/array/array_map_variation7.phpt @@ -0,0 +1,122 @@ +--TEST-- +Test array_map() function : usage variations - arrays of different size +--FILE-- + $b); +} + +// calling array_map with different arrays +var_dump( array_map('callback', array(1, 2, 3), array()) ); +var_dump( array_map('callback', array(), array('a', 'b', 'c')) ); +var_dump( array_map('callback', array(1, 2, 3), array('a', 'b')) ); +var_dump( array_map('callback', array(012, 0x2F, 0X1A), array(2.3, 12.4e2)) ); +var_dump( array_map('callback', array(), array(1, 2, 3), array('a', 'b')) ); // passing more no. of arrays than callback function argument + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_map() : arrays with diff. size *** +array(3) { + [0]=> + array(1) { + [1]=> + NULL + } + [1]=> + array(1) { + [2]=> + NULL + } + [2]=> + array(1) { + [3]=> + NULL + } +} +array(3) { + [0]=> + array(1) { + [""]=> + string(1) "a" + } + [1]=> + array(1) { + [""]=> + string(1) "b" + } + [2]=> + array(1) { + [""]=> + string(1) "c" + } +} +array(3) { + [0]=> + array(1) { + [1]=> + string(1) "a" + } + [1]=> + array(1) { + [2]=> + string(1) "b" + } + [2]=> + array(1) { + [3]=> + NULL + } +} +array(3) { + [0]=> + array(1) { + [10]=> + float(2.3) + } + [1]=> + array(1) { + [47]=> + float(1240) + } + [2]=> + array(1) { + [26]=> + NULL + } +} +array(3) { + [0]=> + array(1) { + [""]=> + int(1) + } + [1]=> + array(1) { + [""]=> + int(2) + } + [2]=> + array(1) { + [""]=> + int(3) + } +} +Done diff --git a/ext/standard/tests/array/array_map_variation8.phpt b/ext/standard/tests/array/array_map_variation8.phpt new file mode 100644 index 0000000..5672e6c --- /dev/null +++ b/ext/standard/tests/array/array_map_variation8.phpt @@ -0,0 +1,81 @@ +--TEST-- +Test array_map() function : usage variations - array with references +--FILE-- + 0, + 1 => &$value4, + 2 => &$value2, + 3 => "hello", + 4 => &$value3, + $value4 => &$value2 +); +echo "-- with one array --\n"; +var_dump( array_map('callback1', $arr1) ); + +echo "-- with two arrays --\n"; +var_dump( array_map('callback_cat', $arr1, $arr1) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_map() : array with references for 'arr1' argument *** +-- with one array -- +array(6) { + [0]=> + int(0) + [1]=> + string(5) "hello" + [2]=> + string(5) "hello" + [3]=> + string(5) "hello" + [4]=> + int(0) + ["hello"]=> + string(5) "hello" +} +-- with two arrays -- +array(6) { + [0]=> + string(2) "00" + [1]=> + string(10) "hellohello" + [2]=> + string(10) "hellohello" + [3]=> + string(10) "hellohello" + [4]=> + string(2) "00" + [5]=> + string(10) "hellohello" +} +Done diff --git a/ext/standard/tests/array/array_map_variation9.phpt b/ext/standard/tests/array/array_map_variation9.phpt new file mode 100644 index 0000000..f029bec --- /dev/null +++ b/ext/standard/tests/array/array_map_variation9.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test array_map() function : usage variations - binary safe checking +--FILE-- + $b); +} + +// array with binary data +$arr1 = array(b"hello", b"world", "1", b"22.22"); + +echo "-- checking binary safe array with one parameter callback function --\n"; +var_dump( array_map('callback1', $arr1) ); + +echo "-- checking binary safe array with two parameter callback function --\n"; +var_dump( array_map(b"callback2", $arr1) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_map() : array with binary data for 'arr1' argument *** +-- checking binary safe array with one parameter callback function -- +array(4) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + [2]=> + string(1) "1" + [3]=> + string(5) "22.22" +} +-- checking binary safe array with two parameter callback function -- + +Warning: Missing argument 2 for callback2() in %s on line %d%d + +Notice: Undefined variable: b in %s on line %d%d + +Warning: Missing argument 2 for callback2() in %s on line %d%d + +Notice: Undefined variable: b in %s on line %d%d + +Warning: Missing argument 2 for callback2() in %s on line %d%d + +Notice: Undefined variable: b in %s on line %d%d + +Warning: Missing argument 2 for callback2() in %s on line %d%d + +Notice: Undefined variable: b in %s on line %d%d +array(4) { + [0]=> + array(1) { + ["hello"]=> + NULL + } + [1]=> + array(1) { + ["world"]=> + NULL + } + [2]=> + array(1) { + [1]=> + NULL + } + [3]=> + array(1) { + ["22.22"]=> + NULL + } +} +Done diff --git a/ext/standard/tests/array/array_merge.phpt b/ext/standard/tests/array/array_merge.phpt new file mode 100644 index 0000000..b718386 --- /dev/null +++ b/ext/standard/tests/array/array_merge.phpt @@ -0,0 +1,762 @@ +--TEST-- +Test array_merge() function +--INI-- +precision=14 +--FILE-- + "string"), + array( "" => "string"), + array( -2.44444 => 12), + array( "a" => 1, "b" => -2.344, "b" => "string", "c" => NULL, "d" => -2.344), + array( 4 => 1, 3 => -2.344, "3" => "string", "2" => NULL,1 => -2.344), + array( NULL, 1.23 => "Hi", "string" => "hello", + array("" => "World", "-2.34" => "a", "0" => "b")) +); + +$end_array = array( + array(), + array( 1 => "string"), + array( "" => "string"), + array( -2.44444 => 12), + array( "a" => 1, "b" => -2.344, "b" => "string", "c" => NULL, "d" => -2.344), + array( 4 => 1, 3 => -2.344, "3" => "string", "2" => NULL, 1=> -2.344), + array( NULL, 1.23 => "Hi", "string" => "hello", + array("" => "World", "-2.34" => "a", "0" => "b")) +); + +/* loop through to merge two arrays */ +$count_outer = 0; +foreach($begin_array as $first) { + echo "\n\n--- Iteration $count_outer ---"; + $count_inner = 0; + foreach($end_array as $second) { + echo "\n-- Inner iteration $count_inner of Iteration $count_outer --\n"; + $result = array_merge($first, $second); + print_r($result); + $count_inner++; + } + $count_outer++; +} + + +echo "\n*** Testing array_merge() with three or more arrays ***\n"; +var_dump( array_merge( $end_array[0], + $end_array[5], + $end_array[4], + $end_array[6] + ) + ); + +var_dump( array_merge( $end_array[0], + $end_array[5], + array("array on fly"), + array("nullarray" => array()) + ) + ); + + +echo "\n*** Testing single array argument ***\n"; +/* Empty array */ +var_dump(array_merge(array())); + +/* associative array with string keys, which will not be re-indexed */ +var_dump(array_merge($begin_array[4])); + +/* associative array with numeric keys, which will be re-indexed */ +var_dump(array_merge($begin_array[5])); + +/* associative array with mixed keys and sub-array as element */ +var_dump(array_merge($begin_array[6])); + +echo "\n*** Testing array_merge() with typecasting non-array to array ***\n"; +var_dump(array_merge($begin_array[4], (array)"type1", (array)10, (array)12.34)); + +echo "\n*** Testing error conditions ***"; +/* Invalid argumens */ +var_dump(array_merge()); +var_dump(array_merge(100, 200)); +var_dump(array_merge($begin_array[0], $begin_array[1], 100)); +var_dump(array_merge($begin_array[0], $begin_array[1], $arr4)); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing array_merge() basic functionality *** + +--- Iteration 0 --- +-- Inner iteration 0 of Iteration 0 -- +Array +( +) + +-- Inner iteration 1 of Iteration 0 -- +Array +( + [0] => string +) + +-- Inner iteration 2 of Iteration 0 -- +Array +( + [] => string +) + +-- Inner iteration 3 of Iteration 0 -- +Array +( + [0] => 12 +) + +-- Inner iteration 4 of Iteration 0 -- +Array +( + [a] => 1 + [b] => string + [c] => + [d] => -2.344 +) + +-- Inner iteration 5 of Iteration 0 -- +Array +( + [0] => 1 + [1] => string + [2] => + [3] => -2.344 +) + +-- Inner iteration 6 of Iteration 0 -- +Array +( + [0] => + [1] => Hi + [string] => hello + [2] => Array + ( + [] => World + [-2.34] => a + [0] => b + ) + +) + + +--- Iteration 1 --- +-- Inner iteration 0 of Iteration 1 -- +Array +( + [0] => string +) + +-- Inner iteration 1 of Iteration 1 -- +Array +( + [0] => string + [1] => string +) + +-- Inner iteration 2 of Iteration 1 -- +Array +( + [0] => string + [] => string +) + +-- Inner iteration 3 of Iteration 1 -- +Array +( + [0] => string + [1] => 12 +) + +-- Inner iteration 4 of Iteration 1 -- +Array +( + [0] => string + [a] => 1 + [b] => string + [c] => + [d] => -2.344 +) + +-- Inner iteration 5 of Iteration 1 -- +Array +( + [0] => string + [1] => 1 + [2] => string + [3] => + [4] => -2.344 +) + +-- Inner iteration 6 of Iteration 1 -- +Array +( + [0] => string + [1] => + [2] => Hi + [string] => hello + [3] => Array + ( + [] => World + [-2.34] => a + [0] => b + ) + +) + + +--- Iteration 2 --- +-- Inner iteration 0 of Iteration 2 -- +Array +( + [] => string +) + +-- Inner iteration 1 of Iteration 2 -- +Array +( + [] => string + [0] => string +) + +-- Inner iteration 2 of Iteration 2 -- +Array +( + [] => string +) + +-- Inner iteration 3 of Iteration 2 -- +Array +( + [] => string + [0] => 12 +) + +-- Inner iteration 4 of Iteration 2 -- +Array +( + [] => string + [a] => 1 + [b] => string + [c] => + [d] => -2.344 +) + +-- Inner iteration 5 of Iteration 2 -- +Array +( + [] => string + [0] => 1 + [1] => string + [2] => + [3] => -2.344 +) + +-- Inner iteration 6 of Iteration 2 -- +Array +( + [] => string + [0] => + [1] => Hi + [string] => hello + [2] => Array + ( + [] => World + [-2.34] => a + [0] => b + ) + +) + + +--- Iteration 3 --- +-- Inner iteration 0 of Iteration 3 -- +Array +( + [0] => 12 +) + +-- Inner iteration 1 of Iteration 3 -- +Array +( + [0] => 12 + [1] => string +) + +-- Inner iteration 2 of Iteration 3 -- +Array +( + [0] => 12 + [] => string +) + +-- Inner iteration 3 of Iteration 3 -- +Array +( + [0] => 12 + [1] => 12 +) + +-- Inner iteration 4 of Iteration 3 -- +Array +( + [0] => 12 + [a] => 1 + [b] => string + [c] => + [d] => -2.344 +) + +-- Inner iteration 5 of Iteration 3 -- +Array +( + [0] => 12 + [1] => 1 + [2] => string + [3] => + [4] => -2.344 +) + +-- Inner iteration 6 of Iteration 3 -- +Array +( + [0] => 12 + [1] => + [2] => Hi + [string] => hello + [3] => Array + ( + [] => World + [-2.34] => a + [0] => b + ) + +) + + +--- Iteration 4 --- +-- Inner iteration 0 of Iteration 4 -- +Array +( + [a] => 1 + [b] => string + [c] => + [d] => -2.344 +) + +-- Inner iteration 1 of Iteration 4 -- +Array +( + [a] => 1 + [b] => string + [c] => + [d] => -2.344 + [0] => string +) + +-- Inner iteration 2 of Iteration 4 -- +Array +( + [a] => 1 + [b] => string + [c] => + [d] => -2.344 + [] => string +) + +-- Inner iteration 3 of Iteration 4 -- +Array +( + [a] => 1 + [b] => string + [c] => + [d] => -2.344 + [0] => 12 +) + +-- Inner iteration 4 of Iteration 4 -- +Array +( + [a] => 1 + [b] => string + [c] => + [d] => -2.344 +) + +-- Inner iteration 5 of Iteration 4 -- +Array +( + [a] => 1 + [b] => string + [c] => + [d] => -2.344 + [0] => 1 + [1] => string + [2] => + [3] => -2.344 +) + +-- Inner iteration 6 of Iteration 4 -- +Array +( + [a] => 1 + [b] => string + [c] => + [d] => -2.344 + [0] => + [1] => Hi + [string] => hello + [2] => Array + ( + [] => World + [-2.34] => a + [0] => b + ) + +) + + +--- Iteration 5 --- +-- Inner iteration 0 of Iteration 5 -- +Array +( + [0] => 1 + [1] => string + [2] => + [3] => -2.344 +) + +-- Inner iteration 1 of Iteration 5 -- +Array +( + [0] => 1 + [1] => string + [2] => + [3] => -2.344 + [4] => string +) + +-- Inner iteration 2 of Iteration 5 -- +Array +( + [0] => 1 + [1] => string + [2] => + [3] => -2.344 + [] => string +) + +-- Inner iteration 3 of Iteration 5 -- +Array +( + [0] => 1 + [1] => string + [2] => + [3] => -2.344 + [4] => 12 +) + +-- Inner iteration 4 of Iteration 5 -- +Array +( + [0] => 1 + [1] => string + [2] => + [3] => -2.344 + [a] => 1 + [b] => string + [c] => + [d] => -2.344 +) + +-- Inner iteration 5 of Iteration 5 -- +Array +( + [0] => 1 + [1] => string + [2] => + [3] => -2.344 + [4] => 1 + [5] => string + [6] => + [7] => -2.344 +) + +-- Inner iteration 6 of Iteration 5 -- +Array +( + [0] => 1 + [1] => string + [2] => + [3] => -2.344 + [4] => + [5] => Hi + [string] => hello + [6] => Array + ( + [] => World + [-2.34] => a + [0] => b + ) + +) + + +--- Iteration 6 --- +-- Inner iteration 0 of Iteration 6 -- +Array +( + [0] => + [1] => Hi + [string] => hello + [2] => Array + ( + [] => World + [-2.34] => a + [0] => b + ) + +) + +-- Inner iteration 1 of Iteration 6 -- +Array +( + [0] => + [1] => Hi + [string] => hello + [2] => Array + ( + [] => World + [-2.34] => a + [0] => b + ) + + [3] => string +) + +-- Inner iteration 2 of Iteration 6 -- +Array +( + [0] => + [1] => Hi + [string] => hello + [2] => Array + ( + [] => World + [-2.34] => a + [0] => b + ) + + [] => string +) + +-- Inner iteration 3 of Iteration 6 -- +Array +( + [0] => + [1] => Hi + [string] => hello + [2] => Array + ( + [] => World + [-2.34] => a + [0] => b + ) + + [3] => 12 +) + +-- Inner iteration 4 of Iteration 6 -- +Array +( + [0] => + [1] => Hi + [string] => hello + [2] => Array + ( + [] => World + [-2.34] => a + [0] => b + ) + + [a] => 1 + [b] => string + [c] => + [d] => -2.344 +) + +-- Inner iteration 5 of Iteration 6 -- +Array +( + [0] => + [1] => Hi + [string] => hello + [2] => Array + ( + [] => World + [-2.34] => a + [0] => b + ) + + [3] => 1 + [4] => string + [5] => + [6] => -2.344 +) + +-- Inner iteration 6 of Iteration 6 -- +Array +( + [0] => + [1] => Hi + [string] => hello + [2] => Array + ( + [] => World + [-2.34] => a + [0] => b + ) + + [3] => + [4] => Hi + [5] => Array + ( + [] => World + [-2.34] => a + [0] => b + ) + +) + +*** Testing array_merge() with three or more arrays *** +array(12) { + [0]=> + int(1) + [1]=> + string(6) "string" + [2]=> + NULL + [3]=> + float(-2.344) + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) + [4]=> + NULL + [5]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [6]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } +} +array(6) { + [0]=> + int(1) + [1]=> + string(6) "string" + [2]=> + NULL + [3]=> + float(-2.344) + [4]=> + string(12) "array on fly" + ["nullarray"]=> + array(0) { + } +} + +*** Testing single array argument *** +array(0) { +} +array(4) { + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) +} +array(4) { + [0]=> + int(1) + [1]=> + string(6) "string" + [2]=> + NULL + [3]=> + float(-2.344) +} +array(4) { + [0]=> + NULL + [1]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [2]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } +} + +*** Testing array_merge() with typecasting non-array to array *** +array(7) { + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) + [0]=> + string(5) "type1" + [1]=> + int(10) + [2]=> + float(12.34) +} + +*** Testing error conditions *** +Warning: array_merge() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_merge(): Argument #3 is not an array in %s on line %d +NULL + +Notice: Undefined variable: arr4 in %s on line %d + +Warning: array_merge(): Argument #3 is not an array in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_merge_basic.phpt b/ext/standard/tests/array/array_merge_basic.phpt new file mode 100644 index 0000000..c4dc696 --- /dev/null +++ b/ext/standard/tests/array/array_merge_basic.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test array_merge() function : basic functionality +--FILE-- + 1, 'b' => 2, 'c' => 3); + +var_dump(array_merge($array1, $array2)); + +var_dump(array_merge($array2, $array1)); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_merge() : basic functionality *** +array(6) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + string(3) "two" + ["a"]=> + int(1) + ["b"]=> + int(2) + ["c"]=> + int(3) +} +array(6) { + ["a"]=> + int(1) + ["b"]=> + int(2) + ["c"]=> + int(3) + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + string(3) "two" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_merge_error.phpt b/ext/standard/tests/array/array_merge_error.phpt new file mode 100644 index 0000000..a017c27 --- /dev/null +++ b/ext/standard/tests/array/array_merge_error.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test array_merge() function : error conditions - Pass incorrect number of args +--FILE-- + +--EXPECTF-- +*** Testing array_merge() : error conditions *** + +-- Testing array_merge() function with less than expected no. of arguments -- + +Warning: array_merge() expects at least 1 parameter, 0 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_merge_recursive_basic1.phpt b/ext/standard/tests/array/array_merge_recursive_basic1.phpt new file mode 100644 index 0000000..a86a851 --- /dev/null +++ b/ext/standard/tests/array/array_merge_recursive_basic1.phpt @@ -0,0 +1,97 @@ +--TEST-- +Test array_merge_recursive() function : basic functionality - array with default keys +--FILE-- + +--EXPECTF-- +*** Testing array_merge_recursive() : array with default keys *** +-- With default argument -- +array(2) { + [0]=> + int(1) + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} +-- With more arguments -- +array(4) { + [0]=> + int(1) + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [2]=> + int(3) + [3]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + } +} +array(6) { + [0]=> + int(1) + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [2]=> + int(3) + [3]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + } + [4]=> + array(2) { + [0]=> + int(6) + [1]=> + int(7) + } + [5]=> + array(2) { + [0]=> + string(4) "str1" + [1]=> + string(4) "str2" + } +} +Done diff --git a/ext/standard/tests/array/array_merge_recursive_basic2.phpt b/ext/standard/tests/array/array_merge_recursive_basic2.phpt new file mode 100644 index 0000000..3f8c62e --- /dev/null +++ b/ext/standard/tests/array/array_merge_recursive_basic2.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test array_merge_recursive() function : basic functionality - associative arrays +--FILE-- + "one", 2 => array(1, 2)); +$arr2 = array(2 => 'three', "four" => array("hello", 'world')); +$arr3 = array(1 => array(6, 7), 'four' => array("str1", 'str2')); + +// Calling array_merge_recursive() with default arguments +echo "-- With default argument --\n"; +var_dump( array_merge_recursive($arr1) ); + +// Calling array_merge_recursive() with more arguments +echo "-- With more arguments --\n"; +var_dump( array_merge_recursive($arr1,$arr2) ); +var_dump( array_merge_recursive($arr1,$arr2,$arr3) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_merge_recursive() : associative arrays *** +-- With default argument -- +array(2) { + [0]=> + string(3) "one" + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} +-- With more arguments -- +array(4) { + [0]=> + string(3) "one" + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [2]=> + string(5) "three" + ["four"]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + } +} +array(5) { + [0]=> + string(3) "one" + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [2]=> + string(5) "three" + ["four"]=> + array(4) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + [2]=> + string(4) "str1" + [3]=> + string(4) "str2" + } + [3]=> + array(2) { + [0]=> + int(6) + [1]=> + int(7) + } +} +Done diff --git a/ext/standard/tests/array/array_merge_recursive_error.phpt b/ext/standard/tests/array/array_merge_recursive_error.phpt new file mode 100644 index 0000000..d7d7172 --- /dev/null +++ b/ext/standard/tests/array/array_merge_recursive_error.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test array_merge_recursive() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_merge_recursive() : error conditions *** + +-- Testing array_merge_recursive() function with Zero arguments -- + +Warning: array_merge_recursive() expects at least 1 parameter, 0 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_merge_recursive_variation1.phpt b/ext/standard/tests/array/array_merge_recursive_variation1.phpt new file mode 100644 index 0000000..75e0c20 --- /dev/null +++ b/ext/standard/tests/array/array_merge_recursive_variation1.phpt @@ -0,0 +1,303 @@ +--TEST-- +Test array_merge_recursive() function : usage variations - unexpected values for $arr1 argument +--FILE-- + +--EXPECTF-- +*** Testing array_merge_recursive() : Passing non array values to $arr1 argument *** + +-- Iteration 1 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 2 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 3 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 4 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 5 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 6 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 7 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 8 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 9 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 10 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 11 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 12 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 13 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 14 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 15 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 16 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 17 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 18 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 19 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 20 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 21 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 22 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 23 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 24 -- +-- With default argument -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +-- With more arguments -- +Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_merge_recursive_variation10.phpt b/ext/standard/tests/array/array_merge_recursive_variation10.phpt new file mode 100644 index 0000000..42d315e --- /dev/null +++ b/ext/standard/tests/array/array_merge_recursive_variation10.phpt @@ -0,0 +1,174 @@ +--TEST-- +Test array_merge_recursive() function : usage variations - two dimensional arrays +--FILE-- + array("hello", "world", "str1" => "hello", "str2" => 'world'), + array(1 => "one", 2 => "two", "one", 'two'), + array(1, 2, 3, 1) +); + +// initialize the second argument +$arr2 = array(1, "hello", "array" => array("hello", 'world')); + +echo "-- Passing the entire 2-d array --\n"; +echo "-- With default argument --\n"; +var_dump( array_merge_recursive($arr1) ); +echo "-- With more arguments --\n"; +var_dump( array_merge_recursive($arr1, $arr2) ); + +echo "-- Passing the sub-array --\n"; +echo "-- With default argument --\n"; +var_dump( array_merge_recursive($arr1["array"]) ); +echo "-- With more arguments --\n"; +var_dump( array_merge_recursive($arr1["array"], $arr2["array"]) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_merge_recursive() : two dimensional array for $arr1 argument *** +-- Passing the entire 2-d array -- +-- With default argument -- +array(4) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(1) + } + ["array"]=> + array(4) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + ["str1"]=> + string(5) "hello" + ["str2"]=> + string(5) "world" + } + [1]=> + array(4) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(3) "one" + [4]=> + string(3) "two" + } + [2]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(1) + } +} +-- With more arguments -- +array(6) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(1) + } + ["array"]=> + array(6) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + ["str1"]=> + string(5) "hello" + ["str2"]=> + string(5) "world" + [2]=> + string(5) "hello" + [3]=> + string(5) "world" + } + [1]=> + array(4) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(3) "one" + [4]=> + string(3) "two" + } + [2]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(1) + } + [3]=> + int(1) + [4]=> + string(5) "hello" +} +-- Passing the sub-array -- +-- With default argument -- +array(4) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + ["str1"]=> + string(5) "hello" + ["str2"]=> + string(5) "world" +} +-- With more arguments -- +array(6) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + ["str1"]=> + string(5) "hello" + ["str2"]=> + string(5) "world" + [2]=> + string(5) "hello" + [3]=> + string(5) "world" +} +Done diff --git a/ext/standard/tests/array/array_merge_recursive_variation2.phpt b/ext/standard/tests/array/array_merge_recursive_variation2.phpt new file mode 100644 index 0000000..83f2374 --- /dev/null +++ b/ext/standard/tests/array/array_merge_recursive_variation2.phpt @@ -0,0 +1,199 @@ +--TEST-- +Test array_merge_recursive() function : usage variations - unexpected values for $arr2 argument +--FILE-- + +--EXPECTF-- +*** Testing array_merge_recursive() : Passing non array values to $arr2 argument *** + +-- Iteration 1 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 2 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 3 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 4 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 5 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 6 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 7 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 8 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 9 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 10 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 11 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 12 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 13 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 14 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 15 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 16 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 17 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 18 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 19 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 20 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 21 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 22 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 23 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 24 -- +Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_merge_recursive_variation3.phpt b/ext/standard/tests/array/array_merge_recursive_variation3.phpt new file mode 100644 index 0000000..722388a --- /dev/null +++ b/ext/standard/tests/array/array_merge_recursive_variation3.phpt @@ -0,0 +1,761 @@ +--TEST-- +Test array_merge_recursive() function : usage variations - different arrays for 'arr1' argument +--FILE-- +22 +'single quoted string' +"double quoted string" +2222 != 1111.\t 0000 = 0000\n +EOT; + +// arrays passed to $arr1 argument +$arrays = array ( +/*1*/ array(1, 2,), // with default keys and numeric values + array(1.1, 2.2), // with default keys & float values + array(false, true), // with default keys and boolean values + array(), // empty array +/*5*/ array(NULL), // with NULL + array("a\v\f", "aaaa\r", "b", "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings + array('a\v\f', 'aaaa\r', 'b', '\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings + array("h1" => $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces), // with heredocs + + // associative arrays +/*9*/ array(1 => "one", 2 => "two"), // explicit numeric keys, string values + array("one" => 1, "two" => 2, "1" => 1 ), // string keys & numeric values + array( 1 => 10, 2 => 20, 4 => 40), // explicit numeric keys and numeric values + array( "one" => "ten", "two" => "twenty"), // string key/value + array("one" => 1, 2 => "two", 4 => "four"), //mixed + + // associative array, containing null/empty/boolean values as key/value +/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), + array(true => "true", false => "false", "false" => false, "true" => true), + array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), + array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), + array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + + // array containing embedded arrays +/*15*/ array("str1", "array" => array("hello", 'world'), array(1, 2)) +); + +// initialise the second argument +$arr2 = array( 1 => "one", 2, "string" => "hello", "array" => array("a", "b", "c")); + +// loop through each sub array of $arrays and check the behavior of array_merge_recursive() +$iterator = 1; +foreach($arrays as $arr1) { + echo "-- Iteration $iterator --\n"; + + // with default argument + echo "-- With default argument --\n"; + var_dump( array_merge_recursive($arr1) ); + + // with more arguments + echo "-- With more arguments --\n"; + var_dump( array_merge_recursive($arr1, $arr2) ); + + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_merge_recursive() : Passing different arrays to $arr1 argument *** +-- Iteration 1 -- +-- With default argument -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- With more arguments -- +array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(3) "one" + [3]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 2 -- +-- With default argument -- +array(2) { + [0]=> + float(1.1) + [1]=> + float(2.2) +} +-- With more arguments -- +array(6) { + [0]=> + float(1.1) + [1]=> + float(2.2) + [2]=> + string(3) "one" + [3]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 3 -- +-- With default argument -- +array(2) { + [0]=> + bool(false) + [1]=> + bool(true) +} +-- With more arguments -- +array(6) { + [0]=> + bool(false) + [1]=> + bool(true) + [2]=> + string(3) "one" + [3]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 4 -- +-- With default argument -- +array(0) { +} +-- With more arguments -- +array(4) { + [0]=> + string(3) "one" + [1]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 5 -- +-- With default argument -- +array(1) { + [0]=> + NULL +} +-- With more arguments -- +array(5) { + [0]=> + NULL + [1]=> + string(3) "one" + [2]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 6 -- +-- With default argument -- +array(4) { + [0]=> + string(3) "a " + [1]=> + string(5) "aaaa " + [2]=> + string(1) "b" + [3]=> + string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}" +} +-- With more arguments -- +array(8) { + [0]=> + string(3) "a " + [1]=> + string(5) "aaaa " + [2]=> + string(1) "b" + [3]=> + string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}" + [4]=> + string(3) "one" + [5]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 7 -- +-- With default argument -- +array(4) { + [0]=> + string(5) "a\v\f" + [1]=> + string(6) "aaaa\r" + [2]=> + string(1) "b" + [3]=> + string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}" +} +-- With more arguments -- +array(8) { + [0]=> + string(5) "a\v\f" + [1]=> + string(6) "aaaa\r" + [2]=> + string(1) "b" + [3]=> + string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}" + [4]=> + string(3) "one" + [5]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 8 -- +-- With default argument -- +array(3) { + ["h1"]=> + string(1) " +" + ["h2"]=> + string(88) "hello world +The quick brown fox jumped over; +the lazy dog +This is a double quoted string" + ["h3"]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" +} +-- With more arguments -- +array(7) { + ["h1"]=> + string(1) " +" + ["h2"]=> + string(88) "hello world +The quick brown fox jumped over; +the lazy dog +This is a double quoted string" + ["h3"]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" + [0]=> + string(3) "one" + [1]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 9 -- +-- With default argument -- +array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" +} +-- With more arguments -- +array(6) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + [2]=> + string(3) "one" + [3]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 10 -- +-- With default argument -- +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + [0]=> + int(1) +} +-- With more arguments -- +array(7) { + ["one"]=> + int(1) + ["two"]=> + int(2) + [0]=> + int(1) + [1]=> + string(3) "one" + [2]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 11 -- +-- With default argument -- +array(3) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(40) +} +-- With more arguments -- +array(7) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(40) + [3]=> + string(3) "one" + [4]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 12 -- +-- With default argument -- +array(2) { + ["one"]=> + string(3) "ten" + ["two"]=> + string(6) "twenty" +} +-- With more arguments -- +array(6) { + ["one"]=> + string(3) "ten" + ["two"]=> + string(6) "twenty" + [0]=> + string(3) "one" + [1]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 13 -- +-- With default argument -- +array(3) { + ["one"]=> + int(1) + [0]=> + string(3) "two" + [1]=> + string(4) "four" +} +-- With more arguments -- +array(7) { + ["one"]=> + int(1) + [0]=> + string(3) "two" + [1]=> + string(4) "four" + [2]=> + string(3) "one" + [3]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 14 -- +-- With default argument -- +array(3) { + [""]=> + string(4) "null" + ["NULL"]=> + NULL + ["null"]=> + NULL +} +-- With more arguments -- +array(7) { + [""]=> + string(4) "null" + ["NULL"]=> + NULL + ["null"]=> + NULL + [0]=> + string(3) "one" + [1]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 15 -- +-- With default argument -- +array(4) { + [0]=> + string(4) "true" + [1]=> + string(5) "false" + ["false"]=> + bool(false) + ["true"]=> + bool(true) +} +-- With more arguments -- +array(8) { + [0]=> + string(4) "true" + [1]=> + string(5) "false" + ["false"]=> + bool(false) + ["true"]=> + bool(true) + [2]=> + string(3) "one" + [3]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 16 -- +-- With default argument -- +array(3) { + [""]=> + string(6) "emptys" + ["emptyd"]=> + string(0) "" + ["emptys"]=> + string(0) "" +} +-- With more arguments -- +array(7) { + [""]=> + string(6) "emptys" + ["emptyd"]=> + string(0) "" + ["emptys"]=> + string(0) "" + [0]=> + string(3) "one" + [1]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 17 -- +-- With default argument -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + NULL + [3]=> + NULL + [4]=> + bool(false) + [5]=> + bool(true) +} +-- With more arguments -- +array(10) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + NULL + [3]=> + NULL + [4]=> + bool(false) + [5]=> + bool(true) + [6]=> + string(3) "one" + [7]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 18 -- +-- With default argument -- +array(3) { + [""]=> + int(4) + [0]=> + int(5) + [1]=> + int(6) +} +-- With more arguments -- +array(7) { + [""]=> + int(4) + [0]=> + int(5) + [1]=> + int(6) + [2]=> + string(3) "one" + [3]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 19 -- +-- With default argument -- +array(3) { + [0]=> + string(4) "str1" + ["array"]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + } + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} +-- With more arguments -- +array(6) { + [0]=> + string(4) "str1" + ["array"]=> + array(5) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + [2]=> + string(1) "a" + [3]=> + string(1) "b" + [4]=> + string(1) "c" + } + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [2]=> + string(3) "one" + [3]=> + int(2) + ["string"]=> + string(5) "hello" +} +Done diff --git a/ext/standard/tests/array/array_merge_recursive_variation4.phpt b/ext/standard/tests/array/array_merge_recursive_variation4.phpt new file mode 100644 index 0000000..b497ace --- /dev/null +++ b/ext/standard/tests/array/array_merge_recursive_variation4.phpt @@ -0,0 +1,424 @@ +--TEST-- +Test array_merge_recursive() function : usage variations - associative array with different keys +--FILE-- + "0", 1 => array(1 => "one")), + array(1 => "1", 2 => array(1 => "one", 2 => "two", 3 => 1, 4 => "4")), + + // arrays with float keys +/*3*/ array(2.3333 => "float", 44.44 => array(1.1 => "float")), + array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => array(1.1 => "f1"), 3333333.333333 => "f4"), + + // arrays with string keys +/*5*/ array('\tHello' => array("hello", 'world'), '\v\fworld' => 2.2, 'pen\n' => 111), + array("\tHello" => array("hello", 'world'), "\v\fworld" => 2.2, "pen\n" => 111), + array("hello", $heredoc => array("heredoc", 'string'), "string"), + + // array with object, unset variable and resource variable +/*8*/ array(new classA() => 11, @$unset_var => array("unset"), $fp => 'resource', 11, "hello") +); + +// initialise the second array +$arr2 = array( 1 => "one", 2, "string" => "hello", "array" => array("a", "b", "c")); + +// loop through each sub array of $arrays and check the behavior of array_merge_recursive() +$iterator = 1; +foreach($arrays as $arr1) { + echo "-- Iteration $iterator --\n"; + + // with default argument + echo "-- With default argument --\n"; + var_dump( array_merge_recursive($arr1) ); + + // with more arguments + echo "-- With more arguments --\n"; + var_dump( array_merge_recursive($arr1, $arr2) ); + + $iterator++; +} + +// close the file resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_merge_recursive() : assoc. array with diff. keys to $arr1 argument *** + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d +-- Iteration 1 -- +-- With default argument -- +array(2) { + [0]=> + string(1) "0" + [1]=> + array(1) { + [1]=> + string(3) "one" + } +} +-- With more arguments -- +array(6) { + [0]=> + string(1) "0" + [1]=> + array(1) { + [1]=> + string(3) "one" + } + [2]=> + string(3) "one" + [3]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 2 -- +-- With default argument -- +array(2) { + [0]=> + string(1) "1" + [1]=> + array(4) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + int(1) + [4]=> + string(1) "4" + } +} +-- With more arguments -- +array(6) { + [0]=> + string(1) "1" + [1]=> + array(4) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + int(1) + [4]=> + string(1) "4" + } + [2]=> + string(3) "one" + [3]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 3 -- +-- With default argument -- +array(2) { + [0]=> + string(5) "float" + [1]=> + array(1) { + [1]=> + string(5) "float" + } +} +-- With more arguments -- +array(6) { + [0]=> + string(5) "float" + [1]=> + array(1) { + [1]=> + string(5) "float" + } + [2]=> + string(3) "one" + [3]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 4 -- +-- With default argument -- +array(4) { + [0]=> + string(2) "f1" + [1]=> + string(2) "f2" + [2]=> + array(1) { + [1]=> + string(2) "f1" + } + [3]=> + string(2) "f4" +} +-- With more arguments -- +array(8) { + [0]=> + string(2) "f1" + [1]=> + string(2) "f2" + [2]=> + array(1) { + [1]=> + string(2) "f1" + } + [3]=> + string(2) "f4" + [4]=> + string(3) "one" + [5]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 5 -- +-- With default argument -- +array(3) { + ["\tHello"]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + } + ["\v\fworld"]=> + float(2.2) + ["pen\n"]=> + int(111) +} +-- With more arguments -- +array(7) { + ["\tHello"]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + } + ["\v\fworld"]=> + float(2.2) + ["pen\n"]=> + int(111) + [0]=> + string(3) "one" + [1]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 6 -- +-- With default argument -- +array(3) { + [" Hello"]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + } + [" world"]=> + float(2.2) + ["pen +"]=> + int(111) +} +-- With more arguments -- +array(7) { + [" Hello"]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + } + [" world"]=> + float(2.2) + ["pen +"]=> + int(111) + [0]=> + string(3) "one" + [1]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 7 -- +-- With default argument -- +array(3) { + [0]=> + string(5) "hello" + ["Hello world"]=> + array(2) { + [0]=> + string(7) "heredoc" + [1]=> + string(6) "string" + } + [1]=> + string(6) "string" +} +-- With more arguments -- +array(7) { + [0]=> + string(5) "hello" + ["Hello world"]=> + array(2) { + [0]=> + string(7) "heredoc" + [1]=> + string(6) "string" + } + [1]=> + string(6) "string" + [2]=> + string(3) "one" + [3]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 8 -- +-- With default argument -- +array(3) { + [""]=> + array(1) { + [0]=> + string(5) "unset" + } + [0]=> + int(11) + [1]=> + string(5) "hello" +} +-- With more arguments -- +array(7) { + [""]=> + array(1) { + [0]=> + string(5) "unset" + } + [0]=> + int(11) + [1]=> + string(5) "hello" + [2]=> + string(3) "one" + [3]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +Done diff --git a/ext/standard/tests/array/array_merge_recursive_variation5.phpt b/ext/standard/tests/array/array_merge_recursive_variation5.phpt new file mode 100644 index 0000000..3b25122 --- /dev/null +++ b/ext/standard/tests/array/array_merge_recursive_variation5.phpt @@ -0,0 +1,404 @@ +--TEST-- +Test array_merge_recursive() function : usage variations - associative array with different values +--FILE-- + 0, '1' => 0), + array("one" => 1, 'two' => 2, "three" => 1, 4 => 1), + + // arrays with float values +/*3*/ array("f1" => 2.3333, "f2" => 2.3333, "f3" => array(1.1, 2.22)), + array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => array(1.2, 'f4' => 1.2)), + + // arrays with string values +/*5*/ array(111 => "\tHello", "array" => "col\tor", 2 => "\v\fworld", 3.3 => "\tHello"), + array(111 => '\tHello', 'array' => 'col\tor', 2 => '\v\fworld', 3.3 => '\tHello'), + array(1 => "hello", "string" => $heredoc, $heredoc), + + // array with object, unset variable and resource variable +/*8*/ array(11 => new classA(), "string" => @$unset_var, "resource" => $fp, new classA(), $fp), +); + +// initialise the second array +$arr2 = array( 1 => "one", 2, "string" => "hello", "array" => array("a", "b", "c")); + +// loop through each sub array of $arrays and check the behavior of array_merge_recursive() +$iterator = 1; +foreach($arrays as $arr1) { + echo "-- Iteration $iterator --\n"; + + // with default argument + echo "-- With default argument --\n"; + var_dump( array_merge_recursive($arr1) ); + + // with more arguments + echo "-- With more arguments --\n"; + var_dump( array_merge_recursive($arr1, $arr2) ); + + $iterator++; +} + +// close the file resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_merge_recursive() : assoc. array with diff. values to $arr1 argument *** +-- Iteration 1 -- +-- With default argument -- +array(2) { + [0]=> + int(0) + [1]=> + int(0) +} +-- With more arguments -- +array(6) { + [0]=> + int(0) + [1]=> + int(0) + [2]=> + string(3) "one" + [3]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 2 -- +-- With default argument -- +array(4) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(1) + [0]=> + int(1) +} +-- With more arguments -- +array(8) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(1) + [0]=> + int(1) + [1]=> + string(3) "one" + [2]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 3 -- +-- With default argument -- +array(3) { + ["f1"]=> + float(2.3333) + ["f2"]=> + float(2.3333) + ["f3"]=> + array(2) { + [0]=> + float(1.1) + [1]=> + float(2.22) + } +} +-- With more arguments -- +array(7) { + ["f1"]=> + float(2.3333) + ["f2"]=> + float(2.3333) + ["f3"]=> + array(2) { + [0]=> + float(1.1) + [1]=> + float(2.22) + } + [0]=> + string(3) "one" + [1]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 4 -- +-- With default argument -- +array(4) { + ["f1"]=> + float(1.2) + ["f2"]=> + float(3.33) + [0]=> + float(4.8999992284) + ["f4"]=> + array(2) { + [0]=> + float(1.2) + ["f4"]=> + float(1.2) + } +} +-- With more arguments -- +array(8) { + ["f1"]=> + float(1.2) + ["f2"]=> + float(3.33) + [0]=> + float(4.8999992284) + ["f4"]=> + array(2) { + [0]=> + float(1.2) + ["f4"]=> + float(1.2) + } + [1]=> + string(3) "one" + [2]=> + int(2) + ["string"]=> + string(5) "hello" + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 5 -- +-- With default argument -- +array(4) { + [0]=> + string(6) " Hello" + ["array"]=> + string(6) "col or" + [1]=> + string(7) " world" + [2]=> + string(6) " Hello" +} +-- With more arguments -- +array(7) { + [0]=> + string(6) " Hello" + ["array"]=> + array(4) { + [0]=> + string(6) "col or" + [1]=> + string(1) "a" + [2]=> + string(1) "b" + [3]=> + string(1) "c" + } + [1]=> + string(7) " world" + [2]=> + string(6) " Hello" + [3]=> + string(3) "one" + [4]=> + int(2) + ["string"]=> + string(5) "hello" +} +-- Iteration 6 -- +-- With default argument -- +array(4) { + [0]=> + string(7) "\tHello" + ["array"]=> + string(7) "col\tor" + [1]=> + string(9) "\v\fworld" + [2]=> + string(7) "\tHello" +} +-- With more arguments -- +array(7) { + [0]=> + string(7) "\tHello" + ["array"]=> + array(4) { + [0]=> + string(7) "col\tor" + [1]=> + string(1) "a" + [2]=> + string(1) "b" + [3]=> + string(1) "c" + } + [1]=> + string(9) "\v\fworld" + [2]=> + string(7) "\tHello" + [3]=> + string(3) "one" + [4]=> + int(2) + ["string"]=> + string(5) "hello" +} +-- Iteration 7 -- +-- With default argument -- +array(3) { + [0]=> + string(5) "hello" + ["string"]=> + string(11) "Hello world" + [1]=> + string(11) "Hello world" +} +-- With more arguments -- +array(6) { + [0]=> + string(5) "hello" + ["string"]=> + array(2) { + [0]=> + string(11) "Hello world" + [1]=> + string(5) "hello" + } + [1]=> + string(11) "Hello world" + [2]=> + string(3) "one" + [3]=> + int(2) + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +-- Iteration 8 -- +-- With default argument -- +array(5) { + [0]=> + object(classA)#%d (0) { + } + ["string"]=> + NULL + ["resource"]=> + resource(%d) of type (stream) + [1]=> + object(classA)#%d (0) { + } + [2]=> + resource(%d) of type (stream) +} +-- With more arguments -- +array(8) { + [0]=> + object(classA)#%d (0) { + } + ["string"]=> + array(2) { + [0]=> + NULL + [1]=> + string(5) "hello" + } + ["resource"]=> + resource(%d) of type (stream) + [1]=> + object(classA)#%d (0) { + } + [2]=> + resource(%d) of type (stream) + [3]=> + string(3) "one" + [4]=> + int(2) + ["array"]=> + array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + } +} +Done diff --git a/ext/standard/tests/array/array_merge_recursive_variation6.phpt b/ext/standard/tests/array/array_merge_recursive_variation6.phpt new file mode 100644 index 0000000..8e460ba --- /dev/null +++ b/ext/standard/tests/array/array_merge_recursive_variation6.phpt @@ -0,0 +1,113 @@ +--TEST-- +Test array_merge_recursive() function : usage variations - array with duplicate keys +--FILE-- + "one", 2 => "two", 2 => array(1, 2), 3 => "three", 1 => array("duplicate", 'strings')); +// array with string keys +$arr1_string_key = array("str1" => "hello", "str2" => 111, "str1" => "world", "str2" => 111.111); + +// initialize the second argument +$arr2 = array("one", "str1" => "two", array("one", "two")); + +echo "-- With default argument --\n"; +var_dump( array_merge_recursive($arr1_numeric_key) ); +var_dump( array_merge_recursive($arr1_string_key) ); + +echo "-- With more arguments --\n"; +var_dump( array_merge_recursive($arr1_numeric_key, $arr2) ); +var_dump( array_merge_recursive($arr1_string_key, $arr2) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_merge_recursive() : array with duplicate keys for $arr1 argument *** +-- With default argument -- +array(3) { + [0]=> + array(2) { + [0]=> + string(9) "duplicate" + [1]=> + string(7) "strings" + } + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [2]=> + string(5) "three" +} +array(2) { + ["str1"]=> + string(5) "world" + ["str2"]=> + float(111.111) +} +-- With more arguments -- +array(6) { + [0]=> + array(2) { + [0]=> + string(9) "duplicate" + [1]=> + string(7) "strings" + } + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [2]=> + string(5) "three" + [3]=> + string(3) "one" + ["str1"]=> + string(3) "two" + [4]=> + array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + } +} +array(4) { + ["str1"]=> + array(2) { + [0]=> + string(5) "world" + [1]=> + string(3) "two" + } + ["str2"]=> + float(111.111) + [0]=> + string(3) "one" + [1]=> + array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + } +} +Done diff --git a/ext/standard/tests/array/array_merge_recursive_variation7.phpt b/ext/standard/tests/array/array_merge_recursive_variation7.phpt new file mode 100644 index 0000000..b244e7d --- /dev/null +++ b/ext/standard/tests/array/array_merge_recursive_variation7.phpt @@ -0,0 +1,82 @@ +--TEST-- +Test array_merge_recursive() function : usage variations - array with reference variables +--FILE-- + 0, + 1 => &$value4, + 2 => &$value2, + 3 => "hello", + 4 => &$value3, + $value4 => &$value2 +); + +// initialize the second argument +$arr2 = array($value4 => "hello", &$value2); + +echo "-- With default argument --\n"; +var_dump( array_merge_recursive($arr1) ); + +echo "-- With more arguments --\n"; +var_dump( array_merge_recursive($arr1, $arr2) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_merge_recursive() : array with reference variables for $arr1 argument *** +-- With default argument -- +array(6) { + [0]=> + int(0) + [1]=> + &string(5) "hello" + [2]=> + &string(5) "hello" + [3]=> + string(5) "hello" + [4]=> + &int(0) + ["hello"]=> + &string(5) "hello" +} +-- With more arguments -- +array(7) { + [0]=> + int(0) + [1]=> + &string(5) "hello" + [2]=> + &string(5) "hello" + [3]=> + string(5) "hello" + [4]=> + &int(0) + ["hello"]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "hello" + } + [5]=> + &string(5) "hello" +} +Done diff --git a/ext/standard/tests/array/array_merge_recursive_variation8.phpt b/ext/standard/tests/array/array_merge_recursive_variation8.phpt new file mode 100644 index 0000000..6ad2f69 --- /dev/null +++ b/ext/standard/tests/array/array_merge_recursive_variation8.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test array_merge_recursive() function : usage variations - binary safe checking +--FILE-- + "hello", b"world", "str1" => b"hello", "str2" => "world"); + +// initialize the second argument +$arr2 = array(b"str1" => b"binary", b"hello" => "binary", b"str2" => b"binary"); + +echo "-- With default argument --\n"; +var_dump( array_merge_recursive($arr1) ); + +echo "-- With more arguments --\n"; +var_dump( array_merge_recursive($arr1, $arr2) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_merge_recursive() : array with binary data for $arr1 argument *** +-- With default argument -- +array(5) { + [0]=> + string(1) "1" + ["hello"]=> + string(5) "hello" + [1]=> + string(5) "world" + ["str1"]=> + string(5) "hello" + ["str2"]=> + string(5) "world" +} +-- With more arguments -- +array(5) { + [0]=> + string(1) "1" + ["hello"]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(6) "binary" + } + [1]=> + string(5) "world" + ["str1"]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(6) "binary" + } + ["str2"]=> + array(2) { + [0]=> + string(5) "world" + [1]=> + string(6) "binary" + } +} +Done diff --git a/ext/standard/tests/array/array_merge_recursive_variation9.phpt b/ext/standard/tests/array/array_merge_recursive_variation9.phpt new file mode 100644 index 0000000..d51d2f8 --- /dev/null +++ b/ext/standard/tests/array/array_merge_recursive_variation9.phpt @@ -0,0 +1,117 @@ +--TEST-- +Test array_merge_recursive() function : usage variations - common key and value(Bug#43559) +--FILE-- + 1, "b" => 2); +$arr2 = array("b" => 2, "c" => 4); +echo "-- Integer values --\n"; +var_dump( array_merge_recursive($arr1, $arr2) ); + +// float values +$arr1 = array("a" => 1.1, "b" => 2.2); +$arr2 = array("b" => 2.2, "c" => 3.3); +echo "-- Float values --\n"; +var_dump( array_merge_recursive($arr1, $arr2) ); + +// string values +$arr1 = array("a" => "hello", "b" => "world"); +$arr2 = array("b" => "world", "c" => "string"); +echo "-- String values --\n"; +var_dump( array_merge_recursive($arr1, $arr2) ); + +// boolean values +$arr1 = array("a" => true, "b" => false); +$arr2 = array("b" => false); +echo "-- Boolean values --\n"; +var_dump( array_merge_recursive($arr1, $arr2) ); + +// null values +$arr1 = array( "a" => NULL); +$arr2 = array( "a" => NULL); +echo "-- Null values --\n"; +var_dump( array_merge_recursive($arr1, $arr2) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_merge_recursive() : arrays with common key and value *** +-- Integer values -- +array(3) { + ["a"]=> + int(1) + ["b"]=> + array(2) { + [0]=> + int(2) + [1]=> + int(2) + } + ["c"]=> + int(4) +} +-- Float values -- +array(3) { + ["a"]=> + float(1.1) + ["b"]=> + array(2) { + [0]=> + float(2.2) + [1]=> + float(2.2) + } + ["c"]=> + float(3.3) +} +-- String values -- +array(3) { + ["a"]=> + string(5) "hello" + ["b"]=> + array(2) { + [0]=> + string(5) "world" + [1]=> + string(5) "world" + } + ["c"]=> + string(6) "string" +} +-- Boolean values -- +array(2) { + ["a"]=> + bool(true) + ["b"]=> + array(2) { + [0]=> + bool(false) + [1]=> + bool(false) + } +} +-- Null values -- +array(1) { + ["a"]=> + array(2) { + [0]=> + NULL + [1]=> + NULL + } +} +Done diff --git a/ext/standard/tests/array/array_merge_variation1.phpt b/ext/standard/tests/array/array_merge_variation1.phpt new file mode 100644 index 0000000..1ce71de --- /dev/null +++ b/ext/standard/tests/array/array_merge_variation1.phpt @@ -0,0 +1,231 @@ +--TEST-- +Test array_merge() function : usage variations - Pass different data types to $arr1 arg +--FILE-- + + +--EXPECTF-- +*** Testing array_merge() : usage variations *** + +-- Iteration 1 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 18 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + +-- Iteration 19 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: array_merge(): Argument #1 is not an array in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_merge_variation10.phpt b/ext/standard/tests/array/array_merge_variation10.phpt new file mode 100644 index 0000000..7f08a4b --- /dev/null +++ b/ext/standard/tests/array/array_merge_variation10.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test array_merge() function : usage variations - position of internal array pointer +--FILE-- + " . current($result) . "\n"; + +echo "\n-- Position of Internal Pointer in Original Array: --\n"; +echo "\$arr1: "; +echo key($arr1) . " => " . current ($arr1) . "\n"; +echo "\$arr2: "; +echo key($arr2) . " => " . current ($arr2) . "\n"; +echo "\$arr3: "; +echo key($arr3) . " => " . current ($arr3) . "\n"; + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_merge() : usage variations *** + +-- Call array_merge() -- +array(9) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(4) "zero" + [4]=> + string(2) "un" + [5]=> + string(4) "deux" + [6]=> + string(4) "null" + [7]=> + string(4) "eins" + [8]=> + string(4) "zwei" +} + +-- Position of Internal Pointer in Result: -- +0 => zero + +-- Position of Internal Pointer in Original Array: -- +$arr1: 0 => zero +$arr2: 0 => zero +$arr3: 0 => null +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_merge_variation2.phpt b/ext/standard/tests/array/array_merge_variation2.phpt new file mode 100644 index 0000000..4ebbeb9 --- /dev/null +++ b/ext/standard/tests/array/array_merge_variation2.phpt @@ -0,0 +1,230 @@ +--TEST-- +Test array_merge() function : usage variations - Pass different data types as $arr2 arg +--FILE-- + +--EXPECTF-- +*** Testing array_merge() : usage variations *** + +-- Iteration 1 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 18 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + +-- Iteration 19 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: array_merge(): Argument #2 is not an array in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_merge_variation3.phpt b/ext/standard/tests/array/array_merge_variation3.phpt new file mode 100644 index 0000000..717968a --- /dev/null +++ b/ext/standard/tests/array/array_merge_variation3.phpt @@ -0,0 +1,379 @@ +--TEST-- +Test array_merge() function : usage variations - arrays of diff. data types +--FILE-- + array( + 0, + 1, + 12345, + -2345, + ), + + // float data +/*2*/ 'float' => array( + 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + ), + + // null data +/*3*/ 'null' => array( + NULL, + null, + ), + + // boolean data +/*4*/ 'bool' => array( + true, + false, + TRUE, + FALSE, + ), + + // empty data +/*5*/ 'empty string' => array( + "", + '', + ), + +/*6*/ 'empty array' => array( + ), + + // string data +/*7*/ 'string' => array( + "string", + 'string', + $heredoc, + ), + + // object data +/*8*/ 'object' => array( + new classA(), + ), + + // undefined data +/*9*/ 'undefined' => array( + @$undefined_var, + ), + + // unset data +/*10*/ 'unset' => array( + @$unset_var, + ), + + // resource variable +/*11*/ 'resource' => array( + $fp + ), +); + +// loop through each element of $inputs to check the behavior of array_merge +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator: $key data --\n"; + var_dump( array_merge($input, $arr) ); + var_dump( array_merge($arr, $input) ); + $iterator++; +}; + +fclose($fp); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_merge() : usage variations *** + +-- Iteration 1: int data -- +array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(12345) + [3]=> + int(-2345) + [4]=> + int(1) + [5]=> + int(2) +} +array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(0) + [3]=> + int(1) + [4]=> + int(12345) + [5]=> + int(-2345) +} + +-- Iteration 2: float data -- +array(7) { + [0]=> + float(10.5) + [1]=> + float(-10.5) + [2]=> + float(123456789000) + [3]=> + float(1.23456789E-9) + [4]=> + float(0.5) + [5]=> + int(1) + [6]=> + int(2) +} +array(7) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + float(10.5) + [3]=> + float(-10.5) + [4]=> + float(123456789000) + [5]=> + float(1.23456789E-9) + [6]=> + float(0.5) +} + +-- Iteration 3: null data -- +array(4) { + [0]=> + NULL + [1]=> + NULL + [2]=> + int(1) + [3]=> + int(2) +} +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + NULL + [3]=> + NULL +} + +-- Iteration 4: bool data -- +array(6) { + [0]=> + bool(true) + [1]=> + bool(false) + [2]=> + bool(true) + [3]=> + bool(false) + [4]=> + int(1) + [5]=> + int(2) +} +array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + bool(true) + [3]=> + bool(false) + [4]=> + bool(true) + [5]=> + bool(false) +} + +-- Iteration 5: empty string data -- +array(4) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + int(1) + [3]=> + int(2) +} +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(0) "" + [3]=> + string(0) "" +} + +-- Iteration 6: empty array data -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + +-- Iteration 7: string data -- +array(5) { + [0]=> + string(6) "string" + [1]=> + string(6) "string" + [2]=> + string(11) "hello world" + [3]=> + int(1) + [4]=> + int(2) +} +array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(6) "string" + [3]=> + string(6) "string" + [4]=> + string(11) "hello world" +} + +-- Iteration 8: object data -- +array(3) { + [0]=> + object(classA)#%d (0) { + } + [1]=> + int(1) + [2]=> + int(2) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + object(classA)#%d (0) { + } +} + +-- Iteration 9: undefined data -- +array(3) { + [0]=> + NULL + [1]=> + int(1) + [2]=> + int(2) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + NULL +} + +-- Iteration 10: unset data -- +array(3) { + [0]=> + NULL + [1]=> + int(1) + [2]=> + int(2) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + NULL +} + +-- Iteration 11: resource data -- +array(3) { + [0]=> + resource(%d) of type (stream) + [1]=> + int(1) + [2]=> + int(2) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + resource(%d) of type (stream) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_merge_variation4.phpt b/ext/standard/tests/array/array_merge_variation4.phpt new file mode 100644 index 0000000..e4eb257 --- /dev/null +++ b/ext/standard/tests/array/array_merge_variation4.phpt @@ -0,0 +1,368 @@ +--TEST-- +Test array_merge() function : usage variations - Diff. data types as array keys +--FILE-- + 1, 'two' => 2); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// heredoc string +$heredoc = << array( + 0 => 'zero', + 1 => 'one', + 12345 => 'positive', + -2345 => 'negative', + ), + + // float data +/*2*/ 'float' => array( + 10.5 => 'positive', + -10.5 => 'negative', + .5 => 'half', + ), + +/*3*/ 'extreme floats' => array( + 12.3456789000e10 => 'large', + 12.3456789000E-10 => 'small', + ), + + // null data +/*4*/ 'null uppercase' => array( + NULL => 'null 1', + ), + +/*5*/ 'null lowercase' => array( + null => 'null 2', + ), + + // boolean data +/*6*/ 'bool lowercase' => array( + true => 'lowert', + false => 'lowerf', + ), + +/*7*/ 'bool uppercase' => array( + TRUE => 'uppert', + FALSE => 'upperf', + ), + + // empty data +/*8*/ 'empty double quotes' => array( + "" => 'emptyd', + ), + +/*9*/ 'empty single quotes' => array( + '' => 'emptys', + ), + + // string data +/*10*/ 'string' => array( + "stringd" => 'stringd', + 'strings' => 'strings', + $heredoc => 'stringh', + ), + + // undefined data +/*11*/ 'undefined' => array( + @$undefined_var => 'undefined', + ), + + // unset data +/*12*/ 'unset' => array( + @$unset_var => 'unset', + ), +); + +// loop through each element of $inputs to check the behavior of array_merge +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator: $key data --\n"; + var_dump( array_merge($input, $arr) ); + var_dump( array_merge($arr, $input) ); + $iterator++; +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_merge() : usage variations *** + +-- Iteration 1: int data -- +array(6) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + string(8) "positive" + [3]=> + string(8) "negative" + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(6) { + ["one"]=> + int(1) + ["two"]=> + int(2) + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + string(8) "positive" + [3]=> + string(8) "negative" +} + +-- Iteration 2: float data -- +array(5) { + [0]=> + string(8) "positive" + [1]=> + string(8) "negative" + [2]=> + string(4) "half" + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(5) { + ["one"]=> + int(1) + ["two"]=> + int(2) + [0]=> + string(8) "positive" + [1]=> + string(8) "negative" + [2]=> + string(4) "half" +} + +-- Iteration 3: extreme floats data -- +array(4) { + [0]=> + string(5) "large" + [1]=> + string(5) "small" + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(4) { + ["one"]=> + int(1) + ["two"]=> + int(2) + [0]=> + string(5) "large" + [1]=> + string(5) "small" +} + +-- Iteration 4: null uppercase data -- +array(3) { + [""]=> + string(6) "null 1" + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + [""]=> + string(6) "null 1" +} + +-- Iteration 5: null lowercase data -- +array(3) { + [""]=> + string(6) "null 2" + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + [""]=> + string(6) "null 2" +} + +-- Iteration 6: bool lowercase data -- +array(4) { + [0]=> + string(6) "lowert" + [1]=> + string(6) "lowerf" + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(4) { + ["one"]=> + int(1) + ["two"]=> + int(2) + [0]=> + string(6) "lowert" + [1]=> + string(6) "lowerf" +} + +-- Iteration 7: bool uppercase data -- +array(4) { + [0]=> + string(6) "uppert" + [1]=> + string(6) "upperf" + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(4) { + ["one"]=> + int(1) + ["two"]=> + int(2) + [0]=> + string(6) "uppert" + [1]=> + string(6) "upperf" +} + +-- Iteration 8: empty double quotes data -- +array(3) { + [""]=> + string(6) "emptyd" + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + [""]=> + string(6) "emptyd" +} + +-- Iteration 9: empty single quotes data -- +array(3) { + [""]=> + string(6) "emptys" + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + [""]=> + string(6) "emptys" +} + +-- Iteration 10: string data -- +array(5) { + ["stringd"]=> + string(7) "stringd" + ["strings"]=> + string(7) "strings" + ["hello world"]=> + string(7) "stringh" + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(5) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["stringd"]=> + string(7) "stringd" + ["strings"]=> + string(7) "strings" + ["hello world"]=> + string(7) "stringh" +} + +-- Iteration 11: undefined data -- +array(3) { + [""]=> + string(9) "undefined" + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + [""]=> + string(9) "undefined" +} + +-- Iteration 12: unset data -- +array(3) { + [""]=> + string(5) "unset" + ["one"]=> + int(1) + ["two"]=> + int(2) +} +array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + [""]=> + string(5) "unset" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_merge_variation5.phpt b/ext/standard/tests/array/array_merge_variation5.phpt new file mode 100644 index 0000000..eca6078 --- /dev/null +++ b/ext/standard/tests/array/array_merge_variation5.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test array_merge() function : usage variations - numeric keys +--FILE-- + 'one', 20 => 'twenty', 30 => 'thirty'); + +var_dump(array_merge($arr1, $arr2)); +var_dump(array_merge($arr2, $arr1)); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_merge() : usage variations *** +array(7) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" + [4]=> + string(3) "one" + [5]=> + string(6) "twenty" + [6]=> + string(6) "thirty" +} +array(7) { + [0]=> + string(3) "one" + [1]=> + string(6) "twenty" + [2]=> + string(6) "thirty" + [3]=> + string(4) "zero" + [4]=> + string(3) "one" + [5]=> + string(3) "two" + [6]=> + string(5) "three" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_merge_variation6.phpt b/ext/standard/tests/array/array_merge_variation6.phpt new file mode 100644 index 0000000..13b346e --- /dev/null +++ b/ext/standard/tests/array/array_merge_variation6.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test array_merge() function : usage variations - string keys +--FILE-- + 'zero', 'one' => 'un', 'two' => 'deux'); +$arr2 = array('zero' => 'zero', 'un' => 'eins', 'deux' => 'zwei'); + +var_dump(array_merge($arr1, $arr2)); +var_dump(array_merge($arr2, $arr1)); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_merge() : usage variations *** +array(5) { + ["zero"]=> + string(4) "zero" + ["one"]=> + string(2) "un" + ["two"]=> + string(4) "deux" + ["un"]=> + string(4) "eins" + ["deux"]=> + string(4) "zwei" +} +array(5) { + ["zero"]=> + string(4) "zero" + ["un"]=> + string(4) "eins" + ["deux"]=> + string(4) "zwei" + ["one"]=> + string(2) "un" + ["two"]=> + string(4) "deux" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_merge_variation7.phpt b/ext/standard/tests/array/array_merge_variation7.phpt new file mode 100644 index 0000000..00943f3 --- /dev/null +++ b/ext/standard/tests/array/array_merge_variation7.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test array_merge() function : usage variations - Mixed keys +--FILE-- + 'twenty', 'thirty' => 30, true => 'bool'); +$arr2 = array(0, 1, 2, null => 'null', 1.234E-10 => 'float'); + +var_dump(array_merge($arr1, $arr2)); +var_dump(array_merge($arr2, $arr1)); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_merge() : usage variations *** +array(8) { + [0]=> + string(4) "zero" + [1]=> + string(6) "twenty" + ["thirty"]=> + int(30) + [2]=> + string(4) "bool" + [3]=> + string(5) "float" + [4]=> + int(1) + [5]=> + int(2) + [""]=> + string(4) "null" +} +array(8) { + [0]=> + string(5) "float" + [1]=> + int(1) + [2]=> + int(2) + [""]=> + string(4) "null" + [3]=> + string(4) "zero" + [4]=> + string(6) "twenty" + ["thirty"]=> + int(30) + [5]=> + string(4) "bool" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_merge_variation8.phpt b/ext/standard/tests/array/array_merge_variation8.phpt new file mode 100644 index 0000000..a4cdea7 --- /dev/null +++ b/ext/standard/tests/array/array_merge_variation8.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test array_merge() function : usage variations - multi-dimensional arrays +--FILE-- + + +--EXPECTF-- +*** Testing array_merge() : usage variations *** + +-- Merge a two-dimensional and a one-dimensional array -- +array(7) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + array(1) { + [0]=> + int(0) + } + [4]=> + int(1) + [5]=> + int(2) + [6]=> + int(3) +} + +-- Merge an array and a sub-array -- +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) +} +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(0) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_merge_variation9.phpt b/ext/standard/tests/array/array_merge_variation9.phpt new file mode 100644 index 0000000..69e0401 --- /dev/null +++ b/ext/standard/tests/array/array_merge_variation9.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test array_merge() function : usage variations - referenced variables +--FILE-- + 'val1', 'key2' => 'val2', 'key3' => 'val3'); + +echo "\n-- Merge an array made up of referenced variables to an assoc. array --\n"; +var_dump(array_merge($arr1, $arr2)); +var_dump(array_merge($arr2, $arr1)); + +$val2 = 'hello world'; + +echo "\n-- Change \$val2 --\n"; +var_dump(array_merge($arr1, $arr2)); +var_dump(array_merge($arr2, $arr1)); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_merge() : usage variations *** + +-- Merge an array made up of referenced variables to an assoc. array -- +array(6) { + [0]=> + &string(3) "foo" + [1]=> + &string(3) "bar" + [2]=> + &string(3) "baz" + ["key1"]=> + string(4) "val1" + ["key2"]=> + string(4) "val2" + ["key3"]=> + string(4) "val3" +} +array(6) { + ["key1"]=> + string(4) "val1" + ["key2"]=> + string(4) "val2" + ["key3"]=> + string(4) "val3" + [0]=> + &string(3) "foo" + [1]=> + &string(3) "bar" + [2]=> + &string(3) "baz" +} + +-- Change $val2 -- +array(6) { + [0]=> + &string(3) "foo" + [1]=> + &string(11) "hello world" + [2]=> + &string(3) "baz" + ["key1"]=> + string(4) "val1" + ["key2"]=> + string(4) "val2" + ["key3"]=> + string(4) "val3" +} +array(6) { + ["key1"]=> + string(4) "val1" + ["key2"]=> + string(4) "val2" + ["key3"]=> + string(4) "val3" + [0]=> + &string(3) "foo" + [1]=> + &string(11) "hello world" + [2]=> + &string(3) "baz" +} +Done diff --git a/ext/standard/tests/array/array_multisort_basic1.phpt b/ext/standard/tests/array/array_multisort_basic1.phpt new file mode 100644 index 0000000..ab7db94 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_basic1.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test array_multisort() function : basic functionality +--FILE-- + 2, "row2" => 1, "row3" => 1); +$ar2 = array("row1" => 2, "row2" => "aa", "row3" => "1"); + +echo "\n-- Testing array_multisort() function with all normal arguments --\n"; +var_dump( array_multisort($ar1, SORT_ASC, SORT_REGULAR, $ar2, SORT_DESC, SORT_STRING) ); +var_dump($ar1, $ar2); + +echo "\n-- Testing array_multisort() function with one argument --\n"; +var_dump( array_multisort($ar2) ); +var_dump($ar2); + + +?> +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : basic functionality *** + +-- Testing array_multisort() function with all normal arguments -- +bool(true) +array(3) { + ["row2"]=> + int(1) + ["row3"]=> + int(1) + ["row1"]=> + int(2) +} +array(3) { + ["row2"]=> + string(2) "aa" + ["row3"]=> + string(1) "1" + ["row1"]=> + int(2) +} + +-- Testing array_multisort() function with one argument -- +bool(true) +array(3) { + ["row3"]=> + string(1) "1" + ["row2"]=> + string(2) "aa" + ["row1"]=> + int(2) +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_multisort_basic2.phpt b/ext/standard/tests/array/array_multisort_basic2.phpt new file mode 100644 index 0000000..4a46072 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_basic2.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test array_multisort() function : basic functionality +--FILE-- + 2, 1, 9 => 1); +$ar2 = array( 2, "aa" , "1"); + +echo "\n-- Testing array_multisort() function with all normal arguments --\n"; +var_dump( array_multisort($ar1, SORT_ASC, SORT_REGULAR, $ar2, SORT_ASC, SORT_NUMERIC) ); +var_dump($ar1, $ar2); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : basic functionality - renumbering of numeric keys *** + +-- Testing array_multisort() function with all normal arguments -- +bool(true) +array(3) { + [0]=> + int(1) + [1]=> + int(1) + ["strkey"]=> + int(2) +} +array(3) { + [0]=> + string(2) "aa" + [1]=> + string(1) "1" + [2]=> + int(2) +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_multisort_case.phpt b/ext/standard/tests/array/array_multisort_case.phpt new file mode 100644 index 0000000..6be42ed --- /dev/null +++ b/ext/standard/tests/array/array_multisort_case.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test array_multisort() function : case-sensitive +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : case-sensitive +array(7) { + [0]=> + string(7) "First.3" + [1]=> + string(7) "First.2" + [2]=> + string(7) "First.1" + [3]=> + string(5) "Tenth" + [4]=> + string(6) "Second" + [5]=> + string(9) "Twentieth" + [6]=> + string(5) "Third" +} +array(7) { + [0]=> + string(6) "1 BB 3" + [1]=> + string(6) "1 bB 2" + [2]=> + string(6) "1 bb 1" + [3]=> + string(4) "10 d" + [4]=> + string(3) "2 a" + [5]=> + string(4) "20 c" + [6]=> + string(3) "3 e" +} +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_error.phpt b/ext/standard/tests/array/array_multisort_error.phpt new file mode 100644 index 0000000..5956630 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_error.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test array_multisort() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : error conditions *** + +-- Testing array_multisort() function with Zero arguments -- + +Warning: array_multisort() expects at least 1 parameter, 0 given in %sarray_multisort_error.php on line %d +NULL + +-- Testing array_multisort() function with repeated flags -- + +Warning: array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified in %sarray_multisort_error.php on line %d +bool(false) + +-- Testing array_multisort() function with repeated flags -- + +Warning: array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified in %sarray_multisort_error.php on line %d +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_multisort_incase.phpt b/ext/standard/tests/array/array_multisort_incase.phpt new file mode 100644 index 0000000..951cce4 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_incase.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test array_multisort() function : case-insensitive +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : case-insensitive +array(7) { + [0]=> + string(7) "First.1" + [1]=> + string(7) "First.2" + [2]=> + string(7) "First.3" + [3]=> + string(5) "Tenth" + [4]=> + string(6) "Second" + [5]=> + string(9) "Twentieth" + [6]=> + string(5) "Third" +} +array(7) { + [0]=> + string(6) "1 bb 1" + [1]=> + string(6) "1 bB 2" + [2]=> + string(6) "1 BB 3" + [3]=> + string(4) "10 d" + [4]=> + string(3) "2 a" + [5]=> + string(4) "20 c" + [6]=> + string(3) "3 e" +} +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_natural.phpt b/ext/standard/tests/array/array_multisort_natural.phpt new file mode 100644 index 0000000..e791088 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_natural.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test array_multisort() function : natural sorting +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : natural sorting +array(5) { + [0]=> + string(5) "First" + [1]=> + string(6) "Second" + [2]=> + string(5) "Third" + [3]=> + string(5) "Tenth" + [4]=> + string(9) "Twentieth" +} +array(5) { + [0]=> + string(3) "1 b" + [1]=> + string(3) "2 a" + [2]=> + string(3) "3 e" + [3]=> + string(4) "10 d" + [4]=> + string(4) "20 c" +} +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_natural_case.phpt b/ext/standard/tests/array/array_multisort_natural_case.phpt new file mode 100644 index 0000000..d59e493 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_natural_case.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test array_multisort() function : natural sorting case-sensitive +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : natural sorting case-sensitive +array(7) { + [0]=> + string(7) "First.3" + [1]=> + string(7) "First.2" + [2]=> + string(7) "First.1" + [3]=> + string(6) "Second" + [4]=> + string(5) "Third" + [5]=> + string(5) "Tenth" + [6]=> + string(9) "Twentieth" +} +array(7) { + [0]=> + string(6) "1 BB 3" + [1]=> + string(6) "1 bB 2" + [2]=> + string(6) "1 bb 1" + [3]=> + string(3) "2 a" + [4]=> + string(3) "3 e" + [5]=> + string(4) "10 d" + [6]=> + string(4) "20 c" +} +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_natural_incase.phpt b/ext/standard/tests/array/array_multisort_natural_incase.phpt new file mode 100644 index 0000000..8751405 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_natural_incase.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test array_multisort() function : natural sorting case-insensitive +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : natural sorting case-insensitive +array(7) { + [0]=> + string(7) "First.1" + [1]=> + string(7) "First.2" + [2]=> + string(7) "First.3" + [3]=> + string(6) "Second" + [4]=> + string(5) "Third" + [5]=> + string(5) "Tenth" + [6]=> + string(9) "Twentieth" +} +array(7) { + [0]=> + string(6) "1 bb 1" + [1]=> + string(6) "1 bB 2" + [2]=> + string(6) "1 BB 3" + [3]=> + string(3) "2 a" + [4]=> + string(3) "3 e" + [5]=> + string(4) "10 d" + [6]=> + string(4) "20 c" +} +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation1.phpt b/ext/standard/tests/array/array_multisort_variation1.phpt new file mode 100644 index 0000000..93c2659 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_variation1.phpt @@ -0,0 +1,207 @@ +--TEST-- +Test array_multisort() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for ar1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_multisort($value)); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : usage variation *** + +--int 0-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation1.php(%d) +bool(false) + +--int 1-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation1.php(%d) +bool(false) + +--int 12345-- +Error: 2 - array_multisort(): Argument #1 is an unknown sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--int -12345-- +Error: 2 - array_multisort(): Argument #1 is an unknown sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--float 10.5-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--float -10.5-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--float 12.3456789000e10-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--float -12.3456789000e10-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--float .5-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--uppercase NULL-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--lowercase null-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--lowercase true-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--lowercase false-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--uppercase TRUE-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--uppercase FALSE-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--empty string DQ-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--empty string SQ-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--string DQ-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--string SQ-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--mixed case string-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--heredoc-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--instance of classWithToString-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--instance of classWithoutToString-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--undefined var-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) + +--unset var-- +Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_multisort_variation10.phpt b/ext/standard/tests/array/array_multisort_variation10.phpt new file mode 100644 index 0000000..71c4494 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_variation10.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test array_multisort() function : usage variation - testing with anonymous arrary arguments +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : Testing with anonymous arguments *** +bool(true) +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation11.phpt b/ext/standard/tests/array/array_multisort_variation11.phpt new file mode 100644 index 0000000..046b45f --- /dev/null +++ b/ext/standard/tests/array/array_multisort_variation11.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test array_multisort() function : usage variation - testing with empty array +--FILE-- + +===DONE=== + +--EXPECTF-- +*** Testing array_multisort() : Testing with empty array *** +bool(true) +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation2.phpt b/ext/standard/tests/array/array_multisort_variation2.phpt new file mode 100644 index 0000000..86210ee --- /dev/null +++ b/ext/standard/tests/array/array_multisort_variation2.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_multisort() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_NATURAL|SORT_FLAG_CASE]] + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_multisort($ar1, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : usage variation *** + +--int 0-- +bool(true) + +--int 1-- +bool(true) + +--int 12345-- +Error: 2 - array_multisort(): Argument #2 is an unknown sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--int -12345-- +Error: 2 - array_multisort(): Argument #2 is an unknown sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--float 10.5-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--float -10.5-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--float 12.3456789000e10-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--float -12.3456789000e10-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--float .5-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--empty array-- +Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d) +bool(false) + +--int indexed array-- +Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d) +bool(false) + +--associative array-- +bool(true) + +--nested arrays-- +Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d) +bool(false) + +--uppercase NULL-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--lowercase null-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--lowercase true-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--lowercase false-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--uppercase TRUE-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--uppercase FALSE-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--empty string DQ-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--empty string SQ-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--string DQ-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--string SQ-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--mixed case string-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--heredoc-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--instance of classWithToString-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--instance of classWithoutToString-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--undefined var-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) + +--unset var-- +Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) +bool(false) +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation3.phpt b/ext/standard/tests/array/array_multisort_variation3.phpt new file mode 100644 index 0000000..b2cdb05 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_variation3.phpt @@ -0,0 +1,208 @@ +--TEST-- +Test array_multisort() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for ar2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_multisort($ar1, SORT_REGULAR, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : usage variation *** + +--int 0-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation3.php(%d) +bool(false) + +--int 1-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation3.php(%d) +bool(false) + +--int 12345-- +Error: 2 - array_multisort(): Argument #3 is an unknown sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--int -12345-- +Error: 2 - array_multisort(): Argument #3 is an unknown sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--float 10.5-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--float -10.5-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--float 12.3456789000e10-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--float -12.3456789000e10-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--float .5-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--uppercase NULL-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--lowercase null-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--lowercase true-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--lowercase false-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--uppercase TRUE-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--uppercase FALSE-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--empty string DQ-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--empty string SQ-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--string DQ-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--string SQ-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--mixed case string-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--heredoc-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--instance of classWithToString-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--instance of classWithoutToString-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--undefined var-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) + +--unset var-- +Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) +bool(false) +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation4.phpt b/ext/standard/tests/array/array_multisort_variation4.phpt new file mode 100644 index 0000000..5d11fb3 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_variation4.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test array_multisort() function : usage variation - testing with multiple array arguments +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : Testing with multiple array arguments *** +bool(true) +array(4) { + [0]=> + int(3) + [1]=> + int(3) + [2]=> + int(3) + [3]=> + int(4) +} +array(4) { + [0]=> + int(2) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(9) +} +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(9) + [3]=> + int(9) +} +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation5.phpt b/ext/standard/tests/array/array_multisort_variation5.phpt new file mode 100644 index 0000000..76d7092 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_variation5.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test array_multisort() function : usage variation - testing with multiple array arguments +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : Testing all array sort specifiers *** +array(3) { + [0]=> + string(1) "1" + [1]=> + string(2) "aa" + [2]=> + int(2) +} +array(3) { + [0]=> + string(1) "1" + [1]=> + int(2) + [2]=> + string(2) "aa" +} +array(3) { + [0]=> + string(2) "aa" + [1]=> + string(1) "1" + [2]=> + int(2) +} +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation6.phpt b/ext/standard/tests/array/array_multisort_variation6.phpt new file mode 100644 index 0000000..4e2a622 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_variation6.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test array_multisort() function : usage variation - testing with multiple array arguments +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : Testing all array sort specifiers *** +array(3) { + [0]=> + int(2) + [1]=> + string(2) "aa" + [2]=> + string(1) "1" +} +array(3) { + [0]=> + string(2) "aa" + [1]=> + int(2) + [2]=> + string(1) "1" +} +array(3) { + [0]=> + int(2) + [1]=> + string(1) "1" + [2]=> + string(2) "aa" +} +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation7.phpt b/ext/standard/tests/array/array_multisort_variation7.phpt new file mode 100644 index 0000000..4e9feb5 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_variation7.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test array_multisort() function : usage variation - test sort order of all types +--FILE-- + 0, + 'float -10.5' => -10.5, + array(), + 'uppercase NULL' => NULL, + 'lowercase true' => true, + 'empty string DQ' => "", + 'string DQ' => "string", + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + 'undefined var' => @$undefined_var, +); + +var_dump(array_multisort($inputs)); +var_dump($inputs); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : usage variation - test sort order of all types*** +bool(true) +array(10) { + ["empty string DQ"]=> + string(0) "" + ["int 0"]=> + int(0) + ["uppercase NULL"]=> + NULL + ["undefined var"]=> + NULL + [0]=> + array(0) { + } + ["instance of classWithToString"]=> + object(classWithToString)#1 (0) { + } + ["instance of classWithoutToString"]=> + object(classWithoutToString)#2 (0) { + } + ["lowercase true"]=> + bool(true) + ["float -10.5"]=> + float(-10.5) + ["string DQ"]=> + string(6) "string" +} +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation8.phpt b/ext/standard/tests/array/array_multisort_variation8.phpt new file mode 100644 index 0000000..1995ee8 --- /dev/null +++ b/ext/standard/tests/array/array_multisort_variation8.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test array_multisort() function : usage variation - test sort order of all types +--FILE-- + 0, + 'float -10.5' => -10.5, + array(), + 'uppercase NULL' => NULL, + 'lowercase true' => true, + 'empty string DQ' => "", + 'string DQ' => "string", + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + 'undefined var' => @$undefined_var, +); + +var_dump(array_multisort($inputs, SORT_STRING)); +var_dump($inputs); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : usage variation - test sort order of all types*** +bool(true) +array(10) { + ["empty string DQ"]=> + string(0) "" + ["uppercase NULL"]=> + NULL + ["undefined var"]=> + NULL + ["instance of classWithoutToString"]=> + object(classWithoutToString)#2 (0) { + } + ["float -10.5"]=> + float(-10.5) + ["int 0"]=> + int(0) + ["lowercase true"]=> + bool(true) + [0]=> + array(0) { + } + ["instance of classWithToString"]=> + object(classWithToString)#1 (0) { + } + ["string DQ"]=> + string(6) "string" +} +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation9.phpt b/ext/standard/tests/array/array_multisort_variation9.phpt new file mode 100644 index 0000000..b56357a --- /dev/null +++ b/ext/standard/tests/array/array_multisort_variation9.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test array_multisort() function : usage variation - test sort order of all types +--FILE-- + 0, + 'float -10.5' => -10.5, + array(), + 'uppercase NULL' => NULL, + 'lowercase true' => true, + 'empty string DQ' => "", + 'string DQ' => "string", + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + 'undefined var' => @$undefined_var, +); + +var_dump(array_multisort($inputs, SORT_NUMERIC)); +var_dump($inputs); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_multisort() : usage variation - test sort order of all types*** + +Notice: Object of class classWithToString could not be converted to double in %sarray_multisort_variation9.php on line %d + +Notice: Object of class classWithoutToString could not be converted to double in %sarray_multisort_variation9.php on line %d + +Notice: Object of class classWithoutToString could not be converted to double in %sarray_multisort_variation9.php on line %d + +Notice: Object of class classWithoutToString could not be converted to double in %sarray_multisort_variation9.php on line %d + +Notice: Object of class classWithoutToString could not be converted to double in %sarray_multisort_variation9.php on line %d +bool(true) +array(10) { + ["float -10.5"]=> + float(-10.5) + ["string DQ"]=> + string(6) "string" + ["undefined var"]=> + NULL + ["empty string DQ"]=> + string(0) "" + ["uppercase NULL"]=> + NULL + ["int 0"]=> + int(0) + [0]=> + array(0) { + } + ["instance of classWithoutToString"]=> + object(classWithoutToString)#2 (0) { + } + ["lowercase true"]=> + bool(true) + ["instance of classWithToString"]=> + object(classWithToString)#1 (0) { + } +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_next_error1.phpt b/ext/standard/tests/array/array_next_error1.phpt new file mode 100644 index 0000000..72f2cb9 --- /dev/null +++ b/ext/standard/tests/array/array_next_error1.phpt @@ -0,0 +1,13 @@ +--TEST-- +next - ensure warning is received when passing an indirect temporary. +--FILE-- + +--EXPECTF-- + +Strict Standards: Only variables should be passed by reference in %s on line %d +int(2) \ No newline at end of file diff --git a/ext/standard/tests/array/array_next_error2.phpt b/ext/standard/tests/array/array_next_error2.phpt new file mode 100644 index 0000000..d4f1666 --- /dev/null +++ b/ext/standard/tests/array/array_next_error2.phpt @@ -0,0 +1,12 @@ +--TEST-- +next - ensure we cannot pass a temporary +--FILE-- + +--EXPECTF-- + +Fatal error: Only variables can be passed by reference in %s on line %d \ No newline at end of file diff --git a/ext/standard/tests/array/array_pad.phpt b/ext/standard/tests/array/array_pad.phpt new file mode 100644 index 0000000..add9b3c --- /dev/null +++ b/ext/standard/tests/array/array_pad.phpt @@ -0,0 +1,101 @@ +--TEST-- +array_pad() tests +--FILE-- + +--EXPECTF-- +Warning: array_pad() expects exactly 3 parameters, 0 given in %s on line %d +NULL + +Warning: array_pad() expects exactly 3 parameters, 1 given in %s on line %d +NULL + +Warning: array_pad() expects exactly 3 parameters, 2 given in %s on line %d +NULL +array(1) { + [0]=> + int(0) +} +array(0) { +} +array(1) { + [0]=> + int(0) +} +array(5) { + [0]=> + string(0) "" + [1]=> + int(-1) + [2]=> + float(2) + [3]=> + int(0) + [4]=> + int(0) +} +array(5) { + [0]=> + string(0) "" + [1]=> + int(-1) + [2]=> + float(2) + [3]=> + array(0) { + } + [4]=> + array(0) { + } +} +array(3) { + [0]=> + string(0) "" + [1]=> + int(-1) + [2]=> + float(2) +} +array(3) { + [0]=> + string(0) "" + [1]=> + int(-1) + [2]=> + float(2) +} +array(4) { + [0]=> + array(0) { + } + [1]=> + string(0) "" + [2]=> + int(-1) + [3]=> + float(2) +} + +Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d +bool(false) + +Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_pad_error.phpt b/ext/standard/tests/array/array_pad_error.phpt new file mode 100644 index 0000000..63b4c83 --- /dev/null +++ b/ext/standard/tests/array/array_pad_error.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test array_pad() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_pad() : error conditions *** + +-- Testing array_pad() function with Zero arguments -- + +Warning: array_pad() expects exactly 3 parameters, 0 given in %s on line %d +NULL + +-- Testing array_pad() function with more than expected no. of arguments -- + +Warning: array_pad() expects exactly 3 parameters, 4 given in %s on line %d +NULL + +-- Testing array_pad() function with less than expected no. of arguments -- + +Warning: array_pad() expects exactly 3 parameters, 2 given in %s on line %d +NULL + +Warning: array_pad() expects exactly 3 parameters, 1 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_pad_variation1.phpt b/ext/standard/tests/array/array_pad_variation1.phpt new file mode 100644 index 0000000..18a7044 --- /dev/null +++ b/ext/standard/tests/array/array_pad_variation1.phpt @@ -0,0 +1,270 @@ +--TEST-- +Test array_pad() function : usage variations - unexpected values for 'input' argument +--FILE-- + +--EXPECTF-- +*** Testing array_pad() : passing non array values to $input argument *** + +-- Iteration 1 -- +Warning: array_pad() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- +Warning: array_pad() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- +Warning: array_pad() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- +Warning: array_pad() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- +Warning: array_pad() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- +Warning: array_pad() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- +Warning: array_pad() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- +Warning: array_pad() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- +Warning: array_pad() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- +Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- +Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- +Warning: array_pad() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- +Warning: array_pad() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- +Warning: array_pad() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- +Warning: array_pad() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- +Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- +Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 19 -- +Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- +Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- +Warning: array_pad() expects parameter 1 to be array, object given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, object given in %s on line %d +NULL + +-- Iteration 22 -- +Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 23 -- +Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- +Warning: array_pad() expects parameter 1 to be array, resource given in %s on line %d +NULL + +Warning: array_pad() expects parameter 1 to be array, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_pad_variation2.phpt b/ext/standard/tests/array/array_pad_variation2.phpt new file mode 100644 index 0000000..0267f20 --- /dev/null +++ b/ext/standard/tests/array/array_pad_variation2.phpt @@ -0,0 +1,256 @@ +--TEST-- +Test array_pad() function : usage variations - unexpected values for 'pad_size' argument(Bug#43482) +--FILE-- + 'red', 'item' => 'pen'), + + // null data +/*11*/ NULL, + null, + + // boolean data +/*13*/ true, + false, + TRUE, + FALSE, + + // empty data +/*17*/ "", + '', + + // string data +/*19*/ "string", + 'string', + + // object data +/*21*/ new classA(), + + // undefined data +/*22*/ @$undefined_var, + + // unset data +/*23*/ @$unset_var, +); + +// loop through each element of $pad_sizes to check the behavior of array_pad() +$iterator = 1; +foreach($pad_sizes as $pad_size) { + echo "-- Iteration $iterator --\n"; + var_dump( array_pad($input, $pad_size, $pad_value) ); + $iterator++; +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_pad() : passing non integer values to $pad_size argument *** +-- Iteration 1 -- +array(10) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(1) + [3]=> + int(1) + [4]=> + int(1) + [5]=> + int(1) + [6]=> + int(1) + [7]=> + int(1) + [8]=> + int(1) + [9]=> + int(1) +} +-- Iteration 2 -- +array(10) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) + [3]=> + int(1) + [4]=> + int(1) + [5]=> + int(1) + [6]=> + int(1) + [7]=> + int(1) + [8]=> + int(1) + [9]=> + int(2) +} +-- Iteration 3 -- + +Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d +bool(false) +-- Iteration 5 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- Iteration 6 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- Iteration 7 -- + +Warning: array_pad() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_pad() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_pad() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_pad() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_pad() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 12 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- Iteration 13 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- Iteration 14 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- Iteration 15 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- Iteration 16 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- Iteration 17 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- Iteration 18 -- + +Warning: array_pad() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_pad() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_pad() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_pad() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: array_pad() expects parameter 2 to be long, object given in %s on line %d +NULL +-- Iteration 23 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- Iteration 24 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +Done diff --git a/ext/standard/tests/array/array_pad_variation3.phpt b/ext/standard/tests/array/array_pad_variation3.phpt new file mode 100644 index 0000000..75df118 --- /dev/null +++ b/ext/standard/tests/array/array_pad_variation3.phpt @@ -0,0 +1,869 @@ +--TEST-- +Test array_pad() function : usage variations - possible values for 'pad_value' argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data +/*15*/ NULL, + null, + + // boolean data +/*17*/ true, + false, + TRUE, + FALSE, + + // empty data +/*21*/ "", + '', + + // string data +/*23*/ "string", + 'string', + $heredoc, + + // strings with different white spaces +/*26*/ "\v\fHello\t world!! \rstring\n", + '\v\fHello\t world!! \rstring\n', + + // object data +/*28*/ new classA(), + + // undefined data +/*29*/ @$undefined_var, + + // unset data +/*30*/ @$unset_var, + + // resource variable +/*31*/ $fp, + + // reference variable +/*32*/ $reference +); + +// loop through each element of $pad_values to check the behavior of array_pad() +$iterator = 1; +foreach($pad_values as $pad_value) { + echo "-- Iteration $iterator --\n"; + var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_size' + var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_size' + $iterator++; +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_pad() : possible values for $pad_value argument *** +-- Iteration 1 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(0) + [3]=> + int(0) +} +array(4) { + [0]=> + int(0) + [1]=> + int(0) + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 2 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(1) + [3]=> + int(1) +} +array(4) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 3 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(12345) + [3]=> + int(12345) +} +array(4) { + [0]=> + int(12345) + [1]=> + int(12345) + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 4 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(-2345) + [3]=> + int(-2345) +} +array(4) { + [0]=> + int(-2345) + [1]=> + int(-2345) + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 5 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + float(10.5) + [3]=> + float(10.5) +} +array(4) { + [0]=> + float(10.5) + [1]=> + float(10.5) + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 6 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + float(-10.5) + [3]=> + float(-10.5) +} +array(4) { + [0]=> + float(-10.5) + [1]=> + float(-10.5) + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 7 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + float(123456789000) + [3]=> + float(123456789000) +} +array(4) { + [0]=> + float(123456789000) + [1]=> + float(123456789000) + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 8 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + float(1.23456789E-9) + [3]=> + float(1.23456789E-9) +} +array(4) { + [0]=> + float(1.23456789E-9) + [1]=> + float(1.23456789E-9) + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 9 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + float(0.5) + [3]=> + float(0.5) +} +array(4) { + [0]=> + float(0.5) + [1]=> + float(0.5) + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 10 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + array(0) { + } + [3]=> + array(0) { + } +} +array(4) { + [0]=> + array(0) { + } + [1]=> + array(0) { + } + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 11 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + array(1) { + [0]=> + int(0) + } + [3]=> + array(1) { + [0]=> + int(0) + } +} +array(4) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(0) + } + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 12 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + array(1) { + [0]=> + int(1) + } + [3]=> + array(1) { + [0]=> + int(1) + } +} +array(4) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(1) + } + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 13 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [3]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} +array(4) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 14 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + array(2) { + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + } + [3]=> + array(2) { + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + } +} +array(4) { + [0]=> + array(2) { + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + } + [1]=> + array(2) { + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + } + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 15 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + NULL + [3]=> + NULL +} +array(4) { + [0]=> + NULL + [1]=> + NULL + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 16 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + NULL + [3]=> + NULL +} +array(4) { + [0]=> + NULL + [1]=> + NULL + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 17 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + bool(true) + [3]=> + bool(true) +} +array(4) { + [0]=> + bool(true) + [1]=> + bool(true) + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 18 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + bool(false) + [3]=> + bool(false) +} +array(4) { + [0]=> + bool(false) + [1]=> + bool(false) + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 19 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + bool(true) + [3]=> + bool(true) +} +array(4) { + [0]=> + bool(true) + [1]=> + bool(true) + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 20 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + bool(false) + [3]=> + bool(false) +} +array(4) { + [0]=> + bool(false) + [1]=> + bool(false) + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 21 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(0) "" + [3]=> + string(0) "" +} +array(4) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 22 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(0) "" + [3]=> + string(0) "" +} +array(4) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 23 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(6) "string" + [3]=> + string(6) "string" +} +array(4) { + [0]=> + string(6) "string" + [1]=> + string(6) "string" + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 24 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(6) "string" + [3]=> + string(6) "string" +} +array(4) { + [0]=> + string(6) "string" + [1]=> + string(6) "string" + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 25 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(11) "hello world" + [3]=> + string(11) "hello world" +} +array(4) { + [0]=> + string(11) "hello world" + [1]=> + string(11) "hello world" + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 26 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(25) " Hello world!! string +" + [3]=> + string(25) " Hello world!! string +" +} +array(4) { + [0]=> + string(25) " Hello world!! string +" + [1]=> + string(25) " Hello world!! string +" + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 27 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(30) "\v\fHello\t world!! \rstring\n" + [3]=> + string(30) "\v\fHello\t world!! \rstring\n" +} +array(4) { + [0]=> + string(30) "\v\fHello\t world!! \rstring\n" + [1]=> + string(30) "\v\fHello\t world!! \rstring\n" + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 28 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + object(classA)#%d (0) { + } + [3]=> + object(classA)#%d (0) { + } +} +array(4) { + [0]=> + object(classA)#%d (0) { + } + [1]=> + object(classA)#%d (0) { + } + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 29 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + NULL + [3]=> + NULL +} +array(4) { + [0]=> + NULL + [1]=> + NULL + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 30 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + NULL + [3]=> + NULL +} +array(4) { + [0]=> + NULL + [1]=> + NULL + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 31 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + resource(%d) of type (stream) + [3]=> + resource(%d) of type (stream) +} +array(4) { + [0]=> + resource(%d) of type (stream) + [1]=> + resource(%d) of type (stream) + [2]=> + int(1) + [3]=> + int(2) +} +-- Iteration 32 -- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(5) "hello" + [3]=> + string(5) "hello" +} +array(4) { + [0]=> + string(5) "hello" + [1]=> + string(5) "hello" + [2]=> + int(1) + [3]=> + int(2) +} +Done diff --git a/ext/standard/tests/array/array_pad_variation4.phpt b/ext/standard/tests/array/array_pad_variation4.phpt new file mode 100644 index 0000000..83c1e83 --- /dev/null +++ b/ext/standard/tests/array/array_pad_variation4.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test array_pad() function : usage variations - binary safe checking +--FILE-- + +--EXPECTF-- +*** Testing array_pad() : Passing binary values to $pad_value argument *** +array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + string(5) "hello" + [4]=> + string(5) "hello" + [5]=> + string(5) "hello" +} +array(6) { + [0]=> + string(5) "hello" + [1]=> + string(5) "hello" + [2]=> + string(5) "hello" + [3]=> + int(1) + [4]=> + int(2) + [5]=> + int(3) +} +Done diff --git a/ext/standard/tests/array/array_pad_variation5.phpt b/ext/standard/tests/array/array_pad_variation5.phpt new file mode 100644 index 0000000..4e8e0f1 --- /dev/null +++ b/ext/standard/tests/array/array_pad_variation5.phpt @@ -0,0 +1,140 @@ +--TEST-- +Test array_pad() function : usage variations - two dimensional array for 'pad_value' argument +--FILE-- + 1, 'two' => 2) +); + +var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_value' +var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_value' + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_pad() : Passing 2-d array to $pad_value argument *** +array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + } + [2]=> + array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) + } + } + [4]=> + array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + } + [2]=> + array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) + } + } +} +array(5) { + [0]=> + array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + } + [2]=> + array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) + } + } + [1]=> + array(3) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + } + [2]=> + array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) + } + } + [2]=> + int(1) + [3]=> + int(2) + [4]=> + int(3) +} +Done diff --git a/ext/standard/tests/array/array_pad_variation6.phpt b/ext/standard/tests/array/array_pad_variation6.phpt new file mode 100644 index 0000000..2f97e3e --- /dev/null +++ b/ext/standard/tests/array/array_pad_variation6.phpt @@ -0,0 +1,668 @@ +--TEST-- +Test array_pad() function : usage variations - different arrays for 'input' argument +--FILE-- +22 +'single quoted string' +"double quoted string" +2222 != 1111.\t 0000 = 0000\n +EOT; + +// different arrays to be passed to $input argument +$inputs = array ( +/*1*/ array(1, 2), // with default keys and numeric values + array(1.1, 2.2), // with default keys & float values + array(false,true), // with default keys and boolean values + array(), // empty array +/*5*/ array(NULL), // with NULL + array("a\v\f", "aaaa\r", "b\tbbb", "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings + array('a\v\f', 'aaaa\r', 'b\tbbb', '\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings + array("h1" => $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $numeric_string), // with heredocs + + // associative arrays +/*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values + array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values + array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values + array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value + array("one" => 1, 2 => "two", 4 => "four"), //mixed + + // associative array, containing null/empty/boolean values as key/value +/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), + array(true => "true", false => "false", "false" => false, "true" => true), + array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), + array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), + array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + + // array with repetative keys +/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) +); + +// initialize the $pad_size and $pad_value arguments +$pad_size = 6; +$pad_value = "HELLO"; + +// loop through each sub-array within $inputs to check the behavior of array_pad() +$iterator = 1; +foreach($inputs as $input) { + echo "-- Iteration $iterator --\n"; + var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_size' + var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_size' + $iterator++; +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_pad() : Passing different arrays to $input argument *** +-- Iteration 1 -- +array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + string(5) "HELLO" + [3]=> + string(5) "HELLO" + [4]=> + string(5) "HELLO" + [5]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + [3]=> + string(5) "HELLO" + [4]=> + int(1) + [5]=> + int(2) +} +-- Iteration 2 -- +array(6) { + [0]=> + float(1.1) + [1]=> + float(2.2) + [2]=> + string(5) "HELLO" + [3]=> + string(5) "HELLO" + [4]=> + string(5) "HELLO" + [5]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + [3]=> + string(5) "HELLO" + [4]=> + float(1.1) + [5]=> + float(2.2) +} +-- Iteration 3 -- +array(6) { + [0]=> + bool(false) + [1]=> + bool(true) + [2]=> + string(5) "HELLO" + [3]=> + string(5) "HELLO" + [4]=> + string(5) "HELLO" + [5]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + [3]=> + string(5) "HELLO" + [4]=> + bool(false) + [5]=> + bool(true) +} +-- Iteration 4 -- +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + [3]=> + string(5) "HELLO" + [4]=> + string(5) "HELLO" + [5]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + [3]=> + string(5) "HELLO" + [4]=> + string(5) "HELLO" + [5]=> + string(5) "HELLO" +} +-- Iteration 5 -- +array(6) { + [0]=> + NULL + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + [3]=> + string(5) "HELLO" + [4]=> + string(5) "HELLO" + [5]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + [3]=> + string(5) "HELLO" + [4]=> + string(5) "HELLO" + [5]=> + NULL +} +-- Iteration 6 -- +array(6) { + [0]=> + string(3) "a " + [1]=> + string(5) "aaaa " + [2]=> + string(5) "b bbb" + [3]=> + string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}" + [4]=> + string(5) "HELLO" + [5]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(3) "a " + [3]=> + string(5) "aaaa " + [4]=> + string(5) "b bbb" + [5]=> + string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}" +} +-- Iteration 7 -- +array(6) { + [0]=> + string(5) "a\v\f" + [1]=> + string(6) "aaaa\r" + [2]=> + string(6) "b\tbbb" + [3]=> + string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}" + [4]=> + string(5) "HELLO" + [5]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "a\v\f" + [3]=> + string(6) "aaaa\r" + [4]=> + string(6) "b\tbbb" + [5]=> + string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}" +} +-- Iteration 8 -- +array(6) { + ["h1"]=> + string(1) " +" + ["h2"]=> + string(86) "hello world +The big brown fox jumped over; +the lazy dog +This is a double quoted string" + ["h3"]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" + [0]=> + string(90) "11 < 12. 123 >22 +'single quoted string' +"double quoted string" +2222 != 1111. 0000 = 0000 +" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + ["h1"]=> + string(1) " +" + ["h2"]=> + string(86) "hello world +The big brown fox jumped over; +the lazy dog +This is a double quoted string" + ["h3"]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" + [2]=> + string(90) "11 < 12. 123 >22 +'single quoted string' +"double quoted string" +2222 != 1111. 0000 = 0000 +" +} +-- Iteration 9 -- +array(6) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + [2]=> + string(5) "three" + [3]=> + string(5) "HELLO" + [4]=> + string(5) "HELLO" + [5]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + [3]=> + string(3) "one" + [4]=> + string(3) "two" + [5]=> + string(5) "three" +} +-- Iteration 10 -- +array(6) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) +} +-- Iteration 11 -- +array(6) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(40) + [3]=> + int(30) + [4]=> + string(5) "HELLO" + [5]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + int(10) + [3]=> + int(20) + [4]=> + int(40) + [5]=> + int(30) +} +-- Iteration 12 -- +array(6) { + ["one"]=> + string(3) "ten" + ["two"]=> + string(6) "twenty" + ["three"]=> + string(6) "thirty" + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + ["one"]=> + string(3) "ten" + ["two"]=> + string(6) "twenty" + ["three"]=> + string(6) "thirty" +} +-- Iteration 13 -- +array(6) { + ["one"]=> + int(1) + [0]=> + string(3) "two" + [1]=> + string(4) "four" + [2]=> + string(5) "HELLO" + [3]=> + string(5) "HELLO" + [4]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + ["one"]=> + int(1) + [3]=> + string(3) "two" + [4]=> + string(4) "four" +} +-- Iteration 14 -- +array(6) { + [""]=> + string(4) "null" + ["NULL"]=> + NULL + ["null"]=> + NULL + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + [""]=> + string(4) "null" + ["NULL"]=> + NULL + ["null"]=> + NULL +} +-- Iteration 15 -- +array(6) { + [0]=> + string(4) "true" + [1]=> + string(5) "false" + ["false"]=> + bool(false) + ["true"]=> + bool(true) + [2]=> + string(5) "HELLO" + [3]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(4) "true" + [3]=> + string(5) "false" + ["false"]=> + bool(false) + ["true"]=> + bool(true) +} +-- Iteration 16 -- +array(6) { + [""]=> + string(6) "emptys" + ["emptyd"]=> + string(0) "" + ["emptys"]=> + string(0) "" + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + [""]=> + string(6) "emptys" + ["emptyd"]=> + string(0) "" + ["emptys"]=> + string(0) "" +} +-- Iteration 17 -- +array(6) { + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + NULL + [4]=> + NULL + [5]=> + bool(false) + [6]=> + bool(true) +} +array(6) { + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + NULL + [4]=> + NULL + [5]=> + bool(false) + [6]=> + bool(true) +} +-- Iteration 18 -- +array(6) { + [""]=> + int(4) + [0]=> + int(5) + [1]=> + int(6) + [2]=> + string(5) "HELLO" + [3]=> + string(5) "HELLO" + [4]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + [""]=> + int(4) + [3]=> + int(5) + [4]=> + int(6) +} +-- Iteration 19 -- +array(6) { + ["One"]=> + int(10) + ["two"]=> + int(20) + ["three"]=> + int(3) + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" +} +array(6) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + ["One"]=> + int(10) + ["two"]=> + int(20) + ["three"]=> + int(3) +} +Done diff --git a/ext/standard/tests/array/array_pad_variation7.phpt b/ext/standard/tests/array/array_pad_variation7.phpt new file mode 100644 index 0000000..887f351 --- /dev/null +++ b/ext/standard/tests/array/array_pad_variation7.phpt @@ -0,0 +1,127 @@ +--TEST-- +Test array_pad() function : usage variations - two dimensional array for 'input' argument +--FILE-- + 1, "two" => 2) +); + +// initialize the $pad_size and $pad_value arguments +$pad_size = 5; +$pad_value = "HELLO"; + +// entire 2-d array +echo "-- Entire 2-d array for \$input argument --\n"; +var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_size' +var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_size' + +// sub array +echo "-- Sub array for \$input argument --\n"; +var_dump( array_pad($input[1], $pad_size, $pad_value) ); // positive 'pad_size' +var_dump( array_pad($input[1], -$pad_size, $pad_value) ); // negative 'pad_size' + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_pad() : Passing 2-D array to $input argument *** +-- Entire 2-d array for $input argument -- +array(5) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [1]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + } + [2]=> + array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) + } + [3]=> + string(5) "HELLO" + [4]=> + string(5) "HELLO" +} +array(5) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [3]=> + array(2) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + } + [4]=> + array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) + } +} +-- Sub array for $input argument -- +array(5) { + [0]=> + string(5) "hello" + [1]=> + string(5) "world" + [2]=> + string(5) "HELLO" + [3]=> + string(5) "HELLO" + [4]=> + string(5) "HELLO" +} +array(5) { + [0]=> + string(5) "HELLO" + [1]=> + string(5) "HELLO" + [2]=> + string(5) "HELLO" + [3]=> + string(5) "hello" + [4]=> + string(5) "world" +} +Done diff --git a/ext/standard/tests/array/array_pop.phpt b/ext/standard/tests/array/array_pop.phpt new file mode 100644 index 0000000..34a5c54 --- /dev/null +++ b/ext/standard/tests/array/array_pop.phpt @@ -0,0 +1,220 @@ +--TEST-- +Test array_pop() function +--FILE-- + "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ), + array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), + array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), + array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", + "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + array( 12, "name", 'age', '45' ), + array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), + array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, + 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 ) +); + +/* Loop to test normal functionality with different arrays inputs */ +echo "\n*** Normal testing with various array inputs ***\n"; + +$counter = 1; +foreach( $mixed_array as $sub_array ) +{ + echo "\n-- Input Array for Iteration $counter is --\n"; + print_r( $sub_array ); + echo "\nOutput after Pop is :\n"; + var_dump( array_pop($sub_array) ); + $counter++; +} + +echo"\nDone"; +?> +--EXPECTF-- +*** Normal testing with various array inputs *** + +-- Input Array for Iteration 1 is -- +Array +( +) + +Output after Pop is : +NULL + +-- Input Array for Iteration 2 is -- +Array +( + [0] => 1 + [1] => 2 + [2] => 3 + [3] => 4 + [4] => 5 + [5] => 6 + [6] => 7 + [7] => 8 + [8] => 9 +) + +Output after Pop is : +int(9) + +-- Input Array for Iteration 3 is -- +Array +( + [0] => One + [1] => _Two + [2] => Three + [3] => Four + [4] => Five +) + +Output after Pop is : +string(4) "Five" + +-- Input Array for Iteration 4 is -- +Array +( + [0] => 6 + [1] => six + [2] => 7 + [3] => seven + [4] => 8 + [5] => eight + [6] => 9 + [7] => nine +) + +Output after Pop is : +string(4) "nine" + +-- Input Array for Iteration 5 is -- +Array +( + [a] => aaa + [A] => AAA + [c] => ccc + [d] => ddd + [e] => eee +) + +Output after Pop is : +string(3) "eee" + +-- Input Array for Iteration 6 is -- +Array +( + [1] => one + [2] => two + [3] => three + [4] => four + [5] => five +) + +Output after Pop is : +string(4) "five" + +-- Input Array for Iteration 7 is -- +Array +( + [1] => one + [2] => two + [3] => 7 + [4] => four + [5] => five +) + +Output after Pop is : +string(4) "five" + +-- Input Array for Iteration 8 is -- +Array +( + [f] => fff + [1] => one + [4] => 6 + [] => 3 + [2] => float + [F] => FFF + [blank] => + [3] => 3.7 + [5] => Five + [6] => 8.6 + [4name] => jonny + [a] => +) + +Output after Pop is : +NULL + +-- Input Array for Iteration 9 is -- +Array +( + [0] => 12 + [1] => name + [2] => age + [3] => 45 +) + +Output after Pop is : +string(2) "45" + +-- Input Array for Iteration 10 is -- +Array +( + [0] => Array + ( + [0] => oNe + [1] => tWo + [2] => 4 + ) + + [1] => Array + ( + [0] => 10 + [1] => 20 + [2] => 30 + [3] => 40 + [4] => 50 + ) + + [2] => Array + ( + ) + +) + +Output after Pop is : +array(0) { +} + +-- Input Array for Iteration 11 is -- +Array +( + [one] => 2 + [three] => 3 + [0] => 3 + [1] => 4 + [3] => 33 + [4] => 44 + [5] => 57 + [6] => 6 + [5.4] => 554 + [5.7] => 557 +) + +Output after Pop is : +int(557) + +Done diff --git a/ext/standard/tests/array/array_pop_errors.phpt b/ext/standard/tests/array/array_pop_errors.phpt new file mode 100644 index 0000000..d6c86c3 --- /dev/null +++ b/ext/standard/tests/array/array_pop_errors.phpt @@ -0,0 +1,64 @@ +--TEST-- +Test array_pop() function (errors) +--FILE-- + "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ), + array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), + array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), + array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", + "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + array( 12, "name", 'age', '45' ), + array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), + array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, + 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 ) +); + +/* Testing Error Conditions */ +echo "\n*** Testing Error Conditions ***\n"; + +/* Zero argument */ +var_dump( array_pop() ); + +/* Scalar argument */ +var_dump( array_pop($number) ); + +/* String argument */ +var_dump( array_pop($str) ); + +/* Invalid Number of arguments */ +var_dump( array_pop($mixed_array[1],$mixed_array[2]) ); + +/* Empty Array as argument */ +var_dump( array_pop($empty_array) ); + +echo"\nDone"; +?> +--EXPECTF-- +*** Testing Error Conditions *** + +Warning: array_pop() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: array_pop() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_pop() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_pop() expects exactly 1 parameter, 2 given in %s on line %d +NULL +NULL + +Done diff --git a/ext/standard/tests/array/array_pop_variation.phpt b/ext/standard/tests/array/array_pop_variation.phpt new file mode 100644 index 0000000..795a8bc --- /dev/null +++ b/ext/standard/tests/array/array_pop_variation.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test array_pop() function (variation) +--FILE-- + "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ), + array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), + array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), + array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", + "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + array( 12, "name", 'age', '45' ), + array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), + array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, + 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 ) +); + +echo"\n*** Checking for internal array pointer being reset when pop is called ***\n"; + +echo "\nCurrent Element is : "; +var_dump( current($mixed_array[1]) ); + +echo "\nNext Element is : "; +var_dump( next($mixed_array[1]) ); + +echo "\nNext Element is : "; +var_dump( next($mixed_array[1]) ); + +echo "\nPOPed Element is : "; +var_dump( array_pop($mixed_array[1]) ); + +echo "\nCurrent Element after POP operation is: "; +var_dump( current($mixed_array[1]) ); + +echo"\nDone"; +?> +--EXPECTF-- +*** Checking for internal array pointer being reset when pop is called *** + +Current Element is : int(1) + +Next Element is : int(2) + +Next Element is : int(3) + +POPed Element is : int(9) + +Current Element after POP operation is: int(1) + +Done diff --git a/ext/standard/tests/array/array_product_error.phpt b/ext/standard/tests/array/array_product_error.phpt new file mode 100644 index 0000000..79f7cb4 --- /dev/null +++ b/ext/standard/tests/array/array_product_error.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test array_product() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_product() : error conditions *** + +-- Testing array_product() function with Zero arguments -- + +Warning: array_product() expects exactly 1 parameter, 0 given in %sarray_product_error.php on line %d +NULL + +-- Testing array_product() function with more than expected no. of arguments -- + +Warning: array_product() expects exactly 1 parameter, 2 given in %sarray_product_error.php on line %d +NULL + +-- Testing array_product() function incorrect argument type -- + +Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_error.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_product_variation1.phpt b/ext/standard/tests/array/array_product_variation1.phpt new file mode 100644 index 0000000..cd2ed71 --- /dev/null +++ b/ext/standard/tests/array/array_product_variation1.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test array_product() function : variation +--FILE-- + true, "boolean (false)" => false, + "string" => "hello", "numeric string" => "12", + "resource" => $fp, "object" => new A(), "null" => null, + "array" => array(3,2)); + +foreach ($types as $desc => $type) { + echo $desc . "\n"; + var_dump(array_product(array($type))); + echo "\n"; +} + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_product() : variation - using non numeric values *** +boolean (true) +int(1) + +boolean (false) +int(0) + +string +int(0) + +numeric string +int(12) + +resource +int(%d) + +object +int(1) + +null +int(0) + +array +int(1) + +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_product_variation2.phpt b/ext/standard/tests/array/array_product_variation2.phpt new file mode 100644 index 0000000..c4c47d8 --- /dev/null +++ b/ext/standard/tests/array/array_product_variation2.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test array_product() function : variation +--FILE-- + 2, "janet" => 5)) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_product() : variations *** + +-- Testing array_product() function with a keyed array array -- +int(10) +===DONE=== diff --git a/ext/standard/tests/array/array_product_variation3.phpt b/ext/standard/tests/array/array_product_variation3.phpt new file mode 100644 index 0000000..dc8609e --- /dev/null +++ b/ext/standard/tests/array/array_product_variation3.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test array_product() function : variation +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_product() : variations - negative numbers*** + +-- Testing array_product() function with one negative number -- +int(-2) + +-- Testing array_product() function with two negative numbers -- +int(6) + +-- Testing array_product() function with three negative numbers -- +int(-24) + +-- Testing array_product() function with negative floats -- +float(-1.5) + +-- Testing array_product() function with negative floats -- +float(-9.9999999E+15) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_product_variation4.phpt b/ext/standard/tests/array/array_product_variation4.phpt new file mode 100644 index 0000000..9f83c56 --- /dev/null +++ b/ext/standard/tests/array/array_product_variation4.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test array_product() function : variation +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_product() : variations *** + +-- Testing array_product() function with a very large array -- +float(INF) +===DONE=== diff --git a/ext/standard/tests/array/array_product_variation5.phpt b/ext/standard/tests/array/array_product_variation5.phpt new file mode 100644 index 0000000..183612e --- /dev/null +++ b/ext/standard/tests/array/array_product_variation5.phpt @@ -0,0 +1,223 @@ +--TEST-- +Test array_product() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for input + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_product($value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_product() : usage variation *** + +--int 0-- + +Warning: array_product() expects parameter 1 to be array, integer given in %sarray_product_variation5.php on line %d +NULL + +--int 1-- + +Warning: array_product() expects parameter 1 to be array, integer given in %sarray_product_variation5.php on line %d +NULL + +--int 12345-- + +Warning: array_product() expects parameter 1 to be array, integer given in %sarray_product_variation5.php on line %d +NULL + +--int -12345-- + +Warning: array_product() expects parameter 1 to be array, integer given in %sarray_product_variation5.php on line %d +NULL + +--float 10.5-- + +Warning: array_product() expects parameter 1 to be array, double given in %sarray_product_variation5.php on line %d +NULL + +--float -10.5-- + +Warning: array_product() expects parameter 1 to be array, double given in %sarray_product_variation5.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_product() expects parameter 1 to be array, double given in %sarray_product_variation5.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_product() expects parameter 1 to be array, double given in %sarray_product_variation5.php on line %d +NULL + +--float .5-- + +Warning: array_product() expects parameter 1 to be array, double given in %sarray_product_variation5.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_product() expects parameter 1 to be array, null given in %sarray_product_variation5.php on line %d +NULL + +--lowercase null-- + +Warning: array_product() expects parameter 1 to be array, null given in %sarray_product_variation5.php on line %d +NULL + +--lowercase true-- + +Warning: array_product() expects parameter 1 to be array, boolean given in %sarray_product_variation5.php on line %d +NULL + +--lowercase false-- + +Warning: array_product() expects parameter 1 to be array, boolean given in %sarray_product_variation5.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_product() expects parameter 1 to be array, boolean given in %sarray_product_variation5.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_product() expects parameter 1 to be array, boolean given in %sarray_product_variation5.php on line %d +NULL + +--empty string DQ-- + +Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d +NULL + +--empty string SQ-- + +Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d +NULL + +--string DQ-- + +Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d +NULL + +--string SQ-- + +Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d +NULL + +--mixed case string-- + +Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d +NULL + +--heredoc-- + +Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_product() expects parameter 1 to be array, object given in %sarray_product_variation5.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_product() expects parameter 1 to be array, object given in %sarray_product_variation5.php on line %d +NULL + +--undefined var-- + +Warning: array_product() expects parameter 1 to be array, null given in %sarray_product_variation5.php on line %d +NULL + +--unset var-- + +Warning: array_product() expects parameter 1 to be array, null given in %sarray_product_variation5.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_push.phpt b/ext/standard/tests/array/array_push.phpt new file mode 100644 index 0000000..cea77f4 --- /dev/null +++ b/ext/standard/tests/array/array_push.phpt @@ -0,0 +1,282 @@ +--TEST-- +Test array_push() function +--FILE-- + "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ), + array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), + array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), + array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", + "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + array( 12, "name", 'age', '45' ), + array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), + array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, + 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 ) +); + +/* Error Conditions */ +echo "\n*** Testing Error Conditions ***\n"; + +/* Zero argument */ +var_dump( array_push() ); + +/* Scalar argument */ +var_dump( array_push($number, 22) ); + +/* String argument */ +var_dump( array_push($str, 22) ); + +/* Invalid Number of arguments */ +var_dump( array_push($mixed_array[1],1,2) ); + +/* Empty Array as argument */ +var_dump( array_push($empty_array, 2) ); + + +/* Loop to test normal functionality with different arrays inputs */ +echo "\n*** Testing with various array inputs ***\n"; + +$counter = 1; +foreach( $mixed_array as $sub_array ) +{ + echo "\n-- Input Array for Iteration $counter is --\n"; + print_r( $sub_array ); + echo "\nOutput after push is :\n"; + var_dump( array_push($sub_array, 22, "abc") ); + $counter++; +} + +/* Checking for return value and the new array formed from push operation */ +echo "\n*** Checking for return value and the new array formed from push operation ***\n"; +var_dump( array_push($mixed_array[2], 22, 33, "44") ); +var_dump( $mixed_array[2] ); + +echo"\nDone"; +?> +--EXPECTF-- +*** Testing Error Conditions *** + +Warning: array_push() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: array_push() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_push() expects parameter 1 to be array, string given in %s on line %d +NULL +int(11) +int(1) + +*** Testing with various array inputs *** + +-- Input Array for Iteration 1 is -- +Array +( +) + +Output after push is : +int(2) + +-- Input Array for Iteration 2 is -- +Array +( + [0] => 1 + [1] => 2 + [2] => 3 + [3] => 4 + [4] => 5 + [5] => 6 + [6] => 7 + [7] => 8 + [8] => 9 + [9] => 1 + [10] => 2 +) + +Output after push is : +int(13) + +-- Input Array for Iteration 3 is -- +Array +( + [0] => One + [1] => _Two + [2] => Three + [3] => Four + [4] => Five +) + +Output after push is : +int(7) + +-- Input Array for Iteration 4 is -- +Array +( + [0] => 6 + [1] => six + [2] => 7 + [3] => seven + [4] => 8 + [5] => eight + [6] => 9 + [7] => nine +) + +Output after push is : +int(10) + +-- Input Array for Iteration 5 is -- +Array +( + [a] => aaa + [A] => AAA + [c] => ccc + [d] => ddd + [e] => eee +) + +Output after push is : +int(7) + +-- Input Array for Iteration 6 is -- +Array +( + [1] => one + [2] => two + [3] => three + [4] => four + [5] => five +) + +Output after push is : +int(7) + +-- Input Array for Iteration 7 is -- +Array +( + [1] => one + [2] => two + [3] => 7 + [4] => four + [5] => five +) + +Output after push is : +int(7) + +-- Input Array for Iteration 8 is -- +Array +( + [f] => fff + [1] => one + [4] => 6 + [] => 3 + [2] => float + [F] => FFF + [blank] => + [3] => 3.7 + [5] => Five + [6] => 8.6 + [4name] => jonny + [a] => +) + +Output after push is : +int(14) + +-- Input Array for Iteration 9 is -- +Array +( + [0] => 12 + [1] => name + [2] => age + [3] => 45 +) + +Output after push is : +int(6) + +-- Input Array for Iteration 10 is -- +Array +( + [0] => Array + ( + [0] => oNe + [1] => tWo + [2] => 4 + ) + + [1] => Array + ( + [0] => 10 + [1] => 20 + [2] => 30 + [3] => 40 + [4] => 50 + ) + + [2] => Array + ( + ) + +) + +Output after push is : +int(5) + +-- Input Array for Iteration 11 is -- +Array +( + [one] => 2 + [three] => 3 + [0] => 3 + [1] => 4 + [3] => 33 + [4] => 44 + [5] => 57 + [6] => 6 + [5.4] => 554 + [5.7] => 557 +) + +Output after push is : +int(12) + +*** Checking for return value and the new array formed from push operation *** +int(8) +array(8) { + [0]=> + string(3) "One" + [1]=> + string(4) "_Two" + [2]=> + string(5) "Three" + [3]=> + string(4) "Four" + [4]=> + string(4) "Five" + [5]=> + int(22) + [6]=> + int(33) + [7]=> + string(2) "44" +} + +Done diff --git a/ext/standard/tests/array/array_push_basic.phpt b/ext/standard/tests/array/array_push_basic.phpt new file mode 100644 index 0000000..5ccf037 --- /dev/null +++ b/ext/standard/tests/array/array_push_basic.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test array_push() function : basic functionality +--FILE-- + 'un', 'two' => 'deux'); + +echo "\n-- Push values onto an associative array --\n"; +var_dump(array_push($array_assoc, $var1, $var2)); +var_dump($array_assoc); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_push() : basic functionality *** + +-- Push values onto an indexed array -- +int(5) +array(5) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" + [4]=> + string(4) "four" +} + +-- Push values onto an associative array -- +int(4) +array(4) { + ["one"]=> + string(2) "un" + ["two"]=> + string(4) "deux" + [0]=> + string(5) "three" + [1]=> + string(4) "four" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_push_error1.phpt b/ext/standard/tests/array/array_push_error1.phpt new file mode 100644 index 0000000..fe26fb6 --- /dev/null +++ b/ext/standard/tests/array/array_push_error1.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test array_push() function : error conditions - Pass incorrect number of args +--FILE-- + +--EXPECTF-- +*** Testing array_push() : error conditions *** + +-- Testing array_push() function with less than expected no. of arguments -- + +Warning: array_push() expects at least 2 parameters, 1 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_push_error2.phpt b/ext/standard/tests/array/array_push_error2.phpt new file mode 100644 index 0000000..5d7b655 --- /dev/null +++ b/ext/standard/tests/array/array_push_error2.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test array_push() function : error conditions - max int value as key +--FILE-- + 'max'); + +var_dump(array_push($array, 'new')); +var_dump($array); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_push() : error conditions *** + +Warning: array_push(): Cannot add element to the array as the next element is already occupied in %s on line %d +bool(false) +array(1) { + [%d]=> + string(3) "max" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_push_variation1.phpt b/ext/standard/tests/array/array_push_variation1.phpt new file mode 100644 index 0000000..cef48b9 --- /dev/null +++ b/ext/standard/tests/array/array_push_variation1.phpt @@ -0,0 +1,225 @@ +--TEST-- +Test array_push() function : usage variations - Pass different data types as $stack arg +--FILE-- + +--EXPECTF-- +*** Testing array_push() : usage variations *** + +-- Iteration 1 -- + +Warning: array_push() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: array_push() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: array_push() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: array_push() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: array_push() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: array_push() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_push() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_push() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_push() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_push() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_push() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: array_push() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: array_push() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: array_push() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: array_push() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: array_push() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_push() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +int(1) + +-- Iteration 19 -- + +Warning: array_push() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_push() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_push() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: array_push() expects parameter 1 to be array, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: array_push() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: array_push() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: array_push() expects parameter 1 to be array, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_push_variation2.phpt b/ext/standard/tests/array/array_push_variation2.phpt new file mode 100644 index 0000000..7fefcfa --- /dev/null +++ b/ext/standard/tests/array/array_push_variation2.phpt @@ -0,0 +1,178 @@ +--TEST-- +Test array_push() function : usage variations - Pass different data types as $var arg +--FILE-- + +--EXPECTF-- +*** Testing array_push() : usage variations *** + +-- Iteration 1 -- +int(3) + +-- Iteration 2 -- +int(3) + +-- Iteration 3 -- +int(3) + +-- Iteration 4 -- +int(3) + +-- Iteration 5 -- +int(3) + +-- Iteration 6 -- +int(3) + +-- Iteration 7 -- +int(3) + +-- Iteration 8 -- +int(3) + +-- Iteration 9 -- +int(3) + +-- Iteration 10 -- +int(3) + +-- Iteration 11 -- +int(3) + +-- Iteration 12 -- +int(3) + +-- Iteration 13 -- +int(3) + +-- Iteration 14 -- +int(3) + +-- Iteration 15 -- +int(3) + +-- Iteration 16 -- +int(3) + +-- Iteration 17 -- +int(3) + +-- Iteration 18 -- +int(3) + +-- Iteration 19 -- +int(3) + +-- Iteration 20 -- +int(3) + +-- Iteration 21 -- +int(3) + +-- Iteration 22 -- +int(3) + +-- Iteration 23 -- +int(3) + +-- Iteration 24 -- +int(3) + +-- Iteration 25 -- +int(3) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_push_variation3.phpt b/ext/standard/tests/array/array_push_variation3.phpt new file mode 100644 index 0000000..2bc71a7 --- /dev/null +++ b/ext/standard/tests/array/array_push_variation3.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test array_push() function : usage variations - multidimensional arrays +--FILE-- + +--EXPECTF-- +*** Testing array_push() : usage variations *** + +-- Pass array as $var argument -- +int(4) +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + } +} + +-- Pass sub-array as $stack argument -- +int(3) +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + array(3) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + [2]=> + string(1) "a" + } +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_push_variation5.phpt b/ext/standard/tests/array/array_push_variation5.phpt new file mode 100644 index 0000000..4b6f399 --- /dev/null +++ b/ext/standard/tests/array/array_push_variation5.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_push() function : usage variations - position of internal array pointer +--FILE-- + 'un', 'two' => 'deux'); +$var0 = 'zero'; + +echo "\n-- Call array_push() --\n"; +var_dump($result = array_push($stack, $var0)); + +echo "\n-- Position of Internal Pointer in Original Array: --\n"; +echo key($stack) . " => " . current ($stack) . "\n"; + +echo "Done"; +?> +--EXPECTF-- + +*** Testing array_push() : usage variations *** + +-- Call array_push() -- +int(3) + +-- Position of Internal Pointer in Original Array: -- +one => un +Done diff --git a/ext/standard/tests/array/array_push_variation6.phpt b/ext/standard/tests/array/array_push_variation6.phpt new file mode 100644 index 0000000..19afebb --- /dev/null +++ b/ext/standard/tests/array/array_push_variation6.phpt @@ -0,0 +1,159 @@ +--TEST-- +Test array_push() function : usage variations - array keys are different data types +--FILE-- + array( + 0 => 'zero', + 1 => 'one', + 12345 => 'positive', + -2345 => 'negative', + ), + + // float data +/*2*/ 'float' => array( + 10.5 => 'positive', + -10.5 => 'negative', + .5 => 'half', + ), + + 'extreme floats' => array( + 12.3456789000e10 => 'large', + 12.3456789000E-10 => 'small', + ), + + // null data +/*3*/ 'null uppercase' => array( + NULL => 'null 1', + ), + 'null lowercase' => array( + null => 'null 2', + ), + + // boolean data +/*4*/ 'bool lowercase' => array( + true => 'lowert', + false => 'lowerf', + ), + 'bool uppercase' => array( + TRUE => 'uppert', + FALSE => 'upperf', + ), + + // empty data +/*5*/ 'empty double quotes' => array( + "" => 'emptyd', + ), + 'empty single quotes' => array( + '' => 'emptys', + ), + + // string data +/*6*/ 'string' => array( + "stringd" => 'stringd', + 'strings' => 'strings', + $heredoc => 'stringh', + ), + + // undefined data +/*8*/ 'undefined' => array( + @$undefined_var => 'undefined', + ), + + // unset data +/*9*/ 'unset' => array( + @$unset_var => 'unset', + ), +); + +// loop through each sub-array of $inputs to check the behavior of array_push() +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator : $key data --\n"; + echo "Before : "; + var_dump(count($input)); + echo "After : "; + var_dump( array_push($input, $var) ); + $iterator++; +}; + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_push() : usage variations *** + +-- Iteration 1 : int data -- +Before : int(4) +After : int(5) + +-- Iteration 2 : float data -- +Before : int(3) +After : int(4) + +-- Iteration 3 : extreme floats data -- +Before : int(2) +After : int(3) + +-- Iteration 4 : null uppercase data -- +Before : int(1) +After : int(2) + +-- Iteration 5 : null lowercase data -- +Before : int(1) +After : int(2) + +-- Iteration 6 : bool lowercase data -- +Before : int(2) +After : int(3) + +-- Iteration 7 : bool uppercase data -- +Before : int(2) +After : int(3) + +-- Iteration 8 : empty double quotes data -- +Before : int(1) +After : int(2) + +-- Iteration 9 : empty single quotes data -- +Before : int(1) +After : int(2) + +-- Iteration 10 : string data -- +Before : int(3) +After : int(4) + +-- Iteration 11 : undefined data -- +Before : int(1) +After : int(2) + +-- Iteration 12 : unset data -- +Before : int(1) +After : int(2) +Done diff --git a/ext/standard/tests/array/array_rand.phpt b/ext/standard/tests/array/array_rand.phpt new file mode 100644 index 0000000..1f495f4 --- /dev/null +++ b/ext/standard/tests/array/array_rand.phpt @@ -0,0 +1,51 @@ +--TEST-- +array_rand() tests +--FILE-- + +--EXPECTF-- +Warning: array_rand() expects at least 1 parameter, 0 given in %s on line %d +NULL +NULL + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +Warning: array_rand() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} +array(2) { + [0]=> + int(%d) + [1]=> + int(%d) +} +Done diff --git a/ext/standard/tests/array/array_rand_basic1.phpt b/ext/standard/tests/array/array_rand_basic1.phpt new file mode 100644 index 0000000..30b5b5c --- /dev/null +++ b/ext/standard/tests/array/array_rand_basic1.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test array_rand() function : basic functionality - array with default keys +--FILE-- + +--EXPECTF-- +*** Testing array_rand() : array with default keys *** + +-- with all default and optional arguments -- +array(%d) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) +} + +-- with default argument -- +int(%d) +Done + diff --git a/ext/standard/tests/array/array_rand_basic2.phpt b/ext/standard/tests/array/array_rand_basic2.phpt new file mode 100644 index 0000000..e18fede --- /dev/null +++ b/ext/standard/tests/array/array_rand_basic2.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test array_rand() function : basic functionality - with associative array for 'input' argument +--FILE-- + 1, 'two' => 2, 'three' => 3, + 'FoUr' => 'four', '#5' => 5, 'SIX' => 'six', + "seven" => 7, "#8" => "eight", "nine" => "NINE" +); + +$num_req = 6; + +// Calling array_rand() with optional argument +echo"\n-- with all default and optional arguments --\n"; +var_dump( array_rand($input,$num_req) ); + +// Calling array_rand() with default arguments +echo"\n-- with default argument --\n"; +var_dump( array_rand($input) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_rand() : with associative array *** + +-- with all default and optional arguments -- +array(6) { + [0]=> + string(%d) "%s" + [1]=> + string(%d) "%s" + [2]=> + string(%d) "%s" + [3]=> + string(%d) "%s" + [4]=> + string(%d) "%s" + [5]=> + string(%d) "%s" +} + +-- with default argument -- +string(%d) "%s" +Done + diff --git a/ext/standard/tests/array/array_rand_error.phpt b/ext/standard/tests/array/array_rand_error.phpt new file mode 100644 index 0000000..30cc85a --- /dev/null +++ b/ext/standard/tests/array/array_rand_error.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test array_rand() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_rand() : error conditions *** + +-- Testing array_rand() function with Zero arguments -- + +Warning: array_rand() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing array_rand() function with more than expected no. of arguments -- + +Warning: array_rand() expects at most 2 parameters, 3 given in %s on line %d +NULL +Done + diff --git a/ext/standard/tests/array/array_rand_variation1.phpt b/ext/standard/tests/array/array_rand_variation1.phpt new file mode 100644 index 0000000..e215829 --- /dev/null +++ b/ext/standard/tests/array/array_rand_variation1.phpt @@ -0,0 +1,217 @@ +--TEST-- +Test array_rand() function : usage variations - unexpected values for 'input' parameter +--FILE-- + +--EXPECTF-- +*** Testing array_rand() : unexpected values for 'input' parameter *** + +-- Iteration 1 -- + +Warning: array_rand() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: array_rand() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: array_rand() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: array_rand() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: array_rand() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: array_rand() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_rand() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_rand() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_rand() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_rand() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_rand() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: array_rand() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: array_rand() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: array_rand() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: array_rand() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: array_rand() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_rand() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: array_rand() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: array_rand() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_rand() expects parameter 1 to be array, object given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_rand() expects parameter 1 to be array, resource given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: array_rand() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: array_rand() expects parameter 1 to be array, null given in %s on line %d +NULL +Done + diff --git a/ext/standard/tests/array/array_rand_variation2.phpt b/ext/standard/tests/array/array_rand_variation2.phpt new file mode 100644 index 0000000..3340a12 --- /dev/null +++ b/ext/standard/tests/array/array_rand_variation2.phpt @@ -0,0 +1,215 @@ +--TEST-- +Test array_rand() function : usage variations - unexpected values for 'num_req' parameter +--FILE-- + +--EXPECTF-- +*** Testing array_rand() : unexpected values for 'num_req' parameter *** + +-- Iteration 1 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- Iteration 2 -- +int(%d) + +-- Iteration 3 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- Iteration 5 -- +array(10) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) +} + +-- Iteration 6 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- Iteration 12 -- +int(%d) + +-- Iteration 13 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- Iteration 14 -- +int(%d) + +-- Iteration 15 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: array_rand() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_rand() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: array_rand() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: array_rand() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_rand() expects parameter 2 to be long, object given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL +Done + diff --git a/ext/standard/tests/array/array_rand_variation3.phpt b/ext/standard/tests/array/array_rand_variation3.phpt new file mode 100644 index 0000000..81194a1 --- /dev/null +++ b/ext/standard/tests/array/array_rand_variation3.phpt @@ -0,0 +1,150 @@ +--TEST-- +Test array_rand() function : usage variation - with MultiDimensional array +--FILE-- + +--EXPECTF-- +*** Testing array_rand() : with multi-dimensional array *** +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} + +*** Testing array_rand() with arrays having different types of values *** + +-- Iteration 1 -- +int(%d) +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} + +-- Iteration 2 -- +int(%d) +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} + +-- Iteration 3 -- +int(%d) +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} + +-- Iteration 4 -- +int(%d) +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} + +-- Iteration 5 -- +int(%d) +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} + +-- Iteration 6 -- +int(%d) +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} + +-- Iteration 7 -- +int(%d) +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} +Done + diff --git a/ext/standard/tests/array/array_rand_variation4.phpt b/ext/standard/tests/array/array_rand_variation4.phpt new file mode 100644 index 0000000..72b6c55 --- /dev/null +++ b/ext/standard/tests/array/array_rand_variation4.phpt @@ -0,0 +1,168 @@ +--TEST-- +Test array_rand() function : usage variation - with associative arrays for 'input' parameter +--FILE-- + 'one', 2 => 2, 1234567890 => 'big', -1 => 'negative key', + 2.3 => 'float key', 0 => "zero key", 0.2 => 'decimal key', + 2e2 => 'exp key1', -2e3 => 'negative exp key'), + + // array with string keys + array('one' => 1, "two" => 2.0, "three" => 'three', + '12twelve' => 12.00, "" => 'empty string', " " => "space key"), + + // array with hexa values as keys +/*3*/ array(0xabc => 2748, 0x12f => '303', 0xff => "255", -0xff => "-255"), + + // array with octal values as keys + array(0123 => 83, 0129 => 10, 010 => "8", -0348 => "-28", 0012 => '10'), + + // array with bool values as keys + array(TRUE => '1', true => true, TrUe => "TRUE", + FALSE => '0', false => false, FaLsE => "FALSE"), + + // array with special chars as keys +/*6*/ array('##' => "key1", '&$r' => 'key2', '!' => "key3", '<>' =>'key4', + "NULL" => 'key5', "\n" => 'newline as key', + "\t" => "tab as key", "'" => 'single quote as key', + '"' => 'double quote as key', "\0" => "null char as key") +); + +/* looping to test array_rand() function with different arrays having + * different types of keys +*/ +$counter = 1; +foreach($asso_arrays as $input) { + echo "\n-- Iteration $counter --\n"; + + // with default argument + echo"\nWith default argument\n"; + var_dump( array_rand($input) ); + + // with default and optional arguments + echo"\nWith num_req = 1\n"; + var_dump( array_rand($input, 1) ); // with $num_req=1 + echo"\nWith num_req = 2\n"; + var_dump( array_rand($input, 2) ); // with $num_req=2 + + $counter++; +} // end of for loop + + +echo "Done"; +?> +--EXPECTREGEX-- +\*\*\* Testing array_rand\(\) : with associative arrays \*\*\* + +-- Iteration 1 -- + +With default argument +int\([012-][12.e]*[23e]*[34]*[5]*[6]*[7]*[8]*[9]*[0]*\) + +With num_req = 1 +int\([012-][12.e]*[23e]*[34]*[5]*[6]*[7]*[8]*[9]*[0]*\) + +With num_req = 2 +array\(2\) { + \[0\]=> + int\([012-][12.e]*[23e]*[34]*[5]*[6]*[7]*[8]*[9]*[0]*\) + \[1\]=> + int\([012-][12.e]*[23e]*[34]*[5]*[6]*[7]*[8]*[9]*[0]*\) +} + +-- Iteration 2 -- + +With default argument +string\([0-9]*\) "[ot1 ]*[hnw2]*[eort]*[ew]*[e]*[l]*[v]*[e]*" + +With num_req = 1 +string\([0-9]*\) "[ot1 ]*[hnw2]*[eort]*[ew]*[e]*[l]*[v]*[e]*" + +With num_req = 2 +array\(2\) { + \[0\]=> + string\([0-9]*\) "[ot1 ]*[hnw2]*[eort]*[ew]*[e]*[l]*[v]*[e]*" + \[1\]=> + string\([0-9]*\) "[ot1 ]*[hnw2]*[eort]*[ew]*[e]*[l]*[v]*[e]*" +} + +-- Iteration 3 -- + +With default argument +int\([23-]*[2570]*[345]*[58]*\) + +With num_req = 1 +int\([23-]*[2570]*[345]*[58]*\) + +With num_req = 2 +array\(2\) { + \[0\]=> + int\([23-]*[2570]*[345]*[58]*\) + \[1\]=> + int\([23-]*[2570]*[345]*[58]*\) +} + +-- Iteration 4 -- + +With default argument +int\([18-]*[023]*[8]*\) + +With num_req = 1 +int\([18-]*[023]*[8]*\) + +With num_req = 2 +array\(2\) { + \[0\]=> + int\([18-]*[023]*[8]*\) + \[1\]=> + int\([18-]*[023]*[8]*\) +} + +-- Iteration 5 -- + +With default argument +int\([01]\) + +With num_req = 1 +int\([01]\) + +With num_req = 2 +array\(2\) { + \[0\]=> + int\([01]\) + \[1\]=> + int\([01]\) +} + +-- Iteration 6 -- + +With default argument +string\([0-9]*\) "[#&!N <\n\t'"\0]*[U#$>]*[rL]*[L]*" + +With num_req = 1 +string\([0-9]*\) "[#&!N <\n\t'"\0]*[U#$>]*[rL]*[L]*" + +With num_req = 2 +array\(2\) { + \[0\]=> + string\([0-9]*\) "[#&!N <\n\t'"\0]*[U#$>]*[rL]*[L]*" + \[1\]=> + string\([0-9]*\) "[#&!N <\n\t'"\0]*[U#$>]*[rL]*[L]*" +} +Done + diff --git a/ext/standard/tests/array/array_rand_variation5.phpt b/ext/standard/tests/array/array_rand_variation5.phpt new file mode 100644 index 0000000..69dded9 --- /dev/null +++ b/ext/standard/tests/array/array_rand_variation5.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test array_rand() function : usage variation - invalid values for 'req_num' parameter +--FILE-- + 'one', 2.2 => 'float key', 0.9 => 'decimal key', + 2e2 => 'exp key1', 2000e-3 => 'negative exp key', + 0xabc => 2748, 0x12f => '303', 0xff => "255", + 0123 => 83, 0129 => 10, 010 => "8" +); + +// Testing array_rand() function with various invalid 'req_num' values +// with valid num_req values +echo"\n-- With default num_req value --\n"; +var_dump( array_rand($input) ); // with default $num_req value +echo"\n-- With num_req = 1 --\n"; +var_dump( array_rand($input, 1) ); // with valid $num_req value + +// with invalid num_req value +echo"\n-- With num_req = 0 --\n"; +var_dump( array_rand($input, 0) ); // with $num_req=0 +echo"\n-- With num_req = -1 --\n"; +var_dump( array_rand($input, -1) ); // with $num_req=-1 +echo"\n-- With num_req = -2 --\n"; +var_dump( array_rand($input, -2) ); // with $num_req=-2 +echo"\n-- With num_req more than number of members in 'input' array --\n"; +var_dump( array_rand($input, 13) ); // with $num_req=13 + + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_rand() : with invalid values for 'req_num' *** + +-- With default num_req value -- +int(%d) + +-- With num_req = 1 -- +int(%d) + +-- With num_req = 0 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- With num_req = -1 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- With num_req = -2 -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +-- With num_req more than number of members in 'input' array -- + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL +Done + diff --git a/ext/standard/tests/array/array_rand_variation6.phpt b/ext/standard/tests/array/array_rand_variation6.phpt new file mode 100644 index 0000000..3f1fea2 --- /dev/null +++ b/ext/standard/tests/array/array_rand_variation6.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test array_rand() function : usage variation - with heredoc string as key in the 'input' array +--FILE-- + "heredoc1", + $heredoc_with_newline => "heredoc2", + $heredoc_with_characters => "heredoc3", + $heredoc_with_newline_and_tabs => "heredoc3", + $heredoc_with_alphanumerics => "heredoc4", + $heredoc_with_embedded_nulls => "heredoc5" +); + +// Test array_rand() function with different valid 'req_num' values +echo "\n-- with default parameters --\n"; +var_dump( array_rand($input) ); + +echo "\n-- with num_req = 1 --\n"; +var_dump( array_rand($input, 1) ); + +echo "\n-- with num_req = 3 --\n"; +var_dump( array_rand($input, 3) ); + +echo "\n-- with num_req = 6 --\n"; +var_dump( array_rand($input, 6) ); + + +echo "Done"; +?> +--EXPECTREGEX-- +\*\*\* Testing array_rand\(\) : with keys of input array as heredoc strings \*\*\* + +-- with default parameters -- +string\([0-9]*\) "[a-z \n \t \0 0-9 ]*" + +-- with num_req = 1 -- +string\([0-9]*\) "[a-z \n \t \0 0-9 ]*" + +-- with num_req = 3 -- +array\(3\) { + \[0\]=> + string\([0-9]*\) "[a-z \n \t \0 0-9 ]*" + \[1\]=> + string\([0-9]*\) "[a-z \n \t \0 0-9 ]*" + \[2\]=> + string\([0-9]*\) "[a-z \n \t \0 0-9 ]*" +} + +-- with num_req = 6 -- +array\(6\) { + \[0\]=> + string\([0-9]*\) "[a-z \n \t \0 0-9 ]*" + \[1\]=> + string\([0-9]*\) "[a-z \n \t \0 0-9 ]*" + \[2\]=> + string\([0-9]*\) "[a-z \n \t \0 0-9 ]*" + \[3\]=> + string\([0-9]*\) "[a-z \n \t \0 0-9 ]*" + \[4\]=> + string\([0-9]*\) "[a-z \n \t \0 0-9 ]*" + \[5\]=> + string\([0-9]*\) "[a-z \n \t \0 0-9 ]*" +} +Done + diff --git a/ext/standard/tests/array/array_reduce.phpt b/ext/standard/tests/array/array_reduce.phpt new file mode 100644 index 0000000..94ecca6 --- /dev/null +++ b/ext/standard/tests/array/array_reduce.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test array_reduce() function +--INI-- +precision=14 +--FILE-- + 42, 'bar' => 17, 'qux' => -2, 'quux' => 0); +var_dump(array_reduce($array, 'reduce_array', $initial), $initial); + +echo "\n*** Testing array_reduce() to null ***\n"; +function reduce_null($w, $v) { return $w . $v; } +$initial = null; +var_dump(array_reduce($array, 'reduce_null', $initial), $initial); + +echo "\nDone"; +?> +--EXPECTF-- +*** Testing array_reduce() to integer *** +int(61) +int(42) + +*** Testing array_reduce() to float *** +float(6.1) +float(4.2) + +*** Testing array_reduce() to string *** +string(23) "quuxfoofoobarquxquxquux" +string(4) "quux" + +*** Testing array_reduce() to array *** +array(4) { + ["foo"]=> + int(44) + ["bar"]=> + int(18) + ["qux"]=> + int(0) + ["quux"]=> + int(1) +} +array(4) { + ["foo"]=> + int(42) + ["bar"]=> + int(17) + ["qux"]=> + int(-2) + ["quux"]=> + int(0) +} + +*** Testing array_reduce() to null *** +string(19) "foofoobarquxquxquux" +NULL + +Done diff --git a/ext/standard/tests/array/array_reduce_error.phpt b/ext/standard/tests/array/array_reduce_error.phpt new file mode 100644 index 0000000..954aa43 --- /dev/null +++ b/ext/standard/tests/array/array_reduce_error.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test array_reduce() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_reduce() : error conditions *** + +-- Testing array_reduce() function with more than expected no. of arguments -- + +Warning: array_reduce() expects at most 3 parameters, 4 given in %sarray_reduce_error.php on line %d +NULL + +-- Testing array_reduce() function with less than expected no. of arguments -- + +Warning: array_reduce() expects at least 2 parameters, 1 given in %sarray_reduce_error.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_reduce_variation1.phpt b/ext/standard/tests/array/array_reduce_variation1.phpt new file mode 100644 index 0000000..b02a82a --- /dev/null +++ b/ext/standard/tests/array/array_reduce_variation1.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test array_reduce() function : variation +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_reduce() : variation *** + +--- Testing with a callback with too few parameters --- +int(2) + +--- Testing with a callback with too many parameters --- + +Warning: Missing argument 3 for threeArgs() in %sarray_reduce_variation1.php on line %d + +Notice: Undefined variable: x in %sarray_reduce_variation1.php on line %d +int(3) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_reduce_variation2.phpt b/ext/standard/tests/array/array_reduce_variation2.phpt new file mode 100644 index 0000000..35b2d38 --- /dev/null +++ b/ext/standard/tests/array/array_reduce_variation2.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test array_reduce() function : variation - invalid parameters +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_reduce() : variation - invalid parameters *** + +Warning: array_reduce() expects parameter 2 to be a valid callback, function 'bogusbogus' not found or invalid function name in %sarray_reduce_variation2.php on line %d +NULL + +Warning: array_reduce() expects parameter 1 to be array, string given in %sarray_reduce_variation2.php on line %d +NULL + +Warning: array_reduce() expects parameter 1 to be array, object given in %sarray_reduce_variation2.php on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_reduce_variation3.phpt b/ext/standard/tests/array/array_reduce_variation3.phpt new file mode 100644 index 0000000..f630102 --- /dev/null +++ b/ext/standard/tests/array/array_reduce_variation3.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_reduce() function : variation - object callbacks +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_reduce() : variation - object callbacks *** + +--- Static method callback --- +int(1) + +--- Instance method callback --- +int(1) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_replace.phpt b/ext/standard/tests/array/array_replace.phpt new file mode 100644 index 0000000..6ba9e43 --- /dev/null +++ b/ext/standard/tests/array/array_replace.phpt @@ -0,0 +1,122 @@ +--TEST-- +Test array_replace and array_replace_recursive +--FILE-- + 'dontclobber', + '1' => 'unclobbered', + 'test2' => 0.0, + 'test3' => array( + 'testarray2' => true, + 1 => array( + 'testsubarray1' => 'dontclobber2', + 'testsubarray2' => 'dontclobber3', + ), + ), +); + +$array2 = array( + 1 => 'clobbered', + 'test3' => array( + 'testarray2' => false, + ), + 'test4' => array( + 'clobbered3' => array(0, 1, 2), + ), +); + +$array3 = array(array(array(array()))); + +$array4 = array(); +$array4[] = &$array4; + +echo " -- Testing array_replace() --\n"; +$data = array_replace($array1, $array2); + +var_dump($data); + +echo " -- Testing array_replace_recursive() --\n"; +$data = array_replace_recursive($array1, $array2); + +var_dump($data); + +echo " -- Testing array_replace_recursive() w/ endless recusrsion --\n"; +$data = array_replace_recursive($array3, $array4); + +var_dump($data); +?> +--EXPECTF-- + -- Testing array_replace() -- +array(5) { + [0]=> + string(11) "dontclobber" + [1]=> + string(9) "clobbered" + ["test2"]=> + float(0) + ["test3"]=> + array(1) { + ["testarray2"]=> + bool(false) + } + ["test4"]=> + array(1) { + ["clobbered3"]=> + array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + } + } +} + -- Testing array_replace_recursive() -- +array(5) { + [0]=> + string(11) "dontclobber" + [1]=> + string(9) "clobbered" + ["test2"]=> + float(0) + ["test3"]=> + array(2) { + ["testarray2"]=> + bool(false) + [1]=> + array(2) { + ["testsubarray1"]=> + string(12) "dontclobber2" + ["testsubarray2"]=> + string(12) "dontclobber3" + } + } + ["test4"]=> + array(1) { + ["clobbered3"]=> + array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + } + } +} + -- Testing array_replace_recursive() w/ endless recusrsion -- + +Warning: array_replace_recursive(): recursion detected in %s on line %d +array(1) { + [0]=> + array(1) { + [0]=> + array(1) { + [0]=> + array(0) { + } + } + } +} diff --git a/ext/standard/tests/array/array_reverse_basic1.phpt b/ext/standard/tests/array/array_reverse_basic1.phpt new file mode 100644 index 0000000..f41e0a3 --- /dev/null +++ b/ext/standard/tests/array/array_reverse_basic1.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test array_reverse() function : basic functionality - simple array for 'array' argument +--FILE-- + +--EXPECTF-- +*** Testing array_reverse() : basic functionality *** +array(6) { + [0]=> + float(13.33) + [1]=> + int(10) + [2]=> + string(4) "blue" + [3]=> + string(3) "red" + [4]=> + string(5) "green" + [5]=> + string(1) "a" +} +array(6) { + [5]=> + float(13.33) + [4]=> + int(10) + [3]=> + string(4) "blue" + [2]=> + string(3) "red" + [1]=> + string(5) "green" + [0]=> + string(1) "a" +} +array(6) { + [0]=> + float(13.33) + [1]=> + int(10) + [2]=> + string(4) "blue" + [3]=> + string(3) "red" + [4]=> + string(5) "green" + [5]=> + string(1) "a" +} +Done diff --git a/ext/standard/tests/array/array_reverse_basic2.phpt b/ext/standard/tests/array/array_reverse_basic2.phpt new file mode 100644 index 0000000..9f41f0b --- /dev/null +++ b/ext/standard/tests/array/array_reverse_basic2.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test array_reverse() function : basic functionality - associative array for 'array' argument +--FILE-- + "hello", 123 => "number", 'string' => 'blue', "10" => 13.33); + +// Calling array_reverse() with default arguments +var_dump( array_reverse($array) ); + +// Calling array_reverse() with all possible arguments +var_dump( array_reverse($array, true) ); // expects the keys to be preserved +var_dump( array_reverse($array, false) ); // expects the keys not to be preserved + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_reverse() : basic functionality *** +array(4) { + [0]=> + float(13.33) + ["string"]=> + string(4) "blue" + [1]=> + string(6) "number" + ["a"]=> + string(5) "hello" +} +array(4) { + [10]=> + float(13.33) + ["string"]=> + string(4) "blue" + [123]=> + string(6) "number" + ["a"]=> + string(5) "hello" +} +array(4) { + [0]=> + float(13.33) + ["string"]=> + string(4) "blue" + [1]=> + string(6) "number" + ["a"]=> + string(5) "hello" +} +Done diff --git a/ext/standard/tests/array/array_reverse_error.phpt b/ext/standard/tests/array/array_reverse_error.phpt new file mode 100644 index 0000000..faf7e82 --- /dev/null +++ b/ext/standard/tests/array/array_reverse_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test array_reverse() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_reverse() : error conditions *** + +-- Testing array_reverse() function with Zero arguments -- + +Warning: array_reverse() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing array_diff() function with more than expected no. of arguments -- + +Warning: array_reverse() expects at most 2 parameters, 3 given in %s on line %d +NULL + +Warning: array_reverse() expects at most 2 parameters, 3 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_reverse_variation1.phpt b/ext/standard/tests/array/array_reverse_variation1.phpt new file mode 100644 index 0000000..35a73bb --- /dev/null +++ b/ext/standard/tests/array/array_reverse_variation1.phpt @@ -0,0 +1,340 @@ +--TEST-- +Test array_reverse() function : usage variations - unexpected values for 'array' argument +--FILE-- + +--EXPECTF-- +*** Testing array_reverse() : usage variations - unexpected values for 'array' argument *** + +-- Iteration 1 -- +Warning: array_reverse() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- +Warning: array_reverse() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- +Warning: array_reverse() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- +Warning: array_reverse() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- +Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- +Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- +Warning: array_reverse() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- +Warning: array_reverse() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- +Warning: array_reverse() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- +Warning: array_reverse() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 19 -- +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- +Warning: array_reverse() expects parameter 1 to be array, object given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, object given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, object given in %s on line %d +NULL + +-- Iteration 22 -- +Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 23 -- +Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- +Warning: array_reverse() expects parameter 1 to be array, resource given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, resource given in %s on line %d +NULL + +Warning: array_reverse() expects parameter 1 to be array, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_reverse_variation2.phpt b/ext/standard/tests/array/array_reverse_variation2.phpt new file mode 100644 index 0000000..69e7a9f --- /dev/null +++ b/ext/standard/tests/array/array_reverse_variation2.phpt @@ -0,0 +1,414 @@ +--TEST-- +Test array_reverse() function : usage variations - unexpected values for 'preserve_keys' argument +--FILE-- + "green", "red", "blue", "red", "orange", "pink"); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//get a resource variable +$fp = fopen(__FILE__, "r"); + +//get a class +class classA +{ + public function __toString(){ + return "Class A object"; + } +} + +//array of values to iterate over +$preserve_keys = array ( + + // int data +/*1*/ 0, + 1, + 12345, + -2345, + + // float data +/*5*/ 10.5, + -10.5, + 10.5e10, + 10.6E-10, + .5, + + // array data +/*10*/ array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data +/*15*/ NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data +/*21*/ + "", + '', + + // object data + new classA(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource variable +/*26*/ $fp + +); + +// loop through each element of the array $preserve_keys to check the behavior of array_reverse() +$iterator = 1; +foreach($preserve_keys as $preserve_key) { + echo "-- Iteration $iterator --\n"; + var_dump( array_reverse($array, $preserve_key) ); + $iterator++; +}; + +// close the file resouce used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_reverse() : usage variations *** +-- Iteration 1 -- +array(6) { + [0]=> + string(4) "pink" + [1]=> + string(6) "orange" + [2]=> + string(3) "red" + [3]=> + string(4) "blue" + [4]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 2 -- +array(6) { + [4]=> + string(4) "pink" + [3]=> + string(6) "orange" + [2]=> + string(3) "red" + [1]=> + string(4) "blue" + [0]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 3 -- +array(6) { + [4]=> + string(4) "pink" + [3]=> + string(6) "orange" + [2]=> + string(3) "red" + [1]=> + string(4) "blue" + [0]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 4 -- +array(6) { + [4]=> + string(4) "pink" + [3]=> + string(6) "orange" + [2]=> + string(3) "red" + [1]=> + string(4) "blue" + [0]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 5 -- +array(6) { + [4]=> + string(4) "pink" + [3]=> + string(6) "orange" + [2]=> + string(3) "red" + [1]=> + string(4) "blue" + [0]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 6 -- +array(6) { + [4]=> + string(4) "pink" + [3]=> + string(6) "orange" + [2]=> + string(3) "red" + [1]=> + string(4) "blue" + [0]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 7 -- +array(6) { + [4]=> + string(4) "pink" + [3]=> + string(6) "orange" + [2]=> + string(3) "red" + [1]=> + string(4) "blue" + [0]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 8 -- +array(6) { + [4]=> + string(4) "pink" + [3]=> + string(6) "orange" + [2]=> + string(3) "red" + [1]=> + string(4) "blue" + [0]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 9 -- +array(6) { + [4]=> + string(4) "pink" + [3]=> + string(6) "orange" + [2]=> + string(3) "red" + [1]=> + string(4) "blue" + [0]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 10 -- + +Warning: array_reverse() expects parameter 2 to be boolean, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_reverse() expects parameter 2 to be boolean, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: array_reverse() expects parameter 2 to be boolean, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: array_reverse() expects parameter 2 to be boolean, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: array_reverse() expects parameter 2 to be boolean, array given in %s on line %d +NULL +-- Iteration 15 -- +array(6) { + [0]=> + string(4) "pink" + [1]=> + string(6) "orange" + [2]=> + string(3) "red" + [3]=> + string(4) "blue" + [4]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 16 -- +array(6) { + [0]=> + string(4) "pink" + [1]=> + string(6) "orange" + [2]=> + string(3) "red" + [3]=> + string(4) "blue" + [4]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 17 -- +array(6) { + [4]=> + string(4) "pink" + [3]=> + string(6) "orange" + [2]=> + string(3) "red" + [1]=> + string(4) "blue" + [0]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 18 -- +array(6) { + [0]=> + string(4) "pink" + [1]=> + string(6) "orange" + [2]=> + string(3) "red" + [3]=> + string(4) "blue" + [4]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 19 -- +array(6) { + [4]=> + string(4) "pink" + [3]=> + string(6) "orange" + [2]=> + string(3) "red" + [1]=> + string(4) "blue" + [0]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 20 -- +array(6) { + [0]=> + string(4) "pink" + [1]=> + string(6) "orange" + [2]=> + string(3) "red" + [3]=> + string(4) "blue" + [4]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 21 -- +array(6) { + [0]=> + string(4) "pink" + [1]=> + string(6) "orange" + [2]=> + string(3) "red" + [3]=> + string(4) "blue" + [4]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 22 -- +array(6) { + [0]=> + string(4) "pink" + [1]=> + string(6) "orange" + [2]=> + string(3) "red" + [3]=> + string(4) "blue" + [4]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 23 -- + +Warning: array_reverse() expects parameter 2 to be boolean, object given in %s on line %d +NULL +-- Iteration 24 -- +array(6) { + [0]=> + string(4) "pink" + [1]=> + string(6) "orange" + [2]=> + string(3) "red" + [3]=> + string(4) "blue" + [4]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 25 -- +array(6) { + [0]=> + string(4) "pink" + [1]=> + string(6) "orange" + [2]=> + string(3) "red" + [3]=> + string(4) "blue" + [4]=> + string(3) "red" + ["a"]=> + string(5) "green" +} +-- Iteration 26 -- + +Warning: array_reverse() expects parameter 2 to be boolean, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_reverse_variation3.phpt b/ext/standard/tests/array/array_reverse_variation3.phpt new file mode 100644 index 0000000..1029842 --- /dev/null +++ b/ext/standard/tests/array/array_reverse_variation3.phpt @@ -0,0 +1,602 @@ +--TEST-- +Test array_reverse() function : usage variations - different array values for 'array' argument +--FILE-- + "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values + array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values + array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values + array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value + array("one" => 1, 2 => "two", 4 => "four"), //mixed + + // associative array, containing null/empty/boolean values as key/value +/*13*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), + array(true => "true", false => "false", "false" => false, "true" => true), + array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), + array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), + array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + + // array with repetative keys +/*18*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) +); + +// loop through the various elements of $arrays to test array_reverse() +$iterator = 1; +foreach($arrays as $array) { + echo "-- Iteration $iterator --\n"; + // with default argument + echo "- with default argument -\n"; + var_dump( array_reverse($array) ); + // with all possible arguments + echo "- with \$preserve keys = true -\n"; + var_dump( array_reverse($array, true) ); + echo "- with \$preserve_keys = false -\n"; + var_dump( array_reverse($array, false) ); + $iterator++; +}; + +// close the file resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_reverse() : usage variations *** +-- Iteration 1 -- +- with default argument - +array(2) { + [0]=> + int(2) + [1]=> + int(1) +} +- with $preserve keys = true - +array(2) { + [1]=> + int(2) + [0]=> + int(1) +} +- with $preserve_keys = false - +array(2) { + [0]=> + int(2) + [1]=> + int(1) +} +-- Iteration 2 -- +- with default argument - +array(2) { + [0]=> + float(2.2) + [1]=> + float(1.1) +} +- with $preserve keys = true - +array(2) { + [1]=> + float(2.2) + [0]=> + float(1.1) +} +- with $preserve_keys = false - +array(2) { + [0]=> + float(2.2) + [1]=> + float(1.1) +} +-- Iteration 3 -- +- with default argument - +array(2) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} +- with $preserve keys = true - +array(2) { + [1]=> + array(1) { + [0]=> + int(1) + } + [0]=> + array(1) { + [0]=> + int(2) + } +} +- with $preserve_keys = false - +array(2) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + array(1) { + [0]=> + int(2) + } +} +-- Iteration 4 -- +- with default argument - +array(2) { + [0]=> + bool(true) + [1]=> + bool(false) +} +- with $preserve keys = true - +array(2) { + [1]=> + bool(true) + [0]=> + bool(false) +} +- with $preserve_keys = false - +array(2) { + [0]=> + bool(true) + [1]=> + bool(false) +} +-- Iteration 5 -- +- with default argument - +array(0) { +} +- with $preserve keys = true - +array(0) { +} +- with $preserve_keys = false - +array(0) { +} +-- Iteration 6 -- +- with default argument - +array(1) { + [0]=> + NULL +} +- with $preserve keys = true - +array(1) { + [0]=> + NULL +} +- with $preserve_keys = false - +array(1) { + [0]=> + NULL +} +-- Iteration 7 -- +- with default argument - +array(6) { + [0]=> + string(5) "ccccc" + [1]=> + string(1) "c" + [2]=> + string(4) "bbbb" + [3]=> + string(1) "b" + [4]=> + string(4) "aaaa" + [5]=> + string(1) "a" +} +- with $preserve keys = true - +array(6) { + [5]=> + string(5) "ccccc" + [4]=> + string(1) "c" + [3]=> + string(4) "bbbb" + [2]=> + string(1) "b" + [1]=> + string(4) "aaaa" + [0]=> + string(1) "a" +} +- with $preserve_keys = false - +array(6) { + [0]=> + string(5) "ccccc" + [1]=> + string(1) "c" + [2]=> + string(4) "bbbb" + [3]=> + string(1) "b" + [4]=> + string(4) "aaaa" + [5]=> + string(1) "a" +} +-- Iteration 8 -- +- with default argument - +array(3) { + [0]=> + string(5) "three" + [1]=> + string(3) "two" + [2]=> + string(3) "one" +} +- with $preserve keys = true - +array(3) { + [3]=> + string(5) "three" + [2]=> + string(3) "two" + [1]=> + string(3) "one" +} +- with $preserve_keys = false - +array(3) { + [0]=> + string(5) "three" + [1]=> + string(3) "two" + [2]=> + string(3) "one" +} +-- Iteration 9 -- +- with default argument - +array(3) { + ["three"]=> + int(3) + ["two"]=> + int(2) + ["one"]=> + int(1) +} +- with $preserve keys = true - +array(3) { + ["three"]=> + int(3) + ["two"]=> + int(2) + ["one"]=> + int(1) +} +- with $preserve_keys = false - +array(3) { + ["three"]=> + int(3) + ["two"]=> + int(2) + ["one"]=> + int(1) +} +-- Iteration 10 -- +- with default argument - +array(4) { + [0]=> + int(30) + [1]=> + int(40) + [2]=> + int(20) + [3]=> + int(10) +} +- with $preserve keys = true - +array(4) { + [3]=> + int(30) + [4]=> + int(40) + [2]=> + int(20) + [1]=> + int(10) +} +- with $preserve_keys = false - +array(4) { + [0]=> + int(30) + [1]=> + int(40) + [2]=> + int(20) + [3]=> + int(10) +} +-- Iteration 11 -- +- with default argument - +array(3) { + ["three"]=> + string(6) "thirty" + ["two"]=> + string(6) "twenty" + ["one"]=> + string(3) "ten" +} +- with $preserve keys = true - +array(3) { + ["three"]=> + string(6) "thirty" + ["two"]=> + string(6) "twenty" + ["one"]=> + string(3) "ten" +} +- with $preserve_keys = false - +array(3) { + ["three"]=> + string(6) "thirty" + ["two"]=> + string(6) "twenty" + ["one"]=> + string(3) "ten" +} +-- Iteration 12 -- +- with default argument - +array(3) { + [0]=> + string(4) "four" + [1]=> + string(3) "two" + ["one"]=> + int(1) +} +- with $preserve keys = true - +array(3) { + [4]=> + string(4) "four" + [2]=> + string(3) "two" + ["one"]=> + int(1) +} +- with $preserve_keys = false - +array(3) { + [0]=> + string(4) "four" + [1]=> + string(3) "two" + ["one"]=> + int(1) +} +-- Iteration 13 -- +- with default argument - +array(3) { + ["null"]=> + NULL + ["NULL"]=> + NULL + [""]=> + string(4) "null" +} +- with $preserve keys = true - +array(3) { + ["null"]=> + NULL + ["NULL"]=> + NULL + [""]=> + string(4) "null" +} +- with $preserve_keys = false - +array(3) { + ["null"]=> + NULL + ["NULL"]=> + NULL + [""]=> + string(4) "null" +} +-- Iteration 14 -- +- with default argument - +array(4) { + ["true"]=> + bool(true) + ["false"]=> + bool(false) + [0]=> + string(5) "false" + [1]=> + string(4) "true" +} +- with $preserve keys = true - +array(4) { + ["true"]=> + bool(true) + ["false"]=> + bool(false) + [0]=> + string(5) "false" + [1]=> + string(4) "true" +} +- with $preserve_keys = false - +array(4) { + ["true"]=> + bool(true) + ["false"]=> + bool(false) + [0]=> + string(5) "false" + [1]=> + string(4) "true" +} +-- Iteration 15 -- +- with default argument - +array(3) { + ["emptys"]=> + string(0) "" + ["emptyd"]=> + string(0) "" + [""]=> + string(6) "emptys" +} +- with $preserve keys = true - +array(3) { + ["emptys"]=> + string(0) "" + ["emptyd"]=> + string(0) "" + [""]=> + string(6) "emptys" +} +- with $preserve_keys = false - +array(3) { + ["emptys"]=> + string(0) "" + ["emptyd"]=> + string(0) "" + [""]=> + string(6) "emptys" +} +-- Iteration 16 -- +- with default argument - +array(6) { + [0]=> + bool(true) + [1]=> + bool(false) + [2]=> + NULL + [3]=> + NULL + [4]=> + string(0) "" + [5]=> + string(0) "" +} +- with $preserve keys = true - +array(6) { + [6]=> + bool(true) + [5]=> + bool(false) + [4]=> + NULL + [3]=> + NULL + [2]=> + string(0) "" + [1]=> + string(0) "" +} +- with $preserve_keys = false - +array(6) { + [0]=> + bool(true) + [1]=> + bool(false) + [2]=> + NULL + [3]=> + NULL + [4]=> + string(0) "" + [5]=> + string(0) "" +} +-- Iteration 17 -- +- with default argument - +array(3) { + [0]=> + int(6) + [1]=> + int(5) + [""]=> + int(4) +} +- with $preserve keys = true - +array(3) { + [1]=> + int(6) + [0]=> + int(5) + [""]=> + int(4) +} +- with $preserve_keys = false - +array(3) { + [0]=> + int(6) + [1]=> + int(5) + [""]=> + int(4) +} +-- Iteration 18 -- +- with default argument - +array(3) { + ["three"]=> + int(3) + ["two"]=> + int(20) + ["One"]=> + int(10) +} +- with $preserve keys = true - +array(3) { + ["three"]=> + int(3) + ["two"]=> + int(20) + ["One"]=> + int(10) +} +- with $preserve_keys = false - +array(3) { + ["three"]=> + int(3) + ["two"]=> + int(20) + ["One"]=> + int(10) +} +Done diff --git a/ext/standard/tests/array/array_reverse_variation4.phpt b/ext/standard/tests/array/array_reverse_variation4.phpt new file mode 100644 index 0000000..e3f0254 --- /dev/null +++ b/ext/standard/tests/array/array_reverse_variation4.phpt @@ -0,0 +1,377 @@ +--TEST-- +Test array_reverse() function : usage variations - assoc. array with diff. keys for 'array' argument +--FILE-- + "0"), + array(1 => "1"), + array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), + + // arrays with float keys +/*5*/ array(2.3333 => "float"), + array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => "f3", 33333333.333333 => "f4"), + + // arrays with string keys + array("\tHello" => 111, "re\td" => "color", "\v\fworld" => 2.2, "pen\n" => 33), +/*8*/ array("\tHello" => 111, "re\td" => "color", "\v\fworld" => 2.2, "pen\n" => 33), + array("hello", $heredoc => "string"), // heredoc + + // array with object, unset variable and resource variable + array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), + + // array with mixed values +/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") +); + +// loop through the various elements of $arrays to test array_reverse() +$iterator = 1; +foreach($arrays as $array) { + echo "-- Iteration $iterator --\n"; + // with default argument + echo "- default argument -\n"; + var_dump( array_reverse($array) ); + // with $preserve_keys argument + echo "- \$preserve keys = true -\n"; + var_dump( array_reverse($array, true) ); + echo "- \$preserve_keys = false -\n"; + var_dump( array_reverse($array, false) ); + $iterator++; +}; + +// close the file resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_reverse() : usage variations *** + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d +-- Iteration 1 -- +- default argument - +array(0) { +} +- $preserve keys = true - +array(0) { +} +- $preserve_keys = false - +array(0) { +} +-- Iteration 2 -- +- default argument - +array(1) { + [0]=> + string(1) "0" +} +- $preserve keys = true - +array(1) { + [0]=> + string(1) "0" +} +- $preserve_keys = false - +array(1) { + [0]=> + string(1) "0" +} +-- Iteration 3 -- +- default argument - +array(1) { + [0]=> + string(1) "1" +} +- $preserve keys = true - +array(1) { + [1]=> + string(1) "1" +} +- $preserve_keys = false - +array(1) { + [0]=> + string(1) "1" +} +-- Iteration 4 -- +- default argument - +array(4) { + [0]=> + string(1) "4" + [1]=> + string(1) "3" + [2]=> + string(1) "2" + [3]=> + string(1) "1" +} +- $preserve keys = true - +array(4) { + [4]=> + string(1) "4" + [3]=> + string(1) "3" + [2]=> + string(1) "2" + [1]=> + string(1) "1" +} +- $preserve_keys = false - +array(4) { + [0]=> + string(1) "4" + [1]=> + string(1) "3" + [2]=> + string(1) "2" + [3]=> + string(1) "1" +} +-- Iteration 5 -- +- default argument - +array(1) { + [0]=> + string(5) "float" +} +- $preserve keys = true - +array(1) { + [2]=> + string(5) "float" +} +- $preserve_keys = false - +array(1) { + [0]=> + string(5) "float" +} +-- Iteration 6 -- +- default argument - +array(4) { + [0]=> + string(2) "f4" + [1]=> + string(2) "f3" + [2]=> + string(2) "f2" + [3]=> + string(2) "f1" +} +- $preserve keys = true - +array(4) { + [33333333]=> + string(2) "f4" + [4]=> + string(2) "f3" + [3]=> + string(2) "f2" + [1]=> + string(2) "f1" +} +- $preserve_keys = false - +array(4) { + [0]=> + string(2) "f4" + [1]=> + string(2) "f3" + [2]=> + string(2) "f2" + [3]=> + string(2) "f1" +} +-- Iteration 7 -- +- default argument - +array(4) { + ["pen +"]=> + int(33) + [" world"]=> + float(2.2) + ["re d"]=> + string(5) "color" + [" Hello"]=> + int(111) +} +- $preserve keys = true - +array(4) { + ["pen +"]=> + int(33) + [" world"]=> + float(2.2) + ["re d"]=> + string(5) "color" + [" Hello"]=> + int(111) +} +- $preserve_keys = false - +array(4) { + ["pen +"]=> + int(33) + [" world"]=> + float(2.2) + ["re d"]=> + string(5) "color" + [" Hello"]=> + int(111) +} +-- Iteration 8 -- +- default argument - +array(4) { + ["pen +"]=> + int(33) + [" world"]=> + float(2.2) + ["re d"]=> + string(5) "color" + [" Hello"]=> + int(111) +} +- $preserve keys = true - +array(4) { + ["pen +"]=> + int(33) + [" world"]=> + float(2.2) + ["re d"]=> + string(5) "color" + [" Hello"]=> + int(111) +} +- $preserve_keys = false - +array(4) { + ["pen +"]=> + int(33) + [" world"]=> + float(2.2) + ["re d"]=> + string(5) "color" + [" Hello"]=> + int(111) +} +-- Iteration 9 -- +- default argument - +array(2) { + ["Hello world"]=> + string(6) "string" + [0]=> + string(5) "hello" +} +- $preserve keys = true - +array(2) { + ["Hello world"]=> + string(6) "string" + [0]=> + string(5) "hello" +} +- $preserve_keys = false - +array(2) { + ["Hello world"]=> + string(6) "string" + [0]=> + string(5) "hello" +} +-- Iteration 10 -- +- default argument - +array(1) { + [""]=> + string(5) "hello" +} +- $preserve keys = true - +array(1) { + [""]=> + string(5) "hello" +} +- $preserve_keys = false - +array(1) { + [""]=> + string(5) "hello" +} +-- Iteration 11 -- +- default argument - +array(6) { + ["Hello world"]=> + string(7) "heredoc" + [""]=> + string(5) "unset" + [0]=> + string(5) "float" + [1]=> + string(3) "int" + ["fruit"]=> + float(2.2) + ["hello"]=> + int(1) +} +- $preserve keys = true - +array(6) { + ["Hello world"]=> + string(7) "heredoc" + [""]=> + string(5) "unset" + [444]=> + string(5) "float" + [133]=> + string(3) "int" + ["fruit"]=> + float(2.2) + ["hello"]=> + int(1) +} +- $preserve_keys = false - +array(6) { + ["Hello world"]=> + string(7) "heredoc" + [""]=> + string(5) "unset" + [0]=> + string(5) "float" + [1]=> + string(3) "int" + ["fruit"]=> + float(2.2) + ["hello"]=> + int(1) +} +Done diff --git a/ext/standard/tests/array/array_reverse_variation5.phpt b/ext/standard/tests/array/array_reverse_variation5.phpt new file mode 100644 index 0000000..6c4c952 --- /dev/null +++ b/ext/standard/tests/array/array_reverse_variation5.phpt @@ -0,0 +1,399 @@ +--TEST-- +Test array_reverse() function : usage variations - assoc. array with diff. value for 'array' argument +--INI-- +precision=12 +--FILE-- + 0), + array("1" => 1), + array("one" => 1, 'two' => 2, "three" => 3, 4 => 4), + + // arrays with float values +/*5*/ array("float" => 2.3333), + array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333333), + + // arrays with string values + array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), +/*8*/ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), + array(1 => "hello", "heredoc" => $heredoc), + + // array with object, unset variable and resource variable + array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp), + + // array with mixed values +/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit", 'resource' => $fp, "int" => 133, "float" => 444.432, "unset" => @$unset_var, "heredoc" => $heredoc) +); + +// loop through the various elements of $arrays to test array_reverse() +$iterator = 1; +foreach($arrays as $array) { + echo "-- Iteration $iterator --\n"; + // with default argument + echo "- default argument -\n"; + var_dump( array_reverse($array) ); + // with $preserve_keys argument + echo "- \$preserve keys = true -\n"; + var_dump( array_reverse($array, true) ); + echo "- \$preserve_keys = false -\n"; + var_dump( array_reverse($array, false) ); + $iterator++; +}; + +// close the file resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_reverse() : usage variations *** +-- Iteration 1 -- +- default argument - +array(0) { +} +- $preserve keys = true - +array(0) { +} +- $preserve_keys = false - +array(0) { +} +-- Iteration 2 -- +- default argument - +array(1) { + [0]=> + int(0) +} +- $preserve keys = true - +array(1) { + [0]=> + int(0) +} +- $preserve_keys = false - +array(1) { + [0]=> + int(0) +} +-- Iteration 3 -- +- default argument - +array(1) { + [0]=> + int(1) +} +- $preserve keys = true - +array(1) { + [1]=> + int(1) +} +- $preserve_keys = false - +array(1) { + [0]=> + int(1) +} +-- Iteration 4 -- +- default argument - +array(4) { + [0]=> + int(4) + ["three"]=> + int(3) + ["two"]=> + int(2) + ["one"]=> + int(1) +} +- $preserve keys = true - +array(4) { + [4]=> + int(4) + ["three"]=> + int(3) + ["two"]=> + int(2) + ["one"]=> + int(1) +} +- $preserve_keys = false - +array(4) { + [0]=> + int(4) + ["three"]=> + int(3) + ["two"]=> + int(2) + ["one"]=> + int(1) +} +-- Iteration 5 -- +- default argument - +array(1) { + ["float"]=> + float(2.3333) +} +- $preserve keys = true - +array(1) { + ["float"]=> + float(2.3333) +} +- $preserve_keys = false - +array(1) { + ["float"]=> + float(2.3333) +} +-- Iteration 6 -- +- default argument - +array(4) { + ["f4"]=> + float(33333333.3333) + [0]=> + float(4.8999992284) + ["f2"]=> + float(3.33) + ["f1"]=> + float(1.2) +} +- $preserve keys = true - +array(4) { + ["f4"]=> + float(33333333.3333) + [3]=> + float(4.8999992284) + ["f2"]=> + float(3.33) + ["f1"]=> + float(1.2) +} +- $preserve_keys = false - +array(4) { + ["f4"]=> + float(33333333.3333) + [0]=> + float(4.8999992284) + ["f2"]=> + float(3.33) + ["f1"]=> + float(1.2) +} +-- Iteration 7 -- +- default argument - +array(4) { + [0]=> + string(4) "pen +" + [1]=> + string(7) " world" + ["red"]=> + string(6) "col or" + [2]=> + string(6) " Hello" +} +- $preserve keys = true - +array(4) { + [3]=> + string(4) "pen +" + [2]=> + string(7) " world" + ["red"]=> + string(6) "col or" + [111]=> + string(6) " Hello" +} +- $preserve_keys = false - +array(4) { + [0]=> + string(4) "pen +" + [1]=> + string(7) " world" + ["red"]=> + string(6) "col or" + [2]=> + string(6) " Hello" +} +-- Iteration 8 -- +- default argument - +array(4) { + [0]=> + string(5) "pen\n" + [1]=> + string(9) "\v\fworld" + ["red"]=> + string(7) "col\tor" + [2]=> + string(7) "\tHello" +} +- $preserve keys = true - +array(4) { + [3]=> + string(5) "pen\n" + [2]=> + string(9) "\v\fworld" + ["red"]=> + string(7) "col\tor" + [111]=> + string(7) "\tHello" +} +- $preserve_keys = false - +array(4) { + [0]=> + string(5) "pen\n" + [1]=> + string(9) "\v\fworld" + ["red"]=> + string(7) "col\tor" + [2]=> + string(7) "\tHello" +} +-- Iteration 9 -- +- default argument - +array(2) { + ["heredoc"]=> + string(11) "Hello world" + [0]=> + string(5) "hello" +} +- $preserve keys = true - +array(2) { + ["heredoc"]=> + string(11) "Hello world" + [1]=> + string(5) "hello" +} +- $preserve_keys = false - +array(2) { + ["heredoc"]=> + string(11) "Hello world" + [0]=> + string(5) "hello" +} +-- Iteration 10 -- +- default argument - +array(3) { + ["resource"]=> + resource(%d) of type (stream) + ["unset"]=> + NULL + [0]=> + object(classA)#%d (0) { + } +} +- $preserve keys = true - +array(3) { + ["resource"]=> + resource(%d) of type (stream) + ["unset"]=> + NULL + [11]=> + object(classA)#%d (0) { + } +} +- $preserve_keys = false - +array(3) { + ["resource"]=> + resource(%d) of type (stream) + ["unset"]=> + NULL + [0]=> + object(classA)#%d (0) { + } +} +-- Iteration 11 -- +- default argument - +array(8) { + ["heredoc"]=> + string(11) "Hello world" + ["unset"]=> + NULL + ["float"]=> + float(444.432) + ["int"]=> + int(133) + ["resource"]=> + resource(%d) of type (stream) + [0]=> + string(5) "fruit" + [1]=> + object(classA)#%d (0) { + } + [2]=> + string(5) "hello" +} +- $preserve keys = true - +array(8) { + ["heredoc"]=> + string(11) "Hello world" + ["unset"]=> + NULL + ["float"]=> + float(444.432) + ["int"]=> + int(133) + ["resource"]=> + resource(%d) of type (stream) + [222]=> + string(5) "fruit" + [2]=> + object(classA)#%d (0) { + } + [1]=> + string(5) "hello" +} +- $preserve_keys = false - +array(8) { + ["heredoc"]=> + string(11) "Hello world" + ["unset"]=> + NULL + ["float"]=> + float(444.432) + ["int"]=> + int(133) + ["resource"]=> + resource(%d) of type (stream) + [0]=> + string(5) "fruit" + [1]=> + object(classA)#%d (0) { + } + [2]=> + string(5) "hello" +} +Done diff --git a/ext/standard/tests/array/array_reverse_variation6.phpt b/ext/standard/tests/array/array_reverse_variation6.phpt new file mode 100644 index 0000000..ae1e195 --- /dev/null +++ b/ext/standard/tests/array/array_reverse_variation6.phpt @@ -0,0 +1,209 @@ +--TEST-- +Test array_reverse() function : usage variations - two dimensional arrays for 'array' argument +--FILE-- + 'red', 'item' => 'pen', 'place' => 'LA'), + + // numeric array + array(1, 2, 3, 4, 5), + + // combination of numeric and associative arrays + array('a' => 'green', 'red', 'brown', 33, 88, 'orange', 'item' => 'ball') +); + +// calling array_reverse() with various types of 2-d arrays +// with default arguments +echo "-- with default argument --\n"; +var_dump( array_reverse($two_dimensional_array) ); // whole array +var_dump( array_reverse($two_dimensional_array[1]) ); // sub array + +// with $preserve_keys argument +echo "-- with all possible arguments --\n"; +// whole array +var_dump( array_reverse($two_dimensional_array, true) ); +var_dump( array_reverse($two_dimensional_array, false) ); +// sub array +var_dump( array_reverse($two_dimensional_array[1], true) ); +var_dump( array_reverse($two_dimensional_array[1], false) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_reverse() : usage variations *** +-- with default argument -- +array(3) { + [0]=> + array(7) { + ["a"]=> + string(5) "green" + [0]=> + string(3) "red" + [1]=> + string(5) "brown" + [2]=> + int(33) + [3]=> + int(88) + [4]=> + string(6) "orange" + ["item"]=> + string(4) "ball" + } + [1]=> + array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + } + [2]=> + array(3) { + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + ["place"]=> + string(2) "LA" + } +} +array(5) { + [0]=> + int(5) + [1]=> + int(4) + [2]=> + int(3) + [3]=> + int(2) + [4]=> + int(1) +} +-- with all possible arguments -- +array(3) { + [2]=> + array(7) { + ["a"]=> + string(5) "green" + [0]=> + string(3) "red" + [1]=> + string(5) "brown" + [2]=> + int(33) + [3]=> + int(88) + [4]=> + string(6) "orange" + ["item"]=> + string(4) "ball" + } + [1]=> + array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + } + [0]=> + array(3) { + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + ["place"]=> + string(2) "LA" + } +} +array(3) { + [0]=> + array(7) { + ["a"]=> + string(5) "green" + [0]=> + string(3) "red" + [1]=> + string(5) "brown" + [2]=> + int(33) + [3]=> + int(88) + [4]=> + string(6) "orange" + ["item"]=> + string(4) "ball" + } + [1]=> + array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + } + [2]=> + array(3) { + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + ["place"]=> + string(2) "LA" + } +} +array(5) { + [4]=> + int(5) + [3]=> + int(4) + [2]=> + int(3) + [1]=> + int(2) + [0]=> + int(1) +} +array(5) { + [0]=> + int(5) + [1]=> + int(4) + [2]=> + int(3) + [3]=> + int(2) + [4]=> + int(1) +} +Done diff --git a/ext/standard/tests/array/array_search.phpt b/ext/standard/tests/array/array_search.phpt new file mode 100644 index 0000000..1afcb1d Binary files /dev/null and b/ext/standard/tests/array/array_search.phpt differ diff --git a/ext/standard/tests/array/array_search1.phpt b/ext/standard/tests/array/array_search1.phpt new file mode 100644 index 0000000..26377d2 --- /dev/null +++ b/ext/standard/tests/array/array_search1.phpt @@ -0,0 +1,35 @@ +--TEST-- +array_search() tests +--FILE-- +0, 2=>1, 4=>3, "a"=>"b", "c"=>"d"); + +var_dump(array_search(1)); +var_dump(array_search(1,1)); +var_dump(array_search("a",$a)); +var_dump(array_search("0",$a, true)); +var_dump(array_search("0",$a)); +var_dump(array_search(0,$a)); +var_dump(array_search(1,$a)); +var_dump(array_search("d",$a, true)); +var_dump(array_search("d",$a)); +var_dump(array_search(-1,$a, true)); + +echo "Done\n"; +?> +--EXPECTF-- +Warning: array_search() expects at least 2 parameters, 1 given in %s on line %d +NULL + +Warning: array_search() expects parameter 2 to be array, integer given in %s on line %d +NULL +int(1) +bool(false) +int(1) +int(1) +int(2) +string(1) "c" +int(1) +bool(false) +Done diff --git a/ext/standard/tests/array/array_search_errors.phpt b/ext/standard/tests/array/array_search_errors.phpt new file mode 100644 index 0000000..0127f62 --- /dev/null +++ b/ext/standard/tests/array/array_search_errors.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test array_search() function - error conditions +--FILE-- + +--EXPECTF-- +*** Testing error conditions of array_search() *** + +Warning: array_search() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: array_search() expects at most 3 parameters, 4 given in %s on line %d +NULL + +Warning: array_search() expects at least 2 parameters, 1 given in %s on line %d +NULL + +Warning: array_search() expects parameter 2 to be array, string given in %s on line %d +NULL + +Warning: array_search() expects parameter 2 to be array, integer given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_search_variation1.phpt b/ext/standard/tests/array/array_search_variation1.phpt new file mode 100644 index 0000000..9639501 --- /dev/null +++ b/ext/standard/tests/array/array_search_variation1.phpt @@ -0,0 +1,641 @@ +--TEST-- +Test array_search() function : usage variations - different needle values +--FILE-- + "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL, "b", "ab", "abcd"), + array(4, array(1, 2 => 3), "one" => 1, "5" => 5 ), + array(-1, -2, -3, -4, -2.989888, "-0.005" => "neg0.005", 2.0 => "float2", "-.9" => -.9), + array(TRUE, FALSE), + array("", array()), + array("abcd\x00abcd\x00abcd"), + array("abcd\tabcd\nabcd\rabcd\0abcdefghij") +); + +$array_compare = array ( + 4, + "4", + 4.00, + "b", + "5", + -2, + -2.0, + -2.98989, + "-.9", + "True", + "", + array(), + NULL, + "ab", + "abcd", + 0.0, + -0, + "abcd\x00abcd\x00abcd" +); +/* loop to check if elements in $array_compare exist in $arrays + using array_search() */ +$counter = 1; +foreach($arrays as $array) { + foreach($array_compare as $compare) { + echo "-- Iteration $counter --\n"; + //strict option OFF + var_dump(array_search($compare,$array)); + //strict option ON + var_dump(array_search($compare,$array,TRUE)); + //strict option OFF + var_dump(array_search($compare,$array,FALSE)); + $counter++; + } +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing array_search() with different needle values *** +-- Iteration 1 -- +bool(false) +bool(false) +bool(false) +-- Iteration 2 -- +bool(false) +bool(false) +bool(false) +-- Iteration 3 -- +bool(false) +bool(false) +bool(false) +-- Iteration 4 -- +int(0) +bool(false) +int(0) +-- Iteration 5 -- +bool(false) +bool(false) +bool(false) +-- Iteration 6 -- +bool(false) +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +bool(false) +-- Iteration 8 -- +bool(false) +bool(false) +bool(false) +-- Iteration 9 -- +bool(false) +bool(false) +bool(false) +-- Iteration 10 -- +int(0) +bool(false) +int(0) +-- Iteration 11 -- +int(0) +bool(false) +int(0) +-- Iteration 12 -- +bool(false) +bool(false) +bool(false) +-- Iteration 13 -- +int(0) +bool(false) +int(0) +-- Iteration 14 -- +int(0) +bool(false) +int(0) +-- Iteration 15 -- +int(0) +bool(false) +int(0) +-- Iteration 16 -- +int(0) +bool(false) +int(0) +-- Iteration 17 -- +int(0) +int(0) +int(0) +-- Iteration 18 -- +int(0) +bool(false) +int(0) +-- Iteration 19 -- +int(4) +int(4) +int(4) +-- Iteration 20 -- +int(4) +bool(false) +int(4) +-- Iteration 21 -- +int(4) +bool(false) +int(4) +-- Iteration 22 -- +int(5) +int(5) +int(5) +-- Iteration 23 -- +bool(false) +bool(false) +bool(false) +-- Iteration 24 -- +bool(false) +bool(false) +bool(false) +-- Iteration 25 -- +bool(false) +bool(false) +bool(false) +-- Iteration 26 -- +bool(false) +bool(false) +bool(false) +-- Iteration 27 -- +bool(false) +bool(false) +bool(false) +-- Iteration 28 -- +bool(false) +bool(false) +bool(false) +-- Iteration 29 -- +string(0) "" +bool(false) +string(0) "" +-- Iteration 30 -- +string(0) "" +bool(false) +string(0) "" +-- Iteration 31 -- +string(0) "" +string(0) "" +string(0) "" +-- Iteration 32 -- +int(6) +int(6) +int(6) +-- Iteration 33 -- +int(7) +int(7) +int(7) +-- Iteration 34 -- +string(1) "a" +bool(false) +string(1) "a" +-- Iteration 35 -- +string(1) "a" +bool(false) +string(1) "a" +-- Iteration 36 -- +bool(false) +bool(false) +bool(false) +-- Iteration 37 -- +int(0) +int(0) +int(0) +-- Iteration 38 -- +int(0) +bool(false) +int(0) +-- Iteration 39 -- +int(0) +bool(false) +int(0) +-- Iteration 40 -- +bool(false) +bool(false) +bool(false) +-- Iteration 41 -- +int(5) +bool(false) +int(5) +-- Iteration 42 -- +bool(false) +bool(false) +bool(false) +-- Iteration 43 -- +bool(false) +bool(false) +bool(false) +-- Iteration 44 -- +bool(false) +bool(false) +bool(false) +-- Iteration 45 -- +bool(false) +bool(false) +bool(false) +-- Iteration 46 -- +bool(false) +bool(false) +bool(false) +-- Iteration 47 -- +bool(false) +bool(false) +bool(false) +-- Iteration 48 -- +bool(false) +bool(false) +bool(false) +-- Iteration 49 -- +bool(false) +bool(false) +bool(false) +-- Iteration 50 -- +bool(false) +bool(false) +bool(false) +-- Iteration 51 -- +bool(false) +bool(false) +bool(false) +-- Iteration 52 -- +bool(false) +bool(false) +bool(false) +-- Iteration 53 -- +bool(false) +bool(false) +bool(false) +-- Iteration 54 -- +bool(false) +bool(false) +bool(false) +-- Iteration 55 -- +bool(false) +bool(false) +bool(false) +-- Iteration 56 -- +bool(false) +bool(false) +bool(false) +-- Iteration 57 -- +bool(false) +bool(false) +bool(false) +-- Iteration 58 -- +bool(false) +bool(false) +bool(false) +-- Iteration 59 -- +bool(false) +bool(false) +bool(false) +-- Iteration 60 -- +int(1) +int(1) +int(1) +-- Iteration 61 -- +int(1) +bool(false) +int(1) +-- Iteration 62 -- +bool(false) +bool(false) +bool(false) +-- Iteration 63 -- +string(3) "-.9" +bool(false) +string(3) "-.9" +-- Iteration 64 -- +bool(false) +bool(false) +bool(false) +-- Iteration 65 -- +bool(false) +bool(false) +bool(false) +-- Iteration 66 -- +bool(false) +bool(false) +bool(false) +-- Iteration 67 -- +bool(false) +bool(false) +bool(false) +-- Iteration 68 -- +bool(false) +bool(false) +bool(false) +-- Iteration 69 -- +bool(false) +bool(false) +bool(false) +-- Iteration 70 -- +int(2) +bool(false) +int(2) +-- Iteration 71 -- +int(2) +bool(false) +int(2) +-- Iteration 72 -- +bool(false) +bool(false) +bool(false) +-- Iteration 73 -- +int(0) +bool(false) +int(0) +-- Iteration 74 -- +int(0) +bool(false) +int(0) +-- Iteration 75 -- +int(0) +bool(false) +int(0) +-- Iteration 76 -- +int(0) +bool(false) +int(0) +-- Iteration 77 -- +int(0) +bool(false) +int(0) +-- Iteration 78 -- +int(0) +bool(false) +int(0) +-- Iteration 79 -- +int(0) +bool(false) +int(0) +-- Iteration 80 -- +int(0) +bool(false) +int(0) +-- Iteration 81 -- +int(0) +bool(false) +int(0) +-- Iteration 82 -- +int(0) +bool(false) +int(0) +-- Iteration 83 -- +int(1) +bool(false) +int(1) +-- Iteration 84 -- +int(1) +bool(false) +int(1) +-- Iteration 85 -- +int(1) +bool(false) +int(1) +-- Iteration 86 -- +int(0) +bool(false) +int(0) +-- Iteration 87 -- +int(0) +bool(false) +int(0) +-- Iteration 88 -- +int(1) +bool(false) +int(1) +-- Iteration 89 -- +int(1) +bool(false) +int(1) +-- Iteration 90 -- +int(0) +bool(false) +int(0) +-- Iteration 91 -- +bool(false) +bool(false) +bool(false) +-- Iteration 92 -- +bool(false) +bool(false) +bool(false) +-- Iteration 93 -- +bool(false) +bool(false) +bool(false) +-- Iteration 94 -- +bool(false) +bool(false) +bool(false) +-- Iteration 95 -- +bool(false) +bool(false) +bool(false) +-- Iteration 96 -- +bool(false) +bool(false) +bool(false) +-- Iteration 97 -- +bool(false) +bool(false) +bool(false) +-- Iteration 98 -- +bool(false) +bool(false) +bool(false) +-- Iteration 99 -- +bool(false) +bool(false) +bool(false) +-- Iteration 100 -- +bool(false) +bool(false) +bool(false) +-- Iteration 101 -- +int(0) +int(0) +int(0) +-- Iteration 102 -- +int(1) +int(1) +int(1) +-- Iteration 103 -- +int(0) +bool(false) +int(0) +-- Iteration 104 -- +bool(false) +bool(false) +bool(false) +-- Iteration 105 -- +bool(false) +bool(false) +bool(false) +-- Iteration 106 -- +int(0) +bool(false) +int(0) +-- Iteration 107 -- +int(0) +bool(false) +int(0) +-- Iteration 108 -- +bool(false) +bool(false) +bool(false) +-- Iteration 109 -- +bool(false) +bool(false) +bool(false) +-- Iteration 110 -- +bool(false) +bool(false) +bool(false) +-- Iteration 111 -- +bool(false) +bool(false) +bool(false) +-- Iteration 112 -- +bool(false) +bool(false) +bool(false) +-- Iteration 113 -- +bool(false) +bool(false) +bool(false) +-- Iteration 114 -- +bool(false) +bool(false) +bool(false) +-- Iteration 115 -- +bool(false) +bool(false) +bool(false) +-- Iteration 116 -- +bool(false) +bool(false) +bool(false) +-- Iteration 117 -- +bool(false) +bool(false) +bool(false) +-- Iteration 118 -- +bool(false) +bool(false) +bool(false) +-- Iteration 119 -- +bool(false) +bool(false) +bool(false) +-- Iteration 120 -- +bool(false) +bool(false) +bool(false) +-- Iteration 121 -- +bool(false) +bool(false) +bool(false) +-- Iteration 122 -- +bool(false) +bool(false) +bool(false) +-- Iteration 123 -- +bool(false) +bool(false) +bool(false) +-- Iteration 124 -- +int(0) +bool(false) +int(0) +-- Iteration 125 -- +int(0) +bool(false) +int(0) +-- Iteration 126 -- +int(0) +int(0) +int(0) +-- Iteration 127 -- +bool(false) +bool(false) +bool(false) +-- Iteration 128 -- +bool(false) +bool(false) +bool(false) +-- Iteration 129 -- +bool(false) +bool(false) +bool(false) +-- Iteration 130 -- +bool(false) +bool(false) +bool(false) +-- Iteration 131 -- +bool(false) +bool(false) +bool(false) +-- Iteration 132 -- +bool(false) +bool(false) +bool(false) +-- Iteration 133 -- +bool(false) +bool(false) +bool(false) +-- Iteration 134 -- +bool(false) +bool(false) +bool(false) +-- Iteration 135 -- +bool(false) +bool(false) +bool(false) +-- Iteration 136 -- +bool(false) +bool(false) +bool(false) +-- Iteration 137 -- +bool(false) +bool(false) +bool(false) +-- Iteration 138 -- +bool(false) +bool(false) +bool(false) +-- Iteration 139 -- +bool(false) +bool(false) +bool(false) +-- Iteration 140 -- +bool(false) +bool(false) +bool(false) +-- Iteration 141 -- +bool(false) +bool(false) +bool(false) +-- Iteration 142 -- +int(0) +bool(false) +int(0) +-- Iteration 143 -- +int(0) +bool(false) +int(0) +-- Iteration 144 -- +bool(false) +bool(false) +bool(false) +Done diff --git a/ext/standard/tests/array/array_search_variation2.phpt b/ext/standard/tests/array/array_search_variation2.phpt new file mode 100644 index 0000000..da90de0 --- /dev/null +++ b/ext/standard/tests/array/array_search_variation2.phpt @@ -0,0 +1,102 @@ +--TEST-- +Test array_search() function : usage variations - different haystack values +--FILE-- +'d', + 3, + ".001" =>-67, + "-.051" =>"k", + 0.091 =>"-.08", + "e" =>"5", + "y" =>NULL, + NULL =>"", + 0, + TRUE, + FALSE, + -27.39999999999, + " ", + "abcd\x00abcd\x00\abcd\x00abcdefghij", + "abcd\nabcd\tabcd\rabcd\0abcd" +); +$array_type = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "PHP", ""); +/* loop to do loose and strict type check of elements in + $array_type on elements in $misc_array using array_search(); + checking PHP type comparison tables +*/ +$counter = 1; +foreach($array_type as $type) { + echo "-- Iteration $counter --\n"; + //loose type checking + var_dump( array_search($type,$misc_array ) ); + //strict type checking + var_dump( array_search($type,$misc_array,true) ); + //loose type checking + var_dump( array_search($type,$misc_array,false) ); + $counter++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing array_search() with different haystack values *** +-- Iteration 1 -- +int(0) +int(3) +int(0) +-- Iteration 2 -- +string(1) "y" +int(4) +string(1) "y" +-- Iteration 3 -- +int(3) +bool(false) +int(3) +-- Iteration 4 -- +string(3) "key" +int(2) +string(3) "key" +-- Iteration 5 -- +int(3) +bool(false) +int(3) +-- Iteration 6 -- +int(3) +bool(false) +int(3) +-- Iteration 7 -- +int(2) +bool(false) +int(2) +-- Iteration 8 -- +int(3) +bool(false) +int(3) +-- Iteration 9 -- +string(1) "y" +string(1) "y" +string(1) "y" +-- Iteration 10 -- +string(1) "y" +bool(false) +string(1) "y" +-- Iteration 11 -- +int(2) +bool(false) +int(2) +-- Iteration 12 -- +string(1) "y" +string(0) "" +string(1) "y" +Done diff --git a/ext/standard/tests/array/array_search_variation3.phpt b/ext/standard/tests/array/array_search_variation3.phpt new file mode 100644 index 0000000..8af089a --- /dev/null +++ b/ext/standard/tests/array/array_search_variation3.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test array_search() function : usage variations - haystack as sub-array/object +--FILE-- + "two", "three" => 3), + 4 => "four", + "five" => 5, + array('', 'i') +); +var_dump( array_search("four", $sub_array) ); +//checking for element in a sub-array +var_dump( array_search(3, $sub_array[1]) ); +var_dump( array_search(array('','i'), $sub_array) ); + +/* checking for objects in array_search() */ +echo "\n*** Testing objects with array_search() ***\n"; +class array_search_check { + public $array_var = array(1=>"one", "two"=>2, 3=>3); + public function foo() { + echo "Public function\n"; + } +} + +$array_search_obj = new array_search_check(); //creating new object +//error: as wrong datatype for second argument +var_dump( array_search("array_var", $array_search_obj) ); +//error: as wrong datatype for second argument +var_dump( array_search("foo", $array_search_obj) ); +//element found as "one" exists in array $array_var +var_dump( array_search("one", $array_search_obj->array_var) ); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing sub-arrays with array_search() *** +int(4) +string(5) "three" +int(5) + +*** Testing objects with array_search() *** + +Warning: array_search() expects parameter 2 to be array, object given in %s on line %d +NULL + +Warning: array_search() expects parameter 2 to be array, object given in %s on line %d +NULL +int(1) +Done diff --git a/ext/standard/tests/array/array_search_variation4.phpt b/ext/standard/tests/array/array_search_variation4.phpt new file mode 100644 index 0000000..04f3b91 --- /dev/null +++ b/ext/standard/tests/array/array_search_variation4.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test array_search() function : usage variations - haystack as resource/multi dimentional array +--FILE-- + TRUE, "b"=> TRUE, + array("c"=> TRUE, "d"=>TRUE) + ) + ) + ); + +//matching string having integer in beginning, result:true in loose type check +var_dump( array_search('123abc', array(123)) ); +var_dump( array_search('123abc', array(123), TRUE) ); // false in strict mode + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing resource type with array_search() *** +int(0) +bool(false) + +*** Testing miscelleneos inputs with array_search() *** +int(0) +bool(false) +int(0) +int(0) +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +Done diff --git a/ext/standard/tests/array/array_shift_basic.phpt b/ext/standard/tests/array/array_shift_basic.phpt new file mode 100644 index 0000000..2bb4ae9 --- /dev/null +++ b/ext/standard/tests/array/array_shift_basic.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test array_shift() function : basic functionality +--FILE-- + 'three', 'four' => 4); +echo "\n-- Before shift: --\n"; +var_dump($array); + +echo "\n-- After shift: --\n"; +echo "Returned value:\t"; +var_dump(array_shift($array)); +echo "New array:\n"; +var_dump($array); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_shift() : basic functionality *** + +-- Before shift: -- +array(4) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [3]=> + string(5) "three" + ["four"]=> + int(4) +} + +-- After shift: -- +Returned value: string(4) "zero" +New array: +array(3) { + [0]=> + string(3) "one" + [1]=> + string(5) "three" + ["four"]=> + int(4) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_shift_error.phpt b/ext/standard/tests/array/array_shift_error.phpt new file mode 100644 index 0000000..fcfb931 --- /dev/null +++ b/ext/standard/tests/array/array_shift_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test array_shift() function : error conditions - Pass incorrect number of args +--FILE-- + +--EXPECTF-- +*** Testing array_shift() : error conditions *** + +-- Testing array_shift() function with Zero arguments -- + +Warning: array_shift() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing array_shift() function with more than expected no. of arguments -- + +Warning: array_shift() 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/array/array_shift_variation1.phpt b/ext/standard/tests/array/array_shift_variation1.phpt new file mode 100644 index 0000000..fea2d59 --- /dev/null +++ b/ext/standard/tests/array/array_shift_variation1.phpt @@ -0,0 +1,218 @@ +--TEST-- +Test array_shift() function : usage variations - Pass different data types as $stack arg +--FILE-- + +--EXPECTF-- +*** Testing array_shift() : usage variations *** + +-- Iteration 1 -- + +Warning: array_shift() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: array_shift() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: array_shift() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: array_shift() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: array_shift() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: array_shift() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_shift() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_shift() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_shift() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_shift() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_shift() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: array_shift() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: array_shift() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: array_shift() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: array_shift() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_shift() expects parameter 1 to be array, object given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: array_shift() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: array_shift() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: array_shift() expects parameter 1 to be array, resource given in %s on line 85 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_shift_variation2.phpt b/ext/standard/tests/array/array_shift_variation2.phpt new file mode 100644 index 0000000..2b3adc6 --- /dev/null +++ b/ext/standard/tests/array/array_shift_variation2.phpt @@ -0,0 +1,208 @@ +--TEST-- +Test array_shift() function : usage variations - Pass arrays of different data types +--FILE-- + array( + 0, + 1, + 12345, + -2345, + ), + + // float data +/*2*/ 'float' => array( + 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + ), + + // null data +/*3*/ 'null' => array( + NULL, + null, + ), + + // boolean data +/*4*/ 'bool' => array( + true, + false, + TRUE, + FALSE, + ), + + // empty data +/*5*/ 'empty string' => array( + "", + '', + ), + +/*6*/ 'empty array' => array( + ), + + // string data +/*7*/ 'string' => array( + "string", + 'string', + $heredoc, + ), + + // object data +/*8*/ 'object' => array( + new classA(), + ), + + // undefined data +/*9*/ 'undefined' => array( + @$undefined_var, + ), + + // unset data +/*10*/ 'unset' => array( + @$unset_var, + ), + + // resource variable +/*11*/ 'resource' => array( + $fp + ), +); + +// loop through each element of $inputs to check the behavior of array_shift +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator: $key data --\n"; + var_dump( array_shift($input) ); + var_dump($input); + $iterator++; +}; + +fclose($fp); + + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_shift() : usage variations *** + +-- Iteration 1: int data -- +int(0) +array(3) { + [0]=> + int(1) + [1]=> + int(12345) + [2]=> + int(-2345) +} + +-- Iteration 2: float data -- +float(10.5) +array(4) { + [0]=> + float(-10.5) + [1]=> + float(123456789000) + [2]=> + float(1.23456789E-9) + [3]=> + float(0.5) +} + +-- Iteration 3: null data -- +NULL +array(1) { + [0]=> + NULL +} + +-- Iteration 4: bool data -- +bool(true) +array(3) { + [0]=> + bool(false) + [1]=> + bool(true) + [2]=> + bool(false) +} + +-- Iteration 5: empty string data -- +string(0) "" +array(1) { + [0]=> + string(0) "" +} + +-- Iteration 6: empty array data -- +NULL +array(0) { +} + +-- Iteration 7: string data -- +string(6) "string" +array(2) { + [0]=> + string(6) "string" + [1]=> + string(11) "hello world" +} + +-- Iteration 8: object data -- +object(classA)#%d (0) { +} +array(0) { +} + +-- Iteration 9: undefined data -- +NULL +array(0) { +} + +-- Iteration 10: unset data -- +NULL +array(0) { +} + +-- Iteration 11: resource data -- +resource(%d) of type (stream) +array(0) { +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_shift_variation3.phpt b/ext/standard/tests/array/array_shift_variation3.phpt new file mode 100644 index 0000000..cc260c6 --- /dev/null +++ b/ext/standard/tests/array/array_shift_variation3.phpt @@ -0,0 +1,188 @@ +--TEST-- +Test array_shift() function : usage variations - Pass array with different data types as keys +--FILE-- + array( + 0 => 'zero', + 1 => 'one', + 12345 => 'positive', + -2345 => 'negative', + ), + + // float data +/*2*/ 'float' => array( + 10.5 => 'positive', + -10.5 => 'negative', + .5 => 'half', + ), + +/*3*/ 'extreme floats' => array( + 12.3456789000e10 => 'large', + 12.3456789000E-10 => 'small', + ), + + // null data +/*4*/ 'null uppercase' => array( + NULL => 'null 1', + ), + +/*5*/ 'null lowercase' => array( + null => 'null 2', + ), + + // boolean data +/*6*/ 'bool lowercase' => array( + true => 'lowert', + false => 'lowerf', + ), + +/*7*/ 'bool uppercase' => array( + TRUE => 'uppert', + FALSE => 'upperf', + ), + + // empty data +/*8*/ 'empty double quotes' => array( + "" => 'emptyd', + ), + +/*9*/ 'empty single quotes' => array( + '' => 'emptys', + ), + + // string data +/*10*/ 'string' => array( + "stringd" => 'stringd', + 'strings' => 'strings', + $heredoc => 'stringh', + ), + + // undefined data +/*11*/ 'undefined' => array( + @$undefined_var => 'undefined', + ), + + // unset data +/*12*/ 'unset' => array( + @$unset_var => 'unset', + ), +); + +// loop through each element of $inputs to check the behavior of array_shift() +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator : $key data --\n"; + var_dump( array_shift($input) ); + var_dump($input); + $iterator++; +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_shift() : usage variations *** + +-- Iteration 1 : int data -- +string(4) "zero" +array(3) { + [0]=> + string(3) "one" + [1]=> + string(8) "positive" + [2]=> + string(8) "negative" +} + +-- Iteration 2 : float data -- +string(8) "positive" +array(2) { + [0]=> + string(8) "negative" + [1]=> + string(4) "half" +} + +-- Iteration 3 : extreme floats data -- +string(5) "large" +array(1) { + [0]=> + string(5) "small" +} + +-- Iteration 4 : null uppercase data -- +string(6) "null 1" +array(0) { +} + +-- Iteration 5 : null lowercase data -- +string(6) "null 2" +array(0) { +} + +-- Iteration 6 : bool lowercase data -- +string(6) "lowert" +array(1) { + [0]=> + string(6) "lowerf" +} + +-- Iteration 7 : bool uppercase data -- +string(6) "uppert" +array(1) { + [0]=> + string(6) "upperf" +} + +-- Iteration 8 : empty double quotes data -- +string(6) "emptyd" +array(0) { +} + +-- Iteration 9 : empty single quotes data -- +string(6) "emptys" +array(0) { +} + +-- Iteration 10 : string data -- +string(7) "stringd" +array(2) { + ["strings"]=> + string(7) "strings" + ["hello world"]=> + string(7) "stringh" +} + +-- Iteration 11 : undefined data -- +string(9) "undefined" +array(0) { +} + +-- Iteration 12 : unset data -- +string(5) "unset" +array(0) { +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_shift_variation4.phpt b/ext/standard/tests/array/array_shift_variation4.phpt new file mode 100644 index 0000000..f276815 --- /dev/null +++ b/ext/standard/tests/array/array_shift_variation4.phpt @@ -0,0 +1,109 @@ +--TEST-- +Test array_shift() function : usage variations - multi-dimensional arrays +--FILE-- + +--EXPECTF-- +*** Testing array_shift() : usage variations *** + +-- Before shift: -- +---- $stack_first: +array(3) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [1]=> + string(3) "one" + [2]=> + string(3) "two" +} +---- $stack_last: +array(3) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} + +-- After shift: -- +---- Pop array from array: +Returned value: array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +New array: +array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" +} +---- Pop element from array within array: +Returned value: int(1) +New array: +array(3) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + array(2) { + [0]=> + int(2) + [1]=> + int(3) + } +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_shift_variation5.phpt b/ext/standard/tests/array/array_shift_variation5.phpt new file mode 100644 index 0000000..578b870 --- /dev/null +++ b/ext/standard/tests/array/array_shift_variation5.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test array_shift() function : usage variations - call recursively +--FILE-- + +--EXPECTF-- +*** Testing array_shift() : usage variations *** + +-- Incorrect Method: -- + +Strict Standards: Only variables should be passed by reference in %s on line %d + +Strict Standards: Only variables should be passed by reference in %s on line %d +string(4) "zero" + +-- Correct Method: -- +string(4) "zero" +Done diff --git a/ext/standard/tests/array/array_shift_variation6.phpt b/ext/standard/tests/array/array_shift_variation6.phpt new file mode 100644 index 0000000..9033e7d --- /dev/null +++ b/ext/standard/tests/array/array_shift_variation6.phpt @@ -0,0 +1,83 @@ +--TEST-- +Test array_shift() function : usage variations - Referenced arrays +--FILE-- + +--EXPECTF-- +*** Testing array_shift() : usage variations *** + +-- Variable is referenced array -- +Result: string(4) "zero" + +$original_array: +array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" +} + +$copied_array: +array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" +} + +-- Element is referenced array -- +Result: string(3) "one" + +$new_array: +array(3) { + [0]=> + &array(1) { + [0]=> + string(3) "two" + } + [1]=> + int(1) + [2]=> + string(3) "two" +} + +$copied_array +array(1) { + [0]=> + string(3) "two" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_shift_variation7.phpt b/ext/standard/tests/array/array_shift_variation7.phpt new file mode 100644 index 0000000..9367cac --- /dev/null +++ b/ext/standard/tests/array/array_shift_variation7.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test array_shift() function : usage variations - position of internal pointer +--FILE-- + 'un', 'two' => 'deux'); + +echo "\n-- Call array_shift() --\n"; +var_dump($result = array_shift($stack)); + +echo "\n-- Position of Internal Pointer in Passed Array: --\n"; +echo key($stack) . " => " . current ($stack) . "\n"; + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_shift() : usage variations *** + +-- Call array_shift() -- +string(2) "un" + +-- Position of Internal Pointer in Passed Array: -- +two => deux +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_shift_variation8.phpt b/ext/standard/tests/array/array_shift_variation8.phpt new file mode 100644 index 0000000..717d98f --- /dev/null +++ b/ext/standard/tests/array/array_shift_variation8.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test array_shift() function : usage variations - maintaining referenced elements +--FILE-- + +--EXPECTF-- +*** Testing array_shift() : usage variations *** + +-- Reference result of array_shift: -- + +Strict Standards: Only variables should be assigned by reference in %s on line %d +a = 1, b = 2 + +-- Reference first element before array_shift: -- +a = 2, b = 2 +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_shuffle_basic.phpt b/ext/standard/tests/array/array_shuffle_basic.phpt new file mode 100644 index 0000000..fdf9326 --- /dev/null +++ b/ext/standard/tests/array/array_shuffle_basic.phpt @@ -0,0 +1,99 @@ +--TEST-- +array_shuffle(): Test return type and value for expected input +--FILE-- + 1); +var_dump(shuffle($a)); +var_dump($a); +$a = array("a" => 1); +var_dump(shuffle($a)); +var_dump($a); +$a = array(array(1, 2, 3)); +var_dump(shuffle($a)); +var_dump($a); +$a = array(1, 1, 1, 1); +var_dump(shuffle($a)); +var_dump($a); +$arr1 = array(5 => 1, 6 => 2, 7 => 3, 8 => 9); +$arr2 = array(5 => 1, 6 => 2, 7 => 3, 8 => 9); +shuffle($arr1); +echo "this should be 0->...." . count(array_diff($arr1, $arr2)) . "\n"; +echo "this should be 4->...." . count(array_intersect($arr1, $arr2)) . "\n"; +$bigarray = range(1, 400); +shuffle($bigarray); +echo "this should be 400->...." . count($bigarray) . "\n"; +echo "*** testing pass by reference \n"; +$original = $bigarray; +shuffle($bigarray); +$diffarray = array_diff_assoc($original, $bigarray); +if (count($diffarray) < 350) { + // with 400 entries, the probability that 50 entries or more get the same + // key-> value association should be so close to zero it wont happen in the lifetime of the + // universe. + echo "shuffled array seems to be similar to original\n"; + var_dump($original); + var_dump($bigarray); +} else { + echo "test passed \n"; +} +?> +--EXPECT-- +*** testing array_shuffle +bool(true) +array(0) { +} +bool(true) +array(1) { + [0]=> + int(1) +} +bool(true) +array(1) { + [0]=> + int(1) +} +bool(true) +array(1) { + [0]=> + int(1) +} +bool(true) +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} +bool(true) +array(4) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) + [3]=> + int(1) +} +this should be 0->....0 +this should be 4->....4 +this should be 400->....400 +*** testing pass by reference +test passed \ No newline at end of file diff --git a/ext/standard/tests/array/array_slice.phpt b/ext/standard/tests/array/array_slice.phpt new file mode 100644 index 0000000..b17fbce --- /dev/null +++ b/ext/standard/tests/array/array_slice.phpt @@ -0,0 +1,1459 @@ +--TEST-- +Testing array_slice() function +--FILE-- + "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee"), + array("1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five"), + array(1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five"), + array("f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", + "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five"), + array(12, "name", 'age', '45'), + array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array()) + ); + +$num = 4; +$str = "john"; + +/* Zero args */ +echo"\n*** Output for Zero Argument ***\n"; +array_slice(); + +/* Single args */ +echo"\n*** Output for Single array Argument ***\n"; +array_slice($var_array); + +/* More than valid no. of args (ie. >4 ) */ +echo"\n*** Output for invalid number of Arguments ***\n"; +array_slice($var_array, 2, 4, true, 3); + +/* Scalar arg */ +echo"\n*** Output for scalar Argument ***\n"; +array_slice($num, 2); + +/* String arg */ +echo"\n*** Output for string Argument ***\n"; +array_slice($str, 2); + +$counter = 1; +foreach ($var_array as $sub_array) +{ + /* variations with two arguments */ + /* offset values >, < and = 0 */ + + echo"\n*** Iteration ".$counter." ***\n"; + echo"\n*** Variation with first two Arguments ***\n"; + var_dump ( array_slice($sub_array, 1) ); + var_dump ( array_slice($sub_array, 0) ); + var_dump ( array_slice($sub_array, -2) ); + + /* variations with three arguments */ + /* offset value variations with length values */ + echo"\n*** Variation with first three Arguments ***\n"; + var_dump ( array_slice($sub_array, 1, 3) ); + var_dump ( array_slice($sub_array, 1, 0) ); + var_dump ( array_slice($sub_array, 1, -3) ); + var_dump ( array_slice($sub_array, 0, 3) ); + var_dump ( array_slice($sub_array, 0, 0) ); + var_dump ( array_slice($sub_array, 0, -3) ); + var_dump ( array_slice($sub_array, -2, 3) ); + var_dump ( array_slice($sub_array, -2, 0 ) ); + var_dump ( array_slice($sub_array, -2, -3) ); + + /* variations with four arguments */ + /* offset value, length value and preserve_key values variation */ + echo"\n*** Variation with first two arguments with preserve_key value TRUE ***\n"; + var_dump ( array_slice($sub_array, 1, 3, true) ); + var_dump ( array_slice($sub_array, 1, 0, true) ); + var_dump ( array_slice($sub_array, 1, -3, true) ); + var_dump ( array_slice($sub_array, 0, 3, true) ); + var_dump ( array_slice($sub_array, 0, 0, true) ); + var_dump ( array_slice($sub_array, 0, -3, true) ); + var_dump ( array_slice($sub_array, -2, 3, true) ); + var_dump ( array_slice($sub_array, -2, 0, true) ); + var_dump ( array_slice($sub_array, -2, -3, true) ); + $counter++; +} + + /* variation of offset and length to point to same element */ + echo"\n*** Typical Variation of offset and length Arguments ***\n"; + var_dump (array_slice($var_array[2], 1, -3, true) ); + var_dump (array_slice($var_array[2], 1, -3, false) ); + var_dump (array_slice($var_array[2], -3, -2, true) ); + var_dump (array_slice($var_array[2], -3, -2, false) ); + +?> +--EXPECTF-- +*** Output for Zero Argument *** + +Warning: array_slice() expects at least 2 parameters, 0 given in %s on line %d + +*** Output for Single array Argument *** + +Warning: array_slice() expects at least 2 parameters, 1 given in %s on line %d + +*** Output for invalid number of Arguments *** + +Warning: array_slice() expects at most 4 parameters, 5 given in %s on line %d + +*** Output for scalar Argument *** + +Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d + +*** Output for string Argument *** + +Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d + +*** Iteration 1 *** + +*** Variation with first two Arguments *** +array(0) { +} +array(0) { +} +array(0) { +} + +*** Variation with first three Arguments *** +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} + +*** Variation with first two arguments with preserve_key value TRUE *** +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} + +*** Iteration 2 *** + +*** Variation with first two Arguments *** +array(8) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + int(4) + [3]=> + int(5) + [4]=> + int(6) + [5]=> + int(7) + [6]=> + int(8) + [7]=> + int(9) +} +array(9) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) +} +array(2) { + [0]=> + int(8) + [1]=> + int(9) +} + +*** Variation with first three Arguments *** +array(3) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + int(4) +} +array(0) { +} +array(5) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + int(4) + [3]=> + int(5) + [4]=> + int(6) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(0) { +} +array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) +} +array(2) { + [0]=> + int(8) + [1]=> + int(9) +} +array(0) { +} +array(0) { +} + +*** Variation with first two arguments with preserve_key value TRUE *** +array(3) { + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) +} +array(0) { +} +array(5) { + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(0) { +} +array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) +} +array(2) { + [7]=> + int(8) + [8]=> + int(9) +} +array(0) { +} +array(0) { +} + +*** Iteration 3 *** + +*** Variation with first two Arguments *** +array(4) { + [0]=> + string(3) "Two" + [1]=> + string(5) "Three" + [2]=> + string(4) "Four" + [3]=> + string(4) "Five" +} +array(5) { + [0]=> + string(3) "One" + [1]=> + string(3) "Two" + [2]=> + string(5) "Three" + [3]=> + string(4) "Four" + [4]=> + string(4) "Five" +} +array(2) { + [0]=> + string(4) "Four" + [1]=> + string(4) "Five" +} + +*** Variation with first three Arguments *** +array(3) { + [0]=> + string(3) "Two" + [1]=> + string(5) "Three" + [2]=> + string(4) "Four" +} +array(0) { +} +array(1) { + [0]=> + string(3) "Two" +} +array(3) { + [0]=> + string(3) "One" + [1]=> + string(3) "Two" + [2]=> + string(5) "Three" +} +array(0) { +} +array(2) { + [0]=> + string(3) "One" + [1]=> + string(3) "Two" +} +array(2) { + [0]=> + string(4) "Four" + [1]=> + string(4) "Five" +} +array(0) { +} +array(0) { +} + +*** Variation with first two arguments with preserve_key value TRUE *** +array(3) { + [1]=> + string(3) "Two" + [2]=> + string(5) "Three" + [3]=> + string(4) "Four" +} +array(0) { +} +array(1) { + [1]=> + string(3) "Two" +} +array(3) { + [0]=> + string(3) "One" + [1]=> + string(3) "Two" + [2]=> + string(5) "Three" +} +array(0) { +} +array(2) { + [0]=> + string(3) "One" + [1]=> + string(3) "Two" +} +array(2) { + [3]=> + string(4) "Four" + [4]=> + string(4) "Five" +} +array(0) { +} +array(0) { +} + +*** Iteration 4 *** + +*** Variation with first two Arguments *** +array(7) { + [0]=> + string(3) "six" + [1]=> + int(7) + [2]=> + string(5) "seven" + [3]=> + int(8) + [4]=> + string(5) "eight" + [5]=> + int(9) + [6]=> + string(4) "nine" +} +array(8) { + [0]=> + int(6) + [1]=> + string(3) "six" + [2]=> + int(7) + [3]=> + string(5) "seven" + [4]=> + int(8) + [5]=> + string(5) "eight" + [6]=> + int(9) + [7]=> + string(4) "nine" +} +array(2) { + [0]=> + int(9) + [1]=> + string(4) "nine" +} + +*** Variation with first three Arguments *** +array(3) { + [0]=> + string(3) "six" + [1]=> + int(7) + [2]=> + string(5) "seven" +} +array(0) { +} +array(4) { + [0]=> + string(3) "six" + [1]=> + int(7) + [2]=> + string(5) "seven" + [3]=> + int(8) +} +array(3) { + [0]=> + int(6) + [1]=> + string(3) "six" + [2]=> + int(7) +} +array(0) { +} +array(5) { + [0]=> + int(6) + [1]=> + string(3) "six" + [2]=> + int(7) + [3]=> + string(5) "seven" + [4]=> + int(8) +} +array(2) { + [0]=> + int(9) + [1]=> + string(4) "nine" +} +array(0) { +} +array(0) { +} + +*** Variation with first two arguments with preserve_key value TRUE *** +array(3) { + [1]=> + string(3) "six" + [2]=> + int(7) + [3]=> + string(5) "seven" +} +array(0) { +} +array(4) { + [1]=> + string(3) "six" + [2]=> + int(7) + [3]=> + string(5) "seven" + [4]=> + int(8) +} +array(3) { + [0]=> + int(6) + [1]=> + string(3) "six" + [2]=> + int(7) +} +array(0) { +} +array(5) { + [0]=> + int(6) + [1]=> + string(3) "six" + [2]=> + int(7) + [3]=> + string(5) "seven" + [4]=> + int(8) +} +array(2) { + [6]=> + int(9) + [7]=> + string(4) "nine" +} +array(0) { +} +array(0) { +} + +*** Iteration 5 *** + +*** Variation with first two Arguments *** +array(4) { + ["A"]=> + string(3) "AAA" + ["c"]=> + string(3) "ccc" + ["d"]=> + string(3) "ddd" + ["e"]=> + string(3) "eee" +} +array(5) { + ["a"]=> + string(3) "aaa" + ["A"]=> + string(3) "AAA" + ["c"]=> + string(3) "ccc" + ["d"]=> + string(3) "ddd" + ["e"]=> + string(3) "eee" +} +array(2) { + ["d"]=> + string(3) "ddd" + ["e"]=> + string(3) "eee" +} + +*** Variation with first three Arguments *** +array(3) { + ["A"]=> + string(3) "AAA" + ["c"]=> + string(3) "ccc" + ["d"]=> + string(3) "ddd" +} +array(0) { +} +array(1) { + ["A"]=> + string(3) "AAA" +} +array(3) { + ["a"]=> + string(3) "aaa" + ["A"]=> + string(3) "AAA" + ["c"]=> + string(3) "ccc" +} +array(0) { +} +array(2) { + ["a"]=> + string(3) "aaa" + ["A"]=> + string(3) "AAA" +} +array(2) { + ["d"]=> + string(3) "ddd" + ["e"]=> + string(3) "eee" +} +array(0) { +} +array(0) { +} + +*** Variation with first two arguments with preserve_key value TRUE *** +array(3) { + ["A"]=> + string(3) "AAA" + ["c"]=> + string(3) "ccc" + ["d"]=> + string(3) "ddd" +} +array(0) { +} +array(1) { + ["A"]=> + string(3) "AAA" +} +array(3) { + ["a"]=> + string(3) "aaa" + ["A"]=> + string(3) "AAA" + ["c"]=> + string(3) "ccc" +} +array(0) { +} +array(2) { + ["a"]=> + string(3) "aaa" + ["A"]=> + string(3) "AAA" +} +array(2) { + ["d"]=> + string(3) "ddd" + ["e"]=> + string(3) "eee" +} +array(0) { +} +array(0) { +} + +*** Iteration 6 *** + +*** Variation with first two Arguments *** +array(4) { + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "four" + [3]=> + string(4) "five" +} +array(5) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + [2]=> + string(5) "three" + [3]=> + string(4) "four" + [4]=> + string(4) "five" +} +array(2) { + [0]=> + string(4) "four" + [1]=> + string(4) "five" +} + +*** Variation with first three Arguments *** +array(3) { + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "four" +} +array(0) { +} +array(1) { + [0]=> + string(3) "two" +} +array(3) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + [2]=> + string(5) "three" +} +array(0) { +} +array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" +} +array(2) { + [0]=> + string(4) "four" + [1]=> + string(4) "five" +} +array(0) { +} +array(0) { +} + +*** Variation with first two arguments with preserve_key value TRUE *** +array(3) { + [2]=> + string(3) "two" + [3]=> + string(5) "three" + [4]=> + string(4) "four" +} +array(0) { +} +array(1) { + [2]=> + string(3) "two" +} +array(3) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" +} +array(0) { +} +array(2) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" +} +array(2) { + [4]=> + string(4) "four" + [5]=> + string(4) "five" +} +array(0) { +} +array(0) { +} + +*** Iteration 7 *** + +*** Variation with first two Arguments *** +array(4) { + [0]=> + string(3) "two" + [1]=> + int(7) + [2]=> + string(4) "four" + [3]=> + string(4) "five" +} +array(5) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + [2]=> + int(7) + [3]=> + string(4) "four" + [4]=> + string(4) "five" +} +array(2) { + [0]=> + string(4) "four" + [1]=> + string(4) "five" +} + +*** Variation with first three Arguments *** +array(3) { + [0]=> + string(3) "two" + [1]=> + int(7) + [2]=> + string(4) "four" +} +array(0) { +} +array(1) { + [0]=> + string(3) "two" +} +array(3) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + [2]=> + int(7) +} +array(0) { +} +array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" +} +array(2) { + [0]=> + string(4) "four" + [1]=> + string(4) "five" +} +array(0) { +} +array(0) { +} + +*** Variation with first two arguments with preserve_key value TRUE *** +array(3) { + [2]=> + string(3) "two" + [3]=> + int(7) + [4]=> + string(4) "four" +} +array(0) { +} +array(1) { + [2]=> + string(3) "two" +} +array(3) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + int(7) +} +array(0) { +} +array(2) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" +} +array(2) { + [4]=> + string(4) "four" + [5]=> + string(4) "five" +} +array(0) { +} +array(0) { +} + +*** Iteration 8 *** + +*** Variation with first two Arguments *** +array(9) { + [0]=> + string(3) "one" + [1]=> + int(6) + [""]=> + string(5) "blank" + [2]=> + string(5) "float" + ["F"]=> + string(3) "FFF" + ["blank"]=> + string(0) "" + [3]=> + float(3.7) + [4]=> + string(4) "Five" + [5]=> + float(8.6) +} +array(10) { + ["f"]=> + string(3) "fff" + [0]=> + string(3) "one" + [1]=> + int(6) + [""]=> + string(5) "blank" + [2]=> + string(5) "float" + ["F"]=> + string(3) "FFF" + ["blank"]=> + string(0) "" + [3]=> + float(3.7) + [4]=> + string(4) "Five" + [5]=> + float(8.6) +} +array(2) { + [0]=> + string(4) "Five" + [1]=> + float(8.6) +} + +*** Variation with first three Arguments *** +array(3) { + [0]=> + string(3) "one" + [1]=> + int(6) + [""]=> + string(5) "blank" +} +array(0) { +} +array(6) { + [0]=> + string(3) "one" + [1]=> + int(6) + [""]=> + string(5) "blank" + [2]=> + string(5) "float" + ["F"]=> + string(3) "FFF" + ["blank"]=> + string(0) "" +} +array(3) { + ["f"]=> + string(3) "fff" + [0]=> + string(3) "one" + [1]=> + int(6) +} +array(0) { +} +array(7) { + ["f"]=> + string(3) "fff" + [0]=> + string(3) "one" + [1]=> + int(6) + [""]=> + string(5) "blank" + [2]=> + string(5) "float" + ["F"]=> + string(3) "FFF" + ["blank"]=> + string(0) "" +} +array(2) { + [0]=> + string(4) "Five" + [1]=> + float(8.6) +} +array(0) { +} +array(0) { +} + +*** Variation with first two arguments with preserve_key value TRUE *** +array(3) { + [1]=> + string(3) "one" + [4]=> + int(6) + [""]=> + string(5) "blank" +} +array(0) { +} +array(6) { + [1]=> + string(3) "one" + [4]=> + int(6) + [""]=> + string(5) "blank" + [2]=> + string(5) "float" + ["F"]=> + string(3) "FFF" + ["blank"]=> + string(0) "" +} +array(3) { + ["f"]=> + string(3) "fff" + [1]=> + string(3) "one" + [4]=> + int(6) +} +array(0) { +} +array(7) { + ["f"]=> + string(3) "fff" + [1]=> + string(3) "one" + [4]=> + int(6) + [""]=> + string(5) "blank" + [2]=> + string(5) "float" + ["F"]=> + string(3) "FFF" + ["blank"]=> + string(0) "" +} +array(2) { + [5]=> + string(4) "Five" + [6]=> + float(8.6) +} +array(0) { +} +array(0) { +} + +*** Iteration 9 *** + +*** Variation with first two Arguments *** +array(3) { + [0]=> + string(4) "name" + [1]=> + string(3) "age" + [2]=> + string(2) "45" +} +array(4) { + [0]=> + int(12) + [1]=> + string(4) "name" + [2]=> + string(3) "age" + [3]=> + string(2) "45" +} +array(2) { + [0]=> + string(3) "age" + [1]=> + string(2) "45" +} + +*** Variation with first three Arguments *** +array(3) { + [0]=> + string(4) "name" + [1]=> + string(3) "age" + [2]=> + string(2) "45" +} +array(0) { +} +array(0) { +} +array(3) { + [0]=> + int(12) + [1]=> + string(4) "name" + [2]=> + string(3) "age" +} +array(0) { +} +array(1) { + [0]=> + int(12) +} +array(2) { + [0]=> + string(3) "age" + [1]=> + string(2) "45" +} +array(0) { +} +array(0) { +} + +*** Variation with first two arguments with preserve_key value TRUE *** +array(3) { + [1]=> + string(4) "name" + [2]=> + string(3) "age" + [3]=> + string(2) "45" +} +array(0) { +} +array(0) { +} +array(3) { + [0]=> + int(12) + [1]=> + string(4) "name" + [2]=> + string(3) "age" +} +array(0) { +} +array(1) { + [0]=> + int(12) +} +array(2) { + [2]=> + string(3) "age" + [3]=> + string(2) "45" +} +array(0) { +} +array(0) { +} + +*** Iteration 10 *** + +*** Variation with first two Arguments *** +array(2) { + [0]=> + array(5) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + [3]=> + int(40) + [4]=> + int(50) + } + [1]=> + array(0) { + } +} +array(3) { + [0]=> + array(3) { + [0]=> + string(3) "oNe" + [1]=> + string(3) "tWo" + [2]=> + int(4) + } + [1]=> + array(5) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + [3]=> + int(40) + [4]=> + int(50) + } + [2]=> + array(0) { + } +} +array(2) { + [0]=> + array(5) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + [3]=> + int(40) + [4]=> + int(50) + } + [1]=> + array(0) { + } +} + +*** Variation with first three Arguments *** +array(2) { + [0]=> + array(5) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + [3]=> + int(40) + [4]=> + int(50) + } + [1]=> + array(0) { + } +} +array(0) { +} +array(0) { +} +array(3) { + [0]=> + array(3) { + [0]=> + string(3) "oNe" + [1]=> + string(3) "tWo" + [2]=> + int(4) + } + [1]=> + array(5) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + [3]=> + int(40) + [4]=> + int(50) + } + [2]=> + array(0) { + } +} +array(0) { +} +array(0) { +} +array(2) { + [0]=> + array(5) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + [3]=> + int(40) + [4]=> + int(50) + } + [1]=> + array(0) { + } +} +array(0) { +} +array(0) { +} + +*** Variation with first two arguments with preserve_key value TRUE *** +array(2) { + [1]=> + array(5) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + [3]=> + int(40) + [4]=> + int(50) + } + [2]=> + array(0) { + } +} +array(0) { +} +array(0) { +} +array(3) { + [0]=> + array(3) { + [0]=> + string(3) "oNe" + [1]=> + string(3) "tWo" + [2]=> + int(4) + } + [1]=> + array(5) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + [3]=> + int(40) + [4]=> + int(50) + } + [2]=> + array(0) { + } +} +array(0) { +} +array(0) { +} +array(2) { + [1]=> + array(5) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + [3]=> + int(40) + [4]=> + int(50) + } + [2]=> + array(0) { + } +} +array(0) { +} +array(0) { +} + +*** Typical Variation of offset and length Arguments *** +array(1) { + [1]=> + string(3) "Two" +} +array(1) { + [0]=> + string(3) "Two" +} +array(1) { + [2]=> + string(5) "Three" +} +array(1) { + [0]=> + string(5) "Three" +} diff --git a/ext/standard/tests/array/array_slice_basic.phpt b/ext/standard/tests/array/array_slice_basic.phpt new file mode 100644 index 0000000..a4cbe46 --- /dev/null +++ b/ext/standard/tests/array/array_slice_basic.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test array_slice() function : basic functionality +--FILE-- + 1, 'two' => 2, 3, 23 => 4); +$offset = 2; +$length = 2; +$preserve_keys = true; + +// Calling array_slice() with all possible arguments +echo "\n-- All arguments --\n"; +var_dump( array_slice($input, $offset, $length, $preserve_keys) ); + +// Calling array_slice() with mandatory arguments +echo "\n-- Mandatory arguments --\n"; +var_dump( array_slice($input, $offset) ); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_slice() : basic functionality *** + +-- All arguments -- +array(2) { + [0]=> + int(3) + [23]=> + int(4) +} + +-- Mandatory arguments -- +array(2) { + [0]=> + int(3) + [1]=> + int(4) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_slice_error.phpt b/ext/standard/tests/array/array_slice_error.phpt new file mode 100644 index 0000000..0e8f1c7 --- /dev/null +++ b/ext/standard/tests/array/array_slice_error.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test array_slice() function : error conditions - Pass incorrect number of args +--FILE-- + +--EXPECTF-- +*** Testing array_slice() : error conditions *** + +-- Testing array_slice() function with more than expected no. of arguments -- + +Warning: array_slice() expects at most 4 parameters, 5 given in %s on line %d +NULL + +-- Testing array_slice() function with less than expected no. of arguments -- + +Warning: array_slice() expects at least 2 parameters, 1 given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_slice_variation1.phpt b/ext/standard/tests/array/array_slice_variation1.phpt new file mode 100644 index 0000000..daed1d8 --- /dev/null +++ b/ext/standard/tests/array/array_slice_variation1.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test array_slice() - Third parameter (NULL vs 0) +--FILE-- + + +--EXPECTF-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(0) { +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(0) { +} +array(0) { +} +array(0) { +} +array(1) { + [0]=> + int(3) +} +array(1) { + [2]=> + int(3) +} +array(0) { +} +array(0) { +} +string(3) "foo" diff --git a/ext/standard/tests/array/array_slice_variation10.phpt b/ext/standard/tests/array/array_slice_variation10.phpt new file mode 100644 index 0000000..85c521d --- /dev/null +++ b/ext/standard/tests/array/array_slice_variation10.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test array_slice() function : usage variations - position of internal array pointer +--FILE-- + 'un', 'two' => 'deux', 23 => 'twenty-three', 'zero'); + +echo "\n-- Call array_slice() --\n"; +var_dump($result = array_slice($input, 2)); + +echo "-- Position of Internal Pointer in Result: --\n"; +echo key($result) . " => " . current($result) . "\n"; +echo "\n-- Position of Internal Pointer in Original Array: --\n"; +echo key($input) . " => " . current ($input) . "\n"; + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_slice() : usage variations *** + +-- Call array_slice() -- +array(2) { + [0]=> + string(12) "twenty-three" + [1]=> + string(4) "zero" +} +-- Position of Internal Pointer in Result: -- +0 => twenty-three + +-- Position of Internal Pointer in Original Array: -- +one => un +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_slice_variation11.phpt b/ext/standard/tests/array/array_slice_variation11.phpt new file mode 100644 index 0000000..4c7a148 --- /dev/null +++ b/ext/standard/tests/array/array_slice_variation11.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_slice() function : usage variations - Pass different data types as $input arg +--FILE-- + + +--EXPECTF-- +*** Testing array_slice() : usage variations *** + +-- Iteration 1 -- + +Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +array(0) { +} + +-- Iteration 19 -- + +Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: array_slice() expects parameter 1 to be array, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: array_slice() expects parameter 1 to be array, resource given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_slice_variation2.phpt b/ext/standard/tests/array/array_slice_variation2.phpt new file mode 100644 index 0000000..217788f --- /dev/null +++ b/ext/standard/tests/array/array_slice_variation2.phpt @@ -0,0 +1,311 @@ +--TEST-- +Test array_slice() function : usage variations - Pass different data types as $offset arg +--SKIPIF-- + 4) die("skip this test is for 32bit platform only"); ?> +--FILE-- + 1, 2, 'three' => 3, 4); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a class +class classA +{ + public function __toString() { + return "Class A object"; + } +} + +// heredoc string +$heredoc = << + +--EXPECTF-- +*** Testing array_slice() : usage variations *** + +-- Iteration 1 -- +array(4) { + ["one"]=> + int(1) + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} + +-- Iteration 2 -- +array(3) { + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} + +-- Iteration 3 -- +array(0) { +} + +-- Iteration 4 -- +array(4) { + ["one"]=> + int(1) + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} + +-- Iteration 5 -- +array(0) { +} + +-- Iteration 6 -- +array(4) { + ["one"]=> + int(1) + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} + +-- Iteration 7 -- +array(4) { + ["one"]=> + int(1) + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} + +-- Iteration 8 -- +array(4) { + ["one"]=> + int(1) + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} + +-- Iteration 9 -- +array(4) { + ["one"]=> + int(1) + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} + +-- Iteration 10 -- +array(4) { + ["one"]=> + int(1) + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} + +-- Iteration 11 -- +array(4) { + ["one"]=> + int(1) + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} + +-- Iteration 12 -- +array(3) { + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} + +-- Iteration 13 -- +array(4) { + ["one"]=> + int(1) + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} + +-- Iteration 14 -- +array(3) { + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} + +-- Iteration 15 -- +array(4) { + ["one"]=> + int(1) + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} + +-- Iteration 16 -- + +Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: array_slice() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 22 -- +array(4) { + ["one"]=> + int(1) + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} + +-- Iteration 23 -- +array(4) { + ["one"]=> + int(1) + [0]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_slice_variation3.phpt b/ext/standard/tests/array/array_slice_variation3.phpt new file mode 100644 index 0000000..bdcb759 --- /dev/null +++ b/ext/standard/tests/array/array_slice_variation3.phpt @@ -0,0 +1,213 @@ +--TEST-- +Test array_slice() function : usage variations - Pass different data types as $length arg +--SKIPIF-- + +--FILE-- + 1, 2, 'three' => 3, 4); +$offset = 2; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// heredoc string +$heredoc = << + +--EXPECTF-- +*** Testing array_slice() : usage variations *** + +-- Iteration 1 -- +array(0) { +} + +-- Iteration 2 -- +array(1) { + ["three"]=> + int(3) +} + +-- Iteration 3 -- +array(2) { + ["three"]=> + int(3) + [0]=> + int(4) +} + +-- Iteration 4 -- +array(0) { +} + +-- Iteration 5 -- +array(2) { + ["three"]=> + int(3) + [0]=> + int(4) +} + +-- Iteration 6 -- +array(0) { +} + +-- Iteration 7 -- +array(2) { + ["three"]=> + int(3) + [0]=> + int(4) +} + +-- Iteration 8 -- +array(0) { +} + +-- Iteration 9 -- +array(0) { +} + +-- Iteration 10 -- +array(2) { + ["three"]=> + int(3) + [0]=> + int(4) +} + +-- Iteration 11 -- +array(2) { + ["three"]=> + int(3) + [0]=> + int(4) +} + +-- Iteration 12 -- +array(1) { + ["three"]=> + int(3) +} + +-- Iteration 13 -- +array(0) { +} + +-- Iteration 14 -- +array(1) { + ["three"]=> + int(3) +} + +-- Iteration 15 -- +array(0) { +} + +-- Iteration 16 -- +array(0) { +} + +-- Iteration 17 -- +array(0) { +} + +-- Iteration 18 -- +array(0) { +} + +-- Iteration 19 -- +array(0) { +} + +-- Iteration 20 -- +array(0) { +} + +-- Iteration 21 -- +array(0) { +} + +-- Iteration 22 -- +array(2) { + ["three"]=> + int(3) + [0]=> + int(4) +} + +-- Iteration 23 -- +array(2) { + ["three"]=> + int(3) + [0]=> + int(4) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_slice_variation4.phpt b/ext/standard/tests/array/array_slice_variation4.phpt new file mode 100644 index 0000000..f093d2d --- /dev/null +++ b/ext/standard/tests/array/array_slice_variation4.phpt @@ -0,0 +1,327 @@ +--TEST-- +Test array_slice() function : usage variations - Pass different data types as $preserve_keys arg +--FILE-- + 1, 2, 99 => 3, 4); +$offset = 0; +$length = 3; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a class +class classA +{ + public function __toString() { + return "Class A object"; + } +} + +// heredoc string +$heredoc = << + +--EXPECTF-- +*** Testing array_slice() : usage variations *** + +-- Iteration 1 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [1]=> + int(3) +} + +-- Iteration 2 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [99]=> + int(3) +} + +-- Iteration 3 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [99]=> + int(3) +} + +-- Iteration 4 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [99]=> + int(3) +} + +-- Iteration 5 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [99]=> + int(3) +} + +-- Iteration 6 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [99]=> + int(3) +} + +-- Iteration 7 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [99]=> + int(3) +} + +-- Iteration 8 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [99]=> + int(3) +} + +-- Iteration 9 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [99]=> + int(3) +} + +-- Iteration 10 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [1]=> + int(3) +} + +-- Iteration 11 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [1]=> + int(3) +} + +-- Iteration 12 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [99]=> + int(3) +} + +-- Iteration 13 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [1]=> + int(3) +} + +-- Iteration 14 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [99]=> + int(3) +} + +-- Iteration 15 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [1]=> + int(3) +} + +-- Iteration 16 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [1]=> + int(3) +} + +-- Iteration 17 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [1]=> + int(3) +} + +-- Iteration 18 -- + +Warning: array_slice() expects parameter 4 to be boolean, array given in %s on line %d +NULL + +-- Iteration 19 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [99]=> + int(3) +} + +-- Iteration 20 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [99]=> + int(3) +} + +-- Iteration 21 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [99]=> + int(3) +} + +-- Iteration 22 -- + +Warning: array_slice() expects parameter 4 to be boolean, object given in %s on line %d +NULL + +-- Iteration 23 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [1]=> + int(3) +} + +-- Iteration 24 -- +array(3) { + ["one"]=> + int(1) + [0]=> + int(2) + [1]=> + int(3) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_slice_variation5.phpt b/ext/standard/tests/array/array_slice_variation5.phpt new file mode 100644 index 0000000..ed5c82f --- /dev/null +++ b/ext/standard/tests/array/array_slice_variation5.phpt @@ -0,0 +1,191 @@ +--TEST-- +Test array_slice() function : usage variations - Pass different integers as $offset argument +--FILE-- + 1, 2 => 'two', 'three', 9 => 'nine', 'ten' => 10); + +for ($i = -7; $i <= 7; $i++) { + echo "\n-- \$offset is $i --\n"; + var_dump(array_slice($input, $i)); +} +echo "\n-- \$offset is maximum integer value --\n"; +var_dump(array_slice($input, PHP_INT_MAX)); + +echo "\n-- \$offset is minimum integer value --\n"; +var_dump(array_slice($input, -PHP_INT_MAX)); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_slice() : usage variations *** + +-- $offset is -7 -- +array(5) { + ["one"]=> + int(1) + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "nine" + ["ten"]=> + int(10) +} + +-- $offset is -6 -- +array(5) { + ["one"]=> + int(1) + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "nine" + ["ten"]=> + int(10) +} + +-- $offset is -5 -- +array(5) { + ["one"]=> + int(1) + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "nine" + ["ten"]=> + int(10) +} + +-- $offset is -4 -- +array(4) { + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "nine" + ["ten"]=> + int(10) +} + +-- $offset is -3 -- +array(3) { + [0]=> + string(5) "three" + [1]=> + string(4) "nine" + ["ten"]=> + int(10) +} + +-- $offset is -2 -- +array(2) { + [0]=> + string(4) "nine" + ["ten"]=> + int(10) +} + +-- $offset is -1 -- +array(1) { + ["ten"]=> + int(10) +} + +-- $offset is 0 -- +array(5) { + ["one"]=> + int(1) + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "nine" + ["ten"]=> + int(10) +} + +-- $offset is 1 -- +array(4) { + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "nine" + ["ten"]=> + int(10) +} + +-- $offset is 2 -- +array(3) { + [0]=> + string(5) "three" + [1]=> + string(4) "nine" + ["ten"]=> + int(10) +} + +-- $offset is 3 -- +array(2) { + [0]=> + string(4) "nine" + ["ten"]=> + int(10) +} + +-- $offset is 4 -- +array(1) { + ["ten"]=> + int(10) +} + +-- $offset is 5 -- +array(0) { +} + +-- $offset is 6 -- +array(0) { +} + +-- $offset is 7 -- +array(0) { +} + +-- $offset is maximum integer value -- +array(0) { +} + +-- $offset is minimum integer value -- +array(5) { + ["one"]=> + int(1) + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "nine" + ["ten"]=> + int(10) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_slice_variation6.phpt b/ext/standard/tests/array/array_slice_variation6.phpt new file mode 100644 index 0000000..e32abfc --- /dev/null +++ b/ext/standard/tests/array/array_slice_variation6.phpt @@ -0,0 +1,150 @@ +--TEST-- +Test array_slice() function : usage variations - pass different int values as $length arg +--FILE-- + 1, 2 => 'two', 'three', 9 => 'nine', 'ten' => 10); +$offset = 1; + +for ($i = -6; $i <= 6; $i++) { + echo "\n-- \$length is $i --\n"; + var_dump(array_slice($input, $offset, $i)); +} +echo "\n-- \$length is maximum integer value --\n"; +var_dump(array_slice($input, $offset, PHP_INT_MAX)); + +echo "\n-- \$length is minimum integer value --\n"; +var_dump(array_slice($input, $offset, -PHP_INT_MAX)); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_slice() : usage variations *** + +-- $length is -6 -- +array(0) { +} + +-- $length is -5 -- +array(0) { +} + +-- $length is -4 -- +array(0) { +} + +-- $length is -3 -- +array(1) { + [0]=> + string(3) "two" +} + +-- $length is -2 -- +array(2) { + [0]=> + string(3) "two" + [1]=> + string(5) "three" +} + +-- $length is -1 -- +array(3) { + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "nine" +} + +-- $length is 0 -- +array(0) { +} + +-- $length is 1 -- +array(1) { + [0]=> + string(3) "two" +} + +-- $length is 2 -- +array(2) { + [0]=> + string(3) "two" + [1]=> + string(5) "three" +} + +-- $length is 3 -- +array(3) { + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "nine" +} + +-- $length is 4 -- +array(4) { + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "nine" + ["ten"]=> + int(10) +} + +-- $length is 5 -- +array(4) { + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "nine" + ["ten"]=> + int(10) +} + +-- $length is 6 -- +array(4) { + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "nine" + ["ten"]=> + int(10) +} + +-- $length is maximum integer value -- +array(4) { + [0]=> + string(3) "two" + [1]=> + string(5) "three" + [2]=> + string(4) "nine" + ["ten"]=> + int(10) +} + +-- $length is minimum integer value -- +array(0) { +} +Done diff --git a/ext/standard/tests/array/array_slice_variation7.phpt b/ext/standard/tests/array/array_slice_variation7.phpt new file mode 100644 index 0000000..abf517d --- /dev/null +++ b/ext/standard/tests/array/array_slice_variation7.phpt @@ -0,0 +1,300 @@ +--TEST-- +Test array_slice() function : usage variations - different data types as keys in an array +--FILE-- + array( + 0 => 'zero', + 1 => 'one', + 12345 => 'positive', + -2345 => 'negative', + ), + + // float data +/*2*/ 'float' => array( + 10.5 => 'positive', + -10.5 => 'negative', + .5 => 'half', + ), + +/*3*/ 'extreme floats' => array( + 12.3456789000e6 => 'large', + 12.3456789000E-10 => 'small', + ), + + // null data +/*4*/ 'null uppercase' => array( + NULL => 'null 1', + ), + +/*5*/ 'null lowercase' => array( + null => 'null 2', + ), + + // boolean data +/*6*/ 'bool lowercase' => array( + true => 'lowert', + false => 'lowerf', + ), + +/*7*/ 'bool uppercase' => array( + TRUE => 'uppert', + FALSE => 'upperf', + ), + + // empty data +/*8*/ 'empty double quotes' => array( + "" => 'emptyd', + ), + +/*9*/ 'empty single quotes' => array( + '' => 'emptys', + ), + + // string data +/*10*/ 'string' => array( + "stringd" => 'stringd', + 'strings' => 'strings', + $heredoc => 'stringh', + ), + + // undefined data +/*11*/ 'undefined' => array( + @$undefined_var => 'undefined', + ), + + // unset data +/*12*/ 'unset' => array( + @$unset_var => 'unset', + ), +); + +// loop through each element of $inputs to check the behavior of array_slice() +$iterator = 1; +foreach($inputs as $type => $input) { + echo "\n-- Iteration $iterator : key type is $type --\n"; + echo "\$preserve_keys = TRUE\n"; + var_dump( array_slice($input, $offset, $length, true) ); + echo "\$preserve_keys = FALSE\n"; + var_dump( array_slice($input, $offset, $length, false) ); + $iterator++; +}; + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_slice() : usage variations *** + +-- Iteration 1 : key type is int -- +$preserve_keys = TRUE +array(4) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [12345]=> + string(8) "positive" + [-2345]=> + string(8) "negative" +} +$preserve_keys = FALSE +array(4) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + string(8) "positive" + [3]=> + string(8) "negative" +} + +-- Iteration 2 : key type is float -- +$preserve_keys = TRUE +array(3) { + [10]=> + string(8) "positive" + [-10]=> + string(8) "negative" + [0]=> + string(4) "half" +} +$preserve_keys = FALSE +array(3) { + [0]=> + string(8) "positive" + [1]=> + string(8) "negative" + [2]=> + string(4) "half" +} + +-- Iteration 3 : key type is extreme floats -- +$preserve_keys = TRUE +array(2) { + [12345678]=> + string(5) "large" + [0]=> + string(5) "small" +} +$preserve_keys = FALSE +array(2) { + [0]=> + string(5) "large" + [1]=> + string(5) "small" +} + +-- Iteration 4 : key type is null uppercase -- +$preserve_keys = TRUE +array(1) { + [""]=> + string(6) "null 1" +} +$preserve_keys = FALSE +array(1) { + [""]=> + string(6) "null 1" +} + +-- Iteration 5 : key type is null lowercase -- +$preserve_keys = TRUE +array(1) { + [""]=> + string(6) "null 2" +} +$preserve_keys = FALSE +array(1) { + [""]=> + string(6) "null 2" +} + +-- Iteration 6 : key type is bool lowercase -- +$preserve_keys = TRUE +array(2) { + [1]=> + string(6) "lowert" + [0]=> + string(6) "lowerf" +} +$preserve_keys = FALSE +array(2) { + [0]=> + string(6) "lowert" + [1]=> + string(6) "lowerf" +} + +-- Iteration 7 : key type is bool uppercase -- +$preserve_keys = TRUE +array(2) { + [1]=> + string(6) "uppert" + [0]=> + string(6) "upperf" +} +$preserve_keys = FALSE +array(2) { + [0]=> + string(6) "uppert" + [1]=> + string(6) "upperf" +} + +-- Iteration 8 : key type is empty double quotes -- +$preserve_keys = TRUE +array(1) { + [""]=> + string(6) "emptyd" +} +$preserve_keys = FALSE +array(1) { + [""]=> + string(6) "emptyd" +} + +-- Iteration 9 : key type is empty single quotes -- +$preserve_keys = TRUE +array(1) { + [""]=> + string(6) "emptys" +} +$preserve_keys = FALSE +array(1) { + [""]=> + string(6) "emptys" +} + +-- Iteration 10 : key type is string -- +$preserve_keys = TRUE +array(3) { + ["stringd"]=> + string(7) "stringd" + ["strings"]=> + string(7) "strings" + ["hello world"]=> + string(7) "stringh" +} +$preserve_keys = FALSE +array(3) { + ["stringd"]=> + string(7) "stringd" + ["strings"]=> + string(7) "strings" + ["hello world"]=> + string(7) "stringh" +} + +-- Iteration 11 : key type is undefined -- +$preserve_keys = TRUE +array(1) { + [""]=> + string(9) "undefined" +} +$preserve_keys = FALSE +array(1) { + [""]=> + string(9) "undefined" +} + +-- Iteration 12 : key type is unset -- +$preserve_keys = TRUE +array(1) { + [""]=> + string(5) "unset" +} +$preserve_keys = FALSE +array(1) { + [""]=> + string(5) "unset" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_slice_variation8.phpt b/ext/standard/tests/array/array_slice_variation8.phpt new file mode 100644 index 0000000..aece410 --- /dev/null +++ b/ext/standard/tests/array/array_slice_variation8.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test array_slice() function : usage variations - multidimensional arrays +--FILE-- + 'nine'); + +echo "\n-- Slice a two-dimensional array --\n"; +var_dump(array_slice($input, 1, 3)); + +echo "\n-- \$input is a sub-array --\n"; +var_dump(array_slice($input[2], 1, 2)); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_slice() : usage variations *** + +-- Slice a two-dimensional array -- +array(3) { + [0]=> + string(3) "one" + [1]=> + array(3) { + [0]=> + string(4) "zero" + [1]=> + string(2) "un" + [2]=> + string(4) "deux" + } + [2]=> + string(4) "nine" +} + +-- $input is a sub-array -- +array(2) { + [0]=> + string(2) "un" + [1]=> + string(4) "deux" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_slice_variation9.phpt b/ext/standard/tests/array/array_slice_variation9.phpt new file mode 100644 index 0000000..7ae9238 --- /dev/null +++ b/ext/standard/tests/array/array_slice_variation9.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test array_slice() function : usage variations - referenced variables +--FILE-- + &$val1, 2 => &$val2, 1 => &$val3); +var_dump(array_slice($input, 1, 2)); + +echo "-- Change \$val2 (\$preserve_keys = TRUE) --\n"; +$val2 = 'hello, world'; +var_dump(array_slice($input, 1, 2, true)); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_slice() : usage variations *** + +-- Array of referenced variables ($preserve_keys = default) -- +array(2) { + [0]=> + &string(3) "two" + [1]=> + &string(5) "three" +} +-- Change $val2 ($preserve_keys = TRUE) -- +array(2) { + [2]=> + &string(12) "hello, world" + [1]=> + &string(5) "three" +} +Done diff --git a/ext/standard/tests/array/array_splice_basic.phpt b/ext/standard/tests/array/array_splice_basic.phpt new file mode 100644 index 0000000..e96303d --- /dev/null +++ b/ext/standard/tests/array/array_splice_basic.phpt @@ -0,0 +1,117 @@ +--TEST-- +Test array_splice(): basic functionality +--FILE-- + +--EXPECT-- +*** Testing array_splice() basic operations *** +test truncation +array(2) { + [0]=> + string(4) "blue" + [1]=> + string(6) "yellow" +} +array(2) { + [0]=> + string(3) "red" + [1]=> + string(5) "green" +} +test removing entries from the middle +array(2) { + [0]=> + string(5) "green" + [1]=> + string(4) "blue" +} +array(2) { + [0]=> + string(3) "red" + [1]=> + string(6) "yellow" +} +test substitution at end +array(3) { + [0]=> + string(5) "green" + [1]=> + string(4) "blue" + [2]=> + string(6) "yellow" +} +array(2) { + [0]=> + string(3) "red" + [1]=> + string(6) "orange" +} +array(1) { + [0]=> + string(6) "yellow" +} +array(5) { + [0]=> + string(3) "red" + [1]=> + string(5) "green" + [2]=> + string(4) "blue" + [3]=> + string(5) "black" + [4]=> + string(6) "maroon" +} +test insertion +array(0) { +} +array(5) { + [0]=> + string(3) "red" + [1]=> + string(5) "green" + [2]=> + string(4) "blue" + [3]=> + string(6) "purple" + [4]=> + string(6) "yellow" +} diff --git a/ext/standard/tests/array/array_splice_errors.phpt b/ext/standard/tests/array/array_splice_errors.phpt new file mode 100644 index 0000000..0d4e8da --- /dev/null +++ b/ext/standard/tests/array/array_splice_errors.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test array_splice() function : error conditions +--FILE-- + +--EXPECTF-- + +*** Testing error conditions of array_splice() *** + +Warning: array_splice() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: array_splice() expects at least 2 parameters, 1 given in %s on line %d +NULL + +Warning: array_splice() expects at least 2 parameters, 1 given in %s on line %d +NULL + +Warning: array_splice() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_splice() expects parameter 1 to be array, object given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_splice_variation1.phpt b/ext/standard/tests/array/array_splice_variation1.phpt new file mode 100644 index 0000000..9ba94f6 --- /dev/null +++ b/ext/standard/tests/array/array_splice_variation1.phpt @@ -0,0 +1,109 @@ +--TEST-- +Test array_splice() function : usage variations - references +--FILE-- +&$numbers[3],4,&$numbers[5],"six"=>&$numbers[6],7,&$numbers[8],"nine"=>&$numbers[9]); +var_dump (array_splice ($input_array,4,3)); +var_dump ($input_array); + +echo "Test behaviour of replacement array containing references \n"; + +$three=3; +$four=4; +$input_array=array (0,1,2); +$b=array(&$three,"fourkey"=>&$four); +array_splice ($input_array,-1,1,$b); +var_dump ($input_array); + +echo "Test behaviour of replacement which is part of reference set \n"; + +$int=3; +$input_array=array (1,2); +$b=&$int; + +array_splice ($input_array,-1,1,$b); +var_dump ($input_array); +echo "Done\n"; +?> +--EXPECT-- +test behaviour when input array is in a reference set +array(1) { + [0]=> + int(2) +} +array(2) { + [0]=> + &array(1) { + [0]=> + int(1) + } + [1]=> + &array(1) { + [0]=> + int(1) + } +} +Test behaviour of input arrays containing references +array(3) { + [0]=> + int(4) + [1]=> + &int(5) + ["six"]=> + &int(6) +} +array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + &int(2) + ["three"]=> + &int(3) + [3]=> + int(7) + [4]=> + &int(8) + ["nine"]=> + &int(9) +} +Test behaviour of replacement array containing references +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + &int(3) + [3]=> + &int(4) +} +Test behaviour of replacement which is part of reference set +array(2) { + [0]=> + int(1) + [1]=> + int(3) +} +Done diff --git a/ext/standard/tests/array/array_splice_variation2.phpt b/ext/standard/tests/array/array_splice_variation2.phpt new file mode 100644 index 0000000..516339c --- /dev/null +++ b/ext/standard/tests/array/array_splice_variation2.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test array_splice() function : usage variations - additional parameters +--FILE-- + +--EXPECTF-- + +Warning: array_splice() expects at most 4 parameters, 10 given in %s on line %d +NULL +array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) +} +Done diff --git a/ext/standard/tests/array/array_splice_variation3.phpt b/ext/standard/tests/array/array_splice_variation3.phpt new file mode 100644 index 0000000..33ec80e --- /dev/null +++ b/ext/standard/tests/array/array_splice_variation3.phpt @@ -0,0 +1,856 @@ +--TEST-- +Test array_splice() function : usage variations - lengths and offsets +--FILE-- + + +--EXPECT-- +*** array_splice() function : usage variations - lengths and offsets +absolute offset - absolute length - cut from beginning + - No replacement +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} +array(4) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + int(4) + [3]=> + int(5) +} + - With replacement +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} +array(7) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" + [3]=> + int(2) + [4]=> + int(3) + [5]=> + int(4) + [6]=> + int(5) +} +absolute offset - absolute length - cut from middle + - No replacement +array(2) { + [0]=> + int(2) + [1]=> + int(3) +} +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(4) + [3]=> + int(5) +} + - With replacement +array(2) { + [0]=> + int(2) + [1]=> + int(3) +} +array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + string(1) "A" + [3]=> + string(1) "B" + [4]=> + string(1) "C" + [5]=> + int(4) + [6]=> + int(5) +} +absolute offset - absolute length - cut from end + - No replacement +array(2) { + [0]=> + int(4) + [1]=> + int(5) +} +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) +} + - With replacement +array(2) { + [0]=> + int(4) + [1]=> + int(5) +} +array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + string(1) "A" + [5]=> + string(1) "B" + [6]=> + string(1) "C" +} +absolute offset - absolute length - attempt to cut past end + - No replacement +array(2) { + [0]=> + int(4) + [1]=> + int(5) +} +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) +} + - With replacement +array(2) { + [0]=> + int(4) + [1]=> + int(5) +} +array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + string(1) "A" + [5]=> + string(1) "B" + [6]=> + string(1) "C" +} +absolute offset - absolute length - cut everything + - No replacement +array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) +} +array(0) { +} + - With replacement +array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) +} +array(3) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" +} +absolute offset - absolute length - cut nothing + - No replacement +array(0) { +} +array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) +} + - With replacement +array(0) { +} +array(9) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + string(1) "A" + [4]=> + string(1) "B" + [5]=> + string(1) "C" + [6]=> + int(3) + [7]=> + int(4) + [8]=> + int(5) +} +absolute offset - relative length - cut from beginning + - No replacement +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} +array(4) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + int(4) + [3]=> + int(5) +} + - With replacement +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} +array(7) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" + [3]=> + int(2) + [4]=> + int(3) + [5]=> + int(4) + [6]=> + int(5) +} +absolute offset - relative length - cut from middle + - No replacement +array(2) { + [0]=> + int(2) + [1]=> + int(3) +} +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(4) + [3]=> + int(5) +} + - With replacement +array(2) { + [0]=> + int(2) + [1]=> + int(3) +} +array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + string(1) "A" + [3]=> + string(1) "B" + [4]=> + string(1) "C" + [5]=> + int(4) + [6]=> + int(5) +} +absolute offset - relative length - attempt to cut form before beginning + - No replacement +array(0) { +} +array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) +} + - With replacement +array(0) { +} +array(9) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" + [3]=> + int(0) + [4]=> + int(1) + [5]=> + int(2) + [6]=> + int(3) + [7]=> + int(4) + [8]=> + int(5) +} +absolute offset - relative length - cut nothing + - No replacement +array(0) { +} +array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) +} + - With replacement +array(0) { +} +array(9) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + string(1) "A" + [3]=> + string(1) "B" + [4]=> + string(1) "C" + [5]=> + int(2) + [6]=> + int(3) + [7]=> + int(4) + [8]=> + int(5) +} +relative offset - absolute length - cut from beginning + - No replacement +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} +array(4) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + int(4) + [3]=> + int(5) +} + - With replacement +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} +array(7) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" + [3]=> + int(2) + [4]=> + int(3) + [5]=> + int(4) + [6]=> + int(5) +} +relative offset - absolute length - cut from middle + - No replacement +array(2) { + [0]=> + int(2) + [1]=> + int(3) +} +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(4) + [3]=> + int(5) +} + - With replacement +array(2) { + [0]=> + int(2) + [1]=> + int(3) +} +array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + string(1) "A" + [3]=> + string(1) "B" + [4]=> + string(1) "C" + [5]=> + int(4) + [6]=> + int(5) +} +relative offset - absolute length - cut from end + - No replacement +array(2) { + [0]=> + int(4) + [1]=> + int(5) +} +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) +} + - With replacement +array(2) { + [0]=> + int(4) + [1]=> + int(5) +} +array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + string(1) "A" + [5]=> + string(1) "B" + [6]=> + string(1) "C" +} +relative offset - absolute length - attempt to cut past end + - No replacement +array(2) { + [0]=> + int(4) + [1]=> + int(5) +} +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) +} + - With replacement +array(2) { + [0]=> + int(4) + [1]=> + int(5) +} +array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + string(1) "A" + [5]=> + string(1) "B" + [6]=> + string(1) "C" +} +relative offset - absolute length - cut everything + - No replacement +array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) +} +array(0) { +} + - With replacement +array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) +} +array(3) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" +} +relative offset - absolute length - cut nothing + - No replacement +array(0) { +} +array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) +} + - With replacement +array(0) { +} +array(9) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" + [3]=> + int(0) + [4]=> + int(1) + [5]=> + int(2) + [6]=> + int(3) + [7]=> + int(4) + [8]=> + int(5) +} +relative offset - relative length - cut from beginning + - No replacement +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} +array(4) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + int(4) + [3]=> + int(5) +} + - With replacement +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} +array(7) { + [0]=> + string(1) "A" + [1]=> + string(1) "B" + [2]=> + string(1) "C" + [3]=> + int(2) + [4]=> + int(3) + [5]=> + int(4) + [6]=> + int(5) +} +relative offset - relative length - cut from middle + - No replacement +array(2) { + [0]=> + int(2) + [1]=> + int(3) +} +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(4) + [3]=> + int(5) +} + - With replacement +array(2) { + [0]=> + int(2) + [1]=> + int(3) +} +array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + string(1) "A" + [3]=> + string(1) "B" + [4]=> + string(1) "C" + [5]=> + int(4) + [6]=> + int(5) +} +relative offset - relative length - cut nothing + - No replacement +array(0) { +} +array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) +} + - With replacement +array(0) { +} +array(9) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + string(1) "A" + [3]=> + string(1) "B" + [4]=> + string(1) "C" + [5]=> + int(2) + [6]=> + int(3) + [7]=> + int(4) + [8]=> + int(5) +} +Done diff --git a/ext/standard/tests/array/array_splice_variation4.phpt b/ext/standard/tests/array/array_splice_variation4.phpt new file mode 100644 index 0000000..d1cc501 --- /dev/null +++ b/ext/standard/tests/array/array_splice_variation4.phpt @@ -0,0 +1,69 @@ +--TEST-- +Test array_splice() function : usage variations - non array replacement values +--FILE-- + +--EXPECTF-- +array(0) { +} +array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) +} +array(0) { +} +array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + float(2.1) +} +array(0) { +} +array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + bool(true) +} +array(0) { +} +array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + resource(%d) of type (stream) +} +Done diff --git a/ext/standard/tests/array/array_sum.phpt b/ext/standard/tests/array/array_sum.phpt new file mode 100644 index 0000000..08aec21 --- /dev/null +++ b/ext/standard/tests/array/array_sum.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test array_sum() +--INI-- +precision=14 +memory_limit=128M +--FILE-- + +--EXPECTF-- +int(500500) +int(500500) +%st(5000050000) +%st(5000050000) diff --git a/ext/standard/tests/array/array_sum_basic.phpt b/ext/standard/tests/array/array_sum_basic.phpt new file mode 100644 index 0000000..c178853 --- /dev/null +++ b/ext/standard/tests/array/array_sum_basic.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test array_sum() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing array_sum() : basic functionality *** +-- array_sum() with integer array entries -- +int(15) +-- array_sum() with float array entries -- +float(11.2) +-- array_sum() with integer/float array entries -- +float(17.9) +Done diff --git a/ext/standard/tests/array/array_sum_error.phpt b/ext/standard/tests/array/array_sum_error.phpt new file mode 100644 index 0000000..209405d --- /dev/null +++ b/ext/standard/tests/array/array_sum_error.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test array_sum() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_sum() : error conditions *** +-- Testing array_sum() function with zero arguments -- + +Warning: array_sum() expects exactly 1 parameter, 0 given in %s on line %d +NULL +-- Testing array_sum() function with more than expected no. of arguments -- + +Warning: array_sum() expects exactly 1 parameter, 2 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_sum_variation1.phpt b/ext/standard/tests/array/array_sum_variation1.phpt new file mode 100644 index 0000000..f551375 --- /dev/null +++ b/ext/standard/tests/array/array_sum_variation1.phpt @@ -0,0 +1,179 @@ +--TEST-- +Test array_sum() function : usage variations - unexpected values for 'input' argument +--FILE-- + +--EXPECTF-- +*** Testing array_sum() : unexpected values for 'input' *** +-- Iteration 1 -- + +Warning: array_sum() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 2 -- + +Warning: array_sum() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 3 -- + +Warning: array_sum() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 4 -- + +Warning: array_sum() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: array_sum() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: array_sum() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_sum() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_sum() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_sum() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_sum() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_sum() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: array_sum() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: array_sum() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: array_sum() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: array_sum() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: array_sum() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: array_sum() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: array_sum() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_sum() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_sum() expects parameter 1 to be array, object given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_sum() expects parameter 1 to be array, resource given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: array_sum() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 23 -- + +Warning: array_sum() expects parameter 1 to be array, null given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_sum_variation2.phpt b/ext/standard/tests/array/array_sum_variation2.phpt new file mode 100644 index 0000000..a697a15 --- /dev/null +++ b/ext/standard/tests/array/array_sum_variation2.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test array_sum() function : usage variations - array with different integer value +--FILE-- + +--EXPECTF-- +*** Testing array_sum() : different integer array *** +-- Sum of Integer array -- +int(-573) +-- Sum of Octal array -- +int(35) +-- Sum of Hex array -- +int(-198) +-- Sum of mixed integer values -- +int(58) +Done diff --git a/ext/standard/tests/array/array_sum_variation3.phpt b/ext/standard/tests/array/array_sum_variation3.phpt new file mode 100644 index 0000000..9d32c2c --- /dev/null +++ b/ext/standard/tests/array/array_sum_variation3.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test array_sum() function : usage variations - array with different float values +--FILE-- + +--EXPECTF-- +*** Testing array_sum() : array with different float values *** +-- simple float array -- +float(1.3) +-- float array with scientific notations e and E -- +float(23630.021) +float(23630.021) +-- Mixed float array -- +float(6531.5458) +Done diff --git a/ext/standard/tests/array/array_sum_variation4.phpt b/ext/standard/tests/array/array_sum_variation4.phpt new file mode 100644 index 0000000..4959dee --- /dev/null +++ b/ext/standard/tests/array/array_sum_variation4.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test array_sum() function : usage variations - array with duplicate values +--FILE-- + +--EXPECTF-- +*** Testing array_sum() : array with duplicate values *** +-- With integer array -- +int(117) +-- With float array -- +float(2.5) +Done diff --git a/ext/standard/tests/array/array_sum_variation5.phpt b/ext/standard/tests/array/array_sum_variation5.phpt new file mode 100644 index 0000000..9068c45 --- /dev/null +++ b/ext/standard/tests/array/array_sum_variation5.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test array_sum() function : usage variations - array with reference variables as elements +--FILE-- + 10, + 1 => &$value4, + 2 => &$value2, + 3 => 200, + 4 => &$value3, +); + +var_dump( array_sum($input) ); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_sum() : array with elements as reference *** +int(305) +Done diff --git a/ext/standard/tests/array/array_sum_variation6.phpt b/ext/standard/tests/array/array_sum_variation6.phpt new file mode 100644 index 0000000..ba67cfd --- /dev/null +++ b/ext/standard/tests/array/array_sum_variation6.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test array_sum() function : usage variations - associative array +--FILE-- + 1, 1 => 10, 2 => 0, 3 => -2, 4 => 23.56); +echo "-- with numeric keys --\n"; +var_dump( array_sum($input) ); + +// array with string keys +$input = array('a' => 20, "b" => 50, 'c' => 0, 'd' => -30, "e" => 100); +echo "-- with string keys --\n"; +var_dump( array_sum($input) ); +echo "Done" +?> +--EXPECTF-- +*** Testing array_sum() : with associative array *** +-- with numeric keys -- +float(32.56) +-- with string keys -- +int(140) +Done diff --git a/ext/standard/tests/array/array_sum_variation7.phpt b/ext/standard/tests/array/array_sum_variation7.phpt new file mode 100644 index 0000000..d309875 --- /dev/null +++ b/ext/standard/tests/array/array_sum_variation7.phpt @@ -0,0 +1,86 @@ +--TEST-- +Test array_sum() function : usage variations - 'input' array with unexpected values as array element +--FILE-- +value = $value; + } +} +// array of objects +$input = array( + new MyClass(2), + new MyClass(5), + new MyClass(10), + new MyClass(0) +); +echo "-- array with object values --\n"; +var_dump( array_sum($input) ); + +// Mixed values +$input = array( 5, -8, 7.2, -1.2, "10", "apple", 'Mango', true, false, null, NULL, array( array(1,2), array(0), array())); +echo "-- array with mixed values --\n"; +var_dump( array_sum($input) ); +echo "Done" +?> +--EXPECTF-- +*** Testing array_sum() : array with unexpected entries *** +-- empty array -- +int(0) +-- array with string values -- +int(0) +-- array with bool values -- +int(3) +-- array with null values -- +int(0) +-- array with subarrays -- +int(0) +-- array with object values -- +int(0) +-- array with mixed values -- +float(14) +Done diff --git a/ext/standard/tests/array/array_udiff_assoc_basic.phpt b/ext/standard/tests/array/array_udiff_assoc_basic.phpt new file mode 100644 index 0000000..769bafb --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_basic.phpt @@ -0,0 +1,41 @@ +--TEST-- +array_udiff_assoc(): Test return type and value for expected input +--FILE-- +priv_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member) ? 1 : -1; + } +} +$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),); +$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),); +$result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr")); +var_dump($result); +?> +--EXPECTF-- +array(3) { + ["0.1"]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(9) + } + ["0.5"]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(12) + } + [0]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(23) + } +} \ No newline at end of file diff --git a/ext/standard/tests/array/array_udiff_assoc_error.phpt b/ext/standard/tests/array/array_udiff_assoc_error.phpt new file mode 100644 index 0000000..ec1cc06 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_error.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test array_udiff_assoc() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_udiff_assoc() : error conditions *** + +-- Testing array_udiff_assoc() function with more than expected no. of arguments -- + +Warning: array_udiff_assoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_assoc_error.php on line %d +NULL + +-- Testing array_udiff_assoc() function with less than expected no. of arguments -- + +Warning: array_udiff_assoc(): at least 3 parameters are required, 2 given in %sarray_udiff_assoc_error.php on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_udiff_assoc_variation.phpt b/ext/standard/tests/array/array_udiff_assoc_variation.phpt new file mode 100644 index 0000000..84e8841 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_variation.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_udiff_assoc() function : variation +--FILE-- + "one", "02" => "two", '3' => "three", "four", "0.5" => 5, 6.0 => 6, "seven" => "0x7"); +$arr2 = array("one" => "one", "02" => "two", '3' => "three"); +$arr3 = array("four", "0.5" => "five", 6 => 6, "seven" => 7); +$arr4 = array("four", "0.5" => "five", 6 => 6, "seven" => 7); + + +var_dump( array_udiff_assoc($arr1, $arr2, $arr3, $arr4, $key_compare_function) ); + + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_assoc() : variation - testing with multiple array arguments *** +array(2) { + [4]=> + string(4) "four" + ["0.5"]=> + int(5) +} +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt new file mode 100644 index 0000000..9886d73 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_udiff_assoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_assoc($value, $arr2, $key_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_assoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt new file mode 100644 index 0000000..18484a7 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_udiff_assoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_assoc($arr1, $value, $key_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_assoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation3.phpt b/ext/standard/tests/array/array_udiff_assoc_variation3.phpt new file mode 100644 index 0000000..e693aff --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_variation3.phpt @@ -0,0 +1,251 @@ +--TEST-- +Test array_udiff_assoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for key_comp_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_assoc($arr1, $arr2, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_assoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--empty array-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--int indexed array-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--associative array-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, first array member is not a valid class name or object in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--nested arrays-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation4.phpt b/ext/standard/tests/array/array_udiff_assoc_variation4.phpt new file mode 100644 index 0000000..0bf3e2d --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_variation4.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_udiff_assoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for ... + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_assoc($arr1, $arr2, $value, $key_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_assoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation5.phpt b/ext/standard/tests/array/array_udiff_assoc_variation5.phpt new file mode 100644 index 0000000..6938076 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_variation5.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test array_udiff_assoc() function : usage variation - incorrect comparison functions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_udiff_assoc() : usage variation - differing comparison functions*** + +-- comparison function with an incorrect return value -- +array(1) { + [0]=> + int(1) +} + +-- comparison function taking too many parameters -- + +Warning: Missing argument 3 for too_many_parameters() in %sarray_udiff_assoc_variation5.php on line %d +array(1) { + [0]=> + int(1) +} + +-- comparison function taking too few parameters -- +array(1) { + [0]=> + int(1) +} +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_basic.phpt b/ext/standard/tests/array/array_udiff_basic.phpt new file mode 100644 index 0000000..3da1b60 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_basic.phpt @@ -0,0 +1,36 @@ +--TEST-- +array_udiff():Test return type and value for expected input +--FILE-- +priv_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member) ? 1 : -1; + } +} +$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),); +$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),); +$result = array_udiff($a, $b, array("cr", "comp_func_cr")); +var_dump($result); +?> +--EXPECTF-- +array(2) { + ["0.5"]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(12) + } + [0]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(23) + } +} \ No newline at end of file diff --git a/ext/standard/tests/array/array_udiff_error.phpt b/ext/standard/tests/array/array_udiff_error.phpt new file mode 100644 index 0000000..dc96577 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_error.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test array_udiff() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_udiff() : error conditions *** + +-- Testing array_udiff() function with more than expected no. of arguments -- + +Warning: array_udiff() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_error.php on line %d +NULL + +-- Testing array_udiff() function with less than expected no. of arguments -- + +Warning: array_udiff(): at least 3 parameters are required, 2 given in %sarray_udiff_error.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_basic.phpt b/ext/standard/tests/array/array_udiff_uassoc_basic.phpt new file mode 100644 index 0000000..6095696 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_basic.phpt @@ -0,0 +1,45 @@ +--TEST-- +array_udiff_uassoc(): Test return type and value for expected input +--FILE-- +priv_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member) ? 1 : -1; + } + static function comp_func_key($a, $b) { + if ($a === $b) return 0; + return ($a > $b) ? 1 : -1; + } +} +$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),); +$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),); +$result = array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr", "comp_func_key")); +var_dump($result); +?> +--EXPECTF-- +array(3) { + ["0.1"]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(9) + } + ["0.5"]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(12) + } + [0]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(23) + } +} \ No newline at end of file diff --git a/ext/standard/tests/array/array_udiff_uassoc_error.phpt b/ext/standard/tests/array/array_udiff_uassoc_error.phpt new file mode 100644 index 0000000..e7d27e6 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_error.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test array_udiff_uassoc() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_udiff_uassoc() : error conditions *** + +-- Testing array_udiff_uassoc() function with more than expected no. of arguments -- + +Warning: array_udiff_uassoc() expects parameter 5 to be a valid callback, no array or string given in %sarray_udiff_uassoc_error.php on line %d +NULL + +-- Testing array_udiff_uassoc() function with less than expected no. of arguments -- + +Warning: array_udiff_uassoc(): at least 4 parameters are required, 3 given in %sarray_udiff_uassoc_error.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt new file mode 100644 index 0000000..a48d56d --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_udiff_uassoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_uassoc($value, $arr2, $data_comp_func, $key_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_uassoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt new file mode 100644 index 0000000..c205da7 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_udiff_uassoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_uassoc($arr1, $value, $data_comp_func, $key_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_uassoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation3.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation3.phpt new file mode 100644 index 0000000..76afda0 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_variation3.phpt @@ -0,0 +1,254 @@ +--TEST-- +Test array_udiff_uassoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for data_comp_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_uassoc($arr1, $arr2, $value, $key_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_uassoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--empty array-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--int indexed array-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--associative array-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, first array member is not a valid class name or object in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--nested arrays-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation4.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation4.phpt new file mode 100644 index 0000000..0beb15f --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_variation4.phpt @@ -0,0 +1,254 @@ +--TEST-- +Test array_udiff_uassoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for key_comp_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_uassoc($arr1, $arr2, $data_comp_func, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_uassoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--empty array-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--int indexed array-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--associative array-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, first array member is not a valid class name or object in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--nested arrays-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt new file mode 100644 index 0000000..87c7071 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt @@ -0,0 +1,229 @@ +--TEST-- +Test array_udiff_uassoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for ... + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_uassoc($arr1, $arr2, $value, $data_comp_func, $key_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_uassoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt new file mode 100644 index 0000000..ec752a3 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test array_udiff_uassoc() function : usage variation +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_udiff_uassoc() : usage variation - differing comparison functions*** + +-- comparison function with an incorrect return value -- +array(1) { + [0]=> + int(1) +} + +-- comparison function taking too many parameters -- + +Warning: Missing argument 3 for too_many_parameters() in %sarray_udiff_uassoc_variation6.php on line %d +array(1) { + [0]=> + int(1) +} + +-- comparison function taking too few parameters -- +array(1) { + [0]=> + int(1) +} +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_variation1.phpt b/ext/standard/tests/array/array_udiff_variation1.phpt new file mode 100644 index 0000000..d2c0e24 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_variation1.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_udiff() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff($value, $arr2, $data_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff() : usage variation *** + +--int 0-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--int 1-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--float .5-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--unset var-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_udiff_variation2.phpt b/ext/standard/tests/array/array_udiff_variation2.phpt new file mode 100644 index 0000000..fd2c12d --- /dev/null +++ b/ext/standard/tests/array/array_udiff_variation2.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_udiff() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff($arr1, $value, $data_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff() : usage variation *** + +--int 0-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--int 1-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--float .5-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--unset var-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_variation3.phpt b/ext/standard/tests/array/array_udiff_variation3.phpt new file mode 100644 index 0000000..aeeee89 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_variation3.phpt @@ -0,0 +1,251 @@ +--TEST-- +Test array_udiff() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for data_comp_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff($arr1, $arr2, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff() : usage variation *** + +--int 0-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--int 1-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--float .5-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--empty array-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_variation3.php on line %d +NULL + +--int indexed array-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_variation3.php on line %d +NULL + +--associative array-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, first array member is not a valid class name or object in %sarray_udiff_variation3.php on line %d +NULL + +--nested arrays-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_variation3.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_variation3.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_variation3.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_variation3.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_variation3.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_udiff_variation3.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_udiff_variation3.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--unset var-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_variation4.phpt b/ext/standard/tests/array/array_udiff_variation4.phpt new file mode 100644 index 0000000..09dec4f --- /dev/null +++ b/ext/standard/tests/array/array_udiff_variation4.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_udiff() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for ... + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff($arr1, $arr2, $value, $data_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff() : usage variation *** + +--int 0-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--int 1-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--float .5-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--unset var-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_variation5.phpt b/ext/standard/tests/array/array_udiff_variation5.phpt new file mode 100644 index 0000000..49405d4 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_variation5.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test array_udiff() function : usage variation +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_udiff() : usage variation *** + +-- comparison function with an incorrect return value -- +array(1) { + [0]=> + int(1) +} + +-- comparison function taking too many parameters -- + +Warning: Missing argument 3 for too_many_parameters() in %sarray_udiff_variation5.php on line %d +array(0) { +} + +-- comparison function taking too few parameters -- +array(0) { +} +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_basic.phpt b/ext/standard/tests/array/array_uintersect_assoc_basic.phpt new file mode 100644 index 0000000..7e9fff7 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_basic.phpt @@ -0,0 +1,36 @@ +--TEST-- +array_uintersect_assoc(): Test return type and value for expected input +--FILE-- +priv_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member) ? 1 : -1; + } +} +$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),); +$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),); +$result = array_uintersect_assoc($a, $b, array("cr", "comp_func_cr")); +var_dump($result); +?> +--EXPECTF-- +array(2) { + [1]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(4) + } + [2]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(-15) + } +} \ No newline at end of file diff --git a/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt b/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt new file mode 100644 index 0000000..f0c7ecc --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_uintersect_assoc() function : basic functionality - testing with multiple array arguments +--FILE-- + "one", "02" => "two", '3' => "three", "four", "0.5" => 5, 0.6 => 6, "0x7" => "seven"); +$arr2 = array("one" => "one", "02" => "two", '3' => "three"); +$arr3 = array("one" => "one", '3' => "three", "0.5" => 5); +$arr4 = array("one" => "one", '3' => "three", "0.5" => 5); + + +var_dump( array_uintersect_assoc($arr1, $arr2, $arr3, $arr4, $data_compare_function) ); + + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_assoc() : basic functionality - testing with multiple array arguments *** +array(2) { + ["one"]=> + string(3) "one" + [3]=> + string(5) "three" +} +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_error.phpt b/ext/standard/tests/array/array_uintersect_assoc_error.phpt new file mode 100644 index 0000000..73fc61e --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_error.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test array_uintersect_assoc() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_assoc() : error conditions *** + +-- Testing array_uintersect_assoc() function with more than expected no. of arguments -- + +Warning: array_uintersect_assoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_assoc_error.php on line %d +NULL + +-- Testing array_uintersect_assoc() function with less than expected no. of arguments -- + +Warning: array_uintersect_assoc(): at least 3 parameters are required, 2 given in %sarray_uintersect_assoc_error.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt new file mode 100644 index 0000000..45d0a8d --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_uintersect_assoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_assoc($value, $arr2, $data_compare_function) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_assoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt new file mode 100644 index 0000000..a421c25 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_uintersect_assoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_assoc($arr1, $value, $data_compare_function) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_assoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation3.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation3.phpt new file mode 100644 index 0000000..a76fca0 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_variation3.phpt @@ -0,0 +1,251 @@ +--TEST-- +Test array_uintersect_assoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for data_compare_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_assoc($arr1, $arr2, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_assoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--empty array-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--int indexed array-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--associative array-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, first array member is not a valid class name or object in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--nested arrays-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt new file mode 100644 index 0000000..abff23a --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_uintersect_assoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for ... + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_assoc($arr1, $arr2, $value, $data_compare_function ) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_assoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt new file mode 100644 index 0000000..e2d7bd0 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test array_uintersect_assoc() function : usage variation - differing comparison functions +--FILE-- + + +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_assoc() : usage variation - differing comparison functions*** + +-- comparison function with an incorrect return value -- +array(0) { +} + +-- comparison function taking too many parameters -- + +Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_assoc_variation5.php on line %d +array(0) { +} + +-- comparison function taking too few parameters -- +array(0) { +} + +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_basic.phpt b/ext/standard/tests/array/array_uintersect_basic.phpt new file mode 100644 index 0000000..8d4b803 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_basic.phpt @@ -0,0 +1,41 @@ +--TEST-- +array_uintersect(): Test return type and value for expected input +--FILE-- +priv_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member) ? 1 : -1; + } +} +$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),); +$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),); +$result = array_uintersect($a, $b, array("cr", "comp_func_cr")); +var_dump($result); +?> +--EXPECTF-- +array(3) { + ["0.1"]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(9) + } + [1]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(4) + } + [2]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(-15) + } +} \ No newline at end of file diff --git a/ext/standard/tests/array/array_uintersect_error.phpt b/ext/standard/tests/array/array_uintersect_error.phpt new file mode 100644 index 0000000..1b25db4 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_error.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test array_uintersect() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_uintersect() : error conditions *** + +-- Testing array_uintersect() function with more than expected no. of arguments -- + +Warning: array_uintersect() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_error.php on line %d +NULL + +-- Testing array_uintersect() function with less than expected no. of arguments -- + +Warning: array_uintersect(): at least 3 parameters are required, 2 given in %sarray_uintersect_error.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_basic.phpt b/ext/standard/tests/array/array_uintersect_uassoc_basic.phpt new file mode 100644 index 0000000..a474bc7 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_basic.phpt @@ -0,0 +1,40 @@ +--TEST-- +array_uintersect_uassoc(): Test return type and value for expected input +--FILE-- +priv_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member) ? 1 : -1; + } + static function comp_func_key($a, $b) { + if ($a === $b) return 0; + return ($a > $b) ? 1 : -1; + } +} +$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),); +$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),); +$result = array_uintersect_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr", "comp_func_key")); +var_dump($result); +?> +--EXPECTF-- +array(2) { + [1]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(4) + } + [2]=> + object(cr)#%d (1) { + ["priv_member":"cr":private]=> + int(-15) + } +} \ No newline at end of file diff --git a/ext/standard/tests/array/array_uintersect_uassoc_error.phpt b/ext/standard/tests/array/array_uintersect_uassoc_error.phpt new file mode 100644 index 0000000..c7391ee --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_error.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test array_uintersect_uassoc() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_uassoc() : error conditions *** + +-- Testing array_uintersect_uassoc() function with more than expected no. of arguments -- + +Warning: array_uintersect_uassoc() expects parameter 5 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_error.php on line %d +NULL + +-- Testing array_uintersect_uassoc() function with less than expected no. of arguments -- + +Warning: array_uintersect_uassoc(): at least 4 parameters are required, 3 given in %sarray_uintersect_uassoc_error.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt new file mode 100644 index 0000000..764c584 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_uintersect_uassoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_uassoc($value, $arr2, $data_compare_func, $key_compare_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_uassoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt new file mode 100644 index 0000000..2efa93d --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_uintersect_uassoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_uassoc($arr1, $value, $data_compare_func, $key_compare_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_uassoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation3.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation3.phpt new file mode 100644 index 0000000..860a166 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation3.phpt @@ -0,0 +1,254 @@ +--TEST-- +Test array_uintersect_uassoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for data_compare_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_uassoc($arr1, $arr2, $value, $key_compare_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_uassoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--empty array-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--int indexed array-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--associative array-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, first array member is not a valid class name or object in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--nested arrays-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation4.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation4.phpt new file mode 100644 index 0000000..a396318 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation4.phpt @@ -0,0 +1,254 @@ +--TEST-- +Test array_uintersect_uassoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for key_compare_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_uassoc($arr1, $arr2, $data_compare_func, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_uassoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--empty array-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--int indexed array-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--associative array-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, first array member is not a valid class name or object in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--nested arrays-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt new file mode 100644 index 0000000..061ac60 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt @@ -0,0 +1,229 @@ +--TEST-- +Test array_uintersect_uassoc() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for ... + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_uassoc($arr1, $arr2, $value, $data_compare_func, $key_compare_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_uassoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt new file mode 100644 index 0000000..6ed86f8 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test array_uintersect_uassoc() function : usage variation - incorrect callbacks +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_uassoc() : usage variation - incorrect callbacks *** + +-- comparison function with an incorrect return value -- +array(0) { +} + +-- comparison function taking too many parameters -- + +Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_uassoc_variation6.php on line %d + +Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_uassoc_variation6.php on line %d + +Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_uassoc_variation6.php on line %d +array(0) { +} + +-- comparison function taking too few parameters -- +array(0) { +} +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation1.phpt b/ext/standard/tests/array/array_uintersect_variation1.phpt new file mode 100644 index 0000000..0663a95 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_variation1.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_uintersect() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect($value, $arr2, $data_compare_function) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect() : usage variation *** + +--int 0-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation2.phpt b/ext/standard/tests/array/array_uintersect_variation2.phpt new file mode 100644 index 0000000..79f4cd0 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_variation2.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_uintersect() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect($arr1, $value, $data_compare_function) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect() : usage variation *** + +--int 0-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation3.phpt b/ext/standard/tests/array/array_uintersect_variation3.phpt new file mode 100644 index 0000000..707ba11 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_variation3.phpt @@ -0,0 +1,251 @@ +--TEST-- +Test array_uintersect() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for data_compare_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect($arr1, $arr2, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect() : usage variation *** + +--int 0-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--empty array-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_variation3.php on line %d +NULL + +--int indexed array-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_variation3.php on line %d +NULL + +--associative array-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, first array member is not a valid class name or object in %sarray_uintersect_variation3.php on line %d +NULL + +--nested arrays-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_variation3.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_variation3.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_variation3.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_variation3.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_variation3.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_uintersect_variation3.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_uintersect_variation3.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation4.phpt b/ext/standard/tests/array/array_uintersect_variation4.phpt new file mode 100644 index 0000000..45207b3 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_variation4.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_uintersect() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for ... + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect($arr1, $arr2, $value, $data_compare_function) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect() : usage variation *** + +--int 0-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation5.phpt b/ext/standard/tests/array/array_uintersect_variation5.phpt new file mode 100644 index 0000000..75cf08e --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_variation5.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test array_uintersect() function : usage variation - differing comparison functions +--FILE-- + + +===DONE=== +--EXPECTF-- +*** Testing array_uintersect() : usage variation - differing comparison functions*** + +-- comparison function with an incorrect return value -- +array(0) { +} + +-- comparison function taking too many parameters -- + +Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d + +Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d + +Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d +array(0) { +} + +-- comparison function taking too few parameters -- +array(0) { +} + +===DONE=== diff --git a/ext/standard/tests/array/array_unique_basic.phpt b/ext/standard/tests/array/array_unique_basic.phpt new file mode 100644 index 0000000..58d3acf --- /dev/null +++ b/ext/standard/tests/array/array_unique_basic.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test array_unique() function : basic functionality +--FILE-- + "one", 1 => "one", 2 => "two", '2' => "two"); +var_dump( array_unique($input) ); + +// mixed array +$input = array("1" => "one", "two", "one", 2 => "two", "three"); +var_dump( array_unique($input) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unique() : basic functionality *** +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +array(2) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" +} +array(3) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [4]=> + string(5) "three" +} +Done diff --git a/ext/standard/tests/array/array_unique_error.phpt b/ext/standard/tests/array/array_unique_error.phpt new file mode 100644 index 0000000..9da3dfc --- /dev/null +++ b/ext/standard/tests/array/array_unique_error.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_unique() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_unique() : error conditions *** + +-- Testing array_unique() function with zero arguments -- + +Warning: array_unique() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing array_unique() function with more than expected no. of arguments -- + +Warning: array_unique() expects at most 2 parameters, 3 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_unique_variation1.phpt b/ext/standard/tests/array/array_unique_variation1.phpt new file mode 100644 index 0000000..a7774ef --- /dev/null +++ b/ext/standard/tests/array/array_unique_variation1.phpt @@ -0,0 +1,195 @@ +--TEST-- +Test array_unique() function : usage variations - unexpected values for 'input' argument +--FILE-- + +--EXPECTF-- +*** Testing array_unique() : Passing non array values to $input argument *** +-- Iteration 1 -- + +Warning: array_unique() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 2 -- + +Warning: array_unique() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 3 -- + +Warning: array_unique() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 4 -- + +Warning: array_unique() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: array_unique() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: array_unique() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_unique() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_unique() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_unique() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_unique() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_unique() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: array_unique() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: array_unique() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: array_unique() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: array_unique() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: array_unique() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: array_unique() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: array_unique() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_unique() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_unique() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_unique() expects parameter 1 to be array, object given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: array_unique() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 23 -- + +Warning: array_unique() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 24 -- + +Warning: array_unique() expects parameter 1 to be array, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_unique_variation2.phpt b/ext/standard/tests/array/array_unique_variation2.phpt new file mode 100644 index 0000000..3cfcfba --- /dev/null +++ b/ext/standard/tests/array/array_unique_variation2.phpt @@ -0,0 +1,232 @@ +--TEST-- +Test array_unique() function : usage variations - different arrays for 'input' argument +--FILE-- +22 +'single quoted string' +"double quoted string" +2222 != 1111.\t 0000 = 0000\n +EOT; + +// arrays passed to $input argument +$inputs = array ( +/*1*/ array(1, 2, 2, 1), // with default keys and numeric values + array(1.1, 2.2, 1.1), // with default keys & float values + array(false, true, false), // with default keys and boolean values + array(), // empty array +/*5*/ array(NULL, null), // with NULL + array("a\v\f", "aaaa\r", "b", "aaaa\r", "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings + array('a\v\f', 'aaaa\r', 'b', 'aaaa\r', '\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings + array("h1" => $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $blank_line), // with heredocs + + // associative arrays +/*9*/ array(1 => "one", 2 => "two", 2 => "two"), // explicit numeric keys, string values + array("one" => 1, "two" => 2, "1" => 1 ), // string keys & numeric values + array( 1 => 10, 2 => 20, 4 => 40, 5 => 10), // explicit numeric keys and numeric values + array( "one" => "ten", "two" => "twenty", "10" => "ten"), // string key/value + array("one" => 1, 2 => "two", 4 => "four"), //mixed + + // associative array, containing null/empty/boolean values as key/value +/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), + array(true => "true", false => "false", "false" => false, "true" => true), + array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), + array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), +/*18*/ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), +); + +// loop through each sub-array of $inputs to check the behavior of array_unique() +$iterator = 1; +foreach($inputs as $input) { + echo "-- Iteration $iterator --\n"; + var_dump( array_unique($input, SORT_STRING) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unique() : Passing different arrays to $input argument *** +-- Iteration 1 -- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +-- Iteration 2 -- +array(2) { + [0]=> + float(1.1) + [1]=> + float(2.2) +} +-- Iteration 3 -- +array(2) { + [0]=> + bool(false) + [1]=> + bool(true) +} +-- Iteration 4 -- +array(0) { +} +-- Iteration 5 -- +array(1) { + [0]=> + NULL +} +-- Iteration 6 -- +array(4) { + [0]=> + %unicode|string%(3) "a " + [1]=> + %unicode|string%(5) "aaaa " + [2]=> + %unicode|string%(1) "b" + [4]=> + %unicode|string%(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}" +} +-- Iteration 7 -- +array(4) { + [0]=> + %unicode|string%(5) "a\v\f" + [1]=> + %unicode|string%(6) "aaaa\r" + [2]=> + %unicode|string%(1) "b" + [4]=> + %unicode|string%(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}" +} +-- Iteration 8 -- +array(3) { + [%b|u%"h1"]=> + %unicode|string%(1) " +" + [%b|u%"h2"]=> + %unicode|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 +1111 != 2222 +heredoc +double quoted string. with different white spaces" +} +-- Iteration 9 -- +array(2) { + [1]=> + %unicode|string%(3) "one" + [2]=> + %unicode|string%(3) "two" +} +-- Iteration 10 -- +array(2) { + [%b|u%"one"]=> + int(1) + [%b|u%"two"]=> + int(2) +} +-- Iteration 11 -- +array(3) { + [1]=> + int(10) + [2]=> + int(20) + [4]=> + int(40) +} +-- Iteration 12 -- +array(2) { + [%b|u%"one"]=> + %unicode|string%(3) "ten" + [%b|u%"two"]=> + %unicode|string%(6) "twenty" +} +-- Iteration 13 -- +array(3) { + [%b|u%"one"]=> + int(1) + [2]=> + %unicode|string%(3) "two" + [4]=> + %unicode|string%(4) "four" +} +-- Iteration 14 -- +array(2) { + [%b|u%""]=> + %unicode|string%(4) "null" + [%b|u%"NULL"]=> + NULL +} +-- Iteration 15 -- +array(4) { + [1]=> + %unicode|string%(4) "true" + [0]=> + %unicode|string%(5) "false" + [%b|u%"false"]=> + bool(false) + [%b|u%"true"]=> + bool(true) +} +-- Iteration 16 -- +array(2) { + [%b|u%""]=> + %unicode|string%(6) "emptys" + [%b|u%"emptyd"]=> + %unicode|string%(0) "" +} +-- Iteration 17 -- +array(2) { + [1]=> + %unicode|string%(0) "" + [6]=> + bool(true) +} +-- Iteration 18 -- +array(3) { + [%b|u%""]=> + int(4) + [0]=> + int(5) + [1]=> + int(6) +} +Done diff --git a/ext/standard/tests/array/array_unique_variation3.phpt b/ext/standard/tests/array/array_unique_variation3.phpt new file mode 100644 index 0000000..49103c8 --- /dev/null +++ b/ext/standard/tests/array/array_unique_variation3.phpt @@ -0,0 +1,134 @@ +--TEST-- +Test array_unique() function : usage variations - associative array with different keys +--FILE-- + "0", 1 => "0"), + array(1 => "1", 2 => "2", 3 => 1, 4 => "4"), + + // arrays with float keys +/*3*/ array(2.3333 => "float", 44.44 => "float"), + array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => "f1", 3333333.333333 => "f4"), + + // arrays with string keys +/*5*/ array('\tHello' => 111, 're\td' => "color", '\v\fworld' => 2.2, 'pen\n' => 111), + array("\tHello" => 111, "re\td" => "color", "\v\fworld" => 2.2, "pen\n" => 111), + array("hello", $heredoc => "string", "string"), + + // array with object, unset variable and resource variable +/*8*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource', 11, "hello"), +); + +// loop through each sub-array of $inputs to check the behavior of array_unique() +$iterator = 1; +foreach($inputs as $input) { + echo "-- Iteration $iterator --\n"; + var_dump( array_unique($input) ); + $iterator++; +} + +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unique() : assoc. array with diff. keys passed to $input argument *** + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d +-- Iteration 1 -- +array(1) { + [0]=> + string(1) "0" +} +-- Iteration 2 -- +array(3) { + [1]=> + string(1) "1" + [2]=> + string(1) "2" + [4]=> + string(1) "4" +} +-- Iteration 3 -- +array(1) { + [2]=> + string(5) "float" +} +-- Iteration 4 -- +array(3) { + [1]=> + string(2) "f1" + [3]=> + string(2) "f2" + [3333333]=> + string(2) "f4" +} +-- Iteration 5 -- +array(3) { + ["\tHello"]=> + int(111) + ["re\td"]=> + string(5) "color" + ["\v\fworld"]=> + float(2.2) +} +-- Iteration 6 -- +array(3) { + [" Hello"]=> + int(111) + ["re d"]=> + string(5) "color" + [" world"]=> + float(2.2) +} +-- Iteration 7 -- +array(2) { + [0]=> + string(5) "hello" + ["Hello world"]=> + string(6) "string" +} +-- Iteration 8 -- +array(2) { + [""]=> + string(5) "hello" + [0]=> + int(11) +} +Done diff --git a/ext/standard/tests/array/array_unique_variation4.phpt b/ext/standard/tests/array/array_unique_variation4.phpt new file mode 100644 index 0000000..a1fc13e --- /dev/null +++ b/ext/standard/tests/array/array_unique_variation4.phpt @@ -0,0 +1,131 @@ +--TEST-- +Test array_unique() function : usage variations - associative array with different values +--FILE-- + 0, '1' => 0), + array("one" => 1, 'two' => 2, "three" => 1, 4 => 1), + + // arrays with float values +/*3*/ array("float1" => 2.3333, "float2" => 2.3333), + array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 1.2), + + // arrays with string values +/*5*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "\tHello"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => '\tHello'), + array(1 => "hello", "heredoc" => $heredoc, $heredoc), + + // array with object, unset variable and resource variable +/*8*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp, new classA(), $fp), +); + +// loop through each sub-array of $inputs to check the behavior of array_unique() +$iterator = 1; +foreach($inputs as $input) { + echo "-- Iteration $iterator --\n"; + var_dump( array_unique($input) ); + $iterator++; +} + +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unique() : assoc. array with diff. values to $input argument *** +-- Iteration 1 -- +array(1) { + [0]=> + int(0) +} +-- Iteration 2 -- +array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) +} +-- Iteration 3 -- +array(1) { + ["float1"]=> + float(2.3333) +} +-- Iteration 4 -- +array(3) { + ["f1"]=> + float(1.2) + ["f2"]=> + float(3.33) + [3]=> + float(4.8999992284) +} +-- Iteration 5 -- +array(3) { + [111]=> + string(6) " Hello" + ["red"]=> + string(6) "col or" + [2]=> + string(7) " world" +} +-- Iteration 6 -- +array(3) { + [111]=> + string(7) "\tHello" + ["red"]=> + string(7) "col\tor" + [2]=> + string(9) "\v\fworld" +} +-- Iteration 7 -- +array(2) { + [1]=> + string(5) "hello" + ["heredoc"]=> + string(11) "Hello world" +} +-- Iteration 8 -- +array(3) { + [11]=> + object(classA)#%d (0) { + } + ["unset"]=> + NULL + ["resource"]=> + resource(%d) of type (stream) +} +Done diff --git a/ext/standard/tests/array/array_unique_variation5.phpt b/ext/standard/tests/array/array_unique_variation5.phpt new file mode 100644 index 0000000..5e3f7c3 --- /dev/null +++ b/ext/standard/tests/array/array_unique_variation5.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test array_unique() function : usage variations - array with duplicate keys +--FILE-- + "one", 2 => "two", 2 => "2", 3 => "three", 1 => "1", "1", "2"); +var_dump( array_unique($input) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unique() : array with duplicate keys for $input argument *** +array(3) { + [1]=> + string(1) "1" + [2]=> + string(1) "2" + [3]=> + string(5) "three" +} +Done diff --git a/ext/standard/tests/array/array_unique_variation6.phpt b/ext/standard/tests/array/array_unique_variation6.phpt new file mode 100644 index 0000000..82442bd --- /dev/null +++ b/ext/standard/tests/array/array_unique_variation6.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test array_unique() function : usage variations - array with reference variables +--FILE-- + 0, + 1 => &$value4, + 2 => &$value2, + 3 => "hello", + 4 => &$value3, + 5 => $value4 +); + +var_dump( array_unique($input, SORT_STRING) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unique() : array with reference variables for $input argument *** +array(2) { + [0]=> + int(0) + [1]=> + &%unicode|string%(5) "hello" +} +Done diff --git a/ext/standard/tests/array/array_unique_variation7.phpt b/ext/standard/tests/array/array_unique_variation7.phpt new file mode 100644 index 0000000..e998a73 --- /dev/null +++ b/ext/standard/tests/array/array_unique_variation7.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test array_unique() function : usage variations - binary safe checking +--FILE-- + "hello", "str2" => "world"); + +var_dump( array_unique($input) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unique() : array with binary data for $input argument *** +array(3) { + [0]=> + string(1) "1" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" +} +Done diff --git a/ext/standard/tests/array/array_unique_variation8.phpt b/ext/standard/tests/array/array_unique_variation8.phpt new file mode 100644 index 0000000..ee34dee --- /dev/null +++ b/ext/standard/tests/array/array_unique_variation8.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test array_unique() function : usage variations - two dimensional arrays +--FILE-- + "hello", "str2" => 'world'), + array(1 => "one", 2 => "two", "one", 'two'), + array(1, 2, 3, 1) +); + +var_dump( array_unique($input, SORT_STRING) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unique() : two dimensional array for $input argument *** + +Notice: Array to string conversion in %sarray_unique_variation8.php on line %d + +Notice: Array to string conversion in %sarray_unique_variation8.php on line %d + +Notice: Array to string conversion in %sarray_unique_variation8.php on line %d + +Notice: Array to string conversion in %sarray_unique_variation8.php on line %d + +Notice: Array to string conversion in %sarray_unique_variation8.php on line %d + +Notice: Array to string conversion in %sarray_unique_variation8.php on line %d + +Notice: Array to string conversion in %sarray_unique_variation8.php on line %d + +Notice: Array to string conversion in %sarray_unique_variation8.php on line %d + +Notice: Array to string conversion in %sarray_unique_variation8.php on line %d + +Notice: Array to string conversion in %sarray_unique_variation8.php on line %d + +Notice: Array to string conversion in %sarray_unique_variation8.php on line %d + +Notice: Array to string conversion in %sarray_unique_variation8.php on line %d + +Notice: Array to string conversion in %sarray_unique_variation8.php on line %d + +Notice: Array to string conversion in %sarray_unique_variation8.php on line %d +array(1) { + [0]=> + array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(1) + } +} +Done diff --git a/ext/standard/tests/array/array_unshift.phpt b/ext/standard/tests/array/array_unshift.phpt new file mode 100644 index 0000000..ebcf190 --- /dev/null +++ b/ext/standard/tests/array/array_unshift.phpt @@ -0,0 +1,40 @@ +--TEST-- +array_unshift() tests +--FILE-- + +--EXPECTF-- +int(1) +array(1) { + [0]=> + string(0) "" +} + +Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d +NULL +array(1) { + [0]=> + string(0) "" +} +int(2) +array(2) { + [0]=> + array(1) { + [0]=> + string(0) "" + } + [1]=> + string(0) "" +} +Done diff --git a/ext/standard/tests/array/array_unshift_basic1.phpt b/ext/standard/tests/array/array_unshift_basic1.phpt new file mode 100644 index 0000000..97ea895 --- /dev/null +++ b/ext/standard/tests/array/array_unshift_basic1.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test array_unshift() function : basic functionality - array with default keys for 'array' argument +--FILE-- + +--EXPECTF-- +*** Testing array_unshift() : basic functionality with default key array *** +int(3) +array(3) { + [0]=> + int(10) + [1]=> + int(1) + [2]=> + int(2) +} +int(5) +array(5) { + [0]=> + int(222) + [1]=> + string(5) "hello" + [2]=> + float(12.33) + [3]=> + int(1) + [4]=> + int(2) +} +Done diff --git a/ext/standard/tests/array/array_unshift_basic2.phpt b/ext/standard/tests/array/array_unshift_basic2.phpt new file mode 100644 index 0000000..e4fd2e0 --- /dev/null +++ b/ext/standard/tests/array/array_unshift_basic2.phpt @@ -0,0 +1,71 @@ +--TEST-- +Test array_unshift() function : basic functionality - associative arrays for 'array' argument +--FILE-- + "first", "s" => 'second', 1 => "one", 2 => 'two'); + +// Calling array_unshift() with default argument +$temp_array = $array; +// returns element count in the resulting array after arguments are pushed to +// beginning of the given array +var_dump( array_unshift($temp_array, 10) ); + +// dump the resulting array +var_dump($temp_array); + +// Calling array_unshift() with optional arguments +$temp_array = $array; +// returns element count in the resulting array after arguments are pushed to +// beginning of the given array +var_dump( array_unshift($temp_array, 222, "hello", 12.33) ); + +// dump the resulting array +var_dump($temp_array); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unshift() : basic functionality with associative array *** +int(5) +array(5) { + [0]=> + int(10) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + string(3) "one" + [2]=> + string(3) "two" +} +int(7) +array(7) { + [0]=> + int(222) + [1]=> + string(5) "hello" + [2]=> + float(12.33) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + string(3) "one" + [4]=> + string(3) "two" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_unshift_error.phpt b/ext/standard/tests/array/array_unshift_error.phpt new file mode 100644 index 0000000..1381111 --- /dev/null +++ b/ext/standard/tests/array/array_unshift_error.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test array_unshift() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_unshift() : error conditions *** + +-- Testing array_unshift() function with Zero arguments -- + +Warning: array_unshift() expects at least 2 parameters, 0 given in %s on line %d +NULL + +-- Testing array_unshift() function with less than expected no. of arguments -- + +Warning: array_unshift() expects at least 2 parameters, 1 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_unshift_object.phpt b/ext/standard/tests/array/array_unshift_object.phpt new file mode 100644 index 0000000..e615537 --- /dev/null +++ b/ext/standard/tests/array/array_unshift_object.phpt @@ -0,0 +1,287 @@ +--TEST-- +Test array_unshift() function : passing object for 'var' argument +--FILE-- + "first", "s" => 'second', 1, 2.222); + +// array containing different types of objects as elements +$vars = array( + new SimpleClass(), + new EmptyClass(), + new ChildClass(), + new FinalClass(), + new StaticClass() +); + +// loop through the various elements of $arrays to check the functionality of array_unshift +$iterator = 1; +foreach($vars as $var) { + echo "-- Iteration $iterator --\n"; + + /* with default argument */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + $temp_array = $array; + var_dump( array_unshift($temp_array, $var) ); + + // dump the resulting array + var_dump($temp_array); + + /* with optional arguments */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + $temp_array = $array; + var_dump( array_unshift($temp_array, $var, "hello", 'world') ); + + // dump the resulting array + var_dump($temp_array); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unshift() : Passing object to $var argument *** +-- Iteration 1 -- +int(5) +array(5) { + [0]=> + object(SimpleClass)#%d (1) { + ["var1"]=> + int(1) + } + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + object(SimpleClass)#%d (1) { + ["var1"]=> + int(1) + } + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 2 -- +int(5) +array(5) { + [0]=> + object(EmptyClass)#%d (0) { + } + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + object(EmptyClass)#%d (0) { + } + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 3 -- +int(5) +array(5) { + [0]=> + object(ChildClass)#%d (2) { + ["var3":"ChildClass":private]=> + NULL + ["var2":protected]=> + int(5) + } + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + object(ChildClass)#%d (2) { + ["var3":"ChildClass":private]=> + NULL + ["var2":protected]=> + int(5) + } + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 4 -- +int(5) +array(5) { + [0]=> + object(FinalClass)#%d (1) { + ["var4":"FinalClass":private]=> + NULL + } + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + object(FinalClass)#%d (1) { + ["var4":"FinalClass":private]=> + NULL + } + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 5 -- +int(5) +array(5) { + [0]=> + object(StaticClass)#%d (0) { + } + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + object(StaticClass)#%d (0) { + } + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +Done diff --git a/ext/standard/tests/array/array_unshift_variation1.phpt b/ext/standard/tests/array/array_unshift_variation1.phpt new file mode 100644 index 0000000..4d0c8c2 --- /dev/null +++ b/ext/standard/tests/array/array_unshift_variation1.phpt @@ -0,0 +1,338 @@ +--TEST-- +Test array_unshift() function : usage variations - unexpected values for 'array' argument +--FILE-- + +--EXPECTF-- +*** Testing array_unshift() : unexpected values for $array argument *** + +-- Iteration 1 -- +Warning: array_unshift() expects parameter 1 to be array, integer given in %s on line %d +NULL +int(0) + +Warning: array_unshift() expects parameter 1 to be array, integer given in %s on line %d +NULL +int(0) + +-- Iteration 2 -- +Warning: array_unshift() expects parameter 1 to be array, integer given in %s on line %d +NULL +int(1) + +Warning: array_unshift() expects parameter 1 to be array, integer given in %s on line %d +NULL +int(1) + +-- Iteration 3 -- +Warning: array_unshift() expects parameter 1 to be array, integer given in %s on line %d +NULL +int(12345) + +Warning: array_unshift() expects parameter 1 to be array, integer given in %s on line %d +NULL +int(12345) + +-- Iteration 4 -- +Warning: array_unshift() expects parameter 1 to be array, integer given in %s on line %d +NULL +int(-2345) + +Warning: array_unshift() expects parameter 1 to be array, integer given in %s on line %d +NULL +int(-2345) + +-- Iteration 5 -- +Warning: array_unshift() expects parameter 1 to be array, double given in %s on line %d +NULL +float(10.5) + +Warning: array_unshift() expects parameter 1 to be array, double given in %s on line %d +NULL +float(10.5) + +-- Iteration 6 -- +Warning: array_unshift() expects parameter 1 to be array, double given in %s on line %d +NULL +float(-10.5) + +Warning: array_unshift() expects parameter 1 to be array, double given in %s on line %d +NULL +float(-10.5) + +-- Iteration 7 -- +Warning: array_unshift() expects parameter 1 to be array, double given in %s on line %d +NULL +float(123456789000) + +Warning: array_unshift() expects parameter 1 to be array, double given in %s on line %d +NULL +float(123456789000) + +-- Iteration 8 -- +Warning: array_unshift() expects parameter 1 to be array, double given in %s on line %d +NULL +float(1.23456789E-9) + +Warning: array_unshift() expects parameter 1 to be array, double given in %s on line %d +NULL +float(1.23456789E-9) + +-- Iteration 9 -- +Warning: array_unshift() expects parameter 1 to be array, double given in %s on line %d +NULL +float(0.5) + +Warning: array_unshift() expects parameter 1 to be array, double given in %s on line %d +NULL +float(0.5) + +-- Iteration 10 -- +Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d +NULL +NULL + +Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d +NULL +NULL + +-- Iteration 11 -- +Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d +NULL +NULL + +Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d +NULL +NULL + +-- Iteration 12 -- +Warning: array_unshift() expects parameter 1 to be array, boolean given in %s on line %d +NULL +bool(true) + +Warning: array_unshift() expects parameter 1 to be array, boolean given in %s on line %d +NULL +bool(true) + +-- Iteration 13 -- +Warning: array_unshift() expects parameter 1 to be array, boolean given in %s on line %d +NULL +bool(false) + +Warning: array_unshift() expects parameter 1 to be array, boolean given in %s on line %d +NULL +bool(false) + +-- Iteration 14 -- +Warning: array_unshift() expects parameter 1 to be array, boolean given in %s on line %d +NULL +bool(true) + +Warning: array_unshift() expects parameter 1 to be array, boolean given in %s on line %d +NULL +bool(true) + +-- Iteration 15 -- +Warning: array_unshift() expects parameter 1 to be array, boolean given in %s on line %d +NULL +bool(false) + +Warning: array_unshift() expects parameter 1 to be array, boolean given in %s on line %d +NULL +bool(false) + +-- Iteration 16 -- +Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d +NULL +string(0) "" + +Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d +NULL +string(0) "" + +-- Iteration 17 -- +Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d +NULL +string(0) "" + +Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d +NULL +string(0) "" + +-- Iteration 18 -- +Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d +NULL +string(6) "string" + +Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d +NULL +string(6) "string" + +-- Iteration 19 -- +Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d +NULL +string(6) "string" + +Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d +NULL +string(6) "string" + +-- Iteration 20 -- +Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d +NULL +string(11) "hello world" + +Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d +NULL +string(11) "hello world" + +-- Iteration 21 -- +Warning: array_unshift() expects parameter 1 to be array, object given in %s on line %d +NULL +object(classA)#1 (0) { +} + +Warning: array_unshift() expects parameter 1 to be array, object given in %s on line %d +NULL +object(classA)#1 (0) { +} + +-- Iteration 22 -- +Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d +NULL +NULL + +Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d +NULL +NULL + +-- Iteration 23 -- +Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d +NULL +NULL + +Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d +NULL +NULL + +-- Iteration 24 -- +Warning: array_unshift() expects parameter 1 to be array, resource given in %s on line %d +NULL +resource(%d) of type (stream) + +Warning: array_unshift() expects parameter 1 to be array, resource given in %s on line %d +NULL +resource(%d) of type (stream) +Done diff --git a/ext/standard/tests/array/array_unshift_variation2.phpt b/ext/standard/tests/array/array_unshift_variation2.phpt new file mode 100644 index 0000000..064309b --- /dev/null +++ b/ext/standard/tests/array/array_unshift_variation2.phpt @@ -0,0 +1,1061 @@ +--TEST-- +Test array_unshift() function : usage variations - all possible values for 'var' argument +--FILE-- + "first", "s" => 'second', 1, 2.222); + +// get a class +class classA +{ + public function __toString() { + return "Class A object"; + } +} + +// get a resource variable +$fp = fopen(__FILE__, "r"); + +// heredoc string +$heredoc = << 'red', 'item' => 'pen'), + + // null data +/*15*/ NULL, + null, + + // boolean data +/*17*/ true, + false, + TRUE, + FALSE, + + // empty data +/*21*/ "", + '', + + // string data +/*23*/ "string", + 'string', + $heredoc, + + // object data +/*26*/ new classA(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource variable +/*29*/ $fp +); + +// loop through each element of $vars to check the functionality of array_unshift() +$iterator = 1; +foreach($vars as $var) { + echo "-- Iteration $iterator --\n"; + $temp_array = $array; + + /* with default argument */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + var_dump( array_unshift($temp_array, $var) ); + + // dump the resulting array + var_dump($temp_array); + + /* with optional arguments */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + $temp_array = $array; + var_dump( array_unshift($temp_array, $var, "hello", 'world') ); + + // dump the resulting array + var_dump($temp_array); + $iterator++; +} + +// close the file resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unshift() : all possible values for $var argument *** +-- Iteration 1 -- +int(5) +array(5) { + [0]=> + int(0) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + int(0) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 2 -- +int(5) +array(5) { + [0]=> + int(1) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + int(1) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 3 -- +int(5) +array(5) { + [0]=> + int(12345) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + int(12345) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 4 -- +int(5) +array(5) { + [0]=> + int(-2345) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + int(-2345) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 5 -- +int(5) +array(5) { + [0]=> + float(10.5) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + float(10.5) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 6 -- +int(5) +array(5) { + [0]=> + float(-10.5) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + float(-10.5) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 7 -- +int(5) +array(5) { + [0]=> + float(123456789000) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + float(123456789000) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 8 -- +int(5) +array(5) { + [0]=> + float(1.23456789E-9) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + float(1.23456789E-9) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 9 -- +int(5) +array(5) { + [0]=> + float(0.5) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + float(0.5) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 10 -- +int(5) +array(5) { + [0]=> + array(0) { + } + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + array(0) { + } + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 11 -- +int(5) +array(5) { + [0]=> + array(1) { + [0]=> + int(0) + } + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 12 -- +int(5) +array(5) { + [0]=> + array(1) { + [0]=> + int(1) + } + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + array(1) { + [0]=> + int(1) + } + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 13 -- +int(5) +array(5) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 14 -- +int(5) +array(5) { + [0]=> + array(2) { + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + } + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + array(2) { + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + } + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 15 -- +int(5) +array(5) { + [0]=> + NULL + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + NULL + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 16 -- +int(5) +array(5) { + [0]=> + NULL + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + NULL + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 17 -- +int(5) +array(5) { + [0]=> + bool(true) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + bool(true) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 18 -- +int(5) +array(5) { + [0]=> + bool(false) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + bool(false) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 19 -- +int(5) +array(5) { + [0]=> + bool(true) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + bool(true) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 20 -- +int(5) +array(5) { + [0]=> + bool(false) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + bool(false) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 21 -- +int(5) +array(5) { + [0]=> + string(0) "" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(0) "" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 22 -- +int(5) +array(5) { + [0]=> + string(0) "" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(0) "" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 23 -- +int(5) +array(5) { + [0]=> + string(6) "string" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(6) "string" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 24 -- +int(5) +array(5) { + [0]=> + string(6) "string" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(6) "string" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 25 -- +int(5) +array(5) { + [0]=> + string(11) "hello world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(11) "hello world" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 26 -- +int(5) +array(5) { + [0]=> + object(classA)#%d (0) { + } + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + object(classA)#%d (0) { + } + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 27 -- +int(5) +array(5) { + [0]=> + NULL + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + NULL + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 28 -- +int(5) +array(5) { + [0]=> + NULL + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + NULL + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 29 -- +int(5) +array(5) { + [0]=> + resource(%d) of type (stream) + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + resource(%d) of type (stream) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +Done diff --git a/ext/standard/tests/array/array_unshift_variation3.phpt b/ext/standard/tests/array/array_unshift_variation3.phpt new file mode 100644 index 0000000..286cb29 --- /dev/null +++ b/ext/standard/tests/array/array_unshift_variation3.phpt @@ -0,0 +1,571 @@ +--TEST-- +Test array_unshift() function : usage variations - different array values for 'array' argument +--FILE-- + "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values + array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values + array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values + array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value + array("one" => 1, 2 => "two", 4 => "four"), //mixed + + // associative array, containing null/empty/boolean values as key/value +/*13*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), + array(true => "true", false => "false", "false" => false, "true" => true), + array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), + array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), + array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + + // array with repetative keys +/*18*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) +); + +// loop through the various elements of $arrays to test array_unshift() +$iterator = 1; +foreach($arrays as $array) { + echo "-- Iteration $iterator --\n"; + + /* with default argument */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + $temp_array = $array; + var_dump( array_unshift($temp_array, $var) ); + + // dump the resulting array + var_dump($temp_array); + + /* with optional arguments */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + $temp_array = $array; + var_dump( array_unshift($temp_array, $var, "hello", 'world') ); + + // dump the resulting array + var_dump($temp_array); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unshift() : different arrays for $array argument *** +-- Iteration 1 -- +int(3) +array(3) { + [0]=> + int(10) + [1]=> + int(1) + [2]=> + int(2) +} +int(5) +array(5) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + int(1) + [4]=> + int(2) +} +-- Iteration 2 -- +int(3) +array(3) { + [0]=> + int(10) + [1]=> + float(1.1) + [2]=> + float(2.2) +} +int(5) +array(5) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + float(1.1) + [4]=> + float(2.2) +} +-- Iteration 3 -- +int(3) +array(3) { + [0]=> + int(10) + [1]=> + array(1) { + [0]=> + int(2) + } + [2]=> + array(1) { + [0]=> + int(1) + } +} +int(5) +array(5) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + array(1) { + [0]=> + int(2) + } + [4]=> + array(1) { + [0]=> + int(1) + } +} +-- Iteration 4 -- +int(3) +array(3) { + [0]=> + int(10) + [1]=> + bool(false) + [2]=> + bool(true) +} +int(5) +array(5) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + bool(false) + [4]=> + bool(true) +} +-- Iteration 5 -- +int(1) +array(1) { + [0]=> + int(10) +} +int(3) +array(3) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" +} +-- Iteration 6 -- +int(2) +array(2) { + [0]=> + int(10) + [1]=> + NULL +} +int(4) +array(4) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + NULL +} +-- Iteration 7 -- +int(7) +array(7) { + [0]=> + int(10) + [1]=> + string(1) "a" + [2]=> + string(4) "aaaa" + [3]=> + string(1) "b" + [4]=> + string(4) "bbbb" + [5]=> + string(1) "c" + [6]=> + string(5) "ccccc" +} +int(9) +array(9) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + string(1) "a" + [4]=> + string(4) "aaaa" + [5]=> + string(1) "b" + [6]=> + string(4) "bbbb" + [7]=> + string(1) "c" + [8]=> + string(5) "ccccc" +} +-- Iteration 8 -- +int(4) +array(4) { + [0]=> + int(10) + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" +} +int(6) +array(6) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + string(3) "one" + [4]=> + string(3) "two" + [5]=> + string(5) "three" +} +-- Iteration 9 -- +int(4) +array(4) { + [0]=> + int(10) + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) +} +int(6) +array(6) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) +} +-- Iteration 10 -- +int(5) +array(5) { + [0]=> + int(10) + [1]=> + int(10) + [2]=> + int(20) + [3]=> + int(40) + [4]=> + int(30) +} +int(7) +array(7) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + int(10) + [4]=> + int(20) + [5]=> + int(40) + [6]=> + int(30) +} +-- Iteration 11 -- +int(4) +array(4) { + [0]=> + int(10) + ["one"]=> + string(3) "ten" + ["two"]=> + string(6) "twenty" + ["three"]=> + string(6) "thirty" +} +int(6) +array(6) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["one"]=> + string(3) "ten" + ["two"]=> + string(6) "twenty" + ["three"]=> + string(6) "thirty" +} +-- Iteration 12 -- +int(4) +array(4) { + [0]=> + int(10) + ["one"]=> + int(1) + [1]=> + string(3) "two" + [2]=> + string(4) "four" +} +int(6) +array(6) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["one"]=> + int(1) + [3]=> + string(3) "two" + [4]=> + string(4) "four" +} +-- Iteration 13 -- +int(4) +array(4) { + [0]=> + int(10) + [""]=> + string(4) "null" + ["NULL"]=> + NULL + ["null"]=> + NULL +} +int(6) +array(6) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [""]=> + string(4) "null" + ["NULL"]=> + NULL + ["null"]=> + NULL +} +-- Iteration 14 -- +int(5) +array(5) { + [0]=> + int(10) + [1]=> + string(4) "true" + [2]=> + string(5) "false" + ["false"]=> + bool(false) + ["true"]=> + bool(true) +} +int(7) +array(7) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + string(4) "true" + [4]=> + string(5) "false" + ["false"]=> + bool(false) + ["true"]=> + bool(true) +} +-- Iteration 15 -- +int(4) +array(4) { + [0]=> + int(10) + [""]=> + string(6) "emptys" + ["emptyd"]=> + string(0) "" + ["emptys"]=> + string(0) "" +} +int(6) +array(6) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [""]=> + string(6) "emptys" + ["emptyd"]=> + string(0) "" + ["emptys"]=> + string(0) "" +} +-- Iteration 16 -- +int(7) +array(7) { + [0]=> + int(10) + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + NULL + [4]=> + NULL + [5]=> + bool(false) + [6]=> + bool(true) +} +int(9) +array(9) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + NULL + [6]=> + NULL + [7]=> + bool(false) + [8]=> + bool(true) +} +-- Iteration 17 -- +int(4) +array(4) { + [0]=> + int(10) + [""]=> + int(4) + [1]=> + int(5) + [2]=> + int(6) +} +int(6) +array(6) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [""]=> + int(4) + [3]=> + int(5) + [4]=> + int(6) +} +-- Iteration 18 -- +int(4) +array(4) { + [0]=> + int(10) + ["One"]=> + int(10) + ["two"]=> + int(20) + ["three"]=> + int(3) +} +int(6) +array(6) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["One"]=> + int(10) + ["two"]=> + int(20) + ["three"]=> + int(3) +} +Done diff --git a/ext/standard/tests/array/array_unshift_variation4.phpt b/ext/standard/tests/array/array_unshift_variation4.phpt new file mode 100644 index 0000000..25c9159 --- /dev/null +++ b/ext/standard/tests/array/array_unshift_variation4.phpt @@ -0,0 +1,390 @@ +--TEST-- +Test array_unshift() function : usage variations - assoc. array with diff. keys for 'array' argument +--FILE-- + "0"), + array(1 => "1"), + array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), + + // arrays with float keys +/*5*/ array(2.3333 => "float"), + array(1.2 => "f1", 3.33 => "f2", + 4.89999922839999 => "f3", + 33333333.333333 => "f4"), + + // arrays with string keys +/*7*/ array('\tHello' => 111, 're\td' => "color", + '\v\fworld' => 2.2, 'pen\n' => 33), + array("\tHello" => 111, "re\td" => "color", + "\v\fworld" => 2.2, "pen\n" => 33), + array("hello", $heredoc => "string"), // heredoc + + // array with object, unset variable and resource variable + array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), + + // array with mixed keys +/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, + $fp => 'resource', 133 => "int", 444.432 => "float", + @$unset_var => "unset", $heredoc => "heredoc") +); + +// loop through the various elements of $arrays to test array_unshift() +$iterator = 1; +foreach($arrays as $array) { + echo "-- Iteration $iterator --\n"; + + /* with default argument */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + $temp_array = $array; + var_dump( array_unshift($temp_array, $var) ); + + // dump the resulting array + var_dump($temp_array); + + /* with optional arguments */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + $temp_array = $array; + var_dump( array_unshift($temp_array, $var, "hello", 'world') ); + + // dump the resulting array + var_dump($temp_array); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unshift() : associative array with different keys *** + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d +-- Iteration 1 -- +int(1) +array(1) { + [0]=> + int(10) +} +int(3) +array(3) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" +} +-- Iteration 2 -- +int(2) +array(2) { + [0]=> + int(10) + [1]=> + string(1) "0" +} +int(4) +array(4) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + string(1) "0" +} +-- Iteration 3 -- +int(2) +array(2) { + [0]=> + int(10) + [1]=> + string(1) "1" +} +int(4) +array(4) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + string(1) "1" +} +-- Iteration 4 -- +int(5) +array(5) { + [0]=> + int(10) + [1]=> + string(1) "1" + [2]=> + string(1) "2" + [3]=> + string(1) "3" + [4]=> + string(1) "4" +} +int(7) +array(7) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + string(1) "1" + [4]=> + string(1) "2" + [5]=> + string(1) "3" + [6]=> + string(1) "4" +} +-- Iteration 5 -- +int(2) +array(2) { + [0]=> + int(10) + [1]=> + string(5) "float" +} +int(4) +array(4) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + string(5) "float" +} +-- Iteration 6 -- +int(5) +array(5) { + [0]=> + int(10) + [1]=> + string(2) "f1" + [2]=> + string(2) "f2" + [3]=> + string(2) "f3" + [4]=> + string(2) "f4" +} +int(7) +array(7) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + string(2) "f1" + [4]=> + string(2) "f2" + [5]=> + string(2) "f3" + [6]=> + string(2) "f4" +} +-- Iteration 7 -- +int(5) +array(5) { + [0]=> + int(10) + ["\tHello"]=> + int(111) + ["re\td"]=> + string(5) "color" + ["\v\fworld"]=> + float(2.2) + ["pen\n"]=> + int(33) +} +int(7) +array(7) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["\tHello"]=> + int(111) + ["re\td"]=> + string(5) "color" + ["\v\fworld"]=> + float(2.2) + ["pen\n"]=> + int(33) +} +-- Iteration 8 -- +int(5) +array(5) { + [0]=> + int(10) + [" Hello"]=> + int(111) + ["re d"]=> + string(5) "color" + [" world"]=> + float(2.2) + ["pen +"]=> + int(33) +} +int(7) +array(7) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [" Hello"]=> + int(111) + ["re d"]=> + string(5) "color" + [" world"]=> + float(2.2) + ["pen +"]=> + int(33) +} +-- Iteration 9 -- +int(3) +array(3) { + [0]=> + int(10) + [1]=> + string(5) "hello" + ["Hello world"]=> + string(6) "string" +} +int(5) +array(5) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + string(5) "hello" + ["Hello world"]=> + string(6) "string" +} +-- Iteration 10 -- +int(2) +array(2) { + [0]=> + int(10) + [""]=> + string(5) "hello" +} +int(4) +array(4) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [""]=> + string(5) "hello" +} +-- Iteration 11 -- +int(7) +array(7) { + [0]=> + int(10) + ["hello"]=> + int(1) + ["fruit"]=> + float(2.2) + [1]=> + string(3) "int" + [2]=> + string(5) "float" + [""]=> + string(5) "unset" + ["Hello world"]=> + string(7) "heredoc" +} +int(9) +array(9) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["hello"]=> + int(1) + ["fruit"]=> + float(2.2) + [3]=> + string(3) "int" + [4]=> + string(5) "float" + [""]=> + string(5) "unset" + ["Hello world"]=> + string(7) "heredoc" +} +Done diff --git a/ext/standard/tests/array/array_unshift_variation5.phpt b/ext/standard/tests/array/array_unshift_variation5.phpt new file mode 100644 index 0000000..7f08369 --- /dev/null +++ b/ext/standard/tests/array/array_unshift_variation5.phpt @@ -0,0 +1,398 @@ +--TEST-- +Test array_unshift() function : usage variations - assoc. array with diff values for 'array' argument +--INI-- +precision=12 +--FILE-- + 0), + array("1" => 1), + array("one" => 1, 'two' => 2, "three" => 3, 4 => 4), + + // arrays with float values +/*5*/ array("float" => 2.3333), + array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333333), + + // arrays with string values +/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), + array(1 => "hello", "heredoc" => $heredoc), + + // array with object, unset variable and resource variable + array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp), + + // array with mixed values +/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit", 'resource' => $fp, "int" => 133, "float" => 444.432, "unset" => @$unset_var, "heredoc" => $heredoc) +); + +// loop through the various elements of $arrays to test array_unshift() +$iterator = 1; +foreach($arrays as $array) { + echo "-- Iteration $iterator --\n"; + + /* with default argument */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + $temp_array = $array; + var_dump( array_unshift($temp_array, $var) ); + + // dump the resulting array + var_dump($temp_array); + + /* with optional arguments */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + $temp_array = $array; + var_dump( array_unshift($temp_array, $var, "hello", 'world') ); + + // dump the resulting array + var_dump($temp_array); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unshift() : associative array with different values *** +-- Iteration 1 -- +int(1) +array(1) { + [0]=> + int(10) +} +int(3) +array(3) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" +} +-- Iteration 2 -- +int(2) +array(2) { + [0]=> + int(10) + [1]=> + int(0) +} +int(4) +array(4) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + int(0) +} +-- Iteration 3 -- +int(2) +array(2) { + [0]=> + int(10) + [1]=> + int(1) +} +int(4) +array(4) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + int(1) +} +-- Iteration 4 -- +int(5) +array(5) { + [0]=> + int(10) + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + [1]=> + int(4) +} +int(7) +array(7) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + [3]=> + int(4) +} +-- Iteration 5 -- +int(2) +array(2) { + [0]=> + int(10) + ["float"]=> + float(2.3333) +} +int(4) +array(4) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["float"]=> + float(2.3333) +} +-- Iteration 6 -- +int(5) +array(5) { + [0]=> + int(10) + ["f1"]=> + float(1.2) + ["f2"]=> + float(3.33) + [1]=> + float(4.8999992284) + ["f4"]=> + float(33333333.3333) +} +int(7) +array(7) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f1"]=> + float(1.2) + ["f2"]=> + float(3.33) + [3]=> + float(4.8999992284) + ["f4"]=> + float(33333333.3333) +} +-- Iteration 7 -- +int(5) +array(5) { + [0]=> + int(10) + [1]=> + string(6) " Hello" + ["red"]=> + string(6) "col or" + [2]=> + string(7) " world" + [3]=> + string(4) "pen +" +} +int(7) +array(7) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + string(6) " Hello" + ["red"]=> + string(6) "col or" + [4]=> + string(7) " world" + [5]=> + string(4) "pen +" +} +-- Iteration 8 -- +int(5) +array(5) { + [0]=> + int(10) + [1]=> + string(7) "\tHello" + ["red"]=> + string(7) "col\tor" + [2]=> + string(9) "\v\fworld" + [3]=> + string(5) "pen\n" +} +int(7) +array(7) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + string(7) "\tHello" + ["red"]=> + string(7) "col\tor" + [4]=> + string(9) "\v\fworld" + [5]=> + string(5) "pen\n" +} +-- Iteration 9 -- +int(3) +array(3) { + [0]=> + int(10) + [1]=> + string(5) "hello" + ["heredoc"]=> + string(11) "Hello world" +} +int(5) +array(5) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + string(5) "hello" + ["heredoc"]=> + string(11) "Hello world" +} +-- Iteration 10 -- +int(4) +array(4) { + [0]=> + int(10) + [1]=> + object(classA)#%d (0) { + } + ["unset"]=> + NULL + ["resource"]=> + resource(%d) of type (stream) +} +int(6) +array(6) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + object(classA)#%d (0) { + } + ["unset"]=> + NULL + ["resource"]=> + resource(%d) of type (stream) +} +-- Iteration 11 -- +int(9) +array(9) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + object(classA)#%d (0) { + } + [3]=> + string(5) "fruit" + ["resource"]=> + resource(%d) of type (stream) + ["int"]=> + int(133) + ["float"]=> + float(444.432) + ["unset"]=> + NULL + ["heredoc"]=> + string(11) "Hello world" +} +int(11) +array(11) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + string(5) "hello" + [4]=> + object(classA)#%d (0) { + } + [5]=> + string(5) "fruit" + ["resource"]=> + resource(%d) of type (stream) + ["int"]=> + int(133) + ["float"]=> + float(444.432) + ["unset"]=> + NULL + ["heredoc"]=> + string(11) "Hello world" +} +Done diff --git a/ext/standard/tests/array/array_unshift_variation6.phpt b/ext/standard/tests/array/array_unshift_variation6.phpt new file mode 100644 index 0000000..47da53b --- /dev/null +++ b/ext/standard/tests/array/array_unshift_variation6.phpt @@ -0,0 +1,196 @@ +--TEST-- +Test array_unshift() function : usage variations - two dimensional arrays for 'array' argument +--FILE-- + 'red', 'item' => 'pen', 'place' => 'LA'), + + // numeric array + array(1, 2, 3, 4, 5), + + // combination of numeric and associative arrays + array('a' => 'green', 'red', 'brown', 33, 88, 'orange', 'item' => 'ball') +); + +/* Passing the entire $two_dimensional_array to $array */ + +/* With default argument */ +// returns element count in the resulting array after arguments are pushed to +// beginning of the given array +$temp_array = $two_dimensional_array; +var_dump( array_unshift($temp_array, $var) ); // whole 2-d array + +// dumps the resulting array +var_dump($temp_array); + +/* With optional arguments */ +// returns element count in the resulting array after arguments are pushed to +// beginning of the given array +$temp_array = $two_dimensional_array; +var_dump( array_unshift($temp_array, $var, "hello", 'world') ); // whole 2-d array + +// dumps the resulting array +var_dump($temp_array); + +/* Passing the sub-array within the $two_dimensional_array to $array argument */ + +/* With default argument */ +// returns element count in the resulting array after arguments are pushed to +// beginning of the given array +$temp_array = $two_dimensional_array[0]; +var_dump( array_unshift($temp_array, $var) ); // sub array + +// dumps the resulting array +var_dump($temp_array); + +/* With optional arguments */ +// returns element count in the resulting array after arguments are pushed to +// beginning of the given array +$temp_array = $two_dimensional_array[0]; +var_dump( array_unshift($temp_array, $var, "hello", 'world') ); // sub array + +// dumps the resulting array +var_dump($temp_array); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unshift() : two dimensional arrays for $array argument *** +int(4) +array(4) { + [0]=> + int(10) + [1]=> + array(3) { + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + ["place"]=> + string(2) "LA" + } + [2]=> + array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + } + [3]=> + array(7) { + ["a"]=> + string(5) "green" + [0]=> + string(3) "red" + [1]=> + string(5) "brown" + [2]=> + int(33) + [3]=> + int(88) + [4]=> + string(6) "orange" + ["item"]=> + string(4) "ball" + } +} +int(6) +array(6) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + [3]=> + array(3) { + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + ["place"]=> + string(2) "LA" + } + [4]=> + array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + } + [5]=> + array(7) { + ["a"]=> + string(5) "green" + [0]=> + string(3) "red" + [1]=> + string(5) "brown" + [2]=> + int(33) + [3]=> + int(88) + [4]=> + string(6) "orange" + ["item"]=> + string(4) "ball" + } +} +int(4) +array(4) { + [0]=> + int(10) + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + ["place"]=> + string(2) "LA" +} +int(6) +array(6) { + [0]=> + int(10) + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["color"]=> + string(3) "red" + ["item"]=> + string(3) "pen" + ["place"]=> + string(2) "LA" +} +Done diff --git a/ext/standard/tests/array/array_unshift_variation7.phpt b/ext/standard/tests/array/array_unshift_variation7.phpt new file mode 100644 index 0000000..9a94eca --- /dev/null +++ b/ext/standard/tests/array/array_unshift_variation7.phpt @@ -0,0 +1,216 @@ +--TEST-- +Test array_unshift() function : usage variations - double quoted strings for 'var' argument +--FILE-- + "first", "s" => 'second', 1, 2.222); + +// different variations of double quoted strings to be passed to $var argument +$vars = array ( + "\$ -> This represents the dollar sign. hello dollar!!!", + "\t\r\v The quick brown fo\fx jumped over the lazy dog", + "This is a text with special chars: \!\@\#\$\%\^\&\*\(\)\\", + "hello world\\t", + "This is \ta text in bold letters\r\s\malong with slashes\n : HELLO WORLD\t" +); + +// loop through the various elements of $arrays to test array_unshift() +$iterator = 1; +foreach($vars as $var) { + echo "-- Iteration $iterator --\n"; + $temp_array = $array; // assign $array to another temporary $temp_array + + /* with default argument */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + var_dump( array_unshift($temp_array, $var) ); + +// dump the resulting array + var_dump($temp_array); + + /* with optional arguments */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + $temp_array = $array; + var_dump( array_unshift($temp_array, $var, "hello", 'world') ); + + // dump the resulting array + var_dump($temp_array); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unshift() : double quoted strings for $var argument *** +-- Iteration 1 -- +int(5) +array(5) { + [0]=> + string(53) "$ -> This represents the dollar sign. hello dollar!!!" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(53) "$ -> This represents the dollar sign. hello dollar!!!" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 2 -- +int(5) +array(5) { + [0]=> + string(49) " The quick brown fo x jumped over the lazy dog" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(49) " The quick brown fo x jumped over the lazy dog" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 3 -- +int(5) +array(5) { + [0]=> + string(55) "This is a text with special chars: \!\@\#$\%\^\&\*\(\)\" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(55) "This is a text with special chars: \!\@\#$\%\^\&\*\(\)\" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 4 -- +int(5) +array(5) { + [0]=> + string(13) "hello world\t" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(13) "hello world\t" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 5 -- +int(5) +array(5) { + [0]=> + string(70) "This is a text in bold letters \s\malong with slashes + : HELLO WORLD " + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(70) "This is a text in bold letters \s\malong with slashes + : HELLO WORLD " + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +Done diff --git a/ext/standard/tests/array/array_unshift_variation8.phpt b/ext/standard/tests/array/array_unshift_variation8.phpt new file mode 100644 index 0000000..a64349c --- /dev/null +++ b/ext/standard/tests/array/array_unshift_variation8.phpt @@ -0,0 +1,214 @@ +--TEST-- +Test array_unshift() function : usage variations - single quoted strings for 'var' argument +--FILE-- + "first", "s" => 'second', 1, 2.222); + +// different variations of single quoted strings to be passed to $var argument +$vars = array ( + '\$ -> This represents the dollar sign. hello dollar!!!', + '\t\r\v The quick brown fo\fx jumped over the lazy dog', + 'This is a text with special chars: \!\@\#\$\%\^\&\*\(\)\\', + 'hello world\\t', + 'This is \ta text in bold letters\r\s\malong with slashes\n : HELLO WORLD\t' +); + +// loop through the various elements of $arrays to test array_unshift() +$iterator = 1; +foreach($vars as $var) { + echo "-- Iteration $iterator --\n"; + $temp_array = $array; // assign $array to another temporary $temp_array + + /* with default argument */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + var_dump( array_unshift($temp_array, $var) ); + + // dump the resulting array + var_dump($temp_array); + + /* with optional arguments */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + $temp_array = $array; + var_dump( array_unshift($temp_array, $var, "hello", 'world') ); + + // dump the resulting array + var_dump($temp_array); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unshift() : single quoted strings for $var argument *** +-- Iteration 1 -- +int(5) +array(5) { + [0]=> + string(54) "\$ -> This represents the dollar sign. hello dollar!!!" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(54) "\$ -> This represents the dollar sign. hello dollar!!!" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 2 -- +int(5) +array(5) { + [0]=> + string(53) "\t\r\v The quick brown fo\fx jumped over the lazy dog" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(53) "\t\r\v The quick brown fo\fx jumped over the lazy dog" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 3 -- +int(5) +array(5) { + [0]=> + string(56) "This is a text with special chars: \!\@\#\$\%\^\&\*\(\)\" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(56) "This is a text with special chars: \!\@\#\$\%\^\&\*\(\)\" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 4 -- +int(5) +array(5) { + [0]=> + string(13) "hello world\t" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(13) "hello world\t" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 5 -- +int(5) +array(5) { + [0]=> + string(74) "This is \ta text in bold letters\r\s\malong with slashes\n : HELLO WORLD\t" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(74) "This is \ta text in bold letters\r\s\malong with slashes\n : HELLO WORLD\t" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +Done diff --git a/ext/standard/tests/array/array_unshift_variation9.phpt b/ext/standard/tests/array/array_unshift_variation9.phpt new file mode 100644 index 0000000..a667e6d --- /dev/null +++ b/ext/standard/tests/array/array_unshift_variation9.phpt @@ -0,0 +1,309 @@ +--TEST-- +Test array_unshift() function : usage variations - heredoc strings for 'var' argument +--FILE-- +22 +2222 != 1111.\t 0000 = 0000\n +EOT; + +// heredoc with quote chars & slash +$quote_char_string = << "first", "s" => 'second', 1, 2.222); + +// different heredoc strings to be passed to $var argument +$vars = array( + $empty_string, + $blank_line, + $multiline_string, + $diff_whitespaces, + $numeric_string, + $quote_char_string +); + +// loop through the various elements of $arrays to test array_unshift() +$iterator = 1; +foreach($vars as $var) { + echo "-- Iteration $iterator --\n"; + $temp_array = $array; // assign $array to another temporary $temp_array + + /* with default argument */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + var_dump( array_unshift($temp_array, $var) ); + + // dump the resulting array + var_dump($temp_array); + + /* with all possible arguments */ + // returns element count in the resulting array after arguments are pushed to + // beginning of the given array + $temp_array = $array; + var_dump( array_unshift($temp_array, $var, "hello", 'world') ); + + // dump the resulting array + var_dump($temp_array); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_unshift() : heredoc strings for $var argument *** +-- Iteration 1 -- +int(5) +array(5) { + [0]=> + string(0) "" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(0) "" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 2 -- +int(5) +array(5) { + [0]=> + string(1) " +" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(1) " +" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 3 -- +int(5) +array(5) { + [0]=> + string(86) "hello world +The big brown fox jumped over; +the lazy dog +This is a double quoted string" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(86) "hello world +The big brown fox jumped over; +the lazy dog +This is a double quoted string" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 4 -- +int(5) +array(5) { + [0]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(88) "hello world +1111 != 2222 +heredoc +double quoted string. with different white spaces" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 5 -- +int(5) +array(5) { + [0]=> + string(44) "11 < 12. 123 >22 +2222 != 1111. 0000 = 0000 +" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(44) "11 < 12. 123 >22 +2222 != 1111. 0000 = 0000 +" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +-- Iteration 6 -- +int(5) +array(5) { + [0]=> + string(123) "This's a string with quotes: +"strings in double quote"; +'strings in single quote'; +this\line is single quoted /with\slashes" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [1]=> + int(1) + [2]=> + float(2.222) +} +int(7) +array(7) { + [0]=> + string(123) "This's a string with quotes: +"strings in double quote"; +'strings in single quote'; +this\line is single quoted /with\slashes" + [1]=> + string(5) "hello" + [2]=> + string(5) "world" + ["f"]=> + string(5) "first" + ["s"]=> + string(6) "second" + [3]=> + int(1) + [4]=> + float(2.222) +} +Done diff --git a/ext/standard/tests/array/array_user_key_compare.phpt b/ext/standard/tests/array/array_user_key_compare.phpt new file mode 100644 index 0000000..7f82f71 --- /dev/null +++ b/ext/standard/tests/array/array_user_key_compare.phpt @@ -0,0 +1,19 @@ +--TEST-- +Fix UMR in array_user_key_compare (MOPB24) +--FILE-- + 1, "B" => 1); + +function array_compare(&$key1, &$key2) + { + $GLOBALS['a'] = &$key2; + unset($key2); + return 1; + } + +uksort($arr, "array_compare"); +var_dump($a); + +?> +--EXPECTF-- +string(1) "A" diff --git a/ext/standard/tests/array/array_values.phpt b/ext/standard/tests/array/array_values.phpt new file mode 100644 index 0000000..e5e46ca Binary files /dev/null and b/ext/standard/tests/array/array_values.phpt differ diff --git a/ext/standard/tests/array/array_values_basic.phpt b/ext/standard/tests/array/array_values_basic.phpt new file mode 100644 index 0000000..9cbdf07 --- /dev/null +++ b/ext/standard/tests/array/array_values_basic.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test array_values() function : basic functionality +--FILE-- + 3, 10 => 'ten'); + +// Calling array_values() with all possible arguments +var_dump( array_values($input) ); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_values() : basic functionality *** +array(5) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + int(3) + [4]=> + string(3) "ten" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_values_error.phpt b/ext/standard/tests/array/array_values_error.phpt new file mode 100644 index 0000000..07d682c --- /dev/null +++ b/ext/standard/tests/array/array_values_error.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test array_values() function : error conditions - Pass incorrect number of functions +--FILE-- + + +--EXPECTF-- +*** Testing array_values() : error conditions *** + +-- Testing array_values() function with Zero arguments -- + +Warning: array_values() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing array_values() function with more than expected no. of arguments -- + +Warning: array_values() expects exactly 1 parameter, 2 given in %s on line %d +NULL +Done + diff --git a/ext/standard/tests/array/array_values_errors.phpt b/ext/standard/tests/array/array_values_errors.phpt new file mode 100644 index 0000000..c8133dd --- /dev/null +++ b/ext/standard/tests/array/array_values_errors.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_values() function (errors) +--INI-- +precision=14 +--FILE-- + expected +/* Invalid types */ +var_dump( array_values("") ); // Empty string +var_dump( array_values(100) ); // Integer +var_dump( array_values(new stdclass) ); // object + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing error conditions *** + +Warning: array_values() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: array_values() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: array_values() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_values() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_values() expects parameter 1 to be array, object given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_values_variation.phpt b/ext/standard/tests/array/array_values_variation.phpt new file mode 100644 index 0000000..15da1a6 --- /dev/null +++ b/ext/standard/tests/array/array_values_variation.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test array_values() function (variation) +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + $resource1, "b" => $resource2); +var_dump( array_values($arr_resource) ); + +echo "\n*** Testing array_values() with range checking ***\n"; +$arr_range = array( + 2147483647, + 2147483648, + -2147483647, + -2147483648, + -0, + 0, + -2147483649 +); +var_dump( array_values($arr_range) ); + +echo "\n*** Testing array_values() on an array created on the fly ***\n"; +var_dump( array_values(array(1,2,3)) ); +var_dump( array_values(array()) ); // null array + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing array_values() with resource type *** +array(2) { + [0]=> + resource(%d) of type (stream) + [1]=> + resource(%d) of type (stream) +} + +*** Testing array_values() with range checking *** +array(7) { + [0]=> + int(2147483647) + [1]=> + float(2147483648) + [2]=> + int(-2147483647) + [3]=> + float(-2147483648) + [4]=> + int(0) + [5]=> + int(0) + [6]=> + float(-2147483649) +} + +*** Testing array_values() on an array created on the fly *** +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(0) { +} +Done diff --git a/ext/standard/tests/array/array_values_variation1.phpt b/ext/standard/tests/array/array_values_variation1.phpt new file mode 100644 index 0000000..53d0b5a --- /dev/null +++ b/ext/standard/tests/array/array_values_variation1.phpt @@ -0,0 +1,224 @@ +--TEST-- +Test array_values() function : usage variations - Pass different data types as $input arg +--FILE-- + + +--EXPECTF-- +*** Testing array_values() : usage variations *** + +-- Iteration 1 -- + +Warning: array_values() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: array_values() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: array_values() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: array_values() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: array_values() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: array_values() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_values() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_values() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_values() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_values() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_values() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: array_values() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: array_values() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: array_values() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: array_values() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: array_values() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_values() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +array(0) { +} + +-- Iteration 19 -- + +Warning: array_values() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_values() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_values() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: array_values() expects parameter 1 to be array, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: array_values() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: array_values() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: array_values() expects parameter 1 to be array, resource given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_values_variation2.phpt b/ext/standard/tests/array/array_values_variation2.phpt new file mode 100644 index 0000000..c7e9ad3 --- /dev/null +++ b/ext/standard/tests/array/array_values_variation2.phpt @@ -0,0 +1,215 @@ +--TEST-- +Test array_values() function : usage variations - arrays of different data types +--FILE-- + array( + 0, + 1, + 12345, + -2345, + ), + + // float data +/*2*/ 'float' => array( + 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + ), + + // null data +/*3*/ 'null' => array( + NULL, + null, + ), + + // boolean data +/*4*/ 'bool' => array( + true, + false, + TRUE, + FALSE, + ), + + // empty data +/*5*/ 'empty string' => array( + "", + '', + ), + +/*6*/ 'empty array' => array( + ), + + // string data +/*7*/ 'string' => array( + "string", + 'string', + $heredoc, + ), + + // object data +/*8*/ 'object' => array( + new classA(), + ), + + // undefined data +/*9*/ 'undefined' => array( + @$undefined_var, + ), + + // unset data +/*10*/ 'unset' => array( + @$unset_var, + ), + + // resource variable +/*11*/ 'resource' => array( + $fp + ), +); + +// loop through each element of $inputs to check the behavior of array_values() +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator: $key data --\n"; + var_dump( array_values($input) ); + $iterator++; +}; + +fclose($fp); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_values() : usage variations *** + +-- Iteration 1: int data -- +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(12345) + [3]=> + int(-2345) +} + +-- Iteration 2: float data -- +array(5) { + [0]=> + float(10.5) + [1]=> + float(-10.5) + [2]=> + float(123456789000) + [3]=> + float(1.23456789E-9) + [4]=> + float(0.5) +} + +-- Iteration 3: null data -- +array(2) { + [0]=> + NULL + [1]=> + NULL +} + +-- Iteration 4: bool data -- +array(4) { + [0]=> + bool(true) + [1]=> + bool(false) + [2]=> + bool(true) + [3]=> + bool(false) +} + +-- Iteration 5: empty string data -- +array(2) { + [0]=> + string(0) "" + [1]=> + string(0) "" +} + +-- Iteration 6: empty array data -- +array(0) { +} + +-- Iteration 7: string data -- +array(3) { + [0]=> + string(6) "string" + [1]=> + string(6) "string" + [2]=> + string(11) "hello world" +} + +-- Iteration 8: object data -- +array(1) { + [0]=> + object(classA)#%d (0) { + } +} + +-- Iteration 9: undefined data -- +array(1) { + [0]=> + NULL +} + +-- Iteration 10: unset data -- +array(1) { + [0]=> + NULL +} + +-- Iteration 11: resource data -- +array(1) { + [0]=> + resource(%d) of type (stream) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_values_variation3.phpt b/ext/standard/tests/array/array_values_variation3.phpt new file mode 100644 index 0000000..5c74c0d --- /dev/null +++ b/ext/standard/tests/array/array_values_variation3.phpt @@ -0,0 +1,200 @@ +--TEST-- +Test array_values() function : usage variations - array keys different data types +--FILE-- + array( + 0 => 'zero', + 1 => 'one', + 12345 => 'positive', + -2345 => 'negative', + ), + + // float data +/*2*/ 'float' => array( + 10.5 => 'positive', + -10.5 => 'negative', + .5 => 'half', + ), + +/*3*/ 'extreme floats' => array( + 12.3456789000e10 => 'large', + 12.3456789000E-10 => 'small', + ), + + // null data +/*4*/ 'null uppercase' => array( + NULL => 'null 1', + ), + +/*5*/ 'null lowercase' => array( + null => 'null 2', + ), + + // boolean data +/*6*/ 'bool lowercase' => array( + true => 'lowert', + false => 'lowerf', + ), + +/*7*/ 'bool uppercase' => array( + TRUE => 'uppert', + FALSE => 'upperf', + ), + + // empty data +/*8*/ 'empty double quotes' => array( + "" => 'emptyd', + ), + +/*9*/ 'empty single quotes' => array( + '' => 'emptys', + ), + + // string data +/*10*/ 'string' => array( + "stringd" => 'stringd', + 'strings' => 'strings', + $heredoc => 'stringh', + ), + + // undefined data +/*11*/ 'undefined' => array( + @$undefined_var => 'undefined', + ), + + // unset data +/*12*/ 'unset' => array( + @$unset_var => 'unset', + ), +); + +// loop through each element of $inputs to check the behavior of array_values() +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator: $key data --\n"; + var_dump( array_values($input) ); + $iterator++; +}; +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_values() : usage variations *** + +-- Iteration 1: int data -- +array(4) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + string(8) "positive" + [3]=> + string(8) "negative" +} + +-- Iteration 2: float data -- +array(3) { + [0]=> + string(8) "positive" + [1]=> + string(8) "negative" + [2]=> + string(4) "half" +} + +-- Iteration 3: extreme floats data -- +array(2) { + [0]=> + string(5) "large" + [1]=> + string(5) "small" +} + +-- Iteration 4: null uppercase data -- +array(1) { + [0]=> + string(6) "null 1" +} + +-- Iteration 5: null lowercase data -- +array(1) { + [0]=> + string(6) "null 2" +} + +-- Iteration 6: bool lowercase data -- +array(2) { + [0]=> + string(6) "lowert" + [1]=> + string(6) "lowerf" +} + +-- Iteration 7: bool uppercase data -- +array(2) { + [0]=> + string(6) "uppert" + [1]=> + string(6) "upperf" +} + +-- Iteration 8: empty double quotes data -- +array(1) { + [0]=> + string(6) "emptyd" +} + +-- Iteration 9: empty single quotes data -- +array(1) { + [0]=> + string(6) "emptys" +} + +-- Iteration 10: string data -- +array(3) { + [0]=> + string(7) "stringd" + [1]=> + string(7) "strings" + [2]=> + string(7) "stringh" +} + +-- Iteration 11: undefined data -- +array(1) { + [0]=> + string(9) "undefined" +} + +-- Iteration 12: unset data -- +array(1) { + [0]=> + string(5) "unset" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_values_variation4.phpt b/ext/standard/tests/array/array_values_variation4.phpt new file mode 100644 index 0000000..9c35331 --- /dev/null +++ b/ext/standard/tests/array/array_values_variation4.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test array_values() function : usage variations - multi-dimensional arrays +--FILE-- + 'zero', 'un' => 'one', 'sub' => array (1, 2, 3)); + +echo "\n-- Array values of a two-dimensional array --\n"; +var_dump(array_values($input)); + +echo "\n-- Array values of a sub-array --\n"; +var_dump(array_values($input['sub'])); + +// get an infinitely recursive array +$input[] = &$input; +echo "\n-- Array values of an infinitely recursive array --\n"; +var_dump(array_values($input)); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_values() : usage variations *** + +-- Array values of a two-dimensional array -- +array(3) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} + +-- Array values of a sub-array -- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} + +-- Array values of an infinitely recursive array -- +array(4) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [3]=> + &array(4) { + ["zero"]=> + string(4) "zero" + ["un"]=> + string(3) "one" + ["sub"]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [0]=> + *RECURSION* + } +} +Done diff --git a/ext/standard/tests/array/array_values_variation5.phpt b/ext/standard/tests/array/array_values_variation5.phpt new file mode 100644 index 0000000..d65b467 --- /dev/null +++ b/ext/standard/tests/array/array_values_variation5.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test array_values() function : usage variations - internal array pointer +--FILE-- + 'un', 'two' => 'deux', 'three' => 'trois'); + +echo "\n-- Call array_values() --\n"; +var_dump($result = array_values($input)); + +echo "-- Position of Internal Pointer in Result: --\n"; +echo key($result) . " => " . current($result) . "\n"; +echo "\n-- Position of Internal Pointer in Original Array: --\n"; +echo key($input) . " => " . current ($input) . "\n"; + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_values() : usage variations *** + +-- Call array_values() -- +array(3) { + [0]=> + string(2) "un" + [1]=> + string(4) "deux" + [2]=> + string(5) "trois" +} +-- Position of Internal Pointer in Result: -- +0 => un + +-- Position of Internal Pointer in Original Array: -- +one => un +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_values_variation6.phpt b/ext/standard/tests/array/array_values_variation6.phpt new file mode 100644 index 0000000..8c4479c --- /dev/null +++ b/ext/standard/tests/array/array_values_variation6.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test array_values() function : usage variations - Referenced variables +--FILE-- + + +--EXPECTF-- +*** Testing array_values() : usage variations *** + +-- $input is an array made up of referenced variables: -- +array(3) { + [0]=> + &string(3) "one" + [1]=> + &string(3) "two" + [2]=> + &string(5) "three" +} +Change $val2 and check result of array_values(): +array(3) { + [0]=> + &string(3) "one" + [1]=> + &string(4) "deux" + [2]=> + &string(5) "three" +} +Done diff --git a/ext/standard/tests/array/array_values_variation7.phpt b/ext/standard/tests/array/array_values_variation7.phpt new file mode 100644 index 0000000..b713064 --- /dev/null +++ b/ext/standard/tests/array/array_values_variation7.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test array_values() function : usage variations - Internal order check +--FILE-- + 'three', 2 => 'two', 1 => 'one', 0 => 'zero'); + +echo "\n-- \$input argument: --\n"; +var_dump($input); + +echo "\n-- Result of array_values() --\n"; +var_dump(array_values($input)); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_values() : usage variations *** + +-- $input argument: -- +array(4) { + [3]=> + string(5) "three" + [2]=> + string(3) "two" + [1]=> + string(3) "one" + [0]=> + string(4) "zero" +} + +-- Result of array_values() -- +array(4) { + [0]=> + string(5) "three" + [1]=> + string(3) "two" + [2]=> + string(3) "one" + [3]=> + string(4) "zero" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_values_variation_64bit.phpt b/ext/standard/tests/array/array_values_variation_64bit.phpt new file mode 100644 index 0000000..8b1e2c0 --- /dev/null +++ b/ext/standard/tests/array/array_values_variation_64bit.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test array_values() function +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + $resource1, "b" => $resource2); +var_dump( array_values($arr_resource) ); + +echo "\n*** Testing array_values() with range checking ***\n"; +$arr_range = array( + 2147483647, + 2147483648, + -2147483647, + -2147483648, + -0, + 0, + -2147483649 +); +var_dump( array_values($arr_range) ); + +echo "\n*** Testing array_values() on an array created on the fly ***\n"; +var_dump( array_values(array(1,2,3)) ); +var_dump( array_values(array()) ); // null array + +?> +--EXPECTF-- +*** Testing array_values() with resource type *** +array(2) { + [0]=> + resource(%d) of type (stream) + [1]=> + resource(%d) of type (stream) +} + +*** Testing array_values() with range checking *** +array(7) { + [0]=> + int(2147483647) + [1]=> + int(2147483648) + [2]=> + int(-2147483647) + [3]=> + int(-2147483648) + [4]=> + int(0) + [5]=> + int(0) + [6]=> + int(-2147483649) +} + +*** Testing array_values() on an array created on the fly *** +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(0) { +} diff --git a/ext/standard/tests/array/array_walk.phpt b/ext/standard/tests/array/array_walk.phpt new file mode 100644 index 0000000..35ef02e --- /dev/null +++ b/ext/standard/tests/array/array_walk.phpt @@ -0,0 +1,50 @@ +--TEST-- +array_walk() tests +--FILE-- +getMessage()); +} + +echo "Done\n"; +?> +--EXPECTF-- +Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL +int(1) +int(0) +string(4) "data" +int(2) +int(1) +string(4) "data" +bool(true) +string(4) "data" +Done diff --git a/ext/standard/tests/array/array_walk_basic1.phpt b/ext/standard/tests/array/array_walk_basic1.phpt new file mode 100644 index 0000000..e4bdf1b --- /dev/null +++ b/ext/standard/tests/array/array_walk_basic1.phpt @@ -0,0 +1,80 @@ +--TEST-- +Test array_walk() function : basic functionality - regular array +--FILE-- + +--EXPECT-- +*** Testing array_walk() : basic functionality *** +-- Using array_walk() with default parameters to show array contents -- +string(5) "lemon" +int(0) + +string(6) "orange" +int(1) + +string(6) "banana" +int(2) + +string(5) "apple" +int(3) + +bool(true) +-- Using array_walk() with all parameters -- +string(5) "lemon" +int(0) +string(5) "Added" + +string(6) "orange" +int(1) +string(5) "Added" + +string(6) "banana" +int(2) +string(5) "Added" + +string(5) "apple" +int(3) +string(5) "Added" + +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_basic2.phpt b/ext/standard/tests/array/array_walk_basic2.phpt new file mode 100644 index 0000000..e856b58 --- /dev/null +++ b/ext/standard/tests/array/array_walk_basic2.phpt @@ -0,0 +1,105 @@ +--TEST-- +Test array_walk() function : basic functionality - associative array +--FILE-- + "lemon", "a" => "orange", "b" => "banana", "c" => "apple"); + +// User defined callback functions +/* Prototype : test_alter(mixed $item, mixed $key, string $prefix) + * Parameters : item - value in key/value pair + * key - key in key/value pair + * prefix - string to be added + * Description : alters the array values by appending prefix string + */ +function test_alter(&$item, $key, $prefix) +{ + // dump the arguments to check that they are passed + // with proper type + var_dump($item); // value + var_dump($key); // key + var_dump($prefix); // additional agument passed to callback function + echo "\n"; // new line to separate the output between each element +} + +/* Prototype : test_print(mixed $item, mixed $key) + * Parameters : item - value in key/value pair + * key - key in key/value pair + * Description : prints the array values with keys + */ +function test_print($item, $key) +{ + // dump the arguments to check that they are passed + // with proper type + var_dump($item); // value + var_dump($key); // key + echo "\n"; // new line to separate the output between each element +} + +echo "-- Using array_walk with default parameters to show array contents --\n"; +var_dump(array_walk($fruits, 'test_print')); + +echo "-- Using array_walk with one optional parameter to modify contents --\n"; +var_dump (array_walk($fruits, 'test_alter', 'fruit')); + +echo "-- Using array_walk with default parameters to show modified array contents --\n"; +var_dump (array_walk($fruits, 'test_print')); + +echo "Done"; +?> +--EXPECT-- +*** Testing array_walk() : basic functionality *** +-- Using array_walk with default parameters to show array contents -- +string(5) "lemon" +string(1) "d" + +string(6) "orange" +string(1) "a" + +string(6) "banana" +string(1) "b" + +string(5) "apple" +string(1) "c" + +bool(true) +-- Using array_walk with one optional parameter to modify contents -- +string(5) "lemon" +string(1) "d" +string(5) "fruit" + +string(6) "orange" +string(1) "a" +string(5) "fruit" + +string(6) "banana" +string(1) "b" +string(5) "fruit" + +string(5) "apple" +string(1) "c" +string(5) "fruit" + +bool(true) +-- Using array_walk with default parameters to show modified array contents -- +string(5) "lemon" +string(1) "d" + +string(6) "orange" +string(1) "a" + +string(6) "banana" +string(1) "b" + +string(5) "apple" +string(1) "c" + +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_error1.phpt b/ext/standard/tests/array/array_walk_error1.phpt new file mode 100644 index 0000000..334dfe4 --- /dev/null +++ b/ext/standard/tests/array/array_walk_error1.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test array_walk() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_walk() : error conditions *** +-- Testing array_walk() function with zero arguments -- + +Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d +NULL +-- Testing array_walk() function with one argument -- + +Warning: array_walk() expects at least 2 parameters, 1 given in %s on line %d +NULL +-- Testing array_walk() function with non existent callback function -- + +Warning: array_walk() expects parameter 2 to be a valid callback, function 'non_existent' not found or invalid function name in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_walk_error2.phpt b/ext/standard/tests/array/array_walk_error2.phpt new file mode 100644 index 0000000..654637a --- /dev/null +++ b/ext/standard/tests/array/array_walk_error2.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test array_walk() function : error conditions - callback parameters +--FILE-- + +--EXPECTF-- +*** Testing array_walk() : error conditions - callback parameters *** + +Warning: Missing argument 3 for callback1() in %s on line %d + +callback1() invoked +bool(true) + +Warning: Missing argument 4 for callback2() in %s on line %d + +callback2() invoked +bool(true) + +callback1() invoked +bool(true) + +callback2() invoked +bool(true) +-- Testing array_walk() function with too many callback parameters -- + +Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_walk_object1.phpt b/ext/standard/tests/array/array_walk_object1.phpt new file mode 100644 index 0000000..342e760 --- /dev/null +++ b/ext/standard/tests/array/array_walk_object1.phpt @@ -0,0 +1,67 @@ +--TEST-- +Test array_walk() function : object functionality +--FILE-- +pri_value = $setVal; + $this->pub_value = $setVal; + $this->pro_value = $setVal; + } +}; + +// object for 'input' argument +$input = new MyClass(10); + +var_dump( array_walk($input, "callback", 1)); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_walk() : object functionality *** +%unicode|string%(18) "%r\0%rMyClass%r\0%rpri_value" +int(10) +int(1) + +%unicode|string%(9) "pub_value" +int(10) +int(1) + +%unicode|string%(12) "%r\0%r*%r\0%rpro_value" +int(10) +int(1) + +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_object2.phpt b/ext/standard/tests/array/array_walk_object2.phpt new file mode 100644 index 0000000..61d0529 --- /dev/null +++ b/ext/standard/tests/array/array_walk_object2.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test array_walk() function : object functionality - array of objects +--FILE-- +getValue()); + echo "key : "; + var_dump($key); +} + +function callback_public($value, $key) +{ + echo "value : "; + var_dump($value->pub_value); +} +function callback_protected($value, $key) +{ + echo "value : "; + var_dump($value->get_pro_value()); +} + +class MyClass +{ + private $pri_value; + public $pub_value; + protected $pro_value; + public function __construct($setVal) + { + $this->pri_value = $setVal; + $this->pub_value = $setVal; + $this->pro_value = $setVal; + } + public function getValue() + { + return $this->pri_value; + } + public function get_pro_value() + { + return $this->pro_value; + } +}; + +// array containing objects of MyClass +$input = array ( + new MyClass(3), + new MyClass(10), + new MyClass(20), + new MyClass(-10) +); + +echo "-- For private member --\n"; +var_dump( array_walk($input, "callback_private", 1)); +echo "-- For public member --\n"; +var_dump( array_walk($input, "callback_public")); +echo "-- For protected member --\n"; +var_dump( array_walk($input, "callback_protected")); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_walk() : array of objects *** +-- For private member -- +value : int(3) +key : int(0) +value : int(10) +key : int(1) +value : int(20) +key : int(2) +value : int(-10) +key : int(3) +bool(true) +-- For public member -- +value : int(3) +value : int(10) +value : int(20) +value : int(-10) +bool(true) +-- For protected member -- +value : int(3) +value : int(10) +value : int(20) +value : int(-10) +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_objects.phpt b/ext/standard/tests/array/array_walk_objects.phpt new file mode 100644 index 0000000..506d1ca --- /dev/null +++ b/ext/standard/tests/array/array_walk_objects.phpt @@ -0,0 +1,44 @@ +--TEST-- +array_walk() and objects +--FILE-- +foo = "foo"; +$stdclass->bar = "bar"; +array_walk($stdclass, "walk"); + +$t = new test; +array_walk($t, "walk"); + +$var = array(); +array_walk($var, "walk"); +$var = ""; +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" + +Warning: array_walk() expects parameter 1 to be array, %unicode_string_optional% 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 new file mode 100644 index 0000000..bbd30f3 --- /dev/null +++ b/ext/standard/tests/array/array_walk_rec_objects.phpt @@ -0,0 +1,44 @@ +--TEST-- +array_walk_recursive() and objects +--FILE-- +foo = "foo"; +$stdclass->bar = "bar"; +array_walk_recursive($stdclass, "walk"); + +$t = new test; +array_walk_recursive($t, "walk"); + +$var = array(); +array_walk_recursive($var, "walk"); +$var = ""; +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" + +Warning: array_walk_recursive() expects parameter 1 to be array, %unicode_string_optional% given in %s on line %d +Done diff --git a/ext/standard/tests/array/array_walk_recursive.phpt b/ext/standard/tests/array/array_walk_recursive.phpt new file mode 100644 index 0000000..c3b37c3 --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test array_walk_recursive() +--FILE-- + +--EXPECTF-- +1 foo +2 foo +3 foo +bool(true) +1 bar +2 bar +3 bar +bool(true) diff --git a/ext/standard/tests/array/array_walk_recursive1.phpt b/ext/standard/tests/array/array_walk_recursive1.phpt new file mode 100644 index 0000000..65939d5 --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive1.phpt @@ -0,0 +1,56 @@ +--TEST-- +array_walk_recursive() tests +--FILE-- +getMessage()); +} + +echo "Done\n"; +?> +--EXPECTF-- +Warning: array_walk_recursive() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL +int(1) +int(0) +string(4) "data" +int(2) +int(1) +string(4) "data" +int(2) +int(0) +string(4) "data" +int(3) +int(1) +string(4) "data" +bool(true) +string(4) "data" +Done diff --git a/ext/standard/tests/array/array_walk_recursive_basic1.phpt b/ext/standard/tests/array/array_walk_recursive_basic1.phpt new file mode 100644 index 0000000..df192b6 --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_basic1.phpt @@ -0,0 +1,80 @@ +--TEST-- +Test array_walk_recursive() function : basic functionality - regular array +--FILE-- + +--EXPECT-- +*** Testing array_walk_recursive() : basic functionality *** +-- Using array_walk_recursive() with default parameters to show array contents -- +string(5) "lemon" +int(0) + +string(6) "orange" +int(0) + +string(6) "banana" +int(1) + +string(5) "apple" +int(0) + +bool(true) +-- Using array_walk_recursive() with all parameters -- +string(5) "lemon" +int(0) +string(5) "Added" + +string(6) "orange" +int(0) +string(5) "Added" + +string(6) "banana" +int(1) +string(5) "Added" + +string(5) "apple" +int(0) +string(5) "Added" + +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_recursive_basic2.phpt b/ext/standard/tests/array/array_walk_recursive_basic2.phpt new file mode 100644 index 0000000..c71d92b --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_basic2.phpt @@ -0,0 +1,105 @@ +--TEST-- +Test array_walk_recursive() function : basic functionality - associative array +--FILE-- + "lemon", "b" => array( "c" => "orange", "d" => "banana"), "e" => array("f" => "apple")); + +// User defined callback functions +/* Prototype : test_alter(mixed $item, mixed $key, string $prefix) + * Parameters : item - value in key/value pair + * key - key in key/value pair + * prefix - string to be added + * Description : alters the array values by appending prefix string + */ +function test_alter(&$item, $key, $prefix) +{ + // dump the arguments to check that they are passed + // with proper type + var_dump($item); // value + var_dump($key); // key + var_dump($prefix); // additional agument passed to callback function + echo "\n"; // new line to separate the output between each element +} + +/* Prototype : test_print(mixed $item, mixed $key) + * Parameters : item - value in key/value pair + * key - key in key/value pair + * Description : prints the array values with keys + */ +function test_print($item, $key) +{ + // dump the arguments to check that they are passed + // with proper type + var_dump($item); // value + var_dump($key); // key + echo "\n"; // new line to separate the output between each element +} + +echo "-- Using array_walk_recursive with default parameters to show array contents --\n"; +var_dump(array_walk_recursive($fruits, 'test_print')); + +echo "-- Using array_walk_recursive with one optional parameter to modify contents --\n"; +var_dump (array_walk_recursive($fruits, 'test_alter', 'fruit')); + +echo "-- Using array_walk_recursive with default parameters to show modified array contents --\n"; +var_dump (array_walk_recursive($fruits, 'test_print')); + +echo "Done"; +?> +--EXPECT-- +*** Testing array_walk_recursive() : basic functionality *** +-- Using array_walk_recursive with default parameters to show array contents -- +string(5) "lemon" +string(1) "a" + +string(6) "orange" +string(1) "c" + +string(6) "banana" +string(1) "d" + +string(5) "apple" +string(1) "f" + +bool(true) +-- Using array_walk_recursive with one optional parameter to modify contents -- +string(5) "lemon" +string(1) "a" +string(5) "fruit" + +string(6) "orange" +string(1) "c" +string(5) "fruit" + +string(6) "banana" +string(1) "d" +string(5) "fruit" + +string(5) "apple" +string(1) "f" +string(5) "fruit" + +bool(true) +-- Using array_walk_recursive with default parameters to show modified array contents -- +string(5) "lemon" +string(1) "a" + +string(6) "orange" +string(1) "c" + +string(6) "banana" +string(1) "d" + +string(5) "apple" +string(1) "f" + +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_recursive_error1.phpt b/ext/standard/tests/array/array_walk_recursive_error1.phpt new file mode 100644 index 0000000..75966e8 --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_error1.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test array_walk_recursive() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_walk_recursive() : error conditions *** +-- Testing array_walk_recursive() function with zero arguments -- + +Warning: array_walk_recursive() expects at least 2 parameters, 0 given in %s on line %d +NULL +-- Testing array_walk_recursive() function with one argument -- + +Warning: array_walk_recursive() expects at least 2 parameters, 1 given in %s on line %d +NULL +-- Testing array_walk_recursive() function with non existent callback function -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function 'non_existent' not found or invalid function name in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_walk_recursive_error2.phpt b/ext/standard/tests/array/array_walk_recursive_error2.phpt new file mode 100644 index 0000000..d628e93 --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_error2.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test array_walk_recursive() function : error conditions - callback parameters +--FILE-- + +--EXPECTF-- +*** Testing array_walk_recursive() : error conditions - callback parameters *** + +Warning: Missing argument 3 for callback1() in %s on line %d + +callback1() invoked +bool(true) + +Warning: Missing argument 4 for callback2() in %s on line %d + +callback2() invoked +bool(true) + +callback1() invoked +bool(true) + +callback2() invoked +bool(true) +-- Testing array_walk_recursive() function with too many callback parameters -- + +Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_walk_recursive_object1.phpt b/ext/standard/tests/array/array_walk_recursive_object1.phpt new file mode 100644 index 0000000..7ddced7 --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_object1.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test array_walk_recursive() function : object functionality +--FILE-- +pri_value = $setVal; + $this->pub_value = $setVal; + $this->pro_value = $setVal; + } +}; + +// object for 'input' argument +$input = new MyClass(10); + +var_dump( array_walk_recursive($input, "callback", 1)); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_walk_recursive() : object functionality *** +%unicode|string%(18) "%r\0%rMyClass%r\0%rpri_value" +int(10) +int(1) + +%unicode|string%(9) "pub_value" +int(10) +int(1) + +%unicode|string%(12) "%r\0%r*%r\0%rpro_value" +int(10) +int(1) + +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_recursive_object2.phpt b/ext/standard/tests/array/array_walk_recursive_object2.phpt new file mode 100644 index 0000000..aa12fe8 --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_object2.phpt @@ -0,0 +1,106 @@ +--TEST-- +Test array_walk_recursive() function : object functionality - array of objects +--FILE-- +getValue()); + echo "key : "; + var_dump($key); +} + +function callback_public($value, $key) +{ + echo "value : "; + var_dump($value->pub_value); +} +function callback_protected($value, $key) +{ + echo "value : "; + var_dump($value->get_pro_value()); +} + +class MyClass +{ + private $pri_value; + public $pub_value; + protected $pro_value; + public function __construct($setVal) + { + $this->pri_value = $setVal; + $this->pub_value = $setVal; + $this->pro_value = $setVal; + } + public function getValue() + { + return $this->pri_value; + } + public function get_pro_value() + { + return $this->pro_value; + } +}; + +// array containing objects of MyClass +$input = array ( + array( + new MyClass(3), + new MyClass(10), + ), + new MyClass(20), + array(new MyClass(-10)) +); + +echo "-- For private member --\n"; +var_dump( array_walk_recursive($input, "callback_private", 1)); +echo "-- For public member --\n"; +var_dump( array_walk_recursive($input, "callback_public")); +echo "-- For protected member --\n"; +var_dump( array_walk_recursive($input, "callback_protected")); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_walk_recursive() : array of objects *** +-- For private member -- +value : int(3) +key : int(0) +value : int(10) +key : int(1) +value : int(20) +key : int(1) +value : int(-10) +key : int(0) +bool(true) +-- For public member -- +value : int(3) +value : int(10) +value : int(20) +value : int(-10) +bool(true) +-- For protected member -- +value : int(3) +value : int(10) +value : int(20) +value : int(-10) +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation1.phpt b/ext/standard/tests/array/array_walk_recursive_variation1.phpt new file mode 100644 index 0000000..16044e2 --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_variation1.phpt @@ -0,0 +1,250 @@ +--TEST-- +Test array_walk_recursive() function : usage variations - unexpected values for 'input' argument +--FILE-- + +--EXPECTF-- +*** Testing array_walk_recursive() : unexpected values for 'input' argument *** +-- Iteration 1 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 2 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 3 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 4 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, resource given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, resource given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation2.phpt b/ext/standard/tests/array/array_walk_recursive_variation2.phpt new file mode 100644 index 0000000..bef44b5 --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_variation2.phpt @@ -0,0 +1,268 @@ +--TEST-- +Test array_walk_recursive() function : usage variations - unexpected values in place of 'funcname' argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data +/* 14*/ NULL, + null, + + // boolean data +/* 16*/ true, + false, + TRUE, + FALSE, + + // empty data +/* 20*/ "", + '', + + // object data + new MyClass(), + + // resource data +/* 23*/ $fp = fopen(__FILE__, 'r'), + + // undefined data + @$undefined_var, + + // unset data +/* 25*/ @$unset_var, +); + +for($count = 0; $count < count($funcname_values); $count++) { + echo "-- Iteration ".($count + 1)." --\n"; + var_dump( array_walk_recursive($input, $funcname_values[$count]) ); + var_dump( array_walk_recursive($input, $funcname_values[$count], $user_data )); +} + +fclose($fp); +echo "Done" +?> +--EXPECTF-- +*** Testing array_walk_recursive() : unexpected values for 'funcname' argument *** +-- Iteration 1 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 2 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 3 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 4 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL +-- Iteration 12 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL +-- Iteration 13 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL +-- Iteration 14 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL +-- Iteration 22 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 23 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 24 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 25 -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation3.phpt b/ext/standard/tests/array/array_walk_recursive_variation3.phpt new file mode 100644 index 0000000..9abdc0b --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_variation3.phpt @@ -0,0 +1,123 @@ +--TEST-- +Test array_walk_recursive() function : usage variations - 'input' array with different values +--FILE-- + +--EXPECTF-- +*** Testing array_walk_recursive() : 'input' array with different values*** + +-- Iteration 1 -- +1 : 0 1 +1 : 1 0 +1 : 2 -10 +1 : 0 19 +1 : 1 -33 +1 : 0 90 +1 : 1 31 +1 : 2 -110 +bool(true) + +-- Iteration 2 -- +2 : 0 3.4 +2 : 1 0.8 +2 : 2 -2.9 +2 : 0 625 +2 : 1 0.0082 +bool(true) + +-- Iteration 3 -- +3 : 0 Mango +3 : 0 Apple +3 : 1 Orange +3 : 2 Lemon +bool(true) + +-- Iteration 4 -- +4 : 0 1 +4 : 1 +4 : 0 1 +4 : 1 +bool(true) + +-- Iteration 5 -- +5 : 0 +5 : 0 +bool(true) + +-- Iteration 6 -- +bool(true) + +-- Iteration 7 -- +7 : 0 binary +bool(true) + +-- Iteration 8 -- +8 : 0 16 +8 : 1 8.345 +8 : 0 Fruits +8 : 0 1 +8 : 1 +8 : 0 +8 : 0 -98 +8 : 1 0.005 +8 : 2 banana +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation4.phpt b/ext/standard/tests/array/array_walk_recursive_variation4.phpt new file mode 100644 index 0000000..4db3497 --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_variation4.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test array_walk_recursive() function : usage variations - 'input' array with subarray +--FILE-- + +--EXPECTF-- +*** Testing array_walk_recursive() : array with subarray *** +int(0) +int(1) + +int(0) +int(1) + +int(1) +int(2) + +int(2) +int(3) + +int(0) +string(5) "Mango" + +int(1) +string(6) "Orange" + +int(0) +int(1) + +int(1) +int(2) + +int(2) +int(3) + +int(0) +int(1) + +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation5.phpt b/ext/standard/tests/array/array_walk_recursive_variation5.phpt new file mode 100644 index 0000000..688da57 --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_variation5.phpt @@ -0,0 +1,64 @@ +--TEST-- +Test array_walk_recursive() function : usage variations - 'input' argument containing reference variables +--FILE-- + +--EXPECTF-- +*** Testing array_walk_recursive() : array with references *** +int(0) +int(10) + +int(0) +int(-20) + +int(1) +int(-35) + +int(0) +int(10) + +int(1) +int(0) + +int(0) +int(50) + +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation6.phpt b/ext/standard/tests/array/array_walk_recursive_variation6.phpt new file mode 100644 index 0000000..747eb74 --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_variation6.phpt @@ -0,0 +1,147 @@ +--TEST-- +Test array_walk_recursive() function : usage variations - 'input' argument as diff. associative arrays +--FILE-- + array(1 => 25, 5 => 12, 0 => -80), 1 => array(-2 => 100, 5 => 30)); +echo "-- Associative array with numeric keys --\n"; +var_dump( array_walk_recursive($input, "for_numeric", 10)); + +// String keys +$input = array( "a" => "Apple", 'z' => array('b' => 'Bananna', "c" => "carrot"), 'x' => array('o' => "Orange")); +echo "-- Associative array with string keys --\n"; +var_dump( array_walk_recursive($input, "for_string")); + +// binary key +$input = array( b"a" => "Apple", b"b" => "Banana"); +echo "-- Associative array with binary keys --\n"; +var_dump( array_walk_recursive($input, "for_string")); + +// Mixed keys - numeric/string +$input = array( 0 => array(0 => 1, 1 => 2), "x" => array("a" => "Apple", "b" => "Banana"), 2 =>3); +echo "-- Associative array with numeric/string keys --\n"; +var_dump( array_walk_recursive($input, "for_mixed")); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_walk_recursive() : 'input' as an associative array *** +-- Associative array with numeric keys -- +int(1) +int(25) +int(10) + +int(5) +int(12) +int(10) + +int(0) +int(-80) +int(10) + +int(-2) +int(100) +int(10) + +int(5) +int(30) +int(10) + +bool(true) +-- Associative array with string keys -- +string(1) "a" +string(5) "Apple" + +string(1) "b" +string(7) "Bananna" + +string(1) "c" +string(6) "carrot" + +string(1) "o" +string(6) "Orange" + +bool(true) +-- Associative array with binary keys -- +string(1) "a" +string(5) "Apple" + +string(1) "b" +string(6) "Banana" + +bool(true) +-- Associative array with numeric/string keys -- +int(0) +int(1) + +int(1) +int(2) + +string(1) "a" +string(5) "Apple" + +string(1) "b" +string(6) "Banana" + +int(2) +int(3) + +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation7.phpt b/ext/standard/tests/array/array_walk_recursive_variation7.phpt new file mode 100644 index 0000000..0cdd6d2 --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_variation7.phpt @@ -0,0 +1,93 @@ +--TEST-- +Test array_walk_recursive() function : usage variations - anonymous callback function +--FILE-- + +--EXPECTF-- +*** Testing array_walk_recursive() : anonymous function as callback *** +-- Anonymous function with one argument -- +int(2) + +int(5) + +int(10) + +int(0) + +bool(true) +-- Anonymous function with two arguments -- +int(0) +int(2) + +int(1) +int(5) + +int(0) +int(10) + +int(1) +int(0) + +bool(true) +-- Anonymous function with three arguments -- +int(0) +int(2) +int(10) + +int(1) +int(5) +int(10) + +int(0) +int(10) +int(10) + +int(1) +int(0) +int(10) + +bool(true) +-- Anonymous function with one more argument -- + +Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d +NULL +-- Anonymous function with null argument -- +1 +1 +1 +1 +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation8.phpt b/ext/standard/tests/array/array_walk_recursive_variation8.phpt new file mode 100644 index 0000000..671fcdb --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_variation8.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test array_walk_recursive() function : usage variations - buit-in function as callback +--FILE-- + 1, 65), array(98, 100), array(6 => -4)); + +echo "-- With 'pow' built-in function --\n"; +var_dump( array_walk_recursive($input, 'pow')); + +echo "-- With 'min' built-in function --\n"; +var_dump( array_walk_recursive($input, "min")); + +echo "-- With 'echo' language construct --\n"; +var_dump( array_walk_recursive($input, "echo")); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_walk_recursive() : built-in function as callback *** +-- With 'pow' built-in function -- +bool(true) +-- With 'min' built-in function -- +bool(true) +-- With 'echo' language construct -- + +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation9.phpt b/ext/standard/tests/array/array_walk_recursive_variation9.phpt new file mode 100644 index 0000000..f18fe24 --- /dev/null +++ b/ext/standard/tests/array/array_walk_recursive_variation9.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test array_walk_recursive() function : usage variations - different callback functions +--FILE-- + +--EXPECTF-- +*** Testing array_walk_recursive() : callback function variation *** +-- callback function with both parameters -- +int(0) +string(5) "Apple" + +int(1) +string(6) "Banana" + +int(1) +string(5) "Mango" + +int(0) +string(6) "Orange" + +bool(true) +-- callback function with only one parameter -- +string(5) "Apple" + +string(6) "Banana" + +string(5) "Mango" + +string(6) "Orange" + +bool(true) +-- callback function without parameters -- +callback3() called +callback3() called +callback3() called +callback3() called +bool(true) +-- passing one more parameter to function with two parameters -- +int(0) +string(5) "Apple" + +int(1) +string(6) "Banana" + +int(1) +string(5) "Mango" + +int(0) +string(6) "Orange" + +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_variation1.phpt b/ext/standard/tests/array/array_walk_variation1.phpt new file mode 100644 index 0000000..d1c91bb --- /dev/null +++ b/ext/standard/tests/array/array_walk_variation1.phpt @@ -0,0 +1,250 @@ +--TEST-- +Test array_walk() function : usage variations - unexpected values for 'input' argument +--FILE-- + +--EXPECTF-- +*** Testing array_walk() : unexpected values for 'input' argument *** +-- Iteration 1 -- + +Warning: array_walk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 2 -- + +Warning: array_walk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 3 -- + +Warning: array_walk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 4 -- + +Warning: array_walk() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: array_walk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: array_walk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_walk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_walk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_walk() expects parameter 1 to be array, double given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: array_walk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: array_walk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: array_walk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: array_walk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_walk() expects parameter 1 to be array, resource given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, resource given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_walk_variation2.phpt b/ext/standard/tests/array/array_walk_variation2.phpt new file mode 100644 index 0000000..5cfee36 --- /dev/null +++ b/ext/standard/tests/array/array_walk_variation2.phpt @@ -0,0 +1,268 @@ +--TEST-- +Test array_walk() function : usage variations - unexpected values in place of 'funcname' argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data +/* 14*/ NULL, + null, + + // boolean data +/* 16*/ true, + false, + TRUE, + FALSE, + + // empty data +/* 20*/ "", + '', + + // object data + new MyClass(), + + // resource data +/* 23*/ $fp = fopen(__FILE__, 'r'), + + // undefined data + @$undefined_var, + + // unset data +/* 25*/ @$unset_var, +); + +for($count = 0; $count < count($funcname_values); $count++) { + echo "-- Iteration ".($count + 1)." --\n"; + var_dump( array_walk($input, $funcname_values[$count]) ); + var_dump( array_walk($input, $funcname_values[$count], $user_data )); +} + +fclose($fp); +echo "Done" +?> +--EXPECTF-- +*** Testing array_walk() : unexpected values for 'funcname' argument *** +-- Iteration 1 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 2 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 3 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 4 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL +-- Iteration 12 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL +-- Iteration 13 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL +-- Iteration 14 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL +-- Iteration 22 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 23 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 24 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 25 -- + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_walk_variation3.phpt b/ext/standard/tests/array/array_walk_variation3.phpt new file mode 100644 index 0000000..9ff7d5d --- /dev/null +++ b/ext/standard/tests/array/array_walk_variation3.phpt @@ -0,0 +1,123 @@ +--TEST-- +Test array_walk() function : usage variations - 'input' array with different values +--FILE-- + +--EXPECTF-- +*** Testing array_walk() : 'input' array with different values*** + +-- Iteration 1 -- +1 : 0 1 +1 : 1 0 +1 : 2 -10 +1 : 3 19 +1 : 4 -33 +1 : 5 90 +1 : 6 31 +1 : 7 -110 +bool(true) + +-- Iteration 2 -- +2 : 0 3.4 +2 : 1 0.8 +2 : 2 -2.9 +2 : 3 625 +2 : 4 0.0082 +bool(true) + +-- Iteration 3 -- +3 : 0 Mango +3 : 1 Apple +3 : 2 Orange +3 : 3 Lemon +bool(true) + +-- Iteration 4 -- +4 : 0 1 +4 : 1 +4 : 2 1 +4 : 3 +bool(true) + +-- Iteration 5 -- +5 : 0 +5 : 1 +bool(true) + +-- Iteration 6 -- +bool(true) + +-- Iteration 7 -- +7 : 0 binary +bool(true) + +-- Iteration 8 -- +8 : 0 16 +8 : 1 8.345 +8 : 2 Fruits +8 : 3 1 +8 : 4 +8 : 5 +8 : 6 -98 +8 : 7 0.005 +8 : 8 banana +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_variation4.phpt b/ext/standard/tests/array/array_walk_variation4.phpt new file mode 100644 index 0000000..868732d --- /dev/null +++ b/ext/standard/tests/array/array_walk_variation4.phpt @@ -0,0 +1,87 @@ +--TEST-- +Test array_walk() function : usage variations - 'input' array with subarray +--FILE-- + +--EXPECTF-- +*** Testing array_walk() : array with subarray *** +int(0) +array(0) { +} + +int(1) +array(1) { + [0]=> + int(1) +} + +int(2) +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} + +int(3) +array(2) { + [0]=> + string(5) "Mango" + [1]=> + string(6) "Orange" +} + +int(4) +array(1) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} + +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_variation5.phpt b/ext/standard/tests/array/array_walk_variation5.phpt new file mode 100644 index 0000000..b5d262a --- /dev/null +++ b/ext/standard/tests/array/array_walk_variation5.phpt @@ -0,0 +1,64 @@ +--TEST-- +Test array_walk() function : usage variations - 'input' argument containing reference variables +--FILE-- + +--EXPECTF-- +*** Testing array_walk() : array with references *** +int(0) +int(10) + +int(1) +int(-20) + +int(2) +int(-35) + +int(3) +int(10) + +int(4) +int(0) + +int(5) +int(50) + +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_variation6.phpt b/ext/standard/tests/array/array_walk_variation6.phpt new file mode 100644 index 0000000..c1f2323 --- /dev/null +++ b/ext/standard/tests/array/array_walk_variation6.phpt @@ -0,0 +1,143 @@ +--TEST-- +Test array_walk() function : usage variations - 'input' argument as diff. associative arrays +--FILE-- + 25, 5 => 12, 0 => -80, -2 => 100, 5 => 30); +echo "-- Associative array with numeric keys --\n"; +var_dump( array_walk($input, "for_numeric", 10)); + +// String keys +$input = array( "a" => "Apple", 'b' => 'Bananna', "c" => "carrot", 'o' => "Orange"); +echo "-- Associative array with string keys --\n"; +var_dump( array_walk($input, "for_string")); + +// binary keys +$input = array( b"a" => "Apple", b"b" => "Banana"); +echo "-- Associative array with binary keys --\n"; +var_dump( array_walk($input, "for_string")); + +// Mixed keys - numeric/string +$input = array( 0 => 1, 1 => 2, "a" => "Apple", "b" => "Banana", 2 =>3); +echo "-- Associative array with numeric/string keys --\n"; +var_dump( array_walk($input, "for_mixed")); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_walk() : 'input' as an associative array *** +-- Associative array with numeric keys -- +int(1) +int(25) +int(10) + +int(5) +int(30) +int(10) + +int(0) +int(-80) +int(10) + +int(-2) +int(100) +int(10) + +bool(true) +-- Associative array with string keys -- +string(1) "a" +string(5) "Apple" + +string(1) "b" +string(7) "Bananna" + +string(1) "c" +string(6) "carrot" + +string(1) "o" +string(6) "Orange" + +bool(true) +-- Associative array with binary keys -- +string(1) "a" +string(5) "Apple" + +string(1) "b" +string(6) "Banana" + +bool(true) +-- Associative array with numeric/string keys -- +int(0) +int(1) + +int(1) +int(2) + +string(1) "a" +string(5) "Apple" + +string(1) "b" +string(6) "Banana" + +int(2) +int(3) + +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_variation7.phpt b/ext/standard/tests/array/array_walk_variation7.phpt new file mode 100644 index 0000000..da85958 --- /dev/null +++ b/ext/standard/tests/array/array_walk_variation7.phpt @@ -0,0 +1,93 @@ +--TEST-- +Test array_walk() function : usage variations - anonymous callback function +--FILE-- + +--EXPECTF-- +*** Testing array_walk() : anonymous function as callback *** +-- Anonymous function with one argument -- +int(2) + +int(5) + +int(10) + +int(0) + +bool(true) +-- Anonymous function with two arguments -- +int(0) +int(2) + +int(1) +int(5) + +int(2) +int(10) + +int(3) +int(0) + +bool(true) +-- Anonymous function with three arguments -- +int(0) +int(2) +int(10) + +int(1) +int(5) +int(10) + +int(2) +int(10) +int(10) + +int(3) +int(0) +int(10) + +bool(true) +-- Anonymous function with one more argument -- + +Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d +NULL +-- Anonymous function with null argument -- +1 +1 +1 +1 +bool(true) +Done diff --git a/ext/standard/tests/array/array_walk_variation8.phpt b/ext/standard/tests/array/array_walk_variation8.phpt new file mode 100644 index 0000000..56a60e6 --- /dev/null +++ b/ext/standard/tests/array/array_walk_variation8.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test array_walk() function : usage variations - buit-in function as callback +--FILE-- + 1, 65, 98, 100, 6 => -4); + +echo "-- With 'pow' built-in function --\n"; +var_dump( array_walk($input, 'pow')); + +echo "-- With 'min' built-in function --\n"; +var_dump( array_walk($input, "min")); + +echo "-- With 'echo' language construct --\n"; +var_dump( array_walk($input, "echo")); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_walk() : built-in function as callback *** +-- With 'pow' built-in function -- +bool(true) +-- With 'min' built-in function -- +bool(true) +-- With 'echo' language construct -- + +Warning: array_walk() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_walk_variation9.phpt b/ext/standard/tests/array/array_walk_variation9.phpt new file mode 100644 index 0000000..3707784 --- /dev/null +++ b/ext/standard/tests/array/array_walk_variation9.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test array_walk() function : usage variations - different callback functions +--FILE-- + +--EXPECTF-- +*** Testing array_walk() : callback function variation *** +-- callback function with both parameters -- +int(0) +string(5) "Apple" + +int(1) +string(6) "Banana" + +int(2) +string(5) "Mango" + +int(3) +string(6) "Orange" + +bool(true) +-- callback function with only one parameter -- +string(5) "Apple" + +string(6) "Banana" + +string(5) "Mango" + +string(6) "Orange" + +bool(true) +-- callback function without parameters -- +callback3() called +callback3() called +callback3() called +callback3() called +bool(true) +-- passing one more parameter to function with two parameters -- +int(0) +string(5) "Apple" + +int(1) +string(6) "Banana" + +int(2) +string(5) "Mango" + +int(3) +string(6) "Orange" + +bool(true) +Done diff --git a/ext/standard/tests/array/arsort_basic.phpt b/ext/standard/tests/array/arsort_basic.phpt new file mode 100644 index 0000000..24799ab --- /dev/null +++ b/ext/standard/tests/array/arsort_basic.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test arsort() function : basic functionality +--FILE-- + "lemon", "o" => "orange", + "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", + "b" => "banana", +); +// an array containing unsorted numeric values with indices +$unsorted_numerics = array( 1 => 100, 2 => 33, 3 => 555, 4 => 22 ); + +echo "\n-- Testing arsort() by supplying string array, 'flag' value is default --\n"; +$temp_array = $unsorted_strings; +var_dump( arsort($temp_array) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying numeric array, 'flag' value is default --\n"; +$temp_array = $unsorted_numerics; +var_dump( arsort($temp_array) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying string array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $unsorted_strings; +var_dump( arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying numeric array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $unsorted_numerics; +var_dump( arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying string array, 'flag' = SORT_STRING --\n"; +$temp_array = $unsorted_strings; +var_dump( arsort($temp_array, SORT_STRING) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE --\n"; +$temp_array = $unsorted_strings; +var_dump( arsort($temp_array, SORT_STRING|SORT_FLAG_CASE) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying string array (natural), 'flag' = SORT_NATURAL --\n"; +$temp_array = $unsorted_strings; +var_dump( arsort($temp_array, SORT_NATURAL) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE --\n"; +$temp_array = $unsorted_strings; +var_dump( arsort($temp_array, SORT_NATURAL|SORT_FLAG_CASE) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n"; +$temp_array = $unsorted_numerics; +var_dump( arsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing arsort() : basic functionality *** + +-- Testing arsort() by supplying string array, 'flag' value is default -- +bool(true) +array(8) { + ["o20"]=> + string(8) "orange20" + ["o2"]=> + string(7) "orange2" + ["o"]=> + string(6) "orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" + ["O3"]=> + string(7) "Orange3" + ["O1"]=> + string(7) "Orange1" + ["O"]=> + string(6) "Orange" +} + +-- Testing arsort() by supplying numeric array, 'flag' value is default -- +bool(true) +array(4) { + [3]=> + int(555) + [1]=> + int(100) + [2]=> + int(33) + [4]=> + int(22) +} + +-- Testing arsort() by supplying string array, 'flag' = SORT_REGULAR -- +bool(true) +array(8) { + ["o20"]=> + string(8) "orange20" + ["o2"]=> + string(7) "orange2" + ["o"]=> + string(6) "orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" + ["O3"]=> + string(7) "Orange3" + ["O1"]=> + string(7) "Orange1" + ["O"]=> + string(6) "Orange" +} + +-- Testing arsort() by supplying numeric array, 'flag' = SORT_REGULAR -- +bool(true) +array(4) { + [3]=> + int(555) + [1]=> + int(100) + [2]=> + int(33) + [4]=> + int(22) +} + +-- Testing arsort() by supplying string array, 'flag' = SORT_STRING -- +bool(true) +array(8) { + ["o20"]=> + string(8) "orange20" + ["o2"]=> + string(7) "orange2" + ["o"]=> + string(6) "orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" + ["O3"]=> + string(7) "Orange3" + ["O1"]=> + string(7) "Orange1" + ["O"]=> + string(6) "Orange" +} + +-- Testing arsort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE -- +bool(true) +array(8) { + ["O3"]=> + string(7) "Orange3" + ["o20"]=> + string(8) "orange20" + ["o2"]=> + string(7) "orange2" + ["O1"]=> + string(7) "Orange1" + ["o"]=> + string(6) "orange" + ["O"]=> + string(6) "Orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" +} + +-- Testing arsort() by supplying string array (natural), 'flag' = SORT_NATURAL -- +bool(true) +array(8) { + ["o20"]=> + string(8) "orange20" + ["o2"]=> + string(7) "orange2" + ["o"]=> + string(6) "orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" + ["O3"]=> + string(7) "Orange3" + ["O1"]=> + string(7) "Orange1" + ["O"]=> + string(6) "Orange" +} + +-- Testing arsort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE -- +bool(true) +array(8) { + ["o20"]=> + string(8) "orange20" + ["O3"]=> + string(7) "Orange3" + ["o2"]=> + string(7) "orange2" + ["O1"]=> + string(7) "Orange1" + ["o"]=> + string(6) "orange" + ["O"]=> + string(6) "Orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" +} + +-- Testing arsort() by supplying numeric array, 'flag' = SORT_NUMERIC -- +bool(true) +array(4) { + [3]=> + int(555) + [1]=> + int(100) + [2]=> + int(33) + [4]=> + int(22) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_error.phpt b/ext/standard/tests/array/arsort_error.phpt new file mode 100644 index 0000000..676d826 --- /dev/null +++ b/ext/standard/tests/array/arsort_error.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test arsort() function : error conditions +--FILE-- + SORT_REGULAR, "SORT_STRING" => SORT_STRING, "SORT_NUMERIC" => SORT_NUMERIC); +$extra_arg = 10; + +// loop through $flag_value array and setting all possible flag values +foreach($flags as $key => $flag){ + echo "\nSort flag = $key\n"; + var_dump( arsort($array_arg,$flag, $extra_arg) ); + + // dump the input array to ensure that it wasn't changed + var_dump($array_arg); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing arsort() : error conditions *** + +-- Testing arsort() function with Zero arguments -- + +Warning: arsort() expects at least 1 parameter, 0 given in %sarsort_error.php on line %d +bool(false) + +-- Testing arsort() function with more than expected no. of arguments -- + +Sort flag = SORT_REGULAR + +Warning: arsort() expects at most 2 parameters, 3 given in %sarsort_error.php on line %d +bool(false) +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + +Sort flag = SORT_STRING + +Warning: arsort() expects at most 2 parameters, 3 given in %sarsort_error.php on line %d +bool(false) +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + +Sort flag = SORT_NUMERIC + +Warning: arsort() expects at most 2 parameters, 3 given in %sarsort_error.php on line %d +bool(false) +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_object1.phpt b/ext/standard/tests/array/arsort_object1.phpt new file mode 100644 index 0000000..8fd80f9 --- /dev/null +++ b/ext/standard/tests/array/arsort_object1.phpt @@ -0,0 +1,90 @@ +--TEST-- +Test arsort() function : object functionality - sort objects +--FILE-- +class_value = $value; + } + +} + +// class declaration for string objects +class for_string_arsort +{ + public $class_value; + // initializing object member value + function __construct($value){ + $this->class_value = $value; + } + + // return string value + function __tostring() { + return (string)$this->value; + } + +} + +// array of integer objects +$unsorted_int_obj = array ( + 1 => new for_integer_arsort(11), 2 => new for_integer_asort(66), + 3 => new for_integer_arsort(23), 4 => new for_integer_asort(-5), + 5 => new for_integer_arsort(0.001), 6 => new for_integer_asort(0) +); + +// array of string objects +$unsorted_str_obj = array ( + "a" => new for_string_arsort("axx"), "b" => new for_string_asort("t"), + "c" => new for_string_arsort("w"), "d" => new for_string_asort("py"), + "e" => new for_string_arsort("apple"), "f" => new for_string_asort("Orange"), + "g" => new for_string_arsort("Lemon"), "h" => new for_string_asort("aPPle") +); + + +echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is defualt --\n"; + +// testing arsort() function by supplying integer object array, flag value is defualt +$temp_array = $unsorted_int_obj; +var_dump(arsort($temp_array) ); +var_dump($temp_array); + +// testing arsort() function by supplying string object array, flag value is defualt +$temp_array = $unsorted_str_obj; +var_dump(arsort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n"; +// testing arsort() function by supplying integer object array, flag value = SORT_REGULAR +$temp_array = $unsorted_int_obj; +var_dump(arsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +// testing arsort() function by supplying string object array, flag value = SORT_REGULAR +$temp_array = $unsorted_str_obj; +var_dump(arsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing arsort() : object functionality *** + +Fatal error: Class 'for_integer_asort' not found in %sarsort_object1.php on line %d \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_object2.phpt b/ext/standard/tests/array/arsort_object2.phpt new file mode 100644 index 0000000..24da657 --- /dev/null +++ b/ext/standard/tests/array/arsort_object2.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test arsort() function : object functionality - sorting objects with diff. accessibility of member vars +--FILE-- +public_class_value = $value1; + $this->private_class_value = $value2; + $this->protected_class_value = $value3; + } + +} + +// class declaration for string objects +class for_string_arsort +{ + public $public_class_value; + private $private_class_value; + protected $protected_class_value; + // initializing object member value + function __construct($value1, $value2,$value3){ + $this->public_class_value = $value1; + $this->private_class_value = $value2; + $this->protected_class_value = $value3; + } + + // return string value + function __tostring() { + return (string)$this->value; + } +} + +// array of integer objects +$unsorted_int_obj = array ( + 1 => new for_integer_arsort(11, 33,2), 2 => new for_integer_asort(44, 66,3), + 3 => new for_integer_arsort(23, 32,6), 4 => new for_integer_asort(-88, -5,-4), +); + +// array of string objects +$unsorted_str_obj = array ( + "a" => new for_string_arsort("axx","AXX","d"), "b" => new for_string_asort("T", "t","q"), + "c" => new for_string_arsort("w", "W","c"), "d" => new for_string_asort("PY", "py","s"), +); + + +echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is default --\n"; + +// testing arsort() function by supplying integer object array, flag value is default +$temp_array = $unsorted_int_obj; +var_dump(arsort($temp_array) ); +var_dump($temp_array); + +// testing arsort() function by supplying string object array, flag value is default +$temp_array = $unsorted_str_obj; +var_dump(arsort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n"; +// testing arsort() function by supplying integer object array, flag value = SORT_REGULAR +$temp_array = $unsorted_int_obj; +var_dump(arsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +// testing arsort() function by supplying string object array, flag value = SORT_REGULAR +$temp_array = $unsorted_str_obj; +var_dump(arsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing arsort() : object functionality *** + +Fatal error: Class 'for_integer_asort' not found in %sarsort_object2.php on line %d \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_variation1.phpt b/ext/standard/tests/array/arsort_variation1.phpt new file mode 100644 index 0000000..1545abe --- /dev/null +++ b/ext/standard/tests/array/arsort_variation1.phpt @@ -0,0 +1,399 @@ +--TEST-- +Test arsort() function : usage variations - unexpected values for 'array_arg' argument +--FILE-- + 0, + 1 => 1, + 2 => 12345, + 3 => -2345, + + // float data + 4 => 10.5, + 5 => -10.5, + 6 => 10.5e3, + 7 => 10.6E-2, + 8 => .5, + + // null data + 9 => NULL, + 10 => null, + + // boolean data + 11 => true, + 12 => false, + 13 => TRUE, + 14 => FALSE, + + // empty data + 15 => "", + 16 => '', + + // string data + 17 => "string", + 18 => 'string', + + // object data + 19 => new stdclass(), + + // undefined data + 20 => @undefined_var, + + // unset data + 21 => @unset_var, + + // resource variable + 22 => $fp + +); + +// loop though each element of the array and check the working of arsort() +// when $array arugment is supplied with different values from $unexpected_values +echo "\n-- Testing arsort() by supplying different unexpected values for 'array' argument --\n"; +echo "\n-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --\n"; + +$counter = 1; +for($index = 0; $index < count($unexpected_values); $index ++) { + echo "-- Iteration $counter --\n"; + $value = $unexpected_values [$index]; + var_dump( arsort($value) ); // expecting : bool(false) + var_dump( arsort($value, SORT_REGULAR) ); // expecting : bool(false) + var_dump( arsort($value, SORT_NUMERIC) ); // expecting : bool(false) + var_dump( arsort($value, SORT_STRING) ); // expecting : bool(false) + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing arsort() : usage variations *** + +-- Testing arsort() by supplying different unexpected values for 'array' argument -- + +-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING -- +-- Iteration 1 -- + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 2 -- + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 3 -- + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 4 -- + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 5 -- + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 6 -- + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 7 -- + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 8 -- + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 9 -- + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 10 -- + +Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 11 -- + +Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 12 -- + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 13 -- + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 14 -- + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 15 -- + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 16 -- + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 17 -- + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 18 -- + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 19 -- + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 20 -- + +Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 21 -- + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 22 -- + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d +bool(false) +-- Iteration 23 -- + +Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d +bool(false) + +Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_variation10.phpt b/ext/standard/tests/array/arsort_variation10.phpt new file mode 100644 index 0000000..ec483df --- /dev/null +++ b/ext/standard/tests/array/arsort_variation10.phpt @@ -0,0 +1,114 @@ +--TEST-- +Test arsort() function : usage variations - sort octal values +--FILE-- + 01235, 0321 => 0321, 0345 => 0345, 066 => 066, 0772 => 0772, + 077 => 077, -066 => -066, -0345 => -0345, 0 => 0 +); + +echo "\n-- Testing arsort() by supplying octal value array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_oct_array; +var_dump( arsort($temp_array) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing arsort() by supplying octal value array, 'flag' value is SORT_REGULAR --\n"; +$temp_array = $unsorted_oct_array; +var_dump( arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing arsort() by supplying octal value array, 'flag' value is SORT_NUMERIC --\n"; +$temp_array = $unsorted_oct_array; +var_dump( arsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing arsort() : usage variations *** + +-- Testing arsort() by supplying octal value array, 'flag' value is defualt -- +bool(true) +array(9) { + [669]=> + int(669) + [506]=> + int(506) + [229]=> + int(229) + [209]=> + int(209) + [63]=> + int(63) + [54]=> + int(54) + [0]=> + int(0) + [-54]=> + int(-54) + [-229]=> + int(-229) +} + +-- Testing arsort() by supplying octal value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(9) { + [669]=> + int(669) + [506]=> + int(506) + [229]=> + int(229) + [209]=> + int(209) + [63]=> + int(63) + [54]=> + int(54) + [0]=> + int(0) + [-54]=> + int(-54) + [-229]=> + int(-229) +} + +-- Testing arsort() by supplying octal value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(9) { + [669]=> + int(669) + [506]=> + int(506) + [229]=> + int(229) + [209]=> + int(209) + [63]=> + int(63) + [54]=> + int(54) + [0]=> + int(0) + [-54]=> + int(-54) + [-229]=> + int(-229) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_variation11.phpt b/ext/standard/tests/array/arsort_variation11.phpt new file mode 100644 index 0000000..e8bfd77 Binary files /dev/null and b/ext/standard/tests/array/arsort_variation11.phpt differ diff --git a/ext/standard/tests/array/arsort_variation2.phpt b/ext/standard/tests/array/arsort_variation2.phpt new file mode 100644 index 0000000..b856530 --- /dev/null +++ b/ext/standard/tests/array/arsort_variation2.phpt @@ -0,0 +1,308 @@ +--TEST-- +Test arsort() function : usage variations - unexpected values for 'sort_flags' argument +--FILE-- + 10, 2 => 2, 3 => 45); + +//array of values to iterate over +$unexpected_values = array( + + // int data +/*1*/ -2345, + + // float data +/*2*/ 10.5, + -10.5, + 10.5e2, + 10.6E-2, + .5, + + // null data +/*7*/ NULL, + null, + + // boolean data +/*9*/ true, + false, + TRUE, + FALSE, + + // empty data +/*13*/ "", + '', + + // string data +/*15*/ "string", + 'string', + + // object data +/*16*/ new stdclass(), + + // undefined data +/*17*/ @undefined_var, + + // unset data +/*18*/ @unset_var, + + // resource variable +/*19*/ $fp + +); + +// loop though each element of the array and check the working of arsort() +// when $flag arugment is supplied with different values from $unexpected_values +echo "\n-- Testing arsort() by supplying different unexpected values for 'sort_flags' argument --\n"; + +$counter = 1; +for($index = 0; $index < count($unexpected_values); $index ++) { + echo "-- Iteration $counter --\n"; + $value = $unexpected_values [$index]; + $temp_array = $unsorted_values; + var_dump( arsort($temp_array, $value) ); + var_dump($temp_array); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing arsort() : usage variations *** + +-- Testing arsort() by supplying different unexpected values for 'sort_flags' argument -- +-- Iteration 1 -- +bool(true) +array(3) { + [3]=> + int(45) + [1]=> + int(10) + [2]=> + int(2) +} +-- Iteration 2 -- +bool(true) +array(3) { + [3]=> + int(45) + [2]=> + int(2) + [1]=> + int(10) +} +-- Iteration 3 -- +bool(true) +array(3) { + [3]=> + int(45) + [1]=> + int(10) + [2]=> + int(2) +} +-- Iteration 4 -- +bool(true) +array(3) { + [3]=> + int(45) + [1]=> + int(10) + [2]=> + int(2) +} +-- Iteration 5 -- +bool(true) +array(3) { + [3]=> + int(45) + [1]=> + int(10) + [2]=> + int(2) +} +-- Iteration 6 -- +bool(true) +array(3) { + [3]=> + int(45) + [1]=> + int(10) + [2]=> + int(2) +} +-- Iteration 7 -- +bool(true) +array(3) { + [3]=> + int(45) + [1]=> + int(10) + [2]=> + int(2) +} +-- Iteration 8 -- +bool(true) +array(3) { + [3]=> + int(45) + [1]=> + int(10) + [2]=> + int(2) +} +-- Iteration 9 -- +bool(true) +array(3) { + [3]=> + int(45) + [1]=> + int(10) + [2]=> + int(2) +} +-- Iteration 10 -- +bool(true) +array(3) { + [3]=> + int(45) + [1]=> + int(10) + [2]=> + int(2) +} +-- Iteration 11 -- +bool(true) +array(3) { + [3]=> + int(45) + [1]=> + int(10) + [2]=> + int(2) +} +-- Iteration 12 -- +bool(true) +array(3) { + [3]=> + int(45) + [1]=> + int(10) + [2]=> + int(2) +} +-- Iteration 13 -- + +Warning: arsort() expects parameter 2 to be long, string given in %sarsort_variation2.php on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 14 -- + +Warning: arsort() expects parameter 2 to be long, string given in %sarsort_variation2.php on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 15 -- + +Warning: arsort() expects parameter 2 to be long, string given in %sarsort_variation2.php on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 16 -- + +Warning: arsort() expects parameter 2 to be long, string given in %sarsort_variation2.php on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 17 -- + +Warning: arsort() expects parameter 2 to be long, object given in %sarsort_variation2.php on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 18 -- + +Warning: arsort() expects parameter 2 to be long, string given in %sarsort_variation2.php on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 19 -- + +Warning: arsort() expects parameter 2 to be long, string given in %sarsort_variation2.php on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 20 -- + +Warning: arsort() expects parameter 2 to be long, resource given in %sarsort_variation2.php on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +Done diff --git a/ext/standard/tests/array/arsort_variation3.phpt b/ext/standard/tests/array/arsort_variation3.phpt new file mode 100644 index 0000000..609155c --- /dev/null +++ b/ext/standard/tests/array/arsort_variation3.phpt @@ -0,0 +1,326 @@ +--TEST-- +Test arsort() function : usage variations - sort integer/float values +--FILE-- + 11, 2 => -11, 3 => 21, 4 => -21, 5 => 31, 6 => -31, 7 => 0, 8 => 41, 10 =>-41), + + // float value array + array(1 => 10.5, 2 => -10.5, 3 => 10.5e2, 4 => 10.6E-2, 5 => .5, 6 => .0001, 7 => -.1), + + // mixed value array + array(1 => .0001, 2 => .0021, 3 => -.01, 4 => -1, 5 => 0, 6 => .09, 7 => 2, 8 => -.9, 9 => 10.6E-2, 10 => -10.6E-2, 11 => 33), + + // array values contains minimum and maximum ranges + array(1 => 2147483647, 2 => 2147483648, 3 => -2147483647, 4 => -2147483648, 5 => -0, 6 => 0, 7 => -2147483649) +); + +// set of possible flag values +$flag_value = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC); + +$count = 1; +echo "\n-- Testing arsort() by supplying various integer/float arrays --\n"; + +// loop through to test arsort() with different arrays +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With default sort_flag -\n"; + $temp_array = $array; + var_dump(arsort($temp_array) ); + var_dump($temp_array); + + // loop through $flag_value array and setting all possible flag values + foreach($flag_value as $key => $flag){ + echo "- Sort_flag = $key -\n"; + $temp_array = $array; + var_dump(arsort($temp_array, $flag) ); + var_dump($temp_array); + } + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing arsort() : usage variations *** + +-- Testing arsort() by supplying various integer/float arrays -- + +-- Iteration 1 -- +- With default sort_flag - +bool(true) +array(9) { + [8]=> + int(41) + [5]=> + int(31) + [3]=> + int(21) + [1]=> + int(11) + [7]=> + int(0) + [2]=> + int(-11) + [4]=> + int(-21) + [6]=> + int(-31) + [10]=> + int(-41) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(9) { + [8]=> + int(41) + [5]=> + int(31) + [3]=> + int(21) + [1]=> + int(11) + [7]=> + int(0) + [2]=> + int(-11) + [4]=> + int(-21) + [6]=> + int(-31) + [10]=> + int(-41) +} +- Sort_flag = SORT_NUMERIC - +bool(true) +array(9) { + [8]=> + int(41) + [5]=> + int(31) + [3]=> + int(21) + [1]=> + int(11) + [7]=> + int(0) + [2]=> + int(-11) + [4]=> + int(-21) + [6]=> + int(-31) + [10]=> + int(-41) +} + +-- Iteration 2 -- +- With default sort_flag - +bool(true) +array(7) { + [3]=> + float(1050) + [1]=> + float(10.5) + [5]=> + float(0.5) + [4]=> + float(0.106) + [6]=> + float(0.0001) + [7]=> + float(-0.1) + [2]=> + float(-10.5) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(7) { + [3]=> + float(1050) + [1]=> + float(10.5) + [5]=> + float(0.5) + [4]=> + float(0.106) + [6]=> + float(0.0001) + [7]=> + float(-0.1) + [2]=> + float(-10.5) +} +- Sort_flag = SORT_NUMERIC - +bool(true) +array(7) { + [3]=> + float(1050) + [1]=> + float(10.5) + [5]=> + float(0.5) + [4]=> + float(0.106) + [6]=> + float(0.0001) + [7]=> + float(-0.1) + [2]=> + float(-10.5) +} + +-- Iteration 3 -- +- With default sort_flag - +bool(true) +array(11) { + [11]=> + int(33) + [7]=> + int(2) + [9]=> + float(0.106) + [6]=> + float(0.09) + [2]=> + float(0.0021) + [1]=> + float(0.0001) + [5]=> + int(0) + [3]=> + float(-0.01) + [10]=> + float(-0.106) + [8]=> + float(-0.9) + [4]=> + int(-1) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(11) { + [11]=> + int(33) + [7]=> + int(2) + [9]=> + float(0.106) + [6]=> + float(0.09) + [2]=> + float(0.0021) + [1]=> + float(0.0001) + [5]=> + int(0) + [3]=> + float(-0.01) + [10]=> + float(-0.106) + [8]=> + float(-0.9) + [4]=> + int(-1) +} +- Sort_flag = SORT_NUMERIC - +bool(true) +array(11) { + [11]=> + int(33) + [7]=> + int(2) + [9]=> + float(0.106) + [6]=> + float(0.09) + [2]=> + float(0.0021) + [1]=> + float(0.0001) + [5]=> + int(0) + [3]=> + float(-0.01) + [10]=> + float(-0.106) + [8]=> + float(-0.9) + [4]=> + int(-1) +} + +-- Iteration 4 -- +- With default sort_flag - +bool(true) +array(7) { + [2]=> + %s(2147483648) + [1]=> + int(2147483647) + [6]=> + int(0) + [5]=> + int(0) + [3]=> + int(-2147483647) + [4]=> + %s(-2147483648) + [7]=> + %s(-2147483649) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(7) { + [2]=> + %s(2147483648) + [1]=> + int(2147483647) + [6]=> + int(0) + [5]=> + int(0) + [3]=> + int(-2147483647) + [4]=> + %s(-2147483648) + [7]=> + %s(-2147483649) +} +- Sort_flag = SORT_NUMERIC - +bool(true) +array(7) { + [2]=> + %s(2147483648) + [1]=> + int(2147483647) + [6]=> + int(0) + [5]=> + int(0) + [3]=> + int(-2147483647) + [4]=> + %s(-2147483648) + [7]=> + %s(-2147483649) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_variation4.phpt b/ext/standard/tests/array/arsort_variation4.phpt new file mode 100644 index 0000000..a76a180 --- /dev/null +++ b/ext/standard/tests/array/arsort_variation4.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test arsort() function : usage variations - sort reference variables +--FILE-- + &$value1 , 2 => &$value2, 3 => &$value3); + +echo "\n-- Testing arsort() by supplying reference variable array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_numerics; +var_dump( arsort($temp_array) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying reference variable array, 'flag' = SORT_REGULAR --\n"; +$temp_array = &$unsorted_numerics; +var_dump( arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying reference variable array, 'flag' = SORT_NUMERIC --\n"; +$temp_array = &$unsorted_numerics; +var_dump( arsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing arsort() :usage variations *** + +-- Testing arsort() by supplying reference variable array, 'flag' value is defualt -- +bool(true) +array(3) { + [3]=> + &int(555) + [1]=> + &int(100) + [2]=> + &int(33) +} + +-- Testing arsort() by supplying reference variable array, 'flag' = SORT_REGULAR -- +bool(true) +array(3) { + [3]=> + &int(555) + [1]=> + &int(100) + [2]=> + &int(33) +} + +-- Testing arsort() by supplying reference variable array, 'flag' = SORT_NUMERIC -- +bool(true) +array(3) { + [3]=> + &int(555) + [1]=> + &int(100) + [2]=> + &int(33) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_variation5.phpt b/ext/standard/tests/array/arsort_variation5.phpt new file mode 100644 index 0000000..187d43c --- /dev/null +++ b/ext/standard/tests/array/arsort_variation5.phpt @@ -0,0 +1,247 @@ +--TEST-- +Test arsort() function : usage variations - sort strings +--SKIPIF-- + null, "NULL" => NULL, "\a" => "\a", "\cx" => "\cx", "\e" => "\e", + "\f" => "\f", "\n" =>"\n", "\r" => "\r", "\t" => "\t", "\xhh" => "\xhh", + "\ddd" => "\ddd", "\v" => "\v" + ), + + // array contains combination of capital/small letters + array ('l' => "lemoN", 'O' => "Orange", 'b' => "banana", 'a' => "apple", 'Te' => "Test", + 'T' => "TTTT", 't' => "ttt", 'w' => "ww", 'x' => "x", 'X' => "X", 'o' => "oraNGe", + 'B' => "BANANA" + ) +); + +$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING); + +$count = 1; +echo "\n-- Testing arsort() by supplying various string arrays --\n"; + +// loop through to test arsort() with different arrays +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With default sort_flag -\n"; + $temp_array = $array; + var_dump(arsort($temp_array) ); // expecting : bool(true) + var_dump($temp_array); + + // loop through $flags array and setting all possible flag values + foreach($flags as $key => $flag){ + echo "- Sort_flag = $key -\n"; + $temp_array = $array; + var_dump(arsort($temp_array, $flag) ); // expecting : bool(true) + var_dump($temp_array); + } + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing arsort() : usage variations *** + +-- Testing arsort() by supplying various string arrays -- + +-- Iteration 1 -- +- With default sort_flag - +bool(true) +array(12) { + ["\xhh"]=> + string(4) "\xhh" + ["\ddd"]=> + string(4) "\ddd" + ["\cx"]=> + string(3) "\cx" + ["\a"]=> + string(2) "\a" + [""]=> + string(1) "" + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" +"]=> + string(1) " +" + [" "]=> + string(1) " " + ["null"]=> + NULL + ["NULL"]=> + NULL +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(12) { + ["\xhh"]=> + string(4) "\xhh" + ["\ddd"]=> + string(4) "\ddd" + ["\cx"]=> + string(3) "\cx" + ["\a"]=> + string(2) "\a" + [""]=> + string(1) "" + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" +"]=> + string(1) " +" + [" "]=> + string(1) " " + ["null"]=> + NULL + ["NULL"]=> + NULL +} +- Sort_flag = SORT_STRING - +bool(true) +array(12) { + ["\xhh"]=> + string(4) "\xhh" + ["\ddd"]=> + string(4) "\ddd" + ["\cx"]=> + string(3) "\cx" + ["\a"]=> + string(2) "\a" + [""]=> + string(1) "" + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" +"]=> + string(1) " +" + [" "]=> + string(1) " " + ["null"]=> + NULL + ["NULL"]=> + NULL +} + +-- Iteration 2 -- +- With default sort_flag - +bool(true) +array(12) { + ["x"]=> + string(1) "x" + ["w"]=> + string(2) "ww" + ["t"]=> + string(3) "ttt" + ["o"]=> + string(6) "oraNGe" + ["l"]=> + string(5) "lemoN" + ["b"]=> + string(6) "banana" + ["a"]=> + string(5) "apple" + ["X"]=> + string(1) "X" + ["Te"]=> + string(4) "Test" + ["T"]=> + string(4) "TTTT" + ["O"]=> + string(6) "Orange" + ["B"]=> + string(6) "BANANA" +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(12) { + ["x"]=> + string(1) "x" + ["w"]=> + string(2) "ww" + ["t"]=> + string(3) "ttt" + ["o"]=> + string(6) "oraNGe" + ["l"]=> + string(5) "lemoN" + ["b"]=> + string(6) "banana" + ["a"]=> + string(5) "apple" + ["X"]=> + string(1) "X" + ["Te"]=> + string(4) "Test" + ["T"]=> + string(4) "TTTT" + ["O"]=> + string(6) "Orange" + ["B"]=> + string(6) "BANANA" +} +- Sort_flag = SORT_STRING - +bool(true) +array(12) { + ["x"]=> + string(1) "x" + ["w"]=> + string(2) "ww" + ["t"]=> + string(3) "ttt" + ["o"]=> + string(6) "oraNGe" + ["l"]=> + string(5) "lemoN" + ["b"]=> + string(6) "banana" + ["a"]=> + string(5) "apple" + ["X"]=> + string(1) "X" + ["Te"]=> + string(4) "Test" + ["T"]=> + string(4) "TTTT" + ["O"]=> + string(6) "Orange" + ["B"]=> + string(6) "BANANA" +} +Done diff --git a/ext/standard/tests/array/arsort_variation6.phpt b/ext/standard/tests/array/arsort_variation6.phpt new file mode 100644 index 0000000..687b20a --- /dev/null +++ b/ext/standard/tests/array/arsort_variation6.phpt @@ -0,0 +1,114 @@ +--TEST-- +Test arsort() function : usage variations - sort hexadecimal values +--FILE-- + 0x1AB, 0xFFF => 0xFFF, 0xF => 0xF, 0xFF => 0xFF, 0x2AA => 0x2AA, 0xBB => 0xBB, + 0x1ab => 0x1ab, 0xff => 0xff, -0xff => -0xFF, 0 => 0, -0x2aa => -0x2aa + ); + +echo "\n-- Testing arsort() by supplying hexadecimal value array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_hex_array; +var_dump(arsort($temp_array) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing arsort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --\n"; +$temp_array = $unsorted_hex_array; +var_dump(arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing arsort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --\n"; +$temp_array = $unsorted_hex_array; +var_dump(arsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing arsort() : usage variations *** + +-- Testing arsort() by supplying hexadecimal value array, 'flag' value is defualt -- +bool(true) +array(9) { + [4095]=> + int(4095) + [682]=> + int(682) + [427]=> + int(427) + [255]=> + int(255) + [187]=> + int(187) + [15]=> + int(15) + [0]=> + int(0) + [-255]=> + int(-255) + [-682]=> + int(-682) +} + +-- Testing arsort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(9) { + [4095]=> + int(4095) + [682]=> + int(682) + [427]=> + int(427) + [255]=> + int(255) + [187]=> + int(187) + [15]=> + int(15) + [0]=> + int(0) + [-255]=> + int(-255) + [-682]=> + int(-682) +} + +-- Testing arsort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(9) { + [4095]=> + int(4095) + [682]=> + int(682) + [427]=> + int(427) + [255]=> + int(255) + [187]=> + int(187) + [15]=> + int(15) + [0]=> + int(0) + [-255]=> + int(-255) + [-682]=> + int(-682) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_variation7.phpt b/ext/standard/tests/array/arsort_variation7.phpt new file mode 100644 index 0000000..97195b7 --- /dev/null +++ b/ext/standard/tests/array/arsort_variation7.phpt @@ -0,0 +1,98 @@ +--TEST-- +Test arsort() function : usage variations - sort bool values +--FILE-- + true, 2 => false, 3 => TRUE, 4 => FALSE); + +echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is defualt --\n"; +$temp_array = $bool_values; +var_dump(arsort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is SORT_REGULAR --\n"; +$temp_array = $bool_values; +var_dump(arsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is SORT_NUMERIC --\n"; +$temp_array = $bool_values; +var_dump(arsort($temp_array, SORT_NUMERIC) ); +var_dump($temp_array); + +echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is SORT_STRING --\n"; +$temp_array = $bool_values; +var_dump(arsort($temp_array, SORT_STRING) ); +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing arsort() : usage variations *** + +-- Testing arsort() by supplying bool value array, 'flag' value is defualt -- +bool(true) +array(4) { + [3]=> + bool(true) + [1]=> + bool(true) + [4]=> + bool(false) + [2]=> + bool(false) +} + +-- Testing arsort() by supplying bool value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(4) { + [3]=> + bool(true) + [1]=> + bool(true) + [4]=> + bool(false) + [2]=> + bool(false) +} + +-- Testing arsort() by supplying bool value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(4) { + [3]=> + bool(true) + [1]=> + bool(true) + [4]=> + bool(false) + [2]=> + bool(false) +} + +-- Testing arsort() by supplying bool value array, 'flag' value is SORT_STRING -- +bool(true) +array(4) { + [3]=> + bool(true) + [1]=> + bool(true) + [4]=> + bool(false) + [2]=> + bool(false) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_variation8.phpt b/ext/standard/tests/array/arsort_variation8.phpt new file mode 100644 index 0000000..c247316 --- /dev/null +++ b/ext/standard/tests/array/arsort_variation8.phpt @@ -0,0 +1,180 @@ +--TEST-- +Test arsort() function : usage variations - sort array with diff. sub arrays, 'sort_flags' as default/SORT_REGULAR +--FILE-- + array(), + + // array contains null sub array + "array[1]" => array( "sub_array[1][0]" => array() ), + + // array of arrays along with some values + "array[2]" => array("data[2,0]" => 44, "data[2,1]" => 11, "sub_array[2][0] " => array(64,61) ), + + // array contains sub arrays + "array[3]" => array ( "sub_array[3][0]" => array(33,-5,6), "sub_array[3][1]" => array(11), + "sub_array[3][2]" => array(22,-55), "sub_array[3][3]" => array() ) +); + + +$count = 1; +echo "\n-- Testing arsort() by supplying various arrays containing sub arrays --\n"; + +// loop through to test arsort() with different arrays +foreach ($various_arrays as $array) { + + echo "\n-- Iteration $count --\n"; + // testing arsort() function by supplying different arrays, flag value is default + echo "- With default sort_flag -\n"; + $temp_array = $array; + var_dump(arsort($temp_array) ); + var_dump($temp_array); + + // testing arsort() function by supplying different arrays, flag value = SORT_REGULAR + echo "- Sort_flag = SORT_REGULAR -\n"; + $temp_array = $array; + var_dump(arsort($temp_array, SORT_REGULAR) ); + var_dump($temp_array); + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing arsort() : usage variations *** + +-- Testing arsort() by supplying various arrays containing sub arrays -- + +-- Iteration 1 -- +- With default sort_flag - +bool(true) +array(0) { +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(0) { +} + +-- Iteration 2 -- +- With default sort_flag - +bool(true) +array(1) { + ["sub_array[1][0]"]=> + array(0) { + } +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(1) { + ["sub_array[1][0]"]=> + array(0) { + } +} + +-- Iteration 3 -- +- With default sort_flag - +bool(true) +array(3) { + ["sub_array[2][0] "]=> + array(2) { + [0]=> + int(64) + [1]=> + int(61) + } + ["data[2,0]"]=> + int(44) + ["data[2,1]"]=> + int(11) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(3) { + ["sub_array[2][0] "]=> + array(2) { + [0]=> + int(64) + [1]=> + int(61) + } + ["data[2,0]"]=> + int(44) + ["data[2,1]"]=> + int(11) +} + +-- Iteration 4 -- +- With default sort_flag - +bool(true) +array(4) { + ["sub_array[3][0]"]=> + array(3) { + [0]=> + int(33) + [1]=> + int(-5) + [2]=> + int(6) + } + ["sub_array[3][2]"]=> + array(2) { + [0]=> + int(22) + [1]=> + int(-55) + } + ["sub_array[3][1]"]=> + array(1) { + [0]=> + int(11) + } + ["sub_array[3][3]"]=> + array(0) { + } +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(4) { + ["sub_array[3][0]"]=> + array(3) { + [0]=> + int(33) + [1]=> + int(-5) + [2]=> + int(6) + } + ["sub_array[3][2]"]=> + array(2) { + [0]=> + int(22) + [1]=> + int(-55) + } + ["sub_array[3][1]"]=> + array(1) { + [0]=> + int(11) + } + ["sub_array[3][3]"]=> + array(0) { + } +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_variation9.phpt b/ext/standard/tests/array/arsort_variation9.phpt new file mode 100644 index 0000000..a034db5 --- /dev/null +++ b/ext/standard/tests/array/arsort_variation9.phpt @@ -0,0 +1,258 @@ +--TEST-- +Test arsort() function : usage variations - sorting arrays with/without keys, 'sort_flags' as default/SORT_REGULAR +--FILE-- + 55, 66, 22, 33, 11), + array ("a" => "orange", "banana", "c" => "apple"), + array(1, 2, 3, 4, 5, 6), + array("first", 5 => "second", "third"), + array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13), + array('bar' => 'baz', "foo" => 1), + array('a'=>1,'b'=>array('e'=>2,'f'=>3),'c'=>array('g'=>4),'d'=>5), +); + +$count = 1; +echo "\n-- Testing arsort() by supplying various arrays with key values --\n"; + +// loop through to test arsort() with different arrays, +// to test the new keys for the elements in the sorted array +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With default sort_flag -\n"; + $temp_array = $array; + var_dump(arsort($temp_array) ); + var_dump($temp_array); + + echo "- Sort_flag = SORT_REGULAR -\n"; + $temp_array = $array; + var_dump(arsort($temp_array, SORT_REGULAR) ); + var_dump($temp_array); + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing arsort() : usage variations *** + +-- Testing arsort() by supplying various arrays with key values -- + +-- Iteration 1 -- +- With default sort_flag - +bool(true) +array(5) { + [6]=> + int(66) + [5]=> + int(55) + [8]=> + int(33) + [7]=> + int(22) + [9]=> + int(11) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(5) { + [6]=> + int(66) + [5]=> + int(55) + [8]=> + int(33) + [7]=> + int(22) + [9]=> + int(11) +} + +-- Iteration 2 -- +- With default sort_flag - +bool(true) +array(3) { + ["a"]=> + string(6) "orange" + [0]=> + string(6) "banana" + ["c"]=> + string(5) "apple" +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(3) { + ["a"]=> + string(6) "orange" + [0]=> + string(6) "banana" + ["c"]=> + string(5) "apple" +} + +-- Iteration 3 -- +- With default sort_flag - +bool(true) +array(6) { + [5]=> + int(6) + [4]=> + int(5) + [3]=> + int(4) + [2]=> + int(3) + [1]=> + int(2) + [0]=> + int(1) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(6) { + [5]=> + int(6) + [4]=> + int(5) + [3]=> + int(4) + [2]=> + int(3) + [1]=> + int(2) + [0]=> + int(1) +} + +-- Iteration 4 -- +- With default sort_flag - +bool(true) +array(3) { + [6]=> + string(5) "third" + [5]=> + string(6) "second" + [0]=> + string(5) "first" +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(3) { + [6]=> + string(5) "third" + [5]=> + string(6) "second" + [0]=> + string(5) "first" +} + +-- Iteration 5 -- +- With default sort_flag - +bool(true) +array(6) { + [9]=> + int(19) + [3]=> + int(13) + [4]=> + int(1) + [8]=> + int(1) + [1]=> + int(1) + [0]=> + int(1) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(6) { + [9]=> + int(19) + [3]=> + int(13) + [4]=> + int(1) + [8]=> + int(1) + [1]=> + int(1) + [0]=> + int(1) +} + +-- Iteration 6 -- +- With default sort_flag - +bool(true) +array(2) { + ["foo"]=> + int(1) + ["bar"]=> + string(3) "baz" +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(2) { + ["foo"]=> + int(1) + ["bar"]=> + string(3) "baz" +} + +-- Iteration 7 -- +- With default sort_flag - +bool(true) +array(4) { + ["b"]=> + array(2) { + ["e"]=> + int(2) + ["f"]=> + int(3) + } + ["c"]=> + array(1) { + ["g"]=> + int(4) + } + ["d"]=> + int(5) + ["a"]=> + int(1) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(4) { + ["b"]=> + array(2) { + ["e"]=> + int(2) + ["f"]=> + int(3) + } + ["c"]=> + array(1) { + ["g"]=> + int(4) + } + ["d"]=> + int(5) + ["a"]=> + int(1) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/asort_basic.phpt b/ext/standard/tests/array/asort_basic.phpt new file mode 100644 index 0000000..b80d31d --- /dev/null +++ b/ext/standard/tests/array/asort_basic.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test asort() function : basic functionality +--FILE-- + "lemon", "o" => "orange", + "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", + "b" => "banana", +); +// an array containing unsorted numeric values with indices +$unsorted_numerics = array( 1 => 100, 2 => 33, 3 => 555, 4 => 22 ); + +echo "\n-- Testing asort() by supplying string array, 'flag' value is default --\n"; +$temp_array = $unsorted_strings; +var_dump( asort($temp_array) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing asort() by supplying numeric array, 'flag' value is default --\n"; +$temp_array = $unsorted_numerics; +var_dump( asort($temp_array) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing asort() by supplying string array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $unsorted_strings; +var_dump( asort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing asort() by supplying numeric array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $unsorted_numerics; +var_dump( asort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing asort() by supplying string array, 'flag' = SORT_STRING --\n"; +$temp_array = $unsorted_strings; +var_dump( asort($temp_array, SORT_STRING) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing asort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE --\n"; +$temp_array = $unsorted_strings; +var_dump( asort($temp_array, SORT_STRING|SORT_FLAG_CASE) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing asort() by supplying string array (natural), 'flag' = SORT_NATURAL --\n"; +$temp_array = $unsorted_strings; +var_dump( asort($temp_array, SORT_NATURAL) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing asort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE --\n"; +$temp_array = $unsorted_strings; +var_dump( asort($temp_array, SORT_NATURAL|SORT_FLAG_CASE) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing asort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n"; +$temp_array = $unsorted_numerics; +var_dump( asort($temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing asort() : basic functionality *** + +-- Testing asort() by supplying string array, 'flag' value is default -- +bool(true) +array(8) { + ["O"]=> + string(6) "Orange" + ["O1"]=> + string(7) "Orange1" + ["O3"]=> + string(7) "Orange3" + ["b"]=> + string(6) "banana" + ["l"]=> + string(5) "lemon" + ["o"]=> + string(6) "orange" + ["o2"]=> + string(7) "orange2" + ["o20"]=> + string(8) "orange20" +} + +-- Testing asort() by supplying numeric array, 'flag' value is default -- +bool(true) +array(4) { + [4]=> + int(22) + [2]=> + int(33) + [1]=> + int(100) + [3]=> + int(555) +} + +-- Testing asort() by supplying string array, 'flag' = SORT_REGULAR -- +bool(true) +array(8) { + ["O"]=> + string(6) "Orange" + ["O1"]=> + string(7) "Orange1" + ["O3"]=> + string(7) "Orange3" + ["b"]=> + string(6) "banana" + ["l"]=> + string(5) "lemon" + ["o"]=> + string(6) "orange" + ["o2"]=> + string(7) "orange2" + ["o20"]=> + string(8) "orange20" +} + +-- Testing asort() by supplying numeric array, 'flag' = SORT_REGULAR -- +bool(true) +array(4) { + [4]=> + int(22) + [2]=> + int(33) + [1]=> + int(100) + [3]=> + int(555) +} + +-- Testing asort() by supplying string array, 'flag' = SORT_STRING -- +bool(true) +array(8) { + ["O"]=> + string(6) "Orange" + ["O1"]=> + string(7) "Orange1" + ["O3"]=> + string(7) "Orange3" + ["b"]=> + string(6) "banana" + ["l"]=> + string(5) "lemon" + ["o"]=> + string(6) "orange" + ["o2"]=> + string(7) "orange2" + ["o20"]=> + string(8) "orange20" +} + +-- Testing asort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE -- +bool(true) +array(8) { + ["b"]=> + string(6) "banana" + ["l"]=> + string(5) "lemon" + ["o"]=> + string(6) "orange" + ["O"]=> + string(6) "Orange" + ["O1"]=> + string(7) "Orange1" + ["o2"]=> + string(7) "orange2" + ["o20"]=> + string(8) "orange20" + ["O3"]=> + string(7) "Orange3" +} + +-- Testing asort() by supplying string array (natural), 'flag' = SORT_NATURAL -- +bool(true) +array(8) { + ["O"]=> + string(6) "Orange" + ["O1"]=> + string(7) "Orange1" + ["O3"]=> + string(7) "Orange3" + ["b"]=> + string(6) "banana" + ["l"]=> + string(5) "lemon" + ["o"]=> + string(6) "orange" + ["o2"]=> + string(7) "orange2" + ["o20"]=> + string(8) "orange20" +} + +-- Testing asort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE -- +bool(true) +array(8) { + ["b"]=> + string(6) "banana" + ["l"]=> + string(5) "lemon" + ["o"]=> + string(6) "orange" + ["O"]=> + string(6) "Orange" + ["O1"]=> + string(7) "Orange1" + ["o2"]=> + string(7) "orange2" + ["O3"]=> + string(7) "Orange3" + ["o20"]=> + string(8) "orange20" +} + +-- Testing asort() by supplying numeric array, 'flag' = SORT_NUMERIC -- +bool(true) +array(4) { + [4]=> + int(22) + [2]=> + int(33) + [1]=> + int(100) + [3]=> + int(555) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/asort_error.phpt b/ext/standard/tests/array/asort_error.phpt new file mode 100644 index 0000000..ef23295 --- /dev/null +++ b/ext/standard/tests/array/asort_error.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test asort() function : error conditions +--FILE-- + SORT_REGULAR, "SORT_STRING" => SORT_STRING, "SORT_NUMERIC" => SORT_NUMERIC); +$extra_arg = 10; + +// loop through $flag_value array and setting all possible flag values +foreach($flags as $key => $flag){ + echo "\nSort flag = $key\n"; + var_dump( asort($array_arg,$flag, $extra_arg) ); + + // dump the input array to ensure that it wasn't changed + var_dump($array_arg); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing asort() : error conditions *** + +-- Testing asort() function with Zero arguments -- + +Warning: asort() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing asort() function with more than expected no. of arguments -- + +Sort flag = SORT_REGULAR + +Warning: asort() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + +Sort flag = SORT_STRING + +Warning: asort() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + +Sort flag = SORT_NUMERIC + +Warning: asort() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +Done diff --git a/ext/standard/tests/array/asort_object1.phpt b/ext/standard/tests/array/asort_object1.phpt new file mode 100644 index 0000000..ad54675 --- /dev/null +++ b/ext/standard/tests/array/asort_object1.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test asort() function : object functionality - sort objects +--FILE-- +class_value = $value; + } + +} + +// class declaration for string objects +class for_string_asort +{ + public $class_value; + // initializing object member value + function __construct($value){ + $this->class_value = $value; + } + + // return string value + function __tostring() { + return (string)$this->value; + } + +} + +// array of integer objects +$unsorted_int_obj = array ( + 1 => new for_integer_asort(11), 2 => new for_integer_asort(66), + 3 => new for_integer_asort(23), 4 => new for_integer_asort(-5), + 5 => new for_integer_asort(0.001), 6 => new for_integer_asort(0) +); + +// array of string objects +$unsorted_str_obj = array ( + "a" => new for_string_asort("axx"), "b" => new for_string_asort("t"), + "c" => new for_string_asort("w"), "d" => new for_string_asort("py"), + "e" => new for_string_asort("apple"), "f" => new for_string_asort("Orange"), + "g" => new for_string_asort("Lemon"), "h" => new for_string_asort("aPPle") +); + + +echo "\n-- Testing asort() by supplying various object arrays, 'flag' value is defualt --\n"; + +// testing asort() function by supplying integer object array, flag value is defualt +$temp_array = $unsorted_int_obj; +var_dump(asort($temp_array) ); +var_dump($temp_array); + +// testing asort() function by supplying string object array, flag value is defualt +$temp_array = $unsorted_str_obj; +var_dump(asort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Testing asort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n"; +// testing asort() function by supplying integer object array, flag value = SORT_REGULAR +$temp_array = $unsorted_int_obj; +var_dump(asort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +// testing asort() function by supplying string object array, flag value = SORT_REGULAR +$temp_array = $unsorted_str_obj; +var_dump(asort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing asort() : object functionality *** + +-- Testing asort() by supplying various object arrays, 'flag' value is defualt -- +bool(true) +array(6) { + [4]=> + object(for_integer_asort)#%d (1) { + ["class_value"]=> + int(-5) + } + [6]=> + object(for_integer_asort)#%d (1) { + ["class_value"]=> + int(0) + } + [5]=> + object(for_integer_asort)#%d (1) { + ["class_value"]=> + float(0.001) + } + [1]=> + object(for_integer_asort)#%d (1) { + ["class_value"]=> + int(11) + } + [3]=> + object(for_integer_asort)#%d (1) { + ["class_value"]=> + int(23) + } + [2]=> + object(for_integer_asort)#%d (1) { + ["class_value"]=> + int(66) + } +} +bool(true) +array(8) { + ["g"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(5) "Lemon" + } + ["f"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(6) "Orange" + } + ["h"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(5) "aPPle" + } + ["e"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(5) "apple" + } + ["a"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(3) "axx" + } + ["d"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(2) "py" + } + ["b"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(1) "t" + } + ["c"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(1) "w" + } +} + +-- Testing asort() by supplying various object arrays, 'flag' value is SORT_REGULAR -- +bool(true) +array(6) { + [4]=> + object(for_integer_asort)#%d (1) { + ["class_value"]=> + int(-5) + } + [6]=> + object(for_integer_asort)#%d (1) { + ["class_value"]=> + int(0) + } + [5]=> + object(for_integer_asort)#%d (1) { + ["class_value"]=> + float(0.001) + } + [1]=> + object(for_integer_asort)#%d (1) { + ["class_value"]=> + int(11) + } + [3]=> + object(for_integer_asort)#%d (1) { + ["class_value"]=> + int(23) + } + [2]=> + object(for_integer_asort)#%d (1) { + ["class_value"]=> + int(66) + } +} +bool(true) +array(8) { + ["g"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(5) "Lemon" + } + ["f"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(6) "Orange" + } + ["h"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(5) "aPPle" + } + ["e"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(5) "apple" + } + ["a"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(3) "axx" + } + ["d"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(2) "py" + } + ["b"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(1) "t" + } + ["c"]=> + object(for_string_asort)#%d (1) { + ["class_value"]=> + string(1) "w" + } +} +Done diff --git a/ext/standard/tests/array/asort_object2.phpt b/ext/standard/tests/array/asort_object2.phpt new file mode 100644 index 0000000..be76120 --- /dev/null +++ b/ext/standard/tests/array/asort_object2.phpt @@ -0,0 +1,253 @@ +--TEST-- +Test asort() function : object functionality - sorting objects with diff. accessibility of member vars +--FILE-- +public_class_value = $value1; + $this->private_class_value = $value2; + $this->protected_class_value = $value3; + } + +} + +// class declaration for string objects +class for_string_asort +{ + public $public_class_value; + private $private_class_value; + protected $protected_class_value; + // initializing object member value + function __construct($value1, $value2,$value3){ + $this->public_class_value = $value1; + $this->private_class_value = $value2; + $this->protected_class_value = $value3; + } + + // return string value + function __tostring() { + return (string)$this->value; + } +} + +// array of integer objects +$unsorted_int_obj = array ( + 1 => new for_integer_asort(11, 33,2), 2 => new for_integer_asort(44, 66,3), + 3 => new for_integer_asort(23, 32,6), 4 => new for_integer_asort(-88, -5,-4), +); + +// array of string objects +$unsorted_str_obj = array ( + "a" => new for_string_asort("axx","AXX","d"), "b" => new for_string_asort("T", "t","q"), + "c" => new for_string_asort("w", "W","c"), "d" => new for_string_asort("PY", "py","s"), +); + + +echo "\n-- Testing asort() by supplying various object arrays, 'flag' value is default --\n"; + +// testing asort() function by supplying integer object array, flag value is default +$temp_array = $unsorted_int_obj; +var_dump(asort($temp_array) ); +var_dump($temp_array); + +// testing asort() function by supplying string object array, flag value is default +$temp_array = $unsorted_str_obj; +var_dump(asort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Testing asort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n"; +// testing asort() function by supplying integer object array, flag value = SORT_REGULAR +$temp_array = $unsorted_int_obj; +var_dump(asort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +// testing asort() function by supplying string object array, flag value = SORT_REGULAR +$temp_array = $unsorted_str_obj; +var_dump(asort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing asort() : object functionality *** + +-- Testing asort() by supplying various object arrays, 'flag' value is default -- +bool(true) +array(4) { + [4]=> + object(for_integer_asort)#%d (3) { + ["public_class_value"]=> + int(-88) + ["private_class_value":"for_integer_asort":private]=> + int(-5) + ["protected_class_value":protected]=> + int(-4) + } + [1]=> + object(for_integer_asort)#%d (3) { + ["public_class_value"]=> + int(11) + ["private_class_value":"for_integer_asort":private]=> + int(33) + ["protected_class_value":protected]=> + int(2) + } + [3]=> + object(for_integer_asort)#%d (3) { + ["public_class_value"]=> + int(23) + ["private_class_value":"for_integer_asort":private]=> + int(32) + ["protected_class_value":protected]=> + int(6) + } + [2]=> + object(for_integer_asort)#%d (3) { + ["public_class_value"]=> + int(44) + ["private_class_value":"for_integer_asort":private]=> + int(66) + ["protected_class_value":protected]=> + int(3) + } +} +bool(true) +array(4) { + ["d"]=> + object(for_string_asort)#%d (3) { + ["public_class_value"]=> + string(2) "PY" + ["private_class_value":"for_string_asort":private]=> + string(2) "py" + ["protected_class_value":protected]=> + string(1) "s" + } + ["b"]=> + object(for_string_asort)#%d (3) { + ["public_class_value"]=> + string(1) "T" + ["private_class_value":"for_string_asort":private]=> + string(1) "t" + ["protected_class_value":protected]=> + string(1) "q" + } + ["a"]=> + object(for_string_asort)#%d (3) { + ["public_class_value"]=> + string(3) "axx" + ["private_class_value":"for_string_asort":private]=> + string(3) "AXX" + ["protected_class_value":protected]=> + string(1) "d" + } + ["c"]=> + object(for_string_asort)#%d (3) { + ["public_class_value"]=> + string(1) "w" + ["private_class_value":"for_string_asort":private]=> + string(1) "W" + ["protected_class_value":protected]=> + string(1) "c" + } +} + +-- Testing asort() by supplying various object arrays, 'flag' value is SORT_REGULAR -- +bool(true) +array(4) { + [4]=> + object(for_integer_asort)#%d (3) { + ["public_class_value"]=> + int(-88) + ["private_class_value":"for_integer_asort":private]=> + int(-5) + ["protected_class_value":protected]=> + int(-4) + } + [1]=> + object(for_integer_asort)#%d (3) { + ["public_class_value"]=> + int(11) + ["private_class_value":"for_integer_asort":private]=> + int(33) + ["protected_class_value":protected]=> + int(2) + } + [3]=> + object(for_integer_asort)#%d (3) { + ["public_class_value"]=> + int(23) + ["private_class_value":"for_integer_asort":private]=> + int(32) + ["protected_class_value":protected]=> + int(6) + } + [2]=> + object(for_integer_asort)#%d (3) { + ["public_class_value"]=> + int(44) + ["private_class_value":"for_integer_asort":private]=> + int(66) + ["protected_class_value":protected]=> + int(3) + } +} +bool(true) +array(4) { + ["d"]=> + object(for_string_asort)#%d (3) { + ["public_class_value"]=> + string(2) "PY" + ["private_class_value":"for_string_asort":private]=> + string(2) "py" + ["protected_class_value":protected]=> + string(1) "s" + } + ["b"]=> + object(for_string_asort)#%d (3) { + ["public_class_value"]=> + string(1) "T" + ["private_class_value":"for_string_asort":private]=> + string(1) "t" + ["protected_class_value":protected]=> + string(1) "q" + } + ["a"]=> + object(for_string_asort)#%d (3) { + ["public_class_value"]=> + string(3) "axx" + ["private_class_value":"for_string_asort":private]=> + string(3) "AXX" + ["protected_class_value":protected]=> + string(1) "d" + } + ["c"]=> + object(for_string_asort)#%d (3) { + ["public_class_value"]=> + string(1) "w" + ["private_class_value":"for_string_asort":private]=> + string(1) "W" + ["protected_class_value":protected]=> + string(1) "c" + } +} +Done diff --git a/ext/standard/tests/array/asort_variation1.phpt b/ext/standard/tests/array/asort_variation1.phpt new file mode 100644 index 0000000..5420f05 --- /dev/null +++ b/ext/standard/tests/array/asort_variation1.phpt @@ -0,0 +1,399 @@ +--TEST-- +Test asort() function : usage variations - unexpected values for 'array_arg' argument +--FILE-- + 0, + 1 => 1, + 2 => 12345, + 3 => -2345, + + // float data + 4 => 10.5, + 5 => -10.5, + 6 => 10.5e3, + 7 => 10.6E-2, + 8 => .5, + + // null data + 9 => NULL, + 10 => null, + + // boolean data + 11 => true, + 12 => false, + 13 => TRUE, + 14 => FALSE, + + // empty data + 15 => "", + 16 => '', + + // string data + 17 => "string", + 18 => 'string', + + // object data + 19 => new stdclass(), + + // undefined data + 20 => @undefined_var, + + // unset data + 21 => @unset_var, + + // resource variable + 22 => $fp + +); + +// loop though each element of the array and check the working of asort() +// when $array arugment is supplied with different values from $unexpected_values +echo "\n-- Testing asort() by supplying different unexpected values for 'array' argument --\n"; +echo "\n-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --\n"; + +$counter = 1; +for($index = 0; $index < count($unexpected_values); $index ++) { + echo "-- Iteration $counter --\n"; + $value = $unexpected_values [$index]; + var_dump( asort($value) ); // expecting : bool(false) + var_dump( asort($value, SORT_REGULAR) ); // expecting : bool(false) + var_dump( asort($value, SORT_NUMERIC) ); // expecting : bool(false) + var_dump( asort($value, SORT_STRING) ); // expecting : bool(false) + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing asort() : usage variations *** + +-- Testing asort() by supplying different unexpected values for 'array' argument -- + +-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING -- +-- Iteration 1 -- + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 2 -- + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 3 -- + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 7 -- + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 8 -- + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 9 -- + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 10 -- + +Warning: asort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +-- Iteration 11 -- + +Warning: asort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 14 -- + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 15 -- + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 16 -- + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 17 -- + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 18 -- + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 19 -- + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 20 -- + +Warning: asort() expects parameter 1 to be array, object given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, object given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, object given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, object given in %s on line %d +bool(false) +-- Iteration 21 -- + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 22 -- + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 23 -- + +Warning: asort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) + +Warning: asort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/array/asort_variation10.phpt b/ext/standard/tests/array/asort_variation10.phpt new file mode 100644 index 0000000..f51945b --- /dev/null +++ b/ext/standard/tests/array/asort_variation10.phpt @@ -0,0 +1,114 @@ +--TEST-- +Test asort() function : usage variations - sort octal values +--FILE-- + 01235, 0321 => 0321, 0345 => 0345, 066 => 066, 0772 => 0772, + 077 => 077, -066 => -066, -0345 => -0345, 0 => 0 +); + +echo "\n-- Testing asort() by supplying octal value array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_oct_array; +var_dump( asort($temp_array) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing asort() by supplying octal value array, 'flag' value is SORT_REGULAR --\n"; +$temp_array = $unsorted_oct_array; +var_dump( asort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing asort() by supplying octal value array, 'flag' value is SORT_NUMERIC --\n"; +$temp_array = $unsorted_oct_array; +var_dump( asort($temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing asort() : usage variations *** + +-- Testing asort() by supplying octal value array, 'flag' value is defualt -- +bool(true) +array(9) { + [-229]=> + int(-229) + [-54]=> + int(-54) + [0]=> + int(0) + [54]=> + int(54) + [63]=> + int(63) + [209]=> + int(209) + [229]=> + int(229) + [506]=> + int(506) + [669]=> + int(669) +} + +-- Testing asort() by supplying octal value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(9) { + [-229]=> + int(-229) + [-54]=> + int(-54) + [0]=> + int(0) + [54]=> + int(54) + [63]=> + int(63) + [209]=> + int(209) + [229]=> + int(229) + [506]=> + int(506) + [669]=> + int(669) +} + +-- Testing asort() by supplying octal value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(9) { + [-229]=> + int(-229) + [-54]=> + int(-54) + [0]=> + int(0) + [54]=> + int(54) + [63]=> + int(63) + [209]=> + int(209) + [229]=> + int(229) + [506]=> + int(506) + [669]=> + int(669) +} +Done diff --git a/ext/standard/tests/array/asort_variation11.phpt b/ext/standard/tests/array/asort_variation11.phpt new file mode 100644 index 0000000..fca91a9 Binary files /dev/null and b/ext/standard/tests/array/asort_variation11.phpt differ diff --git a/ext/standard/tests/array/asort_variation2.phpt b/ext/standard/tests/array/asort_variation2.phpt new file mode 100644 index 0000000..6cce644 --- /dev/null +++ b/ext/standard/tests/array/asort_variation2.phpt @@ -0,0 +1,308 @@ +--TEST-- +Test asort() function : usage variations - unexpected values for 'sort_flags' argument +--FILE-- + 10, 2 => 2, 3 => 45); + +//array of values to iterate over +$unexpected_values = array( + + // int data +/*1*/ -2345, + + // float data +/*2*/ 10.5, + -10.5, + 10.5e2, + 10.6E-2, + .5, + + // null data +/*7*/ NULL, + null, + + // boolean data +/*9*/ true, + false, + TRUE, + FALSE, + + // empty data +/*13*/ "", + '', + + // string data +/*15*/ "string", + 'string', + + // object data +/*16*/ new stdclass(), + + // undefined data +/*17*/ @undefined_var, + + // unset data +/*18*/ @unset_var, + + // resource variable +/*19*/ $fp + +); + +// loop though each element of the array and check the working of asort() +// when $flag arugment is supplied with different values from $unexpected_values +echo "\n-- Testing asort() by supplying different unexpected values for 'sort_flags' argument --\n"; + +$counter = 1; +for($index = 0; $index < count($unexpected_values); $index ++) { + echo "-- Iteration $counter --\n"; + $value = $unexpected_values [$index]; + $temp_array = $unsorted_values; + var_dump( asort($temp_array, $value) ); + var_dump($temp_array); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing asort() : usage variations *** + +-- Testing asort() by supplying different unexpected values for 'sort_flags' argument -- +-- Iteration 1 -- +bool(true) +array(3) { + [2]=> + int(2) + [1]=> + int(10) + [3]=> + int(45) +} +-- Iteration 2 -- +bool(true) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 3 -- +bool(true) +array(3) { + [2]=> + int(2) + [1]=> + int(10) + [3]=> + int(45) +} +-- Iteration 4 -- +bool(true) +array(3) { + [2]=> + int(2) + [1]=> + int(10) + [3]=> + int(45) +} +-- Iteration 5 -- +bool(true) +array(3) { + [2]=> + int(2) + [1]=> + int(10) + [3]=> + int(45) +} +-- Iteration 6 -- +bool(true) +array(3) { + [2]=> + int(2) + [1]=> + int(10) + [3]=> + int(45) +} +-- Iteration 7 -- +bool(true) +array(3) { + [2]=> + int(2) + [1]=> + int(10) + [3]=> + int(45) +} +-- Iteration 8 -- +bool(true) +array(3) { + [2]=> + int(2) + [1]=> + int(10) + [3]=> + int(45) +} +-- Iteration 9 -- +bool(true) +array(3) { + [2]=> + int(2) + [1]=> + int(10) + [3]=> + int(45) +} +-- Iteration 10 -- +bool(true) +array(3) { + [2]=> + int(2) + [1]=> + int(10) + [3]=> + int(45) +} +-- Iteration 11 -- +bool(true) +array(3) { + [2]=> + int(2) + [1]=> + int(10) + [3]=> + int(45) +} +-- Iteration 12 -- +bool(true) +array(3) { + [2]=> + int(2) + [1]=> + int(10) + [3]=> + int(45) +} +-- Iteration 13 -- + +Warning: asort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 14 -- + +Warning: asort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 15 -- + +Warning: asort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 16 -- + +Warning: asort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 17 -- + +Warning: asort() expects parameter 2 to be long, object given in %s on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 18 -- + +Warning: asort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 19 -- + +Warning: asort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +-- Iteration 20 -- + +Warning: asort() expects parameter 2 to be long, resource given in %s on line %d +bool(false) +array(3) { + [1]=> + int(10) + [2]=> + int(2) + [3]=> + int(45) +} +Done diff --git a/ext/standard/tests/array/asort_variation3.phpt b/ext/standard/tests/array/asort_variation3.phpt new file mode 100644 index 0000000..25f40d3 --- /dev/null +++ b/ext/standard/tests/array/asort_variation3.phpt @@ -0,0 +1,326 @@ +--TEST-- +Test asort() function : usage variations - sort integer/float values +--FILE-- + 11, 2 => -11, 3 => 21, 4 => -21, 5 => 31, 6 => -31, 7 => 0, 8 => 41, 10 =>-41), + + // float value array + array(1 => 10.5, 2 => -10.5, 3 => 10.5e2, 4 => 10.6E-2, 5 => .5, 6 => .0001, 7 => -.1), + + // mixed value array + array(1 => .0001, 2 => .0021, 3 => -.01, 4 => -1, 5 => 0, 6 => .09, 7 => 2, 8 => -.9, 9 => 10.6E-2, 10 => -10.6E-2, 11 => 33), + + // array values contains minimum and maximum ranges + array(1 => 2147483647, 2 => 2147483648, 3 => -2147483647, 4 => -2147483648, 5 => -0, 6 => 0, 7 => -2147483649) +); + +// set of possible flag values +$flag_value = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC); + +$count = 1; +echo "\n-- Testing asort() by supplying various integer/float arrays --\n"; + +// loop through to test asort() with different arrays +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With default sort_flag -\n"; + $temp_array = $array; + var_dump(asort($temp_array) ); + var_dump($temp_array); + + // loop through $flag_value array and setting all possible flag values + foreach($flag_value as $key => $flag){ + echo "- Sort_flag = $key -\n"; + $temp_array = $array; + var_dump(asort($temp_array, $flag) ); + var_dump($temp_array); + } + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing asort() : usage variations *** + +-- Testing asort() by supplying various integer/float arrays -- + +-- Iteration 1 -- +- With default sort_flag - +bool(true) +array(9) { + [10]=> + int(-41) + [6]=> + int(-31) + [4]=> + int(-21) + [2]=> + int(-11) + [7]=> + int(0) + [1]=> + int(11) + [3]=> + int(21) + [5]=> + int(31) + [8]=> + int(41) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(9) { + [10]=> + int(-41) + [6]=> + int(-31) + [4]=> + int(-21) + [2]=> + int(-11) + [7]=> + int(0) + [1]=> + int(11) + [3]=> + int(21) + [5]=> + int(31) + [8]=> + int(41) +} +- Sort_flag = SORT_NUMERIC - +bool(true) +array(9) { + [10]=> + int(-41) + [6]=> + int(-31) + [4]=> + int(-21) + [2]=> + int(-11) + [7]=> + int(0) + [1]=> + int(11) + [3]=> + int(21) + [5]=> + int(31) + [8]=> + int(41) +} + +-- Iteration 2 -- +- With default sort_flag - +bool(true) +array(7) { + [2]=> + float(-10.5) + [7]=> + float(-0.1) + [6]=> + float(0.0001) + [4]=> + float(0.106) + [5]=> + float(0.5) + [1]=> + float(10.5) + [3]=> + float(1050) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(7) { + [2]=> + float(-10.5) + [7]=> + float(-0.1) + [6]=> + float(0.0001) + [4]=> + float(0.106) + [5]=> + float(0.5) + [1]=> + float(10.5) + [3]=> + float(1050) +} +- Sort_flag = SORT_NUMERIC - +bool(true) +array(7) { + [2]=> + float(-10.5) + [7]=> + float(-0.1) + [6]=> + float(0.0001) + [4]=> + float(0.106) + [5]=> + float(0.5) + [1]=> + float(10.5) + [3]=> + float(1050) +} + +-- Iteration 3 -- +- With default sort_flag - +bool(true) +array(11) { + [4]=> + int(-1) + [8]=> + float(-0.9) + [10]=> + float(-0.106) + [3]=> + float(-0.01) + [5]=> + int(0) + [1]=> + float(0.0001) + [2]=> + float(0.0021) + [6]=> + float(0.09) + [9]=> + float(0.106) + [7]=> + int(2) + [11]=> + int(33) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(11) { + [4]=> + int(-1) + [8]=> + float(-0.9) + [10]=> + float(-0.106) + [3]=> + float(-0.01) + [5]=> + int(0) + [1]=> + float(0.0001) + [2]=> + float(0.0021) + [6]=> + float(0.09) + [9]=> + float(0.106) + [7]=> + int(2) + [11]=> + int(33) +} +- Sort_flag = SORT_NUMERIC - +bool(true) +array(11) { + [4]=> + int(-1) + [8]=> + float(-0.9) + [10]=> + float(-0.106) + [3]=> + float(-0.01) + [5]=> + int(0) + [1]=> + float(0.0001) + [2]=> + float(0.0021) + [6]=> + float(0.09) + [9]=> + float(0.106) + [7]=> + int(2) + [11]=> + int(33) +} + +-- Iteration 4 -- +- With default sort_flag - +bool(true) +array(7) { + [7]=> + %s(-2147483649) + [4]=> + %s(-2147483648) + [3]=> + int(-2147483647) + [6]=> + int(0) + [5]=> + int(0) + [1]=> + int(2147483647) + [2]=> + %s(2147483648) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(7) { + [7]=> + %s(-2147483649) + [4]=> + %s(-2147483648) + [3]=> + int(-2147483647) + [6]=> + int(0) + [5]=> + int(0) + [1]=> + int(2147483647) + [2]=> + %s(2147483648) +} +- Sort_flag = SORT_NUMERIC - +bool(true) +array(7) { + [7]=> + %s(-2147483649) + [4]=> + %s(-2147483648) + [3]=> + int(-2147483647) + [6]=> + int(0) + [5]=> + int(0) + [1]=> + int(2147483647) + [2]=> + %s(2147483648) +} +Done diff --git a/ext/standard/tests/array/asort_variation4.phpt b/ext/standard/tests/array/asort_variation4.phpt new file mode 100644 index 0000000..9fd7600 --- /dev/null +++ b/ext/standard/tests/array/asort_variation4.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test asort() function : usage variations - sort reference variables +--FILE-- + &$value1 , 2 => &$value2, 3 => &$value3); + +echo "\n-- Testing asort() by supplying reference variable array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_numerics; +var_dump( asort($temp_array) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing asort() by supplying reference variable array, 'flag' = SORT_REGULAR --\n"; +$temp_array = &$unsorted_numerics; +var_dump( asort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing asort() by supplying reference variable array, 'flag' = SORT_NUMERIC --\n"; +$temp_array = &$unsorted_numerics; +var_dump( asort($temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing asort() :usage variations *** + +-- Testing asort() by supplying reference variable array, 'flag' value is defualt -- +bool(true) +array(3) { + [2]=> + &int(33) + [1]=> + &int(100) + [3]=> + &int(555) +} + +-- Testing asort() by supplying reference variable array, 'flag' = SORT_REGULAR -- +bool(true) +array(3) { + [2]=> + &int(33) + [1]=> + &int(100) + [3]=> + &int(555) +} + +-- Testing asort() by supplying reference variable array, 'flag' = SORT_NUMERIC -- +bool(true) +array(3) { + [2]=> + &int(33) + [1]=> + &int(100) + [3]=> + &int(555) +} +Done diff --git a/ext/standard/tests/array/asort_variation5.phpt b/ext/standard/tests/array/asort_variation5.phpt new file mode 100644 index 0000000..3d6a12e --- /dev/null +++ b/ext/standard/tests/array/asort_variation5.phpt @@ -0,0 +1,247 @@ +--TEST-- +Test asort() function : usage variations - sort strings +--SKIPIF-- + null, "NULL" => NULL, "\a" => "\a", "\cx" => "\cx", "\e" => "\e", + "\f" => "\f", "\n" =>"\n", "\r" => "\r", "\t" => "\t", "\xhh" => "\xhh", + "\ddd" => "\ddd", "\v" => "\v" + ), + + // array contains combination of capital/small letters + array ('l' => "lemoN", 'O' => "Orange", 'b' => "banana", 'a' => "apple", 'Te' => "Test", + 'T' => "TTTT", 't' => "ttt", 'w' => "ww", 'x' => "x", 'X' => "X", 'o' => "oraNGe", + 'B' => "BANANA" + ) +); + +$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING); + +$count = 1; +echo "\n-- Testing asort() by supplying various string arrays --\n"; + +// loop through to test asort() with different arrays +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With default sort_flag -\n"; + $temp_array = $array; + var_dump(asort($temp_array) ); // expecting : bool(true) + var_dump($temp_array); + + // loop through $flags array and setting all possible flag values + foreach($flags as $key => $flag){ + echo "- Sort_flag = $key -\n"; + $temp_array = $array; + var_dump(asort($temp_array, $flag) ); // expecting : bool(true) + var_dump($temp_array); + } + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing asort() : usage variations *** + +-- Testing asort() by supplying various string arrays -- + +-- Iteration 1 -- +- With default sort_flag - +bool(true) +array(12) { + ["null"]=> + NULL + ["NULL"]=> + NULL + [" "]=> + string(1) " " + [" +"]=> + string(1) " +" + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [""]=> + string(1) "" + ["\a"]=> + string(2) "\a" + ["\cx"]=> + string(3) "\cx" + ["\ddd"]=> + string(4) "\ddd" + ["\xhh"]=> + string(4) "\xhh" +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(12) { + ["null"]=> + NULL + ["NULL"]=> + NULL + [" "]=> + string(1) " " + [" +"]=> + string(1) " +" + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [""]=> + string(1) "" + ["\a"]=> + string(2) "\a" + ["\cx"]=> + string(3) "\cx" + ["\ddd"]=> + string(4) "\ddd" + ["\xhh"]=> + string(4) "\xhh" +} +- Sort_flag = SORT_STRING - +bool(true) +array(12) { + ["null"]=> + NULL + ["NULL"]=> + NULL + [" "]=> + string(1) " " + [" +"]=> + string(1) " +" + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [""]=> + string(1) "" + ["\a"]=> + string(2) "\a" + ["\cx"]=> + string(3) "\cx" + ["\ddd"]=> + string(4) "\ddd" + ["\xhh"]=> + string(4) "\xhh" +} + +-- Iteration 2 -- +- With default sort_flag - +bool(true) +array(12) { + ["B"]=> + string(6) "BANANA" + ["O"]=> + string(6) "Orange" + ["T"]=> + string(4) "TTTT" + ["Te"]=> + string(4) "Test" + ["X"]=> + string(1) "X" + ["a"]=> + string(5) "apple" + ["b"]=> + string(6) "banana" + ["l"]=> + string(5) "lemoN" + ["o"]=> + string(6) "oraNGe" + ["t"]=> + string(3) "ttt" + ["w"]=> + string(2) "ww" + ["x"]=> + string(1) "x" +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(12) { + ["B"]=> + string(6) "BANANA" + ["O"]=> + string(6) "Orange" + ["T"]=> + string(4) "TTTT" + ["Te"]=> + string(4) "Test" + ["X"]=> + string(1) "X" + ["a"]=> + string(5) "apple" + ["b"]=> + string(6) "banana" + ["l"]=> + string(5) "lemoN" + ["o"]=> + string(6) "oraNGe" + ["t"]=> + string(3) "ttt" + ["w"]=> + string(2) "ww" + ["x"]=> + string(1) "x" +} +- Sort_flag = SORT_STRING - +bool(true) +array(12) { + ["B"]=> + string(6) "BANANA" + ["O"]=> + string(6) "Orange" + ["T"]=> + string(4) "TTTT" + ["Te"]=> + string(4) "Test" + ["X"]=> + string(1) "X" + ["a"]=> + string(5) "apple" + ["b"]=> + string(6) "banana" + ["l"]=> + string(5) "lemoN" + ["o"]=> + string(6) "oraNGe" + ["t"]=> + string(3) "ttt" + ["w"]=> + string(2) "ww" + ["x"]=> + string(1) "x" +} +Done diff --git a/ext/standard/tests/array/asort_variation6.phpt b/ext/standard/tests/array/asort_variation6.phpt new file mode 100644 index 0000000..117f30d --- /dev/null +++ b/ext/standard/tests/array/asort_variation6.phpt @@ -0,0 +1,114 @@ +--TEST-- +Test asort() function : usage variations - sort hexadecimal values +--FILE-- + 0x1AB, 0xFFF => 0xFFF, 0xF => 0xF, 0xFF => 0xFF, 0x2AA => 0x2AA, 0xBB => 0xBB, + 0x1ab => 0x1ab, 0xff => 0xff, -0xff => -0xFF, 0 => 0, -0x2aa => -0x2aa + ); + +echo "\n-- Testing asort() by supplying hexadecimal value array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_hex_array; +var_dump(asort($temp_array) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing asort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --\n"; +$temp_array = $unsorted_hex_array; +var_dump(asort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing asort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --\n"; +$temp_array = $unsorted_hex_array; +var_dump(asort($temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing asort() : usage variations *** + +-- Testing asort() by supplying hexadecimal value array, 'flag' value is defualt -- +bool(true) +array(9) { + [-682]=> + int(-682) + [-255]=> + int(-255) + [0]=> + int(0) + [15]=> + int(15) + [187]=> + int(187) + [255]=> + int(255) + [427]=> + int(427) + [682]=> + int(682) + [4095]=> + int(4095) +} + +-- Testing asort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(9) { + [-682]=> + int(-682) + [-255]=> + int(-255) + [0]=> + int(0) + [15]=> + int(15) + [187]=> + int(187) + [255]=> + int(255) + [427]=> + int(427) + [682]=> + int(682) + [4095]=> + int(4095) +} + +-- Testing asort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(9) { + [-682]=> + int(-682) + [-255]=> + int(-255) + [0]=> + int(0) + [15]=> + int(15) + [187]=> + int(187) + [255]=> + int(255) + [427]=> + int(427) + [682]=> + int(682) + [4095]=> + int(4095) +} +Done diff --git a/ext/standard/tests/array/asort_variation7.phpt b/ext/standard/tests/array/asort_variation7.phpt new file mode 100644 index 0000000..6050b86 --- /dev/null +++ b/ext/standard/tests/array/asort_variation7.phpt @@ -0,0 +1,98 @@ +--TEST-- +Test asort() function : usage variations - sort bool values +--FILE-- + true, 2 => false, 3 => TRUE, 4 => FALSE); + +echo "\n-- Testing asort() by supplying bool value array, 'flag' value is defualt --\n"; +$temp_array = $bool_values; +var_dump(asort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Testing asort() by supplying bool value array, 'flag' value is SORT_REGULAR --\n"; +$temp_array = $bool_values; +var_dump(asort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "\n-- Testing asort() by supplying bool value array, 'flag' value is SORT_NUMERIC --\n"; +$temp_array = $bool_values; +var_dump(asort($temp_array, SORT_NUMERIC) ); +var_dump($temp_array); + +echo "\n-- Testing asort() by supplying bool value array, 'flag' value is SORT_STRING --\n"; +$temp_array = $bool_values; +var_dump(asort($temp_array, SORT_STRING) ); +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing asort() : usage variations *** + +-- Testing asort() by supplying bool value array, 'flag' value is defualt -- +bool(true) +array(4) { + [4]=> + bool(false) + [2]=> + bool(false) + [1]=> + bool(true) + [3]=> + bool(true) +} + +-- Testing asort() by supplying bool value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(4) { + [4]=> + bool(false) + [2]=> + bool(false) + [1]=> + bool(true) + [3]=> + bool(true) +} + +-- Testing asort() by supplying bool value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(4) { + [4]=> + bool(false) + [2]=> + bool(false) + [1]=> + bool(true) + [3]=> + bool(true) +} + +-- Testing asort() by supplying bool value array, 'flag' value is SORT_STRING -- +bool(true) +array(4) { + [4]=> + bool(false) + [2]=> + bool(false) + [1]=> + bool(true) + [3]=> + bool(true) +} +Done diff --git a/ext/standard/tests/array/asort_variation8.phpt b/ext/standard/tests/array/asort_variation8.phpt new file mode 100644 index 0000000..561cc7d --- /dev/null +++ b/ext/standard/tests/array/asort_variation8.phpt @@ -0,0 +1,180 @@ +--TEST-- +Test asort() function : usage variations - sort array with diff. sub arrays, 'sort_flags' as default/SORT_REGULAR +--FILE-- + array(), + + // array contains null sub array + "array[1]" => array( "sub_array[1][0]" => array() ), + + // array of arrays along with some values + "array[2]" => array("data[2,0]" => 44, "data[2,1]" => 11, "sub_array[2][0] " => array(64,61) ), + + // array contains sub arrays + "array[3]" => array ( "sub_array[3][0]" => array(33,-5,6), "sub_array[3][1]" => array(11), + "sub_array[3][2]" => array(22,-55), "sub_array[3][3]" => array() ) +); + + +$count = 1; +echo "\n-- Testing asort() by supplying various arrays containing sub arrays --\n"; + +// loop through to test asort() with different arrays +foreach ($various_arrays as $array) { + + echo "\n-- Iteration $count --\n"; + // testing asort() function by supplying different arrays, flag value is default + echo "- With default sort_flag -\n"; + $temp_array = $array; + var_dump(asort($temp_array) ); + var_dump($temp_array); + + // testing asort() function by supplying different arrays, flag value = SORT_REGULAR + echo "- Sort_flag = SORT_REGULAR -\n"; + $temp_array = $array; + var_dump(asort($temp_array, SORT_REGULAR) ); + var_dump($temp_array); + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing asort() : usage variations *** + +-- Testing asort() by supplying various arrays containing sub arrays -- + +-- Iteration 1 -- +- With default sort_flag - +bool(true) +array(0) { +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(0) { +} + +-- Iteration 2 -- +- With default sort_flag - +bool(true) +array(1) { + ["sub_array[1][0]"]=> + array(0) { + } +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(1) { + ["sub_array[1][0]"]=> + array(0) { + } +} + +-- Iteration 3 -- +- With default sort_flag - +bool(true) +array(3) { + ["data[2,1]"]=> + int(11) + ["data[2,0]"]=> + int(44) + ["sub_array[2][0] "]=> + array(2) { + [0]=> + int(64) + [1]=> + int(61) + } +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(3) { + ["data[2,1]"]=> + int(11) + ["data[2,0]"]=> + int(44) + ["sub_array[2][0] "]=> + array(2) { + [0]=> + int(64) + [1]=> + int(61) + } +} + +-- Iteration 4 -- +- With default sort_flag - +bool(true) +array(4) { + ["sub_array[3][3]"]=> + array(0) { + } + ["sub_array[3][1]"]=> + array(1) { + [0]=> + int(11) + } + ["sub_array[3][2]"]=> + array(2) { + [0]=> + int(22) + [1]=> + int(-55) + } + ["sub_array[3][0]"]=> + array(3) { + [0]=> + int(33) + [1]=> + int(-5) + [2]=> + int(6) + } +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(4) { + ["sub_array[3][3]"]=> + array(0) { + } + ["sub_array[3][1]"]=> + array(1) { + [0]=> + int(11) + } + ["sub_array[3][2]"]=> + array(2) { + [0]=> + int(22) + [1]=> + int(-55) + } + ["sub_array[3][0]"]=> + array(3) { + [0]=> + int(33) + [1]=> + int(-5) + [2]=> + int(6) + } +} +Done diff --git a/ext/standard/tests/array/asort_variation9.phpt b/ext/standard/tests/array/asort_variation9.phpt new file mode 100644 index 0000000..d79b6fc --- /dev/null +++ b/ext/standard/tests/array/asort_variation9.phpt @@ -0,0 +1,258 @@ +--TEST-- +Test asort() function : usage variations - sorting arrays with/without keys, 'sort_flags' as default/SORT_REGULAR +--FILE-- + 55, 66, 22, 33, 11), + array ("a" => "orange", "banana", "c" => "apple"), + array(1, 2, 3, 4, 5, 6), + array("first", 5 => "second", "third"), + array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13), + array('bar' => 'baz', "foo" => 1), + array('a'=>1,'b'=>array('e'=>2,'f'=>3),'c'=>array('g'=>4),'d'=>5), +); + +$count = 1; +echo "\n-- Testing asort() by supplying various arrays with key values --\n"; + +// loop through to test asort() with different arrays, +// to test the new keys for the elements in the sorted array +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With default sort_flag -\n"; + $temp_array = $array; + var_dump(asort($temp_array) ); + var_dump($temp_array); + + echo "- Sort_flag = SORT_REGULAR -\n"; + $temp_array = $array; + var_dump(asort($temp_array, SORT_REGULAR) ); + var_dump($temp_array); + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing asort() : usage variations *** + +-- Testing asort() by supplying various arrays with key values -- + +-- Iteration 1 -- +- With default sort_flag - +bool(true) +array(5) { + [9]=> + int(11) + [7]=> + int(22) + [8]=> + int(33) + [5]=> + int(55) + [6]=> + int(66) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(5) { + [9]=> + int(11) + [7]=> + int(22) + [8]=> + int(33) + [5]=> + int(55) + [6]=> + int(66) +} + +-- Iteration 2 -- +- With default sort_flag - +bool(true) +array(3) { + ["c"]=> + string(5) "apple" + [0]=> + string(6) "banana" + ["a"]=> + string(6) "orange" +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(3) { + ["c"]=> + string(5) "apple" + [0]=> + string(6) "banana" + ["a"]=> + string(6) "orange" +} + +-- Iteration 3 -- +- With default sort_flag - +bool(true) +array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) +} + +-- Iteration 4 -- +- With default sort_flag - +bool(true) +array(3) { + [0]=> + string(5) "first" + [5]=> + string(6) "second" + [6]=> + string(5) "third" +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(3) { + [0]=> + string(5) "first" + [5]=> + string(6) "second" + [6]=> + string(5) "third" +} + +-- Iteration 5 -- +- With default sort_flag - +bool(true) +array(6) { + [4]=> + int(1) + [0]=> + int(1) + [8]=> + int(1) + [1]=> + int(1) + [3]=> + int(13) + [9]=> + int(19) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(6) { + [4]=> + int(1) + [0]=> + int(1) + [8]=> + int(1) + [1]=> + int(1) + [3]=> + int(13) + [9]=> + int(19) +} + +-- Iteration 6 -- +- With default sort_flag - +bool(true) +array(2) { + ["bar"]=> + string(3) "baz" + ["foo"]=> + int(1) +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(2) { + ["bar"]=> + string(3) "baz" + ["foo"]=> + int(1) +} + +-- Iteration 7 -- +- With default sort_flag - +bool(true) +array(4) { + ["a"]=> + int(1) + ["d"]=> + int(5) + ["c"]=> + array(1) { + ["g"]=> + int(4) + } + ["b"]=> + array(2) { + ["e"]=> + int(2) + ["f"]=> + int(3) + } +} +- Sort_flag = SORT_REGULAR - +bool(true) +array(4) { + ["a"]=> + int(1) + ["d"]=> + int(5) + ["c"]=> + array(1) { + ["g"]=> + int(4) + } + ["b"]=> + array(2) { + ["e"]=> + int(2) + ["f"]=> + int(3) + } +} +Done diff --git a/ext/standard/tests/array/bug12776.phpt b/ext/standard/tests/array/bug12776.phpt new file mode 100644 index 0000000..54c6f6f --- /dev/null +++ b/ext/standard/tests/array/bug12776.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #12776 (array_walk crash) +--FILE-- +'v'); +array_walk($arr,'test'); + +print "First value: ".$globalArray[0]; + +print "\nDone\n"; + +?> +--EXPECT-- +val: v; key: k +First value: k +Done diff --git a/ext/standard/tests/array/bug14580.phpt b/ext/standard/tests/array/bug14580.phpt new file mode 100644 index 0000000..bf0121a --- /dev/null +++ b/ext/standard/tests/array/bug14580.phpt @@ -0,0 +1,11 @@ +--TEST--n +Bug #14580 (key() not binary safe) +--FILE-- + b"foo\0bar"); + $key = key($arr); + echo strlen($key), ': '; + echo urlencode($key), "\n"; +?> +--EXPECT-- +7: foo%00bar diff --git a/ext/standard/tests/array/bug20381.phpt b/ext/standard/tests/array/bug20381.phpt new file mode 100644 index 0000000..1adaa86 --- /dev/null +++ b/ext/standard/tests/array/bug20381.phpt @@ -0,0 +1,79 @@ +--TEST-- +Bug #20381 (array_merge_recursive mangles input arrays) +--FILE-- + 1, + 'a2' => array( 1, 2, 3 ), + 'a3' => array( + 'a' => array( 10, 20, 30 ), + 'b' => 'b' + ) + ); +$b = array( 'a1' => 2, + 'a2' => array( 3, 4, 5 ), + 'a3' => array( + 'c' => 'cc', + 'a' => array( 10, 40 ) + ) + ); + +var_dump($a); +array_merge_recursive( $a, $b ); +var_dump($a); +?> +--EXPECT-- +array(3) { + ["a1"]=> + int(1) + ["a2"]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + ["a3"]=> + array(2) { + ["a"]=> + array(3) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + } + ["b"]=> + string(1) "b" + } +} +array(3) { + ["a1"]=> + int(1) + ["a2"]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + ["a3"]=> + array(2) { + ["a"]=> + array(3) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + } + ["b"]=> + string(1) "b" + } +} diff --git a/ext/standard/tests/array/bug20865.phpt b/ext/standard/tests/array/bug20865.phpt new file mode 100644 index 0000000..f1edbab --- /dev/null +++ b/ext/standard/tests/array/bug20865.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #20865 (array_key_exists and NULL key) +--FILE-- + +--EXPECT-- +bool(true) diff --git a/ext/standard/tests/array/bug21182.phpt b/ext/standard/tests/array/bug21182.phpt new file mode 100644 index 0000000..af4602a --- /dev/null +++ b/ext/standard/tests/array/bug21182.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #21182 (range modifies arguments) +--FILE-- + +--EXPECT-- +a1: 20 +a2: 20 : type : string diff --git a/ext/standard/tests/array/bug21918.phpt b/ext/standard/tests/array/bug21918.phpt new file mode 100644 index 0000000..1c9d746 --- /dev/null +++ b/ext/standard/tests/array/bug21918.phpt @@ -0,0 +1,55 @@ +--TEST-- +Bug #21918 (different handling of positive vs. negative array indexes) +--FILE-- +'a', '-2'=>'b', 3=>'c', '4'=>'d', 5=>'e', '6001'=>'f', '07'=>'g'); + +foreach($a as $k => $v) { + var_dump($k); + var_dump($v); +} + +echo "==Normal==\n"; +$b = array(); +$b[] = 'a'; + +foreach($b as $k => $v) { + var_dump($k); + var_dump($v); +} + +echo "==Negative==\n"; +$c = array('-2' => 'a'); + +foreach($c as $k => $v) { + var_dump($k); + var_dump($v); +} + +echo "==Done==\n"; +?> +--EXPECT-- +==Mixed== +int(-1) +string(1) "a" +int(-2) +string(1) "b" +int(3) +string(1) "c" +int(4) +string(1) "d" +int(5) +string(1) "e" +int(6001) +string(1) "f" +string(2) "07" +string(1) "g" +==Normal== +int(0) +string(1) "a" +==Negative== +int(-2) +string(1) "a" +==Done== diff --git a/ext/standard/tests/array/bug21998.phpt b/ext/standard/tests/array/bug21998.phpt new file mode 100644 index 0000000..aa52dc5 --- /dev/null +++ b/ext/standard/tests/array/bug21998.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #21998 (array_pop() does not reset the current array position) +--FILE-- + +--EXPECT-- +int(0) +string(1) "c" +int(0) +string(1) "b" +int(0) +string(1) "a" +NULL diff --git a/ext/standard/tests/array/bug22088.phpt b/ext/standard/tests/array/bug22088.phpt new file mode 100644 index 0000000..4352cff --- /dev/null +++ b/ext/standard/tests/array/bug22088.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #22088 (array_shift() leaves next index to be +1 too much) +--FILE-- + 1, 'b' => 2, 'c' => 3); +$last = array_shift ($a); +$a[] = 'a'; +var_dump($a); + +?> +--EXPECT-- +array(3) { + [0]=> + string(1) "b" + [1]=> + string(1) "c" + [2]=> + string(1) "a" +} +array(3) { + ["b"]=> + int(2) + ["c"]=> + int(3) + [0]=> + string(1) "a" +} diff --git a/ext/standard/tests/array/bug22463.phpt b/ext/standard/tests/array/bug22463.phpt new file mode 100644 index 0000000..dcede51 --- /dev/null +++ b/ext/standard/tests/array/bug22463.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #22463 (array_reduce() segfaults) +--FILE-- + +--EXPECT-- +int(5) diff --git a/ext/standard/tests/array/bug23581.phpt b/ext/standard/tests/array/bug23581.phpt new file mode 100644 index 0000000..06e1e38 --- /dev/null +++ b/ext/standard/tests/array/bug23581.phpt @@ -0,0 +1,44 @@ +--TEST-- +Bug #23581 (array_map(NULL, array, array, ...) yields an undefined result) +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(4) + [2]=> + int(7) + } + [1]=> + array(3) { + [0]=> + int(2) + [1]=> + int(5) + [2]=> + int(8) + } + [2]=> + array(3) { + [0]=> + int(3) + [1]=> + int(6) + [2]=> + int(9) + } +} + diff --git a/ext/standard/tests/array/bug23788.phpt b/ext/standard/tests/array/bug23788.phpt new file mode 100644 index 0000000..022b3ce --- /dev/null +++ b/ext/standard/tests/array/bug23788.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #23788 (*_replace() clobbers referenced array elements) +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + &int(123) + [1]=> + &bool(true) +} +array(2) { + [0]=> + &int(123) + [1]=> + &bool(true) +} diff --git a/ext/standard/tests/array/bug24198.phpt b/ext/standard/tests/array/bug24198.phpt new file mode 100644 index 0000000..b1cd523 --- /dev/null +++ b/ext/standard/tests/array/bug24198.phpt @@ -0,0 +1,25 @@ +--TEST--n +Bug #24198 (array_merge_recursive() invalid recursion detection) +--FILE-- + 'aa','b' => 'bb'); + +var_dump(array_merge_recursive($c, $c)); +?> +--EXPECT-- +array(2) { + ["a"]=> + array(2) { + [0]=> + string(2) "aa" + [1]=> + string(2) "aa" + } + ["b"]=> + array(2) { + [0]=> + string(2) "bb" + [1]=> + string(2) "bb" + } +} diff --git a/ext/standard/tests/array/bug24220.phpt b/ext/standard/tests/array/bug24220.phpt new file mode 100644 index 0000000..c8e2570 --- /dev/null +++ b/ext/standard/tests/array/bug24220.phpt @@ -0,0 +1,91 @@ +--TEST--n +Bug #24220 (range() numeric string handling) +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + int(2003) + [1]=> + int(2004) +} +array(26) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + [3]=> + string(1) "d" + [4]=> + string(1) "e" + [5]=> + string(1) "f" + [6]=> + string(1) "g" + [7]=> + string(1) "h" + [8]=> + string(1) "i" + [9]=> + string(1) "j" + [10]=> + string(1) "k" + [11]=> + string(1) "l" + [12]=> + string(1) "m" + [13]=> + string(1) "n" + [14]=> + string(1) "o" + [15]=> + string(1) "p" + [16]=> + string(1) "q" + [17]=> + string(1) "r" + [18]=> + string(1) "s" + [19]=> + string(1) "t" + [20]=> + string(1) "u" + [21]=> + string(1) "v" + [22]=> + string(1) "w" + [23]=> + string(1) "x" + [24]=> + string(1) "y" + [25]=> + string(1) "z" +} +array(10) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + [9]=> + int(10) +} diff --git a/ext/standard/tests/array/bug24766.phpt b/ext/standard/tests/array/bug24766.phpt new file mode 100644 index 0000000..d6f82f3 --- /dev/null +++ b/ext/standard/tests/array/bug24766.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bug #24766 (strange result array from unpack) +--FILE-- + 18, 2 => 52); +debug_zval_dump($a, $b); +$k = array_keys($a); +$l = array_keys($b); +debug_zval_dump($k, $l); +$i=$k[0]; +var_dump($a[$i]); +$i=$l[0]; +var_dump($b[$i]); +?> +--EXPECT-- +array(2) refcount(2){ + [1]=> + long(18) refcount(1) + [2]=> + long(52) refcount(1) +} +array(2) refcount(2){ + [1]=> + long(18) refcount(1) + [2]=> + long(52) refcount(1) +} +array(2) refcount(2){ + [0]=> + long(1) refcount(1) + [1]=> + long(2) refcount(1) +} +array(2) refcount(2){ + [0]=> + long(1) refcount(1) + [1]=> + long(2) refcount(1) +} +int(18) +int(18) diff --git a/ext/standard/tests/array/bug24897.phpt b/ext/standard/tests/array/bug24897.phpt new file mode 100644 index 0000000..45bcde3 --- /dev/null +++ b/ext/standard/tests/array/bug24897.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #24897 (inconsistent behaviour or shuffle() & array_multisort()) +--FILE-- + 2); +shuffle($a); +var_dump($a); + +$a = array(1 => 2); +array_multisort($a); +var_dump($a); +?> +--EXPECT-- +array(1) { + [0]=> + int(2) +} +array(1) { + [0]=> + int(2) +} diff --git a/ext/standard/tests/array/bug24980.phpt b/ext/standard/tests/array/bug24980.phpt new file mode 100644 index 0000000..b9e04fd --- /dev/null +++ b/ext/standard/tests/array/bug24980.phpt @@ -0,0 +1,53 @@ +--TEST-- +Bug #24980 (array_reduce() uses first element as default running total) +--FILE-- + +--EXPECT-- +running_total is 0, current_value is 2 +running_total is 4, current_value is 3 +running_total is 13, current_value is 5 +running_total is 38, current_value is 7 +Total is 87 +string(3) "abc" +int(15) +int(1200) +int(1) diff --git a/ext/standard/tests/array/bug25359.phpt b/ext/standard/tests/array/bug25359.phpt new file mode 100644 index 0000000..0b9b89a --- /dev/null +++ b/ext/standard/tests/array/bug25359.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #25359 (array_multisort() does not work in a function if array is global or reference) +--FILE-- + +--EXPECT-- +array(5) { + [0]=> + string(5) "first" + [1]=> + string(6) "second" + [2]=> + string(5) "third" + [3]=> + string(5) "forth" + [4]=> + string(5) "fifth" +} diff --git a/ext/standard/tests/array/bug25708.phpt b/ext/standard/tests/array/bug25708.phpt new file mode 100644 index 0000000..d3da3e3 --- /dev/null +++ b/ext/standard/tests/array/bug25708.phpt @@ -0,0 +1,223 @@ +--TEST-- +Bug #25708 (extract($GLOBALS, EXTR_REFS) mangles $GLOBALS) +--FILE-- + +--EXPECT-- +NULL refcount(2) +NULL refcount(2) +long(1) refcount(3) +long(2) refcount(3) +-- +long(1) refcount(1) +long(2) refcount(1) +long(1) refcount(1) +long(2) refcount(1) +-- +long(1) refcount(1) +long(2) refcount(1) +long(1) refcount(1) +long(2) refcount(1) +-- +long(1) refcount(1) +long(3) refcount(1) +long(1) refcount(1) +long(3) refcount(1) +-- +long(4) refcount(1) +long(3) refcount(1) +long(4) refcount(1) +long(3) refcount(1) +-- +long(3) refcount(1) +long(3) refcount(1) +long(3) refcount(2) +-- +long(4) refcount(1) +string(1) "x" refcount(1) +long(4) refcount(1) +string(1) "x" refcount(1) +long(3) refcount(2) +-- +long(1) refcount(2) +long(2) refcount(2) +----a +long(1) refcount(1) +long(2) refcount(1) +long(1) refcount(1) +long(2) refcount(1) +-- +long(1) refcount(1) +long(2) refcount(1) +long(1) refcount(1) +long(2) refcount(1) +-- +long(1) refcount(1) +long(2) refcount(1) +long(1) refcount(1) +long(2) refcount(1) +-- +long(1) refcount(1) +long(3) refcount(1) +long(1) refcount(1) +long(3) refcount(1) +-- +long(4) refcount(1) +long(3) refcount(1) +long(4) refcount(1) +long(3) refcount(1) +-- +long(3) refcount(1) +long(3) refcount(1) +long(3) refcount(2) +-- +long(4) refcount(1) +string(1) "x" refcount(1) +long(4) refcount(1) +string(1) "x" refcount(1) +long(3) refcount(2) +-- +long(1) refcount(2) +long(2) refcount(2) +----ra +NULL refcount(2) +NULL refcount(2) +long(1) refcount(3) +long(2) refcount(3) +-- +long(1) refcount(1) +long(2) refcount(1) +long(1) refcount(1) +long(2) refcount(1) +-- +long(1) refcount(1) +long(2) refcount(1) +long(1) refcount(1) +long(2) refcount(1) +-- +long(1) refcount(1) +long(3) refcount(1) +long(1) refcount(1) +long(3) refcount(1) +-- +long(4) refcount(1) +long(3) refcount(1) +long(4) refcount(1) +long(3) refcount(1) +-- +long(3) refcount(1) +long(3) refcount(1) +long(3) refcount(2) +-- +long(4) refcount(1) +string(1) "x" refcount(1) +long(4) refcount(1) +string(1) "x" refcount(1) +long(3) refcount(2) +-- +long(1) refcount(2) +long(2) refcount(2) +---- +long(1) refcount(1) +long(2) refcount(1) +long(1) refcount(1) +long(2) refcount(1) +-- +long(1) refcount(1) +long(2) refcount(1) +long(1) refcount(1) +long(2) refcount(1) +-- +long(1) refcount(1) +long(2) refcount(1) +long(1) refcount(1) +long(2) refcount(1) +-- +long(1) refcount(1) +long(3) refcount(1) +long(1) refcount(1) +long(3) refcount(1) +-- +long(4) refcount(1) +long(3) refcount(1) +long(4) refcount(1) +long(3) refcount(1) +-- +long(3) refcount(1) +long(3) refcount(1) +long(3) refcount(2) +-- +long(4) refcount(1) +string(1) "x" refcount(1) +long(4) refcount(1) +string(1) "x" refcount(1) +long(3) refcount(2) +-- +long(1) refcount(2) +long(2) refcount(2) +----r +string(2) "ok" refcount(2) +string(2) "ok" refcount(2) diff --git a/ext/standard/tests/array/bug25758.phpt b/ext/standard/tests/array/bug25758.phpt new file mode 100644 index 0000000..ff97d2e --- /dev/null +++ b/ext/standard/tests/array/bug25758.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #25758 (var_export does not escape ' & \ inside array keys) +--FILE-- + array("quote'")); + echo var_export($a, true); +?> +--EXPECT-- +array ( + 'quote\'' => + array ( + 0 => 'quote\'', + ), +) diff --git a/ext/standard/tests/array/bug26458.phpt b/ext/standard/tests/array/bug26458.phpt new file mode 100644 index 0000000..ecd12ba Binary files /dev/null and b/ext/standard/tests/array/bug26458.phpt differ diff --git a/ext/standard/tests/array/bug28739.phpt b/ext/standard/tests/array/bug28739.phpt new file mode 100644 index 0000000..f753097 --- /dev/null +++ b/ext/standard/tests/array/bug28739.phpt @@ -0,0 +1,58 @@ +--TEST-- +Bug #28739 (*diff() and *intersect() not clearing the fci cache before work) +--FILE-- +x=$x;} +} +function a(&$a, &$b){var_dump(__FUNCTION__);return $a->x - $b->x;} +function b(&$a, &$b){var_dump(__FUNCTION__);return $a->x - $b->x;} + +$p1 = array(new p(2), new p(1), new p(0)); +$p2 = array(new p(0), new p(2), new p(3)); + +uasort($p1, 'a'); +print_r($p1); +echo "Now diffing:\n"; +print_r(array_udiff($p1,$p2, 'b')); +?> +--EXPECT-- +string(1) "a" +string(1) "a" +Array +( + [2] => p Object + ( + [x] => 0 + ) + + [1] => p Object + ( + [x] => 1 + ) + + [0] => p Object + ( + [x] => 2 + ) + +) +Now diffing: +string(1) "b" +string(1) "b" +string(1) "b" +string(1) "b" +string(1) "b" +string(1) "b" +string(1) "b" +string(1) "b" +string(1) "b" +Array +( + [1] => p Object + ( + [x] => 1 + ) + +) diff --git a/ext/standard/tests/array/bug28974.phpt b/ext/standard/tests/array/bug28974.phpt new file mode 100644 index 0000000..a2bd86f --- /dev/null +++ b/ext/standard/tests/array/bug28974.phpt @@ -0,0 +1,89 @@ +--TEST-- +Bug #28974 (array_(p)slice() treats large lengths incorrectly - overflow) +--FILE-- + +--EXPECT-- +Array +( + [0] => 0 + [1] => 1 + [2] => 2 + [3] => 3 + [4] => 4 + [5] => 5 +) +Array +( + [0] => 2 + [1] => 3 + [2] => 4 + [3] => 5 +) +Array +( + [0] => 2 + [1] => 3 + [2] => 4 + [3] => 5 +) +print_r(array_splice($a,2,1)); +Array +( + [0] => 2 +) +$a is :Array +( + [0] => 0 + [1] => 1 + [2] => 3 + [3] => 4 + [4] => 5 +) +print_r(array_splice($b,2,2147483645)); +Array +( + [0] => 2 + [1] => 3 + [2] => 4 + [3] => 5 +) +$b is :Array +( + [0] => 0 + [1] => 1 +) +print_r(array_splice($c,2,2147483646)); +Array +( + [0] => 2 + [1] => 3 + [2] => 4 + [3] => 5 +) +$c is :Array +( + [0] => 0 + [1] => 1 +) diff --git a/ext/standard/tests/array/bug29253.phpt b/ext/standard/tests/array/bug29253.phpt new file mode 100644 index 0000000..4be9839 --- /dev/null +++ b/ext/standard/tests/array/bug29253.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #29253 (array_diff with $GLOBALS argument fails) +--FILE-- + +--EXPECTF-- +array(0) { +} +string(4) "afad" diff --git a/ext/standard/tests/array/bug29493.phpt b/ext/standard/tests/array/bug29493.phpt new file mode 100644 index 0000000..0cfe459 --- /dev/null +++ b/ext/standard/tests/array/bug29493.phpt @@ -0,0 +1,115 @@ +--TEST-- +Bug #29493 (extract(EXTR_REFS) fails if array has multiple referrals) +--FILE-- + 'aaa'); + // refcount($a) = 1 + // refcount($a['foo']) = 1 + $b = $a; + // refcount($a) = 2 + // refcount($a['foo']) = 1 + $b['foo'] = 'bbb'; + // refcount($a) = 1 + // refcount($a['foo']) = 1 + + var_dump($a, $b); + + extract($a, EXTR_REFS); + + $foo = 'noo'; + + var_dump($a, $b); +} + +function t2() +{ + $a = array('foo' => 'aaa'); + // refcount($a) = 1 + // refcount($a['foo']) = 1 + $b = &$a; + // refcount($a) = 2 + // is_ref($a) = true + // refcount($a['foo']) = 1 + $b['foo'] = 'bbb'; + // refcount($a) = 2 + // refcount($a['foo']) = 1 + + var_dump($a, $b); + + extract($a, EXTR_REFS); + + $foo = 'noo'; + + var_dump($a, $b); +} + +function t3() +{ + $a = array('foo' => 'aaa'); + // refcount($a) = 1 + // refcount($a['foo']) = 1 + $b = &$a; + // refcount($a) = 2 + // is_ref($a) = true + // refcount($a['foo']) = 1 + unset($b); + // refcount($a) = 1 + // is_ref($a) = true + // refcount($a['foo']) = 1 + + var_dump($a); + + extract($a, EXTR_REFS); + + $foo = 'noo'; + + var_dump($a); +} + +t1(); +t2(); +t3(); +?> +--EXPECT-- +array(1) { + ["foo"]=> + string(3) "aaa" +} +array(1) { + ["foo"]=> + string(3) "bbb" +} +array(1) { + ["foo"]=> + &string(3) "noo" +} +array(1) { + ["foo"]=> + string(3) "bbb" +} +array(1) { + ["foo"]=> + string(3) "bbb" +} +array(1) { + ["foo"]=> + string(3) "bbb" +} +array(1) { + ["foo"]=> + &string(3) "noo" +} +array(1) { + ["foo"]=> + &string(3) "noo" +} +array(1) { + ["foo"]=> + string(3) "aaa" +} +array(1) { + ["foo"]=> + &string(3) "noo" +} diff --git a/ext/standard/tests/array/bug30074.phpt b/ext/standard/tests/array/bug30074.phpt new file mode 100644 index 0000000..7720fe0 --- /dev/null +++ b/ext/standard/tests/array/bug30074.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #30074 (EG(uninitialized_zval_ptr) gets set to reference using EXTR_REFS, affecting later values) +--FILE-- +$undefined), EXTR_REFS); +var_dump(array($a)); +echo "Done\n"; +?> +--EXPECT-- +array(1) { + [0]=> + NULL +} +Done diff --git a/ext/standard/tests/array/bug30266.phpt b/ext/standard/tests/array/bug30266.phpt new file mode 100644 index 0000000..8f7c3d2 --- /dev/null +++ b/ext/standard/tests/array/bug30266.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #30266 (Invalid opcode 137/1/8) and array_walk +--FILE-- +b = $val; + throw new Exception("Error"); + } +} + +$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); + +$myobj = new testc(); + +function test($item2, $key, $userd) +{ + $userd->crash($item2); +} + +try +{ + array_walk($fruits, 'test', $myobj); +} +catch(Exception $e) +{ + echo "Caught: " . $e->getMessage() . "\n"; +} +?> +===DONE=== +--EXPECT-- +Caught: Error +===DONE=== diff --git a/ext/standard/tests/array/bug30833.phpt b/ext/standard/tests/array/bug30833.phpt new file mode 100644 index 0000000..728a659 --- /dev/null +++ b/ext/standard/tests/array/bug30833.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #30833 (array_count_values() modifies input array) +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + string(3) "abc" + [1]=> + string(4) "0000" +} +array(2) { + ["abc"]=> + int(1) + ["0000"]=> + int(1) +} +array(2) { + [0]=> + string(3) "abc" + [1]=> + string(4) "0000" +} +Done diff --git a/ext/standard/tests/array/bug31158.phpt b/ext/standard/tests/array/bug31158.phpt new file mode 100644 index 0000000..e672a10 --- /dev/null +++ b/ext/standard/tests/array/bug31158.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #31158 (array_splice on $GLOBALS crashes) +--FILE-- + +--EXPECTF-- +Notice: Undefined variable: GLOBALS in %sbug31158.php on line 6 +ok + diff --git a/ext/standard/tests/array/bug31213.phpt b/ext/standard/tests/array/bug31213.phpt new file mode 100644 index 0000000..6aa31d5 --- /dev/null +++ b/ext/standard/tests/array/bug31213.phpt @@ -0,0 +1,57 @@ +--TEST-- +Bug #31213 (Sideeffects caused by bug #29493) +--FILE-- + $a, + '_b' => &$b + ); + + var_dump($a, $b); + + if ($use_extract) { + extract($arr, EXTR_REFS); + } else { + $_a = &$arr['_a']; + $_b = &$arr['_b']; + } + + $_a++; + $_b++; + + var_dump($a, $b, $_a, $_b, $arr); +} + +test(false); +test(true); + +?> +--EXPECT-- +int(1) +int(1) +int(1) +int(2) +int(2) +int(2) +array(2) { + ["_a"]=> + &int(2) + ["_b"]=> + &int(2) +} +int(1) +int(1) +int(1) +int(2) +int(2) +int(2) +array(2) { + ["_a"]=> + &int(2) + ["_b"]=> + &int(2) +} diff --git a/ext/standard/tests/array/bug32021.phpt b/ext/standard/tests/array/bug32021.phpt new file mode 100644 index 0000000..5d3b421 --- /dev/null +++ b/ext/standard/tests/array/bug32021.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #32021 (Crash caused by range('', 'z')) +--FILE-- + +ALIVE +--EXPECT-- +array(1) { + [0]=> + int(0) +} +ALIVE diff --git a/ext/standard/tests/array/bug33382.phpt b/ext/standard/tests/array/bug33382.phpt new file mode 100644 index 0000000..e54b984 --- /dev/null +++ b/ext/standard/tests/array/bug33382.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #33382 (array_reverse() fails after *sort() ) +--FILE-- + +--EXPECT-- +array(5) { + [0]=> + int(5) + [1]=> + int(4) + [2]=> + int(3) + [3]=> + int(2) + [4]=> + int(1) +} +Done diff --git a/ext/standard/tests/array/bug33989.phpt b/ext/standard/tests/array/bug33989.phpt new file mode 100644 index 0000000..ccef172 --- /dev/null +++ b/ext/standard/tests/array/bug33989.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #33989 (extract($GLOBALS,EXTR_REFS) crashes PHP) +--FILE-- + +--EXPECT-- +ok diff --git a/ext/standard/tests/array/bug34066.phpt b/ext/standard/tests/array/bug34066.phpt new file mode 100644 index 0000000..31f6b4c --- /dev/null +++ b/ext/standard/tests/array/bug34066.phpt @@ -0,0 +1,804 @@ +--TEST-- +Bug #34066 (recursive array_walk causes segfault) +--FILE-- + "1", + "DocDate" => "19.09.06", + "ReSubmissionDate" => "", + "DocTyp" => "Stapelauftrag", + "CustID" => "00000", + "CustomerAddress" => array( + array( + "Name1" => 'name1', + "Name2" => 'name2', + "Name3" => "", + "City" => 'city', + "Street" => 'street', + "Postal" => 'postcode', + "IATA" => "90", + "Country" => "Deutschland", + "ShortName" => 'short', + "ContactKey" => "", + "EMail" => 'email@example.com', + ) + ), + "Text1" => "", + "Text2" => "", + "Wildcard1" => "", + "Wildcard2" => "", + "Dispatch" => "Paketdienst", + "Weight" => "0,0", + "BillingCustID" => "4300200000", + "ExtDocNr" => "00000000003", + "AnalysisLock" => "", + "PrintFlag" => "", + "FormType" => "0", + "Curr" => "EUR", + "ExChangeRate" => "1,0000", + "WIRRate" => "0", + "OneTimeCustomer" => array( + array( + "BankCode" => "", + "BankAccount" => "" + ) + ), + "Language" => "0", + "PriceGroup" => "1", + "PrFlag" => "0", + "SalesTaxKey" => "1", + "ProceedKey" => "0", + "CustDiscountGroup" => "0", + "Discount" => array( + array( + "FinDisc1" => "0,00", + "Disc1Base" => "145,72", + "Disc1Value" => "0,00", + "FinDisc2" => "0,00", + "Disc2Base" => "145,72", + "Disc2Value" => "0,00", + "FinDisc3" => "0,00", + "Disc3Base" => "145,72", + "Disc3Value" => "0,00", + "ValueSummary" => "0,00" + ) + ), + "Contact" => array( + array( + "Repr" => "999", + "Region" => "99", + "Commission" => "0,00", + "Agent" => "000000" + ) + ), + "Booking" => array( + array( + "CostUnit" => "0000000000", + "CostCentre" => "0000000000", + "AccountingArea"=> "01" + ) + ), + "InvoiceCycleKey" => "0", + "AnalysisKey" => "", + "OrderNumber" => "", + "OrderDate" => "", + "OrderCode" => "", + "DocItems" => array( + "DocItem" => array( + "PosType" => "1", + "ItemRef" => "1002", + "CRef" => "", + "Desc1" => "Prᅵsentation Niederlande per", + "Desc2" => "", + "ArticleGroup" => "102", + "PosTypeVersion" => "E", + "Delivery" => array( + array( + "DelWeek" => "", + "DelDay" => "", + "DelTime" => "" + ) + ), + "PricePu" => "145,72", + "PriceUnit" => "0", + "PriceCalculation" => "0", + "ItemVal" => "145,72", + "InputKey" => "0", + "AveragePurchasePrice" => "0", + "Tax" => array( + array( + "TaxCode" => "00", + "TaxBra" => "000", + "TaxBraAccess" => "0", + "TaxSumIndex" => "0" + ) + ), + "DiscountArticle" => array( + array( + "DiscPC" => "0,00", + "DiscKey" => "1" + ) + ), + "ProceedKeyArticle" => "01", + "ActionKey" => "00", + "ContactCommissionArticle"=> "0,00", + "QuantDependantPriceKey"=> "", + "Quant" => "1", + "QuantUnit" => "", + "Meas" => array( + array( + "Count" => "1", + "Length" => "0,000", + "Width" => "0,000", + "Height" => "0,000" + ) + ), + "DecimalPlace" => "0", + "MultiplierQuant" => "1,000000", + "DifferingQuantUnit" => "", + "DecimalPlaceConversion"=> "0", + "WeightArticle" => array( + array( + "Amount" => "0", + "Unit" => "0" + ) + ), + "Wreath" => "0,000", + "Stock" => "1", + "CostUnitArticle" => "", + "SerialNbKey" => "0", + "TextComplementKey" => "0", + "PartsListPrintKey" => "", + "Prod" => "0000000000" + ) + ), + "Payment" => array( + "PaymentKey" => "0", + "ReminderKey" => "00", + "PayTerms" => array( + array( + "PayTerm" => "1", + "PayDays" => "000", + "CashDiscDays1" => "000", + "CashDiscDays2" => "000", + "CashDiscPer1" => "0,00", + "CashDiscPer2" => "0,00" + ), + array( + "PayTerm" => "2", + "PayDays" => "000", + "CashDiscDays1" => "000", + "CashDiscDays2" => "000", + "CashDiscPer1" => "0,00", + "CashDiscPer2" => "0,00" + ) + ) + ), + "NetAmountByTurnOverTax" => array( + array( + "TurnOverTaxFree" => "145,72", + "TurnOverTax1" => "0,00", + "TurnOverTax2" => "0,00", + "TurnOverTax3" => "0,00", + "TurnOverTax4" => "0,00", + "TurnOverTax5" => "0,00", + "TurnOverTax6" => "0,00", + "TurnOverTax7" => "0,00", + "TurnOverTax8" => "0,00" + ), + ), + "GrossAmount" => "145,72", + "ProceedAmount" => "145,72", + "NetAmountByPayTerm2" => array( + array( + "Sum0" => "0,00", + "Sum1" => "0,00", + "Sum2" => "0,00", + "Sum3" => "0,00", + "Sum4" => "0,00", + "Sum5" => "0,00", + "Sum6" => "0,00", + "Sum7" => "0,00", + "Sum8" => "0,00" + ), + ), + "TaxCodes" => array( + array( + "TaxCode1" => "0", + "TaxCode2" => "0", + "TaxCode3" => "0", + "TaxCode4" => "0", + "TaxCode5" => "0", + "TaxCode6" => "0", + "TaxCode7" => "0", + "TaxCode8" => "0" + ) + ) + ); + $docs = array( + array( + "Version" => "1.0", + "ProducerName" => "xxxxxxxx", + "ProductName" => "Classic Line", + "xmlns" => "x-schema:CL310_DezABFSchema.XML" + ), + "Company" => array( + array( + "MandateNumber" => "111", + "MandateName" => "xxx xxxxxxx-xxxxx xxxxxxx", + "MandateCurr" => "EUR" + ), + ), + "Doc" => $order + ); + + dump2xml($docs); + + +function dump2xml($array) { + // output of this goes through 2xml + array_walk($array, "gen_xml", "/Docs/"); +} +function gen_xml($val, $key, $prefix) +{ + global $xml_fd; + print "gen_xml(prefix=$prefix)\n"; + if (is_array($val)) { + if (preg_match('/^\d+$/', $key)) { + if ($key == 1) { + print substr($prefix, 0, -1) . "\n"; + } + array_walk($val, "gen_xml", "$prefix@"); + } + else { + array_walk($val, "gen_xml", "$prefix$key/"); + } + } + else { + if (strlen($val) > 0) + print "$prefix$key=$val\n"; + else + print "$prefix$key\n"; + } + print "gen_xml(prefix=$prefix) end\n"; +} +echo "Done\n"; +?> +--EXPECTF-- +gen_xml(prefix=/Docs/) +gen_xml(prefix=/Docs/@) +/Docs/@Version=1.0 +gen_xml(prefix=/Docs/@) end +gen_xml(prefix=/Docs/@) +/Docs/@ProducerName=xxxxxxxx +gen_xml(prefix=/Docs/@) end +gen_xml(prefix=/Docs/@) +/Docs/@ProductName=Classic Line +gen_xml(prefix=/Docs/@) end +gen_xml(prefix=/Docs/@) +/Docs/@xmlns=x-schema:CL310_DezABFSchema.XML +gen_xml(prefix=/Docs/@) end +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +gen_xml(prefix=/Docs/Company/) +gen_xml(prefix=/Docs/Company/@) +/Docs/Company/@MandateNumber=111 +gen_xml(prefix=/Docs/Company/@) end +gen_xml(prefix=/Docs/Company/@) +/Docs/Company/@MandateName=xxx xxxxxxx-xxxxx xxxxxxx +gen_xml(prefix=/Docs/Company/@) end +gen_xml(prefix=/Docs/Company/@) +/Docs/Company/@MandateCurr=EUR +gen_xml(prefix=/Docs/Company/@) end +gen_xml(prefix=/Docs/Company/) end +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/DocID=1 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/DocDate=19.09.06 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/ReSubmissionDate +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/DocTyp=Stapelauftrag +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/CustID=00000 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +gen_xml(prefix=/Docs/Doc/CustomerAddress/) +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) +/Docs/Doc/CustomerAddress/@Name1=name1 +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) end +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) +/Docs/Doc/CustomerAddress/@Name2=name2 +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) end +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) +/Docs/Doc/CustomerAddress/@Name3 +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) end +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) +/Docs/Doc/CustomerAddress/@City=city +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) end +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) +/Docs/Doc/CustomerAddress/@Street=street +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) end +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) +/Docs/Doc/CustomerAddress/@Postal=postcode +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) end +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) +/Docs/Doc/CustomerAddress/@IATA=90 +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) end +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) +/Docs/Doc/CustomerAddress/@Country=Deutschland +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) end +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) +/Docs/Doc/CustomerAddress/@ShortName=short +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) end +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) +/Docs/Doc/CustomerAddress/@ContactKey +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) end +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) +/Docs/Doc/CustomerAddress/@EMail=email@example.com +gen_xml(prefix=/Docs/Doc/CustomerAddress/@) end +gen_xml(prefix=/Docs/Doc/CustomerAddress/) end +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/Text1 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/Text2 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/Wildcard1 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/Wildcard2 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/Dispatch=Paketdienst +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/Weight=0,0 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/BillingCustID=4300200000 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/ExtDocNr=00000000003 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/AnalysisLock +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/PrintFlag +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/FormType=0 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/Curr=EUR +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/ExChangeRate=1,0000 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/WIRRate=0 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +gen_xml(prefix=/Docs/Doc/OneTimeCustomer/) +gen_xml(prefix=/Docs/Doc/OneTimeCustomer/@) +/Docs/Doc/OneTimeCustomer/@BankCode +gen_xml(prefix=/Docs/Doc/OneTimeCustomer/@) end +gen_xml(prefix=/Docs/Doc/OneTimeCustomer/@) +/Docs/Doc/OneTimeCustomer/@BankAccount +gen_xml(prefix=/Docs/Doc/OneTimeCustomer/@) end +gen_xml(prefix=/Docs/Doc/OneTimeCustomer/) end +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/Language=0 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/PriceGroup=1 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/PrFlag=0 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/SalesTaxKey=1 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/ProceedKey=0 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/CustDiscountGroup=0 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +gen_xml(prefix=/Docs/Doc/Discount/) +gen_xml(prefix=/Docs/Doc/Discount/@) +/Docs/Doc/Discount/@FinDisc1=0,00 +gen_xml(prefix=/Docs/Doc/Discount/@) end +gen_xml(prefix=/Docs/Doc/Discount/@) +/Docs/Doc/Discount/@Disc1Base=145,72 +gen_xml(prefix=/Docs/Doc/Discount/@) end +gen_xml(prefix=/Docs/Doc/Discount/@) +/Docs/Doc/Discount/@Disc1Value=0,00 +gen_xml(prefix=/Docs/Doc/Discount/@) end +gen_xml(prefix=/Docs/Doc/Discount/@) +/Docs/Doc/Discount/@FinDisc2=0,00 +gen_xml(prefix=/Docs/Doc/Discount/@) end +gen_xml(prefix=/Docs/Doc/Discount/@) +/Docs/Doc/Discount/@Disc2Base=145,72 +gen_xml(prefix=/Docs/Doc/Discount/@) end +gen_xml(prefix=/Docs/Doc/Discount/@) +/Docs/Doc/Discount/@Disc2Value=0,00 +gen_xml(prefix=/Docs/Doc/Discount/@) end +gen_xml(prefix=/Docs/Doc/Discount/@) +/Docs/Doc/Discount/@FinDisc3=0,00 +gen_xml(prefix=/Docs/Doc/Discount/@) end +gen_xml(prefix=/Docs/Doc/Discount/@) +/Docs/Doc/Discount/@Disc3Base=145,72 +gen_xml(prefix=/Docs/Doc/Discount/@) end +gen_xml(prefix=/Docs/Doc/Discount/@) +/Docs/Doc/Discount/@Disc3Value=0,00 +gen_xml(prefix=/Docs/Doc/Discount/@) end +gen_xml(prefix=/Docs/Doc/Discount/@) +/Docs/Doc/Discount/@ValueSummary=0,00 +gen_xml(prefix=/Docs/Doc/Discount/@) end +gen_xml(prefix=/Docs/Doc/Discount/) end +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +gen_xml(prefix=/Docs/Doc/Contact/) +gen_xml(prefix=/Docs/Doc/Contact/@) +/Docs/Doc/Contact/@Repr=999 +gen_xml(prefix=/Docs/Doc/Contact/@) end +gen_xml(prefix=/Docs/Doc/Contact/@) +/Docs/Doc/Contact/@Region=99 +gen_xml(prefix=/Docs/Doc/Contact/@) end +gen_xml(prefix=/Docs/Doc/Contact/@) +/Docs/Doc/Contact/@Commission=0,00 +gen_xml(prefix=/Docs/Doc/Contact/@) end +gen_xml(prefix=/Docs/Doc/Contact/@) +/Docs/Doc/Contact/@Agent=000000 +gen_xml(prefix=/Docs/Doc/Contact/@) end +gen_xml(prefix=/Docs/Doc/Contact/) end +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +gen_xml(prefix=/Docs/Doc/Booking/) +gen_xml(prefix=/Docs/Doc/Booking/@) +/Docs/Doc/Booking/@CostUnit=0000000000 +gen_xml(prefix=/Docs/Doc/Booking/@) end +gen_xml(prefix=/Docs/Doc/Booking/@) +/Docs/Doc/Booking/@CostCentre=0000000000 +gen_xml(prefix=/Docs/Doc/Booking/@) end +gen_xml(prefix=/Docs/Doc/Booking/@) +/Docs/Doc/Booking/@AccountingArea=01 +gen_xml(prefix=/Docs/Doc/Booking/@) end +gen_xml(prefix=/Docs/Doc/Booking/) end +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/InvoiceCycleKey=0 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/AnalysisKey +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/OrderNumber +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/OrderDate +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/OrderCode +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +gen_xml(prefix=/Docs/Doc/DocItems/) +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/PosType=1 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/ItemRef=1002 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/CRef +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/Desc1=Prᅵsentation Niederlande per +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/Desc2 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/ArticleGroup=102 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/PosTypeVersion=E +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Delivery/) +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Delivery/@) +/Docs/Doc/DocItems/DocItem/Delivery/@DelWeek +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Delivery/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Delivery/@) +/Docs/Doc/DocItems/DocItem/Delivery/@DelDay +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Delivery/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Delivery/@) +/Docs/Doc/DocItems/DocItem/Delivery/@DelTime +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Delivery/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Delivery/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/PricePu=145,72 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/PriceUnit=0 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/PriceCalculation=0 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/ItemVal=145,72 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/InputKey=0 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/AveragePurchasePrice=0 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Tax/) +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Tax/@) +/Docs/Doc/DocItems/DocItem/Tax/@TaxCode=00 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Tax/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Tax/@) +/Docs/Doc/DocItems/DocItem/Tax/@TaxBra=000 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Tax/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Tax/@) +/Docs/Doc/DocItems/DocItem/Tax/@TaxBraAccess=0 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Tax/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Tax/@) +/Docs/Doc/DocItems/DocItem/Tax/@TaxSumIndex=0 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Tax/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Tax/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/DiscountArticle/) +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/DiscountArticle/@) +/Docs/Doc/DocItems/DocItem/DiscountArticle/@DiscPC=0,00 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/DiscountArticle/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/DiscountArticle/@) +/Docs/Doc/DocItems/DocItem/DiscountArticle/@DiscKey=1 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/DiscountArticle/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/DiscountArticle/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/ProceedKeyArticle=01 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/ActionKey=00 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/ContactCommissionArticle=0,00 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/QuantDependantPriceKey +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/Quant=1 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/QuantUnit +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Meas/) +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Meas/@) +/Docs/Doc/DocItems/DocItem/Meas/@Count=1 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Meas/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Meas/@) +/Docs/Doc/DocItems/DocItem/Meas/@Length=0,000 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Meas/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Meas/@) +/Docs/Doc/DocItems/DocItem/Meas/@Width=0,000 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Meas/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Meas/@) +/Docs/Doc/DocItems/DocItem/Meas/@Height=0,000 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Meas/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/Meas/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/DecimalPlace=0 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/MultiplierQuant=1,000000 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/DifferingQuantUnit +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/DecimalPlaceConversion=0 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/WeightArticle/) +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/WeightArticle/@) +/Docs/Doc/DocItems/DocItem/WeightArticle/@Amount=0 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/WeightArticle/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/WeightArticle/@) +/Docs/Doc/DocItems/DocItem/WeightArticle/@Unit=0 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/WeightArticle/@) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/WeightArticle/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/Wreath=0,000 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/Stock=1 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/CostUnitArticle +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/SerialNbKey=0 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/TextComplementKey=0 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/PartsListPrintKey +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) +/Docs/Doc/DocItems/DocItem/Prod=0000000000 +gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end +gen_xml(prefix=/Docs/Doc/DocItems/) end +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +gen_xml(prefix=/Docs/Doc/Payment/) +/Docs/Doc/Payment/PaymentKey=0 +gen_xml(prefix=/Docs/Doc/Payment/) end +gen_xml(prefix=/Docs/Doc/Payment/) +/Docs/Doc/Payment/ReminderKey=00 +gen_xml(prefix=/Docs/Doc/Payment/) end +gen_xml(prefix=/Docs/Doc/Payment/) +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/) +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) +/Docs/Doc/Payment/PayTerms/@PayTerm=1 +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) end +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) +/Docs/Doc/Payment/PayTerms/@PayDays=000 +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) end +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) +/Docs/Doc/Payment/PayTerms/@CashDiscDays1=000 +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) end +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) +/Docs/Doc/Payment/PayTerms/@CashDiscDays2=000 +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) end +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) +/Docs/Doc/Payment/PayTerms/@CashDiscPer1=0,00 +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) end +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) +/Docs/Doc/Payment/PayTerms/@CashDiscPer2=0,00 +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) end +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/) end +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/) +/Docs/Doc/Payment/PayTerms +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) +/Docs/Doc/Payment/PayTerms/@PayTerm=2 +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) end +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) +/Docs/Doc/Payment/PayTerms/@PayDays=000 +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) end +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) +/Docs/Doc/Payment/PayTerms/@CashDiscDays1=000 +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) end +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) +/Docs/Doc/Payment/PayTerms/@CashDiscDays2=000 +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) end +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) +/Docs/Doc/Payment/PayTerms/@CashDiscPer1=0,00 +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) end +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) +/Docs/Doc/Payment/PayTerms/@CashDiscPer2=0,00 +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/@) end +gen_xml(prefix=/Docs/Doc/Payment/PayTerms/) end +gen_xml(prefix=/Docs/Doc/Payment/) end +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/) +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) +/Docs/Doc/NetAmountByTurnOverTax/@TurnOverTaxFree=145,72 +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) +/Docs/Doc/NetAmountByTurnOverTax/@TurnOverTax1=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) +/Docs/Doc/NetAmountByTurnOverTax/@TurnOverTax2=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) +/Docs/Doc/NetAmountByTurnOverTax/@TurnOverTax3=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) +/Docs/Doc/NetAmountByTurnOverTax/@TurnOverTax4=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) +/Docs/Doc/NetAmountByTurnOverTax/@TurnOverTax5=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) +/Docs/Doc/NetAmountByTurnOverTax/@TurnOverTax6=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) +/Docs/Doc/NetAmountByTurnOverTax/@TurnOverTax7=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) +/Docs/Doc/NetAmountByTurnOverTax/@TurnOverTax8=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByTurnOverTax/) end +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/GrossAmount=145,72 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +/Docs/Doc/ProceedAmount=145,72 +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/) +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) +/Docs/Doc/NetAmountByPayTerm2/@Sum0=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) +/Docs/Doc/NetAmountByPayTerm2/@Sum1=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) +/Docs/Doc/NetAmountByPayTerm2/@Sum2=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) +/Docs/Doc/NetAmountByPayTerm2/@Sum3=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) +/Docs/Doc/NetAmountByPayTerm2/@Sum4=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) +/Docs/Doc/NetAmountByPayTerm2/@Sum5=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) +/Docs/Doc/NetAmountByPayTerm2/@Sum6=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) +/Docs/Doc/NetAmountByPayTerm2/@Sum7=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) +/Docs/Doc/NetAmountByPayTerm2/@Sum8=0,00 +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/@) end +gen_xml(prefix=/Docs/Doc/NetAmountByPayTerm2/) end +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/Doc/) +gen_xml(prefix=/Docs/Doc/TaxCodes/) +gen_xml(prefix=/Docs/Doc/TaxCodes/@) +/Docs/Doc/TaxCodes/@TaxCode1=0 +gen_xml(prefix=/Docs/Doc/TaxCodes/@) end +gen_xml(prefix=/Docs/Doc/TaxCodes/@) +/Docs/Doc/TaxCodes/@TaxCode2=0 +gen_xml(prefix=/Docs/Doc/TaxCodes/@) end +gen_xml(prefix=/Docs/Doc/TaxCodes/@) +/Docs/Doc/TaxCodes/@TaxCode3=0 +gen_xml(prefix=/Docs/Doc/TaxCodes/@) end +gen_xml(prefix=/Docs/Doc/TaxCodes/@) +/Docs/Doc/TaxCodes/@TaxCode4=0 +gen_xml(prefix=/Docs/Doc/TaxCodes/@) end +gen_xml(prefix=/Docs/Doc/TaxCodes/@) +/Docs/Doc/TaxCodes/@TaxCode5=0 +gen_xml(prefix=/Docs/Doc/TaxCodes/@) end +gen_xml(prefix=/Docs/Doc/TaxCodes/@) +/Docs/Doc/TaxCodes/@TaxCode6=0 +gen_xml(prefix=/Docs/Doc/TaxCodes/@) end +gen_xml(prefix=/Docs/Doc/TaxCodes/@) +/Docs/Doc/TaxCodes/@TaxCode7=0 +gen_xml(prefix=/Docs/Doc/TaxCodes/@) end +gen_xml(prefix=/Docs/Doc/TaxCodes/@) +/Docs/Doc/TaxCodes/@TaxCode8=0 +gen_xml(prefix=/Docs/Doc/TaxCodes/@) end +gen_xml(prefix=/Docs/Doc/TaxCodes/) end +gen_xml(prefix=/Docs/Doc/) end +gen_xml(prefix=/Docs/) end +Done diff --git a/ext/standard/tests/array/bug34066_1.phpt b/ext/standard/tests/array/bug34066_1.phpt new file mode 100644 index 0000000..edc16ef --- /dev/null +++ b/ext/standard/tests/array/bug34066_1.phpt @@ -0,0 +1,731 @@ +--TEST-- +Bug #34066 (recursive array_walk causes segfault) +--FILE-- + "1", + "DocDate" => "19.09.06", + "ReSubmissionDate" => "", + "DocTyp" => "Stapelauftrag", + "CustID" => "00000", + "CustomerAddress" => array( + array( + "Name1" => 'name1', + "Name2" => 'name2', + "Name3" => "", + "City" => 'city', + "Street" => 'street', + "Postal" => 'postcode', + "IATA" => "90", + "Country" => "Deutschland", + "ShortName" => 'short', + "ContactKey" => "", + "EMail" => 'email@example.com', + ) + ), + "Text1" => "", + "Text2" => "", + "Wildcard1" => "", + "Wildcard2" => "", + "Dispatch" => "Paketdienst", + "Weight" => "0,0", + "BillingCustID" => "4300200000", + "ExtDocNr" => "00000000003", + "AnalysisLock" => "", + "PrintFlag" => "", + "FormType" => "0", + "Curr" => "EUR", + "ExChangeRate" => "1,0000", + "WIRRate" => "0", + "OneTimeCustomer" => array( + array( + "BankCode" => "", + "BankAccount" => "" + ) + ), + "Language" => "0", + "PriceGroup" => "1", + "PrFlag" => "0", + "SalesTaxKey" => "1", + "ProceedKey" => "0", + "CustDiscountGroup" => "0", + "Discount" => array( + array( + "FinDisc1" => "0,00", + "Disc1Base" => "145,72", + "Disc1Value" => "0,00", + "FinDisc2" => "0,00", + "Disc2Base" => "145,72", + "Disc2Value" => "0,00", + "FinDisc3" => "0,00", + "Disc3Base" => "145,72", + "Disc3Value" => "0,00", + "ValueSummary" => "0,00" + ) + ), + "Contact" => array( + array( + "Repr" => "999", + "Region" => "99", + "Commission" => "0,00", + "Agent" => "000000" + ) + ), + "Booking" => array( + array( + "CostUnit" => "0000000000", + "CostCentre" => "0000000000", + "AccountingArea"=> "01" + ) + ), + "InvoiceCycleKey" => "0", + "AnalysisKey" => "", + "OrderNumber" => "", + "OrderDate" => "", + "OrderCode" => "", + "DocItems" => array( + "DocItem" => array( + "PosType" => "1", + "ItemRef" => "1002", + "CRef" => "", + "Desc1" => "Prᅵsentation Niederlande per", + "Desc2" => "", + "ArticleGroup" => "102", + "PosTypeVersion" => "E", + "Delivery" => array( + array( + "DelWeek" => "", + "DelDay" => "", + "DelTime" => "" + ) + ), + "PricePu" => "145,72", + "PriceUnit" => "0", + "PriceCalculation" => "0", + "ItemVal" => "145,72", + "InputKey" => "0", + "AveragePurchasePrice" => "0", + "Tax" => array( + array( + "TaxCode" => "00", + "TaxBra" => "000", + "TaxBraAccess" => "0", + "TaxSumIndex" => "0" + ) + ), + "DiscountArticle" => array( + array( + "DiscPC" => "0,00", + "DiscKey" => "1" + ) + ), + "ProceedKeyArticle" => "01", + "ActionKey" => "00", + "ContactCommissionArticle"=> "0,00", + "QuantDependantPriceKey"=> "", + "Quant" => "1", + "QuantUnit" => "", + "Meas" => array( + array( + "Count" => "1", + "Length" => "0,000", + "Width" => "0,000", + "Height" => "0,000" + ) + ), + "DecimalPlace" => "0", + "MultiplierQuant" => "1,000000", + "DifferingQuantUnit" => "", + "DecimalPlaceConversion"=> "0", + "WeightArticle" => array( + array( + "Amount" => "0", + "Unit" => "0" + ) + ), + "Wreath" => "0,000", + "Stock" => "1", + "CostUnitArticle" => "", + "SerialNbKey" => "0", + "TextComplementKey" => "0", + "PartsListPrintKey" => "", + "Prod" => "0000000000" + ) + ), + "Payment" => array( + "PaymentKey" => "0", + "ReminderKey" => "00", + "PayTerms" => array( + array( + "PayTerm" => "1", + "PayDays" => "000", + "CashDiscDays1" => "000", + "CashDiscDays2" => "000", + "CashDiscPer1" => "0,00", + "CashDiscPer2" => "0,00" + ), + array( + "PayTerm" => "2", + "PayDays" => "000", + "CashDiscDays1" => "000", + "CashDiscDays2" => "000", + "CashDiscPer1" => "0,00", + "CashDiscPer2" => "0,00" + ) + ) + ), + "NetAmountByTurnOverTax" => array( + array( + "TurnOverTaxFree" => "145,72", + "TurnOverTax1" => "0,00", + "TurnOverTax2" => "0,00", + "TurnOverTax3" => "0,00", + "TurnOverTax4" => "0,00", + "TurnOverTax5" => "0,00", + "TurnOverTax6" => "0,00", + "TurnOverTax7" => "0,00", + "TurnOverTax8" => "0,00" + ), + ), + "GrossAmount" => "145,72", + "ProceedAmount" => "145,72", + "NetAmountByPayTerm2" => array( + array( + "Sum0" => "0,00", + "Sum1" => "0,00", + "Sum2" => "0,00", + "Sum3" => "0,00", + "Sum4" => "0,00", + "Sum5" => "0,00", + "Sum6" => "0,00", + "Sum7" => "0,00", + "Sum8" => "0,00" + ), + ), + "TaxCodes" => array( + array( + "TaxCode1" => "0", + "TaxCode2" => "0", + "TaxCode3" => "0", + "TaxCode4" => "0", + "TaxCode5" => "0", + "TaxCode6" => "0", + "TaxCode7" => "0", + "TaxCode8" => "0" + ) + ) + ); + $docs = array( + array( + "Version" => "1.0", + "ProducerName" => "xxxxxxxx", + "ProductName" => "Classic Line", + "xmlns" => "x-schema:CL310_DezABFSchema.XML" + ), + "Company" => array( + array( + "MandateNumber" => "111", + "MandateName" => "xxx xxxxxxx-xxxxx xxxxxxx", + "MandateCurr" => "EUR" + ), + ), + "Doc" => $order + ); + + dump2xml($docs); + + +function dump2xml($array) { + // output of this goes through 2xml + array_walk_recursive($array, "gen_xml", "/Docs/"); +} +function gen_xml($val, $key, $prefix) +{ + global $xml_fd; + print "gen_xml(prefix=$prefix)\n"; + if (is_array($val)) { + if (preg_match('/^\d+$/', $key)) { + if ($key == 1) { + print substr($prefix, 0, -1) . "\n"; + } + array_walk_recursive($val, "gen_xml", "$prefix@"); + } + else { + array_walk_recursive($val, "gen_xml", "$prefix$key/"); + } + } + else { + if (strlen($val) > 0) + print "$prefix$key=$val\n"; + else + print "$prefix$key\n"; + } + print "gen_xml(prefix=$prefix) end\n"; +} +echo "Done\n"; +?> +--EXPECTF-- +gen_xml(prefix=/Docs/) +/Docs/Version=1.0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ProducerName=xxxxxxxx +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ProductName=Classic Line +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/xmlns=x-schema:CL310_DezABFSchema.XML +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/MandateNumber=111 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/MandateName=xxx xxxxxxx-xxxxx xxxxxxx +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/MandateCurr=EUR +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/DocID=1 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/DocDate=19.09.06 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ReSubmissionDate +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/DocTyp=Stapelauftrag +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/CustID=00000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Name1=name1 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Name2=name2 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Name3 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/City=city +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Street=street +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Postal=postcode +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/IATA=90 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Country=Deutschland +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ShortName=short +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ContactKey +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/EMail=email@example.com +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Text1 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Text2 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Wildcard1 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Wildcard2 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Dispatch=Paketdienst +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Weight=0,0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/BillingCustID=4300200000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ExtDocNr=00000000003 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/AnalysisLock +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/PrintFlag +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/FormType=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Curr=EUR +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ExChangeRate=1,0000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/WIRRate=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/BankCode +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/BankAccount +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Language=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/PriceGroup=1 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/PrFlag=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/SalesTaxKey=1 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ProceedKey=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/CustDiscountGroup=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/FinDisc1=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Disc1Base=145,72 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Disc1Value=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/FinDisc2=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Disc2Base=145,72 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Disc2Value=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/FinDisc3=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Disc3Base=145,72 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Disc3Value=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ValueSummary=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Repr=999 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Region=99 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Commission=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Agent=000000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/CostUnit=0000000000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/CostCentre=0000000000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/AccountingArea=01 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/InvoiceCycleKey=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/AnalysisKey +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/OrderNumber +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/OrderDate +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/OrderCode +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/PosType=1 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ItemRef=1002 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/CRef +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Desc1=Prᅵsentation Niederlande per +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Desc2 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ArticleGroup=102 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/PosTypeVersion=E +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/DelWeek +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/DelDay +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/DelTime +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/PricePu=145,72 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/PriceUnit=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/PriceCalculation=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ItemVal=145,72 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/InputKey=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/AveragePurchasePrice=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TaxCode=00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TaxBra=000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TaxBraAccess=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TaxSumIndex=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/DiscPC=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/DiscKey=1 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ProceedKeyArticle=01 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ActionKey=00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ContactCommissionArticle=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/QuantDependantPriceKey +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Quant=1 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/QuantUnit +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Count=1 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Length=0,000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Width=0,000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Height=0,000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/DecimalPlace=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/MultiplierQuant=1,000000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/DifferingQuantUnit +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/DecimalPlaceConversion=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Amount=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Unit=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Wreath=0,000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Stock=1 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/CostUnitArticle +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/SerialNbKey=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TextComplementKey=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/PartsListPrintKey +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Prod=0000000000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/PaymentKey=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ReminderKey=00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/PayTerm=1 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/PayDays=000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/CashDiscDays1=000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/CashDiscDays2=000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/CashDiscPer1=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/CashDiscPer2=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/PayTerm=2 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/PayDays=000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/CashDiscDays1=000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/CashDiscDays2=000 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/CashDiscPer1=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/CashDiscPer2=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TurnOverTaxFree=145,72 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TurnOverTax1=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TurnOverTax2=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TurnOverTax3=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TurnOverTax4=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TurnOverTax5=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TurnOverTax6=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TurnOverTax7=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TurnOverTax8=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/GrossAmount=145,72 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/ProceedAmount=145,72 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Sum0=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Sum1=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Sum2=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Sum3=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Sum4=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Sum5=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Sum6=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Sum7=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/Sum8=0,00 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TaxCode1=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TaxCode2=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TaxCode3=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TaxCode4=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TaxCode5=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TaxCode6=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TaxCode7=0 +gen_xml(prefix=/Docs/) end +gen_xml(prefix=/Docs/) +/Docs/TaxCode8=0 +gen_xml(prefix=/Docs/) end +Done diff --git a/ext/standard/tests/array/bug34227.phpt b/ext/standard/tests/array/bug34227.phpt new file mode 100644 index 0000000..29762b7 --- /dev/null +++ b/ext/standard/tests/array/bug34227.phpt @@ -0,0 +1,100 @@ +--TEST-- +Bug #34277 (array_filter() crashes with references and objects) +--FILE-- +m2(); + } + + function m2() + { + $this->m3(); + } + + function m3() + { + $this->m4(); + } + + function m4() + { + $this->m5(); + } + + function m5() + { + $this->m6(); + } + + function m6() + { + $this->m7(); + } + + function m7() + { + $this->m8(); + } + + function m8() + { + $this->m9(); + } + + function m9() + { + $this->m10(); + } + + function m10() + { + $this->m11(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + } + + function m11($a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $a10) + { + $arr = explode('a', 'b'); + } +} + +function f($str) +{ + $obj = new C; + $obj->m1(); + return TRUE; +} + +function p5($a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $a10, $a11, $a12) +{ + $ret = array_filter(array(0), 'f'); +} + +function p4() +{ + p5(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); +} + +function p3() +{ + p4(); +} + +function p2() +{ + p3(); +} + +function p1() +{ + p2(); +} + +p1(); +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/ext/standard/tests/array/bug34982.phpt b/ext/standard/tests/array/bug34982.phpt new file mode 100644 index 0000000..7499667 --- /dev/null +++ b/ext/standard/tests/array/bug34982.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #34982 (array_walk_recursive() modifies elements outside function scope) +--FILE-- + +--EXPECT-- +Array +( + [0] => changed + [1] => Array + ( + [0] => changed + ) + +) +Array +( + [0] => element 1 + [1] => Array + ( + [0] => subelement1 + ) + +) diff --git a/ext/standard/tests/array/bug35014.phpt b/ext/standard/tests/array/bug35014.phpt new file mode 100644 index 0000000..9250c03 --- /dev/null +++ b/ext/standard/tests/array/bug35014.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #35014 (array_product() always returns 0) (32bit) +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +Warning: array_product() expects parameter 1 to be array, string given in %s on line %d +NULL +int(1) +int(0) +int(3) +int(9) +float(1) +float(9.9999998E+15) +float(2.8404260053903E+20) +float(8589934590) diff --git a/ext/standard/tests/array/bug35014_64bit.phpt b/ext/standard/tests/array/bug35014_64bit.phpt new file mode 100644 index 0000000..efd791a --- /dev/null +++ b/ext/standard/tests/array/bug35014_64bit.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #35014 (array_product() always returns 0) (64bit) +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +Warning: array_product() expects parameter 1 to be array, string given in %s on line %d +NULL +int(1) +int(0) +int(3) +int(9) +float(1) +int(9999999800000001) +float(1.219953680145E+30) +float(3.6893488147419E+19) diff --git a/ext/standard/tests/array/bug35022.phpt b/ext/standard/tests/array/bug35022.phpt new file mode 100644 index 0000000..e3f5386 --- /dev/null +++ b/ext/standard/tests/array/bug35022.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #35022 (Regression in the behavior of key/current functions) +--FILE-- + 1, "two" => 2, "three" => 3); +function foo( &$state ) { + $contentDict = end( $state ); + for ( $contentDict = end( $state ); $contentDict !== false; $contentDict = prev( $state ) ) { + echo key($state) . " => " . current($state) . "\n"; + } +} +foo($state); +reset($state); +var_dump( key($state), current($state) ); +?> +--EXPECT-- +three => 3 +two => 2 +one => 1 +string(3) "one" +int(1) diff --git a/ext/standard/tests/array/bug35821.phpt b/ext/standard/tests/array/bug35821.phpt new file mode 100644 index 0000000..05140d0 --- /dev/null +++ b/ext/standard/tests/array/bug35821.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #35821 (array_map() segfaults when exception is throwed from the callback) +--FILE-- +ThrowException(); + } +} + +$arr = array(new Element(), new Element(), new Element()); +array_map(array('Element', 'CallBack'), $arr); + +echo "Done\n"; +?> +--EXPECTF-- + +Warning: array_map(): An error occurred while invoking the map callback in %s on line %d + +Fatal error: Uncaught exception 'Exception' in %s:%d +Stack trace: +#0 %s(%d): Element->ThrowException() +#1 [internal function]: Element::CallBack(Object(Element)) +#2 %s(%d): array_map(Array, Array) +#3 {main} + thrown in %s on line %d diff --git a/ext/standard/tests/array/bug36975.phpt b/ext/standard/tests/array/bug36975.phpt new file mode 100644 index 0000000..f37c933 --- /dev/null +++ b/ext/standard/tests/array/bug36975.phpt @@ -0,0 +1,62 @@ +--TEST-- +Bug #36975 (natcasesort() causes array_pop() to misbehave) +--FILE-- + 'foo', 0 => 'baz'); +array_pop($b); +$b[] = 'bar'; +array_push($b, 'bar'); +print_r($b); + +$c = array(0, 0, 0, 0, 0); +asort($c); +array_pop($c); +$c[] = 'foo'; +$c[] = 'bar'; +var_dump($c); +?> +--EXPECT-- +natcasesort success! +array(6) { + [0]=> + string(2) "aa" + [1]=> + string(2) "aa" + [3]=> + string(2) "bb" + [2]=> + string(2) "bb" + [5]=> + string(2) "cc" + [6]=> + string(2) "cc" +} +Array +( + [1] => foo + [2] => bar + [3] => bar +) +array(6) { + [4]=> + int(0) + [3]=> + int(0) + [2]=> + int(0) + [1]=> + int(0) + [5]=> + string(3) "foo" + [6]=> + string(3) "bar" +} diff --git a/ext/standard/tests/array/bug38464.phpt b/ext/standard/tests/array/bug38464.phpt new file mode 100644 index 0000000..42f7a6a --- /dev/null +++ b/ext/standard/tests/array/bug38464.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #38464 (array_count_values() mishandles numeric strings) +--FILE-- + +--EXPECT-- +array(5) { + ["-000"]=> + int(1) + [" 001"]=> + int(1) + [1]=> + int(1) + [" 123"]=> + int(1) + ["+123"]=> + int(1) +} diff --git a/ext/standard/tests/array/bug39576.phpt b/ext/standard/tests/array/bug39576.phpt new file mode 100644 index 0000000..7c8aeef --- /dev/null +++ b/ext/standard/tests/array/bug39576.phpt @@ -0,0 +1,52 @@ +--TEST-- +Bug #39576 (array_walk() doesn't separate userdata zval) +--FILE-- +name = 'test'; +$test->_columns['name'] = new stdClass; + +function test ($value, $column, &$columns) {} + +array_walk ( + get_object_vars ($test), + 'test', + $test->_columns +); + +var_dump($test); + +array_intersect_key ( + get_object_vars ($test), + $test->_primary +); + +echo "Done\n"; +?> +--EXPECTF-- +Strict Standards: Only variables should be passed by reference in %s on line %d +object(Test)#%d (4) { + ["_table"]=> + string(0) "" + ["_columns"]=> + array(1) { + ["name"]=> + object(stdClass)#%d (0) { + } + } + ["_primary"]=> + array(0) { + } + ["name"]=> + string(4) "test" +} +Done diff --git a/ext/standard/tests/array/bug40191.phpt b/ext/standard/tests/array/bug40191.phpt new file mode 100644 index 0000000..244ce78 --- /dev/null +++ b/ext/standard/tests/array/bug40191.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #40191 (use of array_unique() with objects triggers segfault) +--SKIPIF-- + +--FILE-- +append('foo'); +$arrObj->append('bar'); +$arrObj->append('foo'); + +$arr = array_unique($arrObj); +var_dump($arr); + +echo "Done\n"; +?> +--EXPECTF-- +Warning: array_unique() expects parameter 1 to be array, object given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/bug40709.phpt b/ext/standard/tests/array/bug40709.phpt new file mode 100644 index 0000000..eb0c712 --- /dev/null +++ b/ext/standard/tests/array/bug40709.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #40709 (array_reduce() behaves strange with one item stored arrays) +--FILE-- + +--EXPECT-- +result for arr1: 1,2,3 +result for arr2: 1 +result for arr1: 1,2,3 +result for arr2: 1 +Done diff --git a/ext/standard/tests/array/bug41121.phpt b/ext/standard/tests/array/bug41121.phpt new file mode 100644 index 0000000..a03bdaf --- /dev/null +++ b/ext/standard/tests/array/bug41121.phpt @@ -0,0 +1,128 @@ +--TEST-- +Bug #41121 (range() overflow handling for large numbers on 32bit machines) +--INI-- +precision=14 +--SKIPIF-- + +--FILE-- + high +var_dump(range(2147483647, 2147483645, 1 )); +var_dump(range(2147483648, 2147483645, 1 )); + +?> +--EXPECT-- +array(3) { + [0]=> + int(2147483400) + [1]=> + int(2147483500) + [2]=> + int(2147483600) +} +array(3) { + [0]=> + float(2147483646) + [1]=> + float(2147483647) + [2]=> + float(2147483648) +} +array(12) { + [0]=> + float(2147483646) + [1]=> + float(2147483647) + [2]=> + float(2147483648) + [3]=> + float(2147483649) + [4]=> + float(2147483650) + [5]=> + float(2147483651) + [6]=> + float(2147483652) + [7]=> + float(2147483653) + [8]=> + float(2147483654) + [9]=> + float(2147483655) + [10]=> + float(2147483656) + [11]=> + float(2147483657) +} +array(4) { + [0]=> + int(2147483630) + [1]=> + int(2147483635) + [2]=> + int(2147483640) + [3]=> + int(2147483645) +} +array(4) { + [0]=> + float(-2147483645) + [1]=> + float(-2147483646) + [2]=> + float(-2147483647) + [3]=> + float(-2147483648) +} +array(5) { + [0]=> + float(-2147483645) + [1]=> + float(-2147483646) + [2]=> + float(-2147483647) + [3]=> + float(-2147483648) + [4]=> + float(-2147483649) +} +array(4) { + [0]=> + int(-2147483630) + [1]=> + int(-2147483635) + [2]=> + int(-2147483640) + [3]=> + int(-2147483645) +} +array(3) { + [0]=> + int(2147483647) + [1]=> + int(2147483646) + [2]=> + int(2147483645) +} +array(4) { + [0]=> + float(2147483648) + [1]=> + float(2147483647) + [2]=> + float(2147483646) + [3]=> + float(2147483645) +} diff --git a/ext/standard/tests/array/bug41686.phpt b/ext/standard/tests/array/bug41686.phpt new file mode 100644 index 0000000..9f1384e --- /dev/null +++ b/ext/standard/tests/array/bug41686.phpt @@ -0,0 +1,56 @@ +--TEST-- +Bug #41686 (Omitting length param in array_slice not possible) +--FILE-- +1,'b'=>1,'c'=>2); + +var_dump( + array_slice($a, 1), + array_slice($a, 1, 2, TRUE), + array_slice($a, 1, NULL, TRUE), + array_slice($b, 1), + array_slice($b, 1, 2, TRUE), + array_slice($b, 1, NULL, TRUE) +); + +echo "Done\n"; +?> +--EXPECT-- +array(2) { + [0]=> + int(2) + [1]=> + int(3) +} +array(2) { + [1]=> + int(2) + [2]=> + int(3) +} +array(2) { + [1]=> + int(2) + [2]=> + int(3) +} +array(2) { + ["b"]=> + int(1) + ["c"]=> + int(2) +} +array(2) { + ["b"]=> + int(1) + ["c"]=> + int(2) +} +array(2) { + ["b"]=> + int(1) + ["c"]=> + int(2) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/bug42177.phpt b/ext/standard/tests/array/bug42177.phpt new file mode 100644 index 0000000..5678ca3 --- /dev/null +++ b/ext/standard/tests/array/bug42177.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #42177 (Warning "array_merge_recursive(): recursion detected" comes again...) +--FILE-- + 1, 'key3' => 2 ); +$a2 = array(); +$a1 = array_merge_recursive( $a1, $a2 ); +$a1 = array_merge_recursive( $a1, $a2 ); +unset( $a1, $a2 ); + +$a1 = array(); +$a2 = array( 'key1' => 1, 'key3' => 2 ); +$a1 = array_merge_recursive( $a1, $a2 ); +$a1 = array_merge_recursive( $a1, $a2 ); +unset( $a1, $a2 ); + +$a1 = array(); +$a2 = array( 'key1' => &$a1 ); +$a1 = array_merge_recursive( $a1, $a2 ); +$a1 = array_merge_recursive( $a1, $a2 ); +unset( $a1, $a2 ); + +$x = 'foo'; +$y =& $x; +$a1 = array($x, $y, $x, $y); +$a2 = array( 'key1' => $a1, $x, $y ); +$a1 = array_merge_recursive( $a1, $a2 ); +$a1 = array_merge_recursive( $a1, $a2 ); +unset( $a1, $a2 ); + +?> +--EXPECTF-- +Warning: array_merge_recursive(): recursion detected in %s on line 18 diff --git a/ext/standard/tests/array/bug42233.phpt b/ext/standard/tests/array/bug42233.phpt new file mode 100644 index 0000000..0cebc42 --- /dev/null +++ b/ext/standard/tests/array/bug42233.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #42233 (extract(): scandic characters not allowed as variable name) +--FILE-- + '1', + 'Ê' => '2', + 'ÊÞåÀö' => '3', +); + +var_dump($test); +var_dump(extract($test)); +var_dump($a); +var_dump($Ê); +var_dump($ÊÞåÀö); + +echo "Done.\n"; +?> +--EXPECT-- +array(3) { + ["a"]=> + string(1) "1" + ["Ê"]=> + string(1) "2" + ["ÊÞåÀö"]=> + string(1) "3" +} +int(3) +string(1) "1" +string(1) "2" +string(1) "3" +Done. diff --git a/ext/standard/tests/array/bug42838.phpt b/ext/standard/tests/array/bug42838.phpt new file mode 100644 index 0000000..5a09ae9 --- /dev/null +++ b/ext/standard/tests/array/bug42838.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #42838 (Wrong results in array_diff_uassoc()) +--FILE-- + $b)? 1:-1; +} + +$array1 = array("a" => "green", "b" => "Brown", 'c' => 'blue', 0 => 'red'); +$array2 = array("a" => "green", "b" => "Brown", 'c' => 'blue', 0 => 'red'); + +$result = array_diff_uassoc($array1, $array2, "key_compare_func"); +print_r($result); + +?> +--EXPECT-- +Array +( +) diff --git a/ext/standard/tests/array/bug42850.phpt b/ext/standard/tests/array/bug42850.phpt new file mode 100644 index 0000000..3baec83 --- /dev/null +++ b/ext/standard/tests/array/bug42850.phpt @@ -0,0 +1,59 @@ +--TEST-- +Bug #42850 (array_walk_recursive() leaves references) +--FILE-- + 'val1', array('key2' => 'val2')); +function apply_dumb($item, $key) {}; +var_dump($data); +array_walk_recursive($data, 'apply_dumb'); +$data2 = $data; +$data2[0] = 'altered'; +var_dump($data); +var_dump($data2); + +// Bug #34982 +function myfunc($data) { + array_walk_recursive($data, 'apply_changed'); +} +function apply_changed(&$input, $key) { + $input = 'changed'; +} +myfunc($data); +var_dump($data); + +--EXPECT-- +array(2) { + ["key1"]=> + string(4) "val1" + [0]=> + array(1) { + ["key2"]=> + string(4) "val2" + } +} +array(2) { + ["key1"]=> + string(4) "val1" + [0]=> + array(1) { + ["key2"]=> + string(4) "val2" + } +} +array(2) { + ["key1"]=> + string(4) "val1" + [0]=> + string(7) "altered" +} +array(2) { + ["key1"]=> + string(4) "val1" + [0]=> + array(1) { + ["key2"]=> + string(4) "val2" + } +} diff --git a/ext/standard/tests/array/bug43495.phpt b/ext/standard/tests/array/bug43495.phpt new file mode 100644 index 0000000..8b8f3a6 --- /dev/null +++ b/ext/standard/tests/array/bug43495.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #43495 (array_merge_recursive() crashes with recursive arrays) +--FILE-- +array("key2"=>array())); +$a["key1"]["key2"]["key3"]=&$a; + +$b=array("key1"=>array("key2"=>array())); +$b["key1"]["key2"]["key3"]=&$b; + +array_merge_recursive($a,$b); + +/* Break recursion */ +$a["key1"]["key2"]["key3"] = null; +$b["key1"]["key2"]["key3"] = null; + +echo "Done.\n"; +?> +--EXPECTF-- +Warning: array_merge_recursive(): recursion detected in %sbug43495.php on line %d +Done. diff --git a/ext/standard/tests/array/bug43505.phpt b/ext/standard/tests/array/bug43505.phpt new file mode 100644 index 0000000..219bbfe --- /dev/null +++ b/ext/standard/tests/array/bug43505.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #43505 (Assign by reference bug) +--INI-- +error_reporting=0 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +array(1) { + ["test"]=> + &NULL +} +array(1) { + ["test"]=> + &NULL +} + diff --git a/ext/standard/tests/array/bug43541.phpt b/ext/standard/tests/array/bug43541.phpt new file mode 100644 index 0000000..847f61a --- /dev/null +++ b/ext/standard/tests/array/bug43541.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #43541 (length parameter omitted or not does not work when casted to float) +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} diff --git a/ext/standard/tests/array/bug44181.phpt b/ext/standard/tests/array/bug44181.phpt new file mode 100644 index 0000000..3da73cb --- /dev/null +++ b/ext/standard/tests/array/bug44181.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #44181 (extract EXTR_OVERWRITE|EXTR_REFS can fail to create references) +--FILE-- + 'original.foo'); + +$foo = 'test'; +$ref = &$a; + +extract($a, EXTR_OVERWRITE|EXTR_REFS); +$foo = 'changed.foo'; + +var_dump($a['foo']); +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "changed.foo" +Done + diff --git a/ext/standard/tests/array/bug44182.phpt b/ext/standard/tests/array/bug44182.phpt new file mode 100644 index 0000000..47f3caa --- /dev/null +++ b/ext/standard/tests/array/bug44182.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #44182 (extract EXTR_REFS can fail to split copy-on-write references) +--FILE-- + 'original.foo'); + +$nonref = $a['foo']; +$ref = &$a; + +extract($a, EXTR_REFS); +$a['foo'] = 'changed.foo'; + +var_dump($nonref); +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "original.foo" +Done + diff --git a/ext/standard/tests/array/bug44929.phpt b/ext/standard/tests/array/bug44929.phpt new file mode 100644 index 0000000..9dc85ac --- /dev/null +++ b/ext/standard/tests/array/bug44929.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #44929 (natsort doesn't handle leading zeros well) +--FILE-- + +--EXPECT-- +array(12) { + [6]=> + string(4) "-123" + [8]=> + string(2) "00" + [9]=> + string(1) "0" + [11]=> + string(3) "0-0" + [7]=> + string(5) "0.002" + [10]=> + string(3) "0_0" + [0]=> + string(3) "001" + [4]=> + string(2) "03" + [2]=> + string(3) "005" + [1]=> + string(3) "008" + [3]=> + string(5) "00011" + [5]=> + string(6) "000014" +} diff --git a/ext/standard/tests/array/bug45312.phpt b/ext/standard/tests/array/bug45312.phpt new file mode 100644 index 0000000..017defe --- /dev/null +++ b/ext/standard/tests/array/bug45312.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #45312 (Segmentation fault on second request for array functions) +--FILE-- +priv_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member) ? 1 : -1; + } + static function comp_func_cr2($a, $b) { + echo "."; + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member < $b->priv_member) ? 1 : -1; + } + function dump() { + echo $this->priv_member . "\n"; + } +} +$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),); +$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),); +$result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr")); +foreach($result as $val) { + $val->dump(); +} +$result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr2")); +foreach($result as $val) { + $val->dump(); +} +?> +--EXPECT-- +9 +12 +23 +....9 +12 +23 diff --git a/ext/standard/tests/array/bug46873.phpt b/ext/standard/tests/array/bug46873.phpt new file mode 100644 index 0000000..1f11c9d --- /dev/null +++ b/ext/standard/tests/array/bug46873.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #46873 (extract($foo) crashes if $foo['foo'] exists) +--FILE-- + 1, 'bar' => 2, 'test' => 3); +extract($foo); +var_dump($foo, $bar, $test); +?> +--EXPECT-- +int(1) +int(2) +int(3) diff --git a/ext/standard/tests/array/bug48224.phpt b/ext/standard/tests/array/bug48224.phpt new file mode 100644 index 0000000..5b46e18 --- /dev/null +++ b/ext/standard/tests/array/bug48224.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #48224 (array_rand no longer shuffles) +--FILE-- + +--EXPECT-- +bool(true) diff --git a/ext/standard/tests/array/bug48484.phpt b/ext/standard/tests/array/bug48484.phpt new file mode 100644 index 0000000..0b4afe2 --- /dev/null +++ b/ext/standard/tests/array/bug48484.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug 48484 (array_product() always returns 0 for an empty array) +--FILE-- + +--EXPECT-- +int(1) diff --git a/ext/standard/tests/array/bug48854.phpt b/ext/standard/tests/array/bug48854.phpt new file mode 100644 index 0000000..0908637 --- /dev/null +++ b/ext/standard/tests/array/bug48854.phpt @@ -0,0 +1,43 @@ +--TEST-- +Bug #48854 (array_merge_recursive modifies arrays after first one) +--FILE-- + 5, + 'children' => array( + 'dogs' => 0, + ), +); + +$array2 = array( + 'friends' => 10, + 'children' => array( + 'cats' => 5, + ), +); + +$merged = array_merge_recursive($array1, $array2); + +var_dump($array1, $array2); + +?> +--EXPECTF-- +array(2) { + [%u|b%"friends"]=> + int(5) + [%u|b%"children"]=> + array(1) { + [%u|b%"dogs"]=> + int(0) + } +} +array(2) { + [%u|b%"friends"]=> + int(10) + [%u|b%"children"]=> + array(1) { + [%u|b%"cats"]=> + int(5) + } +} diff --git a/ext/standard/tests/array/bug50006.phpt b/ext/standard/tests/array/bug50006.phpt new file mode 100644 index 0000000..f03a002 --- /dev/null +++ b/ext/standard/tests/array/bug50006.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #50006 (Segfault caused by uksort()) +--FILE-- + 0, + 'bar-bazbazbaz-' => 0, + 'foo' => 0, +); +uksort($data, 'magic_sort_cmp'); +print_r($data); + +function magic_sort_cmp($a, $b) { + $a = substr($a, 1); + $b = substr($b, 1); + if (!$a) return $b ? -1 : 0; + if (!$b) return 1; + return magic_sort_cmp($a, $b); +} + +?> +--EXPECTF-- +Array +( + [foo] => 0 + [bar-bazbazbaz-] => 0 + [bar-bazbazbaz.] => 0 +) diff --git a/ext/standard/tests/array/bug50006_1.phpt b/ext/standard/tests/array/bug50006_1.phpt new file mode 100644 index 0000000..fbb7ddd --- /dev/null +++ b/ext/standard/tests/array/bug50006_1.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #50006 (Segfault caused by uksort()) - usort variant +--FILE-- + +--EXPECTF-- +Array +( + [0] => foo + [1] => bar-bazbazbaz- + [2] => bar-bazbazbaz. +) diff --git a/ext/standard/tests/array/bug50006_2.phpt b/ext/standard/tests/array/bug50006_2.phpt new file mode 100644 index 0000000..19c0d14 --- /dev/null +++ b/ext/standard/tests/array/bug50006_2.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #50006 (Segfault caused by uksort()) - uasort variant +--FILE-- + +--EXPECTF-- +Array +( + [2] => foo + [1] => bar-bazbazbaz- + [0] => bar-bazbazbaz. +) diff --git a/ext/standard/tests/array/bug51552.phpt b/ext/standard/tests/array/bug51552.phpt new file mode 100644 index 0000000..fb61f48 --- /dev/null +++ b/ext/standard/tests/array/bug51552.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #51552 (debug_backtrace() causes segmentation fault and/or memory issues) +--FILE-- + +--EXPECT-- +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 diff --git a/ext/standard/tests/array/bug52534.phpt b/ext/standard/tests/array/bug52534.phpt new file mode 100644 index 0000000..dfff3fd --- /dev/null +++ b/ext/standard/tests/array/bug52534.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #52534 (var_export array with negative key) +--FILE-- + 'Hello'); + +var_export($aArray); + +?> +--EXPECT-- +array ( + -1 => 'Hello', +) diff --git a/ext/standard/tests/array/bug52719.phpt b/ext/standard/tests/array/bug52719.phpt new file mode 100644 index 0000000..078c53d --- /dev/null +++ b/ext/standard/tests/array/bug52719.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #52719: array_walk_recursive crashes if third param of the function is by reference +--FILE-- + +--EXPECTF-- +Done diff --git a/ext/standard/tests/array/bug54459.phpt b/ext/standard/tests/array/bug54459.phpt new file mode 100644 index 0000000..e46cfcb --- /dev/null +++ b/ext/standard/tests/array/bug54459.phpt @@ -0,0 +1,215 @@ +--TEST-- +Bug #54459 (Range function accuracy) +--INI-- +precision=14 +--FILE-- + $v){ + echo $i, ' = ', $v, PHP_EOL; +} +foreach (range("90", "100", .1) as $i => $v){ + echo $i, ' = ', $v, PHP_EOL; +} +--EXPECT-- +0 = 90 +1 = 90.1 +2 = 90.2 +3 = 90.3 +4 = 90.4 +5 = 90.5 +6 = 90.6 +7 = 90.7 +8 = 90.8 +9 = 90.9 +10 = 91 +11 = 91.1 +12 = 91.2 +13 = 91.3 +14 = 91.4 +15 = 91.5 +16 = 91.6 +17 = 91.7 +18 = 91.8 +19 = 91.9 +20 = 92 +21 = 92.1 +22 = 92.2 +23 = 92.3 +24 = 92.4 +25 = 92.5 +26 = 92.6 +27 = 92.7 +28 = 92.8 +29 = 92.9 +30 = 93 +31 = 93.1 +32 = 93.2 +33 = 93.3 +34 = 93.4 +35 = 93.5 +36 = 93.6 +37 = 93.7 +38 = 93.8 +39 = 93.9 +40 = 94 +41 = 94.1 +42 = 94.2 +43 = 94.3 +44 = 94.4 +45 = 94.5 +46 = 94.6 +47 = 94.7 +48 = 94.8 +49 = 94.9 +50 = 95 +51 = 95.1 +52 = 95.2 +53 = 95.3 +54 = 95.4 +55 = 95.5 +56 = 95.6 +57 = 95.7 +58 = 95.8 +59 = 95.9 +60 = 96 +61 = 96.1 +62 = 96.2 +63 = 96.3 +64 = 96.4 +65 = 96.5 +66 = 96.6 +67 = 96.7 +68 = 96.8 +69 = 96.9 +70 = 97 +71 = 97.1 +72 = 97.2 +73 = 97.3 +74 = 97.4 +75 = 97.5 +76 = 97.6 +77 = 97.7 +78 = 97.8 +79 = 97.9 +80 = 98 +81 = 98.1 +82 = 98.2 +83 = 98.3 +84 = 98.4 +85 = 98.5 +86 = 98.6 +87 = 98.7 +88 = 98.8 +89 = 98.9 +90 = 99 +91 = 99.1 +92 = 99.2 +93 = 99.3 +94 = 99.4 +95 = 99.5 +96 = 99.6 +97 = 99.7 +98 = 99.8 +99 = 99.9 +100 = 100 +0 = 90 +1 = 90.1 +2 = 90.2 +3 = 90.3 +4 = 90.4 +5 = 90.5 +6 = 90.6 +7 = 90.7 +8 = 90.8 +9 = 90.9 +10 = 91 +11 = 91.1 +12 = 91.2 +13 = 91.3 +14 = 91.4 +15 = 91.5 +16 = 91.6 +17 = 91.7 +18 = 91.8 +19 = 91.9 +20 = 92 +21 = 92.1 +22 = 92.2 +23 = 92.3 +24 = 92.4 +25 = 92.5 +26 = 92.6 +27 = 92.7 +28 = 92.8 +29 = 92.9 +30 = 93 +31 = 93.1 +32 = 93.2 +33 = 93.3 +34 = 93.4 +35 = 93.5 +36 = 93.6 +37 = 93.7 +38 = 93.8 +39 = 93.9 +40 = 94 +41 = 94.1 +42 = 94.2 +43 = 94.3 +44 = 94.4 +45 = 94.5 +46 = 94.6 +47 = 94.7 +48 = 94.8 +49 = 94.9 +50 = 95 +51 = 95.1 +52 = 95.2 +53 = 95.3 +54 = 95.4 +55 = 95.5 +56 = 95.6 +57 = 95.7 +58 = 95.8 +59 = 95.9 +60 = 96 +61 = 96.1 +62 = 96.2 +63 = 96.3 +64 = 96.4 +65 = 96.5 +66 = 96.6 +67 = 96.7 +68 = 96.8 +69 = 96.9 +70 = 97 +71 = 97.1 +72 = 97.2 +73 = 97.3 +74 = 97.4 +75 = 97.5 +76 = 97.6 +77 = 97.7 +78 = 97.8 +79 = 97.9 +80 = 98 +81 = 98.1 +82 = 98.2 +83 = 98.3 +84 = 98.4 +85 = 98.5 +86 = 98.6 +87 = 98.7 +88 = 98.8 +89 = 98.9 +90 = 99 +91 = 99.1 +92 = 99.2 +93 = 99.3 +94 = 99.4 +95 = 99.5 +96 = 99.6 +97 = 99.7 +98 = 99.8 +99 = 99.9 +100 = 100 diff --git a/ext/standard/tests/array/bug61058.phpt b/ext/standard/tests/array/bug61058.phpt new file mode 100644 index 0000000..1f0f6fe --- /dev/null +++ b/ext/standard/tests/array/bug61058.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #61058 (array_fill leaks if start index is PHP_INT_MAX) +--FILE-- + +--EXPECTF-- +Warning: array_fill(): Cannot add element to the array as the next element is already occupied in %sbug61058.php on line %d diff --git a/ext/standard/tests/array/bug61730.phpt b/ext/standard/tests/array/bug61730.phpt new file mode 100644 index 0000000..0fe9f22 --- /dev/null +++ b/ext/standard/tests/array/bug61730.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #61730 (Segfault from array_walk modifying an array passed by reference) +--FILE-- + 1 + [7] => 1 +) diff --git a/ext/standard/tests/array/compact.phpt b/ext/standard/tests/array/compact.phpt new file mode 100644 index 0000000..4b4bfbb --- /dev/null +++ b/ext/standard/tests/array/compact.phpt @@ -0,0 +1,24 @@ +--TEST-- +compact() +--INI-- +unicode.script_encoding=UTF-8 +unicode.output_encoding=UTF-8 +--FILE-- + +--EXPECT-- +array(2) { + ["event"]=> + string(8) "SIGGRAPH" + ["state"]=> + string(2) "CA" +} diff --git a/ext/standard/tests/array/compact_basic.phpt b/ext/standard/tests/array/compact_basic.phpt new file mode 100644 index 0000000..53a946e --- /dev/null +++ b/ext/standard/tests/array/compact_basic.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test compact() function : basic functionality +--FILE-- +"val"); +$e=NULL; +$f="string"; + +// simple array test +var_dump (compact(array("a", "b", "c", "d", "e", "f"))); +// simple parameter test +var_dump (compact("a", "b", "c", "d", "e", "f")); +var_dump (compact(array("keyval"=>"a", "b"=>"b", "c"=>1))); + +// cases which should not yield any output. +var_dump (compact(array(10, 0.3, true, array(20), NULL))); +var_dump (compact(10, 0.3, true, array(20), NULL)); +var_dump (compact(array("g"))); + +echo "Done"; +?> +--EXPECTF-- +*** Testing compact() : basic functionality *** +array(6) { + ["a"]=> + int(1) + ["b"]=> + float(0.2) + ["c"]=> + bool(true) + ["d"]=> + array(1) { + ["key"]=> + string(3) "val" + } + ["e"]=> + NULL + ["f"]=> + string(6) "string" +} +array(6) { + ["a"]=> + int(1) + ["b"]=> + float(0.2) + ["c"]=> + bool(true) + ["d"]=> + array(1) { + ["key"]=> + string(3) "val" + } + ["e"]=> + NULL + ["f"]=> + string(6) "string" +} +array(2) { + ["a"]=> + int(1) + ["b"]=> + float(0.2) +} +array(0) { +} +array(0) { +} +array(0) { +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/compact_error.phpt b/ext/standard/tests/array/compact_error.phpt new file mode 100644 index 0000000..a7ef545 --- /dev/null +++ b/ext/standard/tests/array/compact_error.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test compact() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing compact() : error conditions *** + +-- Testing compact() function with Zero arguments -- + +Warning: compact() expects at least 1 parameter, 0 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/compact_variation1.phpt b/ext/standard/tests/array/compact_variation1.phpt new file mode 100644 index 0000000..ea48132 --- /dev/null +++ b/ext/standard/tests/array/compact_variation1.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test compact() function : usage variations - arrays containing references. +--FILE-- + +--EXPECTF-- +*** Testing compact() : usage variations - arrays containg references *** + +Warning: compact(): recursion detected in %s on line %d +array(1) { + ["a"]=> + int(1) +} + +Warning: compact(): recursion detected in %s on line %d + +Warning: compact(): recursion detected in %s on line %d + +Warning: compact(): recursion detected in %s on line %d + +Warning: compact(): recursion detected in %s on line %d +array(2) { + ["a"]=> + int(1) + ["b"]=> + int(2) +} +array(1) { + ["c"]=> + int(3) +} +Done diff --git a/ext/standard/tests/array/compact_variation2.phpt b/ext/standard/tests/array/compact_variation2.phpt new file mode 100644 index 0000000..79db8ab --- /dev/null +++ b/ext/standard/tests/array/compact_variation2.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test compact() function: ensure compact() doesn't pick up variables declared outside of current scope. +--FILE-- + +==Done== +--EXPECTF-- +*** Testing compact() : usage variations - variables outside of current scope *** +array(2) { + ["b"]=> + string(3) "f.b" + ["c"]=> + string(3) "f.c" +} +array(2) { + ["b"]=> + string(3) "f.b" + ["c"]=> + string(3) "f.c" +} +==Done== \ No newline at end of file diff --git a/ext/standard/tests/array/compare_function.inc b/ext/standard/tests/array/compare_function.inc new file mode 100644 index 0000000..e517680 --- /dev/null +++ b/ext/standard/tests/array/compare_function.inc @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/ext/standard/tests/array/count_basic.phpt b/ext/standard/tests/array/count_basic.phpt new file mode 100644 index 0000000..45f63d6 --- /dev/null +++ b/ext/standard/tests/array/count_basic.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test count() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing count() : basic functionality *** + +-- One Dimensional Array: -- +int(3) + +-- Two Dimensional Array: -- +$mode = COUNT_NORMAL: int(3) +$mode = 0: int(3) +$mode = COUNT_RECURSIVE: int(6) +$mode = 1: int(6) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/count_error.phpt b/ext/standard/tests/array/count_error.phpt new file mode 100644 index 0000000..76f7213 --- /dev/null +++ b/ext/standard/tests/array/count_error.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test count() function : error conditions - pass incorrect number of args +--FILE-- + +--EXPECTF-- +*** Testing count() : error conditions *** + +-- Testing count() function with Zero arguments -- + +Warning: count() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing count() function with more than expected no. of arguments -- + +Warning: count() expects at most 2 parameters, 3 given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt new file mode 100644 index 0000000..0f6a1d9 --- /dev/null +++ b/ext/standard/tests/array/count_recursive.phpt @@ -0,0 +1,235 @@ +--TEST-- +Test count() function +--SKIPIF-- + +--FILE-- + 1, "b" => 2, array("c" => 3, array("d" => 5))); +print "COUNT_NORMAL: should be 3, is ".count($arr, COUNT_NORMAL)."\n"; +print "COUNT_RECURSIVE: should be 6, is ".count($arr, COUNT_RECURSIVE)."\n"; + +print "-- Testing strings --\n"; +print "COUNT_NORMAL: should be 1, is ".count("string", COUNT_NORMAL)."\n"; +print "COUNT_RECURSIVE: should be 1, is ".count("string", COUNT_RECURSIVE)."\n"; + +print "-- Testing various types with no second argument --\n"; +print "COUNT_NORMAL: should be 1, is ".count("string")."\n"; +print "COUNT_NORMAL: should be 2, is ".count(array("a", array("b")))."\n"; + +$arr = array('a'=>array(NULL, NULL, NULL), 1=>array(NULL=>1, 1=>NULL), + array(array(array(array(array(NULL)))))); +print "-- Testing really cool arrays --\n"; +print "COUNT_NORMAL: should be 3, is ".count($arr, COUNT_NORMAL)."\n"; +print "COUNT_RECURSIVE: should be 13, is ".count($arr, COUNT_RECURSIVE)."\n"; + +echo "\n*** Testing possible variations of count() function on arrays ***"; +$count_array = array( + array(), + array( 1 => "string"), + array( "" => "string", 0 => "a", NULL => "b", -1.00 => "c", + array(array(array(NULL)))), + array( -2.44444 => 12, array(array(1, 2, array(array("0"))))), + array( "a" => 1, "b" => -2.344, "b" => "string", "c" => NULL, "d" => -2.344), + array( 4 => 1, 3 => -2.344, "3" => "string", "2" => NULL, + 1 => -2.344, array()), + array( TRUE => TRUE, FALSE => FALSE, "" => "", " " => " ", + NULL => NULL, "\x000" => "\x000", "\000" => "\000"), + array( NULL, 1.23 => "Hi", "string" => "hello", + array("" => "World", "-2.34" => "a", "0" => "b")) +); + +$i = 0; +foreach ($count_array as $count_value) { + echo "\n-- Iteration $i --\n"; + print "COUNT_NORMAL is ".count($count_value, COUNT_NORMAL)."\n"; + print "COUNT_RECURSIVE is ".count($count_value, COUNT_RECURSIVE)."\n"; + $i++; +} + + +/* Testing count() by passing constant with no second argument */ +print "\n-- Testing count() on constants with no second argument --\n"; +print "COUNT_NORMAL: should be 1, is ".count(100)."\n"; +print "COUNT_NORMAL: should be 1, is ".count(-23.45)."\n"; + +print "\n-- Testing count() on NULL and Unset variables --\n"; +print "COUNT_NORMAL: should be 0, is ".count(NULL)."\n"; +print "COUNT_NORMAL: should be 1, is ".count("")."\n"; +print "COUNT_NORMAL: should be 0, is ".@count($a)."\n"; + + +print "\n-- Testing count() on an empty sub-array --\n"; +$arr = array(1, array(3, 4, array())); +print "COUNT_NORMAL: should be 2, is ".count($arr, COUNT_NORMAL)."\n"; +print "COUNT_RECURSIVE: should be 5, is ".count($arr, COUNT_RECURSIVE)."\n"; + +echo "\n-- Testing count() on objects with Countable interface --\n"; +class count_class implements Countable { + private $var_private; + public $var_public; + protected $var_protected; + + public function count() { + return 3; + } +} + +$obj = new count_class(); +print "COUNT_NORMAL: should be 3, is ".count($obj)."\n"; + + +echo "\n-- Testing count() on resource type --\n"; +$resource1 = fopen( __FILE__, "r" ); // Creating file(stream type) resource +$resource2 = opendir( "." ); // Creating dir resource + +/* creating an array with resources as elements */ +$arr_resource = array("a" => $resource1, "b" => $resource2); +var_dump(count($arr_resource)); + +echo "\n-- Testing count() on arrays containing references --\n"; +$arr = array(1, array("a", "b", "c")); +$arr[2] = &$arr[1]; + +$mode_arr = array( COUNT_NORMAL, COUNT_RECURSIVE, 0, 1, -1, -1.45, 2, TRUE, + FALSE, NULL); +for( $i =0; $i < count( $mode_arr ); $i++) { + echo "For mode '$mode_arr[$i]' count is => "; + var_dump(count($arr, $mode_arr[$i])); +} + + +echo "\n-- Testing error conditions --"; +var_dump( count() ); // No. of args = 0 +var_dump( count(array(), COUNT_NORMAL, 100) ); // No. of args > expected + +/* Testing Invalid type arguments */ +var_dump( count("string", ABCD) ); +var_dump( count(100, "string") ); +var_dump( count(array(), "") ); + +echo "\nDone"; + +/* closing the resource handles */ +fclose( $resource1 ); +closedir( $resource2 ); +?> +--EXPECTF-- +*** Testing basic functionality of count() function *** +-- Testing NULL -- +COUNT_NORMAL: should be 0, is 0 +COUNT_RECURSIVE: should be 0, is 0 +-- Testing arrays -- +COUNT_NORMAL: should be 2, is 2 +COUNT_RECURSIVE: should be 8, is 8 +-- Testing hashes -- +COUNT_NORMAL: should be 3, is 3 +COUNT_RECURSIVE: should be 6, is 6 +-- Testing strings -- +COUNT_NORMAL: should be 1, is 1 +COUNT_RECURSIVE: should be 1, is 1 +-- Testing various types with no second argument -- +COUNT_NORMAL: should be 1, is 1 +COUNT_NORMAL: should be 2, is 2 +-- Testing really cool arrays -- +COUNT_NORMAL: should be 3, is 3 +COUNT_RECURSIVE: should be 13, is 13 + +*** Testing possible variations of count() function on arrays *** +-- Iteration 0 -- +COUNT_NORMAL is 0 +COUNT_RECURSIVE is 0 + +-- Iteration 1 -- +COUNT_NORMAL is 1 +COUNT_RECURSIVE is 1 + +-- Iteration 2 -- +COUNT_NORMAL is 4 +COUNT_RECURSIVE is 7 + +-- Iteration 3 -- +COUNT_NORMAL is 2 +COUNT_RECURSIVE is 8 + +-- Iteration 4 -- +COUNT_NORMAL is 4 +COUNT_RECURSIVE is 4 + +-- Iteration 5 -- +COUNT_NORMAL is 5 +COUNT_RECURSIVE is 5 + +-- Iteration 6 -- +COUNT_NORMAL is 6 +COUNT_RECURSIVE is 6 + +-- Iteration 7 -- +COUNT_NORMAL is 4 +COUNT_RECURSIVE is 7 + +-- Testing count() on constants with no second argument -- +COUNT_NORMAL: should be 1, is 1 +COUNT_NORMAL: should be 1, is 1 + +-- Testing count() on NULL and Unset variables -- +COUNT_NORMAL: should be 0, is 0 +COUNT_NORMAL: should be 1, is 1 +COUNT_NORMAL: should be 0, is 0 + +-- Testing count() on an empty sub-array -- +COUNT_NORMAL: should be 2, is 2 +COUNT_RECURSIVE: should be 5, is 5 + +-- Testing count() on objects with Countable interface -- +COUNT_NORMAL: should be 3, is 3 + +-- Testing count() on resource type -- +int(2) + +-- Testing count() on arrays containing references -- +For mode '0' count is => int(3) +For mode '1' count is => int(9) +For mode '0' count is => int(3) +For mode '1' count is => int(9) +For mode '-1' count is => int(3) +For mode '-1.45' count is => int(3) +For mode '2' count is => int(3) +For mode '1' count is => int(9) +For mode '' count is => int(3) +For mode '' count is => int(3) + +-- Testing error conditions -- +Warning: count() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: count() expects at most 2 parameters, 3 given in %s on line %d +NULL + +Notice: Use of undefined constant ABCD - assumed 'ABCD' in %s on line %d + +Warning: count() expects parameter 2 to be long, %s given in %s on line %d +NULL + +Warning: count() expects parameter 2 to be long, %s given in %s on line %d +NULL + +Warning: count() expects parameter 2 to be long, %s given in %s on line %d +NULL + +Done diff --git a/ext/standard/tests/array/count_variation1.phpt b/ext/standard/tests/array/count_variation1.phpt new file mode 100644 index 0000000..b40a2ab --- /dev/null +++ b/ext/standard/tests/array/count_variation1.phpt @@ -0,0 +1,170 @@ +--TEST-- +Test count() function : usage variations - Pass different data types as $var arg +--FILE-- + +--EXPECTF-- +*** Testing count() : usage variations *** + +-- Iteration 1 -- +int(1) + +-- Iteration 2 -- +int(1) + +-- Iteration 3 -- +int(1) + +-- Iteration 4 -- +int(1) + +-- Iteration 5 -- +int(1) + +-- Iteration 6 -- +int(1) + +-- Iteration 7 -- +int(1) + +-- Iteration 8 -- +int(1) + +-- Iteration 9 -- +int(1) + +-- Iteration 10 -- +int(0) + +-- Iteration 11 -- +int(0) + +-- Iteration 12 -- +int(1) + +-- Iteration 13 -- +int(1) + +-- Iteration 14 -- +int(1) + +-- Iteration 15 -- +int(1) + +-- Iteration 16 -- +int(1) + +-- Iteration 17 -- +int(1) + +-- Iteration 18 -- +int(1) + +-- Iteration 19 -- +int(1) + +-- Iteration 20 -- +int(1) + +-- Iteration 21 -- +int(1) + +-- Iteration 22 -- +int(0) + +-- Iteration 23 -- +int(0) + +-- Iteration 24 -- +int(1) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/count_variation2.phpt b/ext/standard/tests/array/count_variation2.phpt new file mode 100644 index 0000000..86aecc0 --- /dev/null +++ b/ext/standard/tests/array/count_variation2.phpt @@ -0,0 +1,187 @@ +--TEST-- +Test count() function : usage variations - Pass different data types as $mode arg +--FILE-- + +--EXPECTF-- +*** Testing count() : usage variations *** + +-- Iteration 1 -- +int(3) + +-- Iteration 2 -- +int(5) + +-- Iteration 3 -- +int(3) + +-- Iteration 4 -- +int(3) + +-- Iteration 5 -- +int(3) + +-- Iteration 6 -- +int(3) + +-- Iteration 7 -- +int(3) + +-- Iteration 8 -- +int(3) + +-- Iteration 9 -- +int(3) + +-- Iteration 10 -- +int(3) + +-- Iteration 11 -- +int(3) + +-- Iteration 12 -- +int(5) + +-- Iteration 13 -- +int(3) + +-- Iteration 14 -- +int(5) + +-- Iteration 15 -- +int(3) + +-- Iteration 16 -- + +Warning: count() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: count() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: count() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: count() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: count() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: count() expects parameter 2 to be long, object given in %s on line %d +NULL + +-- Iteration 22 -- +int(3) + +-- Iteration 23 -- +int(3) + +-- Iteration 24 -- + +Warning: count() expects parameter 2 to be long, resource given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/count_variation3.phpt b/ext/standard/tests/array/count_variation3.phpt new file mode 100644 index 0000000..e11b4c2 --- /dev/null +++ b/ext/standard/tests/array/count_variation3.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test count() function : usage variations - Infinitely recursive array +--FILE-- + +--EXPECTF-- +*** Testing count() : usage variations *** + +-- $mode not set: -- +int(4) + +-- $mode = 1: -- + +Warning: count(): recursion detected in %s on line %d +int(12) +Done diff --git a/ext/standard/tests/array/current_basic.phpt b/ext/standard/tests/array/current_basic.phpt new file mode 100644 index 0000000..cec6959 --- /dev/null +++ b/ext/standard/tests/array/current_basic.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test current() function : basic functionality +--FILE-- + 3); +var_dump(current($array)); +next($array); +var_dump(current($array)); +end($array); +var_dump(current($array)); +next($array); +var_dump(current($array)); +?> +===DONE=== +--EXPECTF-- +*** Testing current() : basic functionality *** +string(4) "zero" +string(3) "one" +int(3) +bool(false) +===DONE=== diff --git a/ext/standard/tests/array/current_error.phpt b/ext/standard/tests/array/current_error.phpt new file mode 100644 index 0000000..d140ba6 --- /dev/null +++ b/ext/standard/tests/array/current_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test current() function : error conditions - Pass incorrect number of args +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing current() : error conditions *** + +-- Testing current() function with Zero arguments -- + +Warning: current() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing current() function with more than expected no. of arguments -- + +Warning: current() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/current_variation1.phpt b/ext/standard/tests/array/current_variation1.phpt new file mode 100644 index 0000000..111b8de --- /dev/null +++ b/ext/standard/tests/array/current_variation1.phpt @@ -0,0 +1,217 @@ +--TEST-- +Test current() function : usage variations - Pass different data types as $array_arg arg +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing current() : usage variations *** + +-- Iteration 1 -- + +Warning: current() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: current() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: current() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: current() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: current() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: current() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: current() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: current() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: current() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: current() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: current() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: current() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: current() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: current() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: current() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: current() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: current() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: current() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: current() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: current() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- +NULL + +-- Iteration 22 -- + +Warning: current() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: current() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: current() expects parameter 1 to be array, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/current_variation2.phpt b/ext/standard/tests/array/current_variation2.phpt new file mode 100644 index 0000000..49769ce --- /dev/null +++ b/ext/standard/tests/array/current_variation2.phpt @@ -0,0 +1,155 @@ +--TEST-- +Test current() function : usage variations - arrays containing different data types +--FILE-- + array( + 0, + 1, + 12345, + -2345, + ), + + // float data +/*2*/ 'float' => array( + 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + ), + + // null data +/*3*/ 'null' => array( + NULL, + null, + ), + + // boolean data +/*4*/ 'bool' => array( + true, + false, + TRUE, + FALSE, + ), + + // empty data +/*5*/ 'empty string' => array( + "", + '', + ), + +/*6*/ 'empty array' => array( + ), + + // string data +/*7*/ 'string' => array( + "string", + 'string', + $heredoc, + ), + + // object data +/*8*/ 'object' => array( + new classA(), + ), + + // undefined data +/*9*/ 'undefined' => array( + @$undefined_var, + ), + + // unset data +/*10*/ 'unset' => array( + @$unset_var, + ), + + // resource variable +/*11*/ 'resource' => array( + $fp + ), +); + +// loop through each element of $inputs to check the behavior of current() +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator : $key data --\n"; + var_dump( current($input) ); + $iterator++; +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing current() : usage variations *** + +-- Iteration 1 : int data -- +int(0) + +-- Iteration 2 : float data -- +float(10.5) + +-- Iteration 3 : null data -- +NULL + +-- Iteration 4 : bool data -- +bool(true) + +-- Iteration 5 : empty string data -- +string(0) "" + +-- Iteration 6 : empty array data -- +bool(false) + +-- Iteration 7 : string data -- +string(6) "string" + +-- Iteration 8 : object data -- +object(classA)#%d (0) { +} + +-- Iteration 9 : undefined data -- +NULL + +-- Iteration 10 : unset data -- +NULL + +-- Iteration 11 : resource data -- +resource(%d) of type (stream) +===DONE=== diff --git a/ext/standard/tests/array/current_variation3.phpt b/ext/standard/tests/array/current_variation3.phpt new file mode 100644 index 0000000..bab5e6e --- /dev/null +++ b/ext/standard/tests/array/current_variation3.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test current() function : usage variations - referenced variables +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing current() : usage variations *** + +-- Initial position of internal pointer -- +string(4) "zero" + +-- Position after calling next() -- +$array1: string(3) "one" +$array2: string(3) "one" +===DONE=== diff --git a/ext/standard/tests/array/current_variation4.phpt b/ext/standard/tests/array/current_variation4.phpt new file mode 100644 index 0000000..741fced --- /dev/null +++ b/ext/standard/tests/array/current_variation4.phpt @@ -0,0 +1,71 @@ +--TEST-- +Test current() function : usage variations - multi-dimensional arrays +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing current() : usage variations *** + +-- Two Dimensional Array -- +Initial Position: string(4) "zero" +Next Position: array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +End Position: string(3) "two" + +-- Access an Array Within an Array -- +Initial Position: int(1) + +-- Recursive, Multidimensional Array -- +Current Position: string(3) "two" +string(3) "two" +int(1) +===DONE=== diff --git a/ext/standard/tests/array/current_variation5.phpt b/ext/standard/tests/array/current_variation5.phpt new file mode 100644 index 0000000..9e7c9e8 --- /dev/null +++ b/ext/standard/tests/array/current_variation5.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test current() function : usage variations - reference & normal parameters +--FILE-- + +===DONE=== + +--EXPECTF-- +*** Testing current() : usage variations *** + +-- Function: reference parameter -- +string(3) "yes" +string(5) "maybe" +string(5) "maybe" +string(2) "no" + +-- Function: normal parameter -- +string(3) "yes" +string(5) "maybe" +string(5) "maybe" +string(2) "no" +===DONE=== diff --git a/ext/standard/tests/array/data.inc b/ext/standard/tests/array/data.inc new file mode 100644 index 0000000..2991274 --- /dev/null +++ b/ext/standard/tests/array/data.inc @@ -0,0 +1,13 @@ +'PHP: Hypertext Preprocessor', + 5=>'Test', + 'test'=>27, + 1000=>'test', + "-1000"=>array('banana', 'orange'), + 'monkey', + $tmp=>-1/3 +); +?> diff --git a/ext/standard/tests/array/each.phpt b/ext/standard/tests/array/each.phpt new file mode 100644 index 0000000..19ee728 Binary files /dev/null and b/ext/standard/tests/array/each.phpt differ diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt new file mode 100644 index 0000000..350b40f --- /dev/null +++ b/ext/standard/tests/array/each_basic.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test each() function : basic functionality +--FILE-- + 1, 'zero', 'two' => 'deux', 20 => 'twenty'); +echo "\n-- Passed array: --\n"; +var_dump($arr); + +echo "\n-- Initial position: --\n"; +var_dump(each($arr)); + +echo "\n-- End position: --\n"; +end($arr); +var_dump(each($arr)); + +echo "\n-- Passed the end of array: --\n"; +var_dump(each($arr)); + +echo "Done"; +?> +--EXPECTF-- +*** Testing each() : basic functionality *** + +-- Passed array: -- +array(4) { + ["one"]=> + int(1) + [0]=> + string(4) "zero" + ["two"]=> + string(4) "deux" + [20]=> + string(6) "twenty" +} + +-- Initial position: -- +array(4) { + [1]=> + int(1) + ["value"]=> + int(1) + [0]=> + string(3) "one" + ["key"]=> + string(3) "one" +} + +-- End position: -- +array(4) { + [1]=> + string(6) "twenty" + ["value"]=> + string(6) "twenty" + [0]=> + int(20) + ["key"]=> + int(20) +} + +-- Passed the end of array: -- +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/each_error.phpt b/ext/standard/tests/array/each_error.phpt new file mode 100644 index 0000000..0806bee --- /dev/null +++ b/ext/standard/tests/array/each_error.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test each() function : error conditions - pass incorrect number of args +--FILE-- + + +--EXPECTF-- +*** Testing each() : error conditions *** + +-- Testing each() function with Zero arguments -- + +Warning: each() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing each() function with more than expected no. of arguments -- + +Warning: each() expects exactly 1 parameter, 2 given in %s on line %d +NULL +Done + diff --git a/ext/standard/tests/array/each_variation1.phpt b/ext/standard/tests/array/each_variation1.phpt new file mode 100644 index 0000000..0afef31 --- /dev/null +++ b/ext/standard/tests/array/each_variation1.phpt @@ -0,0 +1,222 @@ +--TEST-- +Test each() function : usage variations - Pass different data types as $arr arg +--FILE-- + + +--EXPECTF-- +*** Testing each() : usage variations *** + +-- Iteration 1 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 18 -- +bool(false) + +-- Iteration 19 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 22 -- +bool(false) + +-- Iteration 23 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt new file mode 100644 index 0000000..3f7211c --- /dev/null +++ b/ext/standard/tests/array/each_variation2.phpt @@ -0,0 +1,248 @@ +--TEST-- +Test each() function : usage variations - arrays of different data types +--FILE-- + array( + 0, + 1, + 12345, + -2345, + ), + + // float data +/*2*/ 'float' => array( + 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + ), + + // null data +/*3*/ 'null' => array( + NULL, + null, + ), + + // boolean data +/*4*/ 'bool' => array( + true, + false, + TRUE, + FALSE, + ), + + // empty data +/*5*/ 'empty string' => array( + "", + '', + ), + +/*6*/ 'empty array' => array( + ), + + // string data +/*7*/ 'string' => array( + "string", + 'string', + $heredoc, + ), + + // object data +/*8*/ 'object' => array( + new classA(), + ), + + // undefined data +/*9*/ 'undefined' => array( + @$undefined_var, + ), + + // unset data +/*10*/ 'unset' => array( + @$unset_var, + ), + + // resource variable +/*11*/ 'resource' => array( + $fp + ), +); + +// loop through each element of $inputs to check the behavior of each() +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator: $key data --\n"; + var_dump( each($input) ); + $iterator++; +}; + +fclose($fp); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing each() : usage variations *** + +-- Iteration 1: int data -- +array(4) { + [1]=> + int(0) + ["value"]=> + int(0) + [0]=> + int(0) + ["key"]=> + int(0) +} + +-- Iteration 2: float data -- +array(4) { + [1]=> + float(10.5) + ["value"]=> + float(10.5) + [0]=> + int(0) + ["key"]=> + int(0) +} + +-- Iteration 3: null data -- +array(4) { + [1]=> + NULL + ["value"]=> + NULL + [0]=> + int(0) + ["key"]=> + int(0) +} + +-- Iteration 4: bool data -- +array(4) { + [1]=> + bool(true) + ["value"]=> + bool(true) + [0]=> + int(0) + ["key"]=> + int(0) +} + +-- Iteration 5: empty string data -- +array(4) { + [1]=> + string(0) "" + ["value"]=> + string(0) "" + [0]=> + int(0) + ["key"]=> + int(0) +} + +-- Iteration 6: empty array data -- +bool(false) + +-- Iteration 7: string data -- +array(4) { + [1]=> + string(6) "string" + ["value"]=> + string(6) "string" + [0]=> + int(0) + ["key"]=> + int(0) +} + +-- Iteration 8: object data -- +array(4) { + [1]=> + object(classA)#%d (0) { + } + ["value"]=> + object(classA)#%d (0) { + } + [0]=> + int(0) + ["key"]=> + int(0) +} + +-- Iteration 9: undefined data -- +array(4) { + [1]=> + NULL + ["value"]=> + NULL + [0]=> + int(0) + ["key"]=> + int(0) +} + +-- Iteration 10: unset data -- +array(4) { + [1]=> + NULL + ["value"]=> + NULL + [0]=> + int(0) + ["key"]=> + int(0) +} + +-- Iteration 11: resource data -- +array(4) { + [1]=> + resource(%d) of type (stream) + ["value"]=> + resource(%d) of type (stream) + [0]=> + int(0) + ["key"]=> + int(0) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt new file mode 100644 index 0000000..b31ddc6 --- /dev/null +++ b/ext/standard/tests/array/each_variation3.phpt @@ -0,0 +1,253 @@ +--TEST-- +Test each() function : usage variations - keys of different data types +--FILE-- + array( + 0 => 'zero', + 1 => 'one', + 12345 => 'positive', + -2345 => 'negative', + ), + + // float data +/*2*/ 'float' => array( + 10.5 => 'positive', + -10.5 => 'negative', + .5 => 'half', + ), + +/*3*/ 'extreme floats' => array( + 12.3456789000e6 => 'large', + 12.3456789000E-10 => 'small', + ), + + // null data +/*4*/ 'null uppercase' => array( + NULL => 'null 1', + ), + +/*5*/ 'null lowercase' => array( + null => 'null 2', + ), + + // boolean data +/*6*/ 'bool lowercase' => array( + true => 'lowert', + false => 'lowerf', + ), + +/*7*/ 'bool uppercase' => array( + TRUE => 'uppert', + FALSE => 'upperf', + ), + + // empty data +/*8*/ 'empty double quotes' => array( + "" => 'emptyd', + ), + +/*9*/ 'empty single quotes' => array( + '' => 'emptys', + ), + + // string data +/*10*/ 'string' => array( + "stringd" => 'stringd', + 'strings' => 'strings', + $heredoc => 'stringh', + ), + + // undefined data +/*11*/ 'undefined' => array( + @$undefined_var => 'undefined', + ), + + // unset data +/*12*/ 'unset' => array( + @$unset_var => 'unset', + ), +); + +// loop through each element of $inputs to check the behavior of each() +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator: $key data --\n"; + var_dump( each($input) ); + $iterator++; +}; + +echo "Done"; +?> + +--EXPECTF-- +*** Testing each() : usage variations *** + +-- Iteration 1: int data -- +array(4) { + [1]=> + string(4) "zero" + ["value"]=> + string(4) "zero" + [0]=> + int(0) + ["key"]=> + int(0) +} + +-- Iteration 2: float data -- +array(4) { + [1]=> + string(8) "positive" + ["value"]=> + string(8) "positive" + [0]=> + int(10) + ["key"]=> + int(10) +} + +-- Iteration 3: extreme floats data -- +array(4) { + [1]=> + string(5) "large" + ["value"]=> + string(5) "large" + [0]=> + int(12345678) + ["key"]=> + int(12345678) +} + +-- Iteration 4: null uppercase data -- +array(4) { + [1]=> + string(6) "null 1" + ["value"]=> + string(6) "null 1" + [0]=> + string(0) "" + ["key"]=> + string(0) "" +} + +-- Iteration 5: null lowercase data -- +array(4) { + [1]=> + string(6) "null 2" + ["value"]=> + string(6) "null 2" + [0]=> + string(0) "" + ["key"]=> + string(0) "" +} + +-- Iteration 6: bool lowercase data -- +array(4) { + [1]=> + string(6) "lowert" + ["value"]=> + string(6) "lowert" + [0]=> + int(1) + ["key"]=> + int(1) +} + +-- Iteration 7: bool uppercase data -- +array(4) { + [1]=> + string(6) "uppert" + ["value"]=> + string(6) "uppert" + [0]=> + int(1) + ["key"]=> + int(1) +} + +-- Iteration 8: empty double quotes data -- +array(4) { + [1]=> + string(6) "emptyd" + ["value"]=> + string(6) "emptyd" + [0]=> + string(0) "" + ["key"]=> + string(0) "" +} + +-- Iteration 9: empty single quotes data -- +array(4) { + [1]=> + string(6) "emptys" + ["value"]=> + string(6) "emptys" + [0]=> + string(0) "" + ["key"]=> + string(0) "" +} + +-- Iteration 10: string data -- +array(4) { + [1]=> + string(7) "stringd" + ["value"]=> + string(7) "stringd" + [0]=> + string(7) "stringd" + ["key"]=> + string(7) "stringd" +} + +-- Iteration 11: undefined data -- +array(4) { + [1]=> + string(9) "undefined" + ["value"]=> + string(9) "undefined" + [0]=> + string(0) "" + ["key"]=> + string(0) "" +} + +-- Iteration 12: unset data -- +array(4) { + [1]=> + string(5) "unset" + ["value"]=> + string(5) "unset" + [0]=> + string(0) "" + ["key"]=> + string(0) "" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt new file mode 100644 index 0000000..535ae29 --- /dev/null +++ b/ext/standard/tests/array/each_variation4.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test each() function : usage variations - Referenced variables +--FILE-- + &$val1, &$val2); + +echo "-- Call each until at the end of the array: --\n"; +var_dump( each($arr1) ); +var_dump( each($arr1) ); +var_dump( each($arr1) ); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing each() : usage variations *** + +-- Array made up of referenced variables: -- +-- Call each until at the end of the array: -- +array(4) { + [1]=> + string(3) "foo" + ["value"]=> + string(3) "foo" + [0]=> + string(3) "one" + ["key"]=> + string(3) "one" +} +array(4) { + [1]=> + string(3) "bar" + ["value"]=> + string(3) "bar" + [0]=> + int(0) + ["key"]=> + int(0) +} +bool(false) +Done diff --git a/ext/standard/tests/array/each_variation5.phpt b/ext/standard/tests/array/each_variation5.phpt new file mode 100644 index 0000000..941ad5e --- /dev/null +++ b/ext/standard/tests/array/each_variation5.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test each() function : usage variations - Multi-dimensional arrays +--FILE-- + 'un', + array('a', 'b', 'c') + ); + +echo "\n-- Pass each() a two-dimensional array --\n"; +for ($i = 1; $i < count($arr); $i++) { + var_dump( each($arr) ); +} + +echo "\n-- Pass each() a sub-array --\n"; +var_dump( each($arr[2])); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing each() : usage variations *** + +-- Pass each() a two-dimensional array -- +array(4) { + [1]=> + string(4) "zero" + ["value"]=> + string(4) "zero" + [0]=> + int(0) + ["key"]=> + int(0) +} +array(4) { + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + ["value"]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [0]=> + int(1) + ["key"]=> + int(1) +} +array(4) { + [1]=> + string(2) "un" + ["value"]=> + string(2) "un" + [0]=> + string(3) "one" + ["key"]=> + string(3) "one" +} + +-- Pass each() a sub-array -- +array(4) { + [1]=> + string(1) "a" + ["value"]=> + string(1) "a" + [0]=> + int(0) + ["key"]=> + int(0) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt new file mode 100644 index 0000000..445d63f --- /dev/null +++ b/ext/standard/tests/array/each_variation6.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test each() function : usage variations - Internal array pointer +--FILE-- + " . current($arr) . "\n"; + +echo "\n-- Call to each(): --\n"; +var_dump( each($arr) ); + +echo "\n-- New position: --\n"; +echo key($arr) . " => " . current($arr) . "\n"; + +echo "Done"; +?> + +--EXPECTF-- +*** Testing each() : usage variations *** + +-- Current position: -- +0 => zero + +-- Call to each(): -- +array(4) { + [1]=> + string(4) "zero" + ["value"]=> + string(4) "zero" + [0]=> + int(0) + ["key"]=> + int(0) +} + +-- New position: -- +1 => one +Done \ No newline at end of file diff --git a/ext/standard/tests/array/end.phpt b/ext/standard/tests/array/end.phpt new file mode 100644 index 0000000..a99f90b --- /dev/null +++ b/ext/standard/tests/array/end.phpt @@ -0,0 +1,237 @@ +--TEST-- +Test end() function +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL ), + array(1, array(1, 2 => 3 ), "one" => 1, "5" => 5 ), + array(-1, -2, -3, -4, "-0.005" => "neg0.005", 2.0 => "float2", "neg.9" => -.9 ), + array(1.0005, 2.000000, -3.000000, -4.9999999 ), + array(true, false), + array("PHP", "Web2.0", "SOA"), + array(1, array() ), + array(1, 2, "" ), + array(" "), + array(2147483647, 2147483648, -2147483647, -2147483648 ), + array(0x7FFFFFFF, -0x80000000, 017777777777, -020000000000 ), + array(-.6700000E+3, -4.10003E+3, 1e-5, -1E+5, 000002.00 ) +); +/* loop through $arrays to print the last element of each sub-array */ +echo "*** Testing end() on different arrays ***\n"; +$counter = 1; +foreach ($arrays as $sub_array){ + echo "-- Iteration $counter --\n"; + var_dump( end($sub_array) ); + /* ensure that internal pointer is moved to last element */ + var_dump( current($sub_array) ); + $counter++; +} + +/* checking for end() on sub-arrays */ +echo "\n*** Testing end() with sub-arrays ***\n"; +$test_array = array(1, array(1 => "one", "two" => 2, "" => "f") ); +var_dump( end($test_array) ); +var_dump( end($test_array[1]) ); + +/* checking working of end() when array elements are deleted */ +echo "\n*** Testing end() when array elements are deleted ***\n"; +$array_test = array("a", "b", "d", 7, "u" => "U", -4, "-.008" => "neg.008"); + +// remove first element from array +echo "\n-- Remove first element from array --\n"; +unset($array_test[0]); +var_dump( end($array_test) ); + +// remove last element from array, rewind and check end() +echo "\n-- Remove last element from array --\n"; +unset($array_test['-.008']); +var_dump( end($array_test) ); +reset( $array_test ); +var_dump( end($array_test) ); + +// remove any element !first, !last, rewind and check end() +echo "\n-- Remove any element from array apart from first and last element --\n"; +unset($array_test[7]); +var_dump( end($array_test) ); +var_dump( reset($array_test) ); +var_dump( end($array_test) ); + +/* Checking on OBJECTS type */ +echo "\n*** Testing end() on objects ***\n"; +class foo +{ + function __toString() { + return "Object"; + } +} +class foo1 +{ + function __toString() { + return "Object1"; + } +} + +$object1 = new foo(); //new object created +$object2 = new foo1(); + +$array_object = array(); +$array_object[0] = &$object1; +$array_object[1] = &$object2; +var_dump( end($array_object) ); +var_dump($array_object); + +/* Checking on RESOURCE type */ +echo "\n*** Testing end() on resource type ***\n"; +//file type resource +$file_handle = fopen(__FILE__, "r"); + +//directory type resource +$dir_handle = opendir( dirname(__FILE__) ); + +//store resources in array +$resources = array($file_handle, $dir_handle); +var_dump( end($resources) ); +var_dump( current($resources) ); + +echo "\n*** Testing error conditions ***\n"; +/* checking for unexpected number of arguments */ +var_dump( end() ); +var_dump( end($array[0], $array[0]) ); + +/* checking for unexpected type of arguments */ +$var=1; +$var1="string"; +var_dump( end($var) ); +var_dump( end($var1) ); + +/* checking null array */ +$null_array = array(); +var_dump( end($null_array) ); + +echo "Done\n"; + + +/* cleaning resource handles */ +fclose( $file_handle ); //file resource handle deleted +closedir( $dir_handle ); //dir resource handle deleted + +?> +--EXPECTF-- +*** Testing end() on different arrays *** +-- Iteration 1 -- +int(0) +int(0) +-- Iteration 2 -- +int(100) +int(100) +-- Iteration 3 -- +string(1) "y" +string(1) "y" +-- Iteration 4 -- +NULL +NULL +-- Iteration 5 -- +int(5) +int(5) +-- Iteration 6 -- +float(-0.9) +float(-0.9) +-- Iteration 7 -- +float(-4.9999999) +float(-4.9999999) +-- Iteration 8 -- +bool(false) +bool(false) +-- Iteration 9 -- +string(3) "SOA" +string(3) "SOA" +-- Iteration 10 -- +array(0) { +} +array(0) { +} +-- Iteration 11 -- +string(0) "" +string(0) "" +-- Iteration 12 -- +string(1) " " +string(1) " " +-- Iteration 13 -- +float(-2147483648) +float(-2147483648) +-- Iteration 14 -- +float(-2147483648) +float(-2147483648) +-- Iteration 15 -- +float(2) +float(2) + +*** Testing end() with sub-arrays *** +array(3) { + [1]=> + string(3) "one" + ["two"]=> + int(2) + [""]=> + string(1) "f" +} +string(1) "f" + +*** Testing end() when array elements are deleted *** + +-- Remove first element from array -- +string(7) "neg.008" + +-- Remove last element from array -- +int(-4) +int(-4) + +-- Remove any element from array apart from first and last element -- +int(-4) +string(1) "b" +int(-4) + +*** Testing end() on objects *** +object(foo1)#%d (0) { +} +array(2) { + [0]=> + &object(foo)#%d (0) { + } + [1]=> + &object(foo1)#%d (0) { + } +} + +*** Testing end() on resource type *** +resource(%d) of type (stream) +resource(%d) of type (stream) + +*** Testing error conditions *** + +Warning: end() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: end() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: end() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: end() expects parameter 1 to be array, string given in %s on line %d +NULL +bool(false) +Done diff --git a/ext/standard/tests/array/end_64bit.phpt b/ext/standard/tests/array/end_64bit.phpt new file mode 100644 index 0000000..23d410e --- /dev/null +++ b/ext/standard/tests/array/end_64bit.phpt @@ -0,0 +1,238 @@ +--TEST-- +Test end() function +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL ), + array(1, array(1, 2 => 3 ), "one" => 1, "5" => 5 ), + array(-1, -2, -3, -4, "-0.005" => "neg0.005", 2.0 => "float2", "neg.9" => -.9 ), + array(1.0005, 2.000000, -3.000000, -4.9999999 ), + array(true, false), + array("PHP", "Web2.0", "SOA"), + array(1, array() ), + array(1, 2, "" ), + array(" "), + array(2147483647, 2147483648, -2147483647, -2147483648 ), + array(0x7FFFFFFF, -0x80000000, 017777777777, -020000000000 ), + array(-.6700000E+3, -4.10003E+3, 1e-5, -1E+5, 000002.00 ) +); +/* loop through $arrays to print the last element of each sub-array */ +echo "*** Testing end() on different arrays ***\n"; +$counter = 1; +foreach ($arrays as $sub_array){ + echo "-- Iteration $counter --\n"; + var_dump( end($sub_array) ); + /* ensure that internal pointer is moved to last element */ + var_dump( current($sub_array) ); + $counter++; +} + +/* checking for end() on sub-arrays */ +echo "\n*** Testing end() with sub-arrays ***\n"; +$test_array = array(1, array(1 => "one", "two" => 2, "" => "f") ); +var_dump( end($test_array) ); +var_dump( end($test_array[1]) ); + +/* checking working of end() when array elements are deleted */ +echo "\n*** Testing end() when array elements are deleted ***\n"; +$array_test = array("a", "b", "d", 7, "u" => "U", -4, "-.008" => "neg.008"); + +// remove first element from array +echo "\n-- Remove first element from array --\n"; +unset($array_test[0]); +var_dump( end($array_test) ); + +// remove last element from array, rewind and check end() +echo "\n-- Remove last element from array --\n"; +unset($array_test['-.008']); +var_dump( end($array_test) ); +reset( $array_test ); +var_dump( end($array_test) ); + +// remove any element !first, !last, rewind and check end() +echo "\n-- Remove any element from array apart from first and last element --\n"; +unset($array_test[7]); +var_dump( end($array_test) ); +var_dump( reset($array_test) ); +var_dump( end($array_test) ); + +/* Checking on OBJECTS type */ +echo "\n*** Testing end() on objects ***\n"; +class foo +{ + function __toString() { + return "Object"; + } +} +class foo1 +{ + function __toString() { + return "Object1"; + } +} + +$object1 = new foo(); //new object created +$object2 = new foo1(); + +$array_object = array(); +$array_object[0] = &$object1; +$array_object[1] = &$object2; +var_dump( end($array_object) ); +var_dump($array_object); + +/* Checking on RESOURCE type */ +echo "\n*** Testing end() on resource type ***\n"; +//file type resource +$file_handle = fopen(__FILE__, "r"); + +//directory type resource +$dir_handle = opendir( dirname(__FILE__) ); + +//store resources in array +$resources = array($file_handle, $dir_handle); +var_dump( end($resources) ); +var_dump( current($resources) ); + +echo "\n*** Testing error conditions ***\n"; +/* checking for unexpected number of arguments */ +var_dump( end() ); +var_dump( end($array[0], $array[0]) ); + +/* checking for unexpected type of arguments */ +$var=1; +$var1="string"; +var_dump( end($var) ); +var_dump( end($var1) ); + +/* checking null array */ +$null_array = array(); +var_dump( end($null_array) ); + +echo "Done\n"; + +?> + +--CLEAN-- +/* cleaning resource handles */ +fclose( $file_handle ); //file resource handle deleted +closedir( $dir_handle ); //dir resource handle deleted + +--EXPECTF-- +*** Testing end() on different arrays *** +-- Iteration 1 -- +int(0) +int(0) +-- Iteration 2 -- +int(100) +int(100) +-- Iteration 3 -- +string(1) "y" +string(1) "y" +-- Iteration 4 -- +NULL +NULL +-- Iteration 5 -- +int(5) +int(5) +-- Iteration 6 -- +float(-0.9) +float(-0.9) +-- Iteration 7 -- +float(-4.9999999) +float(-4.9999999) +-- Iteration 8 -- +bool(false) +bool(false) +-- Iteration 9 -- +string(3) "SOA" +string(3) "SOA" +-- Iteration 10 -- +array(0) { +} +array(0) { +} +-- Iteration 11 -- +string(0) "" +string(0) "" +-- Iteration 12 -- +string(1) " " +string(1) " " +-- Iteration 13 -- +int(-2147483648) +int(-2147483648) +-- Iteration 14 -- +int(-2147483648) +int(-2147483648) +-- Iteration 15 -- +float(2) +float(2) + +*** Testing end() with sub-arrays *** +array(3) { + [1]=> + string(3) "one" + ["two"]=> + int(2) + [""]=> + string(1) "f" +} +string(1) "f" + +*** Testing end() when array elements are deleted *** + +-- Remove first element from array -- +string(7) "neg.008" + +-- Remove last element from array -- +int(-4) +int(-4) + +-- Remove any element from array apart from first and last element -- +int(-4) +string(1) "b" +int(-4) + +*** Testing end() on objects *** +object(foo1)#%d (0) { +} +array(2) { + [0]=> + &object(foo)#%d (0) { + } + [1]=> + &object(foo1)#%d (0) { + } +} + +*** Testing end() on resource type *** +resource(%d) of type (stream) +resource(%d) of type (stream) + +*** Testing error conditions *** + +Warning: end() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: end() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: end() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: end() expects parameter 1 to be array, string given in %s on line %d +NULL +bool(false) +Done diff --git a/ext/standard/tests/array/end_basic.phpt b/ext/standard/tests/array/end_basic.phpt new file mode 100644 index 0000000..5a6606d --- /dev/null +++ b/ext/standard/tests/array/end_basic.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test end() function : basic functionality +--FILE-- + 'two'); + +echo "\n-- Initial Position: --\n"; +echo key($array) . " => " . current($array) . "\n"; + +echo "\n-- Call to end() --\n"; +var_dump(end($array)); + +echo "\n-- Current Position: --\n"; +echo key($array) . " => " . current($array) . "\n"; + +echo "\n-- Add a new element to array --\n"; +$array[2] = 'foo'; +var_dump(end($array)); +?> +===DONE=== +--EXPECTF-- +*** Testing end() : basic functionality *** + +-- Initial Position: -- +0 => zero + +-- Call to end() -- +string(3) "two" + +-- Current Position: -- +200 => two + +-- Add a new element to array -- +string(3) "foo" +===DONE=== diff --git a/ext/standard/tests/array/end_error.phpt b/ext/standard/tests/array/end_error.phpt new file mode 100644 index 0000000..96e8429 --- /dev/null +++ b/ext/standard/tests/array/end_error.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test end() function : error conditions - Pass incorrect number of args +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing end() : error conditions *** + +-- Testing end() function with Zero arguments -- + +Warning: end() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing end() function with more than expected no. of arguments -- + +Warning: end() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/end_variation1.phpt b/ext/standard/tests/array/end_variation1.phpt new file mode 100644 index 0000000..79354ab --- /dev/null +++ b/ext/standard/tests/array/end_variation1.phpt @@ -0,0 +1,220 @@ +--TEST-- +Test end() function : usage variations - Pass different data types as $array_arg +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing end() : usage variations *** + +-- Iteration 1 -- + +Warning: end() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: end() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: end() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: end() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: end() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: end() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: end() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: end() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: end() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: end() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: end() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: end() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: end() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: end() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: end() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: end() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: end() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +bool(false) + +-- Iteration 19 -- + +Warning: end() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: end() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: end() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- +string(12) "hello, world" + +-- Iteration 23 -- + +Warning: end() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: end() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: end() expects parameter 1 to be array, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/end_variation2.phpt b/ext/standard/tests/array/end_variation2.phpt new file mode 100644 index 0000000..180f7cd --- /dev/null +++ b/ext/standard/tests/array/end_variation2.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test end() function : usage variations - Multi-dimensional arrays +--FILE-- + 'z', array(9, 8, 7)); + +echo "\n-- Pass a two-dimensional array as \$array_arg --\n"; +var_dump(end($array_arg)); + +echo "\n-- Pass a sub-array as \$array_arg --\n"; +var_dump(end($array_arg[0])); +?> +===DONE=== +--EXPECTF-- +*** Testing end() : usage variations *** + +-- Pass a two-dimensional array as $array_arg -- +array(3) { + [0]=> + int(9) + [1]=> + int(8) + [2]=> + int(7) +} + +-- Pass a sub-array as $array_arg -- +int(7) +===DONE=== diff --git a/ext/standard/tests/array/end_variation3.phpt b/ext/standard/tests/array/end_variation3.phpt new file mode 100644 index 0000000..cd1e2d0 --- /dev/null +++ b/ext/standard/tests/array/end_variation3.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test end() function : usage variations - Referenced variables +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing end() : usage variations *** + +-- Initial position of internal pointer -- +string(4) "zero" + +-- Position after calling end() -- +$array1: string(3) "two" +$array2: string(3) "two" +===DONE=== diff --git a/ext/standard/tests/array/extract_error.phpt b/ext/standard/tests/array/extract_error.phpt new file mode 100644 index 0000000..96cad9d --- /dev/null +++ b/ext/standard/tests/array/extract_error.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test extract() function (error conditions) +--FILE-- + + +--EXPECTF-- +*** Testing Error Conditions *** + +Warning: extract() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Notice: A non well formed numeric value encountered in %s on line %d + +Warning: extract(): Invalid extract type in %s on line %d +NULL + +Warning: extract(): Invalid extract type in %s on line %d +NULL + +Warning: extract() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: extract() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: extract() expects at most 3 parameters, 4 given in %s on line %d +NULL + +Warning: extract(): specified extract type requires the prefix parameter in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/extract_safety.phpt b/ext/standard/tests/array/extract_safety.phpt new file mode 100644 index 0000000..d5d0763 --- /dev/null +++ b/ext/standard/tests/array/extract_safety.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test extract() for overwrite of GLOBALS +--FILE-- + "bar"); +var_dump(extract(array("GLOBALS" => $splat, EXTR_OVERWRITE))); + +unset ($splat); + +debug_zval_dump($GLOBALS["str"]); + +echo "\nDone"; +?> + +--EXPECTF-- +string(4) "John" refcount(2) +int(0) +string(4) "John" refcount(2) + +Done \ No newline at end of file diff --git a/ext/standard/tests/array/extract_variation1.phpt b/ext/standard/tests/array/extract_variation1.phpt new file mode 100644 index 0000000..1b2ea19 --- /dev/null +++ b/ext/standard/tests/array/extract_variation1.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test extract() function (variation 1) +--FILE-- + + +--EXPECTF-- +long(4) refcount(2) +string(4) "John" refcount(2) +int(%d) +long(4) refcount(2) +string(4) "John" refcount(2) + +Done diff --git a/ext/standard/tests/array/extract_variation10.phpt b/ext/standard/tests/array/extract_variation10.phpt new file mode 100644 index 0000000..d520be7 --- /dev/null +++ b/ext/standard/tests/array/extract_variation10.phpt @@ -0,0 +1,13 @@ +--TEST-- +Test extract() function - ensure EXTR_REFS doesn't mess with isRef flag on COW references to array elements. +--FILE-- + 'original.foo'); +$nonref = $a['foo']; +$ref = &$a; +extract($a, EXTR_REFS); +$a['foo'] = 'changed.foo'; +var_dump($nonref); +?> +--EXPECTF-- +%unicode|string%(12) "original.foo" diff --git a/ext/standard/tests/array/extract_variation11.phpt b/ext/standard/tests/array/extract_variation11.phpt new file mode 100644 index 0000000..7f6e08c --- /dev/null +++ b/ext/standard/tests/array/extract_variation11.phpt @@ -0,0 +1,13 @@ +--TEST-- +Test extract() function - ensure EXTR_REFS works when array is referenced and keys clash with variables in current scope. +--FILE-- + 'original.foo'); +$ref = &$a; +$foo = 'test'; +extract($a, EXTR_OVERWRITE|EXTR_REFS); +$foo = 'changed.foo'; +var_dump($a['foo']); +?> +--EXPECTF-- +%unicode|string%(11) "changed.foo" diff --git a/ext/standard/tests/array/extract_variation2.phpt b/ext/standard/tests/array/extract_variation2.phpt new file mode 100644 index 0000000..570e75f --- /dev/null +++ b/ext/standard/tests/array/extract_variation2.phpt @@ -0,0 +1,69 @@ +--TEST-- +Test extract() function (variation 2) +--FILE-- + +--EXPECTF-- +-- Iteration 0 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(9) +int(0) +int(9) +int(9) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(5) +int(0) +int(5) +int(5) +int(0) +Done diff --git a/ext/standard/tests/array/extract_variation3.phpt b/ext/standard/tests/array/extract_variation3.phpt new file mode 100644 index 0000000..2dcb775 --- /dev/null +++ b/ext/standard/tests/array/extract_variation3.phpt @@ -0,0 +1,69 @@ +--TEST-- +Test extract() function (variation 3) +--FILE-- + "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ), + array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), +); + +$counter = 0; + +foreach ( $mixed_array as $sub_array ) { + echo "\n-- Iteration $counter --\n"; + $counter++; + + var_dump ( extract($sub_array)); /* Single Argument */ + + /* variations of two arguments */ + var_dump ( extract($sub_array, EXTR_OVERWRITE)); + var_dump ( extract($sub_array, EXTR_SKIP)); + var_dump ( extract($sub_array, EXTR_IF_EXISTS)); + + /* variations of three arguments with use of various extract types*/ + var_dump ( extract($sub_array, EXTR_PREFIX_INVALID, "ssd")); + var_dump ( extract($sub_array, EXTR_PREFIX_SAME, "sss")); + var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "bb")); + var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "")); // "_" taken as default prefix + var_dump ( extract($sub_array, EXTR_PREFIX_IF_EXISTS, "bb")); +} + +echo "Done\n"; +?> +--EXPECTF-- +-- Iteration 0 -- +int(0) +int(0) +int(0) +int(0) +int(8) +int(0) +int(8) +int(8) +int(0) + +-- Iteration 1 -- +int(5) +int(5) +int(0) +int(5) +int(5) +int(5) +int(5) +int(5) +int(5) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(5) +int(0) +int(5) +int(5) +int(0) +Done diff --git a/ext/standard/tests/array/extract_variation4.phpt b/ext/standard/tests/array/extract_variation4.phpt new file mode 100644 index 0000000..11528f4 --- /dev/null +++ b/ext/standard/tests/array/extract_variation4.phpt @@ -0,0 +1,69 @@ +--TEST-- +Test extract() function (variation 4) +--FILE-- + "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), + array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", + "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + array( 12, "name", 'age', '45' ), +); + +$counter = 0; + +foreach ( $mixed_array as $sub_array ) { + echo "\n-- Iteration $counter --\n"; + $counter++; + + var_dump ( extract($sub_array)); /* Single Argument */ + + /* variations of two arguments */ + var_dump ( extract($sub_array, EXTR_OVERWRITE)); + var_dump ( extract($sub_array, EXTR_SKIP)); + var_dump ( extract($sub_array, EXTR_IF_EXISTS)); + + /* variations of three arguments with use of various extract types*/ + var_dump ( extract($sub_array, EXTR_PREFIX_INVALID, "ssd")); + var_dump ( extract($sub_array, EXTR_PREFIX_SAME, "sss")); + var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "bb")); + var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "")); // "_" taken as default prefix + var_dump ( extract($sub_array, EXTR_PREFIX_IF_EXISTS, "bb")); +} + +echo "Done\n"; +?> +--EXPECTF-- +-- Iteration 0 -- +int(0) +int(0) +int(0) +int(0) +int(5) +int(0) +int(5) +int(5) +int(0) + +-- Iteration 1 -- +int(4) +int(4) +int(0) +int(4) +int(12) +int(4) +int(11) +int(11) +int(4) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(4) +int(0) +int(4) +int(4) +int(0) +Done diff --git a/ext/standard/tests/array/extract_variation5.phpt b/ext/standard/tests/array/extract_variation5.phpt new file mode 100644 index 0000000..4a3e95b --- /dev/null +++ b/ext/standard/tests/array/extract_variation5.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test extract() function (variation 5) +--FILE-- + 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, + 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 ) +); + +$counter = 0; + +foreach ( $mixed_array as $sub_array ) { + echo "\n-- Iteration $counter --\n"; + $counter++; + + var_dump ( extract($sub_array)); /* Single Argument */ + + /* variations of two arguments */ + var_dump ( extract($sub_array, EXTR_OVERWRITE)); + var_dump ( extract($sub_array, EXTR_SKIP)); + var_dump ( extract($sub_array, EXTR_IF_EXISTS)); + + /* variations of three arguments with use of various extract types*/ + var_dump ( extract($sub_array, EXTR_PREFIX_INVALID, "ssd")); + var_dump ( extract($sub_array, EXTR_PREFIX_SAME, "sss")); + var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "bb")); + var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "")); // "_" taken as default prefix + var_dump ( extract($sub_array, EXTR_PREFIX_IF_EXISTS, "bb")); +} + +echo "Done\n"; +?> +--EXPECTF-- +-- Iteration 0 -- +int(0) +int(0) +int(0) +int(0) +int(3) +int(0) +int(3) +int(3) +int(0) + +-- Iteration 1 -- +int(2) +int(2) +int(0) +int(2) +int(8) +int(2) +int(8) +int(8) +int(2) +Done diff --git a/ext/standard/tests/array/extract_variation6.phpt b/ext/standard/tests/array/extract_variation6.phpt new file mode 100644 index 0000000..7eac67e --- /dev/null +++ b/ext/standard/tests/array/extract_variation6.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test extract() function (variation 6) +--FILE-- + 'aaa'); +var_dump ( extract($a, EXTR_REFS)); +var_dump($foo); + +$b = $a; +$b['foo'] = 'bbb'; +var_dump ( extract($a, EXTR_REFS)); +var_dump($foo); +var_dump($a); + +echo "Done\n"; +?> +--EXPECTF-- +int(1) +string(3) "aaa" +int(1) +string(3) "bbb" +array(1) { + ["foo"]=> + &string(3) "bbb" +} +Done diff --git a/ext/standard/tests/array/extract_variation7.phpt b/ext/standard/tests/array/extract_variation7.phpt new file mode 100644 index 0000000..653941d --- /dev/null +++ b/ext/standard/tests/array/extract_variation7.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test extract() function (variation 7) +--FILE-- + "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ); +var_dump ( extract($a, EXTR_PREFIX_ALL, "same")); + +$b = array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", + "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ); +var_dump ( extract($b, EXTR_PREFIX_ALL, "same")); +var_dump ( extract($b, EXTR_PREFIX_ALL, "diff")); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing for EXTR_PREFIX_ALL called twice with same prefix string *** +int(5) +int(11) +int(11) +Done diff --git a/ext/standard/tests/array/extract_variation8.phpt b/ext/standard/tests/array/extract_variation8.phpt new file mode 100644 index 0000000..0d15fd4 --- /dev/null +++ b/ext/standard/tests/array/extract_variation8.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test extract() function (variation 8) +--FILE-- + + +--EXPECTF-- +*** Testing for Numerical prefixes *** +int(3) +int(1) + +Done diff --git a/ext/standard/tests/array/extract_variation9.phpt b/ext/standard/tests/array/extract_variation9.phpt new file mode 100644 index 0000000..4d42a69 --- /dev/null +++ b/ext/standard/tests/array/extract_variation9.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test extract() function (variation 9) +--FILE-- + +--EXPECT-- +*** Testing for object *** +int(1) +Done diff --git a/ext/standard/tests/array/in_array_errors.phpt b/ext/standard/tests/array/in_array_errors.phpt new file mode 100644 index 0000000..13a6cdb --- /dev/null +++ b/ext/standard/tests/array/in_array_errors.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test in_array() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing error conditions of in_array() *** + +Warning: in_array() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: in_array() expects at most 3 parameters, 4 given in %s on line %d +NULL + +Warning: in_array() expects at least 2 parameters, 1 given in %s on line %d +NULL + +Warning: in_array() expects parameter 2 to be array, string given in %s on line %d +NULL + +Warning: in_array() expects parameter 2 to be array, integer given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/in_array_variation1.phpt b/ext/standard/tests/array/in_array_variation1.phpt new file mode 100644 index 0000000..470738b --- /dev/null +++ b/ext/standard/tests/array/in_array_variation1.phpt @@ -0,0 +1,642 @@ +--TEST-- +Test in_array() function : usage variations - different needdle values +--FILE-- + "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL, "b", "ab", "abcd"), + array(4, array(1, 2 => 3), "one" => 1, "5" => 5 ), + array(-1, -2, -3, -4, -2.989888, "-0.005" => "neg0.005", 2.0 => "float2", "-.9" => -.9), + array(TRUE, FALSE), + array("", array()), + array("abcd\x00abcd\x00abcd"), + array("abcd\tabcd\nabcd\rabcd\0abcdefghij") +); + +$array_compare = array ( + 4, + "4", + 4.00, + "b", + "5", + -2, + -2.0, + -2.98989, + "-.9", + "True", + "", + array(), + NULL, + "ab", + "abcd", + 0.0, + -0, + "abcd\x00abcd\x00abcd" +); +/* loop to check if elements in $array_compare exist in $arrays + using in_array() */ +$counter = 1; +foreach($arrays as $array) { + foreach($array_compare as $compare) { + echo "-- Iteration $counter --\n"; + //strict option OFF + var_dump(in_array($compare,$array)); + //strict option ON + var_dump(in_array($compare,$array,TRUE)); + //strict option OFF + var_dump(in_array($compare,$array,FALSE)); + $counter++; + } +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing in_array() with different needle values *** +-- Iteration 1 -- +bool(false) +bool(false) +bool(false) +-- Iteration 2 -- +bool(false) +bool(false) +bool(false) +-- Iteration 3 -- +bool(false) +bool(false) +bool(false) +-- Iteration 4 -- +bool(true) +bool(false) +bool(true) +-- Iteration 5 -- +bool(false) +bool(false) +bool(false) +-- Iteration 6 -- +bool(false) +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +bool(false) +-- Iteration 8 -- +bool(false) +bool(false) +bool(false) +-- Iteration 9 -- +bool(false) +bool(false) +bool(false) +-- Iteration 10 -- +bool(true) +bool(false) +bool(true) +-- Iteration 11 -- +bool(true) +bool(false) +bool(true) +-- Iteration 12 -- +bool(false) +bool(false) +bool(false) +-- Iteration 13 -- +bool(true) +bool(false) +bool(true) +-- Iteration 14 -- +bool(true) +bool(false) +bool(true) +-- Iteration 15 -- +bool(true) +bool(false) +bool(true) +-- Iteration 16 -- +bool(true) +bool(false) +bool(true) +-- Iteration 17 -- +bool(true) +bool(true) +bool(true) +-- Iteration 18 -- +bool(true) +bool(false) +bool(true) +-- Iteration 19 -- +bool(true) +bool(true) +bool(true) +-- Iteration 20 -- +bool(true) +bool(false) +bool(true) +-- Iteration 21 -- +bool(true) +bool(false) +bool(true) +-- Iteration 22 -- +bool(true) +bool(true) +bool(true) +-- Iteration 23 -- +bool(false) +bool(false) +bool(false) +-- Iteration 24 -- +bool(false) +bool(false) +bool(false) +-- Iteration 25 -- +bool(false) +bool(false) +bool(false) +-- Iteration 26 -- +bool(false) +bool(false) +bool(false) +-- Iteration 27 -- +bool(false) +bool(false) +bool(false) +-- Iteration 28 -- +bool(false) +bool(false) +bool(false) +-- Iteration 29 -- +bool(true) +bool(false) +bool(true) +-- Iteration 30 -- +bool(true) +bool(false) +bool(true) +-- Iteration 31 -- +bool(true) +bool(true) +bool(true) +-- Iteration 32 -- +bool(true) +bool(true) +bool(true) +-- Iteration 33 -- +bool(true) +bool(true) +bool(true) +-- Iteration 34 -- +bool(true) +bool(false) +bool(true) +-- Iteration 35 -- +bool(true) +bool(false) +bool(true) +-- Iteration 36 -- +bool(false) +bool(false) +bool(false) +-- Iteration 37 -- +bool(true) +bool(true) +bool(true) +-- Iteration 38 -- +bool(true) +bool(false) +bool(true) +-- Iteration 39 -- +bool(true) +bool(false) +bool(true) +-- Iteration 40 -- +bool(false) +bool(false) +bool(false) +-- Iteration 41 -- +bool(true) +bool(false) +bool(true) +-- Iteration 42 -- +bool(false) +bool(false) +bool(false) +-- Iteration 43 -- +bool(false) +bool(false) +bool(false) +-- Iteration 44 -- +bool(false) +bool(false) +bool(false) +-- Iteration 45 -- +bool(false) +bool(false) +bool(false) +-- Iteration 46 -- +bool(false) +bool(false) +bool(false) +-- Iteration 47 -- +bool(false) +bool(false) +bool(false) +-- Iteration 48 -- +bool(false) +bool(false) +bool(false) +-- Iteration 49 -- +bool(false) +bool(false) +bool(false) +-- Iteration 50 -- +bool(false) +bool(false) +bool(false) +-- Iteration 51 -- +bool(false) +bool(false) +bool(false) +-- Iteration 52 -- +bool(false) +bool(false) +bool(false) +-- Iteration 53 -- +bool(false) +bool(false) +bool(false) +-- Iteration 54 -- +bool(false) +bool(false) +bool(false) +-- Iteration 55 -- +bool(false) +bool(false) +bool(false) +-- Iteration 56 -- +bool(false) +bool(false) +bool(false) +-- Iteration 57 -- +bool(false) +bool(false) +bool(false) +-- Iteration 58 -- +bool(false) +bool(false) +bool(false) +-- Iteration 59 -- +bool(false) +bool(false) +bool(false) +-- Iteration 60 -- +bool(true) +bool(true) +bool(true) +-- Iteration 61 -- +bool(true) +bool(false) +bool(true) +-- Iteration 62 -- +bool(false) +bool(false) +bool(false) +-- Iteration 63 -- +bool(true) +bool(false) +bool(true) +-- Iteration 64 -- +bool(false) +bool(false) +bool(false) +-- Iteration 65 -- +bool(false) +bool(false) +bool(false) +-- Iteration 66 -- +bool(false) +bool(false) +bool(false) +-- Iteration 67 -- +bool(false) +bool(false) +bool(false) +-- Iteration 68 -- +bool(false) +bool(false) +bool(false) +-- Iteration 69 -- +bool(false) +bool(false) +bool(false) +-- Iteration 70 -- +bool(true) +bool(false) +bool(true) +-- Iteration 71 -- +bool(true) +bool(false) +bool(true) +-- Iteration 72 -- +bool(false) +bool(false) +bool(false) +-- Iteration 73 -- +bool(true) +bool(false) +bool(true) +-- Iteration 74 -- +bool(true) +bool(false) +bool(true) +-- Iteration 75 -- +bool(true) +bool(false) +bool(true) +-- Iteration 76 -- +bool(true) +bool(false) +bool(true) +-- Iteration 77 -- +bool(true) +bool(false) +bool(true) +-- Iteration 78 -- +bool(true) +bool(false) +bool(true) +-- Iteration 79 -- +bool(true) +bool(false) +bool(true) +-- Iteration 80 -- +bool(true) +bool(false) +bool(true) +-- Iteration 81 -- +bool(true) +bool(false) +bool(true) +-- Iteration 82 -- +bool(true) +bool(false) +bool(true) +-- Iteration 83 -- +bool(true) +bool(false) +bool(true) +-- Iteration 84 -- +bool(true) +bool(false) +bool(true) +-- Iteration 85 -- +bool(true) +bool(false) +bool(true) +-- Iteration 86 -- +bool(true) +bool(false) +bool(true) +-- Iteration 87 -- +bool(true) +bool(false) +bool(true) +-- Iteration 88 -- +bool(true) +bool(false) +bool(true) +-- Iteration 89 -- +bool(true) +bool(false) +bool(true) +-- Iteration 90 -- +bool(true) +bool(false) +bool(true) +-- Iteration 91 -- +bool(false) +bool(false) +bool(false) +-- Iteration 92 -- +bool(false) +bool(false) +bool(false) +-- Iteration 93 -- +bool(false) +bool(false) +bool(false) +-- Iteration 94 -- +bool(false) +bool(false) +bool(false) +-- Iteration 95 -- +bool(false) +bool(false) +bool(false) +-- Iteration 96 -- +bool(false) +bool(false) +bool(false) +-- Iteration 97 -- +bool(false) +bool(false) +bool(false) +-- Iteration 98 -- +bool(false) +bool(false) +bool(false) +-- Iteration 99 -- +bool(false) +bool(false) +bool(false) +-- Iteration 100 -- +bool(false) +bool(false) +bool(false) +-- Iteration 101 -- +bool(true) +bool(true) +bool(true) +-- Iteration 102 -- +bool(true) +bool(true) +bool(true) +-- Iteration 103 -- +bool(true) +bool(false) +bool(true) +-- Iteration 104 -- +bool(false) +bool(false) +bool(false) +-- Iteration 105 -- +bool(false) +bool(false) +bool(false) +-- Iteration 106 -- +bool(true) +bool(false) +bool(true) +-- Iteration 107 -- +bool(true) +bool(false) +bool(true) +-- Iteration 108 -- +bool(false) +bool(false) +bool(false) +-- Iteration 109 -- +bool(false) +bool(false) +bool(false) +-- Iteration 110 -- +bool(false) +bool(false) +bool(false) +-- Iteration 111 -- +bool(false) +bool(false) +bool(false) +-- Iteration 112 -- +bool(false) +bool(false) +bool(false) +-- Iteration 113 -- +bool(false) +bool(false) +bool(false) +-- Iteration 114 -- +bool(false) +bool(false) +bool(false) +-- Iteration 115 -- +bool(false) +bool(false) +bool(false) +-- Iteration 116 -- +bool(false) +bool(false) +bool(false) +-- Iteration 117 -- +bool(false) +bool(false) +bool(false) +-- Iteration 118 -- +bool(false) +bool(false) +bool(false) +-- Iteration 119 -- +bool(false) +bool(false) +bool(false) +-- Iteration 120 -- +bool(false) +bool(false) +bool(false) +-- Iteration 121 -- +bool(false) +bool(false) +bool(false) +-- Iteration 122 -- +bool(false) +bool(false) +bool(false) +-- Iteration 123 -- +bool(false) +bool(false) +bool(false) +-- Iteration 124 -- +bool(true) +bool(false) +bool(true) +-- Iteration 125 -- +bool(true) +bool(false) +bool(true) +-- Iteration 126 -- +bool(true) +bool(true) +bool(true) +-- Iteration 127 -- +bool(false) +bool(false) +bool(false) +-- Iteration 128 -- +bool(false) +bool(false) +bool(false) +-- Iteration 129 -- +bool(false) +bool(false) +bool(false) +-- Iteration 130 -- +bool(false) +bool(false) +bool(false) +-- Iteration 131 -- +bool(false) +bool(false) +bool(false) +-- Iteration 132 -- +bool(false) +bool(false) +bool(false) +-- Iteration 133 -- +bool(false) +bool(false) +bool(false) +-- Iteration 134 -- +bool(false) +bool(false) +bool(false) +-- Iteration 135 -- +bool(false) +bool(false) +bool(false) +-- Iteration 136 -- +bool(false) +bool(false) +bool(false) +-- Iteration 137 -- +bool(false) +bool(false) +bool(false) +-- Iteration 138 -- +bool(false) +bool(false) +bool(false) +-- Iteration 139 -- +bool(false) +bool(false) +bool(false) +-- Iteration 140 -- +bool(false) +bool(false) +bool(false) +-- Iteration 141 -- +bool(false) +bool(false) +bool(false) +-- Iteration 142 -- +bool(true) +bool(false) +bool(true) +-- Iteration 143 -- +bool(true) +bool(false) +bool(true) +-- Iteration 144 -- +bool(false) +bool(false) +bool(false) +Done diff --git a/ext/standard/tests/array/in_array_variation2.phpt b/ext/standard/tests/array/in_array_variation2.phpt new file mode 100644 index 0000000..ee1267f --- /dev/null +++ b/ext/standard/tests/array/in_array_variation2.phpt @@ -0,0 +1,102 @@ +--TEST-- +Test in_array() function : usage variations - different haystack values +--FILE-- +'d', + 3, + ".001" =>-67, + "-.051" =>"k", + 0.091 =>"-.08", + "e" =>"5", + "y" =>NULL, + NULL =>"", + 0, + TRUE, + FALSE, + -27.39999999999, + " ", + "abcd\x00abcd\x00\abcd\x00abcdefghij", + "abcd\nabcd\tabcd\rabcd\0abcd" +); +$array_type = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "PHP", ""); +/* loop to do loose and strict type check of elements in + $array_type on elements in $misc_array using in_array(); + checking PHP type comparison tables +*/ +$counter = 1; +foreach($array_type as $type) { + echo "-- Iteration $counter --\n"; + //loose type checking + var_dump( in_array($type,$misc_array ) ); + //strict type checking + var_dump( in_array($type,$misc_array,true) ); + //loose type checking + var_dump( in_array($type,$misc_array,false) ); + $counter++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing in_array() with different haystack values *** +-- Iteration 1 -- +bool(true) +bool(true) +bool(true) +-- Iteration 2 -- +bool(true) +bool(true) +bool(true) +-- Iteration 3 -- +bool(true) +bool(false) +bool(true) +-- Iteration 4 -- +bool(true) +bool(true) +bool(true) +-- Iteration 5 -- +bool(true) +bool(false) +bool(true) +-- Iteration 6 -- +bool(true) +bool(false) +bool(true) +-- Iteration 7 -- +bool(true) +bool(false) +bool(true) +-- Iteration 8 -- +bool(true) +bool(false) +bool(true) +-- Iteration 9 -- +bool(true) +bool(true) +bool(true) +-- Iteration 10 -- +bool(true) +bool(false) +bool(true) +-- Iteration 11 -- +bool(true) +bool(false) +bool(true) +-- Iteration 12 -- +bool(true) +bool(true) +bool(true) +Done diff --git a/ext/standard/tests/array/in_array_variation3.phpt b/ext/standard/tests/array/in_array_variation3.phpt new file mode 100644 index 0000000..c8b6445 --- /dev/null +++ b/ext/standard/tests/array/in_array_variation3.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test in_array() function : usage variations - haystack as sub-array/object +--FILE-- + "two", "three" => 3), + 4 => "four", + "five" => 5, + array('', 'i') +); +var_dump( in_array("four", $sub_array) ); +//checking for element in a sub-array +var_dump( in_array(3, $sub_array[1]) ); +var_dump( in_array(array('','i'), $sub_array) ); + +/* checking for objects in in_array() */ +echo "\n*** Testing objects with in_array() ***\n"; +class in_array_check { + public $array_var = array(1=>"one", "two"=>2, 3=>3); + public function foo() { + echo "Public function\n"; + } +} + +$in_array_obj = new in_array_check(); //creating new object +//error: as wrong datatype for second argument +var_dump( in_array("array_var", $in_array_obj) ); +//error: as wrong datatype for second argument +var_dump( in_array("foo", $in_array_obj) ); +//element found as "one" exists in array $array_var +var_dump( in_array("one", $in_array_obj->array_var) ); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing sub-arrays with in_array() *** +bool(true) +bool(true) +bool(true) + +*** Testing objects with in_array() *** + +Warning: in_array() expects parameter 2 to be array, object given in %s on line %d +NULL + +Warning: in_array() expects parameter 2 to be array, object given in %s on line %d +NULL +bool(true) +Done diff --git a/ext/standard/tests/array/in_array_variation4.phpt b/ext/standard/tests/array/in_array_variation4.phpt new file mode 100644 index 0000000..b88a5a2 --- /dev/null +++ b/ext/standard/tests/array/in_array_variation4.phpt @@ -0,0 +1,77 @@ +--TEST-- +Test in_array() function : usage variations - haystack as resource/multi dimentional array +--FILE-- + TRUE, "b"=> TRUE, + array("c"=> TRUE, "d"=>TRUE) + ) + ) + ); + +//matching string having integer in beginning, result:true in loose type check +var_dump( in_array('123abc', array(123)) ); +var_dump( in_array('123abc', array(123), TRUE) ); // false in strict mode + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing resource type with in_array() *** +bool(true) +bool(false) + +*** Testing miscelleneos inputs with in_array() *** +bool(true) +bool(false) +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) +bool(false) +bool(true) +bool(false) +Done diff --git a/ext/standard/tests/array/key_basic.phpt b/ext/standard/tests/array/key_basic.phpt new file mode 100644 index 0000000..8fdca19 --- /dev/null +++ b/ext/standard/tests/array/key_basic.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test key() function : basic functionality +--FILE-- + 'one', 'two', 'three' => 3); +echo "\n-- Initial Position: --\n"; +var_dump(key($array)); + +echo "\n-- Next Position: --\n"; +next($array); +var_dump(key($array)); + +echo "\n-- End Position: --\n"; +end($array); +var_dump(key($array)); + +echo "\n-- Past end of the array --\n"; +next($array); +var_dump(key($array)); +?> +===DONE=== +--EXPECTF-- +*** Testing key() : basic functionality *** + +-- Initial Position: -- +int(0) + +-- Next Position: -- +int(99) + +-- End Position: -- +string(5) "three" + +-- Past end of the array -- +NULL +===DONE=== diff --git a/ext/standard/tests/array/key_error.phpt b/ext/standard/tests/array/key_error.phpt new file mode 100644 index 0000000..1200f74 --- /dev/null +++ b/ext/standard/tests/array/key_error.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test key() function : error conditions - Pass incorrect number of args +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing key() : error conditions *** + +-- Testing key() function with Zero arguments -- + +Warning: key() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing key() function with more than expected no. of arguments -- + +Warning: key() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/key_exists_basic.phpt b/ext/standard/tests/array/key_exists_basic.phpt new file mode 100644 index 0000000..40d982d --- /dev/null +++ b/ext/standard/tests/array/key_exists_basic.phpt @@ -0,0 +1,15 @@ +--TEST-- +Test function key_exists() by calling it with its expected arguments +--CREDITS-- +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- + 1); +var_dump(key_exists('bar', $a)); +var_dump(key_exists('foo', $a)); +--EXPECTF-- +*** test key_exists() by calling it with its expected arguments *** +bool(true) +bool(false) diff --git a/ext/standard/tests/array/key_exists_error.phpt b/ext/standard/tests/array/key_exists_error.phpt new file mode 100644 index 0000000..1bbd41e --- /dev/null +++ b/ext/standard/tests/array/key_exists_error.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test function key_exists() by calling it more than or less than its expected arguments +--CREDITS-- +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- + 1); +var_dump(key_exists()); +var_dump(key_exists('foo', $a, 'baz')); + +?> +--EXPECTF-- +*** Test by calling method or function with incorrect numbers of arguments *** + +Warning: key_exists() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: key_exists() expects exactly 2 parameters, 3 given in %s on line %d +NULL diff --git a/ext/standard/tests/array/key_exists_variation1.phpt b/ext/standard/tests/array/key_exists_variation1.phpt new file mode 100644 index 0000000..94ea8d4 --- /dev/null +++ b/ext/standard/tests/array/key_exists_variation1.phpt @@ -0,0 +1,15 @@ +--TEST-- +Test function key_exists() by calling it with its expected arguments +--CREDITS-- +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- + 1, 'foo' => array('bar' => 2, 'baz' => 3)); +var_dump(key_exists('baz', $a)); +var_dump(key_exists('baz', $a['foo'])); +--EXPECTF-- +*** test key_exists() by calling it with its expected arguments *** +bool(false) +bool(true) diff --git a/ext/standard/tests/array/key_exists_variation2.phpt b/ext/standard/tests/array/key_exists_variation2.phpt new file mode 100644 index 0000000..5f5ab86 --- /dev/null +++ b/ext/standard/tests/array/key_exists_variation2.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test function key_exists() by calling it with its expected arguments +--CREDITS-- +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- + 'bar', 'foo' => 'baz'); +var_dump(key_exists(0, $a)); + +echo "integer\n"; +// 1 has index = 0 +$b = array(1, 'foo' => 'baz'); +var_dump(key_exists(0, $b)); + +// 42 has index = 0, netherless its position is the latest +$c = array('foo' => 'baz', 42); +var_dump(key_exists(0, $c)); + +echo "string\n"; +// 'bar' has index = 0, netherless it is a string +$d = array('bar', 'foo' => 'baz'); +var_dump(key_exists(0, $d)); + +// 'baz' has index = 0, netherless its position is the latest +$e = array('foo' => 'baz', 'baz'); +var_dump(key_exists(0, $e)); + +echo "obj\n"; +class ObjectA +{ + public $foo = 'bar'; +} + +$obj = new ObjectA(); + +// object has index = 0, netherless its position is the latest +$f = array('foo' => 'baz', $obj); +var_dump(key_exists(0, $f)); + +// object has index = 0, netherless its position is the first +$g = array($obj, 'foo' => 'baz'); +var_dump(key_exists(0, $g)); + +echo "stream resource\n"; +// stream resource has index = 0, netherless its position is the first +$st = fopen('php://memory', '+r'); +$h = array($st, 'foo' => 'baz'); +var_dump(key_exists(0, $h)); + +// stream resource has index = 0, netherless its position is the latest +$i = array('foo' => 'baz', $st); +var_dump(key_exists(0, $i)); + +--EXPECTF-- +*** test key_exists() by using mixed type of arrays *** +bool(false) +integer +bool(true) +bool(true) +string +bool(true) +bool(true) +obj +bool(true) +bool(true) +stream resource +bool(true) +bool(true) diff --git a/ext/standard/tests/array/key_variation1.phpt b/ext/standard/tests/array/key_variation1.phpt new file mode 100644 index 0000000..a0c59b4 --- /dev/null +++ b/ext/standard/tests/array/key_variation1.phpt @@ -0,0 +1,220 @@ +--TEST-- +Test key() function : usage variations - Pass different data types as $array_arg arg. +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing key() : usage variations *** + +-- Iteration 1 -- + +Warning: key() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: key() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: key() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: key() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: key() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: key() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: key() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: key() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: key() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: key() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: key() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: key() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: key() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: key() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: key() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: key() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: key() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +NULL + +-- Iteration 19 -- + +Warning: key() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: key() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: key() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- +string(4) "var1" + +-- Iteration 23 -- + +Warning: key() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: key() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: key() expects parameter 1 to be array, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/key_variation2.phpt b/ext/standard/tests/array/key_variation2.phpt new file mode 100644 index 0000000..3538906 --- /dev/null +++ b/ext/standard/tests/array/key_variation2.phpt @@ -0,0 +1,155 @@ +--TEST-- +Test key() function : usage variations +--FILE-- + array( + 0 => 'zero', + 1 => 'one', + 12345 => 'positive', + -2345 => 'negative', + ), + + // float data +/*2*/ 'float' => array( + 10.5 => 'positive', + -10.5 => 'negative', + .5 => 'half', + ), + +/*3*/ 'extreme floats' => array( + 12.3456789000e6 => 'large', + 12.3456789000E-10 => 'small', + ), + + // null data +/*4*/ 'null uppercase' => array( + NULL => 'null 1', + ), + +/*5*/ 'null lowercase' => array( + null => 'null 2', + ), + + // boolean data +/*6*/ 'bool lowercase' => array( + true => 'lowert', + false => 'lowerf', + ), + +/*7*/ 'bool uppercase' => array( + TRUE => 'uppert', + FALSE => 'upperf', + ), + + // empty data +/*8*/ 'empty double quotes' => array( + "" => 'emptyd', + ), + +/*9*/ 'empty single quotes' => array( + '' => 'emptys', + ), + + // string data +/*10*/ 'string' => array( + "stringd" => 'stringd', + 'strings' => 'strings', + $heredoc => 'stringh', + ), + + // undefined data +/*11*/ 'undefined' => array( + @$undefined_var => 'undefined', + ), + + // unset data +/*12*/ 'unset' => array( + @$unset_var => 'unset', + ), +); + +// loop through each element of $inputs to check the behavior of key() +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator : $key data --\n"; + while (key($input) !== NULL) { + var_dump(key($input)); + next($input); + } + $iterator++; +}; +?> +===DONE=== +--EXPECTF-- +*** Testing key() : usage variations *** + +-- Iteration 1 : int data -- +int(0) +int(1) +int(12345) +int(-2345) + +-- Iteration 2 : float data -- +int(10) +int(-10) +int(0) + +-- Iteration 3 : extreme floats data -- +int(12345678) +int(0) + +-- Iteration 4 : null uppercase data -- +string(0) "" + +-- Iteration 5 : null lowercase data -- +string(0) "" + +-- Iteration 6 : bool lowercase data -- +int(1) +int(0) + +-- Iteration 7 : bool uppercase data -- +int(1) +int(0) + +-- Iteration 8 : empty double quotes data -- +string(0) "" + +-- Iteration 9 : empty single quotes data -- +string(0) "" + +-- Iteration 10 : string data -- +string(7) "stringd" +string(7) "strings" +string(11) "hello world" + +-- Iteration 11 : undefined data -- +string(0) "" + +-- Iteration 12 : unset data -- +string(0) "" +===DONE=== diff --git a/ext/standard/tests/array/key_variation3.phpt b/ext/standard/tests/array/key_variation3.phpt new file mode 100644 index 0000000..a231917 --- /dev/null +++ b/ext/standard/tests/array/key_variation3.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test key() function : usage variations +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing key() : usage variations *** + +-- Initial position of internal pointer -- +int(0) + +-- Position after calling next() -- +$array1: int(1) +$array2: int(1) +===DONE=== diff --git a/ext/standard/tests/array/key_variation4.phpt b/ext/standard/tests/array/key_variation4.phpt new file mode 100644 index 0000000..147d55a --- /dev/null +++ b/ext/standard/tests/array/key_variation4.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test key() function : usage variations +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing key() : usage variations *** + +-- Two Dimensional Array -- +Initial Position: int(0) +Next Position: int(1) +End Position: int(2) + +-- Access an Array Within an Array -- +Initial Position: int(0) + +-- Recursive, Multidimensional Array -- +Current Position: int(2) +int(2) +int(0) +===DONE=== diff --git a/ext/standard/tests/array/krsort_basic.phpt b/ext/standard/tests/array/krsort_basic.phpt new file mode 100644 index 0000000..27361eb --- /dev/null +++ b/ext/standard/tests/array/krsort_basic.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test krsort() function : basic functionality +--FILE-- + "l", "orange" => "o", "banana" => "b" ); +$unsorted_strings = array( + "l" => "lemon", "o" => "orange", + "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", + "b" => "banana", +); +// an array containing unsorted numeric values with indices +$unsorted_numerics = array( 100 => 4, 33 => 3, 555 => 2, 22 => 1 ); + +echo "\n-- Testing krsort() by supplying string array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_strings; +var_dump( krsort($temp_array) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing krsort() by supplying numeric array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_numerics; +var_dump( krsort($temp_array) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing krsort() by supplying string array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $unsorted_strings; +var_dump( krsort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing krsort() by supplying numeric array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $unsorted_numerics; +var_dump( krsort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing krsort() by supplying string array, 'flag' = SORT_STRING --\n"; +$temp_array = $unsorted_strings; +var_dump( krsort($temp_array, SORT_STRING) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing krsort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE --\n"; +$temp_array = $unsorted_strings; +var_dump( krsort($temp_array, SORT_STRING|SORT_FLAG_CASE) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing krsort() by supplying string array (natural), 'flag' = SORT_NATURAL --\n"; +$temp_array = $unsorted_strings; +var_dump( krsort($temp_array, SORT_NATURAL) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing krsort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE --\n"; +$temp_array = $unsorted_strings; +var_dump( krsort($temp_array, SORT_NATURAL|SORT_FLAG_CASE) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing krsort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n"; +$temp_array = $unsorted_numerics; +var_dump( krsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing krsort() : basic functionality *** + +-- Testing krsort() by supplying string array, 'flag' value is defualt -- +bool(true) +array(8) { + ["o20"]=> + string(8) "orange20" + ["o2"]=> + string(7) "orange2" + ["o"]=> + string(6) "orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" + ["O3"]=> + string(7) "Orange3" + ["O1"]=> + string(7) "Orange1" + ["O"]=> + string(6) "Orange" +} + +-- Testing krsort() by supplying numeric array, 'flag' value is defualt -- +bool(true) +array(4) { + [555]=> + int(2) + [100]=> + int(4) + [33]=> + int(3) + [22]=> + int(1) +} + +-- Testing krsort() by supplying string array, 'flag' = SORT_REGULAR -- +bool(true) +array(8) { + ["o20"]=> + string(8) "orange20" + ["o2"]=> + string(7) "orange2" + ["o"]=> + string(6) "orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" + ["O3"]=> + string(7) "Orange3" + ["O1"]=> + string(7) "Orange1" + ["O"]=> + string(6) "Orange" +} + +-- Testing krsort() by supplying numeric array, 'flag' = SORT_REGULAR -- +bool(true) +array(4) { + [555]=> + int(2) + [100]=> + int(4) + [33]=> + int(3) + [22]=> + int(1) +} + +-- Testing krsort() by supplying string array, 'flag' = SORT_STRING -- +bool(true) +array(8) { + ["o20"]=> + string(8) "orange20" + ["o2"]=> + string(7) "orange2" + ["o"]=> + string(6) "orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" + ["O3"]=> + string(7) "Orange3" + ["O1"]=> + string(7) "Orange1" + ["O"]=> + string(6) "Orange" +} + +-- Testing krsort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE -- +bool(true) +array(8) { + ["O3"]=> + string(7) "Orange3" + ["o20"]=> + string(8) "orange20" + ["o2"]=> + string(7) "orange2" + ["O1"]=> + string(7) "Orange1" + ["o"]=> + string(6) "orange" + ["O"]=> + string(6) "Orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" +} + +-- Testing krsort() by supplying string array (natural), 'flag' = SORT_NATURAL -- +bool(true) +array(8) { + ["o20"]=> + string(8) "orange20" + ["o2"]=> + string(7) "orange2" + ["o"]=> + string(6) "orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" + ["O3"]=> + string(7) "Orange3" + ["O1"]=> + string(7) "Orange1" + ["O"]=> + string(6) "Orange" +} + +-- Testing krsort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE -- +bool(true) +array(8) { + ["o20"]=> + string(8) "orange20" + ["O3"]=> + string(7) "Orange3" + ["o2"]=> + string(7) "orange2" + ["O1"]=> + string(7) "Orange1" + ["o"]=> + string(6) "orange" + ["O"]=> + string(6) "Orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" +} + +-- Testing krsort() by supplying numeric array, 'flag' = SORT_NUMERIC -- +bool(true) +array(4) { + [555]=> + int(2) + [100]=> + int(4) + [33]=> + int(3) + [22]=> + int(1) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/krsort_error.phpt b/ext/standard/tests/array/krsort_error.phpt new file mode 100644 index 0000000..1bca5f9 --- /dev/null +++ b/ext/standard/tests/array/krsort_error.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test krsort() function : error conditions +--FILE-- + 1, 2 => 2); +$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING, "SORT_NUMERIC" => SORT_NUMERIC); +$extra_arg = 10; + +// loop through $flag_value array and call krsort with all possible sort flag values +foreach($flags as $key => $flag){ + echo "\n- Sort flag = $key -\n"; + $temp_array = $array_arg; + var_dump( krsort($temp_array,$flag, $extra_arg) ); + var_dump($temp_array); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing krsort() : error conditions *** + +-- Testing krsort() function with zero arguments -- + +Warning: krsort() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing krsort() function with more than expected no. of arguments -- + +- Sort flag = SORT_REGULAR - + +Warning: krsort() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +array(2) { + [1]=> + int(1) + [2]=> + int(2) +} + +- Sort flag = SORT_STRING - + +Warning: krsort() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +array(2) { + [1]=> + int(1) + [2]=> + int(2) +} + +- Sort flag = SORT_NUMERIC - + +Warning: krsort() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +array(2) { + [1]=> + int(1) + [2]=> + int(2) +} +Done diff --git a/ext/standard/tests/array/krsort_object.phpt b/ext/standard/tests/array/krsort_object.phpt new file mode 100644 index 0000000..36d8589 --- /dev/null +++ b/ext/standard/tests/array/krsort_object.phpt @@ -0,0 +1,242 @@ +--TEST-- +Test krsort() function : object functionality - sort objects +--FILE-- +class_value = $value; + } +} + +// class declaration for string objects +class String +{ + public $class_value; + // initializing object member value + function __construct($value){ + $this->class_value = $value; + } + + // return string value + function __tostring() { + return (string)$this->value; + } + +} + +// array of integer objects with different key values +$unsorted_int_obj = array ( + 10 => new Integer(11), 20 => new Integer(66), + 3 => new Integer(23), 4 => new Integer(-5), + 50 => new Integer(0.001), 6 => new Integer(0) +); + +// array of string objects with different key values +$unsorted_str_obj = array ( + "axx" => new String("axx"), "t" => new String("t"), + "w" => new String("w"), "py" => new String("py"), + "apple" => new String("apple"), "Orange" => new String("Orange"), + "Lemon" => new String("Lemon"), "aPPle" => new String("aPPle") +); + + +echo "\n-- Testing krsort() by supplying various object arrays, 'flag' value is defualt --\n"; + +// testing krsort() function by supplying integer object array, flag value is defualt +$temp_array = $unsorted_int_obj; +var_dump(krsort($temp_array) ); +var_dump($temp_array); + +// testing krsort() function by supplying string object array, flag value is defualt +$temp_array = $unsorted_str_obj; +var_dump(krsort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Testing krsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n"; +// testing krsort() function by supplying integer object array, flag value = SORT_REGULAR +$temp_array = $unsorted_int_obj; +var_dump(krsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +// testing krsort() function by supplying string object array, flag value = SORT_REGULAR +$temp_array = $unsorted_str_obj; +var_dump(krsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing krsort() : object functionality *** + +-- Testing krsort() by supplying various object arrays, 'flag' value is defualt -- +bool(true) +array(6) { + [50]=> + object(Integer)#%d (1) { + ["class_value"]=> + float(0.001) + } + [20]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(66) + } + [10]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(11) + } + [6]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(0) + } + [4]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(-5) + } + [3]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(23) + } +} +bool(true) +array(8) { + ["w"]=> + object(String)#%d (1) { + ["class_value"]=> + string(1) "w" + } + ["t"]=> + object(String)#%d (1) { + ["class_value"]=> + string(1) "t" + } + ["py"]=> + object(String)#%d (1) { + ["class_value"]=> + string(2) "py" + } + ["axx"]=> + object(String)#%d (1) { + ["class_value"]=> + string(3) "axx" + } + ["apple"]=> + object(String)#%d (1) { + ["class_value"]=> + string(5) "apple" + } + ["aPPle"]=> + object(String)#%d (1) { + ["class_value"]=> + string(5) "aPPle" + } + ["Orange"]=> + object(String)#%d (1) { + ["class_value"]=> + string(6) "Orange" + } + ["Lemon"]=> + object(String)#%d (1) { + ["class_value"]=> + string(5) "Lemon" + } +} + +-- Testing krsort() by supplying various object arrays, 'flag' value is SORT_REGULAR -- +bool(true) +array(6) { + [50]=> + object(Integer)#%d (1) { + ["class_value"]=> + float(0.001) + } + [20]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(66) + } + [10]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(11) + } + [6]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(0) + } + [4]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(-5) + } + [3]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(23) + } +} +bool(true) +array(8) { + ["w"]=> + object(String)#%d (1) { + ["class_value"]=> + string(1) "w" + } + ["t"]=> + object(String)#%d (1) { + ["class_value"]=> + string(1) "t" + } + ["py"]=> + object(String)#%d (1) { + ["class_value"]=> + string(2) "py" + } + ["axx"]=> + object(String)#%d (1) { + ["class_value"]=> + string(3) "axx" + } + ["apple"]=> + object(String)#%d (1) { + ["class_value"]=> + string(5) "apple" + } + ["aPPle"]=> + object(String)#%d (1) { + ["class_value"]=> + string(5) "aPPle" + } + ["Orange"]=> + object(String)#%d (1) { + ["class_value"]=> + string(6) "Orange" + } + ["Lemon"]=> + object(String)#%d (1) { + ["class_value"]=> + string(5) "Lemon" + } +} +Done diff --git a/ext/standard/tests/array/krsort_variation1.phpt b/ext/standard/tests/array/krsort_variation1.phpt new file mode 100644 index 0000000..e4cbaf8 --- /dev/null +++ b/ext/standard/tests/array/krsort_variation1.phpt @@ -0,0 +1,397 @@ +--TEST-- +Test krsort() function : usage variations - unexpected values for 'array' argument +--FILE-- + +--EXPECTF-- +*** Testing krsort() : usage variations *** + +-- Testing krsort() by supplying different unexpected values for 'array' argument -- + +-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING -- +-- Iteration 1 -- + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 2 -- + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 3 -- + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 7 -- + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 8 -- + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 9 -- + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 10 -- + +Warning: krsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +-- Iteration 11 -- + +Warning: krsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 14 -- + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 15 -- + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 16 -- + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 17 -- + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 18 -- + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 19 -- + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 20 -- + +Warning: krsort() expects parameter 1 to be array, object given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, object given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, object given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, object given in %s on line %d +bool(false) +-- Iteration 21 -- + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 22 -- + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 23 -- + +Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) + +Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/array/krsort_variation10.phpt b/ext/standard/tests/array/krsort_variation10.phpt new file mode 100644 index 0000000..f56d287 --- /dev/null +++ b/ext/standard/tests/array/krsort_variation10.phpt @@ -0,0 +1,98 @@ +--TEST-- +Test krsort() function : usage variations - sort heredoc strings +--FILE-- + "Heredoc", + $simple_heredoc2 => "HEREDOC", + $multiline_heredoc => "heredoc string\twith!@# and 123\nTest this!!!" +); + +echo "\n-- Testing krsort() by supplying heredoc string array, 'flag' value is defualt --\n"; +$temp_array = $array; +var_dump(krsort($temp_array) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing krsort() by supplying heredoc string array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $array; +var_dump(krsort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing krsort() by supplying heredoc string array, 'flag' = SORT_STRING --\n"; +$temp_array = $array; +var_dump(krsort($temp_array, SORT_STRING) ); // expecting : bool(true) +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing krsort() : usage variations *** + +-- Testing krsort() by supplying heredoc string array, 'flag' value is defualt -- +bool(true) +array(3) { + ["heredoc string with!@# and 123 +Test this!!!"]=> + string(43) "heredoc string with!@# and 123 +Test this!!!" + ["Heredoc"]=> + string(7) "Heredoc" + ["HEREDOC"]=> + string(7) "HEREDOC" +} + +-- Testing krsort() by supplying heredoc string array, 'flag' = SORT_REGULAR -- +bool(true) +array(3) { + ["heredoc string with!@# and 123 +Test this!!!"]=> + string(43) "heredoc string with!@# and 123 +Test this!!!" + ["Heredoc"]=> + string(7) "Heredoc" + ["HEREDOC"]=> + string(7) "HEREDOC" +} + +-- Testing krsort() by supplying heredoc string array, 'flag' = SORT_STRING -- +bool(true) +array(3) { + ["heredoc string with!@# and 123 +Test this!!!"]=> + string(43) "heredoc string with!@# and 123 +Test this!!!" + ["Heredoc"]=> + string(7) "Heredoc" + ["HEREDOC"]=> + string(7) "HEREDOC" +} +Done diff --git a/ext/standard/tests/array/krsort_variation11.phpt b/ext/standard/tests/array/krsort_variation11.phpt new file mode 100644 index 0000000..0cfa482 --- /dev/null +++ b/ext/standard/tests/array/krsort_variation11.phpt @@ -0,0 +1,81 @@ +--TEST-- +Test krsort() function : usage variations - sort bool values +--FILE-- + true, false => false, TRUE => TRUE, FALSE => FALSE); + +echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is defualt --\n"; +$temp_array = $bool_values; +var_dump(krsort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_REGULAR --\n"; +$temp_array = $bool_values; +var_dump(krsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_NUMERIC --\n"; +$temp_array = $bool_values; +var_dump(krsort($temp_array, SORT_NUMERIC) ); +var_dump($temp_array); + +echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_STRING --\n"; +$temp_array = $bool_values; +var_dump(krsort($temp_array, SORT_STRING) ); +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing krsort() : usage variations *** + +-- Testing krsort() by supplying boolean value array, 'flag' value is defualt -- +bool(true) +array(2) { + [1]=> + bool(true) + [0]=> + bool(false) +} + +-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(2) { + [1]=> + bool(true) + [0]=> + bool(false) +} + +-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(2) { + [1]=> + bool(true) + [0]=> + bool(false) +} + +-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_STRING -- +bool(true) +array(2) { + [1]=> + bool(true) + [0]=> + bool(false) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/krsort_variation2.phpt b/ext/standard/tests/array/krsort_variation2.phpt new file mode 100644 index 0000000..1376202 --- /dev/null +++ b/ext/standard/tests/array/krsort_variation2.phpt @@ -0,0 +1,307 @@ +--TEST-- +Test krsort() function : usage variations - unexpected values for 'sort_flags' argument +--FILE-- + 10, 2 => 2, 45 => 45); + +//array of unexpected values to iterate over +$unexpected_values = array ( + + // int data +/*1*/ -2345, + + // float data +/*2*/ 10.5, + -10.5, + 10.5e2, + 10.6E-2, + .5, + + // null data +/*7*/ NULL, + null, + + // boolean data +/*9*/ true, + false, + TRUE, + FALSE, + + // empty data +/*13*/ "", + '', + + // string data +/*15*/ "string", + 'string', + + // object data +/*16*/ new stdclass(), + + // undefined data +/*17*/ @undefined_var, + + // unset data +/*18*/ @unset_var, + + // resource variable +/*19*/ $fp + +); + +// loop though each element of the array and check the working of krsort() +// when 'sort_flags' arugment is supplied with different values +echo "\n-- Testing krsort() by supplying different unexpected values for 'sort_flags' argument --\n"; + +$counter = 1; +for($index = 0; $index < count($unexpected_values); $index ++) { + echo "-- Iteration $counter --\n"; + $value = $unexpected_values [$index]; + $temp_array = $unsorted_values; + var_dump( krsort($temp_array, $value) ); + var_dump($temp_array); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing krsort() : usage variations *** + +-- Testing krsort() by supplying different unexpected values for 'sort_flags' argument -- +-- Iteration 1 -- +bool(true) +array(3) { + [45]=> + int(45) + [10]=> + int(10) + [2]=> + int(2) +} +-- Iteration 2 -- +bool(true) +array(3) { + [45]=> + int(45) + [2]=> + int(2) + [10]=> + int(10) +} +-- Iteration 3 -- +bool(true) +array(3) { + [45]=> + int(45) + [10]=> + int(10) + [2]=> + int(2) +} +-- Iteration 4 -- +bool(true) +array(3) { + [45]=> + int(45) + [10]=> + int(10) + [2]=> + int(2) +} +-- Iteration 5 -- +bool(true) +array(3) { + [45]=> + int(45) + [10]=> + int(10) + [2]=> + int(2) +} +-- Iteration 6 -- +bool(true) +array(3) { + [45]=> + int(45) + [10]=> + int(10) + [2]=> + int(2) +} +-- Iteration 7 -- +bool(true) +array(3) { + [45]=> + int(45) + [10]=> + int(10) + [2]=> + int(2) +} +-- Iteration 8 -- +bool(true) +array(3) { + [45]=> + int(45) + [10]=> + int(10) + [2]=> + int(2) +} +-- Iteration 9 -- +bool(true) +array(3) { + [45]=> + int(45) + [10]=> + int(10) + [2]=> + int(2) +} +-- Iteration 10 -- +bool(true) +array(3) { + [45]=> + int(45) + [10]=> + int(10) + [2]=> + int(2) +} +-- Iteration 11 -- +bool(true) +array(3) { + [45]=> + int(45) + [10]=> + int(10) + [2]=> + int(2) +} +-- Iteration 12 -- +bool(true) +array(3) { + [45]=> + int(45) + [10]=> + int(10) + [2]=> + int(2) +} +-- Iteration 13 -- + +Warning: krsort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 14 -- + +Warning: krsort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 15 -- + +Warning: krsort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 16 -- + +Warning: krsort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 17 -- + +Warning: krsort() expects parameter 2 to be long, object given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 18 -- + +Warning: krsort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 19 -- + +Warning: krsort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 20 -- + +Warning: krsort() expects parameter 2 to be long, resource given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +Done diff --git a/ext/standard/tests/array/krsort_variation3.phpt b/ext/standard/tests/array/krsort_variation3.phpt new file mode 100644 index 0000000..8f411a9 --- /dev/null +++ b/ext/standard/tests/array/krsort_variation3.phpt @@ -0,0 +1,262 @@ +--TEST-- +Test krsort() function : usage variations - sort integer/float values +--FILE-- + 11, -2 => -11, 3 => 21, -4 => -21, 5 => 31, -6 => -31, 7 => 0, 8 => 41, -10 =>-41), + + // float key values + array(1.0 => 10.5, 0.2 => -10.5, 3.1 => 10.5e2, 4 => 10.6E-2, .5 => .5, 6 => .0001, -7 => -.1), + + // mixed value array with different types of keys + array(1 => .0001, 2 => .0021, -3 => -.01, 4 => -1, 5 => 0, 6 => .09, 7 => 2, -8 => -.9, 9 => 10.6E-2, + -10 => -10.6E-2, 11 => 33) +); + +// set of possible flag values +$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC); + +$count = 1; +echo "\n-- Testing krsort() by supplying various integer/float arrays --\n"; + +// loop through to test krsort() with different arrays +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With defualt sort flag -\n"; + $temp_array = $array; + var_dump(krsort($temp_array) ); + var_dump($temp_array); + + // loop through $flags array and call krsort() with all possible sort flag values + foreach($flags as $key => $flag){ + echo "- Sort flag = $key -\n"; + $temp_array = $array; + var_dump(krsort($temp_array, $flag) ); + var_dump($temp_array); + } + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing krsort() : usage variations *** + +-- Testing krsort() by supplying various integer/float arrays -- + +-- Iteration 1 -- +- With defualt sort flag - +bool(true) +array(9) { + [8]=> + int(41) + [7]=> + int(0) + [5]=> + int(31) + [3]=> + int(21) + [1]=> + int(11) + [-2]=> + int(-11) + [-4]=> + int(-21) + [-6]=> + int(-31) + [-10]=> + int(-41) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(9) { + [8]=> + int(41) + [7]=> + int(0) + [5]=> + int(31) + [3]=> + int(21) + [1]=> + int(11) + [-2]=> + int(-11) + [-4]=> + int(-21) + [-6]=> + int(-31) + [-10]=> + int(-41) +} +- Sort flag = SORT_NUMERIC - +bool(true) +array(9) { + [8]=> + int(41) + [7]=> + int(0) + [5]=> + int(31) + [3]=> + int(21) + [1]=> + int(11) + [-2]=> + int(-11) + [-4]=> + int(-21) + [-6]=> + int(-31) + [-10]=> + int(-41) +} + +-- Iteration 2 -- +- With defualt sort flag - +bool(true) +array(6) { + [6]=> + float(0.0001) + [4]=> + float(0.106) + [3]=> + float(1050) + [1]=> + float(10.5) + [0]=> + float(0.5) + [-7]=> + float(-0.1) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(6) { + [6]=> + float(0.0001) + [4]=> + float(0.106) + [3]=> + float(1050) + [1]=> + float(10.5) + [0]=> + float(0.5) + [-7]=> + float(-0.1) +} +- Sort flag = SORT_NUMERIC - +bool(true) +array(6) { + [6]=> + float(0.0001) + [4]=> + float(0.106) + [3]=> + float(1050) + [1]=> + float(10.5) + [0]=> + float(0.5) + [-7]=> + float(-0.1) +} + +-- Iteration 3 -- +- With defualt sort flag - +bool(true) +array(11) { + [11]=> + int(33) + [9]=> + float(0.106) + [7]=> + int(2) + [6]=> + float(0.09) + [5]=> + int(0) + [4]=> + int(-1) + [2]=> + float(0.0021) + [1]=> + float(0.0001) + [-3]=> + float(-0.01) + [-8]=> + float(-0.9) + [-10]=> + float(-0.106) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(11) { + [11]=> + int(33) + [9]=> + float(0.106) + [7]=> + int(2) + [6]=> + float(0.09) + [5]=> + int(0) + [4]=> + int(-1) + [2]=> + float(0.0021) + [1]=> + float(0.0001) + [-3]=> + float(-0.01) + [-8]=> + float(-0.9) + [-10]=> + float(-0.106) +} +- Sort flag = SORT_NUMERIC - +bool(true) +array(11) { + [11]=> + int(33) + [9]=> + float(0.106) + [7]=> + int(2) + [6]=> + float(0.09) + [5]=> + int(0) + [4]=> + int(-1) + [2]=> + float(0.0021) + [1]=> + float(0.0001) + [-3]=> + float(-0.01) + [-8]=> + float(-0.9) + [-10]=> + float(-0.106) +} +Done diff --git a/ext/standard/tests/array/krsort_variation4.phpt b/ext/standard/tests/array/krsort_variation4.phpt new file mode 100644 index 0000000..3df924a --- /dev/null +++ b/ext/standard/tests/array/krsort_variation4.phpt @@ -0,0 +1,114 @@ +--TEST-- +Test krsort() function : usage variations - sort octal values +--FILE-- + 01, 0321 => 02, 0345 => 03, 066 => 04, 0772 => 05, + 077 => 06, -066 => -01, -0345 => -02, 0 => 0 +); + +echo "\n-- Testing krsort() by supplying octal value array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_oct_array; +var_dump( krsort($temp_array) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing krsort() by supplying octal value array, 'flag' value is SORT_REGULAR --\n"; +$temp_array = $unsorted_oct_array; +var_dump( krsort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing krsort() by supplying octal value array, 'flag' value is SORT_NUMERIC --\n"; +$temp_array = $unsorted_oct_array; +var_dump( krsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing krsort() : usage variations *** + +-- Testing krsort() by supplying octal value array, 'flag' value is defualt -- +bool(true) +array(9) { + [669]=> + int(1) + [506]=> + int(5) + [229]=> + int(3) + [209]=> + int(2) + [63]=> + int(6) + [54]=> + int(4) + [0]=> + int(0) + [-54]=> + int(-1) + [-229]=> + int(-2) +} + +-- Testing krsort() by supplying octal value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(9) { + [669]=> + int(1) + [506]=> + int(5) + [229]=> + int(3) + [209]=> + int(2) + [63]=> + int(6) + [54]=> + int(4) + [0]=> + int(0) + [-54]=> + int(-1) + [-229]=> + int(-2) +} + +-- Testing krsort() by supplying octal value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(9) { + [669]=> + int(1) + [506]=> + int(5) + [229]=> + int(3) + [209]=> + int(2) + [63]=> + int(6) + [54]=> + int(4) + [0]=> + int(0) + [-54]=> + int(-1) + [-229]=> + int(-2) +} +Done diff --git a/ext/standard/tests/array/krsort_variation5.phpt b/ext/standard/tests/array/krsort_variation5.phpt new file mode 100644 index 0000000..0fa1e9c --- /dev/null +++ b/ext/standard/tests/array/krsort_variation5.phpt @@ -0,0 +1,235 @@ +--TEST-- +Test krsort() function : usage variations - sort strings +--SKIPIF-- + null, NULL => NULL, "\a" => "\a", "\cx" => "\cx", "\e" => "\e", + "\f" => "\f", "\n" =>"\n", "\r" => "\r", "\t" => "\t", "\xhh" => "\xhh", + "\ddd" => "\ddd", "\v" => "\v" + ), + + // array containing different strings with key values + array ( 'Lemon' => "lemoN", 'o' => "Orange", 'B' => "banana", 'Apple' => "apple", 'te' => "Test", + 't' => "TTTT", 'T' => "ttt", 'W' => "ww", 'X' => "x", 'x' => "X", 'O' => "oraNGe", + 'B' => "BANANA" + ) +); + +$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING); + +$count = 1; +echo "\n-- Testing krsort() by supplying various string arrays --\n"; + +// loop through to test krsort() with different arrays +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With defualt sort flag -\n"; + $temp_array = $array; + var_dump(krsort($temp_array) ); // expecting : bool(true) + var_dump($temp_array); + + // loop through $flags array and call krsort() with all possible sort flag values + foreach($flags as $key => $flag){ + echo "- Sort flag = $key -\n"; + $temp_array = $array; + var_dump(krsort($temp_array, $flag) ); // expecting : bool(true) + var_dump($temp_array); + } + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing krsort() : usage variations *** + +-- Testing krsort() by supplying various string arrays -- + +-- Iteration 1 -- +- With defualt sort flag - +bool(true) +array(11) { + ["\xhh"]=> + string(4) "\xhh" + ["\ddd"]=> + string(4) "\ddd" + ["\cx"]=> + string(3) "\cx" + ["\a"]=> + string(2) "\a" + [""]=> + string(1) "" + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" +"]=> + string(1) " +" + [" "]=> + string(1) " " + [""]=> + NULL +} +- Sort flag = SORT_REGULAR - +bool(true) +array(11) { + ["\xhh"]=> + string(4) "\xhh" + ["\ddd"]=> + string(4) "\ddd" + ["\cx"]=> + string(3) "\cx" + ["\a"]=> + string(2) "\a" + [""]=> + string(1) "" + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" +"]=> + string(1) " +" + [" "]=> + string(1) " " + [""]=> + NULL +} +- Sort flag = SORT_STRING - +bool(true) +array(11) { + ["\xhh"]=> + string(4) "\xhh" + ["\ddd"]=> + string(4) "\ddd" + ["\cx"]=> + string(3) "\cx" + ["\a"]=> + string(2) "\a" + [""]=> + string(1) "" + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" +"]=> + string(1) " +" + [" "]=> + string(1) " " + [""]=> + NULL +} + +-- Iteration 2 -- +- With defualt sort flag - +bool(true) +array(11) { + ["x"]=> + string(1) "X" + ["te"]=> + string(4) "Test" + ["t"]=> + string(4) "TTTT" + ["o"]=> + string(6) "Orange" + ["X"]=> + string(1) "x" + ["W"]=> + string(2) "ww" + ["T"]=> + string(3) "ttt" + ["O"]=> + string(6) "oraNGe" + ["Lemon"]=> + string(5) "lemoN" + ["B"]=> + string(6) "BANANA" + ["Apple"]=> + string(5) "apple" +} +- Sort flag = SORT_REGULAR - +bool(true) +array(11) { + ["x"]=> + string(1) "X" + ["te"]=> + string(4) "Test" + ["t"]=> + string(4) "TTTT" + ["o"]=> + string(6) "Orange" + ["X"]=> + string(1) "x" + ["W"]=> + string(2) "ww" + ["T"]=> + string(3) "ttt" + ["O"]=> + string(6) "oraNGe" + ["Lemon"]=> + string(5) "lemoN" + ["B"]=> + string(6) "BANANA" + ["Apple"]=> + string(5) "apple" +} +- Sort flag = SORT_STRING - +bool(true) +array(11) { + ["x"]=> + string(1) "X" + ["te"]=> + string(4) "Test" + ["t"]=> + string(4) "TTTT" + ["o"]=> + string(6) "Orange" + ["X"]=> + string(1) "x" + ["W"]=> + string(2) "ww" + ["T"]=> + string(3) "ttt" + ["O"]=> + string(6) "oraNGe" + ["Lemon"]=> + string(5) "lemoN" + ["B"]=> + string(6) "BANANA" + ["Apple"]=> + string(5) "apple" +} +Done diff --git a/ext/standard/tests/array/krsort_variation6.phpt b/ext/standard/tests/array/krsort_variation6.phpt new file mode 100644 index 0000000..167d0ee --- /dev/null +++ b/ext/standard/tests/array/krsort_variation6.phpt @@ -0,0 +1,114 @@ +--TEST-- +Test krsort() function : usage variations - sort hexadecimal values +--FILE-- + 0x1AB, 0xFFF => 0xFFF, 0xF => 0xF, 0xFF => 0xFF, 0x2AA => 0x2AA, 0xBB => 0xBB, + 0x1ab => 0x1ab, 0xff => 0xff, -0xff => -0xFF, 0 => 0, -0x2aa => -0x2aa +); + +echo "\n-- Testing krsort() by supplying hexadecimal value array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_hex_array; +var_dump(krsort( $temp_array) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing krsort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --\n"; +$temp_array = $unsorted_hex_array; +var_dump(krsort( $temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing krsort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --\n"; +$temp_array = $unsorted_hex_array; +var_dump(krsort( $temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing krsort() : usage variations *** + +-- Testing krsort() by supplying hexadecimal value array, 'flag' value is defualt -- +bool(true) +array(9) { + [4095]=> + int(4095) + [682]=> + int(682) + [427]=> + int(427) + [255]=> + int(255) + [187]=> + int(187) + [15]=> + int(15) + [0]=> + int(0) + [-255]=> + int(-255) + [-682]=> + int(-682) +} + +-- Testing krsort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(9) { + [4095]=> + int(4095) + [682]=> + int(682) + [427]=> + int(427) + [255]=> + int(255) + [187]=> + int(187) + [15]=> + int(15) + [0]=> + int(0) + [-255]=> + int(-255) + [-682]=> + int(-682) +} + +-- Testing krsort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(9) { + [4095]=> + int(4095) + [682]=> + int(682) + [427]=> + int(427) + [255]=> + int(255) + [187]=> + int(187) + [15]=> + int(15) + [0]=> + int(0) + [-255]=> + int(-255) + [-682]=> + int(-682) +} +Done diff --git a/ext/standard/tests/array/krsort_variation7.phpt b/ext/standard/tests/array/krsort_variation7.phpt new file mode 100644 index 0000000..9ba3fc5 --- /dev/null +++ b/ext/standard/tests/array/krsort_variation7.phpt @@ -0,0 +1,177 @@ +--TEST-- +Test krsort() function : usage variations - sort array with diff. sub arrays +--FILE-- + array(), + + // array contains null sub array + 2 => array( 1 => array() ), + + // array of arrays along with some values + 3 => array(4 => 44, 1 => 11, 3 => array(64,61) ), + + // array contains sub arrays + 4 => array ( 3 => array(33,-5,6), 1 => array(11), + 2 => array(22,-55), 0 => array() ) +); + + +$count = 1; +echo "\n-- Testing krsort() by supplying various arrays containing sub arrays --\n"; + +// loop through to test krsort() with different arrays +foreach ($various_arrays as $array) { + + echo "\n-- Iteration $count --\n"; + echo "- With defualt sort flag -\n"; + $temp_array = $array; + var_dump( krsort($temp_array) ); + var_dump($temp_array); + + echo "- Sort flag = SORT_REGULAR -\n"; + $temp_array = $array; + var_dump( krsort($temp_array, SORT_REGULAR) ); + var_dump($temp_array); + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing krsort() : usage variations *** + +-- Testing krsort() by supplying various arrays containing sub arrays -- + +-- Iteration 1 -- +- With defualt sort flag - +bool(true) +array(0) { +} +- Sort flag = SORT_REGULAR - +bool(true) +array(0) { +} + +-- Iteration 2 -- +- With defualt sort flag - +bool(true) +array(1) { + [1]=> + array(0) { + } +} +- Sort flag = SORT_REGULAR - +bool(true) +array(1) { + [1]=> + array(0) { + } +} + +-- Iteration 3 -- +- With defualt sort flag - +bool(true) +array(3) { + [4]=> + int(44) + [3]=> + array(2) { + [0]=> + int(64) + [1]=> + int(61) + } + [1]=> + int(11) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(3) { + [4]=> + int(44) + [3]=> + array(2) { + [0]=> + int(64) + [1]=> + int(61) + } + [1]=> + int(11) +} + +-- Iteration 4 -- +- With defualt sort flag - +bool(true) +array(4) { + [3]=> + array(3) { + [0]=> + int(33) + [1]=> + int(-5) + [2]=> + int(6) + } + [2]=> + array(2) { + [0]=> + int(22) + [1]=> + int(-55) + } + [1]=> + array(1) { + [0]=> + int(11) + } + [0]=> + array(0) { + } +} +- Sort flag = SORT_REGULAR - +bool(true) +array(4) { + [3]=> + array(3) { + [0]=> + int(33) + [1]=> + int(-5) + [2]=> + int(6) + } + [2]=> + array(2) { + [0]=> + int(22) + [1]=> + int(-55) + } + [1]=> + array(1) { + [0]=> + int(11) + } + [0]=> + array(0) { + } +} +Done diff --git a/ext/standard/tests/array/krsort_variation8.phpt b/ext/standard/tests/array/krsort_variation8.phpt new file mode 100644 index 0000000..20276ad Binary files /dev/null and b/ext/standard/tests/array/krsort_variation8.phpt differ diff --git a/ext/standard/tests/array/krsort_variation9.phpt b/ext/standard/tests/array/krsort_variation9.phpt new file mode 100644 index 0000000..d7d8343 --- /dev/null +++ b/ext/standard/tests/array/krsort_variation9.phpt @@ -0,0 +1,257 @@ +--TEST-- +Test krsort() function : usage variations - sort array with/without key values +--FILE-- + 55, 66, 22, 33, 11), + array ("a" => "orange", "banana", "c" => "apple"), + array(1, 2, 3, 4, 5, 6), + array("first", 5 => "second", 1 => "third"), + array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13), + array('bar' => 'baz', "foo" => 1), + array('a' => 1,'b' => array('e' => 2,'f' => 3),'c' => array('g' => 4),'d' => 5), +); + +$count = 1; +echo "\n-- Testing krsort() by supplying various arrays with/without key values --\n"; + +// loop through to test krsort() with different arrays, +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With defualt sort flag -\n"; + $temp_array = $array; + var_dump( krsort($temp_array) ); + var_dump($temp_array); + + echo "- Sort flag = SORT_REGULAR -\n"; + $temp_array = $array; + var_dump( krsort($temp_array, SORT_REGULAR) ); + var_dump($temp_array); + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing krsort() : usage variations *** + +-- Testing krsort() by supplying various arrays with/without key values -- + +-- Iteration 1 -- +- With defualt sort flag - +bool(true) +array(5) { + [9]=> + int(11) + [8]=> + int(33) + [7]=> + int(22) + [6]=> + int(66) + [5]=> + int(55) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(5) { + [9]=> + int(11) + [8]=> + int(33) + [7]=> + int(22) + [6]=> + int(66) + [5]=> + int(55) +} + +-- Iteration 2 -- +- With defualt sort flag - +bool(true) +array(3) { + ["c"]=> + string(5) "apple" + [0]=> + string(6) "banana" + ["a"]=> + string(6) "orange" +} +- Sort flag = SORT_REGULAR - +bool(true) +array(3) { + ["c"]=> + string(5) "apple" + [0]=> + string(6) "banana" + ["a"]=> + string(6) "orange" +} + +-- Iteration 3 -- +- With defualt sort flag - +bool(true) +array(6) { + [5]=> + int(6) + [4]=> + int(5) + [3]=> + int(4) + [2]=> + int(3) + [1]=> + int(2) + [0]=> + int(1) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(6) { + [5]=> + int(6) + [4]=> + int(5) + [3]=> + int(4) + [2]=> + int(3) + [1]=> + int(2) + [0]=> + int(1) +} + +-- Iteration 4 -- +- With defualt sort flag - +bool(true) +array(3) { + [5]=> + string(6) "second" + [1]=> + string(5) "third" + [0]=> + string(5) "first" +} +- Sort flag = SORT_REGULAR - +bool(true) +array(3) { + [5]=> + string(6) "second" + [1]=> + string(5) "third" + [0]=> + string(5) "first" +} + +-- Iteration 5 -- +- With defualt sort flag - +bool(true) +array(6) { + [9]=> + int(19) + [8]=> + int(1) + [4]=> + int(1) + [3]=> + int(13) + [1]=> + int(1) + [0]=> + int(1) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(6) { + [9]=> + int(19) + [8]=> + int(1) + [4]=> + int(1) + [3]=> + int(13) + [1]=> + int(1) + [0]=> + int(1) +} + +-- Iteration 6 -- +- With defualt sort flag - +bool(true) +array(2) { + ["foo"]=> + int(1) + ["bar"]=> + string(3) "baz" +} +- Sort flag = SORT_REGULAR - +bool(true) +array(2) { + ["foo"]=> + int(1) + ["bar"]=> + string(3) "baz" +} + +-- Iteration 7 -- +- With defualt sort flag - +bool(true) +array(4) { + ["d"]=> + int(5) + ["c"]=> + array(1) { + ["g"]=> + int(4) + } + ["b"]=> + array(2) { + ["e"]=> + int(2) + ["f"]=> + int(3) + } + ["a"]=> + int(1) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(4) { + ["d"]=> + int(5) + ["c"]=> + array(1) { + ["g"]=> + int(4) + } + ["b"]=> + array(2) { + ["e"]=> + int(2) + ["f"]=> + int(3) + } + ["a"]=> + int(1) +} +Done diff --git a/ext/standard/tests/array/ksort_basic.phpt b/ext/standard/tests/array/ksort_basic.phpt new file mode 100644 index 0000000..dd9f7a2 --- /dev/null +++ b/ext/standard/tests/array/ksort_basic.phpt @@ -0,0 +1,243 @@ +--TEST-- +Test ksort() function : basic functionality +--FILE-- + "lemon", "o" => "orange", + "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", + "b" => "banana", +); +// an array containing unsorted numeric values with indices +$unsorted_numerics = array( 100 => 4, 33 => 3, 555 => 2, 22 => 1 ); + +echo "\n-- Testing ksort() by supplying string array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_strings; +var_dump( ksort($temp_array) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing ksort() by supplying numeric array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_numerics; +var_dump( ksort($temp_array) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing ksort() by supplying string array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $unsorted_strings; +var_dump( ksort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing ksort() by supplying numeric array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $unsorted_numerics; +var_dump( ksort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing ksort() by supplying string array, 'flag' = SORT_STRING --\n"; +$temp_array = $unsorted_strings; +var_dump( ksort($temp_array, SORT_STRING) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing ksort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE --\n"; +$temp_array = $unsorted_strings; +var_dump( sort($temp_array, SORT_STRING|SORT_FLAG_CASE) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing ksort() by supplying string array (natural), 'flag' = SORT_NATURAL --\n"; +$temp_array = $unsorted_strings; +var_dump( sort($temp_array, SORT_NATURAL) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing ksort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE --\n"; +$temp_array = $unsorted_strings; +var_dump( sort($temp_array, SORT_NATURAL|SORT_FLAG_CASE) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing ksort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n"; +$temp_array = $unsorted_numerics; +var_dump( ksort($temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing ksort() : basic functionality *** + +-- Testing ksort() by supplying string array, 'flag' value is defualt -- +bool(true) +array(8) { + ["O"]=> + string(6) "Orange" + ["O1"]=> + string(7) "Orange1" + ["O3"]=> + string(7) "Orange3" + ["b"]=> + string(6) "banana" + ["l"]=> + string(5) "lemon" + ["o"]=> + string(6) "orange" + ["o2"]=> + string(7) "orange2" + ["o20"]=> + string(8) "orange20" +} + +-- Testing ksort() by supplying numeric array, 'flag' value is defualt -- +bool(true) +array(4) { + [22]=> + int(1) + [33]=> + int(3) + [100]=> + int(4) + [555]=> + int(2) +} + +-- Testing ksort() by supplying string array, 'flag' = SORT_REGULAR -- +bool(true) +array(8) { + ["O"]=> + string(6) "Orange" + ["O1"]=> + string(7) "Orange1" + ["O3"]=> + string(7) "Orange3" + ["b"]=> + string(6) "banana" + ["l"]=> + string(5) "lemon" + ["o"]=> + string(6) "orange" + ["o2"]=> + string(7) "orange2" + ["o20"]=> + string(8) "orange20" +} + +-- Testing ksort() by supplying numeric array, 'flag' = SORT_REGULAR -- +bool(true) +array(4) { + [22]=> + int(1) + [33]=> + int(3) + [100]=> + int(4) + [555]=> + int(2) +} + +-- Testing ksort() by supplying string array, 'flag' = SORT_STRING -- +bool(true) +array(8) { + ["O"]=> + string(6) "Orange" + ["O1"]=> + string(7) "Orange1" + ["O3"]=> + string(7) "Orange3" + ["b"]=> + string(6) "banana" + ["l"]=> + string(5) "lemon" + ["o"]=> + string(6) "orange" + ["o2"]=> + string(7) "orange2" + ["o20"]=> + string(8) "orange20" +} + +-- Testing ksort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE -- +bool(true) +array(8) { + [0]=> + string(6) "banana" + [1]=> + string(5) "lemon" + [2]=> + string(6) "orange" + [3]=> + string(6) "Orange" + [4]=> + string(7) "Orange1" + [5]=> + string(7) "orange2" + [6]=> + string(8) "orange20" + [7]=> + string(7) "Orange3" +} + +-- Testing ksort() by supplying string array (natural), 'flag' = SORT_NATURAL -- +bool(true) +array(8) { + [0]=> + string(6) "Orange" + [1]=> + string(7) "Orange1" + [2]=> + string(7) "Orange3" + [3]=> + string(6) "banana" + [4]=> + string(5) "lemon" + [5]=> + string(6) "orange" + [6]=> + string(7) "orange2" + [7]=> + string(8) "orange20" +} + +-- Testing ksort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE -- +bool(true) +array(8) { + [0]=> + string(6) "banana" + [1]=> + string(5) "lemon" + [2]=> + string(6) "orange" + [3]=> + string(6) "Orange" + [4]=> + string(7) "Orange1" + [5]=> + string(7) "orange2" + [6]=> + string(7) "Orange3" + [7]=> + string(8) "orange20" +} + +-- Testing ksort() by supplying numeric array, 'flag' = SORT_NUMERIC -- +bool(true) +array(4) { + [22]=> + int(1) + [33]=> + int(3) + [100]=> + int(4) + [555]=> + int(2) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/ksort_error.phpt b/ext/standard/tests/array/ksort_error.phpt new file mode 100644 index 0000000..f2b102a --- /dev/null +++ b/ext/standard/tests/array/ksort_error.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test ksort() function : error conditions +--FILE-- + 1, 2 => 2); +$flag_value = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING, "SORT_NUMERIC" => SORT_NUMERIC); +$extra_arg = 10; + +// loop through $flag_value array and call krsort with all possible sort flag values +foreach($flag_value as $key => $flag){ + echo "\n- Sort flag = $key -\n"; + $temp_array = $array_arg; + var_dump( ksort($temp_array,$flag, $extra_arg) ); + var_dump( $temp_array); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing ksort() : error conditions *** + +-- Testing ksort() function with Zero arguments -- + +Warning: ksort() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing ksort() function with more than expected no. of arguments -- + +- Sort flag = SORT_REGULAR - + +Warning: ksort() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +array(2) { + [1]=> + int(1) + [2]=> + int(2) +} + +- Sort flag = SORT_STRING - + +Warning: ksort() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +array(2) { + [1]=> + int(1) + [2]=> + int(2) +} + +- Sort flag = SORT_NUMERIC - + +Warning: ksort() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +array(2) { + [1]=> + int(1) + [2]=> + int(2) +} +Done diff --git a/ext/standard/tests/array/ksort_object.phpt b/ext/standard/tests/array/ksort_object.phpt new file mode 100644 index 0000000..20e8ba2 --- /dev/null +++ b/ext/standard/tests/array/ksort_object.phpt @@ -0,0 +1,241 @@ +--TEST-- +Test ksort() function : object functionality - sort objects +--FILE-- +class_value = $value; + } + +} + +// class declaration for string objects +class String +{ + public $class_value; + // initializing object member value + function __construct($value){ + $this->class_value = $value; + } + + // return string value + function __tostring() { + return (string)$this->value; + } + +} + +// array of integer objects +$unsorted_int_obj = array ( + 11 => new Integer(11), 66 => new Integer(66), + 23 => new Integer(23), -5 => new Integer(-5), + 1 => new Integer(0.001), 0 => new Integer(0) +); + +// array of string objects +$unsorted_str_obj = array ( + "axx" => new String("axx"), "t" => new String("t"), + "w" => new String("w"), "py" => new String("py"), + "apple" => new String("apple"), "Orange" => new String("Orange"), + "Lemon" => new String("Lemon"), "aPPle" => new String("aPPle") +); +echo "\n-- Testing ksort() by supplying various object arrays, 'flag' value is defualt --\n"; + +// testing ksort() function by supplying integer object array, flag value is defualt +$temp_array = $unsorted_int_obj; +var_dump(ksort($temp_array) ); +var_dump($temp_array); + +// testing ksort() function by supplying string object array, flag value is defualt +$temp_array = $unsorted_str_obj; +var_dump(ksort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Testing ksort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n"; +// testing ksort() function by supplying integer object array, flag value = SORT_REGULAR +$temp_array = $unsorted_int_obj; +var_dump(ksort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +// testing ksort() function by supplying string object array, flag value = SORT_REGULAR +$temp_array = $unsorted_str_obj; +var_dump(ksort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing ksort() : object functionality *** + +-- Testing ksort() by supplying various object arrays, 'flag' value is defualt -- +bool(true) +array(6) { + [-5]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(-5) + } + [0]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(0) + } + [1]=> + object(Integer)#%d (1) { + ["class_value"]=> + float(0.001) + } + [11]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(11) + } + [23]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(23) + } + [66]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(66) + } +} +bool(true) +array(8) { + ["Lemon"]=> + object(String)#%d (1) { + ["class_value"]=> + string(5) "Lemon" + } + ["Orange"]=> + object(String)#%d (1) { + ["class_value"]=> + string(6) "Orange" + } + ["aPPle"]=> + object(String)#%d (1) { + ["class_value"]=> + string(5) "aPPle" + } + ["apple"]=> + object(String)#%d (1) { + ["class_value"]=> + string(5) "apple" + } + ["axx"]=> + object(String)#%d (1) { + ["class_value"]=> + string(3) "axx" + } + ["py"]=> + object(String)#%d (1) { + ["class_value"]=> + string(2) "py" + } + ["t"]=> + object(String)#%d (1) { + ["class_value"]=> + string(1) "t" + } + ["w"]=> + object(String)#%d (1) { + ["class_value"]=> + string(1) "w" + } +} + +-- Testing ksort() by supplying various object arrays, 'flag' value is SORT_REGULAR -- +bool(true) +array(6) { + [-5]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(-5) + } + [0]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(0) + } + [1]=> + object(Integer)#%d (1) { + ["class_value"]=> + float(0.001) + } + [11]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(11) + } + [23]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(23) + } + [66]=> + object(Integer)#%d (1) { + ["class_value"]=> + int(66) + } +} +bool(true) +array(8) { + ["Lemon"]=> + object(String)#%d (1) { + ["class_value"]=> + string(5) "Lemon" + } + ["Orange"]=> + object(String)#%d (1) { + ["class_value"]=> + string(6) "Orange" + } + ["aPPle"]=> + object(String)#%d (1) { + ["class_value"]=> + string(5) "aPPle" + } + ["apple"]=> + object(String)#%d (1) { + ["class_value"]=> + string(5) "apple" + } + ["axx"]=> + object(String)#%d (1) { + ["class_value"]=> + string(3) "axx" + } + ["py"]=> + object(String)#%d (1) { + ["class_value"]=> + string(2) "py" + } + ["t"]=> + object(String)#%d (1) { + ["class_value"]=> + string(1) "t" + } + ["w"]=> + object(String)#%d (1) { + ["class_value"]=> + string(1) "w" + } +} +Done diff --git a/ext/standard/tests/array/ksort_variation1.phpt b/ext/standard/tests/array/ksort_variation1.phpt new file mode 100644 index 0000000..d8c037f --- /dev/null +++ b/ext/standard/tests/array/ksort_variation1.phpt @@ -0,0 +1,397 @@ +--TEST-- +Test ksort() function : usage variations - unexpected values for 'array' argument +--FILE-- + +--EXPECTF-- +*** Testing ksort() : usage variations *** + +-- Testing ksort() by supplying different unexpected values for 'array' argument -- + +-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING -- +-- Iteration 1 -- + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 2 -- + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 3 -- + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 7 -- + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 8 -- + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 9 -- + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 10 -- + +Warning: ksort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +-- Iteration 11 -- + +Warning: ksort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 14 -- + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 15 -- + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 16 -- + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 17 -- + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 18 -- + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 19 -- + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 20 -- + +Warning: ksort() expects parameter 1 to be array, object given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, object given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, object given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, object given in %s on line %d +bool(false) +-- Iteration 21 -- + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 22 -- + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 23 -- + +Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) + +Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/array/ksort_variation10.phpt b/ext/standard/tests/array/ksort_variation10.phpt new file mode 100644 index 0000000..051bc30 --- /dev/null +++ b/ext/standard/tests/array/ksort_variation10.phpt @@ -0,0 +1,113 @@ +--TEST-- +Test ksort() function : usage variations - sort octal values +--FILE-- + 01, 0321 => 02, 0345 => 03, 066 => 04, 0772 => 05, + 077 => 06, -066 => -01, -0345 => -02, 0 => 0 +); + +echo "\n-- Testing ksort() by supplying octal value array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_oct_array; +var_dump( ksort($temp_array) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing ksort() by supplying octal value array, 'flag' value is SORT_REGULAR --\n"; +$temp_array = $unsorted_oct_array; +var_dump( ksort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing ksort() by supplying octal value array, 'flag' value is SORT_NUMERIC --\n"; +$temp_array = $unsorted_oct_array; +var_dump( ksort($temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing ksort() : usage variations *** + +-- Testing ksort() by supplying octal value array, 'flag' value is defualt -- +bool(true) +array(9) { + [-229]=> + int(-2) + [-54]=> + int(-1) + [0]=> + int(0) + [54]=> + int(4) + [63]=> + int(6) + [209]=> + int(2) + [229]=> + int(3) + [506]=> + int(5) + [669]=> + int(1) +} + +-- Testing ksort() by supplying octal value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(9) { + [-229]=> + int(-2) + [-54]=> + int(-1) + [0]=> + int(0) + [54]=> + int(4) + [63]=> + int(6) + [209]=> + int(2) + [229]=> + int(3) + [506]=> + int(5) + [669]=> + int(1) +} + +-- Testing ksort() by supplying octal value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(9) { + [-229]=> + int(-2) + [-54]=> + int(-1) + [0]=> + int(0) + [54]=> + int(4) + [63]=> + int(6) + [209]=> + int(2) + [229]=> + int(3) + [506]=> + int(5) + [669]=> + int(1) +} +Done diff --git a/ext/standard/tests/array/ksort_variation11.phpt b/ext/standard/tests/array/ksort_variation11.phpt new file mode 100644 index 0000000..347df65 --- /dev/null +++ b/ext/standard/tests/array/ksort_variation11.phpt @@ -0,0 +1,98 @@ +--TEST-- +Test ksort() function : usage variations - sort heredoc strings +--FILE-- + "Heredoc", + $simple_heredoc2 => "HEREDOC", + $multiline_heredoc => "heredoc string\twith!@# and 123\nTest this!!!" +); + +echo "\n-- Testing ksort() by supplying heredoc string array, 'flag' value is defualt --\n"; +$temp_array = $array; +var_dump(ksort($temp_array) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing ksort() by supplying heredoc string array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $array; +var_dump(ksort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing ksort() by supplying heredoc string array, 'flag' = SORT_STRING --\n"; +$temp_array = $array; +var_dump(ksort($temp_array, SORT_STRING) ); // expecting : bool(true) +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing ksort() : usage variations *** + +-- Testing ksort() by supplying heredoc string array, 'flag' value is defualt -- +bool(true) +array(3) { + ["HEREDOC"]=> + string(7) "HEREDOC" + ["Heredoc"]=> + string(7) "Heredoc" + ["heredoc string with!@# and 123 +Test this!!!"]=> + string(43) "heredoc string with!@# and 123 +Test this!!!" +} + +-- Testing ksort() by supplying heredoc string array, 'flag' = SORT_REGULAR -- +bool(true) +array(3) { + ["HEREDOC"]=> + string(7) "HEREDOC" + ["Heredoc"]=> + string(7) "Heredoc" + ["heredoc string with!@# and 123 +Test this!!!"]=> + string(43) "heredoc string with!@# and 123 +Test this!!!" +} + +-- Testing ksort() by supplying heredoc string array, 'flag' = SORT_STRING -- +bool(true) +array(3) { + ["HEREDOC"]=> + string(7) "HEREDOC" + ["Heredoc"]=> + string(7) "Heredoc" + ["heredoc string with!@# and 123 +Test this!!!"]=> + string(43) "heredoc string with!@# and 123 +Test this!!!" +} +Done diff --git a/ext/standard/tests/array/ksort_variation2.phpt b/ext/standard/tests/array/ksort_variation2.phpt new file mode 100644 index 0000000..4969844 --- /dev/null +++ b/ext/standard/tests/array/ksort_variation2.phpt @@ -0,0 +1,307 @@ +--TEST-- +Test ksort() function : usage variations - unexpected values for 'sort_flags' argument +--FILE-- + 10, 2 => 2, 45 => 45); + +//array of unexpected values to iterate over +$unexpected_values = array ( + + // int data +/*1*/ -2345, + + // float data +/*2*/ 10.5, + -10.5, + 10.5e2, + 10.6E-2, + .5, + + // null data +/*7*/ NULL, + null, + + // boolean data +/*9*/ true, + false, + TRUE, + FALSE, + + // empty data +/*13*/ "", + '', + + // string data +/*15*/ "string", + 'string', + + // object data +/*16*/ new stdclass(), + + // undefined data +/*17*/ @undefined_var, + + // unset data +/*18*/ @unset_var, + + // resource variable +/*19*/ $fp + +); + +// loop though each element of the array and check the working of ksort() +// when 'sort_flags' arugment is supplied with different values +echo "\n-- Testing ksort() by supplying different unexpected values for 'sort_flags' argument --\n"; + +$counter = 1; +for($index = 0; $index < count($unexpected_values); $index ++) { + echo "-- Iteration $counter --\n"; + $value = $unexpected_values [$index]; + $temp_array = $unsorted_values; + var_dump( ksort($temp_array, $value) ); + var_dump($temp_array); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing ksort() : usage variations *** + +-- Testing ksort() by supplying different unexpected values for 'sort_flags' argument -- +-- Iteration 1 -- +bool(true) +array(3) { + [2]=> + int(2) + [10]=> + int(10) + [45]=> + int(45) +} +-- Iteration 2 -- +bool(true) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 3 -- +bool(true) +array(3) { + [2]=> + int(2) + [10]=> + int(10) + [45]=> + int(45) +} +-- Iteration 4 -- +bool(true) +array(3) { + [2]=> + int(2) + [10]=> + int(10) + [45]=> + int(45) +} +-- Iteration 5 -- +bool(true) +array(3) { + [2]=> + int(2) + [10]=> + int(10) + [45]=> + int(45) +} +-- Iteration 6 -- +bool(true) +array(3) { + [2]=> + int(2) + [10]=> + int(10) + [45]=> + int(45) +} +-- Iteration 7 -- +bool(true) +array(3) { + [2]=> + int(2) + [10]=> + int(10) + [45]=> + int(45) +} +-- Iteration 8 -- +bool(true) +array(3) { + [2]=> + int(2) + [10]=> + int(10) + [45]=> + int(45) +} +-- Iteration 9 -- +bool(true) +array(3) { + [2]=> + int(2) + [10]=> + int(10) + [45]=> + int(45) +} +-- Iteration 10 -- +bool(true) +array(3) { + [2]=> + int(2) + [10]=> + int(10) + [45]=> + int(45) +} +-- Iteration 11 -- +bool(true) +array(3) { + [2]=> + int(2) + [10]=> + int(10) + [45]=> + int(45) +} +-- Iteration 12 -- +bool(true) +array(3) { + [2]=> + int(2) + [10]=> + int(10) + [45]=> + int(45) +} +-- Iteration 13 -- + +Warning: ksort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 14 -- + +Warning: ksort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 15 -- + +Warning: ksort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 16 -- + +Warning: ksort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 17 -- + +Warning: ksort() expects parameter 2 to be long, object given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 18 -- + +Warning: ksort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 19 -- + +Warning: ksort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +-- Iteration 20 -- + +Warning: ksort() expects parameter 2 to be long, resource given in %s on line %d +bool(false) +array(3) { + [10]=> + int(10) + [2]=> + int(2) + [45]=> + int(45) +} +Done diff --git a/ext/standard/tests/array/ksort_variation3.phpt b/ext/standard/tests/array/ksort_variation3.phpt new file mode 100644 index 0000000..4029b9b --- /dev/null +++ b/ext/standard/tests/array/ksort_variation3.phpt @@ -0,0 +1,262 @@ +--TEST-- +Test ksort() function : usage variations - sort integer/float values +--FILE-- + 11, -2 => -11, 3 => 21, -4 => -21, 5 => 31, -6 => -31, 7 => 0, 8 => 41, -10 =>-41), + + // float key values + array(1.0 => 10.5, 0.2 => -10.5, 3.1 => 10.5e2, 4 => 10.6E-2, .5 => .5, 6 => .0001, -7 => -.1), + + // mixed value array with different types of keys + array(1 => .0001, 2 => .0021, -3 => -.01, 4 => -1, 5 => 0, 6 => .09, 7 => 2, -8 => -.9, + 9 => 10.6E-2, -10 => -10.6E-2, 11 => 33) +); + +// set of possible flag values +$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC); + +$count = 1; +echo "\n-- Testing ksort() by supplying various integer/float arrays --\n"; + +// loop through to test ksort() with different arrays +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With defualt sort flag -\n"; + $temp_array = $array; + var_dump(ksort($temp_array) ); + var_dump($temp_array); + + // loop through $flags array and call ksort() with all possible sort flag values + foreach($flags as $key => $flag){ + echo "- Sort flag = $key -\n"; + $temp_array = $array; + var_dump(ksort($temp_array, $flag) ); + var_dump($temp_array); + } + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing ksort() : usage variations *** + +-- Testing ksort() by supplying various integer/float arrays -- + +-- Iteration 1 -- +- With defualt sort flag - +bool(true) +array(9) { + [-10]=> + int(-41) + [-6]=> + int(-31) + [-4]=> + int(-21) + [-2]=> + int(-11) + [1]=> + int(11) + [3]=> + int(21) + [5]=> + int(31) + [7]=> + int(0) + [8]=> + int(41) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(9) { + [-10]=> + int(-41) + [-6]=> + int(-31) + [-4]=> + int(-21) + [-2]=> + int(-11) + [1]=> + int(11) + [3]=> + int(21) + [5]=> + int(31) + [7]=> + int(0) + [8]=> + int(41) +} +- Sort flag = SORT_NUMERIC - +bool(true) +array(9) { + [-10]=> + int(-41) + [-6]=> + int(-31) + [-4]=> + int(-21) + [-2]=> + int(-11) + [1]=> + int(11) + [3]=> + int(21) + [5]=> + int(31) + [7]=> + int(0) + [8]=> + int(41) +} + +-- Iteration 2 -- +- With defualt sort flag - +bool(true) +array(6) { + [-7]=> + float(-0.1) + [0]=> + float(0.5) + [1]=> + float(10.5) + [3]=> + float(1050) + [4]=> + float(0.106) + [6]=> + float(0.0001) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(6) { + [-7]=> + float(-0.1) + [0]=> + float(0.5) + [1]=> + float(10.5) + [3]=> + float(1050) + [4]=> + float(0.106) + [6]=> + float(0.0001) +} +- Sort flag = SORT_NUMERIC - +bool(true) +array(6) { + [-7]=> + float(-0.1) + [0]=> + float(0.5) + [1]=> + float(10.5) + [3]=> + float(1050) + [4]=> + float(0.106) + [6]=> + float(0.0001) +} + +-- Iteration 3 -- +- With defualt sort flag - +bool(true) +array(11) { + [-10]=> + float(-0.106) + [-8]=> + float(-0.9) + [-3]=> + float(-0.01) + [1]=> + float(0.0001) + [2]=> + float(0.0021) + [4]=> + int(-1) + [5]=> + int(0) + [6]=> + float(0.09) + [7]=> + int(2) + [9]=> + float(0.106) + [11]=> + int(33) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(11) { + [-10]=> + float(-0.106) + [-8]=> + float(-0.9) + [-3]=> + float(-0.01) + [1]=> + float(0.0001) + [2]=> + float(0.0021) + [4]=> + int(-1) + [5]=> + int(0) + [6]=> + float(0.09) + [7]=> + int(2) + [9]=> + float(0.106) + [11]=> + int(33) +} +- Sort flag = SORT_NUMERIC - +bool(true) +array(11) { + [-10]=> + float(-0.106) + [-8]=> + float(-0.9) + [-3]=> + float(-0.01) + [1]=> + float(0.0001) + [2]=> + float(0.0021) + [4]=> + int(-1) + [5]=> + int(0) + [6]=> + float(0.09) + [7]=> + int(2) + [9]=> + float(0.106) + [11]=> + int(33) +} +Done diff --git a/ext/standard/tests/array/ksort_variation4.phpt b/ext/standard/tests/array/ksort_variation4.phpt new file mode 100644 index 0000000..d6b3f48 --- /dev/null +++ b/ext/standard/tests/array/ksort_variation4.phpt @@ -0,0 +1,81 @@ +--TEST-- +Test ksort() function : usage variations - sort bool values +--FILE-- + true, false => false, TRUE => TRUE, FALSE => FALSE); + +echo "\n-- Testing ksort() by supplying boolean value array, 'flag' value is defualt --\n"; +$temp_array = $bool_values; +var_dump(ksort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_REGULAR --\n"; +$temp_array = $bool_values; +var_dump(ksort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "\n-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_NUMERIC --\n"; +$temp_array = $bool_values; +var_dump(ksort($temp_array, SORT_NUMERIC) ); +var_dump($temp_array); + +echo "\n-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_STRING --\n"; +$temp_array = $bool_values; +var_dump(ksort($temp_array, SORT_STRING) ); +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing ksort() : usage variations *** + +-- Testing ksort() by supplying boolean value array, 'flag' value is defualt -- +bool(true) +array(2) { + [0]=> + bool(false) + [1]=> + bool(true) +} + +-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(2) { + [0]=> + bool(false) + [1]=> + bool(true) +} + +-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(2) { + [0]=> + bool(false) + [1]=> + bool(true) +} + +-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_STRING -- +bool(true) +array(2) { + [0]=> + bool(false) + [1]=> + bool(true) +} +Done diff --git a/ext/standard/tests/array/ksort_variation5.phpt b/ext/standard/tests/array/ksort_variation5.phpt new file mode 100644 index 0000000..6e6a38b --- /dev/null +++ b/ext/standard/tests/array/ksort_variation5.phpt @@ -0,0 +1,235 @@ +--TEST-- +Test ksort() function : usage variations - sort strings +--SKIPIF-- + null, NULL => NULL, "\a" => "\a", "\cx" => "\cx", "\e" => "\e", + "\f" => "\f", "\n" =>"\n", "\r" => "\r", "\t" => "\t", "\xhh" => "\xhh", + "\ddd" => "\ddd", "\v" => "\v" + ), + + // array containing different strings with key values + array ( 'Lemon' => "lemoN", 'o' => "Orange", 'B' => "banana", 'Apple' => "apple", 'te' => "Test", + 't' => "TTTT", 'T' => "ttt", 'W' => "ww", 'X' => "x", 'x' => "X", 'O' => "oraNGe", + 'B' => "BANANA" + ) +); + +$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING); + +$count = 1; +echo "\n-- Testing ksort() by supplying various string arrays --\n"; + +// loop through to test ksort() with different arrays +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With defualt sort flag -\n"; + $temp_array = $array; + var_dump(ksort($temp_array) ); // expecting : bool(true) + var_dump($temp_array); + + // loop through $flags array and call ksort() with all possible sort flag values + foreach($flags as $key => $flag){ + echo "- Sort flag = $key -\n"; + $temp_array = $array; + var_dump(ksort($temp_array, $flag) ); // expecting : bool(true) + var_dump($temp_array); + } + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing ksort() : usage variations *** + +-- Testing ksort() by supplying various string arrays -- + +-- Iteration 1 -- +- With defualt sort flag - +bool(true) +array(11) { + [""]=> + NULL + [" "]=> + string(1) " " + [" +"]=> + string(1) " +" + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [""]=> + string(1) "" + ["\a"]=> + string(2) "\a" + ["\cx"]=> + string(3) "\cx" + ["\ddd"]=> + string(4) "\ddd" + ["\xhh"]=> + string(4) "\xhh" +} +- Sort flag = SORT_REGULAR - +bool(true) +array(11) { + [""]=> + NULL + [" "]=> + string(1) " " + [" +"]=> + string(1) " +" + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [""]=> + string(1) "" + ["\a"]=> + string(2) "\a" + ["\cx"]=> + string(3) "\cx" + ["\ddd"]=> + string(4) "\ddd" + ["\xhh"]=> + string(4) "\xhh" +} +- Sort flag = SORT_STRING - +bool(true) +array(11) { + [""]=> + NULL + [" "]=> + string(1) " " + [" +"]=> + string(1) " +" + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [" "]=> + string(1) " " + [""]=> + string(1) "" + ["\a"]=> + string(2) "\a" + ["\cx"]=> + string(3) "\cx" + ["\ddd"]=> + string(4) "\ddd" + ["\xhh"]=> + string(4) "\xhh" +} + +-- Iteration 2 -- +- With defualt sort flag - +bool(true) +array(11) { + ["Apple"]=> + string(5) "apple" + ["B"]=> + string(6) "BANANA" + ["Lemon"]=> + string(5) "lemoN" + ["O"]=> + string(6) "oraNGe" + ["T"]=> + string(3) "ttt" + ["W"]=> + string(2) "ww" + ["X"]=> + string(1) "x" + ["o"]=> + string(6) "Orange" + ["t"]=> + string(4) "TTTT" + ["te"]=> + string(4) "Test" + ["x"]=> + string(1) "X" +} +- Sort flag = SORT_REGULAR - +bool(true) +array(11) { + ["Apple"]=> + string(5) "apple" + ["B"]=> + string(6) "BANANA" + ["Lemon"]=> + string(5) "lemoN" + ["O"]=> + string(6) "oraNGe" + ["T"]=> + string(3) "ttt" + ["W"]=> + string(2) "ww" + ["X"]=> + string(1) "x" + ["o"]=> + string(6) "Orange" + ["t"]=> + string(4) "TTTT" + ["te"]=> + string(4) "Test" + ["x"]=> + string(1) "X" +} +- Sort flag = SORT_STRING - +bool(true) +array(11) { + ["Apple"]=> + string(5) "apple" + ["B"]=> + string(6) "BANANA" + ["Lemon"]=> + string(5) "lemoN" + ["O"]=> + string(6) "oraNGe" + ["T"]=> + string(3) "ttt" + ["W"]=> + string(2) "ww" + ["X"]=> + string(1) "x" + ["o"]=> + string(6) "Orange" + ["t"]=> + string(4) "TTTT" + ["te"]=> + string(4) "Test" + ["x"]=> + string(1) "X" +} +Done diff --git a/ext/standard/tests/array/ksort_variation6.phpt b/ext/standard/tests/array/ksort_variation6.phpt new file mode 100644 index 0000000..1243ab1 --- /dev/null +++ b/ext/standard/tests/array/ksort_variation6.phpt @@ -0,0 +1,114 @@ +--TEST-- +Test ksort() function : usage variations - sort hexadecimal values +--FILE-- + 0x1AB, 0xFFF => 0xFFF, 0xF => 0xF, 0xFF => 0xFF, 0x2AA => 0x2AA, 0xBB => 0xBB, + 0x1ab => 0x1ab, 0xff => 0xff, -0xff => -0xFF, 0 => 0, -0x2aa => -0x2aa +); + +echo "\n-- Testing ksort() by supplying hexadecimal value array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_hex_array; +var_dump(ksort( $temp_array) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing ksort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --\n"; +$temp_array = $unsorted_hex_array; +var_dump(ksort( $temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump($temp_array); + +echo "\n-- Testing ksort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --\n"; +$temp_array = $unsorted_hex_array; +var_dump(ksort( $temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing ksort() : usage variations *** + +-- Testing ksort() by supplying hexadecimal value array, 'flag' value is defualt -- +bool(true) +array(9) { + [-682]=> + int(-682) + [-255]=> + int(-255) + [0]=> + int(0) + [15]=> + int(15) + [187]=> + int(187) + [255]=> + int(255) + [427]=> + int(427) + [682]=> + int(682) + [4095]=> + int(4095) +} + +-- Testing ksort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(9) { + [-682]=> + int(-682) + [-255]=> + int(-255) + [0]=> + int(0) + [15]=> + int(15) + [187]=> + int(187) + [255]=> + int(255) + [427]=> + int(427) + [682]=> + int(682) + [4095]=> + int(4095) +} + +-- Testing ksort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(9) { + [-682]=> + int(-682) + [-255]=> + int(-255) + [0]=> + int(0) + [15]=> + int(15) + [187]=> + int(187) + [255]=> + int(255) + [427]=> + int(427) + [682]=> + int(682) + [4095]=> + int(4095) +} +Done diff --git a/ext/standard/tests/array/ksort_variation7.phpt b/ext/standard/tests/array/ksort_variation7.phpt new file mode 100644 index 0000000..a0f454b --- /dev/null +++ b/ext/standard/tests/array/ksort_variation7.phpt @@ -0,0 +1,177 @@ +--TEST-- +Test ksort() function : usage variations - sort array with diff. sub arrays +--FILE-- + array(), + + // array contains null sub array + 2 => array( 1 => array() ), + + // array of arrays along with some values + 3 => array(4 => 44, 1 => 11, 3 => array(64,61) ), + + // array contains sub arrays + 4 => array ( 3 => array(33,-5,6), 1 => array(11), + 2 => array(22,-55), 0 => array() ) +); + + +$count = 1; +echo "\n-- Testing ksort() by supplying various arrays containing sub arrays --\n"; + +// loop through to test ksort() with different arrays +foreach ($various_arrays as $array) { + + echo "\n-- Iteration $count --\n"; + echo "- With defualt sort flag -\n"; + $temp_array = $array; + var_dump( ksort($temp_array) ); + var_dump($temp_array); + + echo "- Sort flag = SORT_REGULAR -\n"; + $temp_array = $array; + var_dump( ksort($temp_array, SORT_REGULAR) ); + var_dump($temp_array); + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing ksort() : usage variations *** + +-- Testing ksort() by supplying various arrays containing sub arrays -- + +-- Iteration 1 -- +- With defualt sort flag - +bool(true) +array(0) { +} +- Sort flag = SORT_REGULAR - +bool(true) +array(0) { +} + +-- Iteration 2 -- +- With defualt sort flag - +bool(true) +array(1) { + [1]=> + array(0) { + } +} +- Sort flag = SORT_REGULAR - +bool(true) +array(1) { + [1]=> + array(0) { + } +} + +-- Iteration 3 -- +- With defualt sort flag - +bool(true) +array(3) { + [1]=> + int(11) + [3]=> + array(2) { + [0]=> + int(64) + [1]=> + int(61) + } + [4]=> + int(44) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(3) { + [1]=> + int(11) + [3]=> + array(2) { + [0]=> + int(64) + [1]=> + int(61) + } + [4]=> + int(44) +} + +-- Iteration 4 -- +- With defualt sort flag - +bool(true) +array(4) { + [0]=> + array(0) { + } + [1]=> + array(1) { + [0]=> + int(11) + } + [2]=> + array(2) { + [0]=> + int(22) + [1]=> + int(-55) + } + [3]=> + array(3) { + [0]=> + int(33) + [1]=> + int(-5) + [2]=> + int(6) + } +} +- Sort flag = SORT_REGULAR - +bool(true) +array(4) { + [0]=> + array(0) { + } + [1]=> + array(1) { + [0]=> + int(11) + } + [2]=> + array(2) { + [0]=> + int(22) + [1]=> + int(-55) + } + [3]=> + array(3) { + [0]=> + int(33) + [1]=> + int(-5) + [2]=> + int(6) + } +} +Done diff --git a/ext/standard/tests/array/ksort_variation8.phpt b/ext/standard/tests/array/ksort_variation8.phpt new file mode 100644 index 0000000..787e71d Binary files /dev/null and b/ext/standard/tests/array/ksort_variation8.phpt differ diff --git a/ext/standard/tests/array/ksort_variation9.phpt b/ext/standard/tests/array/ksort_variation9.phpt new file mode 100644 index 0000000..ed406e2 --- /dev/null +++ b/ext/standard/tests/array/ksort_variation9.phpt @@ -0,0 +1,256 @@ +--TEST-- +Test ksort() function : usage variations - sorting arrays with/without keys +--FILE-- + 55, 66, 22, 33, 11), + array ("a" => "orange", "banana", "c" => "apple"), + array(1, 2, 3, 4, 5, 6), + array("first", 5 => "second", 1 => "third"), + array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13), + array('bar' => 'baz', "foo" => 1), + array('a' => 1,'b' => array('e' => 2,'f' => 3),'c' => array('g' => 4),'d' => 5), +); + +$count = 1; +echo "\n-- Testing ksort() by supplying various arrays with/without key values --\n"; + +// loop through to test ksort() with different arrays, +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With defualt sort flag -\n"; + $temp_array = $array; + var_dump( ksort($temp_array) ); + var_dump($temp_array); + + echo "- Sort flag = SORT_REGULAR -\n"; + $temp_array = $array; + var_dump( ksort($temp_array, SORT_REGULAR) ); + var_dump($temp_array); + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing ksort() : usage variations *** + +-- Testing ksort() by supplying various arrays with/without key values -- + +-- Iteration 1 -- +- With defualt sort flag - +bool(true) +array(5) { + [5]=> + int(55) + [6]=> + int(66) + [7]=> + int(22) + [8]=> + int(33) + [9]=> + int(11) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(5) { + [5]=> + int(55) + [6]=> + int(66) + [7]=> + int(22) + [8]=> + int(33) + [9]=> + int(11) +} + +-- Iteration 2 -- +- With defualt sort flag - +bool(true) +array(3) { + ["c"]=> + string(5) "apple" + [0]=> + string(6) "banana" + ["a"]=> + string(6) "orange" +} +- Sort flag = SORT_REGULAR - +bool(true) +array(3) { + ["c"]=> + string(5) "apple" + [0]=> + string(6) "banana" + ["a"]=> + string(6) "orange" +} + +-- Iteration 3 -- +- With defualt sort flag - +bool(true) +array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) +} + +-- Iteration 4 -- +- With defualt sort flag - +bool(true) +array(3) { + [0]=> + string(5) "first" + [1]=> + string(5) "third" + [5]=> + string(6) "second" +} +- Sort flag = SORT_REGULAR - +bool(true) +array(3) { + [0]=> + string(5) "first" + [1]=> + string(5) "third" + [5]=> + string(6) "second" +} + +-- Iteration 5 -- +- With defualt sort flag - +bool(true) +array(6) { + [0]=> + int(1) + [1]=> + int(1) + [3]=> + int(13) + [4]=> + int(1) + [8]=> + int(1) + [9]=> + int(19) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(6) { + [0]=> + int(1) + [1]=> + int(1) + [3]=> + int(13) + [4]=> + int(1) + [8]=> + int(1) + [9]=> + int(19) +} + +-- Iteration 6 -- +- With defualt sort flag - +bool(true) +array(2) { + ["bar"]=> + string(3) "baz" + ["foo"]=> + int(1) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(2) { + ["bar"]=> + string(3) "baz" + ["foo"]=> + int(1) +} + +-- Iteration 7 -- +- With defualt sort flag - +bool(true) +array(4) { + ["a"]=> + int(1) + ["b"]=> + array(2) { + ["e"]=> + int(2) + ["f"]=> + int(3) + } + ["c"]=> + array(1) { + ["g"]=> + int(4) + } + ["d"]=> + int(5) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(4) { + ["a"]=> + int(1) + ["b"]=> + array(2) { + ["e"]=> + int(2) + ["f"]=> + int(3) + } + ["c"]=> + array(1) { + ["g"]=> + int(4) + } + ["d"]=> + int(5) +} +Done diff --git a/ext/standard/tests/array/locale_sort.phpt b/ext/standard/tests/array/locale_sort.phpt new file mode 100644 index 0000000..1db9604 --- /dev/null +++ b/ext/standard/tests/array/locale_sort.phpt @@ -0,0 +1,62 @@ +--TEST-- +Sort with SORT_LOCALE_STRING +--SKIPIF-- + +--INI-- +unicode.script_encoding=ISO8859-1 +unicode.output_encoding=ISO8859-1 +--FILE-- + "Alberta", +"BC" => "Colombie-Britannique", +"MB" => "Manitoba", +"NB" => "Nouveau-Brunswick", +"NL" => "Terre-Neuve-et-Labrador", +"NS" => "Nouvelle-Écosse", +"ON" => "Ontario", +"PE" => "Île-du-Prince-Édouard", +"QC" => "Québec", +"SK" => "Saskatchewan", +"NT" => "Territoires du Nord-Ouest", +"NU" => "Nunavut", +"YT" => "Territoire du Yukon"); +asort($table, SORT_LOCALE_STRING); +var_dump($table); +?> +--EXPECT-- +array(13) { + ["AB"]=> + string(7) "Alberta" + ["BC"]=> + string(20) "Colombie-Britannique" + ["PE"]=> + string(21) "Île-du-Prince-Édouard" + ["MB"]=> + string(8) "Manitoba" + ["NB"]=> + string(17) "Nouveau-Brunswick" + ["NS"]=> + string(15) "Nouvelle-Écosse" + ["NU"]=> + string(7) "Nunavut" + ["ON"]=> + string(7) "Ontario" + ["QC"]=> + string(6) "Québec" + ["SK"]=> + string(12) "Saskatchewan" + ["NL"]=> + string(23) "Terre-Neuve-et-Labrador" + ["YT"]=> + string(19) "Territoire du Yukon" + ["NT"]=> + string(25) "Territoires du Nord-Ouest" +} diff --git a/ext/standard/tests/array/max.phpt b/ext/standard/tests/array/max.phpt new file mode 100644 index 0000000..555d2d0 --- /dev/null +++ b/ext/standard/tests/array/max.phpt @@ -0,0 +1,41 @@ +--TEST-- +max() tests +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +Warning: max() expects at least 1 parameter, 0 given in %s on line 3 +NULL + +Warning: max(): When only one parameter is given, it must be an array in %s on line 4 +NULL + +Warning: max(): Array must contain at least one element in %s on line 5 +bool(false) + +Warning: max(): When only one parameter is given, it must be an array in %s on line 6 +NULL +int(2) +float(2.11) +string(1) "t" +bool(true) +bool(true) +int(1) +bool(true) +Done diff --git a/ext/standard/tests/array/max_basic.phpt b/ext/standard/tests/array/max_basic.phpt new file mode 100644 index 0000000..f304212 --- /dev/null +++ b/ext/standard/tests/array/max_basic.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test return type and value for expected input max() +--FILE-- + +--EXPECT-- + +*** Testing sequences of numbers *** +int(2) +int(2) +float(2.11) +string(1) "t" +bool(true) +bool(true) +int(1) +bool(true) +array(2) { + [0]=> + int(2) + [1]=> + int(3) +} + +Done diff --git a/ext/standard/tests/array/max_basiclong_64bit.phpt b/ext/standard/tests/array/max_basiclong_64bit.phpt new file mode 100644 index 0000000..1eb7e31 --- /dev/null +++ b/ext/standard/tests/array/max_basiclong_64bit.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test max function : 64bit long tests +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +int(9223372036854775807) +int(9223372036854775807) +===DONE=== diff --git a/ext/standard/tests/array/max_error.phpt b/ext/standard/tests/array/max_error.phpt new file mode 100644 index 0000000..b20a3c0 --- /dev/null +++ b/ext/standard/tests/array/max_error.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test wrong number of arguments for min() +--FILE-- + +--EXPECTF-- +*** Testing Error Conditions *** + +Warning: max() expects at least 1 parameter, 0 given in %s on line 10 +NULL + +Warning: max(): When only one parameter is given, it must be an array in %s on line 11 +NULL + +Warning: max(): Array must contain at least one element in %s on line 12 +bool(false) + +Warning: max(): When only one parameter is given, it must be an array in %s on line 13 +NULL diff --git a/ext/standard/tests/array/max_variation1.phpt b/ext/standard/tests/array/max_variation1.phpt new file mode 100644 index 0000000..a32ceb8 --- /dev/null +++ b/ext/standard/tests/array/max_variation1.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test variations in usage of max() +--FILE-- + +--EXPECTF-- + +*** Testing boundary conditions *** +int(2147483646) +%s(2147483648) +%s(2147483648) +int(-2147483646) +int(-2147483647) +int(-2147483647) + +*** Testing large number of arguments *** +int(21) + +Done diff --git a/ext/standard/tests/array/max_variation2.phpt b/ext/standard/tests/array/max_variation2.phpt new file mode 100644 index 0000000..9abcda5 --- /dev/null +++ b/ext/standard/tests/array/max_variation2.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test variations in usage of max() +--FILE-- + +--EXPECTF-- + +*** Testing arrays *** +int(2) +int(2) +float(2.11) +string(1) "t" +bool(true) +bool(true) +int(1) +bool(true) +array(2) { + [0]=> + int(2) + [1]=> + int(3) +} +int(2147483646) +%s(2147483648) +%s(2147483648) +int(-2147483646) +int(-2147483647) +int(-2147483647) + +Done diff --git a/ext/standard/tests/array/min.phpt b/ext/standard/tests/array/min.phpt new file mode 100644 index 0000000..3a77ee8 --- /dev/null +++ b/ext/standard/tests/array/min.phpt @@ -0,0 +1,41 @@ +--TEST-- +min() tests +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +Warning: min() expects at least 1 parameter, 0 given in %s on line 3 +NULL + +Warning: min(): When only one parameter is given, it must be an array in %s on line 4 +NULL + +Warning: min(): Array must contain at least one element in %s on line 5 +bool(false) + +Warning: min(): When only one parameter is given, it must be an array in %s on line 6 +NULL +int(1) +float(2.09) +string(0) "" +bool(false) +bool(false) +bool(false) +int(0) +Done diff --git a/ext/standard/tests/array/min_basic.phpt b/ext/standard/tests/array/min_basic.phpt new file mode 100644 index 0000000..34f853f --- /dev/null +++ b/ext/standard/tests/array/min_basic.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test return type and value for expected input min() +--FILE-- + +--EXPECT-- + +*** Testing sequences of numbers *** +int(1) +int(-2) +float(2.09) +string(0) "" +bool(false) +bool(false) +bool(false) +int(0) +int(0) + +Done diff --git a/ext/standard/tests/array/min_basiclong_64bit.phpt b/ext/standard/tests/array/min_basiclong_64bit.phpt new file mode 100644 index 0000000..52f63f3 --- /dev/null +++ b/ext/standard/tests/array/min_basiclong_64bit.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test min function : 64bit long tests +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +int(-9223372036854775808) +int(-9223372036854775808) +===DONE=== diff --git a/ext/standard/tests/array/min_error.phpt b/ext/standard/tests/array/min_error.phpt new file mode 100644 index 0000000..dc472bc --- /dev/null +++ b/ext/standard/tests/array/min_error.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test wrong number of arguments for min() +--FILE-- + +--EXPECTF-- +*** Testing Error Conditions *** + +Warning: min() expects at least 1 parameter, 0 given in %s on line 10 +NULL + +Warning: min(): When only one parameter is given, it must be an array in %s on line 11 +NULL + +Warning: min(): Array must contain at least one element in %s on line 12 +bool(false) + +Warning: min(): When only one parameter is given, it must be an array in %s on line 13 +NULL diff --git a/ext/standard/tests/array/min_variation1.phpt b/ext/standard/tests/array/min_variation1.phpt new file mode 100644 index 0000000..9e24bd6 --- /dev/null +++ b/ext/standard/tests/array/min_variation1.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test variations in usage of min() +--FILE-- + +--EXPECTF-- + +*** Testing boundary conditions *** +int(2147483645) +int(2147483647) +int(2147483646) +int(-2147483647) +%s(-2147483648) +%s(-2147483649) + +*** Testing large number of arguments *** +int(0) + +Done diff --git a/ext/standard/tests/array/min_variation2.phpt b/ext/standard/tests/array/min_variation2.phpt new file mode 100644 index 0000000..a8b2152 --- /dev/null +++ b/ext/standard/tests/array/min_variation2.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test variations in usage of min() +--FILE-- + +--EXPECTF-- + +*** Testing arrays *** +int(1) +int(-2) +float(2.09) +string(0) "" +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(2147483645) +int(2147483647) +int(2147483646) +int(-2147483647) +%s(-2147483648) +%s(-2147483649) + +Done diff --git a/ext/standard/tests/array/natcasesort_basic.phpt b/ext/standard/tests/array/natcasesort_basic.phpt new file mode 100644 index 0000000..cf6cc57 --- /dev/null +++ b/ext/standard/tests/array/natcasesort_basic.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test natcasesort() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing natcasesort() : basic functionality *** + +-- Before sorting: -- +array(5) { + [0]=> + string(3) "A01" + [1]=> + string(2) "a1" + [2]=> + string(3) "b10" + [3]=> + string(3) "a01" + [4]=> + string(3) "b01" +} + +-- After Sorting: -- +bool(true) +array(5) { + [3]=> + string(3) "a01" + [0]=> + string(3) "A01" + [1]=> + string(2) "a1" + [4]=> + string(3) "b01" + [2]=> + string(3) "b10" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_error.phpt b/ext/standard/tests/array/natcasesort_error.phpt new file mode 100644 index 0000000..9ae8691 --- /dev/null +++ b/ext/standard/tests/array/natcasesort_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test natcasesort() function : error conditions - Pass incorrect number of args +--FILE-- + +--EXPECTF-- +*** Testing natcasesort() : error conditions *** + +-- Testing natcasesort() function with Zero arguments -- + +Warning: natcasesort() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing natcasesort() function with more than expected no. of arguments -- + +Warning: natcasesort() 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/array/natcasesort_object1.phpt b/ext/standard/tests/array/natcasesort_object1.phpt new file mode 100644 index 0000000..aab98a4 --- /dev/null +++ b/ext/standard/tests/array/natcasesort_object1.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test natcasesort() function : object functionality - array of objects +--FILE-- +class_value = $value; + } + + // return string value + function __tostring() { + return (string)$this->class_value; + } + +} + + + +// array of string objects +$unsorted_str_obj = array ( + new for_string_natcasesort("axx"), new for_string_natcasesort("t"), + new for_string_natcasesort("w"), new for_string_natcasesort("py"), + new for_string_natcasesort("apple"), new for_string_natcasesort("Orange"), + new for_string_natcasesort("Lemon"), new for_string_natcasesort("aPPle") +); + + +echo "\n-- Testing natcasesort() by supplying various object arrays --\n"; + +// testing natcasesort() function by supplying string object array +var_dump(natcasesort($unsorted_str_obj) ); +var_dump($unsorted_str_obj); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing natcasesort() : object functionality *** + +-- Testing natcasesort() by supplying various object arrays -- +bool(true) +array(8) { + [4]=> + object(for_string_natcasesort)#%d (1) { + ["class_value"]=> + string(5) "apple" + } + [7]=> + object(for_string_natcasesort)#%d (1) { + ["class_value"]=> + string(5) "aPPle" + } + [0]=> + object(for_string_natcasesort)#%d (1) { + ["class_value"]=> + string(3) "axx" + } + [6]=> + object(for_string_natcasesort)#%d (1) { + ["class_value"]=> + string(5) "Lemon" + } + [5]=> + object(for_string_natcasesort)#%d (1) { + ["class_value"]=> + string(6) "Orange" + } + [3]=> + object(for_string_natcasesort)#%d (1) { + ["class_value"]=> + string(2) "py" + } + [1]=> + object(for_string_natcasesort)#%d (1) { + ["class_value"]=> + string(1) "t" + } + [2]=> + object(for_string_natcasesort)#%d (1) { + ["class_value"]=> + string(1) "w" + } +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_object2.phpt b/ext/standard/tests/array/natcasesort_object2.phpt new file mode 100644 index 0000000..38efefc --- /dev/null +++ b/ext/standard/tests/array/natcasesort_object2.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test natcasesort() function : object functionality - mixed visibility within objects +--FILE-- +public_class_value = $value1; + $this->private_class_value = $value2; + $this->protected_class_value = $value3; + } + + // return string value + function __tostring() { + return (string)$this->public_class_value; + } + +} + +// array of string objects +$unsorted_str_obj = array ( +new for_string_natcasesort("axx","AXX","ass"), +new for_string_natcasesort("t","eee","abb"), +new for_string_natcasesort("w","W", "c"), +new for_string_natcasesort("py","PY", "pt"), +); + + +echo "\n-- Testing natcasesort() by supplying object arrays --\n"; + +// testing natcasesort() function by supplying string object array +$temp_array = $unsorted_str_obj; +var_dump(natcasesort($temp_array) ); +var_dump($temp_array); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing natcasesort() : object functionality *** + +-- Testing natcasesort() by supplying object arrays -- +bool(true) +array(4) { + [0]=> + object(for_string_natcasesort)#%d (3) { + ["public_class_value"]=> + string(3) "axx" + ["private_class_value":"for_string_natcasesort":private]=> + string(3) "AXX" + ["protected_class_value":protected]=> + string(3) "ass" + } + [3]=> + object(for_string_natcasesort)#%d (3) { + ["public_class_value"]=> + string(2) "py" + ["private_class_value":"for_string_natcasesort":private]=> + string(2) "PY" + ["protected_class_value":protected]=> + string(2) "pt" + } + [1]=> + object(for_string_natcasesort)#%d (3) { + ["public_class_value"]=> + string(1) "t" + ["private_class_value":"for_string_natcasesort":private]=> + string(3) "eee" + ["protected_class_value":protected]=> + string(3) "abb" + } + [2]=> + object(for_string_natcasesort)#%d (3) { + ["public_class_value"]=> + string(1) "w" + ["private_class_value":"for_string_natcasesort":private]=> + string(1) "W" + ["protected_class_value":protected]=> + string(1) "c" + } +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation1.phpt b/ext/standard/tests/array/natcasesort_variation1.phpt new file mode 100644 index 0000000..59eaded --- /dev/null +++ b/ext/standard/tests/array/natcasesort_variation1.phpt @@ -0,0 +1,223 @@ +--TEST-- +Test natcasesort() function : usage variations - Pass different data types as $array_arg arg +--FILE-- + +--EXPECTF-- +*** Testing natcasesort() : usage variation *** + +-- Iteration 1 -- + +Warning: natcasesort() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: natcasesort() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: natcasesort() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: natcasesort() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: natcasesort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: natcasesort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: natcasesort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: natcasesort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: natcasesort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: natcasesort() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: natcasesort() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: natcasesort() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: natcasesort() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: natcasesort() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: natcasesort() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: natcasesort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: natcasesort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +bool(true) + +-- Iteration 19 -- + +Warning: natcasesort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: natcasesort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: natcasesort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: natcasesort() expects parameter 1 to be array, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: natcasesort() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: natcasesort() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: natcasesort() expects parameter 1 to be array, resource given in %s on line %d +NULL +Done + diff --git a/ext/standard/tests/array/natcasesort_variation10.phpt b/ext/standard/tests/array/natcasesort_variation10.phpt new file mode 100644 index 0000000..cffa007 --- /dev/null +++ b/ext/standard/tests/array/natcasesort_variation10.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test natcasesort() function : usage variations - position of internal array pointer +--FILE-- + " . current ($array_arg) . "\n"; + +echo "\n-- Call natcasesort() --\n"; +var_dump(natcasesort($array_arg)); +var_dump($array_arg); + +echo "\n-- Position of Internal Pointer in Passed Array: --\n"; +echo key($array_arg) . " => " . current ($array_arg) . "\n"; + +echo "Done"; +?> + +--EXPECTF-- +*** Testing natcasesort() : usage variations *** + +-- Initial Position of Internal Pointer: -- +0 => img13 + +-- Call natcasesort() -- +bool(true) +array(4) { + [3]=> + string(4) "img1" + [2]=> + string(4) "img2" + [0]=> + string(5) "img13" + [1]=> + string(5) "img20" +} + +-- Position of Internal Pointer in Passed Array: -- +3 => img1 +Done diff --git a/ext/standard/tests/array/natcasesort_variation11.phpt b/ext/standard/tests/array/natcasesort_variation11.phpt new file mode 100644 index 0000000..98158f1 --- /dev/null +++ b/ext/standard/tests/array/natcasesort_variation11.phpt @@ -0,0 +1,232 @@ +--TEST-- +Test natcasesort() function : usage variations - Different array keys +--FILE-- + array( + 0 => 'zero', + 1 => 'one', + 12345 => 'positive', + -2345 => 'negative', + ), + + // float data +/*2*/ 'float' => array( + 10.5 => 'positive', + -10.5 => 'negative', + .5 => 'half', + ), + +/*3*/ 'extreme floats' => array( + 12.3456789000e6 => 'large', + 12.3456789000E-10 => 'small', + ), + + // null data +/*4*/ 'null uppercase' => array( + NULL => 'null 1', + ), + +/*5*/ 'null lowercase' => array( + null => 'null 2', + ), + + // boolean data +/*6*/ 'bool lowercase' => array( + true => 'lowert', + false => 'lowerf', + ), + +/*7*/ 'bool uppercase' => array( + TRUE => 'uppert', + FALSE => 'upperf', + ), + + // empty data +/*8*/ 'empty double quotes' => array( + "" => 'emptyd', + ), + +/*9*/ 'empty single quotes' => array( + '' => 'emptys', + ), + + // string data +/*10*/ 'string' => array( + "stringd" => 'stringd', + 'strings' => 'strings', + $heredoc => 'stringh', + ), + + // undefined data +/*11*/ 'undefined' => array( + @$undefined_var => 'undefined', + ), + + // unset data +/*12*/ 'unset' => array( + @$unset_var => 'unset', + ), + + // duplicate values +/*13*/ 'duplicate' => array( + 'foo' => 'bar', + 'baz' => 'bar', + 'hello' => 'world' + ), + +); + +// loop through each element of $inputs to check the behavior of natcasesort() +$iterator = 1; +foreach($inputs as $input) { + echo "\n-- Iteration $iterator --\n"; + var_dump( natcasesort($input) ); + var_dump($input); + $iterator++; +}; + +echo "Done"; +?> + +--EXPECTF-- +*** Testing natcasesort() : usage variations *** + +-- Iteration 1 -- +bool(true) +array(4) { + [-2345]=> + string(8) "negative" + [1]=> + string(3) "one" + [12345]=> + string(8) "positive" + [0]=> + string(4) "zero" +} + +-- Iteration 2 -- +bool(true) +array(3) { + [0]=> + string(4) "half" + [-10]=> + string(8) "negative" + [10]=> + string(8) "positive" +} + +-- Iteration 3 -- +bool(true) +array(2) { + [12345678]=> + string(5) "large" + [0]=> + string(5) "small" +} + +-- Iteration 4 -- +bool(true) +array(1) { + [""]=> + string(6) "null 1" +} + +-- Iteration 5 -- +bool(true) +array(1) { + [""]=> + string(6) "null 2" +} + +-- Iteration 6 -- +bool(true) +array(2) { + [0]=> + string(6) "lowerf" + [1]=> + string(6) "lowert" +} + +-- Iteration 7 -- +bool(true) +array(2) { + [0]=> + string(6) "upperf" + [1]=> + string(6) "uppert" +} + +-- Iteration 8 -- +bool(true) +array(1) { + [""]=> + string(6) "emptyd" +} + +-- Iteration 9 -- +bool(true) +array(1) { + [""]=> + string(6) "emptys" +} + +-- Iteration 10 -- +bool(true) +array(3) { + ["stringd"]=> + string(7) "stringd" + ["hello world"]=> + string(7) "stringh" + ["strings"]=> + string(7) "strings" +} + +-- Iteration 11 -- +bool(true) +array(1) { + [""]=> + string(9) "undefined" +} + +-- Iteration 12 -- +bool(true) +array(1) { + [""]=> + string(5) "unset" +} + +-- Iteration 13 -- +bool(true) +array(3) { + ["foo"]=> + string(3) "bar" + ["baz"]=> + string(3) "bar" + ["hello"]=> + string(5) "world" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation2.phpt b/ext/standard/tests/array/natcasesort_variation2.phpt new file mode 100644 index 0000000..00edf94 --- /dev/null +++ b/ext/standard/tests/array/natcasesort_variation2.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test natcasesort() function : usage variations - Pass arrays of different data types +--FILE-- + array( + 0, + 1, + 12345, + -2345, + ), + + // float data +/*2*/ 'float' => array( + 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + ), + + // null data +/*3*/ 'null' => array( + NULL, + null, + ), + + // boolean data +/*4*/ 'bool' => array( + true, + false, + TRUE, + FALSE, + ), + + // empty data +/*5*/ 'empty string' => array( + "", + '', + ), + +/*6*/ 'empty array' => array( + ), + + // string data +/*7*/ 'string' => array( + "string", + 'string', + $heredoc, + ), + + // object data +/*8*/ 'object' => array( + new classA(), + ), + + // undefined data +/*9*/ 'undefined' => array( + @$undefined_var, + ), + + // unset data +/*10*/ 'unset' => array( + @$unset_var, + ), + + // resource variable +/*11*/ 'resource' => array( + $fp + ), +); +// loop through each element of $inputs to check the behavior of natcasesort() +$iterator = 1; +foreach($inputs as $input) { + echo "\n-- Iteration $iterator --\n"; + var_dump( natcasesort($input) ); + var_dump($input); + $iterator++; +}; + +fclose($fp); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing natcasesort() : usage variation *** + +-- Iteration 1 -- +bool(true) +array(4) { + [3]=> + int(-2345) + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(12345) +} + +-- Iteration 2 -- +bool(true) +array(5) { + [1]=> + float(-10.5) + [4]=> + float(0.5) + [3]=> + float(1.23456789E-9) + [0]=> + float(10.5) + [2]=> + float(123456789000) +} + +-- Iteration 3 -- +bool(true) +array(2) { + [1]=> + NULL + [0]=> + NULL +} + +-- Iteration 4 -- +bool(true) +array(4) { + [3]=> + bool(false) + [1]=> + bool(false) + [0]=> + bool(true) + [2]=> + bool(true) +} + +-- Iteration 5 -- +bool(true) +array(2) { + [1]=> + string(0) "" + [0]=> + string(0) "" +} + +-- Iteration 6 -- +bool(true) +array(0) { +} + +-- Iteration 7 -- +bool(true) +array(3) { + [2]=> + string(11) "hello world" + [1]=> + string(6) "string" + [0]=> + string(6) "string" +} + +-- Iteration 8 -- +bool(true) +array(1) { + [0]=> + object(classA)#%d (0) { + } +} + +-- Iteration 9 -- +bool(true) +array(1) { + [0]=> + NULL +} + +-- Iteration 10 -- +bool(true) +array(1) { + [0]=> + NULL +} + +-- Iteration 11 -- +bool(true) +array(1) { + [0]=> + resource(%d) of type (stream) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation3.phpt b/ext/standard/tests/array/natcasesort_variation3.phpt new file mode 100644 index 0000000..77f83e1 --- /dev/null +++ b/ext/standard/tests/array/natcasesort_variation3.phpt @@ -0,0 +1,135 @@ +--TEST-- +Test natcasesort() function : usage variations - different numeric types +--SKIPIF-- + +--FILE-- + + +--EXPECTF-- +*** Testing natcasesort() : usage variation *** + +-- Iteration 1 -- +bool(true) +array(9) { + [1]=> + int(-11) + [3]=> + int(-21) + [5]=> + int(-31) + [8]=> + int(-41) + [6]=> + int(0) + [0]=> + int(11) + [2]=> + int(21) + [4]=> + int(31) + [7]=> + int(41) +} + +-- Iteration 1 -- +bool(true) +array(7) { + [6]=> + float(-0.1) + [1]=> + float(-10.5) + [5]=> + float(0.01) + [4]=> + float(0.5) + [3]=> + float(0.106) + [0]=> + float(10.5) + [2]=> + float(1050) +} + +-- Iteration 1 -- +bool(true) +array(11) { + [2]=> + float(-0.01) + [7]=> + float(-0.9) + [9]=> + float(-0.106) + [3]=> + int(-1) + [4]=> + int(0) + [0]=> + float(0.0001) + [1]=> + float(0.0021) + [5]=> + float(0.09) + [8]=> + float(0.106) + [6]=> + int(2) + [10]=> + int(33) +} + +-- Iteration 1 -- +bool(true) +array(7) { + [2]=> + int(-2147483647) + [3]=> + float(-2147483648) + [6]=> + float(-2147483649) + [5]=> + int(0) + [4]=> + int(0) + [0]=> + int(2147483647) + [1]=> + float(2147483648) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation4.phpt b/ext/standard/tests/array/natcasesort_variation4.phpt new file mode 100644 index 0000000..c7f99e1 --- /dev/null +++ b/ext/standard/tests/array/natcasesort_variation4.phpt @@ -0,0 +1,91 @@ +--TEST-- +Test natcasesort() function : usage variations - different string types +--SKIPIF-- + +--EXPECTF-- +*** Testing natcasesort() : usage variation *** +bool(true) +array(11) { + [0]=> + NULL + [1]=> + NULL + [6]=> + string(1) " +" + [10]=> + string(1) " " + [7]=> + string(1) " " + [5]=> + string(1) " " + [4]=> + string(1) "" + [2]=> + string(2) "\a" + [3]=> + string(3) "\cx" + [9]=> + string(4) "\ddd" + [8]=> + string(4) "\xhh" +} +bool(true) +array(12) { + [3]=> + string(5) "apple" + [11]=> + string(6) "BANANA" + [2]=> + string(6) "banana" + [0]=> + string(5) "lemoN" + [10]=> + string(6) "oraNGe" + [1]=> + string(6) "Orange" + [4]=> + string(4) "Test" + [6]=> + string(3) "ttt" + [5]=> + string(4) "TTTT" + [7]=> + string(2) "ww" + [8]=> + string(1) "x" + [9]=> + string(1) "X" +} +Done diff --git a/ext/standard/tests/array/natcasesort_variation5.phpt b/ext/standard/tests/array/natcasesort_variation5.phpt new file mode 100644 index 0000000..867d0b8 --- /dev/null +++ b/ext/standard/tests/array/natcasesort_variation5.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test natcasesort() function : usage variations - different hex values +--FILE-- + +--EXPECTF-- +*** Testing natcasesort() : usage variation *** +bool(true) +array(11) { + [8]=> + int(-255) + [10]=> + int(-682) + [9]=> + int(0) + [2]=> + int(15) + [5]=> + int(187) + [3]=> + int(255) + [7]=> + int(255) + [0]=> + int(427) + [6]=> + int(427) + [4]=> + int(682) + [1]=> + int(4095) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation6.phpt b/ext/standard/tests/array/natcasesort_variation6.phpt new file mode 100644 index 0000000..1d151d8 --- /dev/null +++ b/ext/standard/tests/array/natcasesort_variation6.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test natcasesort() function : usage variations - referenced variables +--FILE-- + +--EXPECTF-- +*** Testing natcasesort() : usage variation *** + +-- Initial test -- +bool(true) +array(3) { + [1]=> + &int(33) + [0]=> + &int(100) + [2]=> + &int(555) +} + +-- Change $value1 -- +bool(true) +array(3) { + [0]=> + &int(-29) + [1]=> + &int(33) + [2]=> + &int(555) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation7.phpt b/ext/standard/tests/array/natcasesort_variation7.phpt new file mode 100644 index 0000000..91be7e2 --- /dev/null +++ b/ext/standard/tests/array/natcasesort_variation7.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test natcasesort() function : usage variations - recursive arrays +--FILE-- + +--EXPECTF-- +*** Testing natcasesort() : usage variations *** +array(5) { + [0]=> + int(1) + [1]=> + float(3) + [2]=> + string(4) "zero" + [3]=> + string(1) "2" + [4]=> + &array(5) { + [0]=> + int(1) + [1]=> + float(3) + [2]=> + string(4) "zero" + [3]=> + string(1) "2" + [4]=> + *RECURSION* + } +} +bool(true) +array(5) { + [0]=> + int(1) + [3]=> + string(1) "2" + [1]=> + float(3) + [4]=> + &array(5) { + [0]=> + int(1) + [3]=> + string(1) "2" + [1]=> + float(3) + [4]=> + *RECURSION* + [2]=> + string(4) "zero" + } + [2]=> + string(4) "zero" +} +Done diff --git a/ext/standard/tests/array/natcasesort_variation8.phpt b/ext/standard/tests/array/natcasesort_variation8.phpt new file mode 100644 index 0000000..fbced4a --- /dev/null +++ b/ext/standard/tests/array/natcasesort_variation8.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test natcasesort() function : usage variations - octal values +--FILE-- + +--EXPECTF-- +*** Testing natcasesort() : usage variation *** +bool(true) +array(9) { + [6]=> + int(-54) + [7]=> + int(-229) + [8]=> + int(0) + [3]=> + int(54) + [5]=> + int(63) + [1]=> + int(209) + [2]=> + int(229) + [4]=> + int(506) + [0]=> + int(669) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation9.phpt b/ext/standard/tests/array/natcasesort_variation9.phpt new file mode 100644 index 0000000..98eec05 --- /dev/null +++ b/ext/standard/tests/array/natcasesort_variation9.phpt @@ -0,0 +1,110 @@ +--TEST-- +Test natcasesort() function : usage variations - mixed array +--FILE-- + + +--EXPECTF-- +*** Testing natcasesort() : usage variation *** +bool(true) +array(22) { + [13]=> + NULL + [19]=> + string(0) "" + [21]=> + bool(false) + [12]=> + string(0) "" + [10]=> + string(3) "-.9" + [7]=> + int(-2) + [8]=> + float(-2) + [9]=> + float(-2.98989) + [2]=> + int(-4) + [16]=> + float(0) + [17]=> + int(0) + [20]=> + bool(true) + [3]=> + string(1) "4" + [4]=> + float(4) + [6]=> + string(1) "5" + [14]=> + string(2) "ab" + [15]=> + string(4) "abcd" + [18]=> + string(14) "%s" + [0]=> + array(0) { + } + [1]=> + array(4) { + [0]=> + array(3) { + [0]=> + int(33) + [1]=> + int(-5) + [2]=> + int(6) + } + [1]=> + array(1) { + [0]=> + int(11) + } + [2]=> + array(2) { + [0]=> + int(22) + [1]=> + int(-55) + } + [3]=> + array(0) { + } + } + [5]=> + string(1) "b" + [11]=> + string(4) "True" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natsort_basic.phpt b/ext/standard/tests/array/natsort_basic.phpt new file mode 100644 index 0000000..e38359f --- /dev/null +++ b/ext/standard/tests/array/natsort_basic.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test natsort(): basic functionality +--FILE-- + +--EXPECT-- +Standard sorting +Array +( + [0] => img1.png + [1] => img10.png + [2] => img12.png + [3] => img2.png +) + +Natural order sorting +Array +( + [3] => img1.png + [2] => img2.png + [1] => img10.png + [0] => img12.png +) + diff --git a/ext/standard/tests/array/next_basic.phpt b/ext/standard/tests/array/next_basic.phpt new file mode 100644 index 0000000..fe8b70c --- /dev/null +++ b/ext/standard/tests/array/next_basic.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test next() function : basic functionality +--FILE-- + " . current($array) . "\n"; +var_dump(next($array)); + +echo key($array) . " => " . current($array) . "\n"; +var_dump(next($array)); + +echo key($array) . " => " . current($array) . "\n"; +var_dump(next($array)); +?> +===DONE=== +--EXPECTF-- +*** Testing next() : basic functionality *** +0 => zero +string(3) "one" +1 => one +string(3) "two" +2 => two +bool(false) +===DONE=== diff --git a/ext/standard/tests/array/next_error.phpt b/ext/standard/tests/array/next_error.phpt new file mode 100644 index 0000000..f7b7835 --- /dev/null +++ b/ext/standard/tests/array/next_error.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test next() function : error conditions - Pass incorrect number of arguments +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing next() : error conditions *** + +-- Testing next() function with Zero arguments -- + +Warning: next() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing next() function with more than expected no. of arguments -- + +Warning: next() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/next_variation1.phpt b/ext/standard/tests/array/next_variation1.phpt new file mode 100644 index 0000000..5f477b4 --- /dev/null +++ b/ext/standard/tests/array/next_variation1.phpt @@ -0,0 +1,219 @@ +--TEST-- +Test next() function : usage variation - Pass different data types as $array_arg +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing next() : variation *** + +-- Iteration 1 -- + +Warning: next() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: next() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: next() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: next() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: next() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: next() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: next() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: next() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: next() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: next() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: next() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: next() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: next() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: next() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: next() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: next() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: next() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +bool(false) + +-- Iteration 19 -- + +Warning: next() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: next() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: next() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- +bool(false) + +-- Iteration 23 -- + +Warning: next() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: next() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: next() expects parameter 1 to be array, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/next_variation2.phpt b/ext/standard/tests/array/next_variation2.phpt new file mode 100644 index 0000000..e750509 --- /dev/null +++ b/ext/standard/tests/array/next_variation2.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test next() function : usage variation - Mulit-dimensional arrays +--FILE-- + 'z', array(9, 8, 7)); + +echo "\n-- Pass a two-dimensional array as \$array_arg --\n"; +var_dump(next($array_arg)); +var_dump(next($array_arg)); + +echo "\n-- Pass a sub-array as \$array_arg --\n"; +var_dump(next($array_arg[0])); +?> +===DONE=== +--EXPECTF-- +*** Testing next() : usage variations *** + +-- Pass a two-dimensional array as $array_arg -- +array(3) { + [0]=> + int(9) + [1]=> + int(8) + [2]=> + int(7) +} +bool(false) + +-- Pass a sub-array as $array_arg -- +int(8) +===DONE=== diff --git a/ext/standard/tests/array/prev_basic.phpt b/ext/standard/tests/array/prev_basic.phpt new file mode 100644 index 0000000..8c1450d --- /dev/null +++ b/ext/standard/tests/array/prev_basic.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test prev() function : basic functionality +--FILE-- + " . current($array) . "\n"; +var_dump(prev($array)); + +echo key($array) . " => " . current($array) . "\n"; +var_dump(prev($array)); + +echo key($array) . " => " . current($array) . "\n"; +var_dump(prev($array)); + +echo "\n*** Testing an array with differing values/keys ***\n"; +$array2 = array('one', 2 => "help", 3, false, 'stringkey2' => 'val2', 'stringkey1' => 'val1'); +end($array2); +$length = count($array2); +for ($i = $length; $i > 0; $i--) { + var_dump(prev($array2)); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing prev() : basic functionality *** +2 => two +string(3) "one" +1 => one +string(4) "zero" +0 => zero +bool(false) + +*** Testing an array with differing values/keys *** +string(4) "val2" +bool(false) +int(3) +string(4) "help" +string(3) "one" +bool(false) +===DONE=== diff --git a/ext/standard/tests/array/prev_error1.phpt b/ext/standard/tests/array/prev_error1.phpt new file mode 100644 index 0000000..bea2451 --- /dev/null +++ b/ext/standard/tests/array/prev_error1.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test prev() function : error conditions - Pass incorrect number of arguments +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing prev() : error conditions *** + +-- Testing prev() function with Zero arguments -- + +Warning: prev() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing prev() function with more than expected no. of arguments -- + +Warning: prev() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/prev_error2.phpt b/ext/standard/tests/array/prev_error2.phpt new file mode 100644 index 0000000..f26bdd0 --- /dev/null +++ b/ext/standard/tests/array/prev_error2.phpt @@ -0,0 +1,28 @@ +--TEST-- +prev - ensure warning is received when passing an indirect temporary. +--FILE-- + +--EXPECTF-- +-- Passing an indirect temporary variable -- + +Strict Standards: Only variables should be passed by reference in %s on line %d +int(1) diff --git a/ext/standard/tests/array/prev_error3.phpt b/ext/standard/tests/array/prev_error3.phpt new file mode 100644 index 0000000..dfac24e --- /dev/null +++ b/ext/standard/tests/array/prev_error3.phpt @@ -0,0 +1,19 @@ +--TEST-- +prev - ensure we cannot pass a temporary +--FILE-- + +--EXPECTF-- + +Fatal error: Only variables can be passed by reference in %s on line %d \ No newline at end of file diff --git a/ext/standard/tests/array/prev_variation1.phpt b/ext/standard/tests/array/prev_variation1.phpt new file mode 100644 index 0000000..5a62536 --- /dev/null +++ b/ext/standard/tests/array/prev_variation1.phpt @@ -0,0 +1,219 @@ +--TEST-- +Test prev() function : usage variation - Pass different data types as $array_arg +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing prev() : variation *** + +-- Iteration 1 -- + +Warning: prev() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: prev() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: prev() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: prev() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: prev() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: prev() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: prev() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: prev() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: prev() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: prev() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: prev() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: prev() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: prev() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: prev() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: prev() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: prev() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: prev() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +bool(false) + +-- Iteration 19 -- + +Warning: prev() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: prev() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: prev() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- +bool(false) + +-- Iteration 23 -- + +Warning: prev() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: prev() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: prev() expects parameter 1 to be array, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/prev_variation2.phpt b/ext/standard/tests/array/prev_variation2.phpt new file mode 100644 index 0000000..0ce0877 --- /dev/null +++ b/ext/standard/tests/array/prev_variation2.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test prev() function : usage variation - Multi-dimensional arrays +--FILE-- + 'z'); +end($array_arg); + +echo "\n-- Pass a two-dimensional array as \$array_arg --\n"; +var_dump(prev($array_arg)); +var_dump(prev($array_arg)); + +echo "\n-- Pass a sub-array as \$array_arg --\n"; +var_dump(prev($array_arg[0])); +?> +===DONE=== +--EXPECTF-- +*** Testing prev() : usage variations *** + +-- Pass a two-dimensional array as $array_arg -- +array(3) { + [0]=> + int(9) + [1]=> + int(8) + [2]=> + int(7) +} +bool(false) + +-- Pass a sub-array as $array_arg -- +int(8) +===DONE=== diff --git a/ext/standard/tests/array/range.phpt b/ext/standard/tests/array/range.phpt new file mode 100644 index 0000000..9fd0f5e --- /dev/null +++ b/ext/standard/tests/array/range.phpt @@ -0,0 +1,448 @@ +--TEST-- +Test range() function +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +*** Testing range() function on basic operations *** + +-- Integers as Low and High -- +-- An array of elements from low to high -- +array(10) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + [9]=> + int(10) +} + +-- An array of elements from high to low -- +array(10) { + [0]=> + int(10) + [1]=> + int(9) + [2]=> + int(8) + [3]=> + int(7) + [4]=> + int(6) + [5]=> + int(5) + [6]=> + int(4) + [7]=> + int(3) + [8]=> + int(2) + [9]=> + int(1) +} + +-- Numeric Strings as Low and High -- +-- An array of elements from low to high -- +array(10) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + [9]=> + int(10) +} + +-- An array of elements from high to low -- +array(10) { + [0]=> + int(10) + [1]=> + int(9) + [2]=> + int(8) + [3]=> + int(7) + [4]=> + int(6) + [5]=> + int(5) + [6]=> + int(4) + [7]=> + int(3) + [8]=> + int(2) + [9]=> + int(1) +} + +-- Chars as Low and High -- +-- An array of elements from low to high -- +array(26) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" + [3]=> + string(1) "d" + [4]=> + string(1) "e" + [5]=> + string(1) "f" + [6]=> + string(1) "g" + [7]=> + string(1) "h" + [8]=> + string(1) "i" + [9]=> + string(1) "j" + [10]=> + string(1) "k" + [11]=> + string(1) "l" + [12]=> + string(1) "m" + [13]=> + string(1) "n" + [14]=> + string(1) "o" + [15]=> + string(1) "p" + [16]=> + string(1) "q" + [17]=> + string(1) "r" + [18]=> + string(1) "s" + [19]=> + string(1) "t" + [20]=> + string(1) "u" + [21]=> + string(1) "v" + [22]=> + string(1) "w" + [23]=> + string(1) "x" + [24]=> + string(1) "y" + [25]=> + string(1) "z" +} + +-- An array of elements from high to low -- +array(26) { + [0]=> + string(1) "z" + [1]=> + string(1) "y" + [2]=> + string(1) "x" + [3]=> + string(1) "w" + [4]=> + string(1) "v" + [5]=> + string(1) "u" + [6]=> + string(1) "t" + [7]=> + string(1) "s" + [8]=> + string(1) "r" + [9]=> + string(1) "q" + [10]=> + string(1) "p" + [11]=> + string(1) "o" + [12]=> + string(1) "n" + [13]=> + string(1) "m" + [14]=> + string(1) "l" + [15]=> + string(1) "k" + [16]=> + string(1) "j" + [17]=> + string(1) "i" + [18]=> + string(1) "h" + [19]=> + string(1) "g" + [20]=> + string(1) "f" + [21]=> + string(1) "e" + [22]=> + string(1) "d" + [23]=> + string(1) "c" + [24]=> + string(1) "b" + [25]=> + string(1) "a" +} + +-- Low and High are equal -- +array(1) { + [0]=> + int(5) +} +array(1) { + [0]=> + string(1) "q" +} + +-- floats as Low and High -- +array(6) { + [0]=> + float(5.1) + [1]=> + float(6.1) + [2]=> + float(7.1) + [3]=> + float(8.1) + [4]=> + float(9.1) + [5]=> + float(10.1) +} +array(6) { + [0]=> + float(10.1) + [1]=> + float(9.1) + [2]=> + float(8.1) + [3]=> + float(7.1) + [4]=> + float(6.1) + [5]=> + float(5.1) +} +array(6) { + [0]=> + float(5.1) + [1]=> + float(6.1) + [2]=> + float(7.1) + [3]=> + float(8.1) + [4]=> + float(9.1) + [5]=> + float(10.1) +} +array(6) { + [0]=> + float(10.1) + [1]=> + float(9.1) + [2]=> + float(8.1) + [3]=> + float(7.1) + [4]=> + float(6.1) + [5]=> + float(5.1) +} + +-- Passing step with Low and High -- +array(11) { + [0]=> + float(1) + [1]=> + float(1.1) + [2]=> + float(1.2) + [3]=> + float(1.3) + [4]=> + float(1.4) + [5]=> + float(1.5) + [6]=> + float(1.6) + [7]=> + float(1.7) + [8]=> + float(1.8) + [9]=> + float(1.9) + [10]=> + float(2) +} +array(11) { + [0]=> + float(2) + [1]=> + float(1.9) + [2]=> + float(1.8) + [3]=> + float(1.7) + [4]=> + float(1.6) + [5]=> + float(1.5) + [6]=> + float(1.4) + [7]=> + float(1.3) + [8]=> + float(1.2) + [9]=> + float(1.1) + [10]=> + float(1) +} +array(11) { + [0]=> + float(1) + [1]=> + float(1.1) + [2]=> + float(1.2) + [3]=> + float(1.3) + [4]=> + float(1.4) + [5]=> + float(1.5) + [6]=> + float(1.6) + [7]=> + float(1.7) + [8]=> + float(1.8) + [9]=> + float(1.9) + [10]=> + float(2) +} +array(11) { + [0]=> + float(1) + [1]=> + float(1.1) + [2]=> + float(1.2) + [3]=> + float(1.3) + [4]=> + float(1.4) + [5]=> + float(1.5) + [6]=> + float(1.6) + [7]=> + float(1.7) + [8]=> + float(1.8) + [9]=> + float(1.9) + [10]=> + float(2) +} + +-- Testing basic string with step -- +array(7) { + [0]=> + string(1) "a" + [1]=> + string(1) "c" + [2]=> + string(1) "e" + [3]=> + string(1) "g" + [4]=> + string(1) "i" + [5]=> + string(1) "k" + [6]=> + string(1) "m" +} +Done diff --git a/ext/standard/tests/array/range_errors.phpt b/ext/standard/tests/array/range_errors.phpt new file mode 100644 index 0000000..9652e28 --- /dev/null +++ b/ext/standard/tests/array/range_errors.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test range() function (errors) +--INI-- +precision=14 +--FILE-- + high) && (step = 0) ) --"; +var_dump( range(2, 1, 0) ); +var_dump( range("b", "a", 0) ); + +echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --"; +var_dump( range(1.0, 7.0, 6.5) ); + +echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --"; +var_dump( range(7.0, 1.0, 6.5) ); + +echo "\n-- Testing Invalid number of arguments --"; +var_dump( range() ); // No.of args = 0 +var_dump( range(1) ); // No.of args < expected +var_dump( range(1,2,3,4) ); // No.of args > expected +var_dump( range(-1, -2, 2) ); +var_dump( range("a", "j", "z") ); + +echo "\n-- Testing Invalid steps --"; +$step_arr = array( "string", NULL, FALSE, "", "\0" ); + +foreach( $step_arr as $step ) { + var_dump( range( 1, 5, $step ) ); +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing error conditions *** + +-- Testing ( (low < high) && (step = 0) ) -- +Warning: range(): step exceeds the specified range in %s on line %d +bool(false) + +Warning: range(): step exceeds the specified range in %s on line %d +bool(false) + + +-- Testing ( (low > high) && (step = 0) ) -- +Warning: range(): step exceeds the specified range in %s on line %d +bool(false) + +Warning: range(): step exceeds the specified range in %s on line %d +bool(false) + + +-- Testing ( (low < high) && (high-low < step) ) -- +Warning: range(): step exceeds the specified range in %s on line %d +bool(false) + + +-- Testing ( (low > high) && (low-high < step) ) -- +Warning: range(): step exceeds the specified range in %s on line %d +bool(false) + +-- Testing Invalid number of arguments -- +Warning: range() expects at least 2 parameters, 0 given in %s on line %d +bool(false) + +Warning: range() expects at least 2 parameters, 1 given in %s on line %d +bool(false) + +Warning: range() expects at most 3 parameters, 4 given in %s on line %d +bool(false) + +Warning: range(): step exceeds the specified range in %s on line %d +bool(false) + +Warning: range(): step exceeds the specified range in %s on line %d +bool(false) + +-- Testing Invalid steps -- +Warning: range(): step exceeds the specified range in %s on line %d +bool(false) + +Warning: range(): step exceeds the specified range in %s on line %d +bool(false) + +Warning: range(): step exceeds the specified range in %s on line %d +bool(false) + +Warning: range(): step exceeds the specified range in %s on line %d +bool(false) + +Warning: range(): step exceeds the specified range in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/array/range_variation.phpt b/ext/standard/tests/array/range_variation.phpt new file mode 100644 index 0000000..e97d918 --- /dev/null +++ b/ext/standard/tests/array/range_variation.phpt @@ -0,0 +1,626 @@ +--TEST-- +Test range() function (variation-1) +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +*** Testing range() with various low and high values *** +-- creating an array with low = 'ABCD' and high = 'ABCD' -- +array(1) { + [0]=> + string(1) "A" +} + +-- creating an array with low = 'ABCD' and high = '-10.5555' -- +array(11) { + [0]=> + float(0) + [1]=> + float(-1) + [2]=> + float(-2) + [3]=> + float(-3) + [4]=> + float(-4) + [5]=> + float(-5) + [6]=> + float(-6) + [7]=> + float(-7) + [8]=> + float(-8) + [9]=> + float(-9) + [10]=> + float(-10) +} + +-- creating an array with low = 'ABCD' and high = '1' -- +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} + +-- creating an array with low = 'ABCD' and high = '' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = 'ABCD' and high = '' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = 'ABCD' and high = '' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = 'ABCD' and high = 'Array' -- +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} + +-- creating an array with low = '-10.5555' and high = 'ABCD' -- +array(11) { + [0]=> + float(-10.5555) + [1]=> + float(-9.5555) + [2]=> + float(-8.5555) + [3]=> + float(-7.5555) + [4]=> + float(-6.5555) + [5]=> + float(-5.5555) + [6]=> + float(-4.5555) + [7]=> + float(-3.5555) + [8]=> + float(-2.5555) + [9]=> + float(-1.5555) + [10]=> + float(-0.5555) +} + +-- creating an array with low = '-10.5555' and high = '-10.5555' -- +array(1) { + [0]=> + float(-10.5555) +} + +-- creating an array with low = '-10.5555' and high = '1' -- +array(12) { + [0]=> + float(-10.5555) + [1]=> + float(-9.5555) + [2]=> + float(-8.5555) + [3]=> + float(-7.5555) + [4]=> + float(-6.5555) + [5]=> + float(-5.5555) + [6]=> + float(-4.5555) + [7]=> + float(-3.5555) + [8]=> + float(-2.5555) + [9]=> + float(-1.5555) + [10]=> + float(-0.5555) + [11]=> + float(0.4445) +} + +-- creating an array with low = '-10.5555' and high = '' -- +array(11) { + [0]=> + float(-10.5555) + [1]=> + float(-9.5555) + [2]=> + float(-8.5555) + [3]=> + float(-7.5555) + [4]=> + float(-6.5555) + [5]=> + float(-5.5555) + [6]=> + float(-4.5555) + [7]=> + float(-3.5555) + [8]=> + float(-2.5555) + [9]=> + float(-1.5555) + [10]=> + float(-0.5555) +} + +-- creating an array with low = '-10.5555' and high = '' -- +array(11) { + [0]=> + float(-10.5555) + [1]=> + float(-9.5555) + [2]=> + float(-8.5555) + [3]=> + float(-7.5555) + [4]=> + float(-6.5555) + [5]=> + float(-5.5555) + [6]=> + float(-4.5555) + [7]=> + float(-3.5555) + [8]=> + float(-2.5555) + [9]=> + float(-1.5555) + [10]=> + float(-0.5555) +} + +-- creating an array with low = '-10.5555' and high = '' -- +array(11) { + [0]=> + float(-10.5555) + [1]=> + float(-9.5555) + [2]=> + float(-8.5555) + [3]=> + float(-7.5555) + [4]=> + float(-6.5555) + [5]=> + float(-5.5555) + [6]=> + float(-4.5555) + [7]=> + float(-3.5555) + [8]=> + float(-2.5555) + [9]=> + float(-1.5555) + [10]=> + float(-0.5555) +} + +-- creating an array with low = '-10.5555' and high = 'Array' -- +array(12) { + [0]=> + float(-10.5555) + [1]=> + float(-9.5555) + [2]=> + float(-8.5555) + [3]=> + float(-7.5555) + [4]=> + float(-6.5555) + [5]=> + float(-5.5555) + [6]=> + float(-4.5555) + [7]=> + float(-3.5555) + [8]=> + float(-2.5555) + [9]=> + float(-1.5555) + [10]=> + float(-0.5555) + [11]=> + float(0.4445) +} + +-- creating an array with low = '1' and high = 'ABCD' -- +array(2) { + [0]=> + int(1) + [1]=> + int(0) +} + +-- creating an array with low = '1' and high = '-10.5555' -- +array(12) { + [0]=> + float(1) + [1]=> + float(0) + [2]=> + float(-1) + [3]=> + float(-2) + [4]=> + float(-3) + [5]=> + float(-4) + [6]=> + float(-5) + [7]=> + float(-6) + [8]=> + float(-7) + [9]=> + float(-8) + [10]=> + float(-9) + [11]=> + float(-10) +} + +-- creating an array with low = '1' and high = '1' -- +array(1) { + [0]=> + int(1) +} + +-- creating an array with low = '1' and high = '' -- +array(2) { + [0]=> + int(1) + [1]=> + int(0) +} + +-- creating an array with low = '1' and high = '' -- +array(2) { + [0]=> + int(1) + [1]=> + int(0) +} + +-- creating an array with low = '1' and high = '' -- +array(2) { + [0]=> + int(1) + [1]=> + int(0) +} + +-- creating an array with low = '1' and high = 'Array' -- +array(1) { + [0]=> + int(1) +} + +-- creating an array with low = '' and high = 'ABCD' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = '' and high = '-10.5555' -- +array(11) { + [0]=> + float(0) + [1]=> + float(-1) + [2]=> + float(-2) + [3]=> + float(-3) + [4]=> + float(-4) + [5]=> + float(-5) + [6]=> + float(-6) + [7]=> + float(-7) + [8]=> + float(-8) + [9]=> + float(-9) + [10]=> + float(-10) +} + +-- creating an array with low = '' and high = '1' -- +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} + +-- creating an array with low = '' and high = '' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = '' and high = '' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = '' and high = '' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = '' and high = 'Array' -- +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} + +-- creating an array with low = '' and high = 'ABCD' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = '' and high = '-10.5555' -- +array(11) { + [0]=> + float(0) + [1]=> + float(-1) + [2]=> + float(-2) + [3]=> + float(-3) + [4]=> + float(-4) + [5]=> + float(-5) + [6]=> + float(-6) + [7]=> + float(-7) + [8]=> + float(-8) + [9]=> + float(-9) + [10]=> + float(-10) +} + +-- creating an array with low = '' and high = '1' -- +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} + +-- creating an array with low = '' and high = '' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = '' and high = '' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = '' and high = '' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = '' and high = 'Array' -- +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} + +-- creating an array with low = '' and high = 'ABCD' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = '' and high = '-10.5555' -- +array(11) { + [0]=> + float(0) + [1]=> + float(-1) + [2]=> + float(-2) + [3]=> + float(-3) + [4]=> + float(-4) + [5]=> + float(-5) + [6]=> + float(-6) + [7]=> + float(-7) + [8]=> + float(-8) + [9]=> + float(-9) + [10]=> + float(-10) +} + +-- creating an array with low = '' and high = '1' -- +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} + +-- creating an array with low = '' and high = '' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = '' and high = '' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = '' and high = '' -- +array(1) { + [0]=> + int(0) +} + +-- creating an array with low = '' and high = 'Array' -- +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} + +-- creating an array with low = 'Array' and high = 'ABCD' -- +array(2) { + [0]=> + int(1) + [1]=> + int(0) +} + +-- creating an array with low = 'Array' and high = '-10.5555' -- +array(12) { + [0]=> + float(1) + [1]=> + float(0) + [2]=> + float(-1) + [3]=> + float(-2) + [4]=> + float(-3) + [5]=> + float(-4) + [6]=> + float(-5) + [7]=> + float(-6) + [8]=> + float(-7) + [9]=> + float(-8) + [10]=> + float(-9) + [11]=> + float(-10) +} + +-- creating an array with low = 'Array' and high = '1' -- +array(1) { + [0]=> + int(1) +} + +-- creating an array with low = 'Array' and high = '' -- +array(2) { + [0]=> + int(1) + [1]=> + int(0) +} + +-- creating an array with low = 'Array' and high = '' -- +array(2) { + [0]=> + int(1) + [1]=> + int(0) +} + +-- creating an array with low = 'Array' and high = '' -- +array(2) { + [0]=> + int(1) + [1]=> + int(0) +} + +-- creating an array with low = 'Array' and high = 'Array' -- +array(1) { + [0]=> + int(1) +} + +*** Possible variatins with steps *** +array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) +} +array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) +} +Done diff --git a/ext/standard/tests/array/range_variation1.phpt b/ext/standard/tests/array/range_variation1.phpt new file mode 100644 index 0000000..6e57f73 --- /dev/null +++ b/ext/standard/tests/array/range_variation1.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test range() function (variation-2) +--INI-- +precision=14 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing max/outof range values *** +array(2) { + [0]=> + int(2147483645) + [1]=> + int(2147483646) +} +array(3) { + [0]=> + float(2147483646) + [1]=> + float(2147483647) + [2]=> + float(2147483648) +} +array(2) { + [0]=> + int(-2147483647) + [1]=> + int(-2147483646) +} +array(2) { + [0]=> + float(-2147483648) + [1]=> + float(-2147483647) +} +array(3) { + [0]=> + float(-2147483649) + [1]=> + float(-2147483648) + [2]=> + float(-2147483647) +} + +Done diff --git a/ext/standard/tests/array/range_variation1_64bit.phpt b/ext/standard/tests/array/range_variation1_64bit.phpt new file mode 100644 index 0000000..a14dae9 --- /dev/null +++ b/ext/standard/tests/array/range_variation1_64bit.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test range() function (variation-2) +--INI-- +precision=14 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing max/outof range values *** +array(2) { + [0]=> + int(2147483645) + [1]=> + int(2147483646) +} +array(3) { + [0]=> + int(2147483646) + [1]=> + int(2147483647) + [2]=> + int(2147483648) +} +array(2) { + [0]=> + int(-2147483647) + [1]=> + int(-2147483646) +} +array(2) { + [0]=> + int(-2147483648) + [1]=> + int(-2147483647) +} +array(3) { + [0]=> + int(-2147483649) + [1]=> + int(-2147483648) + [2]=> + int(-2147483647) +} + +Done diff --git a/ext/standard/tests/array/reset_basic.phpt b/ext/standard/tests/array/reset_basic.phpt new file mode 100644 index 0000000..d376e68 --- /dev/null +++ b/ext/standard/tests/array/reset_basic.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test reset() function : basic functionality +--FILE-- + 'two'); + +echo "\n-- Initial Position: --\n"; +echo key($array) . " => " . current($array) . "\n"; + +echo "\n-- Call to next() --\n"; +var_dump(next($array)); + +echo "\n-- Current Position: --\n"; +echo key($array) . " => " . current($array) . "\n"; + +echo "\n-- Call to reset() --\n"; +var_dump(reset($array)); +?> +===DONE=== +--EXPECTF-- +*** Testing reset() : basic functionality *** + +-- Initial Position: -- +0 => zero + +-- Call to next() -- +string(3) "one" + +-- Current Position: -- +1 => one + +-- Call to reset() -- +string(4) "zero" +===DONE=== diff --git a/ext/standard/tests/array/reset_error.phpt b/ext/standard/tests/array/reset_error.phpt new file mode 100644 index 0000000..c716081 --- /dev/null +++ b/ext/standard/tests/array/reset_error.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test reset() function : error conditions - Pass incorrect number of args +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing reset() : error conditions *** + +-- Testing reset() function with Zero arguments -- + +Warning: reset() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing reset() function with more than expected no. of arguments -- + +Warning: reset() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/reset_variation1.phpt b/ext/standard/tests/array/reset_variation1.phpt new file mode 100644 index 0000000..b6cddf0 --- /dev/null +++ b/ext/standard/tests/array/reset_variation1.phpt @@ -0,0 +1,219 @@ +--TEST-- +Test reset() function : usage variations - Pass different data types as $array_arg arg. +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing reset() : usage variations *** + +-- Iteration 1 -- + +Warning: reset() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: reset() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: reset() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: reset() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: reset() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: reset() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: reset() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: reset() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: reset() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: reset() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: reset() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: reset() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: reset() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: reset() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: reset() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: reset() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: reset() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +bool(false) + +-- Iteration 19 -- + +Warning: reset() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: reset() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: reset() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- +bool(false) + +-- Iteration 23 -- + +Warning: reset() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: reset() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: reset() expects parameter 1 to be array, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/reset_variation2.phpt b/ext/standard/tests/array/reset_variation2.phpt new file mode 100644 index 0000000..1384aff --- /dev/null +++ b/ext/standard/tests/array/reset_variation2.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test reset() function : usage variations - unset first element +--FILE-- + " . key($array) . "\n"; + +echo "\n-- Unset First element in array and check reset() --\n"; +unset($array[0]); +var_dump(reset($array)); +?> +===DONE=== +--EXPECTF-- +*** Testing reset() : usage variations *** + +-- Initial Position: -- +a => 0 + +-- Unset First element in array and check reset() -- +string(1) "b" +===DONE=== diff --git a/ext/standard/tests/array/reset_variation3.phpt b/ext/standard/tests/array/reset_variation3.phpt new file mode 100644 index 0000000..29f965a --- /dev/null +++ b/ext/standard/tests/array/reset_variation3.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test reset() function : usage variations - Referenced variables +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing reset() : usage variations *** + +-- Initial position of internal pointer -- +string(4) "zero" + +-- Position after calling next() -- +$array1: string(3) "one" +$array2: string(3) "one" + +-- Position after calling reset() -- +string(4) "zero" +$array1: string(4) "zero" +$array2: string(4) "zero" +===DONE=== diff --git a/ext/standard/tests/array/rsort_basic.phpt b/ext/standard/tests/array/rsort_basic.phpt new file mode 100644 index 0000000..34fcbb7 --- /dev/null +++ b/ext/standard/tests/array/rsort_basic.phpt @@ -0,0 +1,241 @@ +--TEST-- +Test rsort() function : basic functionality +--FILE-- + "lemon", "o" => "orange", + "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", + "b" => "banana", +); + +// array with default keys containing unsorted numeric values +$unsorted_numerics = array( 100, 33, 555, 22 ); + +echo "\n-- Testing rsort() by supplying string array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_strings; +var_dump( rsort($temp_array) ); +var_dump( $temp_array); + +echo "\n-- Testing rsort() by supplying numeric array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_numerics; +var_dump( rsort($temp_array) ); +var_dump( $temp_array); + +echo "\n-- Testing rsort() by supplying string array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $unsorted_strings; +var_dump( rsort($temp_array, SORT_REGULAR) ); +var_dump( $temp_array); + +echo "\n-- Testing rsort() by supplying numeric array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $unsorted_numerics; +var_dump( rsort($temp_array, SORT_REGULAR) ); +var_dump( $temp_array); + +echo "\n-- Testing rsort() by supplying string array, 'flag' = SORT_STRING --\n"; +$temp_array = $unsorted_strings; +var_dump( rsort($temp_array, SORT_STRING) ); +var_dump( $temp_array); + +echo "\n-- Testing rsort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE --\n"; +$temp_array = $unsorted_strings; +var_dump( rsort($temp_array, SORT_STRING|SORT_FLAG_CASE) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing rsort() by supplying string array (natural), 'flag' = SORT_NATURAL --\n"; +$temp_array = $unsorted_strings; +var_dump( rsort($temp_array, SORT_NATURAL) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing rsort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE --\n"; +$temp_array = $unsorted_strings; +var_dump( rsort($temp_array, SORT_NATURAL|SORT_FLAG_CASE) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing rsort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n"; +$temp_array = $unsorted_numerics; +var_dump( rsort($temp_array, SORT_NUMERIC) ); +var_dump( $temp_array); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing rsort() : basic functionality *** + +-- Testing rsort() by supplying string array, 'flag' value is defualt -- +bool(true) +array(8) { + [0]=> + string(8) "orange20" + [1]=> + string(7) "orange2" + [2]=> + string(6) "orange" + [3]=> + string(5) "lemon" + [4]=> + string(6) "banana" + [5]=> + string(7) "Orange3" + [6]=> + string(7) "Orange1" + [7]=> + string(6) "Orange" +} + +-- Testing rsort() by supplying numeric array, 'flag' value is defualt -- +bool(true) +array(4) { + [0]=> + int(555) + [1]=> + int(100) + [2]=> + int(33) + [3]=> + int(22) +} + +-- Testing rsort() by supplying string array, 'flag' = SORT_REGULAR -- +bool(true) +array(8) { + [0]=> + string(8) "orange20" + [1]=> + string(7) "orange2" + [2]=> + string(6) "orange" + [3]=> + string(5) "lemon" + [4]=> + string(6) "banana" + [5]=> + string(7) "Orange3" + [6]=> + string(7) "Orange1" + [7]=> + string(6) "Orange" +} + +-- Testing rsort() by supplying numeric array, 'flag' = SORT_REGULAR -- +bool(true) +array(4) { + [0]=> + int(555) + [1]=> + int(100) + [2]=> + int(33) + [3]=> + int(22) +} + +-- Testing rsort() by supplying string array, 'flag' = SORT_STRING -- +bool(true) +array(8) { + [0]=> + string(8) "orange20" + [1]=> + string(7) "orange2" + [2]=> + string(6) "orange" + [3]=> + string(5) "lemon" + [4]=> + string(6) "banana" + [5]=> + string(7) "Orange3" + [6]=> + string(7) "Orange1" + [7]=> + string(6) "Orange" +} + +-- Testing rsort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE -- +bool(true) +array(8) { + [0]=> + string(7) "Orange3" + [1]=> + string(8) "orange20" + [2]=> + string(7) "orange2" + [3]=> + string(7) "Orange1" + [4]=> + string(6) "orange" + [5]=> + string(6) "Orange" + [6]=> + string(5) "lemon" + [7]=> + string(6) "banana" +} + +-- Testing rsort() by supplying string array (natural), 'flag' = SORT_NATURAL -- +bool(true) +array(8) { + [0]=> + string(8) "orange20" + [1]=> + string(7) "orange2" + [2]=> + string(6) "orange" + [3]=> + string(5) "lemon" + [4]=> + string(6) "banana" + [5]=> + string(7) "Orange3" + [6]=> + string(7) "Orange1" + [7]=> + string(6) "Orange" +} + +-- Testing rsort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE -- +bool(true) +array(8) { + [0]=> + string(8) "orange20" + [1]=> + string(7) "Orange3" + [2]=> + string(7) "orange2" + [3]=> + string(7) "Orange1" + [4]=> + string(6) "orange" + [5]=> + string(6) "Orange" + [6]=> + string(5) "lemon" + [7]=> + string(6) "banana" +} + +-- Testing rsort() by supplying numeric array, 'flag' = SORT_NUMERIC -- +bool(true) +array(4) { + [0]=> + int(555) + [1]=> + int(100) + [2]=> + int(33) + [3]=> + int(22) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_error.phpt b/ext/standard/tests/array/rsort_error.phpt new file mode 100644 index 0000000..6f6f2f9 --- /dev/null +++ b/ext/standard/tests/array/rsort_error.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test rsort() function : error conditions - Pass incorrect number of args +--FILE-- + + +--EXPECTF-- +*** Testing rsort() : error conditions *** + +-- Testing rsort() function with Zero arguments -- + +Warning: rsort() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing rsort() function with more than expected no. of arguments -- + +Warning: rsort() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_object1.phpt b/ext/standard/tests/array/rsort_object1.phpt new file mode 100644 index 0000000..98f7cfe --- /dev/null +++ b/ext/standard/tests/array/rsort_object1.phpt @@ -0,0 +1,243 @@ +--TEST-- +Test rsort() function : object functionality +--FILE-- +class_value = $value; + } + +} + +// class declaration for string objects +class for_string_rsort +{ + public $class_value; + // initializing object member value + function __construct($value){ + $this->class_value = $value; + } + + // return string value + function __tostring() { + return (string)$this->value; + } + +} + +// array of integer objects +$unsorted_int_obj = array( + new for_integer_rsort(11), new for_integer_rsort(66), + new for_integer_rsort(23), new for_integer_rsort(-5), + new for_integer_rsort(0.001), new for_integer_rsort(0) +); + +// array of string objects +$unsorted_str_obj = array ( + new for_string_rsort("axx"), new for_string_rsort("t"), + new for_string_rsort("w"), new for_string_rsort("py"), + new for_string_rsort("apple"), new for_string_rsort("Orange"), + new for_string_rsort("Lemon"), new for_string_rsort("aPPle") +); + + +echo "\n-- Sort flag = default --\n"; + +// testing rsort() function by supplying integer object array, flag value is defualt +$temp_array = $unsorted_int_obj; +var_dump(rsort($temp_array) ); +var_dump($temp_array); + +// testing rsort() function by supplying string object array, flag value is defualt +$temp_array = $unsorted_str_obj; +var_dump(rsort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Sort flag = SORT_REGULAR --\n"; +// testing rsort() function by supplying integer object array, flag value = SORT_REGULAR +$temp_array = $unsorted_int_obj; +var_dump(rsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +// testing rsort() function by supplying string object array, flag value = SORT_REGULAR +$temp_array = $unsorted_str_obj; +var_dump(rsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing rsort() : object functionality *** + +-- Sort flag = default -- +bool(true) +array(6) { + [0]=> + object(for_integer_rsort)#%d (1) { + ["class_value"]=> + int(66) + } + [1]=> + object(for_integer_rsort)#%d (1) { + ["class_value"]=> + int(23) + } + [2]=> + object(for_integer_rsort)#%d (1) { + ["class_value"]=> + int(11) + } + [3]=> + object(for_integer_rsort)#%d (1) { + ["class_value"]=> + float(0.001) + } + [4]=> + object(for_integer_rsort)#%d (1) { + ["class_value"]=> + int(0) + } + [5]=> + object(for_integer_rsort)#%d (1) { + ["class_value"]=> + int(-5) + } +} +bool(true) +array(8) { + [0]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(1) "w" + } + [1]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(1) "t" + } + [2]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(2) "py" + } + [3]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(3) "axx" + } + [4]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(5) "apple" + } + [5]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(5) "aPPle" + } + [6]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(6) "Orange" + } + [7]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(5) "Lemon" + } +} + +-- Sort flag = SORT_REGULAR -- +bool(true) +array(6) { + [0]=> + object(for_integer_rsort)#%d (1) { + ["class_value"]=> + int(66) + } + [1]=> + object(for_integer_rsort)#%d (1) { + ["class_value"]=> + int(23) + } + [2]=> + object(for_integer_rsort)#%d (1) { + ["class_value"]=> + int(11) + } + [3]=> + object(for_integer_rsort)#%d (1) { + ["class_value"]=> + float(0.001) + } + [4]=> + object(for_integer_rsort)#%d (1) { + ["class_value"]=> + int(0) + } + [5]=> + object(for_integer_rsort)#%d (1) { + ["class_value"]=> + int(-5) + } +} +bool(true) +array(8) { + [0]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(1) "w" + } + [1]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(1) "t" + } + [2]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(2) "py" + } + [3]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(3) "axx" + } + [4]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(5) "apple" + } + [5]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(5) "aPPle" + } + [6]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(6) "Orange" + } + [7]=> + object(for_string_rsort)#%d (1) { + ["class_value"]=> + string(5) "Lemon" + } +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_object2.phpt b/ext/standard/tests/array/rsort_object2.phpt new file mode 100644 index 0000000..57acdc6 --- /dev/null +++ b/ext/standard/tests/array/rsort_object2.phpt @@ -0,0 +1,258 @@ +--TEST-- +Test rsort() function : object functionality - different visibilities +--FILE-- +public_class_value = $value1; + $this->private_class_value = $value2; + $this->protected_class_value = $value3; + } + +} + +// class declaration for string objects +class for_string_rsort +{ + public $public_class_value; + private $private_class_value; + protected $protected_class_value; + // initializing object member value + function __construct($value1, $value2,$value3){ + $this->public_class_value = $value1; + $this->private_class_value = $value2; + $this->protected_class_value = $value3; + } + + // return string value + function __tostring() { + return (string)$this->value; + } + +} + +// array of integer objects + +$unsorted_int_obj = array( + new for_integer_rsort(11,33,30), + new for_integer_rsort(66,44,4), + new for_integer_rsort(-88,-5,5), + new for_integer_rsort(0.001,99.5,0.1) +); + +// array of string objects +$unsorted_str_obj = array ( + new for_string_rsort("axx","AXX","ass"), + new for_string_rsort("t","eee","abb"), + new for_string_rsort("w","W", "c"), + new for_string_rsort("py","PY", "pt"), +); + + +echo "\n-- Sort flag = default --\n"; + +// testing rsort() function by supplying integer object array, flag value is defualt +$temp_array = $unsorted_int_obj; +var_dump(rsort($temp_array) ); +var_dump($temp_array); + +// testing rsort() function by supplying string object array, flag value is defualt +$temp_array = $unsorted_str_obj; +var_dump(rsort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Sort flag = SORT_REGULAR --\n"; +// testing rsort() function by supplying integer object array, flag value = SORT_REGULAR +$temp_array = $unsorted_int_obj; +var_dump(rsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +// testing rsort() function by supplying string object array, flag value = SORT_REGULAR +$temp_array = $unsorted_str_obj; +var_dump(rsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing rsort() : object functionality *** + +-- Sort flag = default -- +bool(true) +array(4) { + [0]=> + object(for_integer_rsort)#%d (3) { + ["public_class_value"]=> + int(66) + ["private_class_value":"for_integer_rsort":private]=> + int(44) + ["protected_class_value":protected]=> + int(4) + } + [1]=> + object(for_integer_rsort)#%d (3) { + ["public_class_value"]=> + int(11) + ["private_class_value":"for_integer_rsort":private]=> + int(33) + ["protected_class_value":protected]=> + int(30) + } + [2]=> + object(for_integer_rsort)#%d (3) { + ["public_class_value"]=> + float(0.001) + ["private_class_value":"for_integer_rsort":private]=> + float(99.5) + ["protected_class_value":protected]=> + float(0.1) + } + [3]=> + object(for_integer_rsort)#%d (3) { + ["public_class_value"]=> + int(-88) + ["private_class_value":"for_integer_rsort":private]=> + int(-5) + ["protected_class_value":protected]=> + int(5) + } +} +bool(true) +array(4) { + [0]=> + object(for_string_rsort)#%d (3) { + ["public_class_value"]=> + string(1) "w" + ["private_class_value":"for_string_rsort":private]=> + string(1) "W" + ["protected_class_value":protected]=> + string(1) "c" + } + [1]=> + object(for_string_rsort)#%d (3) { + ["public_class_value"]=> + string(1) "t" + ["private_class_value":"for_string_rsort":private]=> + string(3) "eee" + ["protected_class_value":protected]=> + string(3) "abb" + } + [2]=> + object(for_string_rsort)#%d (3) { + ["public_class_value"]=> + string(2) "py" + ["private_class_value":"for_string_rsort":private]=> + string(2) "PY" + ["protected_class_value":protected]=> + string(2) "pt" + } + [3]=> + object(for_string_rsort)#%d (3) { + ["public_class_value"]=> + string(3) "axx" + ["private_class_value":"for_string_rsort":private]=> + string(3) "AXX" + ["protected_class_value":protected]=> + string(3) "ass" + } +} + +-- Sort flag = SORT_REGULAR -- +bool(true) +array(4) { + [0]=> + object(for_integer_rsort)#%d (3) { + ["public_class_value"]=> + int(66) + ["private_class_value":"for_integer_rsort":private]=> + int(44) + ["protected_class_value":protected]=> + int(4) + } + [1]=> + object(for_integer_rsort)#%d (3) { + ["public_class_value"]=> + int(11) + ["private_class_value":"for_integer_rsort":private]=> + int(33) + ["protected_class_value":protected]=> + int(30) + } + [2]=> + object(for_integer_rsort)#%d (3) { + ["public_class_value"]=> + float(0.001) + ["private_class_value":"for_integer_rsort":private]=> + float(99.5) + ["protected_class_value":protected]=> + float(0.1) + } + [3]=> + object(for_integer_rsort)#%d (3) { + ["public_class_value"]=> + int(-88) + ["private_class_value":"for_integer_rsort":private]=> + int(-5) + ["protected_class_value":protected]=> + int(5) + } +} +bool(true) +array(4) { + [0]=> + object(for_string_rsort)#%d (3) { + ["public_class_value"]=> + string(1) "w" + ["private_class_value":"for_string_rsort":private]=> + string(1) "W" + ["protected_class_value":protected]=> + string(1) "c" + } + [1]=> + object(for_string_rsort)#%d (3) { + ["public_class_value"]=> + string(1) "t" + ["private_class_value":"for_string_rsort":private]=> + string(3) "eee" + ["protected_class_value":protected]=> + string(3) "abb" + } + [2]=> + object(for_string_rsort)#%d (3) { + ["public_class_value"]=> + string(2) "py" + ["private_class_value":"for_string_rsort":private]=> + string(2) "PY" + ["protected_class_value":protected]=> + string(2) "pt" + } + [3]=> + object(for_string_rsort)#%d (3) { + ["public_class_value"]=> + string(3) "axx" + ["private_class_value":"for_string_rsort":private]=> + string(3) "AXX" + ["protected_class_value":protected]=> + string(3) "ass" + } +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation1.phpt b/ext/standard/tests/array/rsort_variation1.phpt new file mode 100644 index 0000000..96dac90 --- /dev/null +++ b/ext/standard/tests/array/rsort_variation1.phpt @@ -0,0 +1,514 @@ +--TEST-- +Test rsort() function : usage variations - Pass different data types as $array_arg arg +--FILE-- + + +--EXPECTF-- +*** Testing rsort() : variation *** +-- Iteration 1 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 2 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 3 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 4 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 5 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 6 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 7 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 8 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 9 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 10 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +-- Iteration 11 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +-- Iteration 12 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 13 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 14 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 15 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 16 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 17 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 18 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 19 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 20 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 21 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, object given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, object given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, object given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, object given in %s on line %d +bool(false) +-- Iteration 22 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +-- Iteration 23 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +-- Iteration 24 -- +Flag = default: + +Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) +Flag = SORT_REGULAR: + +Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) +Flag = SORT_NUMERIC: + +Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) +Flag = SORT_STRING: + +Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation10.phpt b/ext/standard/tests/array/rsort_variation10.phpt new file mode 100644 index 0000000..ccf886b --- /dev/null +++ b/ext/standard/tests/array/rsort_variation10.phpt @@ -0,0 +1,108 @@ +--TEST-- +Test rsort() function : usage variations - Octal values +--FILE-- + + +--EXPECTF-- +*** Testing rsort() : variation *** + +-- Sort flag = default -- +bool(true) +array(9) { + [0]=> + int(669) + [1]=> + int(506) + [2]=> + int(229) + [3]=> + int(209) + [4]=> + int(63) + [5]=> + int(54) + [6]=> + int(0) + [7]=> + int(-54) + [8]=> + int(-229) +} + +-- Sort flag = SORT_REGULAR -- +bool(true) +array(9) { + [0]=> + int(669) + [1]=> + int(506) + [2]=> + int(229) + [3]=> + int(209) + [4]=> + int(63) + [5]=> + int(54) + [6]=> + int(0) + [7]=> + int(-54) + [8]=> + int(-229) +} + +-- Sort flag = SORT_NUMERIC -- +bool(true) +array(9) { + [0]=> + int(669) + [1]=> + int(506) + [2]=> + int(229) + [3]=> + int(209) + [4]=> + int(63) + [5]=> + int(54) + [6]=> + int(0) + [7]=> + int(-54) + [8]=> + int(-229) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation11.phpt b/ext/standard/tests/array/rsort_variation11.phpt new file mode 100644 index 0000000..83bbf84 Binary files /dev/null and b/ext/standard/tests/array/rsort_variation11.phpt differ diff --git a/ext/standard/tests/array/rsort_variation2.phpt b/ext/standard/tests/array/rsort_variation2.phpt new file mode 100644 index 0000000..2196a64 --- /dev/null +++ b/ext/standard/tests/array/rsort_variation2.phpt @@ -0,0 +1,484 @@ +--TEST-- +Test rsort() function : usage variations - Pass different data types as $sort_flags arg +--FILE-- + + +--EXPECTF-- +*** Testing rsort() : variation *** + +-- Iteration 1 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 2 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 3 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 4 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 5 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 6 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 7 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 8 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 9 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 10 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 11 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 12 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 13 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 14 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 15 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 16 -- + +Warning: rsort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(5) { + [0]=> + int(1) + [1]=> + int(5) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(1) +} + +-- Iteration 17 -- + +Warning: rsort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(5) { + [0]=> + int(1) + [1]=> + int(5) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(1) +} + +-- Iteration 18 -- + +Warning: rsort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(5) { + [0]=> + int(1) + [1]=> + int(5) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(1) +} + +-- Iteration 19 -- + +Warning: rsort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(5) { + [0]=> + int(1) + [1]=> + int(5) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(1) +} + +-- Iteration 20 -- + +Warning: rsort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(5) { + [0]=> + int(1) + [1]=> + int(5) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(1) +} + +-- Iteration 21 -- + +Warning: rsort() expects parameter 2 to be long, object given in %s on line %d +bool(false) +array(5) { + [0]=> + int(1) + [1]=> + int(5) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(1) +} + +-- Iteration 22 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 23 -- +bool(true) +array(5) { + [0]=> + int(5) + [1]=> + int(3) + [2]=> + int(2) + [3]=> + int(1) + [4]=> + int(1) +} + +-- Iteration 24 -- + +Warning: rsort() expects parameter 2 to be long, resource given in %s on line %d +bool(false) +array(5) { + [0]=> + int(1) + [1]=> + int(5) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(1) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation3.phpt b/ext/standard/tests/array/rsort_variation3.phpt new file mode 100644 index 0000000..f8c002a --- /dev/null +++ b/ext/standard/tests/array/rsort_variation3.phpt @@ -0,0 +1,325 @@ +--TEST-- +Test rsort() function : usage variations - numeric values +--SKIPIF-- + +--FILE-- + SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC); + +$count = 1; + +// loop through to test rsort() with different arrays +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With Defualt sort flag -\n"; + $temp_array = $array; + var_dump(rsort($temp_array) ); + var_dump($temp_array); + + // loop through $flag_value array and setting all possible flag values + foreach($flag_value as $key => $flag){ + echo "- Sort flag = $key -\n"; + $temp_array = $array; + var_dump(rsort($temp_array, $flag) ); + var_dump($temp_array); + } + $count++; +} + +echo "Done"; +?> + +--EXPECTF-- +*** Testing rsort() : variation *** + +-- Iteration 1 -- +- With Defualt sort flag - +bool(true) +array(9) { + [0]=> + int(41) + [1]=> + int(31) + [2]=> + int(21) + [3]=> + int(11) + [4]=> + int(0) + [5]=> + int(-11) + [6]=> + int(-21) + [7]=> + int(-31) + [8]=> + int(-41) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(9) { + [0]=> + int(41) + [1]=> + int(31) + [2]=> + int(21) + [3]=> + int(11) + [4]=> + int(0) + [5]=> + int(-11) + [6]=> + int(-21) + [7]=> + int(-31) + [8]=> + int(-41) +} +- Sort flag = SORT_NUMERIC - +bool(true) +array(9) { + [0]=> + int(41) + [1]=> + int(31) + [2]=> + int(21) + [3]=> + int(11) + [4]=> + int(0) + [5]=> + int(-11) + [6]=> + int(-21) + [7]=> + int(-31) + [8]=> + int(-41) +} + +-- Iteration 2 -- +- With Defualt sort flag - +bool(true) +array(7) { + [0]=> + float(1050) + [1]=> + float(10.5) + [2]=> + float(0.5) + [3]=> + float(0.106) + [4]=> + float(0.01) + [5]=> + float(-0.1) + [6]=> + float(-10.5) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(7) { + [0]=> + float(1050) + [1]=> + float(10.5) + [2]=> + float(0.5) + [3]=> + float(0.106) + [4]=> + float(0.01) + [5]=> + float(-0.1) + [6]=> + float(-10.5) +} +- Sort flag = SORT_NUMERIC - +bool(true) +array(7) { + [0]=> + float(1050) + [1]=> + float(10.5) + [2]=> + float(0.5) + [3]=> + float(0.106) + [4]=> + float(0.01) + [5]=> + float(-0.1) + [6]=> + float(-10.5) +} + +-- Iteration 3 -- +- With Defualt sort flag - +bool(true) +array(11) { + [0]=> + int(33) + [1]=> + int(2) + [2]=> + float(0.106) + [3]=> + float(0.09) + [4]=> + float(0.0021) + [5]=> + float(0.0001) + [6]=> + int(0) + [7]=> + float(-0.01) + [8]=> + float(-0.106) + [9]=> + float(-0.9) + [10]=> + int(-1) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(11) { + [0]=> + int(33) + [1]=> + int(2) + [2]=> + float(0.106) + [3]=> + float(0.09) + [4]=> + float(0.0021) + [5]=> + float(0.0001) + [6]=> + int(0) + [7]=> + float(-0.01) + [8]=> + float(-0.106) + [9]=> + float(-0.9) + [10]=> + int(-1) +} +- Sort flag = SORT_NUMERIC - +bool(true) +array(11) { + [0]=> + int(33) + [1]=> + int(2) + [2]=> + float(0.106) + [3]=> + float(0.09) + [4]=> + float(0.0021) + [5]=> + float(0.0001) + [6]=> + int(0) + [7]=> + float(-0.01) + [8]=> + float(-0.106) + [9]=> + float(-0.9) + [10]=> + int(-1) +} + +-- Iteration 4 -- +- With Defualt sort flag - +bool(true) +array(7) { + [0]=> + float(2147483648) + [1]=> + int(2147483647) + [2]=> + int(0) + [3]=> + int(0) + [4]=> + int(-2147483647) + [5]=> + float(-2147483648) + [6]=> + float(-2147483649) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(7) { + [0]=> + float(2147483648) + [1]=> + int(2147483647) + [2]=> + int(0) + [3]=> + int(0) + [4]=> + int(-2147483647) + [5]=> + float(-2147483648) + [6]=> + float(-2147483649) +} +- Sort flag = SORT_NUMERIC - +bool(true) +array(7) { + [0]=> + float(2147483648) + [1]=> + int(2147483647) + [2]=> + int(0) + [3]=> + int(0) + [4]=> + int(-2147483647) + [5]=> + float(-2147483648) + [6]=> + float(-2147483649) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation4.phpt b/ext/standard/tests/array/rsort_variation4.phpt new file mode 100644 index 0000000..226284d --- /dev/null +++ b/ext/standard/tests/array/rsort_variation4.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test rsort() function : usage variations - referenced variables +--FILE-- + +--EXPECTF-- +*** Testing rsort() : variation *** + +-- 'flag' value is defualt -- +bool(true) +array(3) { + [0]=> + &int(555) + [1]=> + &int(100) + [2]=> + &int(33) +} + +-- 'flag' = SORT_REGULAR -- +bool(true) +array(3) { + [0]=> + &int(555) + [1]=> + &int(100) + [2]=> + &int(33) +} +Done diff --git a/ext/standard/tests/array/rsort_variation5.phpt b/ext/standard/tests/array/rsort_variation5.phpt new file mode 100644 index 0000000..c0184e8 --- /dev/null +++ b/ext/standard/tests/array/rsort_variation5.phpt @@ -0,0 +1,226 @@ +--TEST-- +Test rsort() function : usage variations - String values +--SKIPIF-- + SORT_REGULAR, "SORT_STRING" => SORT_STRING); + +$count = 1; +// loop through to test rsort() with different arrays +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With Default sort flag -\n"; + $temp_array = $array; + var_dump(rsort($temp_array) ); + var_dump($temp_array); + + // loop through $flags array and setting all possible flag values + foreach($flags as $key => $flag){ + echo "- Sort flag = $key -\n"; + + $temp_array = $array; + var_dump(rsort($temp_array, $flag) ); + var_dump($temp_array); + } + $count++; +} + +echo "Done"; +?> + +--EXPECTF-- +*** Testing rsort() : variation *** + +-- Iteration 1 -- +- With Default sort flag - +bool(true) +array(11) { + [0]=> + string(4) "\xhh" + [1]=> + string(4) "\ddd" + [2]=> + string(3) "\cx" + [3]=> + string(2) "\a" + [4]=> + string(1) "" + [5]=> + string(1) " " + [6]=> + string(1) " " + [7]=> + string(1) " +" + [8]=> + string(1) " " + [9]=> + NULL + [10]=> + NULL +} +- Sort flag = SORT_REGULAR - +bool(true) +array(11) { + [0]=> + string(4) "\xhh" + [1]=> + string(4) "\ddd" + [2]=> + string(3) "\cx" + [3]=> + string(2) "\a" + [4]=> + string(1) "" + [5]=> + string(1) " " + [6]=> + string(1) " " + [7]=> + string(1) " +" + [8]=> + string(1) " " + [9]=> + NULL + [10]=> + NULL +} +- Sort flag = SORT_STRING - +bool(true) +array(11) { + [0]=> + string(4) "\xhh" + [1]=> + string(4) "\ddd" + [2]=> + string(3) "\cx" + [3]=> + string(2) "\a" + [4]=> + string(1) "" + [5]=> + string(1) " " + [6]=> + string(1) " " + [7]=> + string(1) " +" + [8]=> + string(1) " " + [9]=> + NULL + [10]=> + NULL +} + +-- Iteration 2 -- +- With Default sort flag - +bool(true) +array(12) { + [0]=> + string(1) "x" + [1]=> + string(2) "ww" + [2]=> + string(3) "ttt" + [3]=> + string(6) "oraNGe" + [4]=> + string(5) "lemoN" + [5]=> + string(6) "banana" + [6]=> + string(5) "apple" + [7]=> + string(1) "X" + [8]=> + string(4) "Test" + [9]=> + string(4) "TTTT" + [10]=> + string(6) "Orange" + [11]=> + string(6) "BANANA" +} +- Sort flag = SORT_REGULAR - +bool(true) +array(12) { + [0]=> + string(1) "x" + [1]=> + string(2) "ww" + [2]=> + string(3) "ttt" + [3]=> + string(6) "oraNGe" + [4]=> + string(5) "lemoN" + [5]=> + string(6) "banana" + [6]=> + string(5) "apple" + [7]=> + string(1) "X" + [8]=> + string(4) "Test" + [9]=> + string(4) "TTTT" + [10]=> + string(6) "Orange" + [11]=> + string(6) "BANANA" +} +- Sort flag = SORT_STRING - +bool(true) +array(12) { + [0]=> + string(1) "x" + [1]=> + string(2) "ww" + [2]=> + string(3) "ttt" + [3]=> + string(6) "oraNGe" + [4]=> + string(5) "lemoN" + [5]=> + string(6) "banana" + [6]=> + string(5) "apple" + [7]=> + string(1) "X" + [8]=> + string(4) "Test" + [9]=> + string(4) "TTTT" + [10]=> + string(6) "Orange" + [11]=> + string(6) "BANANA" +} +Done diff --git a/ext/standard/tests/array/rsort_variation6.phpt b/ext/standard/tests/array/rsort_variation6.phpt new file mode 100644 index 0000000..559a1eb --- /dev/null +++ b/ext/standard/tests/array/rsort_variation6.phpt @@ -0,0 +1,120 @@ +--TEST-- +Test rsort() function : usage variations - Hexadecimal vales +--FILE-- + + +--EXPECTF-- +*** Testing rsort() : variation *** + +-- 'flag' value is defualt -- +bool(true) +array(11) { + [0]=> + int(4095) + [1]=> + int(682) + [2]=> + int(427) + [3]=> + int(427) + [4]=> + int(255) + [5]=> + int(255) + [6]=> + int(187) + [7]=> + int(15) + [8]=> + int(0) + [9]=> + int(-255) + [10]=> + int(-682) +} + +-- 'flag' value is SORT_REGULAR -- +bool(true) +array(11) { + [0]=> + int(4095) + [1]=> + int(682) + [2]=> + int(427) + [3]=> + int(427) + [4]=> + int(255) + [5]=> + int(255) + [6]=> + int(187) + [7]=> + int(15) + [8]=> + int(0) + [9]=> + int(-255) + [10]=> + int(-682) +} + +-- 'flag' value is SORT_NUMERIC -- +bool(true) +array(11) { + [0]=> + int(4095) + [1]=> + int(682) + [2]=> + int(427) + [3]=> + int(427) + [4]=> + int(255) + [5]=> + int(255) + [6]=> + int(187) + [7]=> + int(15) + [8]=> + int(0) + [9]=> + int(-255) + [10]=> + int(-682) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation7.phpt b/ext/standard/tests/array/rsort_variation7.phpt new file mode 100644 index 0000000..a996bf6 --- /dev/null +++ b/ext/standard/tests/array/rsort_variation7.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test rsort() function : usage variations - boolean values +--FILE-- + + +--EXPECTF-- +*** Testing rsort() : variation *** + +-- 'flag' value is defualt -- +bool(true) +array(4) { + [0]=> + bool(true) + [1]=> + bool(true) + [2]=> + bool(false) + [3]=> + bool(false) +} + +-- 'flag' value is SORT_REGULAR -- +bool(true) +array(4) { + [0]=> + bool(true) + [1]=> + bool(true) + [2]=> + bool(false) + [3]=> + bool(false) +} + +-- 'flag' value is SORT_NUMERIC -- +bool(true) +array(4) { + [0]=> + bool(true) + [1]=> + bool(true) + [2]=> + bool(false) + [3]=> + bool(false) +} + +-- 'flag' value is SORT_STRING -- +bool(true) +array(4) { + [0]=> + bool(true) + [1]=> + bool(true) + [2]=> + bool(false) + [3]=> + bool(false) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation8.phpt b/ext/standard/tests/array/rsort_variation8.phpt new file mode 100644 index 0000000..a4f94b5 --- /dev/null +++ b/ext/standard/tests/array/rsort_variation8.phpt @@ -0,0 +1,180 @@ +--TEST-- +Test rsort() function : usage variations - multi-dimensional arrays +--FILE-- + + +--EXPECTF-- +*** Testing rsort() : variation *** + +-- Iteration 1 -- + +-- 'flag' value is default -- +bool(true) +array(0) { +} + +-- 'flag' value is SORT_REGULAR -- +bool(true) +array(0) { +} + +-- Iteration 2 -- + +-- 'flag' value is default -- +bool(true) +array(1) { + [0]=> + array(0) { + } +} + +-- 'flag' value is SORT_REGULAR -- +bool(true) +array(1) { + [0]=> + array(0) { + } +} + +-- Iteration 3 -- + +-- 'flag' value is default -- +bool(true) +array(3) { + [0]=> + array(2) { + [0]=> + int(64) + [1]=> + int(61) + } + [1]=> + int(44) + [2]=> + int(11) +} + +-- 'flag' value is SORT_REGULAR -- +bool(true) +array(3) { + [0]=> + array(2) { + [0]=> + int(64) + [1]=> + int(61) + } + [1]=> + int(44) + [2]=> + int(11) +} + +-- Iteration 4 -- + +-- 'flag' value is default -- +bool(true) +array(4) { + [0]=> + array(3) { + [0]=> + int(33) + [1]=> + int(-5) + [2]=> + int(6) + } + [1]=> + array(2) { + [0]=> + int(22) + [1]=> + int(-55) + } + [2]=> + array(1) { + [0]=> + int(11) + } + [3]=> + array(0) { + } +} + +-- 'flag' value is SORT_REGULAR -- +bool(true) +array(4) { + [0]=> + array(3) { + [0]=> + int(33) + [1]=> + int(-5) + [2]=> + int(6) + } + [1]=> + array(2) { + [0]=> + int(22) + [1]=> + int(-55) + } + [2]=> + array(1) { + [0]=> + int(11) + } + [3]=> + array(0) { + } +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation9.phpt b/ext/standard/tests/array/rsort_variation9.phpt new file mode 100644 index 0000000..c08791d --- /dev/null +++ b/ext/standard/tests/array/rsort_variation9.phpt @@ -0,0 +1,259 @@ +--TEST-- +Test rsort() function : usage variations - mixed associative arrays +--FILE-- + 55, 6 => 66, 2 => 22, 3 => 33, 1 => 11), + + // two-dimensional assoc. and default key array + array("fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"), + "numbers" => array(1, 2, 3, 4, 5, 6), + "holes" => array("first", 5 => "second", "third")), + + // numeric assoc. and default key array + array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13), + + // mixed assoc. array + array('bar' => 'baz', "foo" => 1), + + // assoc. only multi-dimensional array + array('a' => 1,'b' => array('e' => 2,'f' => 3),'c' => array('g' => 4),'d' => 5), +); + +$count = 1; + +// loop through to test rsort() with different arrays, +// to test the new keys for the elements in the sorted array +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "-- Sort flag = default --\n"; + $temp_array = $array; + var_dump(rsort($temp_array) ); + var_dump($temp_array); + + echo "-- Sort flag = SORT_REGULAR --\n"; + $temp_array = $array; + var_dump(rsort($temp_array, SORT_REGULAR) ); + var_dump($temp_array); + $count++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing rsort() : variation *** + +-- Iteration 1 -- +-- Sort flag = default -- +bool(true) +array(5) { + [0]=> + int(66) + [1]=> + int(55) + [2]=> + int(33) + [3]=> + int(22) + [4]=> + int(11) +} +-- Sort flag = SORT_REGULAR -- +bool(true) +array(5) { + [0]=> + int(66) + [1]=> + int(55) + [2]=> + int(33) + [3]=> + int(22) + [4]=> + int(11) +} + +-- Iteration 2 -- +-- Sort flag = default -- +bool(true) +array(3) { + [0]=> + array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + } + [1]=> + array(3) { + [0]=> + string(5) "first" + [5]=> + string(6) "second" + [6]=> + string(5) "third" + } + [2]=> + array(3) { + ["a"]=> + string(6) "orange" + ["b"]=> + string(6) "banana" + ["c"]=> + string(5) "apple" + } +} +-- Sort flag = SORT_REGULAR -- +bool(true) +array(3) { + [0]=> + array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + } + [1]=> + array(3) { + [0]=> + string(5) "first" + [5]=> + string(6) "second" + [6]=> + string(5) "third" + } + [2]=> + array(3) { + ["a"]=> + string(6) "orange" + ["b"]=> + string(6) "banana" + ["c"]=> + string(5) "apple" + } +} + +-- Iteration 3 -- +-- Sort flag = default -- +bool(true) +array(6) { + [0]=> + int(19) + [1]=> + int(13) + [2]=> + int(1) + [3]=> + int(1) + [4]=> + int(1) + [5]=> + int(1) +} +-- Sort flag = SORT_REGULAR -- +bool(true) +array(6) { + [0]=> + int(19) + [1]=> + int(13) + [2]=> + int(1) + [3]=> + int(1) + [4]=> + int(1) + [5]=> + int(1) +} + +-- Iteration 4 -- +-- Sort flag = default -- +bool(true) +array(2) { + [0]=> + int(1) + [1]=> + string(3) "baz" +} +-- Sort flag = SORT_REGULAR -- +bool(true) +array(2) { + [0]=> + int(1) + [1]=> + string(3) "baz" +} + +-- Iteration 5 -- +-- Sort flag = default -- +bool(true) +array(4) { + [0]=> + array(2) { + ["e"]=> + int(2) + ["f"]=> + int(3) + } + [1]=> + array(1) { + ["g"]=> + int(4) + } + [2]=> + int(5) + [3]=> + int(1) +} +-- Sort flag = SORT_REGULAR -- +bool(true) +array(4) { + [0]=> + array(2) { + ["e"]=> + int(2) + ["f"]=> + int(3) + } + [1]=> + array(1) { + ["g"]=> + int(4) + } + [2]=> + int(5) + [3]=> + int(1) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/shuffle_basic1.phpt b/ext/standard/tests/array/shuffle_basic1.phpt new file mode 100644 index 0000000..d601f54 --- /dev/null +++ b/ext/standard/tests/array/shuffle_basic1.phpt @@ -0,0 +1,150 @@ +--TEST-- +Test shuffle() function : basic functionality - array with default keys +--FILE-- + +--EXPECTF-- +*** Testing shuffle() : with arrays having default keys *** + +-- input array of integers before shuffle() function is applied -- +array(9) { + [0]=> + int(0) + [1]=> + int(10) + [2]=> + int(20) + [3]=> + int(30) + [4]=> + int(40) + [5]=> + int(50) + [6]=> + int(60) + [7]=> + int(70) + [8]=> + int(80) +} + +-- return value from shuffle() function -- +bool(true) + +-- resultant array after shuffle() function is applied -- +array(9) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) +} + +-- input array of strings before shuffle() function is applied -- +array(9) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + [2]=> + string(5) "three" + [3]=> + string(4) "four" + [4]=> + string(4) "five" + [5]=> + string(1) " " + [6]=> + string(3) "six" + [7]=> + string(1) " " + [8]=> + string(5) "seven" +} + +-- return value from shuffle() function -- +bool(true) + +-- resultant array after shuffle() function is applied -- +array(9) { + [0]=> + string(%d) "%s" + [1]=> + string(%d) "%s" + [2]=> + string(%d) "%s" + [3]=> + string(%d) "%s" + [4]=> + string(%d) "%s" + [5]=> + string(%d) "%s" + [6]=> + string(%d) "%s" + [7]=> + string(%d) "%s" + [8]=> + string(%d) "%s" +} +Done + diff --git a/ext/standard/tests/array/shuffle_basic2.phpt b/ext/standard/tests/array/shuffle_basic2.phpt new file mode 100644 index 0000000..cb127d2 --- /dev/null +++ b/ext/standard/tests/array/shuffle_basic2.phpt @@ -0,0 +1,89 @@ +--TEST-- +Test shuffle() function : basic functionality - with associative array +--FILE-- + 1, 2 => 02, 'three' => 3, + 4 => 4, '#5' => 5, 'SIX' => 6, + "seven" => 0x7, "#8" => 012, "nine" => 9 +); + +// printing the input array before the shuffle operation +echo "\n-- input array before shuffle() function is applied --\n"; +var_dump( $array_arg ); + +// applying shuffle() function on the input array +echo "\n-- return value from shuffle() function --\n"; +var_dump( shuffle($array_arg) ); // prints the return value from shuffle() function + +echo "\n-- resultant array after shuffle() function is applied --\n"; +var_dump( $array_arg ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing shuffle() : with associative array *** + +-- input array before shuffle() function is applied -- +array(9) { + ["one"]=> + int(1) + [2]=> + int(2) + ["three"]=> + int(3) + [4]=> + int(4) + ["#5"]=> + int(5) + ["SIX"]=> + int(6) + ["seven"]=> + int(7) + ["#8"]=> + int(10) + ["nine"]=> + int(9) +} + +-- return value from shuffle() function -- +bool(true) + +-- resultant array after shuffle() function is applied -- +array(9) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) +} +Done + diff --git a/ext/standard/tests/array/shuffle_error.phpt b/ext/standard/tests/array/shuffle_error.phpt new file mode 100644 index 0000000..833b390 --- /dev/null +++ b/ext/standard/tests/array/shuffle_error.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test shuffle() function : error conditions +--FILE-- + 2); +$extra_arg = 10; +var_dump( shuffle($array_arg, $extra_arg) ); + +// printing the input array to check that it is not affected +// by above shuffle() function calls +echo "\n-- original input array --\n"; +var_dump( $array_arg ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing shuffle() : error conditions *** + +-- Testing shuffle() function with Zero arguments -- + +Warning: shuffle() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing shuffle() function with more than expected no. of arguments -- + +Warning: shuffle() expects exactly 1 parameter, 2 given in %s on line %d +bool(false) + +-- original input array -- +array(2) { + [0]=> + int(1) + ["two"]=> + int(2) +} +Done + diff --git a/ext/standard/tests/array/shuffle_variation1.phpt b/ext/standard/tests/array/shuffle_variation1.phpt new file mode 100644 index 0000000..dff2182 --- /dev/null +++ b/ext/standard/tests/array/shuffle_variation1.phpt @@ -0,0 +1,214 @@ +--TEST-- +Test shuffle() function : usage variations - unexpected values for 'array_arg' argument +--FILE-- + +--EXPECTF-- +*** Testing shuffle() : with unexpected values for 'array_arg' argument *** + +-- Iteration 1 -- + +Warning: shuffle() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +-- Iteration 2 -- + +Warning: shuffle() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +-- Iteration 3 -- + +Warning: shuffle() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +-- Iteration 4 -- + +Warning: shuffle() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +-- Iteration 5 -- + +Warning: shuffle() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: shuffle() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +-- Iteration 7 -- + +Warning: shuffle() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +-- Iteration 8 -- + +Warning: shuffle() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +-- Iteration 9 -- + +Warning: shuffle() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +-- Iteration 10 -- + +Warning: shuffle() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: shuffle() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: shuffle() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: shuffle() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: shuffle() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +-- Iteration 15 -- + +Warning: shuffle() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +-- Iteration 16 -- + +Warning: shuffle() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +-- Iteration 17 -- + +Warning: shuffle() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +-- Iteration 18 -- + +Warning: shuffle() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +-- Iteration 19 -- + +Warning: shuffle() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +-- Iteration 20 -- + +Warning: shuffle() expects parameter 1 to be array, object given in %s on line %d +bool(false) + +-- Iteration 21 -- + +Warning: shuffle() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +-- Iteration 22 -- + +Warning: shuffle() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +-- Iteration 23 -- + +Warning: shuffle() expects parameter 1 to be array, resource given in %s on line %d +bool(false) +Done + diff --git a/ext/standard/tests/array/shuffle_variation2.phpt b/ext/standard/tests/array/shuffle_variation2.phpt new file mode 100644 index 0000000..a0cb6b6 --- /dev/null +++ b/ext/standard/tests/array/shuffle_variation2.phpt @@ -0,0 +1,212 @@ +--TEST-- +Test shuffle() function : usage variation - with MultiDimensional array +--FILE-- + +--EXPECTF-- +*** Testing shuffle() : with multi-dimensional array *** +bool(true) + +The output array is: +array(7) { + [0]=> + array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + } + [1]=> + array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + } + [2]=> + array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + } + [3]=> + array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + } + [4]=> + array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + } + [5]=> + array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + } + [6]=> + array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + } +} + +*** Testing shuffle() with arrays having different types of values *** + +-- Iteration 1 -- +bool(true) + +The output array is: +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} + +-- Iteration 2 -- +bool(true) + +The output array is: +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} + +-- Iteration 3 -- +bool(true) + +The output array is: +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} + +-- Iteration 4 -- +bool(true) + +The output array is: +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} + +-- Iteration 5 -- +bool(true) + +The output array is: +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} + +-- Iteration 6 -- +bool(true) + +The output array is: +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} + +-- Iteration 7 -- +bool(true) + +The output array is: +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} +Done + diff --git a/ext/standard/tests/array/shuffle_variation3.phpt b/ext/standard/tests/array/shuffle_variation3.phpt new file mode 100644 index 0000000..ad8e668 --- /dev/null +++ b/ext/standard/tests/array/shuffle_variation3.phpt @@ -0,0 +1,233 @@ +--TEST-- +Test shuffle() function : usage variation - arrays with diff types of values +--FILE-- + +--EXPECTF-- +*** Testing shuffle() : arrays with diff types of values *** + +*** Testing shuffle() with arrays having different types of values *** + +-- Iteration 1 -- +bool(true) + +The output array is: +array(4) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) +} + +-- Iteration 2 -- +bool(true) + +The output array is: +array(3) { + [0]=> + int(-%d) + [1]=> + int(-%d) + [2]=> + int(-%d) +} + +-- Iteration 3 -- +bool(true) + +The output array is: +array(7) { + [0]=> + float(%f) + [1]=> + float(%f) + [2]=> + float(%f) + [3]=> + float(%f) + [4]=> + float(%f) + [5]=> + float(%f) + [6]=> + float(%f) +} + +-- Iteration 4 -- +bool(true) + +The output array is: +array(6) { + [0]=> + float(-%f) + [1]=> + float(-%f) + [2]=> + float(-%f) + [3]=> + float(-%f) + [4]=> + float(-%f) + [5]=> + float(-%f) +} + +-- Iteration 5 -- +bool(true) + +The output array is: +array(5) { + [0]=> + string(%d) "%s" + [1]=> + string(%d) "%s" + [2]=> + string(%d) "%s" + [3]=> + string(%d) "%s" + [4]=> + string(%d) "%s" +} + +-- Iteration 6 -- +bool(true) + +The output array is: +array(4) { + [0]=> + bool(%s) + [1]=> + bool(%s) + [2]=> + bool(%s) + [3]=> + bool(%s) +} + +-- Iteration 7 -- +bool(true) + +The output array is: +array(6) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) +} + +-- Iteration 8 -- +bool(true) + +The output array is: +array(5) { + [0]=> + int(-%d) + [1]=> + int(-%d) + [2]=> + int(-%d) + [3]=> + int(-%d) + [4]=> + int(-%d) +} + +-- Iteration 9 -- +bool(true) + +The output array is: +array(4) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) +} + +-- Iteration 10 -- +bool(true) + +The output array is: +array(3) { + [0]=> + int(-%d) + [1]=> + int(-%d) + [2]=> + int(-%d) +} +Done + diff --git a/ext/standard/tests/array/shuffle_variation4.phpt b/ext/standard/tests/array/shuffle_variation4.phpt new file mode 100644 index 0000000..516e7c9 --- /dev/null +++ b/ext/standard/tests/array/shuffle_variation4.phpt @@ -0,0 +1,231 @@ +--TEST-- +Test shuffle() function : usage variation - associative arrays with diff types of values +--FILE-- + 0, 1 => 1, "two" => 2, "max_int" => 2147483647 ), + + // array with negative int values + array("minus_one" => -1, 'minus_two' => -2, "min_int" => -2147483647 ), + + // array with positive float values +/*3*/ array("float1" => 0.23, 'float2' => 1.34, "exp1" => 0e2, 'exp2' => 200e-2, "exp3" => 10e0), + + // array with negative float values + array(-0.23 => -0.23, -1.34 => -1.34, -200e-2 => -200e-2, -30 => -30e0, -2147473649.80), + + // array with single and double quoted strings +/*5*/ array('1' => 'one', "str1" => "123numbers", '' => 'hello\tworld', "" => "hello world\0", "12.34floatnum"), + + // array with bool values + array('1' => TRUE, "1" => TRUE, "0" => FALSE, '0' => FALSE), + + // array with positive hexa values +/*7*/ array("hex1" => 0x123, 'hex2' => 0xabc, "hex\t3" => 0xABC, "hex\04" => 0xAb1), + + // array with negative hexa values + array(NULL => -0x123, "NULL" => -0xabc, "-ABC" => -0xABC, -0xAB1 => -0xAb1), + + // array with positive octal values +/*9*/ array(0123 => 0123, "02348" => 02348, '034' => 034, 00 => 00), + + // array with negative octal values + array(-0123 => -0123, "-02348" => -02348, '-034' => -034), + + // array with null values +/*11*/ array(NULL => NULL, "null" => NULL, "NULL" => NULL) + +); + +// looping to test shuffle() with each sub-array in the $array_arg array +echo "\n*** Testing shuffle() with arrays having different types of values ***\n"; +$counter = 1; +foreach($array_arg as $arr) { + echo "\n-- Iteration $counter --\n"; + var_dump( shuffle($arr) ); + echo "\nThe output array is:\n"; + var_dump( $arr ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing shuffle() : associative arrays with diff types of values *** + +*** Testing shuffle() with arrays having different types of values *** + +-- Iteration 1 -- +bool(true) + +The output array is: +array(4) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) +} + +-- Iteration 2 -- +bool(true) + +The output array is: +array(3) { + [0]=> + int(-%d) + [1]=> + int(-%d) + [2]=> + int(-%d) +} + +-- Iteration 3 -- +bool(true) + +The output array is: +array(5) { + [0]=> + float(%f) + [1]=> + float(%f) + [2]=> + float(%f) + [3]=> + float(%f) + [4]=> + float(%f) +} + +-- Iteration 4 -- +bool(true) + +The output array is: +array(5) { + [0]=> + float(-%f) + [1]=> + float(-%f) + [2]=> + float(-%f) + [3]=> + float(-%f) + [4]=> + float(-%f) +} + +-- Iteration 5 -- +bool(true) + +The output array is: +array(4) { + [0]=> + string(%d) "%s" + [1]=> + string(%d) "%s" + [2]=> + string(%d) "%s" + [3]=> + string(%d) "%s" +} + +-- Iteration 6 -- +bool(true) + +The output array is: +array(2) { + [0]=> + bool(%s) + [1]=> + bool(%s) +} + +-- Iteration 7 -- +bool(true) + +The output array is: +array(4) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) +} + +-- Iteration 8 -- +bool(true) + +The output array is: +array(4) { + [0]=> + int(-%d) + [1]=> + int(-%d) + [2]=> + int(-%d) + [3]=> + int(-%d) +} + +-- Iteration 9 -- +bool(true) + +The output array is: +array(4) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) +} + +-- Iteration 10 -- +bool(true) + +The output array is: +array(3) { + [0]=> + int(-%d) + [1]=> + int(-%d) + [2]=> + int(-%d) +} + +-- Iteration 11 -- +bool(true) + +The output array is: +array(3) { + [0]=> + NULL + [1]=> + NULL + [2]=> + NULL +} +Done + diff --git a/ext/standard/tests/array/shuffle_variation5.phpt b/ext/standard/tests/array/shuffle_variation5.phpt new file mode 100644 index 0000000..ca2c1ac --- /dev/null +++ b/ext/standard/tests/array/shuffle_variation5.phpt @@ -0,0 +1,120 @@ +--TEST-- +Test shuffle() function : usage variation - arrays with diff heredoc strings +--FILE-- + "heredoc1", + $heredoc_with_newline => "heredoc2", + $heredoc_with_characters => "heredoc3", + $heredoc_with_newline_and_tabs => "heredoc3", + $heredoc_with_alphanumerics => "heredoc4", + $heredoc_with_embedded_nulls => "heredoc5" +); + +// test shuffle() with array containing heredoc strings as values +echo "\n-- with array of heredoc strings --\n"; +var_dump( shuffle($heredoc_array) ); +echo "\nThe output array is:\n"; +var_dump( $heredoc_array ); + +// test shuffle() with array containing heredoc strings as its keys +echo "\n-- with array having heredoc strings as keys --\n"; +var_dump( shuffle($heredoc_asso_array) ); +echo "\nThe output array is:\n"; +var_dump( $heredoc_asso_array ); + +echo "Done"; +?> +--EXPECTREGEX-- +\*\*\* Testing shuffle\(\) : with array containing heredoc strings \*\*\* + +-- with array of heredoc strings -- +bool\(true\) + +The output array is: +array\(6\) { + \[0\]=> + string\([0-9]*\) "[0-9 a-z \n \0 \t]*" + \[1\]=> + string\([0-9]*\) "[0-9 a-z \n \0 \t]*" + \[2\]=> + string\([0-9]*\) "[0-9 a-z \n \0 \t]*" + \[3\]=> + string\([0-9]*\) "[0-9 a-z \n \0 \t]*" + \[4\]=> + string\([0-9]*\) "[0-9 a-z \n \0 \t]*" + \[5\]=> + string\([0-9]*\) "[0-9 a-z \n \0 \t]*" +} + +-- with array having heredoc strings as keys -- +bool\(true\) + +The output array is: +array\(6\) { + \[0\]=> + string\(8\) "[heredoc 1-5]*" + \[1\]=> + string\(8\) "[heredoc 1-5]*" + \[2\]=> + string\(8\) "[heredoc 1-5]*" + \[3\]=> + string\(8\) "[heredoc 1-5]*" + \[4\]=> + string\(8\) "[heredoc 1-5]*" + \[5\]=> + string\(8\) "[heredoc 1-5]*" +} +Done + diff --git a/ext/standard/tests/array/sizeof_basic1.phpt b/ext/standard/tests/array/sizeof_basic1.phpt new file mode 100644 index 0000000..dea4a68 --- /dev/null +++ b/ext/standard/tests/array/sizeof_basic1.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test sizeof() function : basic functionality - for scalar types +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : basic functionality *** +-- Testing sizeof() for integer type in default, COUNT_NORMAL and COUNT_RECURSIVE modes -- +default mode: int(1) + +COUNT_NORMAL mode: int(1) + +COUNT_RECURSIVE mode: int(1) + +-- Testing sizeof() for float type in default, COUNT_NORMAL and COUNT_RECURSIVE modes -- +default mode: int(1) + +COUNT_NORMAL mode: int(1) + +COUNT_RECURSIVE mode: int(1) +Done diff --git a/ext/standard/tests/array/sizeof_basic2.phpt b/ext/standard/tests/array/sizeof_basic2.phpt new file mode 100644 index 0000000..a2ab2ee --- /dev/null +++ b/ext/standard/tests/array/sizeof_basic2.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test sizeof() function : basic functionality - for non-scalar type(array) +--FILE-- + "Saffron", "Peace" => "White", "Growth" => "Green"); +$mixed_array = array(1, 2, "Aggression" => "Saffron", 10 => "Ten", "Ten" => 10); + +echo "-- Testing sizeof() with integer array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n"; +echo "default mode: "; +var_dump( sizeof($int_array) ); +echo "\n"; +echo "COUNT_NORMAL mode: "; +var_dump( sizeof($int_array, COUNT_NORMAL) ); +echo "\n"; +echo "COUNT_RECURSIVE mode: "; +var_dump( sizeof($int_array, COUNT_RECURSIVE) ); +echo "\n"; + +echo "-- Testing sizeof() with string array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n"; +echo "default mode: "; +var_dump( sizeof($string_array) ); +echo "\n"; +echo "COUNT_NORMAL mode: "; +var_dump( sizeof($string_array, COUNT_NORMAL) ); +echo "\n"; +echo "COUNT_RECURSIVE mode: "; +var_dump( sizeof($string_array, COUNT_RECURSIVE) ); +echo "\n"; + +echo "-- Testing sizeof() with indexed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n"; +echo "default mode: "; +var_dump( sizeof($indexed_array) ); +echo "\n"; +echo "COUNT_NORMAL mode: "; +var_dump( sizeof($indexed_array, COUNT_NORMAL) ); +echo "\n"; +echo "COUNT_RECURSIVE mode: "; +var_dump( sizeof($indexed_array, COUNT_RECURSIVE) ); +echo "\n"; + +echo "-- Testing sizeof() with mixed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n"; +echo "default mode: "; +var_dump( sizeof($mixed_array) ); +echo "\n"; +echo "COUNT_NORMAL mode: "; +var_dump( sizeof($mixed_array, COUNT_NORMAL) ); +echo "\n"; +echo "COUNT_RECURSIVE mode: "; +var_dump( sizeof($mixed_array, COUNT_RECURSIVE) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing sizeof() : basic functionality *** +-- Testing sizeof() with integer array in default, COUNT_NORMAL, COUNT_RECURSIVE modes -- +default mode: int(4) + +COUNT_NORMAL mode: int(4) + +COUNT_RECURSIVE mode: int(4) + +-- Testing sizeof() with string array in default, COUNT_NORMAL, COUNT_RECURSIVE modes -- +default mode: int(3) + +COUNT_NORMAL mode: int(3) + +COUNT_RECURSIVE mode: int(3) + +-- Testing sizeof() with indexed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes -- +default mode: int(3) + +COUNT_NORMAL mode: int(3) + +COUNT_RECURSIVE mode: int(3) + +-- Testing sizeof() with mixed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes -- +default mode: int(5) + +COUNT_NORMAL mode: int(5) + +COUNT_RECURSIVE mode: int(5) +Done diff --git a/ext/standard/tests/array/sizeof_error.phpt b/ext/standard/tests/array/sizeof_error.phpt new file mode 100644 index 0000000..79a75f3 --- /dev/null +++ b/ext/standard/tests/array/sizeof_error.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test sizeof() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : error conditions *** +-- Testing sizeof() with zero arguments -- + +Warning: sizeof() expects at least 1 parameter, 0 given in %s on line %d +NULL +-- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode -- + +Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d +NULL +-- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode -- + +Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/sizeof_object1.phpt b/ext/standard/tests/array/sizeof_object1.phpt new file mode 100644 index 0000000..4705996 --- /dev/null +++ b/ext/standard/tests/array/sizeof_object1.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test sizeof() function : object functionality - object with Countable interface +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : object functionality *** +-- Testing sizeof() with an object which implements Countable interface -- +-- Testing sizeof() in default mode -- +int(3) +-- Testing sizeof() in COUNT_NORMAL mode -- +int(3) +-- Testing sizeof() in COUNT_RECURSIVE mode -- +int(3) +Done diff --git a/ext/standard/tests/array/sizeof_object2.phpt b/ext/standard/tests/array/sizeof_object2.phpt new file mode 100644 index 0000000..e2c0816 --- /dev/null +++ b/ext/standard/tests/array/sizeof_object2.phpt @@ -0,0 +1,138 @@ +--TEST-- +Test sizeof() function : object functionality - objects without Countable interface +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : object functionality *** +--- Testing sizeof() with objects which doesn't implement Countable interface --- +-- Iteration 1 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 2 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 3 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 4 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 5 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +Done diff --git a/ext/standard/tests/array/sizeof_variation1.phpt b/ext/standard/tests/array/sizeof_variation1.phpt new file mode 100644 index 0000000..328645f --- /dev/null +++ b/ext/standard/tests/array/sizeof_variation1.phpt @@ -0,0 +1,215 @@ +--TEST-- +Test sizeof() function : usage variations - for all scalar types and resource variable +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : usage variations *** +--- Testing sizeof() for all scalar types in default,COUNT_NORMAL and COUNT_RECURSIVE mode --- +-- Iteration 1 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 2 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 3 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 4 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 5 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 6 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 7 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 8 -- +Default Mode: int(0) + +COUNT_NORMAL Mode: int(0) + +COUNT_RECURSIVE Mode: int(0) + +-- Iteration 9 -- +Default Mode: int(0) + +COUNT_NORMAL Mode: int(0) + +COUNT_RECURSIVE Mode: int(0) + +-- Iteration 10 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 11 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 12 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 13 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 14 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 15 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 16 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 17 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 18 -- +Default Mode: int(0) + +COUNT_NORMAL Mode: int(0) + +COUNT_RECURSIVE Mode: int(0) + +-- Iteration 19 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +Done diff --git a/ext/standard/tests/array/sizeof_variation2.phpt b/ext/standard/tests/array/sizeof_variation2.phpt new file mode 100644 index 0000000..a224579 --- /dev/null +++ b/ext/standard/tests/array/sizeof_variation2.phpt @@ -0,0 +1,163 @@ +--TEST-- +Test sizeof() function : usage variations - different array values for 'var' argument +--FILE-- + $fp), + array(1, array(3, 4, array(6, array(8)))), + array("a" => 1, 'b' => 2, array( "c" =>3, array( "d" => 5))), + array(), + /* 5 */ array(1, 2, 3, 4), + array("Saffron", "White", "Green"), + array('saffron', 'white', 'green'), + array(1 => "Hi", 2 => "Hello" ), + array("color" => "red", "item" => "pen"), + /* 10 */ array('color' => 'red', 'item' => 'pen'), + array(TRUE => "red", FALSE => "pen" ), + array(false => 'red', true => 'pen' ), + array('color' => "red", "item" => 'pen', 1 => "Hi", "" => "Hello" ), + /* 14 */ array($fp, "resource1" => $fp, 'resource2' => $fp, array( $fp, 'type' => $fp) ) +); + +// loop through each element of the values array for 'var' argument +// check the working of sizeof() +$counter = 1; +for($i = 0; $i < count($values); $i++) +{ + echo "-- Iteration $counter --\n"; + $var = $values[$i]; + + echo "Default Mode: "; + var_dump( sizeof($var) ); + echo "\n"; + + echo "COUNT_NORMAL Mode: "; + var_dump( sizeof($var, COUNT_NORMAL) ); + echo "\n"; + + echo "COUNT_RECURSIVE Mode: "; + var_dump( sizeof($var, COUNT_RECURSIVE) ); + echo "\n"; + + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing sizeof() : usage variations *** +--- Testing sizeof() with different array values for 'var' argument --- +-- Iteration 1 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 2 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(8) + +-- Iteration 3 -- +Default Mode: int(3) + +COUNT_NORMAL Mode: int(3) + +COUNT_RECURSIVE Mode: int(6) + +-- Iteration 4 -- +Default Mode: int(0) + +COUNT_NORMAL Mode: int(0) + +COUNT_RECURSIVE Mode: int(0) + +-- Iteration 5 -- +Default Mode: int(4) + +COUNT_NORMAL Mode: int(4) + +COUNT_RECURSIVE Mode: int(4) + +-- Iteration 6 -- +Default Mode: int(3) + +COUNT_NORMAL Mode: int(3) + +COUNT_RECURSIVE Mode: int(3) + +-- Iteration 7 -- +Default Mode: int(3) + +COUNT_NORMAL Mode: int(3) + +COUNT_RECURSIVE Mode: int(3) + +-- Iteration 8 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 9 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 10 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 11 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 12 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 13 -- +Default Mode: int(4) + +COUNT_NORMAL Mode: int(4) + +COUNT_RECURSIVE Mode: int(4) + +-- Iteration 14 -- +Default Mode: int(4) + +COUNT_NORMAL Mode: int(4) + +COUNT_RECURSIVE Mode: int(6) + +Done diff --git a/ext/standard/tests/array/sizeof_variation3.phpt b/ext/standard/tests/array/sizeof_variation3.phpt new file mode 100644 index 0000000..ba8afb8 --- /dev/null +++ b/ext/standard/tests/array/sizeof_variation3.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test sizeof() function : usage variations - checking for infinite recursion in COUNT_RECURSIVE mode +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : usage variations *** +-- Testing sizeof() for infinite recursion with arrays as argument in COUNT_RECURSIVE mode -- +int(13) + +int(2) +Done diff --git a/ext/standard/tests/array/sizeof_variation4.phpt b/ext/standard/tests/array/sizeof_variation4.phpt new file mode 100644 index 0000000..a246275 --- /dev/null +++ b/ext/standard/tests/array/sizeof_variation4.phpt @@ -0,0 +1,350 @@ +--TEST-- +Test sizeof() function : usage variations - all kinds of unset variables for 'var' argument +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : usage variations *** +--- Testing sizeof() for all kinds of unset variables in default, Normal and Recursive Modes --- +-- Iteration 1 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 2 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 3 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 4 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 5 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 6 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 7 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 8 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 9 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 10 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 11 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 12 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 13 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 14 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 15 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 16 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 17 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 18 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 19 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 20 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +Done diff --git a/ext/standard/tests/array/sizeof_variation5.phpt b/ext/standard/tests/array/sizeof_variation5.phpt new file mode 100644 index 0000000..6e40f7e --- /dev/null +++ b/ext/standard/tests/array/sizeof_variation5.phpt @@ -0,0 +1,132 @@ +--TEST-- +Test sizeof() function : usage variations - different values for 'mode' argument +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : usage variations *** +--- Testing sizeof() with different values for 'mode' argument --- +-- Iteration 1 -- +int(6) +-- Iteration 2 -- +int(9) +-- Iteration 3 -- +int(6) +-- Iteration 4 -- +int(9) +-- Iteration 5 -- +int(9) +-- Iteration 6 -- +int(9) +-- Iteration 7 -- +int(6) +-- Iteration 8 -- +int(6) +-- Iteration 9 -- +int(6) +-- Iteration 10 -- +int(6) +-- Iteration 11 -- +int(6) +-- Iteration 12 -- +int(6) +-- Iteration 13 -- +int(6) +-- Iteration 14 -- +int(6) +-- Iteration 15 -- +int(6) +-- Iteration 16 -- + +Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 20 -- +int(6) +-- Iteration 21 -- + +Warning: sizeof() expects parameter 2 to be long, object given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: sizeof() expects parameter 2 to be long, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/sort_basic.phpt b/ext/standard/tests/array/sort_basic.phpt new file mode 100644 index 0000000..460b572 --- /dev/null +++ b/ext/standard/tests/array/sort_basic.phpt @@ -0,0 +1,246 @@ +--TEST-- +Test sort() function : basic functionality +--FILE-- + "lemon", "o" => "orange", + "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20", + "b" => "banana", +); + +// array with default keys containing unsorted numeric values +$unsorted_numerics = array( 100, 33, 555, 22 ); + +echo "\n-- Testing sort() by supplying string array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_strings; +var_dump( sort($temp_array) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing sort() by supplying numeric array, 'flag' value is defualt --\n"; +$temp_array = $unsorted_numerics; +var_dump( sort($temp_array) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing sort() by supplying string array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $unsorted_strings; +var_dump( sort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing sort() by supplying numeric array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $unsorted_numerics; +var_dump( sort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing sort() by supplying string array, 'flag' = SORT_STRING --\n"; +$temp_array = $unsorted_strings; +var_dump( sort($temp_array, SORT_STRING) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing sort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE --\n"; +$temp_array = $unsorted_strings; +var_dump( sort($temp_array, SORT_STRING|SORT_FLAG_CASE) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing sort() by supplying string array (natural), 'flag' = SORT_NATURAL --\n"; +$temp_array = $unsorted_strings; +var_dump( sort($temp_array, SORT_NATURAL) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing sort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE --\n"; +$temp_array = $unsorted_strings; +var_dump( sort($temp_array, SORT_NATURAL|SORT_FLAG_CASE) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing sort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n"; +$temp_array = $unsorted_numerics; +var_dump( sort($temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing sort() : basic functionality *** + +-- Testing sort() by supplying string array, 'flag' value is defualt -- +bool(true) +array(8) { + [0]=> + string(6) "Orange" + [1]=> + string(7) "Orange1" + [2]=> + string(7) "Orange3" + [3]=> + string(6) "banana" + [4]=> + string(5) "lemon" + [5]=> + string(6) "orange" + [6]=> + string(7) "orange2" + [7]=> + string(8) "orange20" +} + +-- Testing sort() by supplying numeric array, 'flag' value is defualt -- +bool(true) +array(4) { + [0]=> + int(22) + [1]=> + int(33) + [2]=> + int(100) + [3]=> + int(555) +} + +-- Testing sort() by supplying string array, 'flag' = SORT_REGULAR -- +bool(true) +array(8) { + [0]=> + string(6) "Orange" + [1]=> + string(7) "Orange1" + [2]=> + string(7) "Orange3" + [3]=> + string(6) "banana" + [4]=> + string(5) "lemon" + [5]=> + string(6) "orange" + [6]=> + string(7) "orange2" + [7]=> + string(8) "orange20" +} + +-- Testing sort() by supplying numeric array, 'flag' = SORT_REGULAR -- +bool(true) +array(4) { + [0]=> + int(22) + [1]=> + int(33) + [2]=> + int(100) + [3]=> + int(555) +} + +-- Testing sort() by supplying string array, 'flag' = SORT_STRING -- +bool(true) +array(8) { + [0]=> + string(6) "Orange" + [1]=> + string(7) "Orange1" + [2]=> + string(7) "Orange3" + [3]=> + string(6) "banana" + [4]=> + string(5) "lemon" + [5]=> + string(6) "orange" + [6]=> + string(7) "orange2" + [7]=> + string(8) "orange20" +} + +-- Testing sort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE -- +bool(true) +array(8) { + [0]=> + string(6) "banana" + [1]=> + string(5) "lemon" + [2]=> + string(6) "orange" + [3]=> + string(6) "Orange" + [4]=> + string(7) "Orange1" + [5]=> + string(7) "orange2" + [6]=> + string(8) "orange20" + [7]=> + string(7) "Orange3" +} + +-- Testing sort() by supplying string array (natural), 'flag' = SORT_NATURAL -- +bool(true) +array(8) { + [0]=> + string(6) "Orange" + [1]=> + string(7) "Orange1" + [2]=> + string(7) "Orange3" + [3]=> + string(6) "banana" + [4]=> + string(5) "lemon" + [5]=> + string(6) "orange" + [6]=> + string(7) "orange2" + [7]=> + string(8) "orange20" +} + +-- Testing sort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE -- +bool(true) +array(8) { + [0]=> + string(6) "banana" + [1]=> + string(5) "lemon" + [2]=> + string(6) "orange" + [3]=> + string(6) "Orange" + [4]=> + string(7) "Orange1" + [5]=> + string(7) "orange2" + [6]=> + string(7) "Orange3" + [7]=> + string(8) "orange20" +} + +-- Testing sort() by supplying numeric array, 'flag' = SORT_NUMERIC -- +bool(true) +array(4) { + [0]=> + int(22) + [1]=> + int(33) + [2]=> + int(100) + [3]=> + int(555) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/sort_error.phpt b/ext/standard/tests/array/sort_error.phpt new file mode 100644 index 0000000..4864ef3 --- /dev/null +++ b/ext/standard/tests/array/sort_error.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test sort() function : error conditions +--FILE-- + SORT_REGULAR, "SORT_STRING" => SORT_STRING, "SORT_NUMERIC" => SORT_NUMERIC); +$extra_arg = 10; + +// loop through $flag_value array and setting all possible flag values +foreach($flag_value as $key => $flag){ + echo "\nSort flag = $key\n"; + var_dump( sort($array_arg,$flag, $extra_arg) ); + + // dump the input array to ensure that it wasn't changed + var_dump($array_arg); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing sort() : error conditions *** + +-- Testing sort() function with Zero arguments -- + +Warning: sort() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing sort() function with more than expected no. of arguments -- + +Sort flag = SORT_REGULAR + +Warning: sort() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + +Sort flag = SORT_STRING + +Warning: sort() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + +Sort flag = SORT_NUMERIC + +Warning: sort() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +Done diff --git a/ext/standard/tests/array/sort_object1.phpt b/ext/standard/tests/array/sort_object1.phpt new file mode 100644 index 0000000..caa9c8d --- /dev/null +++ b/ext/standard/tests/array/sort_object1.phpt @@ -0,0 +1,242 @@ +--TEST-- +Test sort() function : object functionality - sorting objects, 'sort_flags' as default/SORT_REGULAR +--FILE-- +class_value = $value; + } + +} + +// class declaration for string objects +class for_string_sort +{ + public $class_value; + // initializing object member value + function __construct($value){ + $this->class_value = $value; + } + + // return string value + function __tostring() { + return (string)$this->value; + } + +} + +// array of integer objects +$unsorted_int_obj = array( + new for_integer_sort(11), new for_integer_sort(66), + new for_integer_sort(23), new for_integer_sort(-5), + new for_integer_sort(0.001), new for_integer_sort(0) +); + +// array of string objects +$unsorted_str_obj = array ( + new for_string_sort("axx"), new for_string_sort("t"), + new for_string_sort("w"), new for_string_sort("py"), + new for_string_sort("apple"), new for_string_sort("Orange"), + new for_string_sort("Lemon"), new for_string_sort("aPPle") +); + + +echo "\n-- Testing sort() by supplying various object arrays, 'flag' value is defualt --\n"; + +// testing sort() function by supplying integer object array, flag value is defualt +$temp_array = $unsorted_int_obj; +var_dump(sort($temp_array) ); +var_dump($temp_array); + +// testing sort() function by supplying string object array, flag value is defualt +$temp_array = $unsorted_str_obj; +var_dump(sort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Testing sort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n"; +// testing sort() function by supplying integer object array, flag value = SORT_REGULAR +$temp_array = $unsorted_int_obj; +var_dump(sort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +// testing sort() function by supplying string object array, flag value = SORT_REGULAR +$temp_array = $unsorted_str_obj; +var_dump(sort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing sort() : object functionality *** + +-- Testing sort() by supplying various object arrays, 'flag' value is defualt -- +bool(true) +array(6) { + [0]=> + object(for_integer_sort)#%d (1) { + ["class_value"]=> + int(-5) + } + [1]=> + object(for_integer_sort)#%d (1) { + ["class_value"]=> + int(0) + } + [2]=> + object(for_integer_sort)#%d (1) { + ["class_value"]=> + float(0.001) + } + [3]=> + object(for_integer_sort)#%d (1) { + ["class_value"]=> + int(11) + } + [4]=> + object(for_integer_sort)#%d (1) { + ["class_value"]=> + int(23) + } + [5]=> + object(for_integer_sort)#%d (1) { + ["class_value"]=> + int(66) + } +} +bool(true) +array(8) { + [0]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(5) "Lemon" + } + [1]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(6) "Orange" + } + [2]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(5) "aPPle" + } + [3]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(5) "apple" + } + [4]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(3) "axx" + } + [5]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(2) "py" + } + [6]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(1) "t" + } + [7]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(1) "w" + } +} + +-- Testing sort() by supplying various object arrays, 'flag' value is SORT_REGULAR -- +bool(true) +array(6) { + [0]=> + object(for_integer_sort)#%d (1) { + ["class_value"]=> + int(-5) + } + [1]=> + object(for_integer_sort)#%d (1) { + ["class_value"]=> + int(0) + } + [2]=> + object(for_integer_sort)#%d (1) { + ["class_value"]=> + float(0.001) + } + [3]=> + object(for_integer_sort)#%d (1) { + ["class_value"]=> + int(11) + } + [4]=> + object(for_integer_sort)#%d (1) { + ["class_value"]=> + int(23) + } + [5]=> + object(for_integer_sort)#%d (1) { + ["class_value"]=> + int(66) + } +} +bool(true) +array(8) { + [0]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(5) "Lemon" + } + [1]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(6) "Orange" + } + [2]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(5) "aPPle" + } + [3]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(5) "apple" + } + [4]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(3) "axx" + } + [5]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(2) "py" + } + [6]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(1) "t" + } + [7]=> + object(for_string_sort)#%d (1) { + ["class_value"]=> + string(1) "w" + } +} +Done diff --git a/ext/standard/tests/array/sort_object2.phpt b/ext/standard/tests/array/sort_object2.phpt new file mode 100644 index 0000000..93b0fa2 --- /dev/null +++ b/ext/standard/tests/array/sort_object2.phpt @@ -0,0 +1,256 @@ +--TEST-- +Test sort() function : object functionality - sorting objects with diff. accessibility of member vars +--FILE-- +public_class_value = $value1; + $this->private_class_value = $value2; + $this->protected_class_value = $value3; + } +} + +// class declaration for string objects +class for_string_sort +{ + public $public_class_value; + private $private_class_value; + protected $protected_class_value; + // initializing object member value + function __construct($value1, $value2,$value3){ + $this->public_class_value = $value1; + $this->private_class_value = $value2; + $this->protected_class_value = $value3; + } + + // return string value + function __tostring() { + return (string)$this->value; + } + +} + +// array of integer objects +$unsorted_int_obj = array( + new for_integer_sort(11,33,30), + new for_integer_sort(66,44,4), + new for_integer_sort(-88,-5,5), + new for_integer_sort(0.001,99.5,0.1) +); + +// array of string objects +$unsorted_str_obj = array ( + new for_string_sort("axx","AXX","ass"), + new for_string_sort("t","eee","abb"), + new for_string_sort("w","W", "c"), + new for_string_sort("py","PY", "pt"), +); + + +echo "\n-- Testing sort() by supplying various object arrays, 'flag' value is defualt --\n"; + +// testing sort() function by supplying integer object array, flag value is defualt +$temp_array = $unsorted_int_obj; +var_dump(sort($temp_array) ); +var_dump($temp_array); + +// testing sort() function by supplying string object array, flag value is defualt +$temp_array = $unsorted_str_obj; +var_dump(sort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Testing sort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n"; +// testing sort() function by supplying integer object array, flag value = SORT_REGULAR +$temp_array = $unsorted_int_obj; +var_dump(sort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +// testing sort() function by supplying string object array, flag value = SORT_REGULAR +$temp_array = $unsorted_str_obj; +var_dump(sort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing sort() : object functionality *** + +-- Testing sort() by supplying various object arrays, 'flag' value is defualt -- +bool(true) +array(4) { + [0]=> + object(for_integer_sort)#%d (3) { + ["public_class_value"]=> + int(-88) + ["private_class_value":"for_integer_sort":private]=> + int(-5) + ["protected_class_value":protected]=> + int(5) + } + [1]=> + object(for_integer_sort)#%d (3) { + ["public_class_value"]=> + float(0.001) + ["private_class_value":"for_integer_sort":private]=> + float(99.5) + ["protected_class_value":protected]=> + float(0.1) + } + [2]=> + object(for_integer_sort)#%d (3) { + ["public_class_value"]=> + int(11) + ["private_class_value":"for_integer_sort":private]=> + int(33) + ["protected_class_value":protected]=> + int(30) + } + [3]=> + object(for_integer_sort)#%d (3) { + ["public_class_value"]=> + int(66) + ["private_class_value":"for_integer_sort":private]=> + int(44) + ["protected_class_value":protected]=> + int(4) + } +} +bool(true) +array(4) { + [0]=> + object(for_string_sort)#%d (3) { + ["public_class_value"]=> + string(3) "axx" + ["private_class_value":"for_string_sort":private]=> + string(3) "AXX" + ["protected_class_value":protected]=> + string(3) "ass" + } + [1]=> + object(for_string_sort)#%d (3) { + ["public_class_value"]=> + string(2) "py" + ["private_class_value":"for_string_sort":private]=> + string(2) "PY" + ["protected_class_value":protected]=> + string(2) "pt" + } + [2]=> + object(for_string_sort)#%d (3) { + ["public_class_value"]=> + string(1) "t" + ["private_class_value":"for_string_sort":private]=> + string(3) "eee" + ["protected_class_value":protected]=> + string(3) "abb" + } + [3]=> + object(for_string_sort)#%d (3) { + ["public_class_value"]=> + string(1) "w" + ["private_class_value":"for_string_sort":private]=> + string(1) "W" + ["protected_class_value":protected]=> + string(1) "c" + } +} + +-- Testing sort() by supplying various object arrays, 'flag' value is SORT_REGULAR -- +bool(true) +array(4) { + [0]=> + object(for_integer_sort)#%d (3) { + ["public_class_value"]=> + int(-88) + ["private_class_value":"for_integer_sort":private]=> + int(-5) + ["protected_class_value":protected]=> + int(5) + } + [1]=> + object(for_integer_sort)#%d (3) { + ["public_class_value"]=> + float(0.001) + ["private_class_value":"for_integer_sort":private]=> + float(99.5) + ["protected_class_value":protected]=> + float(0.1) + } + [2]=> + object(for_integer_sort)#%d (3) { + ["public_class_value"]=> + int(11) + ["private_class_value":"for_integer_sort":private]=> + int(33) + ["protected_class_value":protected]=> + int(30) + } + [3]=> + object(for_integer_sort)#%d (3) { + ["public_class_value"]=> + int(66) + ["private_class_value":"for_integer_sort":private]=> + int(44) + ["protected_class_value":protected]=> + int(4) + } +} +bool(true) +array(4) { + [0]=> + object(for_string_sort)#%d (3) { + ["public_class_value"]=> + string(3) "axx" + ["private_class_value":"for_string_sort":private]=> + string(3) "AXX" + ["protected_class_value":protected]=> + string(3) "ass" + } + [1]=> + object(for_string_sort)#%d (3) { + ["public_class_value"]=> + string(2) "py" + ["private_class_value":"for_string_sort":private]=> + string(2) "PY" + ["protected_class_value":protected]=> + string(2) "pt" + } + [2]=> + object(for_string_sort)#%d (3) { + ["public_class_value"]=> + string(1) "t" + ["private_class_value":"for_string_sort":private]=> + string(3) "eee" + ["protected_class_value":protected]=> + string(3) "abb" + } + [3]=> + object(for_string_sort)#%d (3) { + ["public_class_value"]=> + string(1) "w" + ["private_class_value":"for_string_sort":private]=> + string(1) "W" + ["protected_class_value":protected]=> + string(1) "c" + } +} +Done diff --git a/ext/standard/tests/array/sort_variation1.phpt b/ext/standard/tests/array/sort_variation1.phpt new file mode 100644 index 0000000..f6991bd --- /dev/null +++ b/ext/standard/tests/array/sort_variation1.phpt @@ -0,0 +1,398 @@ +--TEST-- +Test sort() function : usage variations - unexpected values for 'array_arg' argument +--FILE-- + +--EXPECTF-- +*** Testing sort() : usage variations *** + +-- Testing sort() by supplying different unexpected values for 'array' argument -- + +-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING -- +-- Iteration 1 -- + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 2 -- + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 3 -- + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, integer given in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 7 -- + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 8 -- + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 9 -- + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, double given in %s on line %d +bool(false) +-- Iteration 10 -- + +Warning: sort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +-- Iteration 11 -- + +Warning: sort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, null given in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 14 -- + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 15 -- + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) +-- Iteration 16 -- + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 17 -- + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 18 -- + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 19 -- + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 20 -- + +Warning: sort() expects parameter 1 to be array, object given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, object given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, object given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, object given in %s on line %d +bool(false) +-- Iteration 21 -- + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 22 -- + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, string given in %s on line %d +bool(false) +-- Iteration 23 -- + +Warning: sort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) + +Warning: sort() expects parameter 1 to be array, resource given in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/array/sort_variation10.phpt b/ext/standard/tests/array/sort_variation10.phpt new file mode 100644 index 0000000..0a5a580 --- /dev/null +++ b/ext/standard/tests/array/sort_variation10.phpt @@ -0,0 +1,112 @@ +--TEST-- +Test sort() function : usage variations - sort octal values +--FILE-- + +--EXPECTF-- +*** Testing sort() : usage variations *** + +-- Testing sort() by supplying octal value array, 'flag' value is defualt -- +bool(true) +array(9) { + [0]=> + int(-229) + [1]=> + int(-54) + [2]=> + int(0) + [3]=> + int(54) + [4]=> + int(63) + [5]=> + int(209) + [6]=> + int(229) + [7]=> + int(506) + [8]=> + int(669) +} + +-- Testing sort() by supplying octal value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(9) { + [0]=> + int(-229) + [1]=> + int(-54) + [2]=> + int(0) + [3]=> + int(54) + [4]=> + int(63) + [5]=> + int(209) + [6]=> + int(229) + [7]=> + int(506) + [8]=> + int(669) +} + +-- Testing sort() by supplying octal value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(9) { + [0]=> + int(-229) + [1]=> + int(-54) + [2]=> + int(0) + [3]=> + int(54) + [4]=> + int(63) + [5]=> + int(209) + [6]=> + int(229) + [7]=> + int(506) + [8]=> + int(669) +} +Done diff --git a/ext/standard/tests/array/sort_variation11.phpt b/ext/standard/tests/array/sort_variation11.phpt new file mode 100644 index 0000000..56583d2 Binary files /dev/null and b/ext/standard/tests/array/sort_variation11.phpt differ diff --git a/ext/standard/tests/array/sort_variation2.phpt b/ext/standard/tests/array/sort_variation2.phpt new file mode 100644 index 0000000..7cb8ed6 --- /dev/null +++ b/ext/standard/tests/array/sort_variation2.phpt @@ -0,0 +1,311 @@ +--TEST-- +Test sort() function : usage variations - unexpected values for 'sort_flags' argument +--FILE-- + +--EXPECTF-- +*** Testing sort() : usage variations *** + +-- Testing sort() by supplying different unexpected values for 'flag' argument -- +-- Iteration 1 -- +bool(true) +array(3) { + [0]=> + int(2) + [1]=> + int(10) + [2]=> + int(45) +} +-- Iteration 2 -- +bool(true) +array(3) { + [0]=> + int(10) + [1]=> + int(2) + [2]=> + int(45) +} +-- Iteration 3 -- +bool(true) +array(3) { + [0]=> + int(2) + [1]=> + int(10) + [2]=> + int(45) +} +-- Iteration 4 -- +bool(true) +array(3) { + [0]=> + int(2) + [1]=> + int(10) + [2]=> + int(45) +} +-- Iteration 5 -- +bool(true) +array(3) { + [0]=> + int(2) + [1]=> + int(10) + [2]=> + int(45) +} +-- Iteration 6 -- +bool(true) +array(3) { + [0]=> + int(2) + [1]=> + int(10) + [2]=> + int(45) +} +-- Iteration 7 -- +bool(true) +array(3) { + [0]=> + int(2) + [1]=> + int(10) + [2]=> + int(45) +} +-- Iteration 8 -- +bool(true) +array(3) { + [0]=> + int(2) + [1]=> + int(10) + [2]=> + int(45) +} +-- Iteration 9 -- +bool(true) +array(3) { + [0]=> + int(2) + [1]=> + int(10) + [2]=> + int(45) +} +-- Iteration 10 -- +bool(true) +array(3) { + [0]=> + int(2) + [1]=> + int(10) + [2]=> + int(45) +} +-- Iteration 11 -- +bool(true) +array(3) { + [0]=> + int(2) + [1]=> + int(10) + [2]=> + int(45) +} +-- Iteration 12 -- +bool(true) +array(3) { + [0]=> + int(2) + [1]=> + int(10) + [2]=> + int(45) +} +-- Iteration 13 -- + +Warning: sort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [0]=> + int(10) + [1]=> + int(2) + [2]=> + int(45) +} +-- Iteration 14 -- + +Warning: sort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [0]=> + int(10) + [1]=> + int(2) + [2]=> + int(45) +} +-- Iteration 15 -- + +Warning: sort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [0]=> + int(10) + [1]=> + int(2) + [2]=> + int(45) +} +-- Iteration 16 -- + +Warning: sort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [0]=> + int(10) + [1]=> + int(2) + [2]=> + int(45) +} +-- Iteration 17 -- + +Warning: sort() expects parameter 2 to be long, object given in %s on line %d +bool(false) +array(3) { + [0]=> + int(10) + [1]=> + int(2) + [2]=> + int(45) +} +-- Iteration 18 -- + +Warning: sort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [0]=> + int(10) + [1]=> + int(2) + [2]=> + int(45) +} +-- Iteration 19 -- + +Warning: sort() expects parameter 2 to be long, string given in %s on line %d +bool(false) +array(3) { + [0]=> + int(10) + [1]=> + int(2) + [2]=> + int(45) +} +-- Iteration 20 -- + +Warning: sort() expects parameter 2 to be long, resource given in %s on line %d +bool(false) +array(3) { + [0]=> + int(10) + [1]=> + int(2) + [2]=> + int(45) +} +Done diff --git a/ext/standard/tests/array/sort_variation3.phpt b/ext/standard/tests/array/sort_variation3.phpt new file mode 100644 index 0000000..1ad058d --- /dev/null +++ b/ext/standard/tests/array/sort_variation3.phpt @@ -0,0 +1,328 @@ +--TEST-- +Test sort() function : usage variations - sort integer/float values +--FILE-- + SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC); + +$count = 1; +echo "\n-- Testing sort() by supplying various integer/float arrays --\n"; + +// loop through to test sort() with different arrays +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With Defualt sort flag -\n"; + $temp_array = $array; + var_dump(sort($temp_array) ); + var_dump($temp_array); + + // loop through $flag_value array and setting all possible flag values + foreach($flag_value as $key => $flag){ + echo "- Sort flag = $key -\n"; + $temp_array = $array; + var_dump(sort($temp_array, $flag) ); + var_dump($temp_array); + } + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing sort() : usage variations *** + +-- Testing sort() by supplying various integer/float arrays -- + +-- Iteration 1 -- +- With Defualt sort flag - +bool(true) +array(9) { + [0]=> + int(-41) + [1]=> + int(-31) + [2]=> + int(-21) + [3]=> + int(-11) + [4]=> + int(0) + [5]=> + int(11) + [6]=> + int(21) + [7]=> + int(31) + [8]=> + int(41) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(9) { + [0]=> + int(-41) + [1]=> + int(-31) + [2]=> + int(-21) + [3]=> + int(-11) + [4]=> + int(0) + [5]=> + int(11) + [6]=> + int(21) + [7]=> + int(31) + [8]=> + int(41) +} +- Sort flag = SORT_NUMERIC - +bool(true) +array(9) { + [0]=> + int(-41) + [1]=> + int(-31) + [2]=> + int(-21) + [3]=> + int(-11) + [4]=> + int(0) + [5]=> + int(11) + [6]=> + int(21) + [7]=> + int(31) + [8]=> + int(41) +} + +-- Iteration 2 -- +- With Defualt sort flag - +bool(true) +array(7) { + [0]=> + float(-10.5) + [1]=> + float(-0.1) + [2]=> + float(0.01) + [3]=> + float(0.106) + [4]=> + float(0.5) + [5]=> + float(10.5) + [6]=> + float(1050) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(7) { + [0]=> + float(-10.5) + [1]=> + float(-0.1) + [2]=> + float(0.01) + [3]=> + float(0.106) + [4]=> + float(0.5) + [5]=> + float(10.5) + [6]=> + float(1050) +} +- Sort flag = SORT_NUMERIC - +bool(true) +array(7) { + [0]=> + float(-10.5) + [1]=> + float(-0.1) + [2]=> + float(0.01) + [3]=> + float(0.106) + [4]=> + float(0.5) + [5]=> + float(10.5) + [6]=> + float(1050) +} + +-- Iteration 3 -- +- With Defualt sort flag - +bool(true) +array(11) { + [0]=> + int(-1) + [1]=> + float(-0.9) + [2]=> + float(-0.106) + [3]=> + float(-0.01) + [4]=> + int(0) + [5]=> + float(0.0001) + [6]=> + float(0.0021) + [7]=> + float(0.09) + [8]=> + float(0.106) + [9]=> + int(2) + [10]=> + int(33) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(11) { + [0]=> + int(-1) + [1]=> + float(-0.9) + [2]=> + float(-0.106) + [3]=> + float(-0.01) + [4]=> + int(0) + [5]=> + float(0.0001) + [6]=> + float(0.0021) + [7]=> + float(0.09) + [8]=> + float(0.106) + [9]=> + int(2) + [10]=> + int(33) +} +- Sort flag = SORT_NUMERIC - +bool(true) +array(11) { + [0]=> + int(-1) + [1]=> + float(-0.9) + [2]=> + float(-0.106) + [3]=> + float(-0.01) + [4]=> + int(0) + [5]=> + float(0.0001) + [6]=> + float(0.0021) + [7]=> + float(0.09) + [8]=> + float(0.106) + [9]=> + int(2) + [10]=> + int(33) +} + +-- Iteration 4 -- +- With Defualt sort flag - +bool(true) +array(7) { + [0]=> + %s(-2147483649) + [1]=> + %s(-2147483648) + [2]=> + int(-2147483647) + [3]=> + int(0) + [4]=> + int(0) + [5]=> + int(2147483647) + [6]=> + %s(2147483648) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(7) { + [0]=> + %s(-2147483649) + [1]=> + %s(-2147483648) + [2]=> + int(-2147483647) + [3]=> + int(0) + [4]=> + int(0) + [5]=> + int(2147483647) + [6]=> + %s(2147483648) +} +- Sort flag = SORT_NUMERIC - +bool(true) +array(7) { + [0]=> + %s(-2147483649) + [1]=> + %s(-2147483648) + [2]=> + int(-2147483647) + [3]=> + int(0) + [4]=> + int(0) + [5]=> + int(2147483647) + [6]=> + %s(2147483648) +} +Done diff --git a/ext/standard/tests/array/sort_variation4.phpt b/ext/standard/tests/array/sort_variation4.phpt new file mode 100644 index 0000000..82e3d97 --- /dev/null +++ b/ext/standard/tests/array/sort_variation4.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test sort() function : usage variations - sort reference values +--FILE-- + +--EXPECTF-- +*** Testing sort() :usage variations *** + +-- Testing sort() by supplying reference variable array, 'flag' value is defualt -- +bool(true) +array(3) { + [0]=> + &int(33) + [1]=> + &int(100) + [2]=> + &int(555) +} + +-- Testing sort() by supplying reference variable array, 'flag' = SORT_REGULAR -- +bool(true) +array(3) { + [0]=> + &int(33) + [1]=> + &int(100) + [2]=> + &int(555) +} + +-- Testing sort() by supplying reference variable array, 'flag' = SORT_NUMERIC -- +bool(true) +array(3) { + [0]=> + &int(33) + [1]=> + &int(100) + [2]=> + &int(555) +} +Done diff --git a/ext/standard/tests/array/sort_variation5.phpt b/ext/standard/tests/array/sort_variation5.phpt new file mode 100644 index 0000000..a06c22c --- /dev/null +++ b/ext/standard/tests/array/sort_variation5.phpt @@ -0,0 +1,238 @@ +--TEST-- +Test sort() function : usage variations - sort strings +--SKIPIF-- + SORT_REGULAR, "SORT_STRING" => SORT_STRING); + +$count = 1; +echo "\n-- Testing sort() by supplying various string arrays --\n"; + +// loop through to test sort() with different arrays +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With Default sort flag -\n"; + $temp_array = $array; + var_dump(sort($temp_array) ); // expecting : bool(true) + var_dump($temp_array); + + // loop through $flags array and setting all possible flag values + foreach($flags as $key => $flag){ + echo "- Sort flag = $key -\n"; + $temp_array = $array; + var_dump(sort($temp_array, $flag) ); // expecting : bool(true) + var_dump($temp_array); + } + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing sort() : usage variations *** + +-- Testing sort() by supplying various string arrays -- + +-- Iteration 1 -- +- With Default sort flag - +bool(true) +array(12) { + [0]=> + NULL + [1]=> + NULL + [2]=> + string(1) " " + [3]=> + string(1) " +" + [4]=> + string(1) " " + [5]=> + string(1) " " + [6]=> + string(1) " " + [7]=> + string(1) "" + [8]=> + string(2) "\a" + [9]=> + string(3) "\cx" + [10]=> + string(4) "\ddd" + [11]=> + string(4) "\xhh" +} +- Sort flag = SORT_REGULAR - +bool(true) +array(12) { + [0]=> + NULL + [1]=> + NULL + [2]=> + string(1) " " + [3]=> + string(1) " +" + [4]=> + string(1) " " + [5]=> + string(1) " " + [6]=> + string(1) " " + [7]=> + string(1) "" + [8]=> + string(2) "\a" + [9]=> + string(3) "\cx" + [10]=> + string(4) "\ddd" + [11]=> + string(4) "\xhh" +} +- Sort flag = SORT_STRING - +bool(true) +array(12) { + [0]=> + NULL + [1]=> + NULL + [2]=> + string(1) " " + [3]=> + string(1) " +" + [4]=> + string(1) " " + [5]=> + string(1) " " + [6]=> + string(1) " " + [7]=> + string(1) "" + [8]=> + string(2) "\a" + [9]=> + string(3) "\cx" + [10]=> + string(4) "\ddd" + [11]=> + string(4) "\xhh" +} + +-- Iteration 2 -- +- With Default sort flag - +bool(true) +array(12) { + [0]=> + string(6) "BANANA" + [1]=> + string(6) "Orange" + [2]=> + string(4) "TTTT" + [3]=> + string(4) "Test" + [4]=> + string(1) "X" + [5]=> + string(5) "apple" + [6]=> + string(6) "banana" + [7]=> + string(5) "lemoN" + [8]=> + string(6) "oraNGe" + [9]=> + string(3) "ttt" + [10]=> + string(2) "ww" + [11]=> + string(1) "x" +} +- Sort flag = SORT_REGULAR - +bool(true) +array(12) { + [0]=> + string(6) "BANANA" + [1]=> + string(6) "Orange" + [2]=> + string(4) "TTTT" + [3]=> + string(4) "Test" + [4]=> + string(1) "X" + [5]=> + string(5) "apple" + [6]=> + string(6) "banana" + [7]=> + string(5) "lemoN" + [8]=> + string(6) "oraNGe" + [9]=> + string(3) "ttt" + [10]=> + string(2) "ww" + [11]=> + string(1) "x" +} +- Sort flag = SORT_STRING - +bool(true) +array(12) { + [0]=> + string(6) "BANANA" + [1]=> + string(6) "Orange" + [2]=> + string(4) "TTTT" + [3]=> + string(4) "Test" + [4]=> + string(1) "X" + [5]=> + string(5) "apple" + [6]=> + string(6) "banana" + [7]=> + string(5) "lemoN" + [8]=> + string(6) "oraNGe" + [9]=> + string(3) "ttt" + [10]=> + string(2) "ww" + [11]=> + string(1) "x" +} +Done diff --git a/ext/standard/tests/array/sort_variation6.phpt b/ext/standard/tests/array/sort_variation6.phpt new file mode 100644 index 0000000..7a93f0e --- /dev/null +++ b/ext/standard/tests/array/sort_variation6.phpt @@ -0,0 +1,123 @@ +--TEST-- +Test sort() function : usage variations - sort hexadecimal values +--FILE-- + +--EXPECTF-- +*** Testing sort() : usage variations *** + +-- Testing sort() by supplying hexadecimal value array, 'flag' value is defualt -- +bool(true) +array(11) { + [0]=> + int(-682) + [1]=> + int(-255) + [2]=> + int(0) + [3]=> + int(15) + [4]=> + int(187) + [5]=> + int(255) + [6]=> + int(255) + [7]=> + int(427) + [8]=> + int(427) + [9]=> + int(682) + [10]=> + int(4095) +} + +-- Testing sort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(11) { + [0]=> + int(-682) + [1]=> + int(-255) + [2]=> + int(0) + [3]=> + int(15) + [4]=> + int(187) + [5]=> + int(255) + [6]=> + int(255) + [7]=> + int(427) + [8]=> + int(427) + [9]=> + int(682) + [10]=> + int(4095) +} + +-- Testing sort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(11) { + [0]=> + int(-682) + [1]=> + int(-255) + [2]=> + int(0) + [3]=> + int(15) + [4]=> + int(187) + [5]=> + int(255) + [6]=> + int(255) + [7]=> + int(427) + [8]=> + int(427) + [9]=> + int(682) + [10]=> + int(4095) +} +Done diff --git a/ext/standard/tests/array/sort_variation7.phpt b/ext/standard/tests/array/sort_variation7.phpt new file mode 100644 index 0000000..19d888a --- /dev/null +++ b/ext/standard/tests/array/sort_variation7.phpt @@ -0,0 +1,98 @@ +--TEST-- +Test sort() function : usage variations - sort boolean values +--FILE-- + +--EXPECTF-- +*** Testing sort() : usage variations *** + +-- Testing sort() by supplying bool value array, 'flag' value is defualt -- +bool(true) +array(4) { + [0]=> + bool(false) + [1]=> + bool(false) + [2]=> + bool(true) + [3]=> + bool(true) +} + +-- Testing sort() by supplying bool value array, 'flag' value is SORT_REGULAR -- +bool(true) +array(4) { + [0]=> + bool(false) + [1]=> + bool(false) + [2]=> + bool(true) + [3]=> + bool(true) +} + +-- Testing sort() by supplying bool value array, 'flag' value is SORT_NUMERIC -- +bool(true) +array(4) { + [0]=> + bool(false) + [1]=> + bool(false) + [2]=> + bool(true) + [3]=> + bool(true) +} + +-- Testing sort() by supplying bool value array, 'flag' value is SORT_STRING -- +bool(true) +array(4) { + [0]=> + bool(false) + [1]=> + bool(false) + [2]=> + bool(true) + [3]=> + bool(true) +} +Done diff --git a/ext/standard/tests/array/sort_variation8.phpt b/ext/standard/tests/array/sort_variation8.phpt new file mode 100644 index 0000000..9a33031 --- /dev/null +++ b/ext/standard/tests/array/sort_variation8.phpt @@ -0,0 +1,178 @@ +--TEST-- +Test sort() function : usage variations - sort array with diff. sub arrays, 'sort_flags' as defualt/SORT_REGULAR +--FILE-- + +--EXPECTF-- +*** Testing sort() : usage variations *** + +-- Testing sort() by supplying various arrays containing sub arrays -- + +-- Iteration 1 -- +- With Defualt sort flag - +bool(true) +array(0) { +} +- Sort flag = SORT_REGULAR - +bool(true) +array(0) { +} + +-- Iteration 2 -- +- With Defualt sort flag - +bool(true) +array(1) { + [0]=> + array(0) { + } +} +- Sort flag = SORT_REGULAR - +bool(true) +array(1) { + [0]=> + array(0) { + } +} + +-- Iteration 3 -- +- With Defualt sort flag - +bool(true) +array(3) { + [0]=> + int(11) + [1]=> + int(44) + [2]=> + array(2) { + [0]=> + int(64) + [1]=> + int(61) + } +} +- Sort flag = SORT_REGULAR - +bool(true) +array(3) { + [0]=> + int(11) + [1]=> + int(44) + [2]=> + array(2) { + [0]=> + int(64) + [1]=> + int(61) + } +} + +-- Iteration 4 -- +- With Defualt sort flag - +bool(true) +array(4) { + [0]=> + array(0) { + } + [1]=> + array(1) { + [0]=> + int(11) + } + [2]=> + array(2) { + [0]=> + int(22) + [1]=> + int(-55) + } + [3]=> + array(3) { + [0]=> + int(33) + [1]=> + int(-5) + [2]=> + int(6) + } +} +- Sort flag = SORT_REGULAR - +bool(true) +array(4) { + [0]=> + array(0) { + } + [1]=> + array(1) { + [0]=> + int(11) + } + [2]=> + array(2) { + [0]=> + int(22) + [1]=> + int(-55) + } + [3]=> + array(3) { + [0]=> + int(33) + [1]=> + int(-5) + [2]=> + int(6) + } +} +Done diff --git a/ext/standard/tests/array/sort_variation9.phpt b/ext/standard/tests/array/sort_variation9.phpt new file mode 100644 index 0000000..faab166 --- /dev/null +++ b/ext/standard/tests/array/sort_variation9.phpt @@ -0,0 +1,259 @@ +--TEST-- +Test sort() function : usage variations - sort diff. associative arrays, 'sort_flags' as defualt/SORT_REGULAR +--FILE-- + 55, 6 => 66, 2 => 22, 3 => 33, 1 => 11), + array ("fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"), + "numbers" => array(1, 2, 3, 4, 5, 6), + "holes" => array("first", 5 => "second", "third") + ), + array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13), + array('bar' => 'baz', "foo" => 1), + array('a' => 1,'b' => array('e' => 2,'f' => 3),'c' => array('g' => 4),'d' => 5), +); + +$count = 1; +echo "\n-- Testing sort() by supplying various arrays with key values --\n"; + +// loop through to test sort() with different arrays, +// to test the new keys for the elements in the sorted array +foreach ($various_arrays as $array) { + echo "\n-- Iteration $count --\n"; + + echo "- With Defualt sort flag -\n"; + $temp_array = $array; + var_dump(sort($temp_array) ); + var_dump($temp_array); + + echo "- Sort flag = SORT_REGULAR -\n"; + $temp_array = $array; + var_dump(sort($temp_array, SORT_REGULAR) ); + var_dump($temp_array); + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing sort() : usage variations *** + +-- Testing sort() by supplying various arrays with key values -- + +-- Iteration 1 -- +- With Defualt sort flag - +bool(true) +array(5) { + [0]=> + int(11) + [1]=> + int(22) + [2]=> + int(33) + [3]=> + int(55) + [4]=> + int(66) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(5) { + [0]=> + int(11) + [1]=> + int(22) + [2]=> + int(33) + [3]=> + int(55) + [4]=> + int(66) +} + +-- Iteration 2 -- +- With Defualt sort flag - +bool(true) +array(3) { + [0]=> + array(3) { + [0]=> + string(5) "first" + [5]=> + string(6) "second" + [6]=> + string(5) "third" + } + [1]=> + array(3) { + ["a"]=> + string(6) "orange" + ["b"]=> + string(6) "banana" + ["c"]=> + string(5) "apple" + } + [2]=> + array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + } +} +- Sort flag = SORT_REGULAR - +bool(true) +array(3) { + [0]=> + array(3) { + [0]=> + string(5) "first" + [5]=> + string(6) "second" + [6]=> + string(5) "third" + } + [1]=> + array(3) { + ["a"]=> + string(6) "orange" + ["b"]=> + string(6) "banana" + ["c"]=> + string(5) "apple" + } + [2]=> + array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + } +} + +-- Iteration 3 -- +- With Defualt sort flag - +bool(true) +array(6) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) + [3]=> + int(1) + [4]=> + int(13) + [5]=> + int(19) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(6) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) + [3]=> + int(1) + [4]=> + int(13) + [5]=> + int(19) +} + +-- Iteration 4 -- +- With Defualt sort flag - +bool(true) +array(2) { + [0]=> + string(3) "baz" + [1]=> + int(1) +} +- Sort flag = SORT_REGULAR - +bool(true) +array(2) { + [0]=> + string(3) "baz" + [1]=> + int(1) +} + +-- Iteration 5 -- +- With Defualt sort flag - +bool(true) +array(4) { + [0]=> + int(1) + [1]=> + int(5) + [2]=> + array(1) { + ["g"]=> + int(4) + } + [3]=> + array(2) { + ["e"]=> + int(2) + ["f"]=> + int(3) + } +} +- Sort flag = SORT_REGULAR - +bool(true) +array(4) { + [0]=> + int(1) + [1]=> + int(5) + [2]=> + array(1) { + ["g"]=> + int(4) + } + [3]=> + array(2) { + ["e"]=> + int(2) + ["f"]=> + int(3) + } +} +Done diff --git a/ext/standard/tests/array/uasort_basic1.phpt b/ext/standard/tests/array/uasort_basic1.phpt new file mode 100644 index 0000000..70dd04c --- /dev/null +++ b/ext/standard/tests/array/uasort_basic1.phpt @@ -0,0 +1,116 @@ +--TEST-- +Test uasort() function : basic functionality +--FILE-- + $value2) { + return 1; + } + else + return -1; +} + +// Int array with default keys +$int_values = array(1, 8, 9, 3, 2, 6, 7); +echo "-- Numeric array with default keys --\n"; +var_dump( uasort($int_values, 'cmp') ); +var_dump($int_values); + +// String array with default keys +$string_values = array("This", "is", 'a', "test"); +echo "-- String array with default keys --\n"; +var_dump( uasort($string_values, 'cmp') ); +var_dump($string_values); + +// Associative array with numeric keys +$numeric_key_arg = array(1=> 1, 2 => 2, 3 => 7, 5 => 4, 4 => 9); +echo "-- Associative array with numeric keys --\n"; +var_dump( uasort($numeric_key_arg, 'cmp') ); +var_dump($numeric_key_arg); + +// Associative array with string keys +$string_key_arg = array('one' => 4, 'two' => 2, 'three' => 1, 'four' => 10); +echo "-- Associative array with string keys --\n"; +var_dump( uasort($string_key_arg, 'cmp') ); +var_dump($string_key_arg); + +echo "Done" +?> +--EXPECTF-- +*** Testing uasort() : basic functionality *** +-- Numeric array with default keys -- +bool(true) +array(7) { + [0]=> + int(1) + [4]=> + int(2) + [3]=> + int(3) + [5]=> + int(6) + [6]=> + int(7) + [1]=> + int(8) + [2]=> + int(9) +} +-- String array with default keys -- +bool(true) +array(4) { + [0]=> + string(4) "This" + [2]=> + string(1) "a" + [1]=> + string(2) "is" + [3]=> + string(4) "test" +} +-- Associative array with numeric keys -- +bool(true) +array(5) { + [1]=> + int(1) + [2]=> + int(2) + [5]=> + int(4) + [3]=> + int(7) + [4]=> + int(9) +} +-- Associative array with string keys -- +bool(true) +array(4) { + ["three"]=> + int(1) + ["two"]=> + int(2) + ["one"]=> + int(4) + ["four"]=> + int(10) +} +Done diff --git a/ext/standard/tests/array/uasort_basic2.phpt b/ext/standard/tests/array/uasort_basic2.phpt new file mode 100644 index 0000000..e1b4ac9 --- /dev/null +++ b/ext/standard/tests/array/uasort_basic2.phpt @@ -0,0 +1,102 @@ +--TEST-- +Test uasort() function : basic functionality - duplicate values +--FILE-- + $value2) { + return 1; + } + else + return -1; +} + +// increasing values +$int_values1 = array(1, 1, 2, 2, 3, 3); +echo "-- Numeric array with increasing values --\n"; +var_dump( uasort($int_values1, 'cmp') ); +var_dump($int_values1); + +// decreasing values +$int_values2 = array(3, 3, 2, 2, 1, 1); +echo "-- Numeric array with decreasing values --\n"; +var_dump( uasort($int_values2, 'cmp') ); +var_dump($int_values2); + +// increasing and decreasing values +$int_values3 = array(1, 2, 3, 3, 2, 1); +echo "-- Numeric array with increasing and decreasing values --\n"; +var_dump( uasort($int_values3, 'cmp') ); +var_dump($int_values3); + +echo "Done" +?> +--EXPECTF-- +*** Testing uasort() : basic functionality with duplicate values *** +-- Numeric array with increasing values -- +bool(true) +array(6) { + [0]=> + int(1) + [1]=> + int(1) + [3]=> + int(2) + [2]=> + int(2) + [5]=> + int(3) + [4]=> + int(3) +} +-- Numeric array with decreasing values -- +bool(true) +array(6) { + [4]=> + int(1) + [5]=> + int(1) + [3]=> + int(2) + [2]=> + int(2) + [1]=> + int(3) + [0]=> + int(3) +} +-- Numeric array with increasing and decreasing values -- +bool(true) +array(6) { + [5]=> + int(1) + [0]=> + int(1) + [1]=> + int(2) + [4]=> + int(2) + [2]=> + int(3) + [3]=> + int(3) +} +Done diff --git a/ext/standard/tests/array/uasort_error.phpt b/ext/standard/tests/array/uasort_error.phpt new file mode 100644 index 0000000..820ab58 --- /dev/null +++ b/ext/standard/tests/array/uasort_error.phpt @@ -0,0 +1,81 @@ +--TEST-- +Test uasort() function : error conditions +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +// Initialize 'array_arg' +$array_arg = array(0 => 1, 1 => 10, 2 => 'string', 3 => 3, 4 => 2, 5 => 100, 6 => 25); + +// With zero arguments +echo "-- Testing uasort() function with Zero argument --\n"; +var_dump( uasort() ); + +// With one more than the expected number of arguments +echo "-- Testing uasort() function with more than expected no. of arguments --\n"; +$extra_arg = 10; +var_dump( uasort($array_arg, 'cmp', $extra_arg) ); + +// With one less than the expected number of arguments +echo "-- Testing uasort() function with less than expected no. of arguments --\n"; +var_dump( uasort($array_arg) ); + +// With non existent comparison function +echo "-- Testing uasort() function with non-existent compare function --\n"; +var_dump( uasort($array_arg, 'non_existent') ); + +// With non existent comparison function and extra arguemnt +echo "-- Testing uasort() function with non-existent compare function and extra argument --\n"; +var_dump( uasort($array_arg, 'non_existent', $extra_arg) ); + +echo "Done" +?> +--EXPECTF-- +*** Testing uasort() : error conditions *** +-- Testing uasort() function with Zero argument -- + +Warning: uasort() expects exactly 2 parameters, 0 given in %s on line %d +NULL +-- Testing uasort() function with more than expected no. of arguments -- + +Warning: uasort() expects exactly 2 parameters, 3 given in %s on line %d +NULL +-- Testing uasort() function with less than expected no. of arguments -- + +Warning: uasort() expects exactly 2 parameters, 1 given in %s on line %d +NULL +-- Testing uasort() function with non-existent compare function -- + +Warning: uasort() expects parameter 2 to be a valid callback, function 'non_existent' not found or invalid function name in %s on line %d +NULL +-- Testing uasort() function with non-existent compare function and extra argument -- + +Warning: uasort() expects exactly 2 parameters, 3 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/uasort_object1.phpt b/ext/standard/tests/array/uasort_object1.phpt new file mode 100644 index 0000000..5d5b0b5 --- /dev/null +++ b/ext/standard/tests/array/uasort_object1.phpt @@ -0,0 +1,150 @@ +--TEST-- +Test uasort() function : object functionality +--FILE-- + $value2) { + return 1; + } + else + return -1; +} + +// comparison function for SimpleClass2 objects which has more than one members +function multiple_cmp($value1, $value2) +{ + if($value1->getValue() == $value2->getValue()) + return 0; + else if($value1->getValue() > $value2->getValue()) + return 1; + else + return -1; +} + +// Simple class with single member variable +class SimpleClass1 +{ + private $int_value; + + public function __construct($value) { + $this->int_value = $value; + } +} + +// Simple class with more than one member variables +class SimpleClass2 +{ + private $int_value; + protected $float_value; + public $string_value; + public function __construct($int, $float, $str) { + $this->int_value = $int; + $this->float_value = $float; + $this->string_value = $str; + } + public function getValue() { + return $this->int_value; + } +} + +// array of SimpleClass objects with only one member +$array_arg = array( + 0 => new SimpleClass1(10), + 1 => new SimpleClass1(1), + 2 => new SimpleClass1(100), + 3 => new SimpleClass1(50) +); +var_dump( uasort($array_arg, 'simple_cmp') ); +var_dump($array_arg); + +// array of SimpleClass objects having more than one members +$array_arg = array( + 0 => new SimpleClass2(2, 3.4, "mango"), + 1 => new SimpleClass2(10, 1.2, "apple"), + 2 => new SimpleClass2(5, 2.5, "orange"), +); +var_dump( uasort($array_arg, 'multiple_cmp') ); +var_dump($array_arg); + +echo "Done" +?> +--EXPECTF-- +*** Testing uasort() : object functionality *** +bool(true) +array(4) { + [1]=> + object(SimpleClass1)#2 (1) { + ["int_value":"SimpleClass1":private]=> + int(1) + } + [0]=> + object(SimpleClass1)#1 (1) { + ["int_value":"SimpleClass1":private]=> + int(10) + } + [3]=> + object(SimpleClass1)#4 (1) { + ["int_value":"SimpleClass1":private]=> + int(50) + } + [2]=> + object(SimpleClass1)#3 (1) { + ["int_value":"SimpleClass1":private]=> + int(100) + } +} +bool(true) +array(3) { + [0]=> + object(SimpleClass2)#5 (3) { + ["int_value":"SimpleClass2":private]=> + int(2) + ["float_value":protected]=> + float(3.4) + ["string_value"]=> + string(5) "mango" + } + [2]=> + object(SimpleClass2)#7 (3) { + ["int_value":"SimpleClass2":private]=> + int(5) + ["float_value":protected]=> + float(2.5) + ["string_value"]=> + string(6) "orange" + } + [1]=> + object(SimpleClass2)#6 (3) { + ["int_value":"SimpleClass2":private]=> + int(10) + ["float_value":protected]=> + float(1.2) + ["string_value"]=> + string(5) "apple" + } +} +Done diff --git a/ext/standard/tests/array/uasort_object2.phpt b/ext/standard/tests/array/uasort_object2.phpt new file mode 100644 index 0000000..cd32d8d --- /dev/null +++ b/ext/standard/tests/array/uasort_object2.phpt @@ -0,0 +1,187 @@ +--TEST-- +Test uasort() function : object functionality - sort diff. objects +--FILE-- + $value2) { + return 1; + } + else + return -1; +} + + +// Simple class with single member variable +class SimpleClass +{ + private $int_value; + + public function __construct($value) { + $this->int_value = $value; + } + +} + +// Class without any member +class EmptyClass +{ +} + +// Class with static member +class StaticClass +{ + public static $static_value; + public function __construct($value) { + StaticClass::$static_value = $value; + } +} + +// Abstract class +abstract class AbstractClass +{ + public $pub_value; + public abstract function abstractMethod(); +} + +// Child class extending abstract class +class ChildClass extends AbstractClass +{ + public $child_value = 100; + public function abstractMethod() { + $pub_value = 5; + } + public function __construct($value) { + $this->child_value = $value; + } +} + +// Testing uasort with StaticClass objects as elements of 'array_arg' +echo "-- Testing uasort() with StaticClass objects --\n"; +$array_arg = array( + 0 => new StaticClass(20), + 1 => new StaticClass(50), + 2 => new StaticClass(15), + 3 => new StaticClass(70), +); +var_dump( uasort($array_arg, 'cmp_function') ); +var_dump($array_arg); + +// Testing uasort with EmptyClass objects as elements of 'array_arg' +echo "-- Testing uasort() with EmptyClass objects --\n"; +$array_arg = array( + 0 => new EmptyClass(), + 1 => new EmptyClass(), + 2 => new EmptyClass(), + 3 => new EmptyClass(), +); +var_dump( uasort($array_arg, 'cmp_function') ); +var_dump($array_arg); + +// Testing uasort with ChildClass objects as elements of 'array_arg' +echo "-- Testing uasort() with ChildClass objects --\n"; +$array_arg = array( + 0 => new ChildClass(20), + 1 => new ChildClass(500), + 2 => new ChildClass(15), + 3 => new ChildClass(700), +); +var_dump( uasort($array_arg, 'cmp_function') ); +var_dump($array_arg); + +echo "Done" +?> +--EXPECTF-- +*** Testing uasort() : object functionality *** +-- Testing uasort() with StaticClass objects -- +bool(true) +array(4) { + [3]=> + object(StaticClass)#%d (0) { + } + [2]=> + object(StaticClass)#%d (0) { + } + [1]=> + object(StaticClass)#%d (0) { + } + [0]=> + object(StaticClass)#%d (0) { + } +} +-- Testing uasort() with EmptyClass objects -- +bool(true) +array(4) { + [3]=> + object(EmptyClass)#%d (0) { + } + [2]=> + object(EmptyClass)#%d (0) { + } + [1]=> + object(EmptyClass)#%d (0) { + } + [0]=> + object(EmptyClass)#%d (0) { + } +} +-- Testing uasort() with ChildClass objects -- +bool(true) +array(4) { + [2]=> + object(ChildClass)#%d (2) { + ["child_value"]=> + int(15) + ["pub_value"]=> + NULL + } + [0]=> + object(ChildClass)#%d (2) { + ["child_value"]=> + int(20) + ["pub_value"]=> + NULL + } + [1]=> + object(ChildClass)#%d (2) { + ["child_value"]=> + int(500) + ["pub_value"]=> + NULL + } + [3]=> + object(ChildClass)#%d (2) { + ["child_value"]=> + int(700) + ["pub_value"]=> + NULL + } +} +Done diff --git a/ext/standard/tests/array/uasort_variation1.phpt b/ext/standard/tests/array/uasort_variation1.phpt new file mode 100644 index 0000000..96dcaee --- /dev/null +++ b/ext/standard/tests/array/uasort_variation1.phpt @@ -0,0 +1,188 @@ +--TEST-- +Test uasort() function : usage variations - unexpected values for 'array_arg' argument +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get resource variable +$fp = fopen(__FILE__,'r'); + +//array of values to iterate over +$input_values = array( + + // int data +/*1*/ 0, + 1, + 12345, + -2345, + + // float data +/*5*/ 10.5, + -10.5, + 10.1234567e8, + 10.7654321E-8, + .5, + + // null data +/*10*/ NULL, + null, + + // boolean data +/*12*/ true, + false, + TRUE, + FALSE, + + // empty data +/*16*/ "", + '', + + // string data +/*18*/ "string", + 'string', + + // resource data +/*20*/ $fp, + + // undefined data + @$undefined_var, + + // unset data +/*22*/ @$unset_var, +); + +// loop through each value of input_values +for($count = 0; $count < count($input_values); $count++) { + echo "-- Iteration ".($count + 1)." --\n"; + var_dump( uasort($input_values[$count], 'cmp_function') ); +}; + +//closing resource +fclose($fp); +echo "Done" +?> +--EXPECTF-- +*** Testing uasort() : unexpected values for 'array_arg' *** +-- Iteration 1 -- + +Warning: uasort() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 2 -- + +Warning: uasort() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 3 -- + +Warning: uasort() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 4 -- + +Warning: uasort() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: uasort() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: uasort() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: uasort() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: uasort() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: uasort() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: uasort() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: uasort() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: uasort() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: uasort() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: uasort() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: uasort() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: uasort() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: uasort() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: uasort() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: uasort() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: uasort() expects parameter 1 to be array, resource given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: uasort() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: uasort() expects parameter 1 to be array, null given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/uasort_variation10.phpt b/ext/standard/tests/array/uasort_variation10.phpt new file mode 100644 index 0000000..809cb78 --- /dev/null +++ b/ext/standard/tests/array/uasort_variation10.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test uasort() function : usage variations - sort array with reference variables +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +echo "*** Testing uasort() : 'array_arg' with elements as reference ***\n"; + +// different variables which are used as elements of 'array_arg' +$value1 = -5; +$value2 = 100; +$value3 = 0; +$value4 = &$value1; + +// array_args an array containing elements with reference variables +$array_arg = array( + 0 => 10, + 1 => &$value4, + 2 => &$value2, + 3 => 200, + 4 => &$value3, +); + +echo "-- Sorting 'array_arg' containing different references --\n"; +var_dump( uasort($array_arg, 'cmp_function') ); // expecting: bool(true) +var_dump($array_arg); + +echo "Done" +?> +--EXPECTF-- +*** Testing uasort() : 'array_arg' with elements as reference *** +-- Sorting 'array_arg' containing different references -- +bool(true) +array(5) { + [1]=> + &int(-5) + [4]=> + &int(0) + [0]=> + int(10) + [2]=> + &int(100) + [3]=> + int(200) +} +Done diff --git a/ext/standard/tests/array/uasort_variation11.phpt b/ext/standard/tests/array/uasort_variation11.phpt new file mode 100644 index 0000000..6d523ea --- /dev/null +++ b/ext/standard/tests/array/uasort_variation11.phpt @@ -0,0 +1,82 @@ +--TEST-- +Test uasort() function : usage variations - different associative arrays +--FILE-- + $value2) { + return 1; + } + else + return -1; +} + +// Array with duplicate string and integer keys +$array_arg = array(0 => 2, "a" => 8, "d" => 9, 3 => 3, 5 => 2, "o" => 6, "z" => -99, 0 => 1, "z" => 3); +echo "-- Array with duplicate keys --\n"; +var_dump( uasort($array_arg, 'cmp') ); +var_dump($array_arg); + +// Array with default and assigned keys +$array_arg = array(0 => "Banana", 1 => "Mango", "Orange", 2 => "Apple", "Pineapple"); +echo "-- Array with default/assigned keys --\n"; +var_dump( uasort($array_arg, 'cmp') ); +var_dump($array_arg); + +echo "Done" +?> +--EXPECTF-- +*** Testing uasort() : sorting different associative arrays *** +-- Array with duplicate keys -- +bool(true) +array(7) { + [0]=> + int(1) + [5]=> + int(2) + ["z"]=> + int(3) + [3]=> + int(3) + ["o"]=> + int(6) + ["a"]=> + int(8) + ["d"]=> + int(9) +} +-- Array with default/assigned keys -- +bool(true) +array(4) { + [2]=> + string(5) "Apple" + [0]=> + string(6) "Banana" + [1]=> + string(5) "Mango" + [3]=> + string(9) "Pineapple" +} +Done diff --git a/ext/standard/tests/array/uasort_variation2.phpt b/ext/standard/tests/array/uasort_variation2.phpt new file mode 100644 index 0000000..6283245 --- /dev/null +++ b/ext/standard/tests/array/uasort_variation2.phpt @@ -0,0 +1,212 @@ +--TEST-- +Test uasort() function : usage variations - unexpected values for 'cmp_function' argument +--FILE-- + 1, 1 => -1, 2 => 3, 3 => 10, 4 => 4, 5 => 2, 6 => 8, 7 => 5); + +// Get an unset variable +$unset_var = 10; +unset ($unset_var); + +// Get resource variable +$fp = fopen(__FILE__,'r'); + +// different values for 'cmp_function' +$cmp_values = array( + + // int data +/*1*/ 0, + 1, + 12345, + -2345, + + // float data +/*5*/ 10.5, + -10.5, + 10.1234567e8, + 10.7654321E-8, + .5, + + // array data +/*10*/ array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data +/*15*/ NULL, + null, + + // boolean data +/*17*/ true, + false, + TRUE, + FALSE, + + // empty data +/*21*/ "", + '', + + // string data + "string", + 'string', + + // object data +/*25*/ new MyClass(), + + // resource data + $fp, + + // undefined data + @$undefined_var, + + // unset data +/*28*/ @$unset_var, +); + +// loop through each element of the cmp_values for 'cmp_function' +for($count = 0; $count < count($cmp_values); $count++) { + echo "-- Iteration ".($count + 1)." --\n"; + var_dump( uasort($array_arg, $cmp_values[$count]) ); +}; + +//closing resource +fclose($fp); +echo "Done" +?> +--EXPECTF-- +*** Testing uasort() : Unexpected values in place of comparison function *** +-- Iteration 1 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 2 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 3 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 4 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: uasort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL +-- Iteration 11 -- + +Warning: uasort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL +-- Iteration 12 -- + +Warning: uasort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL +-- Iteration 13 -- + +Warning: uasort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL +-- Iteration 14 -- + +Warning: uasort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL +-- Iteration 15 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: uasort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL +-- Iteration 22 -- + +Warning: uasort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL +-- Iteration 23 -- + +Warning: uasort() expects parameter 2 to be a valid callback, function 'string' not found or invalid function name in %s on line %d +NULL +-- Iteration 24 -- + +Warning: uasort() expects parameter 2 to be a valid callback, function 'string' not found or invalid function name in %s on line %d +NULL +-- Iteration 25 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 26 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 27 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +-- Iteration 28 -- + +Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/uasort_variation3.phpt b/ext/standard/tests/array/uasort_variation3.phpt new file mode 100644 index 0000000..9147d59 Binary files /dev/null and b/ext/standard/tests/array/uasort_variation3.phpt differ diff --git a/ext/standard/tests/array/uasort_variation4.phpt b/ext/standard/tests/array/uasort_variation4.phpt new file mode 100644 index 0000000..c2844bf --- /dev/null +++ b/ext/standard/tests/array/uasort_variation4.phpt @@ -0,0 +1,150 @@ +--TEST-- +Test uasort() function : usage variations - sort different numeric values +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +echo "*** Testing uasort() : different numeric arrays as 'array_arg' ***\n"; + +// Int array +$int_values = array(0 => 3, 1 => 2, 3 => 100, 4 => 150, 5 => 25, 6 => 350, 7 => 0, 8 => -3, 9 => -1200); +echo "-- Sorting Integer array --\n"; +var_dump( uasort($int_values, 'cmp_function') ); // expecting: bool(true) +var_dump($int_values); + +// Octal array +$octal_values = array(0 => 056, 1 => 023, 2 => 090, 3 => 015, 4 => -045, 5 => 01, 6 => -078); +echo "-- Sorting Octal array --\n"; +var_dump( uasort($octal_values, 'cmp_function') ); // expecting: bool(true) +var_dump($octal_values); + +// Hexadecimal array +$hex_values = array(0 => 0xAE, 1 => 0x2B, 2 => 0X10, 3 => -0xCF, 4 => 0X12, 5 => -0XF2); +echo "-- Sorting Hex array --\n"; +var_dump( uasort($hex_values, 'cmp_function') ); // expecting: bool(true) +var_dump($hex_values); + +// Float array +$float_values = array( 0 => 10.2, 1 => 2.4, 2 => -3.4, 3 => 0, 4 => 0.5, 5 => 7.3e3, 6 => -9.34E-2); +echo "-- Sorting Float array --\n"; +var_dump( uasort($float_values, 'cmp_function') ); // expecting: bool(true) +var_dump($float_values); + +// empty array +$empty_array = array(); +echo "-- Sorting empty array --\n"; +var_dump( uasort($empty_array, 'cmp_function') ); // expecting: bool(true) +var_dump($empty_array); + +echo "Done" +?> +--EXPECTF-- +*** Testing uasort() : different numeric arrays as 'array_arg' *** +-- Sorting Integer array -- +bool(true) +array(9) { + [9]=> + int(-1200) + [8]=> + int(-3) + [7]=> + int(0) + [1]=> + int(2) + [0]=> + int(3) + [5]=> + int(25) + [3]=> + int(100) + [4]=> + int(150) + [6]=> + int(350) +} +-- Sorting Octal array -- +bool(true) +array(7) { + [4]=> + int(-37) + [6]=> + int(-7) + [2]=> + int(0) + [5]=> + int(1) + [3]=> + int(13) + [1]=> + int(19) + [0]=> + int(46) +} +-- Sorting Hex array -- +bool(true) +array(6) { + [5]=> + int(-242) + [3]=> + int(-207) + [2]=> + int(16) + [4]=> + int(18) + [1]=> + int(43) + [0]=> + int(174) +} +-- Sorting Float array -- +bool(true) +array(7) { + [2]=> + float(-3.4) + [6]=> + float(-0.0934) + [3]=> + int(0) + [4]=> + float(0.5) + [1]=> + float(2.4) + [0]=> + float(10.2) + [5]=> + float(7300) +} +-- Sorting empty array -- +bool(true) +array(0) { +} +Done diff --git a/ext/standard/tests/array/uasort_variation5.phpt b/ext/standard/tests/array/uasort_variation5.phpt new file mode 100644 index 0000000..e6996a5 --- /dev/null +++ b/ext/standard/tests/array/uasort_variation5.phpt @@ -0,0 +1,145 @@ +--TEST-- +Test uasort() function : usage variations - sort diff. strings +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +// Different heredoc strings to be sorted +$empty_heredoc =<< ' ', 1 => 'test', 3 => 'Hello', 4 => 'HELLO', + 5 => '', 6 => '\t', 7 => '0', 8 => '123Hello', 9 => '\'', 10 => '@#$%' +); +echo "-- Sorting Single Quoted String values --\n"; +var_dump( uasort($single_quoted_values, 'cmp_function') ); // expecting: bool(true) +var_dump($single_quoted_values); + +// Double quoted strings +$double_quoted_values = array( + 0 => " ", 1 => "test", 3 => "Hello", 4 => "HELLO", + 5 => "", 6 => "\t", 7 => "0", 8 => "123Hello", 9 => "\"", 10 => "@#$%" +); +echo "-- Sorting Double Quoted String values --\n"; +var_dump( uasort($double_quoted_values, 'cmp_function') ); // expecting: bool(true) +var_dump($double_quoted_values); + +// Heredoc strings +$heredoc_values = array(0 => $empty_heredoc, 1 => $simple_heredoc1, 2 => $simple_heredoc2, 3 => $multiline_heredoc); +echo "-- Sorting Heredoc String values --\n"; +var_dump( uasort($heredoc_values, 'cmp_function') ); // expecting: bool(true) +var_dump($heredoc_values); + +echo "Done" +?> +--EXPECTF-- +*** Testing uasort() : different string arrays as 'array_arg' *** +-- Sorting Single Quoted String values -- +bool(true) +array(10) { + [5]=> + string(0) "" + [0]=> + string(1) " " + [9]=> + string(1) "'" + [7]=> + string(1) "0" + [8]=> + string(8) "123Hello" + [10]=> + string(4) "@#$%" + [4]=> + string(5) "HELLO" + [3]=> + string(5) "Hello" + [6]=> + string(2) "\t" + [1]=> + string(4) "test" +} +-- Sorting Double Quoted String values -- +bool(true) +array(10) { + [5]=> + string(0) "" + [6]=> + string(1) " " + [0]=> + string(1) " " + [9]=> + string(1) """ + [7]=> + string(1) "0" + [8]=> + string(8) "123Hello" + [10]=> + string(4) "@#$%" + [4]=> + string(5) "HELLO" + [3]=> + string(5) "Hello" + [1]=> + string(4) "test" +} +-- Sorting Heredoc String values -- +bool(true) +array(4) { + [0]=> + string(0) "" + [2]=> + string(7) "HEREDOC" + [1]=> + string(7) "Heredoc" + [3]=> + string(4%d) "heredoc string with!@# and 123 +Test this!!!" +} +Done diff --git a/ext/standard/tests/array/uasort_variation6.phpt b/ext/standard/tests/array/uasort_variation6.phpt new file mode 100644 index 0000000..48d9c03 --- /dev/null +++ b/ext/standard/tests/array/uasort_variation6.phpt @@ -0,0 +1,115 @@ +--TEST-- +Test uasort() function : usage variations - sort array having subarrays +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +echo "*** Testing uasort() : sorting array having different subarrays ***\n"; + +$array_args = array( + 0 => array(2, 10, -1), + 1 => array(100), + 2 => array(), + 3 => array(0), + 4 => array(-1), + 5 => array(-9, 34, 54, 0, 20), + 6 => array(''), + 7 => array("apple", "Apple", "APPLE", "aPPle", "aPpLe") +); +$temp_array = $array_args; +// sorting array_arg as whole array +var_dump( uasort($temp_array, 'cmp_function') ); // expecting: bool(true) +var_dump($temp_array); + +?> +--EXPECTF-- +*** Testing uasort() : sorting array having different subarrays *** +bool(true) +array(8) { + [2]=> + array(0) { + } + [4]=> + array(1) { + [0]=> + int(-1) + } + [6]=> + array(1) { + [0]=> + string(0) "" + } + [3]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(100) + } + [0]=> + array(3) { + [0]=> + int(2) + [1]=> + int(10) + [2]=> + int(-1) + } + [5]=> + array(5) { + [0]=> + int(-9) + [1]=> + int(34) + [2]=> + int(54) + [3]=> + int(0) + [4]=> + int(20) + } + [7]=> + array(5) { + [0]=> + string(5) "apple" + [1]=> + string(5) "Apple" + [2]=> + string(5) "APPLE" + [3]=> + string(5) "aPPle" + [4]=> + string(5) "aPpLe" + } +} diff --git a/ext/standard/tests/array/uasort_variation7.phpt b/ext/standard/tests/array/uasort_variation7.phpt new file mode 100644 index 0000000..44a2bb3 --- /dev/null +++ b/ext/standard/tests/array/uasort_variation7.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test uasort() function : usage variations - anonymous function as 'cmp_function' +--FILE-- + $value2) {return 1;} else{return -1;}'; + +$array_arg = array(0 => 100, 1 => 3, 2 => -70, 3 => 24, 4 => 90); +echo "-- Anonymous 'cmp_function' with parameters passed by value --\n"; +var_dump( uasort($array_arg, create_function('$value1, $value2',$cmp_function) ) ); +var_dump($array_arg); + +$array_arg = array("b" => "Banana", "m" => "Mango", "a" => "Apple", "p" => "Pineapple"); +echo "-- Anonymous 'cmp_function' with parameters passed by reference --\n"; +var_dump( uasort($array_arg, create_function('&$value1, &$value2', $cmp_function) ) ); +var_dump($array_arg); + +echo "Done" +?> +--EXPECTF-- +*** Testing uasort() : anonymous function as 'cmp_function' *** +-- Anonymous 'cmp_function' with parameters passed by value -- +bool(true) +array(5) { + [2]=> + int(-70) + [1]=> + int(3) + [3]=> + int(24) + [4]=> + int(90) + [0]=> + int(100) +} +-- Anonymous 'cmp_function' with parameters passed by reference -- +bool(true) +array(4) { + ["a"]=> + string(5) "Apple" + ["b"]=> + string(6) "Banana" + ["m"]=> + string(5) "Mango" + ["p"]=> + string(9) "Pineapple" +} +Done diff --git a/ext/standard/tests/array/uasort_variation8.phpt b/ext/standard/tests/array/uasort_variation8.phpt new file mode 100644 index 0000000..dd0a7a3 --- /dev/null +++ b/ext/standard/tests/array/uasort_variation8.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test uasort() function : usage variations - built-in function as 'cmp_function' +--FILE-- + "Banana", "m" => "Mango", "a" => "apple", "p" => "Pineapple", "o" => "orange"); +$builtin_fun_arg = $array_arg; +$languageConstruct_fun_arg = $array_arg; + +// Testing library functions as comparison function +echo "-- Testing uasort() with built-in 'cmp_function': strcasecmp() --\n"; +var_dump( uasort($builtin_fun_arg, 'strcasecmp') ); // expecting: bool(true) +var_dump($builtin_fun_arg); + +echo "-- Testing uasort() with built-in 'cmp_function': strcmp() --\n"; +var_dump( uasort($array_arg, 'strcmp') ); // expecting: bool(true) +var_dump($array_arg); + +// Testing with language construct as comparison function +echo "-- Testing uasort() with language construct as 'cmp_function' --\n"; +var_dump( uasort($languageConstruct_fun_arg, 'echo') ); // expecting: bool(false) + +echo "-- Testing uasort() with language construct as 'cmp_function' --\n"; +var_dump( uasort($languageConstruct_fun_arg, 'exit') ); // expecting: bool(false) + +echo "Done" +?> +--EXPECTF-- +*** Testing uasort() : built in function as 'cmp_function' *** +-- Testing uasort() with built-in 'cmp_function': strcasecmp() -- +bool(true) +array(5) { + ["a"]=> + string(5) "apple" + ["b"]=> + string(6) "Banana" + ["m"]=> + string(5) "Mango" + ["o"]=> + string(6) "orange" + ["p"]=> + string(9) "Pineapple" +} +-- Testing uasort() with built-in 'cmp_function': strcmp() -- +bool(true) +array(5) { + ["b"]=> + string(6) "Banana" + ["m"]=> + string(5) "Mango" + ["p"]=> + string(9) "Pineapple" + ["a"]=> + string(5) "apple" + ["o"]=> + string(6) "orange" +} +-- Testing uasort() with language construct as 'cmp_function' -- + +Warning: uasort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d +NULL +-- Testing uasort() with language construct as 'cmp_function' -- + +Warning: uasort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/uasort_variation9.phpt b/ext/standard/tests/array/uasort_variation9.phpt new file mode 100644 index 0000000..486042e --- /dev/null +++ b/ext/standard/tests/array/uasort_variation9.phpt @@ -0,0 +1,81 @@ +--TEST-- +Test uasort() function : usage variations - 'cmp_function' with reference argument +--FILE-- + $value2) { + return 1; + } + else + return -1; +} + +// Int array with default keys +$int_values = array(1, 8, 9, 3, 2, 6, 7); +echo "-- Passing integer values to 'cmp_function' --\n"; +var_dump( uasort($int_values, 'cmp') ); +var_dump($int_values); + +// String array with default keys +$string_values = array("Mango", "Apple", "Orange", "Banana"); +echo "-- Passing string values to 'cmp_function' --\n"; +var_dump( uasort($string_values, 'cmp') ); +var_dump($string_values); + +echo "Done" +?> +--EXPECTF-- +*** Testing uasort() : 'cmp_function' with reference arguments *** +-- Passing integer values to 'cmp_function' -- +bool(true) +array(7) { + [0]=> + int(1) + [4]=> + int(2) + [3]=> + int(3) + [5]=> + int(6) + [6]=> + int(7) + [1]=> + int(8) + [2]=> + int(9) +} +-- Passing string values to 'cmp_function' -- +bool(true) +array(4) { + [1]=> + string(5) "Apple" + [3]=> + string(6) "Banana" + [0]=> + string(5) "Mango" + [2]=> + string(6) "Orange" +} +Done diff --git a/ext/standard/tests/array/uksort_basic.phpt b/ext/standard/tests/array/uksort_basic.phpt new file mode 100644 index 0000000..f83c032 --- /dev/null +++ b/ext/standard/tests/array/uksort_basic.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test uksort(): basic functionality +--FILE-- + $value) { + echo "$key: $value\n"; +} +?> +--EXPECT-- +4: 1 +1: 2 +0: 3 +2: 5 +3: 6 \ No newline at end of file diff --git a/ext/standard/tests/array/uksort_error.phpt b/ext/standard/tests/array/uksort_error.phpt new file mode 100644 index 0000000..241ed2f --- /dev/null +++ b/ext/standard/tests/array/uksort_error.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test uksort() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing uksort() : error conditions *** + +-- Testing uksort() function with more than expected no. of arguments -- + +Warning: uksort() expects exactly 2 parameters, 3 given in %suksort_error.php on line %d +NULL + +-- Testing uksort() function with less than expected no. of arguments -- + +Warning: uksort() expects exactly 2 parameters, 1 given in %suksort_error.php on line %d +NULL + +-- Testing uksort() function with zero arguments -- + +Warning: uksort() expects exactly 2 parameters, 0 given in %suksort_error.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/uksort_variation1.phpt b/ext/standard/tests/array/uksort_variation1.phpt new file mode 100644 index 0000000..3189f7f --- /dev/null +++ b/ext/standard/tests/array/uksort_variation1.phpt @@ -0,0 +1,224 @@ +--TEST-- +Test uksort() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for array_arg + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( uksort($value, $cmp_function) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing uksort() : usage variation *** + +--int 0-- + +Warning: uksort() expects parameter 1 to be array, integer given in %suksort_variation1.php on line %d +NULL + +--int 1-- + +Warning: uksort() expects parameter 1 to be array, integer given in %suksort_variation1.php on line %d +NULL + +--int 12345-- + +Warning: uksort() expects parameter 1 to be array, integer given in %suksort_variation1.php on line %d +NULL + +--int -12345-- + +Warning: uksort() expects parameter 1 to be array, integer given in %suksort_variation1.php on line %d +NULL + +--float 10.5-- + +Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d +NULL + +--float -10.5-- + +Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d +NULL + +--float .5-- + +Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d +NULL + +--uppercase NULL-- + +Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d +NULL + +--lowercase null-- + +Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d +NULL + +--lowercase true-- + +Warning: uksort() expects parameter 1 to be array, boolean given in %suksort_variation1.php on line %d +NULL + +--lowercase false-- + +Warning: uksort() expects parameter 1 to be array, boolean given in %suksort_variation1.php on line %d +NULL + +--uppercase TRUE-- + +Warning: uksort() expects parameter 1 to be array, boolean given in %suksort_variation1.php on line %d +NULL + +--uppercase FALSE-- + +Warning: uksort() expects parameter 1 to be array, boolean given in %suksort_variation1.php on line %d +NULL + +--empty string DQ-- + +Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d +NULL + +--string DQ-- + +Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d +NULL + +--string SQ-- + +Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d +NULL + +--heredoc-- + +Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d +NULL + +--instance of classWithToString-- + +Warning: uksort() expects parameter 1 to be array, object given in %suksort_variation1.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: uksort() expects parameter 1 to be array, object given in %suksort_variation1.php on line %d +NULL + +--undefined var-- + +Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d +NULL + +--unset var-- + +Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/uksort_variation2.phpt b/ext/standard/tests/array/uksort_variation2.phpt new file mode 100644 index 0000000..2f5b8b5 --- /dev/null +++ b/ext/standard/tests/array/uksort_variation2.phpt @@ -0,0 +1,224 @@ +--TEST-- +Test uksort() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for cmp_function + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( uksort($array_arg, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing uksort() : usage variation *** + +--int 0-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--int 1-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--int 12345-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--int -12345-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--float 10.5-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--float -10.5-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--float .5-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--empty array-- + +Warning: uksort() expects parameter 2 to be a valid callback, array must have exactly two members in %suksort_variation2.php on line %d +NULL + +--int indexed array-- + +Warning: uksort() expects parameter 2 to be a valid callback, array must have exactly two members in %suksort_variation2.php on line %d +NULL + +--associative array-- + +Warning: uksort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %suksort_variation2.php on line %d +NULL + +--nested arrays-- + +Warning: uksort() expects parameter 2 to be a valid callback, array must have exactly two members in %suksort_variation2.php on line %d +NULL + +--uppercase NULL-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--lowercase null-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--lowercase true-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--lowercase false-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--uppercase TRUE-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--uppercase FALSE-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--empty string DQ-- + +Warning: uksort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %suksort_variation2.php on line %d +NULL + +--empty string SQ-- + +Warning: uksort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %suksort_variation2.php on line %d +NULL + +--instance of classWithToString-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--undefined var-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--unset var-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/unexpected_array_mod_bug.phpt b/ext/standard/tests/array/unexpected_array_mod_bug.phpt new file mode 100644 index 0000000..58f2249 --- /dev/null +++ b/ext/standard/tests/array/unexpected_array_mod_bug.phpt @@ -0,0 +1,21 @@ +--TEST-- +Crash when function parameter modified via reference +--FILE-- + "entry_1", +2 => "entry_2", +3 => "entry_3", +4 => "entry_4", +5 => "entry_5"); +usort($my_var, "usercompare"); + +echo "Done.\n"; +?> +--EXPECTF-- + +Warning: usort(): Array was modified by the user comparison function in %s on line %d +Done. diff --git a/ext/standard/tests/array/usort_basic.phpt b/ext/standard/tests/array/usort_basic.phpt new file mode 100644 index 0000000..eaf3018 --- /dev/null +++ b/ext/standard/tests/array/usort_basic.phpt @@ -0,0 +1,119 @@ +--TEST-- +Test usort() function : basic functionality +--FILE-- + $value2) { + return 1; + } + else + return -1; +} + +// Int array with default keys +$int_values = array(1, 8, 9, 3, 2, 6, 7); + +echo "\n-- Numeric array with default keys --\n"; +var_dump( usort($int_values, 'cmp') ); +var_dump($int_values); + +// String array with default keys +$string_values = array("This", "is", 'a', "test"); + +echo "\n-- String array with default keys --\n"; +var_dump( usort($string_values, 'cmp') ); +var_dump($string_values); + +// Associative array with numeric keys +$numeric_key_arg = array(1=> 1, 2 => 2, 3 => 7, 5 => 4, 4 => 9); + +echo "\n-- Associative array with numeric keys --\n"; +var_dump( usort($numeric_key_arg, 'cmp') ); +var_dump($numeric_key_arg); + +// Associative array with string keys +$string_key_arg = array('one' => 4, 'two' => 2, 'three' => 1, 'four' => 10); + +echo "\n-- Associative array with string keys --\n"; +var_dump( usort($string_key_arg, 'cmp') ); +var_dump($string_key_arg); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : basic functionality *** + +-- Numeric array with default keys -- +bool(true) +array(7) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(6) + [4]=> + int(7) + [5]=> + int(8) + [6]=> + int(9) +} + +-- String array with default keys -- +bool(true) +array(4) { + [0]=> + string(4) "This" + [1]=> + string(1) "a" + [2]=> + string(2) "is" + [3]=> + string(4) "test" +} + +-- Associative array with numeric keys -- +bool(true) +array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(4) + [3]=> + int(7) + [4]=> + int(9) +} + +-- Associative array with string keys -- +bool(true) +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(4) + [3]=> + int(10) +} +===DONE=== diff --git a/ext/standard/tests/array/usort_error1.phpt b/ext/standard/tests/array/usort_error1.phpt new file mode 100644 index 0000000..70c555e --- /dev/null +++ b/ext/standard/tests/array/usort_error1.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test usort() function : error conditions - Pass incorrect number of arguments +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing usort() : error conditions *** + +-- Testing usort() function with more than expected no. of arguments -- + +Warning: usort() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing usort() function with less than expected no. of arguments -- + +Warning: usort() expects exactly 2 parameters, 1 given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_error2.phpt b/ext/standard/tests/array/usort_error2.phpt new file mode 100644 index 0000000..308199f --- /dev/null +++ b/ext/standard/tests/array/usort_error2.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test usort() function : error conditions - Pass unknown 'cmp_function' +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +// Initialize 'array_arg' +$array_arg = array(0 => 1, 1 => 10, 2 => 'string', 3 => 3, 4 => 2, 5 => 100, 6 => 25); +$extra_arg = 10; + +// With non existent comparison function +echo "\n-- Testing usort() function with non-existent compare function --\n"; +var_dump( usort($array_arg, 'non_existent') ); + +// With non existent comparison function and extra arguemnt +echo "\n-- Testing usort() function with non-existent compare function and extra argument --\n"; +var_dump( usort($array_arg, 'non_existent', $extra_arg) ); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : error conditions *** + +-- Testing usort() function with non-existent compare function -- + +Warning: usort() expects parameter 2 to be a valid callback, function 'non_existent' not found or invalid function name in %s on line %d +NULL + +-- Testing usort() function with non-existent compare function and extra argument -- + +Warning: usort() 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/array/usort_object1.phpt b/ext/standard/tests/array/usort_object1.phpt new file mode 100644 index 0000000..0e87443 --- /dev/null +++ b/ext/standard/tests/array/usort_object1.phpt @@ -0,0 +1,141 @@ +--TEST-- +Test usort() function : object functionality - different number of properties +--FILE-- + $value2) { + return 1; + } + else + return -1; +} + +// comparison function for SimpleClass2 objects which has more than one member +function multiple_cmp($value1, $value2) +{ + if($value1->getValue() == $value2->getValue()) + return 0; + else if($value1->getValue() > $value2->getValue()) + return 1; + else + return -1; +} + +// Simple class with single property +class SimpleClass1 +{ + private $int_value; + + public function __construct($value) { + $this->int_value = $value; + } +} + +// Simple class with more than one property +class SimpleClass2 +{ + private $int_value; + protected $float_value; + public $string_value; + public function __construct($int, $float, $str) { + $this->int_value = $int; + $this->float_value = $float; + $this->string_value = $str; + } + public function getValue() { + return $this->int_value; + } +} + +// array of SimpleClass objects with only one property +$array_arg = array( +0 => new SimpleClass1(10), +1 => new SimpleClass1(1), +2 => new SimpleClass1(100), +3 => new SimpleClass1(50) +); +var_dump( usort($array_arg, 'simple_cmp') ); +var_dump($array_arg); + +// array of SimpleClass objects having more than one properties +$array_arg = array( +0 => new SimpleClass2(2, 3.4, "mango"), +1 => new SimpleClass2(10, 1.2, "apple"), +2 => new SimpleClass2(5, 2.5, "orange"), +); +var_dump( usort($array_arg, 'multiple_cmp') ); +var_dump($array_arg); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : object functionality *** +bool(true) +array(4) { + [0]=> + object(SimpleClass1)#%d (1) { + ["int_value":"SimpleClass1":private]=> + int(1) + } + [1]=> + object(SimpleClass1)#%d (1) { + ["int_value":"SimpleClass1":private]=> + int(10) + } + [2]=> + object(SimpleClass1)#%d (1) { + ["int_value":"SimpleClass1":private]=> + int(50) + } + [3]=> + object(SimpleClass1)#%d (1) { + ["int_value":"SimpleClass1":private]=> + int(100) + } +} +bool(true) +array(3) { + [0]=> + object(SimpleClass2)#%d (3) { + ["int_value":"SimpleClass2":private]=> + int(2) + ["float_value":protected]=> + float(3.4) + ["string_value"]=> + string(5) "mango" + } + [1]=> + object(SimpleClass2)#%d (3) { + ["int_value":"SimpleClass2":private]=> + int(5) + ["float_value":protected]=> + float(2.5) + ["string_value"]=> + string(6) "orange" + } + [2]=> + object(SimpleClass2)#%d (3) { + ["int_value":"SimpleClass2":private]=> + int(10) + ["float_value":protected]=> + float(1.2) + ["string_value"]=> + string(5) "apple" + } +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_object2.phpt b/ext/standard/tests/array/usort_object2.phpt new file mode 100644 index 0000000..00d302f --- /dev/null +++ b/ext/standard/tests/array/usort_object2.phpt @@ -0,0 +1,165 @@ +--TEST-- +Test usort() function : object functionality - Different types of classes +--FILE-- + $value2) { + return 1; + } + else + return -1; +} + +// Class without any member +class EmptyClass +{ +} + +// Class with static member +class StaticClass +{ + public static $static_value; + public function __construct($value) { + StaticClass::$static_value = $value; + } +} + +// Abstract class +abstract class AbstractClass +{ + public $pub_value; + public abstract function abstractMethod(); +} + +// Child class extending abstract class +class ChildClass extends AbstractClass +{ + public $child_value = 100; + public function abstractMethod() { + $pub_value = 5; + } + public function __construct($value) { + $this->child_value = $value; + } +} + +// Testing uasort with StaticClass objects as elements of 'array_arg' +echo "-- Testing usort() with StaticClass objects --\n"; +$array_arg = array( + 0 => new StaticClass(20), + 1 => new StaticClass(50), + 2 => new StaticClass(15), + 3 => new StaticClass(70), +); +var_dump( usort($array_arg, 'cmp_function') ); +var_dump($array_arg); + +// Testing uasort with EmptyClass objects as elements of 'array_arg' +echo "-- Testing usort() with EmptyClass objects --\n"; +$array_arg = array( + 0 => new EmptyClass(), + 1 => new EmptyClass(), + 2 => new EmptyClass(), + 3 => new EmptyClass(), +); +var_dump( usort($array_arg, 'cmp_function') ); +var_dump($array_arg); + +// Testing uasort with ChildClass objects as elements of 'array_arg' +echo "-- Testing usort() with ChildClass objects --\n"; +$array_arg = array( + 0 => new ChildClass(20), + 1 => new ChildClass(500), + 2 => new ChildClass(15), + 3 => new ChildClass(700), +); +var_dump( usort($array_arg, 'cmp_function') ); +var_dump($array_arg); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : object functionality *** +-- Testing usort() with StaticClass objects -- +bool(true) +array(4) { + [0]=> + object(StaticClass)#%d (0) { + } + [1]=> + object(StaticClass)#%d (0) { + } + [2]=> + object(StaticClass)#%d (0) { + } + [3]=> + object(StaticClass)#%d (0) { + } +} +-- Testing usort() with EmptyClass objects -- +bool(true) +array(4) { + [0]=> + object(EmptyClass)#%d (0) { + } + [1]=> + object(EmptyClass)#%d (0) { + } + [2]=> + object(EmptyClass)#%d (0) { + } + [3]=> + object(EmptyClass)#%d (0) { + } +} +-- Testing usort() with ChildClass objects -- +bool(true) +array(4) { + [0]=> + object(ChildClass)#%d (2) { + ["child_value"]=> + int(15) + ["pub_value"]=> + NULL + } + [1]=> + object(ChildClass)#%d (2) { + ["child_value"]=> + int(20) + ["pub_value"]=> + NULL + } + [2]=> + object(ChildClass)#%d (2) { + ["child_value"]=> + int(500) + ["pub_value"]=> + NULL + } + [3]=> + object(ChildClass)#%d (2) { + ["child_value"]=> + int(700) + ["pub_value"]=> + NULL + } +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_variation1.phpt b/ext/standard/tests/array/usort_variation1.phpt new file mode 100644 index 0000000..73fdc08 --- /dev/null +++ b/ext/standard/tests/array/usort_variation1.phpt @@ -0,0 +1,236 @@ +--TEST-- +Test usort() function : usage variations - Pass different data types as $array_arg arg +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a class +class classA +{ + public function __toString() { + return "Class A object"; + } +} + +// heredoc string +$heredoc = << +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variations *** + +-- Iteration 1 -- + +Warning: usort() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: usort() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: usort() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: usort() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: usort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: usort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: usort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: usort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: usort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: usort() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: usort() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: usort() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: usort() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: usort() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: usort() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: usort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: usort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +bool(true) + +-- Iteration 19 -- + +Warning: usort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: usort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: usort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: usort() expects parameter 1 to be array, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: usort() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: usort() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: usort() expects parameter 1 to be array, resource given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_variation10.phpt b/ext/standard/tests/array/usort_variation10.phpt new file mode 100644 index 0000000..b343419 --- /dev/null +++ b/ext/standard/tests/array/usort_variation10.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test usort() function : usage variations - duplicate keys and values +--FILE-- + $value2) { + return 1; + } + else + return -1; +} + +// Array with duplicate string and integer keys and values +$array_arg = array(0 => 2, "a" => 8, "d" => 9, + 3 => 3, 5 => 2, "o" => 6, + "z" => -99, 0 => 1, "z" => 3); + +echo "\n-- Array with duplicate keys --\n"; +var_dump( usort($array_arg, 'cmp') ); +var_dump($array_arg); + +// Array with default and assigned keys +$array_arg = array(0 => "Banana", 1 => "Mango", "Orange", 2 => "Apple", "Pineapple"); + +echo "\n-- Array with default/assigned keys --\n"; +var_dump( usort($array_arg, 'cmp') ); +var_dump($array_arg); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Array with duplicate keys -- +bool(true) +array(7) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(3) + [4]=> + int(6) + [5]=> + int(8) + [6]=> + int(9) +} + +-- Array with default/assigned keys -- +bool(true) +array(4) { + [0]=> + string(5) "Apple" + [1]=> + string(6) "Banana" + [2]=> + string(5) "Mango" + [3]=> + string(9) "Pineapple" +} +===DONE=== diff --git a/ext/standard/tests/array/usort_variation2.phpt b/ext/standard/tests/array/usort_variation2.phpt new file mode 100644 index 0000000..70d2164 --- /dev/null +++ b/ext/standard/tests/array/usort_variation2.phpt @@ -0,0 +1,242 @@ +--TEST-- +Test usort() function : usage variations - Pass different data types as $cmp_function arg +--FILE-- + 1, 1 => -1, 2 => 3, 3 => 10, 4 => 4, 5 => 2, 6 => 8, 7 => 5); + +// Get an unset variable +$unset_var = 10; +unset ($unset_var); + +// Get resource variable +$fp = fopen(__FILE__,'r'); + +// different values for $cmp_function +$inputs = array( + + // int data +/*1*/ 0, + 1, + 12345, + -2345, + + // float data +/*5*/ 10.5, + -10.5, + 10.1234567e8, + 10.7654321E-8, + .5, + + // array data +/*10*/ array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data +/*15*/ NULL, + null, + + // boolean data +/*17*/ true, + false, + TRUE, + FALSE, + + // empty data +/*21*/ "", + '', + + // string data + "string", + 'string', + + // object data +/*25*/ new MyClass(), + + // resource data + $fp, + + // undefined data + @$undefined_var, + + // unset data +/*28*/ @$unset_var, +); + +// loop through each element of $inputs to check the behavior of usort() +$iterator = 1; +foreach($inputs as $input) { + echo "\n-- Iteration $iterator --\n"; + var_dump( usort($array_arg, $input) ); + $iterator++; +}; + +//closing resource +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Iteration 1 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: usort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: usort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: usort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: usort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: usort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: usort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: usort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: usort() expects parameter 2 to be a valid callback, function 'string' not found or invalid function name in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: usort() expects parameter 2 to be a valid callback, function 'string' not found or invalid function name in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 26 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 27 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 28 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_variation3.phpt b/ext/standard/tests/array/usort_variation3.phpt new file mode 100644 index 0000000..3758fe9 --- /dev/null +++ b/ext/standard/tests/array/usort_variation3.phpt @@ -0,0 +1,115 @@ +--TEST-- +Test usort() function : usage variations - diff. array values +--FILE-- + $value2) { + return -1; + } + else { + return 1; + } +} + +// different heredoc strings + +// single line heredoc string +$simple_heredoc = << 9, + 8.9 => 8, + 012 => 7, + 0x34 => 6, + + // string keys + 'key' => 5, //single quoted key + "two" => 4, //double quoted key + " " => 0, // space as key + + // bool keys + TRUE => 100, + FALSE => 25, + + // null keys + NULL => 35, + + // binary key + "a".chr(0)."b" => 45, + b"binary" => 30, + + //heredoc keys + $simple_heredoc => 75, + $multiline_heredoc => 200, + + // default key + 1, +); + +var_dump( usort($array_arg, 'cmp_function') ); +echo "\n-- Sorted array after usort() function call --\n"; +var_dump($array_arg); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** +bool(true) + +-- Sorted array after usort() function call -- +array(15) { + [0]=> + int(200) + [1]=> + int(100) + [2]=> + int(75) + [3]=> + int(45) + [4]=> + int(35) + [5]=> + int(30) + [6]=> + int(25) + [7]=> + int(9) + [8]=> + int(8) + [9]=> + int(7) + [10]=> + int(6) + [11]=> + int(5) + [12]=> + int(4) + [13]=> + int(1) + [14]=> + int(0) +} +===DONE=== diff --git a/ext/standard/tests/array/usort_variation4.phpt b/ext/standard/tests/array/usort_variation4.phpt new file mode 100644 index 0000000..4de45cc --- /dev/null +++ b/ext/standard/tests/array/usort_variation4.phpt @@ -0,0 +1,155 @@ +--TEST-- +Test usort() function : usage variations - numeric data +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +// Int array +$int_values = array(0 => 3, 1 => 2, 3 => 100, + 4 => 150, 5 => 25, 6 => 350, + 7 => 0, 8 => -3, 9 => -1200); + +echo "\n-- Sorting Integer array --\n"; +var_dump( usort($int_values, 'cmp_function') ); +var_dump($int_values); + +// Octal array +$octal_values = array(0 => 056, 1 => 023, 2 => 090, + 3 => 015, 4 => -045, 5 => 01, 6 => -078); + +echo "\n-- Sorting Octal array --\n"; +var_dump( usort($octal_values, 'cmp_function') ); +var_dump($octal_values); + +// Hexadecimal array +$hex_values = array(0 => 0xAE, 1 => 0x2B, 2 => 0X10, + 3 => -0xCF, 4 => 0X12, 5 => -0XF2); + +echo "\n-- Sorting Hex array --\n"; +var_dump( usort($hex_values, 'cmp_function') ); +var_dump($hex_values); + +// Float array +$float_values = array( 0 => 10.2, 1 => 2.4, 2 => -3.4, + 3 => 0, 4 => 0.5, 5 => 7.3e3, 6 => -9.34E-2); + +echo "\n-- Sorting Float array --\n"; +var_dump( usort($float_values, 'cmp_function') ); +var_dump($float_values); + +// empty array +$empty_array = array(); + +echo "\n-- Sorting empty array --\n"; +var_dump( usort($empty_array, 'cmp_function') ); +var_dump($empty_array); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Sorting Integer array -- +bool(true) +array(9) { + [0]=> + int(-1200) + [1]=> + int(-3) + [2]=> + int(0) + [3]=> + int(2) + [4]=> + int(3) + [5]=> + int(25) + [6]=> + int(100) + [7]=> + int(150) + [8]=> + int(350) +} + +-- Sorting Octal array -- +bool(true) +array(7) { + [0]=> + int(-37) + [1]=> + int(-7) + [2]=> + int(0) + [3]=> + int(1) + [4]=> + int(13) + [5]=> + int(19) + [6]=> + int(46) +} + +-- Sorting Hex array -- +bool(true) +array(6) { + [0]=> + int(-242) + [1]=> + int(-207) + [2]=> + int(16) + [3]=> + int(18) + [4]=> + int(43) + [5]=> + int(174) +} + +-- Sorting Float array -- +bool(true) +array(7) { + [0]=> + float(-3.4) + [1]=> + float(-0.0934) + [2]=> + int(0) + [3]=> + float(0.5) + [4]=> + float(2.4) + [5]=> + float(10.2) + [6]=> + float(7300) +} + +-- Sorting empty array -- +bool(true) +array(0) { +} +===DONE=== diff --git a/ext/standard/tests/array/usort_variation5.phpt b/ext/standard/tests/array/usort_variation5.phpt new file mode 100644 index 0000000..922321c --- /dev/null +++ b/ext/standard/tests/array/usort_variation5.phpt @@ -0,0 +1,143 @@ +--TEST-- +Test usort() function : usage variations - string data +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +// Different heredoc strings to be sorted +$empty_heredoc =<< ' ', 1 => 'test', 3 => 'Hello', 4 => 'HELLO', + 5 => '', 6 => '\t', 7 => '0', 8 => '123Hello', + 9 => '\'', 10 => '@#$%' +); + +echo "\n-- Sorting Single Quoted String values --\n"; +var_dump( usort($single_quoted_values, 'cmp_function') ); +var_dump($single_quoted_values); + +// Double quoted strings +$double_quoted_values = array( + 0 => " ", 1 => "test", 3 => "Hello", 4 => "HELLO", + 5 => "", 6 => "\t", 7 => "0", 8 => "123Hello", + 9 => "\"", 10 => "@#$%" +); + +echo "\n-- Sorting Double Quoted String values --\n"; +var_dump( usort($double_quoted_values, 'cmp_function') ); +var_dump($double_quoted_values); + +// Heredoc strings +$heredoc_values = array(0 => $empty_heredoc, 1 => $simple_heredoc1, + 2 => $simple_heredoc2, 3 => $multiline_heredoc); + +echo "\n-- Sorting Heredoc String values --\n"; +var_dump( usort($heredoc_values, 'cmp_function') ); +var_dump($heredoc_values); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Sorting Single Quoted String values -- +bool(true) +array(10) { + [0]=> + string(0) "" + [1]=> + string(1) " " + [2]=> + string(1) "'" + [3]=> + string(1) "0" + [4]=> + string(8) "123Hello" + [5]=> + string(4) "@#$%" + [6]=> + string(5) "HELLO" + [7]=> + string(5) "Hello" + [8]=> + string(2) "\t" + [9]=> + string(4) "test" +} + +-- Sorting Double Quoted String values -- +bool(true) +array(10) { + [0]=> + string(0) "" + [1]=> + string(1) " " + [2]=> + string(1) " " + [3]=> + string(1) """ + [4]=> + string(1) "0" + [5]=> + string(8) "123Hello" + [6]=> + string(4) "@#$%" + [7]=> + string(5) "HELLO" + [8]=> + string(5) "Hello" + [9]=> + string(4) "test" +} + +-- Sorting Heredoc String values -- +bool(true) +array(4) { + [0]=> + string(0) "" + [1]=> + string(7) "HEREDOC" + [2]=> + string(7) "Heredoc" + [3]=> + string(%d) "heredoc string with!@# and 123 +Test this!!!" +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_variation6.phpt b/ext/standard/tests/array/usort_variation6.phpt new file mode 100644 index 0000000..ab4b3d4 --- /dev/null +++ b/ext/standard/tests/array/usort_variation6.phpt @@ -0,0 +1,139 @@ +--TEST-- +Test usort() function : usage variations - multi-dimensional arrays +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +$array_args = array( + 0 => array(2, 10, -1), + 1 => array(100), + 2 => array(), + 3 => array(0), + 4 => array(-1), + 5 => array(-9, 34, 54, 0, 20), + 6 => array(''), + 7 => array("apple", "Apple", "APPLE", "aPPle", "aPpLe") +); + +$temp_array = $array_args; + +echo "\n-- Pass usort() a two-dimensional array --\n"; +// sorting array_arg as whole array +var_dump( usort($temp_array, 'cmp_function') ); + +echo "-- Array after call to usort() --\n"; +var_dump($temp_array); + +echo "\n-- Pass usort() a sub-array --\n"; +var_dump( usort($array_args[5], 'cmp_function') ); + +echo "-- Array after call to usort() --\n"; +var_dump($array_args[5]); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Pass usort() a two-dimensional array -- +bool(true) +-- Array after call to usort() -- +array(8) { + [0]=> + array(0) { + } + [1]=> + array(1) { + [0]=> + int(-1) + } + [2]=> + array(1) { + [0]=> + string(0) "" + } + [3]=> + array(1) { + [0]=> + int(0) + } + [4]=> + array(1) { + [0]=> + int(100) + } + [5]=> + array(3) { + [0]=> + int(2) + [1]=> + int(10) + [2]=> + int(-1) + } + [6]=> + array(5) { + [0]=> + int(-9) + [1]=> + int(34) + [2]=> + int(54) + [3]=> + int(0) + [4]=> + int(20) + } + [7]=> + array(5) { + [0]=> + string(5) "apple" + [1]=> + string(5) "Apple" + [2]=> + string(5) "APPLE" + [3]=> + string(5) "aPPle" + [4]=> + string(5) "aPpLe" + } +} + +-- Pass usort() a sub-array -- +bool(true) +-- Array after call to usort() -- +array(5) { + [0]=> + int(-9) + [1]=> + int(0) + [2]=> + int(20) + [3]=> + int(34) + [4]=> + int(54) +} +===DONE=== diff --git a/ext/standard/tests/array/usort_variation7.phpt b/ext/standard/tests/array/usort_variation7.phpt new file mode 100644 index 0000000..e567341 --- /dev/null +++ b/ext/standard/tests/array/usort_variation7.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test usort() function : usage variations - Anonymous comparison function +--FILE-- + $value2) {return 1;} else{return -1;}'; + +$array_arg = array(0 => 100, 1 => 3, 2 => -70, 3 => 24, 4 => 90); + +echo "\n-- Anonymous 'cmp_function' with parameters passed by value --\n"; +var_dump( usort($array_arg, create_function('$value1, $value2',$cmp_function) ) ); +var_dump($array_arg); + +$array_arg = array("b" => "Banana", "m" => "Mango", "a" => "Apple", "p" => "Pineapple"); + +echo "\n-- Anonymous 'cmp_function' with parameters passed by reference --\n"; +var_dump( usort($array_arg, create_function('&$value1, &$value2', $cmp_function) ) ); +var_dump($array_arg); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Anonymous 'cmp_function' with parameters passed by value -- +bool(true) +array(5) { + [0]=> + int(-70) + [1]=> + int(3) + [2]=> + int(24) + [3]=> + int(90) + [4]=> + int(100) +} + +-- Anonymous 'cmp_function' with parameters passed by reference -- +bool(true) +array(4) { + [0]=> + string(5) "Apple" + [1]=> + string(6) "Banana" + [2]=> + string(5) "Mango" + [3]=> + string(9) "Pineapple" +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_variation8.phpt b/ext/standard/tests/array/usort_variation8.phpt new file mode 100644 index 0000000..87107f8 --- /dev/null +++ b/ext/standard/tests/array/usort_variation8.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test usort() function : usage variations - use built in functions as $cmp_function arg +--FILE-- + "Banana", "m" => "Mango", "a" => "apple", + "p" => "Pineapple", "o" => "orange"); + +// Testing library functions as comparison function +echo "\n-- Testing usort() with built-in 'cmp_function': strcasecmp() --\n"; +$temp_array1 = $array_arg; +var_dump( usort($temp_array1, 'strcasecmp') ); +var_dump($temp_array1); + +echo "\n-- Testing usort() with built-in 'cmp_function': strcmp() --\n"; +$temp_array2 = $array_arg; +var_dump( usort($temp_array2, 'strcmp') ); +var_dump($temp_array2); + +// Testing with language construct as comparison function +echo "\n-- Testing usort() with language construct as 'cmp_function' --\n"; +$temp_array3 = $array_arg; +var_dump( usort($temp_array3, 'echo') ); + +echo "\n-- Testing usort() with language construct as 'cmp_function' --\n"; +$temp_array4 = $array_arg; +var_dump( usort($temp_array4, 'exit') ); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Testing usort() with built-in 'cmp_function': strcasecmp() -- +bool(true) +array(5) { + [0]=> + string(5) "apple" + [1]=> + string(6) "Banana" + [2]=> + string(5) "Mango" + [3]=> + string(6) "orange" + [4]=> + string(9) "Pineapple" +} + +-- Testing usort() with built-in 'cmp_function': strcmp() -- +bool(true) +array(5) { + [0]=> + string(6) "Banana" + [1]=> + string(5) "Mango" + [2]=> + string(9) "Pineapple" + [3]=> + string(5) "apple" + [4]=> + string(6) "orange" +} + +-- Testing usort() with language construct as 'cmp_function' -- + +Warning: usort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d +NULL + +-- Testing usort() with language construct as 'cmp_function' -- + +Warning: usort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_variation9.phpt b/ext/standard/tests/array/usort_variation9.phpt new file mode 100644 index 0000000..6a06799 --- /dev/null +++ b/ext/standard/tests/array/usort_variation9.phpt @@ -0,0 +1,66 @@ +--TEST-- +Test usort() function : usage variations - referenced variables +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +// different variables which are used as elements of $array_arg +$value1 = -5; +$value2 = 100; +$value3 = 0; +$value4 = &$value1; + +// array_args an array containing elements with reference variables +$array_arg = array( + 0 => 10, + 1 => &$value4, + 2 => &$value2, + 3 => 200, + 4 => &$value3, +); + +echo "\n-- Sorting \$array_arg containing different references --\n"; +var_dump( usort($array_arg, 'cmp_function') ); +var_dump($array_arg); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Sorting $array_arg containing different references -- +bool(true) +array(5) { + [0]=> + &int(-5) + [1]=> + &int(0) + [2]=> + int(10) + [3]=> + &int(100) + [4]=> + int(200) +} +===DONE=== diff --git a/ext/standard/tests/array/var_export.phpt b/ext/standard/tests/array/var_export.phpt new file mode 100644 index 0000000..8caf407 --- /dev/null +++ b/ext/standard/tests/array/var_export.phpt @@ -0,0 +1,13 @@ +--TEST-- +var_export() and objects with numeric indexes properties +--FILE-- + "bar"); +var_export($a); +?> +--EXPECT-- +stdClass::__set_state(array( + 0 => 1, + 1 => 3, + 'foo' => 'bar', +)) diff --git a/ext/standard/tests/array/var_export2.phpt b/ext/standard/tests/array/var_export2.phpt new file mode 100644 index 0000000..6db44d5 --- /dev/null +++ b/ext/standard/tests/array/var_export2.phpt @@ -0,0 +1,13 @@ +--TEST-- +var_export() and empty array keys +--FILE-- + 'null', "" => 'empty', "0" => 'nul'); +var_export($a); +?> +--EXPECT-- +array ( + '' . "\0" . '' => 'null', + '' => 'empty', + 0 => 'nul', +) diff --git a/ext/standard/tests/array/var_export3.phpt b/ext/standard/tests/array/var_export3.phpt new file mode 100644 index 0000000..6d39946 --- /dev/null +++ b/ext/standard/tests/array/var_export3.phpt @@ -0,0 +1,24 @@ +--TEST-- +var_export() and classes +--FILE-- +mann = 42; + $this->kvinne = 43; + } +} + +$kake = new kake; + +var_export($kake); +?> +--EXPECT-- +kake::__set_state(array( + 'mann' => 42, + 'kvinne' => 43, +)) diff --git a/ext/standard/tests/assert/assert.phpt b/ext/standard/tests/assert/assert.phpt new file mode 100644 index 0000000..44fb609 --- /dev/null +++ b/ext/standard/tests/assert/assert.phpt @@ -0,0 +1,44 @@ +--TEST-- +assert() +--INI-- +error_reporting = 2039 +assert.active = 0 +assert.warning = 1 +assert.callback = +assert.bail = 0 +assert.quiet_eval = 0 +--FILE-- + +--EXPECT-- +assertion failed 22,"$a != 0" +class assertion failed 25,"$a != 0" +class assertion failed 29,"$a != 0" diff --git a/ext/standard/tests/assert/assert02.phpt b/ext/standard/tests/assert/assert02.phpt new file mode 100644 index 0000000..723eeb9 --- /dev/null +++ b/ext/standard/tests/assert/assert02.phpt @@ -0,0 +1,48 @@ +--TEST-- +catch assert() errors +--INI-- +assert.active=1 +assert.warning=1 +assert.callback= +assert.bail=0 +assert.quiet_eval=0 +--FILE-- + +--EXPECTF-- +Notice: Undefined variable: a in %sassert02.php(12) : assert code on line 1 + +Warning: assert(): Assertion "$a" failed in %sassert02.php on line 12 + +Parse error: %s error%sin %sassert02.php(14) : assert code on line 1 +in handler() +%string|unicode%(%d) "assert(): Failure evaluating code: +aa=sd+as+safsafasfasafsaf" + +Warning: assert(): Assertion "0" failed in %sassert02.php on line 16 + +Parse error: %s error%sin %sassert02.php(19) : assert code on line 1 +in handler() +%string|unicode%(%d) "assert(): Failure evaluating code: +aa=sd+as+safsafasfasafsaf" diff --git a/ext/standard/tests/assert/assert03.phpt b/ext/standard/tests/assert/assert03.phpt new file mode 100644 index 0000000..d839414 --- /dev/null +++ b/ext/standard/tests/assert/assert03.phpt @@ -0,0 +1,39 @@ +--TEST-- +assert() - set callback using ini_set() +--INI-- +assert.active = 1 +assert.warning = 0 +assert.callback = +assert.bail = 0 +assert.quiet_eval = 1 +--FILE-- + +==DONE== +--EXPECTF-- +assertion failed - a - %d,"$a != 0" +assertion failed - b - %d,"$a != 0" +==DONE== diff --git a/ext/standard/tests/assert/assert04.phpt b/ext/standard/tests/assert/assert04.phpt new file mode 100644 index 0000000..bffadcb --- /dev/null +++ b/ext/standard/tests/assert/assert04.phpt @@ -0,0 +1,48 @@ +--TEST-- +misc assert() tests tests +--INI-- +assert.active = 1 +assert.warning = 1 +assert.callback = +assert.bail = 0 +assert.quiet_eval = 0 +--FILE-- + +--EXPECTF-- +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 long, %unicode_string_optional% given in %s on line %d + +Warning: assert(): Assertion failed in %s on line %d + +Warning: assert(): Assertion failed in %s on line %d + diff --git a/ext/standard/tests/assert/assert_basic.phpt b/ext/standard/tests/assert/assert_basic.phpt new file mode 100644 index 0000000..ea58e9f --- /dev/null +++ b/ext/standard/tests/assert/assert_basic.phpt @@ -0,0 +1,30 @@ +--TEST-- +assert() - basic - check that assert runs when assert.active is set to 1. +--INI-- +assert.active = 1 +assert.warning = 0 +assert.callback = f1 +assert.bail = 0 +assert.quiet_eval = 0 +--FILE-- + +--EXPECTF-- +string(2) "f1" +f1 called + +Warning: assert(): Assertion failed in %s on line 13 +string(2) "f1" +string(2) "f2" +f2 called + +Warning: assert(): Assertion failed in %s on line 17 diff --git a/ext/standard/tests/assert/assert_basic3.phpt b/ext/standard/tests/assert/assert_basic3.phpt new file mode 100644 index 0000000..0ce3266 --- /dev/null +++ b/ext/standard/tests/assert/assert_basic3.phpt @@ -0,0 +1,25 @@ +--TEST-- +assert() - basic - Test that bailout works +--INI-- +assert.active = 1 +assert.warning = 1 +assert.callback = f1 +assert.quiet_eval = 1 +assert.bail = 0 +--FILE-- + [".assert_options(ASSERT_ACTIVE)."]\n"; +echo "Initial values: assert_options(ASSERT_WARNING) => [".assert_options(ASSERT_WARNING)."]\n"; +echo "Initial values: assert_options(ASSERT_BAIL) => [".assert_options(ASSERT_BAIL)."]\n"; +echo "Initial values: assert_options(ASSERT_QUIET_EVAL) => [".assert_options(ASSERT_QUIET_EVAL)."]\n"; +echo "Initial values: assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; + +//Using ini.get; +echo "Initial values: ini.get(\"assert.active\") => [".ini_get("assert.active")."]\n"; +echo "Initial values: ini.get(\"assert.warning\") => [".ini_get("assert.warning")."]\n"; +echo "Initial values: ini.get(\"assert.bail\") => [".ini_get("assert.bail")."]\n"; +echo "Initial values: ini.get(\"assert.quiet_eval\") => [".ini_get("assert.quiet_eval")."]\n"; +echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; + +--EXPECTF-- +Initial values: assert_options(ASSERT_ACTIVE) => [0] +Initial values: assert_options(ASSERT_WARNING) => [0] +Initial values: assert_options(ASSERT_BAIL) => [0] +Initial values: assert_options(ASSERT_QUIET_EVAL) => [0] +Initial values: assert_options(ASSERT_CALLBACK) => [f1] +Initial values: ini.get("assert.active") => [0] +Initial values: ini.get("assert.warning") => [0] +Initial values: ini.get("assert.bail") => [0] +Initial values: ini.get("assert.quiet_eval") => [0] +Initial values: ini.get("assert.callback") => [f1] diff --git a/ext/standard/tests/assert/assert_basic5.phpt b/ext/standard/tests/assert/assert_basic5.phpt new file mode 100644 index 0000000..737f902 --- /dev/null +++ b/ext/standard/tests/assert/assert_basic5.phpt @@ -0,0 +1,32 @@ +--TEST-- +assert() - basic - check switch on warnings using assert_options. +--INI-- +assert.active = 1 +assert.warning = 0 +assert.callback = f1 +assert.bail = 0 +assert.quiet_eval = 0 +--FILE-- + +--EXPECTF-- +Hello World! + +Warning: assert(): Assertion failed in %s on line %d diff --git a/ext/standard/tests/assert/assert_error.phpt b/ext/standard/tests/assert/assert_error.phpt new file mode 100644 index 0000000..28655be --- /dev/null +++ b/ext/standard/tests/assert/assert_error.phpt @@ -0,0 +1,27 @@ +--TEST-- +assert() - error - give assert nonsense string with quiet_eval on then off +--INI-- +assert.active = 1 +assert.warning = 1 +assert.callback = f1 +assert.bail = 0 +assert.quiet_eval = 0 +--FILE-- + [".assert_options(ASSERT_CALLBACK)."]\n"; +echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; +$sa = "0 != 0"; +var_dump($r2=assert($sa)); +echo"\n"; + +echo "Change callback function using ini.set and test return value \n"; +var_dump($rv = ini_set("assert.callback","f2")); +echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; +echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; +var_dump($r2=assert($sa)); +echo"\n"; + +echo "Change callback function using assert_options and test return value \n"; +var_dump($rv=assert_options(ASSERT_CALLBACK, "f3")); +echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; +echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; +var_dump($r2=assert($sa)); +echo"\n"; + + +echo "Reset the name of the callback routine to a class method and check that it works\n"; +var_dump($rc=assert_options(ASSERT_CALLBACK, "c1")); +echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; +echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; +var_dump($r2=assert($sa)); +echo"\n"; + +echo "Reset callback options to use a class method \n"; +var_dump($rc = assert_options(ASSERT_CALLBACK,array("c1","assert"))); +var_dump($rao=assert_options(ASSERT_CALLBACK)); +echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; +var_dump($r2=assert($sa)); +echo"\n"; + +echo "Reset callback options to use an object method \n"; +$o = new c1(); +var_dump($rc=assert_options(ASSERT_CALLBACK,array(&$o,"assert"))); +var_dump($rao=assert_options(ASSERT_CALLBACK)); +echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; +var_dump($r2=assert($sa)); +echo"\n"; + +--EXPECTF-- +Initial values: assert_options(ASSERT_CALLBACK) => [f1] +Initial values: ini.get("assert.callback") => [f1] +f1 called +NULL + +Change callback function using ini.set and test return value +string(2) "f1" +assert_options(ASSERT_CALLBACK) => [f2] +ini.get("assert.callback") => [f2] +f2 called +NULL + +Change callback function using assert_options and test return value +string(2) "f2" +assert_options(ASSERT_CALLBACK) => [f3] +ini.get("assert.callback") => [f2] +f3 called +NULL + +Reset the name of the callback routine to a class method and check that it works +string(2) "f3" +assert_options(ASSERT_CALLBACK) => [c1] +ini.get("assert.callback") => [f2] +NULL + +Reset callback options to use a class method +string(2) "c1" +array(2) { + [0]=> + string(2) "c1" + [1]=> + string(6) "assert" +} +ini.get("assert.callback") => [f2] + + +Strict Standards: Non-static method c1::assert() should not be called statically in %s on line 53 +Class assertion failed 53, "0 != 0" +NULL + +Reset callback options to use an object method +array(2) { + [0]=> + string(2) "c1" + [1]=> + string(6) "assert" +} +array(2) { + [0]=> + &object(c1)#1 (0) { + } + [1]=> + string(6) "assert" +} +ini.get("assert.callback") => [f2] + +Class assertion failed 61, "0 != 0" +NULL diff --git a/ext/standard/tests/bug49244.phpt b/ext/standard/tests/bug49244.phpt new file mode 100644 index 0000000..1ba24fb --- /dev/null +++ b/ext/standard/tests/bug49244.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #49244 (Floating point NaN cause garbage characters) +--FILE-- + +--EXPECT-- +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN +{NaN} NaN diff --git a/ext/standard/tests/class_object/AutoInterface.inc b/ext/standard/tests/class_object/AutoInterface.inc new file mode 100644 index 0000000..f1e5b1f --- /dev/null +++ b/ext/standard/tests/class_object/AutoInterface.inc @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/ext/standard/tests/class_object/AutoLoaded.inc b/ext/standard/tests/class_object/AutoLoaded.inc new file mode 100644 index 0000000..52e6671 --- /dev/null +++ b/ext/standard/tests/class_object/AutoLoaded.inc @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/ext/standard/tests/class_object/AutoTest.inc b/ext/standard/tests/class_object/AutoTest.inc new file mode 100644 index 0000000..0627096 --- /dev/null +++ b/ext/standard/tests/class_object/AutoTest.inc @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/ext/standard/tests/class_object/AutoTrait.inc b/ext/standard/tests/class_object/AutoTrait.inc new file mode 100644 index 0000000..698e975 --- /dev/null +++ b/ext/standard/tests/class_object/AutoTrait.inc @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/ext/standard/tests/class_object/class_exists_basic_001.phpt b/ext/standard/tests/class_object/class_exists_basic_001.phpt new file mode 100644 index 0000000..4cb6cbd --- /dev/null +++ b/ext/standard/tests/class_object/class_exists_basic_001.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test class_exists() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing class_exists() : basic functionality *** +Calling class_exists() on non-existent class with autoload explicitly enabled: +In __autoload(C) +bool(false) + +Calling class_exists() on existing class with autoload explicitly enabled: +bool(true) + +Calling class_exists() on non-existent class with autoload explicitly enabled: +bool(false) + +Calling class_exists() on existing class with autoload explicitly disabled: +bool(true) + +Calling class_exists() on non-existent class with autoload unspecified: +In __autoload(E) +bool(false) + +Calling class_exists() on existing class with autoload unspecified: +bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/class_exists_error_001.phpt b/ext/standard/tests/class_object/class_exists_error_001.phpt new file mode 100644 index 0000000..99c0b89 --- /dev/null +++ b/ext/standard/tests/class_object/class_exists_error_001.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test class_exists() function : error conditions (wrong number of arguments) +--FILE-- + +--EXPECTF-- +*** Testing class_exists() : error conditions *** + +-- Testing class_exists() function with Zero arguments -- + +Warning: class_exists() expects at least 1 parameter, 0 given in %s on line 16 +NULL + +-- Testing class_exists() function with more than expected no. of arguments -- + +Warning: class_exists() expects at most 2 parameters, 3 given in %s on line 23 +NULL +Done diff --git a/ext/standard/tests/class_object/class_exists_variation_001.phpt b/ext/standard/tests/class_object/class_exists_variation_001.phpt new file mode 100644 index 0000000..c9146ba --- /dev/null +++ b/ext/standard/tests/class_object/class_exists_variation_001.phpt @@ -0,0 +1,187 @@ +--TEST-- +Test class_exists() function : usage variations - unexpected types for agument 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for classname + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( class_exists($value, $autoload) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing class_exists() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(67) +Error: 8 - Undefined variable: unset_var, %s(70) + +Arg value 0 +In __autoload(0) +bool(false) + +Arg value 1 +In __autoload(1) +bool(false) + +Arg value 12345 +In __autoload(12345) +bool(false) + +Arg value -2345 +In __autoload(-2345) +bool(false) + +Arg value 10.5 +In __autoload(10.5) +bool(false) + +Arg value -10.5 +In __autoload(-10.5) +bool(false) + +Arg value 101234567000 +In __autoload(101234567000) +bool(false) + +Arg value 1.07654321E-9 +In __autoload(1.07654321E-9) +bool(false) + +Arg value 0.5 +In __autoload(0.5) +bool(false) +Error: 8 - Array to string conversion, %sclass_exists_variation_001.php(%d) + +Arg value Array +Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %sclass_exists_variation_001.php(%d) + +Arg value Array +Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %sclass_exists_variation_001.php(%d) + +Arg value Array +Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %sclass_exists_variation_001.php(%d) + +Arg value Array +Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %sclass_exists_variation_001.php(%d) + +Arg value Array +Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77) +NULL + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +In __autoload(1) +bool(false) + +Arg value +bool(false) + +Arg value 1 +In __autoload(1) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(76) + +Arg value +Error: 2 - class_exists() expects parameter 1 to be string, object given, %s(77) +NULL + +Arg value +bool(false) + +Arg value +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/class_exists_variation_002.phpt b/ext/standard/tests/class_object/class_exists_variation_002.phpt new file mode 100644 index 0000000..ae9de15 --- /dev/null +++ b/ext/standard/tests/class_object/class_exists_variation_002.phpt @@ -0,0 +1,198 @@ +--TEST-- +Test class_exists() function : usage variations - unexpected types for agument 2 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for autoload + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( class_exists($classname, $value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing class_exists() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(71) +Error: 8 - Undefined variable: unset_var, %s(74) + +Arg value 0 +bool(false) + +Arg value 1 +In __autoload(string_val) +bool(false) + +Arg value 12345 +In __autoload(string_val) +bool(false) + +Arg value -2345 +In __autoload(string_val) +bool(false) + +Arg value 10.5 +In __autoload(string_val) +bool(false) + +Arg value -10.5 +In __autoload(string_val) +bool(false) + +Arg value 101234567000 +In __autoload(string_val) +bool(false) + +Arg value 1.07654321E-9 +In __autoload(string_val) +bool(false) + +Arg value 0.5 +In __autoload(string_val) +bool(false) +Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - class_exists() expects parameter 2 to be boolean, array given, %s(81) +NULL +Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - class_exists() expects parameter 2 to be boolean, array given, %s(81) +NULL +Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - class_exists() expects parameter 2 to be boolean, array given, %s(81) +NULL +Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - class_exists() expects parameter 2 to be boolean, array given, %s(81) +NULL +Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - class_exists() expects parameter 2 to be boolean, array given, %s(81) +NULL + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +In __autoload(string_val) +bool(false) + +Arg value +bool(false) + +Arg value 1 +In __autoload(string_val) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value string +In __autoload(string_val) +bool(false) + +Arg value string +In __autoload(string_val) +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(80) + +Arg value +Error: 2 - class_exists() expects parameter 2 to be boolean, object given, %s(81) +NULL + +Arg value +bool(false) + +Arg value +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/class_exists_variation_003.phpt b/ext/standard/tests/class_object/class_exists_variation_003.phpt new file mode 100644 index 0000000..0745601 --- /dev/null +++ b/ext/standard/tests/class_object/class_exists_variation_003.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test class_exists() function : usage variations - case sensitivity +--FILE-- + +--EXPECTF-- +bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/forward_static_call_001.phpt b/ext/standard/tests/class_object/forward_static_call_001.phpt new file mode 100644 index 0000000..2b3a8dd --- /dev/null +++ b/ext/standard/tests/class_object/forward_static_call_001.phpt @@ -0,0 +1,83 @@ +--TEST-- +forward_static_call() called from outside of a method. +--FILE-- + +===DONE=== +--EXPECTF-- +A +- +B +B +- +B +B +B +- +B +B +- +C +C +- +B +B +C +- +B +C +===DONE=== diff --git a/ext/standard/tests/class_object/forward_static_call_002.phpt b/ext/standard/tests/class_object/forward_static_call_002.phpt new file mode 100644 index 0000000..58c4efd --- /dev/null +++ b/ext/standard/tests/class_object/forward_static_call_002.phpt @@ -0,0 +1,21 @@ +--TEST-- +forward_static_call() from outside of a class method. +--FILE-- + +--EXPECTF-- +Fatal error: Cannot call forward_static_call() when no class scope is active in %s on line %d diff --git a/ext/standard/tests/class_object/forward_static_call_003.phpt b/ext/standard/tests/class_object/forward_static_call_003.phpt new file mode 100644 index 0000000..2ea102e --- /dev/null +++ b/ext/standard/tests/class_object/forward_static_call_003.phpt @@ -0,0 +1,51 @@ +--TEST-- +forward_static_call() calling outside of the inheritance chain. +--FILE-- + +===DONE=== +--EXPECTF-- +A +- +B +B +- +C +B +B +===DONE=== diff --git a/ext/standard/tests/class_object/get_class_error_001.phpt b/ext/standard/tests/class_object/get_class_error_001.phpt new file mode 100644 index 0000000..5550995 --- /dev/null +++ b/ext/standard/tests/class_object/get_class_error_001.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test get_class() function : error conditions - wrong number of arguments. +--FILE-- + +--EXPECTF-- +*** Testing get_class() : error conditions *** + +-- Testing get_class() function with more than expected no. of arguments -- + +Warning: get_class() expects at most 1 parameter, 2 given in %s on line 14 +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_class_methods_basic_001.phpt b/ext/standard/tests/class_object/get_class_methods_basic_001.phpt new file mode 100644 index 0000000..b2b87af --- /dev/null +++ b/ext/standard/tests/class_object/get_class_methods_basic_001.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test get_class_methods() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing get_class_methods() : basic functionality *** +Argument is class name: +array(3) { + [0]=> + string(1) "f" + [1]=> + string(1) "g" + [2]=> + string(1) "h" +} +Argument is class instance: +array(3) { + [0]=> + string(1) "f" + [1]=> + string(1) "g" + [2]=> + string(1) "h" +} +Argument is name of class which has no methods: +array(0) { +} +Argument is non existent class: +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_class_methods_basic_002.phpt b/ext/standard/tests/class_object/get_class_methods_basic_002.phpt new file mode 100644 index 0000000..441bb45 --- /dev/null +++ b/ext/standard/tests/class_object/get_class_methods_basic_002.phpt @@ -0,0 +1,178 @@ +--TEST-- +Test get_class_methods() function : basic functionality +--FILE-- + +--EXPECTF-- +Accessing D from global scope: +array(4) { + [0]=> + string(4) "pubD" + [1]=> + string(9) "testFromD" + [2]=> + string(4) "pubC" + [3]=> + string(9) "testFromC" +} +Accessing C from C: +array(4) { + [0]=> + string(5) "privC" + [1]=> + string(5) "protC" + [2]=> + string(4) "pubC" + [3]=> + string(9) "testFromC" +} +Accessing D from C: +array(7) { + [0]=> + string(5) "protD" + [1]=> + string(4) "pubD" + [2]=> + string(9) "testFromD" + [3]=> + string(5) "privC" + [4]=> + string(5) "protC" + [5]=> + string(4) "pubC" + [6]=> + string(9) "testFromC" +} +Accessing X from C: +array(2) { + [0]=> + string(4) "pubX" + [1]=> + string(9) "testFromX" +} +Accessing C from D: +array(3) { + [0]=> + string(5) "protC" + [1]=> + string(4) "pubC" + [2]=> + string(9) "testFromC" +} +Accessing D from D: +array(7) { + [0]=> + string(5) "privD" + [1]=> + string(5) "protD" + [2]=> + string(4) "pubD" + [3]=> + string(9) "testFromD" + [4]=> + string(5) "protC" + [5]=> + string(4) "pubC" + [6]=> + string(9) "testFromC" +} +Accessing X from D: +array(2) { + [0]=> + string(4) "pubX" + [1]=> + string(9) "testFromX" +} +Accessing C from X: +array(2) { + [0]=> + string(4) "pubC" + [1]=> + string(9) "testFromC" +} +Accessing D from X: +array(4) { + [0]=> + string(4) "pubD" + [1]=> + string(9) "testFromD" + [2]=> + string(4) "pubC" + [3]=> + string(9) "testFromC" +} +Accessing X from X: +array(4) { + [0]=> + string(5) "privX" + [1]=> + string(5) "protX" + [2]=> + string(4) "pubX" + [3]=> + string(9) "testFromX" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_class_methods_basic_003.phpt b/ext/standard/tests/class_object/get_class_methods_basic_003.phpt new file mode 100644 index 0000000..b64f702 --- /dev/null +++ b/ext/standard/tests/class_object/get_class_methods_basic_003.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test get_class_methods() function : basic functionality +--FILE-- + +--EXPECTF-- +Accessing I from global scope: +array(1) { + [0]=> + string(4) "pubI" +} +Accessing C from global scope: +array(3) { + [0]=> + string(4) "pubI" + [1]=> + string(4) "pubC" + [2]=> + string(9) "testFromC" +} +Accessing I from C: +array(1) { + [0]=> + string(4) "pubI" +} +Accessing C from C: +array(5) { + [0]=> + string(4) "pubI" + [1]=> + string(5) "privC" + [2]=> + string(5) "protC" + [3]=> + string(4) "pubC" + [4]=> + string(9) "testFromC" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_class_methods_error_001.phpt b/ext/standard/tests/class_object/get_class_methods_error_001.phpt new file mode 100644 index 0000000..e606ab6 --- /dev/null +++ b/ext/standard/tests/class_object/get_class_methods_error_001.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test get_class_methods() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing get_class_methods() : error conditions *** + +-- Testing get_class_methods() function with Zero arguments -- + +Warning: get_class_methods() expects exactly 1 parameter, 0 given in %s on line 16 +NULL + +-- Testing get_class_methods() function with more than expected no. of arguments -- + +Warning: get_class_methods() expects exactly 1 parameter, 2 given in %s on line 22 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt new file mode 100644 index 0000000..8cdef12 --- /dev/null +++ b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt @@ -0,0 +1,177 @@ +--TEST-- +Test get_class_methods() function : usage variations - unexpected types +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for class + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( get_class_methods($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing get_class_methods() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(67) +Error: 8 - Undefined variable: unset_var, %s(70) + +Arg value 0 +NULL + +Arg value 1 +NULL + +Arg value 12345 +NULL + +Arg value -2345 +NULL + +Arg value 10.5 +NULL + +Arg value -10.5 +NULL + +Arg value 101234567000 +NULL + +Arg value 1.07654321E-9 +NULL + +Arg value 0.5 +NULL +Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d) + +Arg value Array +NULL +Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d) + +Arg value Array +NULL +Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d) + +Arg value Array +NULL +Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d) + +Arg value Array +NULL +Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d) + +Arg value Array +NULL + +Arg value +NULL + +Arg value +NULL + +Arg value 1 +NULL + +Arg value +NULL + +Arg value 1 +NULL + +Arg value +NULL + +Arg value +NULL + +Arg value +NULL + +Arg value string +NULL + +Arg value string +NULL +Error: 4096 - Object of class stdClass could not be converted to string, %s(76) + +Arg value +array(0) { +} + +Arg value +NULL + +Arg value +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_class_methods_variation_002.phpt b/ext/standard/tests/class_object/get_class_methods_variation_002.phpt new file mode 100644 index 0000000..60b944c --- /dev/null +++ b/ext/standard/tests/class_object/get_class_methods_variation_002.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test get_class_methods() function : usage variations - case sensitivity +--FILE-- + +--EXPECTF-- +*** Testing get_class_methods() : usage variations *** +array(1) { + [0]=> + string(8) "MyMeThOd" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_class_variation_001.phpt b/ext/standard/tests/class_object/get_class_variation_001.phpt new file mode 100644 index 0000000..2baef2e --- /dev/null +++ b/ext/standard/tests/class_object/get_class_variation_001.phpt @@ -0,0 +1,212 @@ +--TEST-- +Test get_class() function : usage variations - passing unexpected types. +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for object + +foreach($values as $value) { + echo @"\nArg value: $value (type: " . gettype($value) . ")\n"; + var_dump( get_class($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing get_class() : usage variations *** + +Notice: Undefined variable: undefined_var in %sget_class_variation_001.php on line 58 + +Notice: Undefined variable: unset_var in %sget_class_variation_001.php on line 61 + +Arg value: 0 (type: integer) + +Warning: get_class() expects parameter 1 to be object, integer given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: 1 (type: integer) + +Warning: get_class() expects parameter 1 to be object, integer given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: 12345 (type: integer) + +Warning: get_class() expects parameter 1 to be object, integer given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: -2345 (type: integer) + +Warning: get_class() expects parameter 1 to be object, integer given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: 10.5 (type: double) + +Warning: get_class() expects parameter 1 to be object, double given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: -10.5 (type: double) + +Warning: get_class() expects parameter 1 to be object, double given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: 101234567000 (type: double) + +Warning: get_class() expects parameter 1 to be object, double given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: 1.07654321E-9 (type: double) + +Warning: get_class() expects parameter 1 to be object, double given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: 0.5 (type: double) + +Warning: get_class() expects parameter 1 to be object, double given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: Array (type: array) + +Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: Array (type: array) + +Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: Array (type: array) + +Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: Array (type: array) + +Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: Array (type: array) + +Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php 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 +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 +bool(false) + +Arg value: 1 (type: boolean) + +Warning: get_class() expects parameter 1 to be object, boolean given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: (type: boolean) + +Warning: get_class() expects parameter 1 to be object, boolean given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: 1 (type: boolean) + +Warning: get_class() expects parameter 1 to be object, boolean given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: (type: boolean) + +Warning: get_class() expects parameter 1 to be object, boolean given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: (type: string) + +Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: (type: string) + +Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: string (type: string) + +Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d +bool(false) + +Arg value: string (type: string) + +Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php 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 +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 +bool(false) +Done diff --git a/ext/standard/tests/class_object/get_class_variation_002.phpt b/ext/standard/tests/class_object/get_class_variation_002.phpt new file mode 100644 index 0000000..1ee3529 --- /dev/null +++ b/ext/standard/tests/class_object/get_class_variation_002.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test get_class() function : usage variations - ensure class name case is preserved. +--FILE-- + +--EXPECTF-- +string(19) "caseSensitivityTest" +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_class_vars_error.phpt b/ext/standard/tests/class_object/get_class_vars_error.phpt new file mode 100644 index 0000000..0399e60 --- /dev/null +++ b/ext/standard/tests/class_object/get_class_vars_error.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test get_class_vars() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing get_class_vars() : error conditions *** + +-- Testing get_class_vars() function with more than expected no. of arguments -- + +Warning: get_class_vars() expects exactly 1 parameter, 2 given in %sget_class_vars_error.php on line %d +NULL + +-- Testing get_class_vars() function with less than expected no. of arguments -- + +Warning: get_class_vars() expects exactly 1 parameter, 0 given in %sget_class_vars_error.php on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_class_vars_variation1.phpt b/ext/standard/tests/class_object/get_class_vars_variation1.phpt new file mode 100644 index 0000000..649e9ae --- /dev/null +++ b/ext/standard/tests/class_object/get_class_vars_variation1.phpt @@ -0,0 +1,181 @@ +--TEST-- +Test get_class_vars() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for method_name + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( get_class_vars($value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing get_class_vars() : usage variation *** + +--int 0-- +bool(false) + +--int 1-- +bool(false) + +--int 12345-- +bool(false) + +--int -12345-- +bool(false) + +--float 10.5-- +bool(false) + +--float -10.5-- +bool(false) + +--float 12.3456789000e10-- +bool(false) + +--float -12.3456789000e10-- +bool(false) + +--float .5-- +bool(false) + +--empty array-- + +Warning: get_class_vars() expects parameter 1 to be string, array given in %sget_class_vars_variation1.php on line %d +NULL + +--int indexed array-- + +Warning: get_class_vars() expects parameter 1 to be string, array given in %sget_class_vars_variation1.php on line %d +NULL + +--associative array-- + +Warning: get_class_vars() expects parameter 1 to be string, array given in %sget_class_vars_variation1.php on line %d +NULL + +--nested arrays-- + +Warning: get_class_vars() expects parameter 1 to be string, array given in %sget_class_vars_variation1.php on line %d +NULL + +--uppercase NULL-- +bool(false) + +--lowercase null-- +bool(false) + +--lowercase true-- +bool(false) + +--lowercase false-- +bool(false) + +--uppercase TRUE-- +bool(false) + +--uppercase FALSE-- +bool(false) + +--empty string DQ-- +bool(false) + +--empty string SQ-- +bool(false) + +--instance of classWithToString-- +bool(false) + +--instance of classWithoutToString-- + +Warning: get_class_vars() expects parameter 1 to be string, object given in %sget_class_vars_variation1.php on line %d +NULL + +--undefined var-- +bool(false) + +--unset var-- +bool(false) +===DONE=== diff --git a/ext/standard/tests/class_object/get_class_vars_variation2.phpt b/ext/standard/tests/class_object/get_class_vars_variation2.phpt new file mode 100644 index 0000000..fad5716 --- /dev/null +++ b/ext/standard/tests/class_object/get_class_vars_variation2.phpt @@ -0,0 +1,168 @@ +--TEST-- +Test get_class_vars() function : testing visibility +--FILE-- +test(); + +echo "\n-- From a static context --\n"; +Tester::testStatic(); + + +echo "\n-- From inside an parent object instance --\n"; +$parent = new Ancestor(); +$parent->test(); + +echo "\n-- From a parents static context --\n"; +Ancestor::testStatic(); + + +echo "\n-- From inside a child object instance --\n"; +$child = new Child(); +$child->test(); + +echo "\n-- From a child's static context --\n"; +Child::testStatic(); +?> +===DONE=== +--EXPECTF-- +*** Testing get_class_vars() : testing visibility + +-- From global context -- +array(2) { + ["pub"]=> + string(10) "public var" + ["pubs"]=> + string(17) "public static var" +} + +-- From inside an object instance -- +array(6) { + ["pub"]=> + string(10) "public var" + ["prot"]=> + string(13) "protected var" + ["priv"]=> + string(11) "private var" + ["pubs"]=> + string(17) "public static var" + ["prots"]=> + string(20) "protected static var" + ["privs"]=> + string(18) "private static var" +} + +-- From a static context -- +array(6) { + ["pub"]=> + string(10) "public var" + ["prot"]=> + string(13) "protected var" + ["priv"]=> + string(11) "private var" + ["pubs"]=> + string(17) "public static var" + ["prots"]=> + string(20) "protected static var" + ["privs"]=> + string(18) "private static var" +} + +-- From inside an parent object instance -- +array(4) { + ["pub"]=> + string(10) "public var" + ["prot"]=> + string(13) "protected var" + ["pubs"]=> + string(17) "public static var" + ["prots"]=> + string(20) "protected static var" +} + +-- From a parents static context -- +array(4) { + ["pub"]=> + string(10) "public var" + ["prot"]=> + string(13) "protected var" + ["pubs"]=> + string(17) "public static var" + ["prots"]=> + string(20) "protected static var" +} + +-- From inside a child object instance -- +array(4) { + ["pub"]=> + string(10) "public var" + ["prot"]=> + string(13) "protected var" + ["pubs"]=> + string(17) "public static var" + ["prots"]=> + string(20) "protected static var" +} + +-- From a child's static context -- +array(4) { + ["pub"]=> + string(10) "public var" + ["prot"]=> + string(13) "protected var" + ["pubs"]=> + string(17) "public static var" + ["prots"]=> + string(20) "protected static var" +} +===DONE=== diff --git a/ext/standard/tests/class_object/get_declared_classes_basic_001.phpt b/ext/standard/tests/class_object/get_declared_classes_basic_001.phpt new file mode 100644 index 0000000..123e977 --- /dev/null +++ b/ext/standard/tests/class_object/get_declared_classes_basic_001.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test get_declared_classes() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing get_declared_classes() : basic functionality *** + +-- Testing get_declared_classes() function with Zero arguments -- +array(%d) { +%a +} + +-- Ensure userspace classes are listed -- +bool(true) + +-- Ensure userspace interfaces are not listed -- +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_declared_classes_error_001.phpt b/ext/standard/tests/class_object/get_declared_classes_error_001.phpt new file mode 100644 index 0000000..d5b40be --- /dev/null +++ b/ext/standard/tests/class_object/get_declared_classes_error_001.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test get_declared_classes() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing get_declared_classes() : error conditions *** + +-- Testing get_declared_classes() function with one argument -- + +Warning: get_declared_classes() expects exactly 0 parameters, 1 given in %s on line 13 +NULL +Done diff --git a/ext/standard/tests/class_object/get_declared_classes_variation1.phpt b/ext/standard/tests/class_object/get_declared_classes_variation1.phpt new file mode 100644 index 0000000..259f5dc --- /dev/null +++ b/ext/standard/tests/class_object/get_declared_classes_variation1.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test get_declared_classes() function : testing autoloaded classes +--FILE-- + +--EXPECTF-- +*** Testing get_declared_classes() : testing autoloaded classes *** + +-- before instance is declared -- +bool(false) + +-- after instance is declared -- +bool(true) + +DONE diff --git a/ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt b/ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt new file mode 100644 index 0000000..a0ec715 --- /dev/null +++ b/ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test get_declared_interfaces() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing get_declared_interfaces() : basic functionality *** + +-- Testing get_declared_interfaces() function with Zero arguments -- +array(%d) { +%a +} + +-- Ensure userspace classes are not listed -- +bool(false) + +-- Ensure userspace interfaces are listed -- +bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt b/ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt new file mode 100644 index 0000000..2a7f308 --- /dev/null +++ b/ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test get_declared_interfaces() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing get_declared_interfaces() : error conditions *** + +-- Testing get_declared_interfaces() function with one argument -- + +Warning: get_declared_interfaces() expects exactly 0 parameters, 1 given in %s on line 13 +NULL +Done diff --git a/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt b/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt new file mode 100644 index 0000000..56e6161 --- /dev/null +++ b/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test get_declared_interfaces() function : autoloading of interfaces +--FILE-- + +--EXPECTF-- +*** Testing get_declared_interfaces() : autoloading of interfaces *** + +-- before interface is used -- +bool(false) + +-- after interface is used -- +bool(true) + +DONE diff --git a/ext/standard/tests/class_object/get_declared_traits_basic_001.phpt b/ext/standard/tests/class_object/get_declared_traits_basic_001.phpt new file mode 100644 index 0000000..69d8de9 --- /dev/null +++ b/ext/standard/tests/class_object/get_declared_traits_basic_001.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test get_declared_traits() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing get_declared_traits() : basic functionality *** + +-- Testing get_declared_traits() function with Zero arguments -- +array(%d) { +%a +} + +-- Ensure trait is listed -- +bool(true) + +-- Ensure userspace interfaces are not listed -- +bool(false) + +-- Ensure userspace classes are not listed -- +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_declared_traits_error_001.phpt b/ext/standard/tests/class_object/get_declared_traits_error_001.phpt new file mode 100644 index 0000000..f7a00da --- /dev/null +++ b/ext/standard/tests/class_object/get_declared_traits_error_001.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test get_declared_traits() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing get_declared_traits() : error conditions *** + +-- Testing get_declared_traits() function with one argument -- + +Warning: get_declared_traits() expects exactly 0 parameters, 1 given in %s on line 13 +NULL +Done diff --git a/ext/standard/tests/class_object/get_declared_traits_variation1.phpt b/ext/standard/tests/class_object/get_declared_traits_variation1.phpt new file mode 100644 index 0000000..bedd37a --- /dev/null +++ b/ext/standard/tests/class_object/get_declared_traits_variation1.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test get_declared_traits() function : testing autoloaded traits +--FILE-- + +--EXPECTF-- +*** Testing get_declared_traits() : testing autoloaded traits *** + +-- before instance is declared -- +bool(false) + +-- after use is declared -- +bool(true) + +DONE diff --git a/ext/standard/tests/class_object/get_object_vars_basic_001.phpt b/ext/standard/tests/class_object/get_object_vars_basic_001.phpt new file mode 100644 index 0000000..38ed74f --- /dev/null +++ b/ext/standard/tests/class_object/get_object_vars_basic_001.phpt @@ -0,0 +1,107 @@ +--TEST-- +get_object_vars(): visibility from static methods (target object passed as arg) +--FILE-- + +--EXPECTF-- + +---( Global scope: )--- +array(1) { + ["pub"]=> + string(6) "B::pub" +} + +---( Declaring class: )--- +B::test +array(4) { + ["hiddenPriv"]=> + string(13) "B::hiddenPriv" + ["priv"]=> + string(7) "B::priv" + ["prot"]=> + string(7) "B::prot" + ["pub"]=> + string(6) "B::pub" +} + +---( Subclass: )--- +C::test +array(2) { + ["prot"]=> + string(7) "B::prot" + ["pub"]=> + string(6) "B::pub" +} + +---( Superclass: )--- +A::test +array(3) { + ["prot"]=> + string(7) "B::prot" + ["pub"]=> + string(6) "B::pub" + ["hiddenPriv"]=> + string(13) "A::hiddenPriv" +} + +---( Unrelated class: )--- +X::test +array(1) { + ["pub"]=> + string(6) "B::pub" +} \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_object_vars_basic_002.phpt b/ext/standard/tests/class_object/get_object_vars_basic_002.phpt new file mode 100644 index 0000000..910926b --- /dev/null +++ b/ext/standard/tests/class_object/get_object_vars_basic_002.phpt @@ -0,0 +1,64 @@ +--TEST-- +get_object_vars(): visibility from non static methods (target object passed as arg) +--FILE-- +testB($b); +echo "\n---( Superclass: )---\n"; +$b->testA($b); + +?> +--EXPECTF-- + +---( Declaring class: )--- +B::testB +array(4) { + ["hiddenPriv"]=> + string(13) "B::hiddenPriv" + ["priv"]=> + string(7) "B::priv" + ["prot"]=> + string(7) "B::prot" + ["pub"]=> + string(6) "B::pub" +} + +---( Superclass: )--- +A::testA +array(3) { + ["prot"]=> + string(7) "B::prot" + ["pub"]=> + string(6) "B::pub" + ["hiddenPriv"]=> + string(13) "A::hiddenPriv" +} \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_object_vars_error_001.phpt b/ext/standard/tests/class_object/get_object_vars_error_001.phpt new file mode 100644 index 0000000..2cb37f4 --- /dev/null +++ b/ext/standard/tests/class_object/get_object_vars_error_001.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test get_object_vars() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing get_object_vars() : error conditions *** + +-- Testing get_object_vars() function with Zero arguments -- + +Warning: get_object_vars() expects exactly 1 parameter, 0 given in %s on line 12 +NULL + +-- Testing get_object_vars() function with more than expected no. of arguments -- + +Warning: get_object_vars() expects exactly 1 parameter, 2 given in %s on line 18 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_object_vars_variation_001.phpt b/ext/standard/tests/class_object/get_object_vars_variation_001.phpt new file mode 100644 index 0000000..89fbc53 --- /dev/null +++ b/ext/standard/tests/class_object/get_object_vars_variation_001.phpt @@ -0,0 +1,20 @@ +--TEST-- +get_object_vars() - ensure statics are not shown +--FILE-- + +--EXPECTF-- +array(0) { +} \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_object_vars_variation_002.phpt b/ext/standard/tests/class_object/get_object_vars_variation_002.phpt new file mode 100644 index 0000000..73478de --- /dev/null +++ b/ext/standard/tests/class_object/get_object_vars_variation_002.phpt @@ -0,0 +1,47 @@ +--TEST-- +get_object_vars() - ensure references are preserved +--FILE-- +ref = &$a; +$obj->val = $a; + +$arr = get_object_vars($obj); +var_dump($arr); + +$arr['ref'] = 'changed.ref'; +$arr['val'] = 'changed.val'; + +var_dump($arr, $obj, $a); +?> +--EXPECTF-- +array(0) { +} +array(2) { + ["ref"]=> + &string(10) "original.a" + ["val"]=> + string(10) "original.a" +} +array(2) { + ["ref"]=> + &string(11) "changed.ref" + ["val"]=> + string(11) "changed.val" +} +object(stdClass)#1 (2) { + ["ref"]=> + &string(11) "changed.ref" + ["val"]=> + string(10) "original.a" +} +string(11) "changed.ref" \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_object_vars_variation_003.phpt b/ext/standard/tests/class_object/get_object_vars_variation_003.phpt new file mode 100644 index 0000000..1e68d08 --- /dev/null +++ b/ext/standard/tests/class_object/get_object_vars_variation_003.phpt @@ -0,0 +1,210 @@ +--TEST-- +Test get_object_vars() function : usage variations - unexpected types for argument 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for obj + +foreach($values as $value) { + echo @"\nArg value $value \n"; + var_dump( get_object_vars($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing get_object_vars() : usage variations *** + +Notice: Undefined variable: undefined_var in %s on line 56 + +Notice: Undefined variable: unset_var in %s on line 59 + +Arg value 0 + +Warning: get_object_vars() expects parameter 1 to be object, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: get_object_vars() expects parameter 1 to be object, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: get_object_vars() expects parameter 1 to be object, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: get_object_vars() expects parameter 1 to be object, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: get_object_vars() expects parameter 1 to be object, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: get_object_vars() expects parameter 1 to be object, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: get_object_vars() expects parameter 1 to be object, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: get_object_vars() expects parameter 1 to be object, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: get_object_vars() expects parameter 1 to be object, double given in %s on line %d +NULL + +Arg value Array + +Warning: get_object_vars() expects parameter 1 to be object, array given in %s on line %d +NULL + +Arg value Array + +Warning: get_object_vars() expects parameter 1 to be object, array given in %s on line %d +NULL + +Arg value Array + +Warning: get_object_vars() expects parameter 1 to be object, array given in %s on line %d +NULL + +Arg value Array + +Warning: get_object_vars() expects parameter 1 to be object, array given in %s on line %d +NULL + +Arg value Array + +Warning: get_object_vars() expects parameter 1 to be object, array given in %s on line %d +NULL + +Arg value + +Warning: get_object_vars() expects parameter 1 to be object, null given in %s on line %d +NULL + +Arg value + +Warning: get_object_vars() expects parameter 1 to be object, null given in %s on line %d +NULL + +Arg value 1 + +Warning: get_object_vars() expects parameter 1 to be object, boolean given in %s on line %d +NULL + +Arg value + +Warning: get_object_vars() expects parameter 1 to be object, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: get_object_vars() expects parameter 1 to be object, boolean given in %s on line %d +NULL + +Arg value + +Warning: get_object_vars() expects parameter 1 to be object, boolean given in %s on line %d +NULL + +Arg value + +Warning: get_object_vars() expects parameter 1 to be object, string given in %s on line %d +NULL + +Arg value + +Warning: get_object_vars() expects parameter 1 to be object, string given in %s on line %d +NULL + +Arg value string + +Warning: get_object_vars() expects parameter 1 to be object, string given in %s on line %d +NULL + +Arg value string + +Warning: get_object_vars() expects parameter 1 to be object, string given in %s on line %d +NULL + +Arg value + +Warning: get_object_vars() expects parameter 1 to be object, null given in %s on line %d +NULL + +Arg value + +Warning: get_object_vars() expects parameter 1 to be object, null given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_parent_class_error_001.phpt b/ext/standard/tests/class_object/get_parent_class_error_001.phpt new file mode 100644 index 0000000..40c3dba --- /dev/null +++ b/ext/standard/tests/class_object/get_parent_class_error_001.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test get_parent_class() function : error conditions - wrong number of args. +--FILE-- + +--EXPECTF-- +*** Testing get_parent_class() : error conditions *** + +-- Testing get_parent_class() function with more than expected no. of arguments -- + +Warning: get_parent_class() expects at most 1 parameter, 2 given in %s on line 15 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_parent_class_variation_001.phpt b/ext/standard/tests/class_object/get_parent_class_variation_001.phpt new file mode 100644 index 0000000..6f2e328 --- /dev/null +++ b/ext/standard/tests/class_object/get_parent_class_variation_001.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test get_parent_class() function : variation - case sensitivity +--FILE-- + +--EXPECTF-- +*** Testing get_parent_class() : variation *** +string(19) "caseSensitivityTest" +string(19) "caseSensitivityTest" +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt new file mode 100644 index 0000000..0d19e22 --- /dev/null +++ b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt @@ -0,0 +1,179 @@ +--TEST-- +Test get_parent_class() function : usage variations - unexpected argument type. +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'String', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for object + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( get_parent_class($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing get_parent_class() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(68) +Error: 8 - Undefined variable: unset_var, %s(71) + +Arg value 0 +bool(false) + +Arg value 1 +bool(false) + +Arg value 12345 +bool(false) + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +bool(false) + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d) + +Arg value Array +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value string +In __autoload(string) +bool(false) + +Arg value String +In __autoload(String) +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(77) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/interface_exists_error.phpt b/ext/standard/tests/class_object/interface_exists_error.phpt new file mode 100644 index 0000000..bf95a43 --- /dev/null +++ b/ext/standard/tests/class_object/interface_exists_error.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test interface_exists() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing interface_exists() : error conditions *** + +-- Testing interface_exists() function with Zero arguments -- + +Warning: interface_exists() expects at least 1 parameter, 0 given in %sinterface_exists_error.php on line %d +NULL + +-- Testing interface_exists() function with more than expected no. of arguments -- + +Warning: interface_exists() expects at most 2 parameters, 3 given in %sinterface_exists_error.php on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/class_object/interface_exists_variation1.phpt b/ext/standard/tests/class_object/interface_exists_variation1.phpt new file mode 100644 index 0000000..34d0e1e --- /dev/null +++ b/ext/standard/tests/class_object/interface_exists_variation1.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test interface_exists() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for classname + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( interface_exists($value, $autoload) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing interface_exists() : usage variation *** + +--int 0-- +bool(false) + +--int 1-- +bool(false) + +--int 12345-- +bool(false) + +--int -12345-- +bool(false) + +--float 10.5-- +bool(false) + +--float -10.5-- +bool(false) + +--float 12.3456789000e10-- +bool(false) + +--float -12.3456789000e10-- +bool(false) + +--float .5-- +bool(false) + +--empty array-- + +Warning: interface_exists() expects parameter 1 to be string, array given in %sinterface_exists_variation1.php on line %d +NULL + +--int indexed array-- + +Warning: interface_exists() expects parameter 1 to be string, array given in %sinterface_exists_variation1.php on line %d +NULL + +--associative array-- + +Warning: interface_exists() expects parameter 1 to be string, array given in %sinterface_exists_variation1.php on line %d +NULL + +--nested arrays-- + +Warning: interface_exists() expects parameter 1 to be string, array given in %sinterface_exists_variation1.php on line %d +NULL + +--uppercase NULL-- +bool(false) + +--lowercase null-- +bool(false) + +--lowercase true-- +bool(false) + +--lowercase false-- +bool(false) + +--uppercase TRUE-- +bool(false) + +--uppercase FALSE-- +bool(false) + +--empty string DQ-- +bool(false) + +--empty string SQ-- +bool(false) + +--instance of classWithToString-- +bool(false) + +--instance of classWithoutToString-- + +Warning: interface_exists() expects parameter 1 to be string, object given in %sinterface_exists_variation1.php on line %d +NULL + +--undefined var-- +bool(false) + +--unset var-- +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/class_object/interface_exists_variation2.phpt b/ext/standard/tests/class_object/interface_exists_variation2.phpt new file mode 100644 index 0000000..4137d8a --- /dev/null +++ b/ext/standard/tests/class_object/interface_exists_variation2.phpt @@ -0,0 +1,204 @@ +--TEST-- +Test interface_exists() function : usage variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for autoload + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( interface_exists($classname, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing interface_exists() : usage variation *** + +--int 0-- +bool(false) + +--int 1-- +bool(false) + +--int 12345-- +bool(false) + +--int -12345-- +bool(false) + +--float 10.5-- +bool(false) + +--float -10.5-- +bool(false) + +--float 12.3456789000e10-- +bool(false) + +--float -12.3456789000e10-- +bool(false) + +--float .5-- +bool(false) + +--empty array-- + +Warning: interface_exists() expects parameter 2 to be boolean, array given in %sinterface_exists_variation2.php on line %d +NULL + +--int indexed array-- + +Warning: interface_exists() expects parameter 2 to be boolean, array given in %sinterface_exists_variation2.php on line %d +NULL + +--associative array-- + +Warning: interface_exists() expects parameter 2 to be boolean, array given in %sinterface_exists_variation2.php on line %d +NULL + +--nested arrays-- + +Warning: interface_exists() expects parameter 2 to be boolean, array given in %sinterface_exists_variation2.php on line %d +NULL + +--uppercase NULL-- +bool(false) + +--lowercase null-- +bool(false) + +--lowercase true-- +bool(false) + +--lowercase false-- +bool(false) + +--uppercase TRUE-- +bool(false) + +--uppercase FALSE-- +bool(false) + +--empty string DQ-- +bool(false) + +--empty string SQ-- +bool(false) + +--string DQ-- +bool(false) + +--string SQ-- +bool(false) + +--mixed case string-- +bool(false) + +--heredoc-- +bool(false) + +--instance of classWithToString-- + +Warning: interface_exists() expects parameter 2 to be boolean, object given in %sinterface_exists_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: interface_exists() expects parameter 2 to be boolean, object given in %sinterface_exists_variation2.php on line %d +NULL + +--undefined var-- +bool(false) + +--unset var-- +bool(false) +===DONE=== diff --git a/ext/standard/tests/class_object/interface_exists_variation3.phpt b/ext/standard/tests/class_object/interface_exists_variation3.phpt new file mode 100644 index 0000000..d25d74b --- /dev/null +++ b/ext/standard/tests/class_object/interface_exists_variation3.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test interface_exists() function : autoloaded interface +--FILE-- + +--EXPECTF-- +*** Testing interface_exists() : autoloaded interface *** + +-- no autoloading -- +bool(false) + +-- with autoloading -- +bool(true) + +DONE \ No newline at end of file diff --git a/ext/standard/tests/class_object/interface_exists_variation4.phpt b/ext/standard/tests/class_object/interface_exists_variation4.phpt new file mode 100644 index 0000000..c059805 --- /dev/null +++ b/ext/standard/tests/class_object/interface_exists_variation4.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test interface_exists() function : test autoload default value +--FILE-- + +--EXPECTF-- +*** Testing interface_exists() : test autoload default value *** +bool(true) + +DONE \ No newline at end of file diff --git a/ext/standard/tests/class_object/is_a.phpt b/ext/standard/tests/class_object/is_a.phpt new file mode 100644 index 0000000..832d555 --- /dev/null +++ b/ext/standard/tests/class_object/is_a.phpt @@ -0,0 +1,378 @@ +--TEST-- +is_a and is_subclass_of behaviour (with and without autoload) +--SKIPIF-- + +--FILE-- +>> With Defined class\n"; + echo str_pad('is_a( OBJECT:'.get_class($this).', '.$sub.') = ', 60) . (is_a($this, $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_a(get_class($this), $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.', true) = ', 60). (is_a(get_class($this), $sub, true) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( OBJECT:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of($this, $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of(get_class($this), $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.',false) = ', 60). (is_subclass_of(get_class($this), $sub , false) ? 'yes' : 'no')."\n"; + + // with autoload options.. + echo ">>> With Undefined\n"; + echo str_pad('is_a( STRING:undefB, '.$sub.',true) = ', 60). (is_a('undefB', $sub, true) ? 'yes' : 'no')."\n"; + echo str_pad('is_a( STRING:undefB, '.$sub.') = ', 60). (is_a('undefB', $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( STRING:undefB, '.$sub.',false) = ', 60). (is_subclass_of('undefB', $sub, false) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( STRING:undefB, '.$sub.') = ', 60). (is_subclass_of('undefB', $sub) ? 'yes' : 'no')."\n"; + } + function test() { + echo $this->_is_a('base'); + echo $this->_is_a('derived_a'); + echo $this->_is_a('if_a'); + echo $this->_is_a('undefA'); + echo "\n"; + } +} + +class derived_a extends base implements if_a { + function f_a() {} +} + +class derived_b extends base implements if_a, if_b { + function f_a() {} + function f_b() {} +} + +class derived_c extends derived_a implements if_b { + function f_b() {} +} + +class derived_d extends derived_c { +} + +$t = new base(); +$t->test(); + +$t = new derived_a(); +$t->test(); + +eval(' + function __autoload($name) + { + echo ">>>> In __autoload: "; + var_dump($name); + } +'); + +echo "NOW WITH AUTOLOAD\n\n"; + +$t = new base(); +$t->test(); + +$t = new derived_a(); +$t->test(); + +$t = new derived_b(); +$t->test(); + + + + + +?> +--EXPECTF-- +>>> With Defined class +is_a( OBJECT:base, base) = yes +is_a( STRING:base, base) = no +is_a( STRING:base, base, true) = yes +is_subclass_of( OBJECT:base, base) = no +is_subclass_of( STRING:base, base) = no +is_subclass_of( STRING:base, base,false) = no +>>> With Undefined +is_a( STRING:undefB, base,true) = no +is_a( STRING:undefB, base) = no +is_subclass_of( STRING:undefB, base,false) = no +is_subclass_of( STRING:undefB, base) = no + +>>> With Defined class +is_a( OBJECT:base, derived_a) = no +is_a( STRING:base, derived_a) = no +is_a( STRING:base, derived_a, true) = no +is_subclass_of( OBJECT:base, derived_a) = no +is_subclass_of( STRING:base, derived_a) = no +is_subclass_of( STRING:base, derived_a,false) = no +>>> With Undefined +is_a( STRING:undefB, derived_a,true) = no +is_a( STRING:undefB, derived_a) = no +is_subclass_of( STRING:undefB, derived_a,false) = no +is_subclass_of( STRING:undefB, derived_a) = no + +>>> With Defined class +is_a( OBJECT:base, if_a) = no +is_a( STRING:base, if_a) = no +is_a( STRING:base, if_a, true) = no +is_subclass_of( OBJECT:base, if_a) = no +is_subclass_of( STRING:base, if_a) = no +is_subclass_of( STRING:base, if_a,false) = no +>>> With Undefined +is_a( STRING:undefB, if_a,true) = no +is_a( STRING:undefB, if_a) = no +is_subclass_of( STRING:undefB, if_a,false) = no +is_subclass_of( STRING:undefB, if_a) = no + +>>> With Defined class +is_a( OBJECT:base, undefA) = no +is_a( STRING:base, undefA) = no +is_a( STRING:base, undefA, true) = no +is_subclass_of( OBJECT:base, undefA) = no +is_subclass_of( STRING:base, undefA) = no +is_subclass_of( STRING:base, undefA,false) = no +>>> With Undefined +is_a( STRING:undefB, undefA,true) = no +is_a( STRING:undefB, undefA) = no +is_subclass_of( STRING:undefB, undefA,false) = no +is_subclass_of( STRING:undefB, undefA) = no + + +>>> With Defined class +is_a( OBJECT:derived_a, base) = yes +is_a( STRING:derived_a, base) = no +is_a( STRING:derived_a, base, true) = yes +is_subclass_of( OBJECT:derived_a, base) = yes +is_subclass_of( STRING:derived_a, base) = yes +is_subclass_of( STRING:derived_a, base,false) = no +>>> With Undefined +is_a( STRING:undefB, base,true) = no +is_a( STRING:undefB, base) = no +is_subclass_of( STRING:undefB, base,false) = no +is_subclass_of( STRING:undefB, base) = no + +>>> With Defined class +is_a( OBJECT:derived_a, derived_a) = yes +is_a( STRING:derived_a, derived_a) = no +is_a( STRING:derived_a, derived_a, true) = yes +is_subclass_of( OBJECT:derived_a, derived_a) = no +is_subclass_of( STRING:derived_a, derived_a) = no +is_subclass_of( STRING:derived_a, derived_a,false) = no +>>> With Undefined +is_a( STRING:undefB, derived_a,true) = no +is_a( STRING:undefB, derived_a) = no +is_subclass_of( STRING:undefB, derived_a,false) = no +is_subclass_of( STRING:undefB, derived_a) = no + +>>> With Defined class +is_a( OBJECT:derived_a, if_a) = yes +is_a( STRING:derived_a, if_a) = no +is_a( STRING:derived_a, if_a, true) = yes +is_subclass_of( OBJECT:derived_a, if_a) = yes +is_subclass_of( STRING:derived_a, if_a) = yes +is_subclass_of( STRING:derived_a, if_a,false) = no +>>> With Undefined +is_a( STRING:undefB, if_a,true) = no +is_a( STRING:undefB, if_a) = no +is_subclass_of( STRING:undefB, if_a,false) = no +is_subclass_of( STRING:undefB, if_a) = no + +>>> With Defined class +is_a( OBJECT:derived_a, undefA) = no +is_a( STRING:derived_a, undefA) = no +is_a( STRING:derived_a, undefA, true) = no +is_subclass_of( OBJECT:derived_a, undefA) = no +is_subclass_of( STRING:derived_a, undefA) = no +is_subclass_of( STRING:derived_a, undefA,false) = no +>>> With Undefined +is_a( STRING:undefB, undefA,true) = no +is_a( STRING:undefB, undefA) = no +is_subclass_of( STRING:undefB, undefA,false) = no +is_subclass_of( STRING:undefB, undefA) = no + +NOW WITH AUTOLOAD + + +>>> With Defined class +is_a( OBJECT:base, base) = yes +is_a( STRING:base, base) = no +is_a( STRING:base, base, true) = yes +is_subclass_of( OBJECT:base, base) = no +is_subclass_of( STRING:base, base) = no +is_subclass_of( STRING:base, base,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, base,true) = no +is_a( STRING:undefB, base) = no +is_subclass_of( STRING:undefB, base,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, base) = no + +>>> With Defined class +is_a( OBJECT:base, derived_a) = no +is_a( STRING:base, derived_a) = no +is_a( STRING:base, derived_a, true) = no +is_subclass_of( OBJECT:base, derived_a) = no +is_subclass_of( STRING:base, derived_a) = no +is_subclass_of( STRING:base, derived_a,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, derived_a,true) = no +is_a( STRING:undefB, derived_a) = no +is_subclass_of( STRING:undefB, derived_a,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, derived_a) = no + +>>> With Defined class +is_a( OBJECT:base, if_a) = no +is_a( STRING:base, if_a) = no +is_a( STRING:base, if_a, true) = no +is_subclass_of( OBJECT:base, if_a) = no +is_subclass_of( STRING:base, if_a) = no +is_subclass_of( STRING:base, if_a,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, if_a,true) = no +is_a( STRING:undefB, if_a) = no +is_subclass_of( STRING:undefB, if_a,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, if_a) = no + +>>> With Defined class +is_a( OBJECT:base, undefA) = no +is_a( STRING:base, undefA) = no +is_a( STRING:base, undefA, true) = no +is_subclass_of( OBJECT:base, undefA) = no +is_subclass_of( STRING:base, undefA) = no +is_subclass_of( STRING:base, undefA,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, undefA,true) = no +is_a( STRING:undefB, undefA) = no +is_subclass_of( STRING:undefB, undefA,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, undefA) = no + + +>>> With Defined class +is_a( OBJECT:derived_a, base) = yes +is_a( STRING:derived_a, base) = no +is_a( STRING:derived_a, base, true) = yes +is_subclass_of( OBJECT:derived_a, base) = yes +is_subclass_of( STRING:derived_a, base) = yes +is_subclass_of( STRING:derived_a, base,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, base,true) = no +is_a( STRING:undefB, base) = no +is_subclass_of( STRING:undefB, base,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, base) = no + +>>> With Defined class +is_a( OBJECT:derived_a, derived_a) = yes +is_a( STRING:derived_a, derived_a) = no +is_a( STRING:derived_a, derived_a, true) = yes +is_subclass_of( OBJECT:derived_a, derived_a) = no +is_subclass_of( STRING:derived_a, derived_a) = no +is_subclass_of( STRING:derived_a, derived_a,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, derived_a,true) = no +is_a( STRING:undefB, derived_a) = no +is_subclass_of( STRING:undefB, derived_a,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, derived_a) = no + +>>> With Defined class +is_a( OBJECT:derived_a, if_a) = yes +is_a( STRING:derived_a, if_a) = no +is_a( STRING:derived_a, if_a, true) = yes +is_subclass_of( OBJECT:derived_a, if_a) = yes +is_subclass_of( STRING:derived_a, if_a) = yes +is_subclass_of( STRING:derived_a, if_a,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, if_a,true) = no +is_a( STRING:undefB, if_a) = no +is_subclass_of( STRING:undefB, if_a,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, if_a) = no + +>>> With Defined class +is_a( OBJECT:derived_a, undefA) = no +is_a( STRING:derived_a, undefA) = no +is_a( STRING:derived_a, undefA, true) = no +is_subclass_of( OBJECT:derived_a, undefA) = no +is_subclass_of( STRING:derived_a, undefA) = no +is_subclass_of( STRING:derived_a, undefA,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, undefA,true) = no +is_a( STRING:undefB, undefA) = no +is_subclass_of( STRING:undefB, undefA,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, undefA) = no + + +>>> With Defined class +is_a( OBJECT:derived_b, base) = yes +is_a( STRING:derived_b, base) = no +is_a( STRING:derived_b, base, true) = yes +is_subclass_of( OBJECT:derived_b, base) = yes +is_subclass_of( STRING:derived_b, base) = yes +is_subclass_of( STRING:derived_b, base,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, base,true) = no +is_a( STRING:undefB, base) = no +is_subclass_of( STRING:undefB, base,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, base) = no + +>>> With Defined class +is_a( OBJECT:derived_b, derived_a) = no +is_a( STRING:derived_b, derived_a) = no +is_a( STRING:derived_b, derived_a, true) = no +is_subclass_of( OBJECT:derived_b, derived_a) = no +is_subclass_of( STRING:derived_b, derived_a) = no +is_subclass_of( STRING:derived_b, derived_a,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, derived_a,true) = no +is_a( STRING:undefB, derived_a) = no +is_subclass_of( STRING:undefB, derived_a,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, derived_a) = no + +>>> With Defined class +is_a( OBJECT:derived_b, if_a) = yes +is_a( STRING:derived_b, if_a) = no +is_a( STRING:derived_b, if_a, true) = yes +is_subclass_of( OBJECT:derived_b, if_a) = yes +is_subclass_of( STRING:derived_b, if_a) = yes +is_subclass_of( STRING:derived_b, if_a,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, if_a,true) = no +is_a( STRING:undefB, if_a) = no +is_subclass_of( STRING:undefB, if_a,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, if_a) = no + +>>> With Defined class +is_a( OBJECT:derived_b, undefA) = no +is_a( STRING:derived_b, undefA) = no +is_a( STRING:derived_b, undefA, true) = no +is_subclass_of( OBJECT:derived_b, undefA) = no +is_subclass_of( STRING:derived_b, undefA) = no +is_subclass_of( STRING:derived_b, undefA,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, undefA,true) = no +is_a( STRING:undefB, undefA) = no +is_subclass_of( STRING:undefB, undefA,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, undefA) = no diff --git a/ext/standard/tests/class_object/is_a_error_001.phpt b/ext/standard/tests/class_object/is_a_error_001.phpt new file mode 100644 index 0000000..6518a03 --- /dev/null +++ b/ext/standard/tests/class_object/is_a_error_001.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test is_a() function : error conditions - wrong number of args +--INI-- +error_reporting=E_ALL | E_STRICT | E_DEPRECATED +--FILE-- + +--EXPECTF-- + +*** Testing is_a() : error conditions *** + +-- Testing is_a() function with more than expected no. of arguments -- + +Warning: is_a() expects at most 3 parameters, 4 given in %s on line 17 +NULL + +-- Testing is_a() function with non-boolean in last position -- + +Warning: is_a() expects parameter 3 to be boolean, object given in %s on line 21 +NULL + +-- Testing is_a() function with less than expected no. of arguments -- + +Warning: is_a() expects at least 2 parameters, 1 given in %s on line 27 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/is_a_variation_001.phpt b/ext/standard/tests/class_object/is_a_variation_001.phpt new file mode 100644 index 0000000..d449fd3 --- /dev/null +++ b/ext/standard/tests/class_object/is_a_variation_001.phpt @@ -0,0 +1,163 @@ +--TEST-- +Test is_a() function : usage variations - wrong type for arg 1 +--INI-- +error_reporting=E_ALL | E_STRICT | E_DEPRECATED +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'String', + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for object + +foreach($values as $value) { + echo @"\nArg value $value \n"; + var_dump( is_a($value, $class_name) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing is_a() : usage variations *** + +Notice: Undefined variable: undefined_var in %s on line 59 + +Notice: Undefined variable: unset_var in %s on line 62 + +Arg value 0 +bool(false) + +Arg value 1 +bool(false) + +Arg value 12345 +bool(false) + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +bool(false) + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) + +Arg value Array +bool(false) + +Arg value Array +bool(false) + +Arg value Array +bool(false) + +Arg value Array +bool(false) + +Arg value Array +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value string +bool(false) + +Arg value String +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Done diff --git a/ext/standard/tests/class_object/is_a_variation_002.phpt b/ext/standard/tests/class_object/is_a_variation_002.phpt new file mode 100644 index 0000000..a34c325 --- /dev/null +++ b/ext/standard/tests/class_object/is_a_variation_002.phpt @@ -0,0 +1,175 @@ +--TEST-- +Test is_a() function : usage variations - wrong type for arg 2 +--INI-- +error_reporting=E_ALL | E_STRICT | E_DEPRECATED +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new C, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for class_name + +foreach($values as $value) { + echo @"\nArg value $value \n"; + var_dump( is_a($object, $value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing is_a() : usage variations *** + +Notice: Undefined variable: undefined_var in %s on line 64 + +Notice: Undefined variable: unset_var in %s on line 67 + +Arg value 0 +bool(false) + +Arg value 1 +bool(false) + +Arg value 12345 +bool(false) + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +bool(false) + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) + +Arg value Array + +Warning: is_a() expects parameter 2 to be string, array given in %s on line %d +NULL + +Arg value Array + +Warning: is_a() expects parameter 2 to be string, array given in %s on line %d +NULL + +Arg value Array + +Warning: is_a() expects parameter 2 to be string, array given in %s on line %d +NULL + +Arg value Array + +Warning: is_a() expects parameter 2 to be string, array given in %s on line %d +NULL + +Arg value Array + +Warning: is_a() expects parameter 2 to be string, array given in %s on line %d +NULL + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value C Instance +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Done diff --git a/ext/standard/tests/class_object/is_a_variation_003.phpt b/ext/standard/tests/class_object/is_a_variation_003.phpt new file mode 100644 index 0000000..1258647 --- /dev/null +++ b/ext/standard/tests/class_object/is_a_variation_003.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test is_a() function : usage variations - case sensitivity +--INI-- +error_reporting=E_ALL | E_STRICT | E_DEPRECATED +--FILE-- + +--EXPECTF-- +*** Testing is_a() : usage variations *** +bool(true) +Done diff --git a/ext/standard/tests/class_object/is_subclass_of_error_001.phpt b/ext/standard/tests/class_object/is_subclass_of_error_001.phpt new file mode 100644 index 0000000..987dcd4 --- /dev/null +++ b/ext/standard/tests/class_object/is_subclass_of_error_001.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test is_subclass_of() function : wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing is_subclass_of() : error conditions *** + +-- Testing is_subclass_of() function with more than expected no. of arguments -- + +Warning: is_subclass_of() expects at most 3 parameters, 4 given in %s on line 17 +NULL + +-- Testing is_subclass_of() function with more than typo style invalid 3rd argument -- +bool(false) + +-- Testing is_subclass_of() function with more than invalid 3rd argument -- + +Warning: is_subclass_of() expects parameter 3 to be boolean, object given in %s on line 26 +NULL + +-- Testing is_subclass_of() function with less than expected no. of arguments -- + +Warning: is_subclass_of() expects at least 2 parameters, 1 given in %s on line 31 +NULL +Done diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt new file mode 100644 index 0000000..201d878 --- /dev/null +++ b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt @@ -0,0 +1,176 @@ +--TEST-- +Test is_subclass_of() function : usage variations - unexpected type for arg 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'String', + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for object + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( is_subclass_of($value, $class_name) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing is_subclass_of() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(69) +Error: 8 - Undefined variable: unset_var, %s(72) + +Arg value 0 +bool(false) + +Arg value 1 +bool(false) + +Arg value 12345 +bool(false) + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +bool(false) + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d) + +Arg value Array +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value string +In __autoload(string) +bool(false) + +Arg value String +In __autoload(String) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt new file mode 100644 index 0000000..9bb712b --- /dev/null +++ b/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt @@ -0,0 +1,176 @@ +--TEST-- +Test is_subclass_of() function : usage variations - unexpected type for arg 2 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for class_name + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( is_subclass_of($object, $value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing is_subclass_of() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(67) +Error: 8 - Undefined variable: unset_var, %s(70) + +Arg value 0 +bool(false) + +Arg value 1 +bool(false) + +Arg value 12345 +bool(false) + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +bool(false) + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %sis_subclass_of_variation_002.php(%d) + +Arg value Array +Error: 2 - is_subclass_of() expects parameter 2 to be string, array given, %s(%d) +NULL +Error: 8 - Array to string conversion, %sis_subclass_of_variation_002.php(%d) + +Arg value Array +Error: 2 - is_subclass_of() expects parameter 2 to be string, array given, %s(%d) +NULL +Error: 8 - Array to string conversion, %sis_subclass_of_variation_002.php(%d) + +Arg value Array +Error: 2 - is_subclass_of() expects parameter 2 to be string, array given, %s(%d) +NULL +Error: 8 - Array to string conversion, %sis_subclass_of_variation_002.php(%d) + +Arg value Array +Error: 2 - is_subclass_of() expects parameter 2 to be string, array given, %s(%d) +NULL +Error: 8 - Array to string conversion, %sis_subclass_of_variation_002.php(%d) + +Arg value Array +Error: 2 - is_subclass_of() expects parameter 2 to be string, array given, %s(%d) +NULL + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(%d) + +Arg value +Error: 2 - is_subclass_of() expects parameter 2 to be string, object given, %s(%d) +NULL + +Arg value +bool(false) + +Arg value +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_003.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_003.phpt new file mode 100644 index 0000000..d4aef12 --- /dev/null +++ b/ext/standard/tests/class_object/is_subclass_of_variation_003.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test is_subclass_of() function : usage variations - case sensitivity +--FILE-- + +--EXPECTF-- +*** Testing is_subclass_of() : usage variations *** +*** Testing is_a() : usage variations *** +bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt new file mode 100644 index 0000000..65ae8a4 --- /dev/null +++ b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt @@ -0,0 +1,176 @@ +--TEST-- +Test is_subclass_of() function : usage variations - unexpected type for arg 1 with valid class in arg 2. +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'String', + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for object + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( is_subclass_of($value, $class_name) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing is_subclass_of() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(69) +Error: 8 - Undefined variable: unset_var, %s(72) + +Arg value 0 +bool(false) + +Arg value 1 +bool(false) + +Arg value 12345 +bool(false) + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +bool(false) + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d) + +Arg value Array +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value string +In __autoload(string) +bool(false) + +Arg value String +In __autoload(String) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/method_exists_basic_001.phpt b/ext/standard/tests/class_object/method_exists_basic_001.phpt new file mode 100644 index 0000000..2f11e4c --- /dev/null +++ b/ext/standard/tests/class_object/method_exists_basic_001.phpt @@ -0,0 +1,83 @@ +--TEST-- +method_exists() on userspace classes; static & non-static methods with various visibilities. +--FILE-- + +--EXPECTF-- + + ---(Using string class name)--- +Does C::inherit_pub exist? bool(true) +Does C::inherit_prot exist? bool(true) +Does C::inherit_priv exist? bool(true) +Does C::inherit_static_pub exist? bool(true) +Does C::inherit_static_prot exist? bool(true) +Does C::inherit_static_priv exist? bool(true) +Does C::pub exist? bool(true) +Does C::prot exist? bool(true) +Does C::priv exist? bool(true) +Does C::static_pub exist? bool(true) +Does C::static_prot exist? bool(true) +Does C::static_priv exist? bool(true) +Does C::non_existent exist? bool(false) + + ---(Using object)--- +Does C::inherit_pub exist? bool(true) +Does C::inherit_prot exist? bool(true) +Does C::inherit_priv exist? bool(true) +Does C::inherit_static_pub exist? bool(true) +Does C::inherit_static_prot exist? bool(true) +Does C::inherit_static_priv exist? bool(true) +Does C::pub exist? bool(true) +Does C::prot exist? bool(true) +Does C::priv exist? bool(true) +Does C::static_pub exist? bool(true) +Does C::static_prot exist? bool(true) +Does C::static_priv exist? bool(true) +Does C::non_existent exist? bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/method_exists_basic_002.phpt b/ext/standard/tests/class_object/method_exists_basic_002.phpt new file mode 100644 index 0000000..f6b62aa --- /dev/null +++ b/ext/standard/tests/class_object/method_exists_basic_002.phpt @@ -0,0 +1,33 @@ +--TEST-- +method_exists() on internal classes +--FILE-- + +--EXPECTF-- + ---(Internal classes, using string class name)--- +Does exception::getmessage exist? bool(true) +Does stdclass::nonexistent exist? bool(false) + + ---(Internal classes, using class instance)--- +Does exception::getmessage exist? bool(true) +Does stdclass::nonexistent exist? bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/method_exists_basic_003.phpt b/ext/standard/tests/class_object/method_exists_basic_003.phpt new file mode 100644 index 0000000..32f62b7 --- /dev/null +++ b/ext/standard/tests/class_object/method_exists_basic_003.phpt @@ -0,0 +1,22 @@ +--TEST-- +method_exists() on non-existent class, with __autoload(). +--FILE-- + +--EXPECTF-- +In __autoload(UndefC) +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/method_exists_error_001.phpt b/ext/standard/tests/class_object/method_exists_error_001.phpt new file mode 100644 index 0000000..929d84a --- /dev/null +++ b/ext/standard/tests/class_object/method_exists_error_001.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test method_exists() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing method_exists() : error conditions *** + +-- Testing method_exists() function with more than expected no. of arguments -- + +Warning: method_exists() expects exactly 2 parameters, 3 given in %s on line 16 +NULL + +-- Testing method_exists() function with less than expected no. of arguments -- + +Warning: method_exists() expects exactly 2 parameters, 1 given in %s on line 21 +NULL +Done diff --git a/ext/standard/tests/class_object/method_exists_variation_001.phpt b/ext/standard/tests/class_object/method_exists_variation_001.phpt new file mode 100644 index 0000000..1947c76 --- /dev/null +++ b/ext/standard/tests/class_object/method_exists_variation_001.phpt @@ -0,0 +1,175 @@ +--TEST-- +Test method_exists() function : usage variations - unexpected type for arg 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'String', + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for object + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( method_exists($value, $method) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing method_exists() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(68) +Error: 8 - Undefined variable: unset_var, %s(71) + +Arg value 0 +bool(false) + +Arg value 1 +bool(false) + +Arg value 12345 +bool(false) + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +bool(false) + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d) + +Arg value Array +bool(false) +Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d) + +Arg value Array +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value string +In __autoload(string) +bool(false) + +Arg value String +In __autoload(String) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/method_exists_variation_002.phpt b/ext/standard/tests/class_object/method_exists_variation_002.phpt new file mode 100644 index 0000000..b1204e8 --- /dev/null +++ b/ext/standard/tests/class_object/method_exists_variation_002.phpt @@ -0,0 +1,176 @@ +--TEST-- +Test method_exists() function : usage variations - unexpected type for arg 2 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for method + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( method_exists($object, $value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing method_exists() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(67) +Error: 8 - Undefined variable: unset_var, %s(70) + +Arg value 0 +bool(false) + +Arg value 1 +bool(false) + +Arg value 12345 +bool(false) + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +bool(false) + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %smethod_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - method_exists() expects parameter 2 to be string, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %smethod_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - method_exists() expects parameter 2 to be string, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %smethod_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - method_exists() expects parameter 2 to be string, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %smethod_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - method_exists() expects parameter 2 to be string, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %smethod_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - method_exists() expects parameter 2 to be string, array given, %s(77) +NULL + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value 1 +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(76) + +Arg value +Error: 2 - method_exists() expects parameter 2 to be string, object given, %s(77) +NULL + +Arg value +bool(false) + +Arg value +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/method_exists_variation_003.phpt b/ext/standard/tests/class_object/method_exists_variation_003.phpt new file mode 100644 index 0000000..debe5a3 --- /dev/null +++ b/ext/standard/tests/class_object/method_exists_variation_003.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test method_exists() function : variation - Case sensitivity +--FILE-- + +--EXPECTF-- +*** Testing method_exists() : variation *** +bool(true) +bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/property_exists_error.phpt b/ext/standard/tests/class_object/property_exists_error.phpt new file mode 100644 index 0000000..e40e08b --- /dev/null +++ b/ext/standard/tests/class_object/property_exists_error.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test property_exists() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing property_exists() : error conditions *** + +-- Testing property_exists() function with more than expected no. of arguments -- + +Warning: property_exists() expects exactly 2 parameters, 3 given in %sproperty_exists_error.php on line %d +NULL + +-- Testing property_exists() function with less than expected no. of arguments -- + +Warning: property_exists() expects exactly 2 parameters, 1 given in %sproperty_exists_error.php on line %d +NULL + +-- Testing property_exists() function with incorrect arguments -- + +Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists_error.php on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/class_object/property_exists_variation1.phpt b/ext/standard/tests/class_object/property_exists_variation1.phpt new file mode 100644 index 0000000..1505a4b --- /dev/null +++ b/ext/standard/tests/class_object/property_exists_variation1.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test property_exists() function : class auto loading +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing property_exists() : class auto loading *** + +testing property in autoloaded class +bool(true) + +testing __get magic method +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/class_object/trait_class_exists_variation_003.phpt b/ext/standard/tests/class_object/trait_class_exists_variation_003.phpt new file mode 100644 index 0000000..6a8e55b --- /dev/null +++ b/ext/standard/tests/class_object/trait_class_exists_variation_003.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test trait_exists() function : usage variations - case sensitivity +--FILE-- + +--EXPECTF-- +bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/trait_exists_basic_001.phpt b/ext/standard/tests/class_object/trait_exists_basic_001.phpt new file mode 100644 index 0000000..19616ab --- /dev/null +++ b/ext/standard/tests/class_object/trait_exists_basic_001.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test trait_exists() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing trait_exists() : basic functionality *** +Calling trait_exists() on non-existent trait with autoload explicitly enabled: +In __autoload(C) +bool(false) + +Calling trait_exists() on existing trait with autoload explicitly enabled: +bool(true) + +Calling trait_exists() on non-existent trait with autoload explicitly enabled: +bool(false) + +Calling trait_exists() on existing trait with autoload explicitly disabled: +bool(true) + +Calling trait_exists() on non-existent trait with autoload unspecified: +In __autoload(E) +bool(false) + +Calling trait_exists() on existing trait with autoload unspecified: +bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/trait_exists_error_001.phpt b/ext/standard/tests/class_object/trait_exists_error_001.phpt new file mode 100644 index 0000000..b80f06e --- /dev/null +++ b/ext/standard/tests/class_object/trait_exists_error_001.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test trait_exists() function : error conditions (wrong number of arguments) +--FILE-- + +--EXPECTF-- +*** Testing trait_exists() : error conditions *** + +-- Testing trait_exists() function with Zero arguments -- + +Warning: trait_exists() expects at least 1 parameter, 0 given in %s on line 16 +NULL + +-- Testing trait_exists() function with more than expected no. of arguments -- + +Warning: trait_exists() expects at most 2 parameters, 3 given in %s on line 23 +NULL +Done diff --git a/ext/standard/tests/class_object/trait_exists_variation_001.phpt b/ext/standard/tests/class_object/trait_exists_variation_001.phpt new file mode 100644 index 0000000..65ef199 --- /dev/null +++ b/ext/standard/tests/class_object/trait_exists_variation_001.phpt @@ -0,0 +1,187 @@ +--TEST-- +Test trait_exists() function : usage variations - unexpected types for agument 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for traitname + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( trait_exists($value, $autoload) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing trait_exists() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(67) +Error: 8 - Undefined variable: unset_var, %s(70) + +Arg value 0 +In __autoload(0) +bool(false) + +Arg value 1 +In __autoload(1) +bool(false) + +Arg value 12345 +In __autoload(12345) +bool(false) + +Arg value -2345 +In __autoload(-2345) +bool(false) + +Arg value 10.5 +In __autoload(10.5) +bool(false) + +Arg value -10.5 +In __autoload(-10.5) +bool(false) + +Arg value 101234567000 +In __autoload(101234567000) +bool(false) + +Arg value 1.07654321E-9 +In __autoload(1.07654321E-9) +bool(false) + +Arg value 0.5 +In __autoload(0.5) +bool(false) +Error: 8 - Array to string conversion, %strait_exists_variation_001.php(%d) + +Arg value Array +Error: 2 - trait_exists() expects parameter 1 to be string, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %strait_exists_variation_001.php(%d) + +Arg value Array +Error: 2 - trait_exists() expects parameter 1 to be string, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %strait_exists_variation_001.php(%d) + +Arg value Array +Error: 2 - trait_exists() expects parameter 1 to be string, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %strait_exists_variation_001.php(%d) + +Arg value Array +Error: 2 - trait_exists() expects parameter 1 to be string, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %strait_exists_variation_001.php(%d) + +Arg value Array +Error: 2 - trait_exists() expects parameter 1 to be string, array given, %s(77) +NULL + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +In __autoload(1) +bool(false) + +Arg value +bool(false) + +Arg value 1 +In __autoload(1) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(76) + +Arg value +Error: 2 - trait_exists() expects parameter 1 to be string, object given, %s(77) +NULL + +Arg value +bool(false) + +Arg value +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/class_object/trait_exists_variation_002.phpt b/ext/standard/tests/class_object/trait_exists_variation_002.phpt new file mode 100644 index 0000000..a2fcbbf --- /dev/null +++ b/ext/standard/tests/class_object/trait_exists_variation_002.phpt @@ -0,0 +1,198 @@ +--TEST-- +Test trait_exists() function : usage variations - unexpected types for agument 2 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for autoload + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( trait_exists($traitname, $value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing trait_exists() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(71) +Error: 8 - Undefined variable: unset_var, %s(74) + +Arg value 0 +bool(false) + +Arg value 1 +In __autoload(string_val) +bool(false) + +Arg value 12345 +In __autoload(string_val) +bool(false) + +Arg value -2345 +In __autoload(string_val) +bool(false) + +Arg value 10.5 +In __autoload(string_val) +bool(false) + +Arg value -10.5 +In __autoload(string_val) +bool(false) + +Arg value 101234567000 +In __autoload(string_val) +bool(false) + +Arg value 1.07654321E-9 +In __autoload(string_val) +bool(false) + +Arg value 0.5 +In __autoload(string_val) +bool(false) +Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - trait_exists() expects parameter 2 to be boolean, array given, %s(81) +NULL +Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - trait_exists() expects parameter 2 to be boolean, array given, %s(81) +NULL +Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - trait_exists() expects parameter 2 to be boolean, array given, %s(81) +NULL +Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - trait_exists() expects parameter 2 to be boolean, array given, %s(81) +NULL +Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d) + +Arg value Array +Error: 2 - trait_exists() expects parameter 2 to be boolean, array given, %s(81) +NULL + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +In __autoload(string_val) +bool(false) + +Arg value +bool(false) + +Arg value 1 +In __autoload(string_val) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value string +In __autoload(string_val) +bool(false) + +Arg value string +In __autoload(string_val) +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(80) + +Arg value +Error: 2 - trait_exists() expects parameter 2 to be boolean, object given, %s(81) +NULL + +Arg value +bool(false) + +Arg value +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/dir/chdir_basic.phpt b/ext/standard/tests/dir/chdir_basic.phpt new file mode 100644 index 0000000..5fc0e5b --- /dev/null +++ b/ext/standard/tests/dir/chdir_basic.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test chdir() function : basic functionality +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing chdir() : basic functionality *** + +-- Testing chdir() with absolute path: -- +bool(true) +string(%d) "%slevel_one" + +-- Testing chdir() with relative paths: -- +bool(true) +string(%d) "%slevel_one%elevel_two" +===DONE=== diff --git a/ext/standard/tests/dir/chdir_error1.phpt b/ext/standard/tests/dir/chdir_error1.phpt new file mode 100644 index 0000000..0f57ff5 --- /dev/null +++ b/ext/standard/tests/dir/chdir_error1.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test chdir() function : error conditions - Incorrect number of arguments +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing chdir() : error conditions *** + +-- Testing chdir() function with Zero arguments -- + +Warning: chdir() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing chdir() function with more than expected no. of arguments -- + +Warning: chdir() expects exactly 1 parameter, 2 given in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/chdir_error2.phpt b/ext/standard/tests/dir/chdir_error2.phpt new file mode 100644 index 0000000..a3bbb63 --- /dev/null +++ b/ext/standard/tests/dir/chdir_error2.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test chdir() function : error conditions - Non-existent directory +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing chdir() : error conditions *** + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/chdir_variation1.phpt b/ext/standard/tests/dir/chdir_variation1.phpt new file mode 100644 index 0000000..c4c0431 --- /dev/null +++ b/ext/standard/tests/dir/chdir_variation1.phpt @@ -0,0 +1,235 @@ +--TEST-- +Test chdir() function : usage variations - different data type as $directory arg +--FILE-- +dir_path = $dir; + } + + public function __toString() { + return "$this->dir_path"; + } +} + +// heredoc string +$heredoc = << +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing chdir() : usage variations *** + +-- Iteration 1 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 2 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 3 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 4 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 5 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 7 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 8 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 9 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 10 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 15 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 16 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 17 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 18 -- + +Warning: chdir() expects parameter 1 to be a valid path, array given in %s on line %d +bool(false) + +-- Iteration 19 -- +bool(true) + +-- Iteration 20 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 21 -- +bool(true) + +-- Iteration 22 -- +bool(true) + +-- Iteration 23 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 24 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 25 -- + +Warning: chdir() expects parameter 1 to be a valid path, resource given in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/chdir_variation2.phpt b/ext/standard/tests/dir/chdir_variation2.phpt new file mode 100644 index 0000000..fa70f9e --- /dev/null +++ b/ext/standard/tests/dir/chdir_variation2.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test chdir() function : usage variations - relative paths +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing chdir() : usage variations *** + +-- $directory = './level_one': -- +bool(true) +bool(true) +string(%d) "%slevel_one" + +-- $directory = 'level_one/level_two': -- +bool(true) +bool(true) +string(%d) "%slevel_one%elevel_two" + +-- $directory = '..': -- +bool(true) +string(%d) "%slevel_one" + +-- $directory = 'level_two', '.': -- +bool(true) +bool(true) +string(%d) "%slevel_one%elevel_two" + +-- $directory = '../': -- +bool(true) +string(%d) "%slevel_one" + +-- $directory = './': -- +bool(true) +bool(true) +string(%d) "%slevel_one%elevel_two" + +-- $directory = '../../'level_one': -- +bool(true) +bool(true) +string(%d) "%slevel_one" +===DONE=== diff --git a/ext/standard/tests/dir/closedir_basic.phpt b/ext/standard/tests/dir/closedir_basic.phpt new file mode 100644 index 0000000..49080bb --- /dev/null +++ b/ext/standard/tests/dir/closedir_basic.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test closedir() function : basic functionality +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing closedir() : basic functionality *** + +-- Call closedir() with no arguments: -- +NULL +-- Check Directory Handle: -- +resource(%d) of type (Unknown) + +-- Call closedir() with $dir_handle argument supplied: -- +NULL +-- Check Directory Handle: -- +resource(%d) of type (Unknown) +===DONE=== diff --git a/ext/standard/tests/dir/closedir_error.phpt b/ext/standard/tests/dir/closedir_error.phpt new file mode 100644 index 0000000..c2f7647 --- /dev/null +++ b/ext/standard/tests/dir/closedir_error.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test closedir() function : error conditions - Pass incorrect number of arguments +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing closedir() : error conditions *** + +-- Testing closedir() function with more than expected no. of arguments -- + +Warning: closedir() expects at most 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/closedir_variation1.phpt b/ext/standard/tests/dir/closedir_variation1.phpt new file mode 100644 index 0000000..ecc4477 --- /dev/null +++ b/ext/standard/tests/dir/closedir_variation1.phpt @@ -0,0 +1,212 @@ +--TEST-- +Test closedir() function : usage variations - different data types as $dir_handle arg +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing closedir() : usage variations *** + +-- Iteration 1 -- + +Warning: closedir() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: closedir() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: closedir() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: closedir() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: closedir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: closedir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: closedir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: closedir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: closedir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: closedir() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: closedir() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: closedir() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: closedir() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: closedir() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: closedir() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: closedir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: closedir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: closedir() expects parameter 1 to be resource, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: closedir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: closedir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: closedir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: closedir() expects parameter 1 to be resource, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: closedir() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: closedir() expects parameter 1 to be resource, null given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/closedir_variation2.phpt b/ext/standard/tests/dir/closedir_variation2.phpt new file mode 100644 index 0000000..015176c --- /dev/null +++ b/ext/standard/tests/dir/closedir_variation2.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test closedir() function : usage variations - close directory handle twice +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing closedir() : usage variations *** + +-- Close directory handle first time: -- +NULL +Directory Handle: resource(%d) of type (Unknown) + +-- Close directory handle second time: -- + +Warning: closedir(): %d is not a valid Directory resource in %s on line %d +bool(false) +Directory Handle: resource(%d) of type (Unknown) +===DONE=== diff --git a/ext/standard/tests/dir/closedir_variation3.phpt b/ext/standard/tests/dir/closedir_variation3.phpt new file mode 100644 index 0000000..b9b5e67 --- /dev/null +++ b/ext/standard/tests/dir/closedir_variation3.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test closedir() function : usage variations - close a file pointer +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing closedir() : usage variations *** + +-- Open a file using fopen() -- +resource(%d) of type (stream) + +-- Try to close the file pointer using closedir() -- + +Warning: closedir(): %d is not a valid Directory resource in %s on line %d +bool(false) + +-- Check file pointer: -- +resource(%d) of type (stream) +===DONE=== diff --git a/ext/standard/tests/dir/dir_basic.phpt b/ext/standard/tests/dir/dir_basic.phpt new file mode 100644 index 0000000..dba49db --- /dev/null +++ b/ext/standard/tests/dir/dir_basic.phpt @@ -0,0 +1,86 @@ +--TEST-- +Test dir() function : basic functionality +--FILE-- +read() ); +var_dump( $d->read() ); +var_dump( $d->rewind() ); + +echo "\nTest using handle directly:\n"; +var_dump( readdir($d->handle) ); +var_dump( readdir($d->handle) ); + +echo "\nClose directory:\n"; +var_dump( $d->close() ); +var_dump( $d ); + +echo "\nTest read after closing the dir:"; +var_dump( $d->read() ); + +// delete temp files +delete_files($dir_path, 3, "dir_basic", 1, ".tmp"); +echo "Done"; +?> +--CLEAN-- + +--EXPECTF-- +*** Testing dir() : basic functionality *** +Get Directory instance: +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_basic" + ["handle"]=> + resource(%d) of type (stream) +} + +Read and rewind: +string(%d) "%s" +string(%d) "%s" +NULL + +Test using handle directly: +string(%d) "%s" +string(%d) "%s" + +Close directory: +NULL +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_basic" + ["handle"]=> + resource(%d) of type (Unknown) +} + +Test read after closing the dir: +Warning: Directory::read(): %d is not a valid Directory resource in %s on line %d +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/dir/dir_error.phpt b/ext/standard/tests/dir/dir_error.phpt new file mode 100644 index 0000000..f2ef25c --- /dev/null +++ b/ext/standard/tests/dir/dir_error.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test dir() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing dir() : error conditions *** + +-- Testing dir() function with zero arguments -- +Warning: dir() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing dir() function with one more than expected number of arguments -- +Warning: dir() expects at most 2 parameters, 3 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/dir/dir_variation1-win32.phpt b/ext/standard/tests/dir/dir_variation1-win32.phpt new file mode 100644 index 0000000..1f7f4a2 --- /dev/null +++ b/ext/standard/tests/dir/dir_variation1-win32.phpt @@ -0,0 +1,170 @@ +--TEST-- +Test dir() function : usage variations - unexpected value for 'dir' argument +--SKIPIF-- + +--FILE-- +var = 10; + } +} + +// get a resource variable +$fp = fopen(__FILE__, "r"); // get a file handle +$dfp = opendir( dirname(__FILE__) ); // get a dir handle + +// unexpected values to be passed to $directory argument +$unexpected_values = array ( + + // array data +/*1*/ array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data +/*6*/ NULL, + null, + + // boolean data +/*8*/ true, + false, + TRUE, + FALSE, + + // empty data +/*12*/ "", + '', + + // undefined data +/*14*/ @$undefined_var, + + // unset data +/*15*/ @$unset_var, + + // resource variable(dir and file handle) +/*16*/ $fp, + $dfp, + + // object data +/*18*/ new A() +); + +// loop through various elements of $unexpected_values to check the behavior of dir() +$iterator = 1; +foreach( $unexpected_values as $unexpected_value ) { + echo "\n-- Iteration $iterator --\n"; + var_dump( dir($unexpected_value) ); + $iterator++; +} + +fclose($fp); +closedir($dfp); +echo "Done"; +?> +--EXPECTF-- +*** Testing dir() : unexpected values for $directory argument *** + +-- Iteration 1 -- + +Warning: dir() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: dir() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: dir() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: dir() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: dir() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 6 -- +bool(false) + +-- Iteration 7 -- +bool(false) + +-- Iteration 8 -- + +Warning: dir(1,1): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: dir(1): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 9 -- +bool(false) + +-- Iteration 10 -- + +Warning: dir(1,1): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: dir(1): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 11 -- +bool(false) + +-- Iteration 12 -- +bool(false) + +-- Iteration 13 -- +bool(false) + +-- Iteration 14 -- +bool(false) + +-- Iteration 15 -- +bool(false) + +-- Iteration 16 -- + +Warning: dir() expects parameter 1 to be string, resource given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: dir() expects parameter 1 to be string, resource given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: dir() expects parameter 1 to be string, object given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/dir/dir_variation1.phpt b/ext/standard/tests/dir/dir_variation1.phpt new file mode 100644 index 0000000..abb4719 --- /dev/null +++ b/ext/standard/tests/dir/dir_variation1.phpt @@ -0,0 +1,166 @@ +--TEST-- +Test dir() function : usage variations - unexpected value for 'dir' argument +--SKIPIF-- + +--FILE-- +var = 10; + } +} + +// get a resource variable +$fp = fopen(__FILE__, "r"); // get a file handle +$dfp = opendir( dirname(__FILE__) ); // get a dir handle + +// unexpected values to be passed to $directory argument +$unexpected_values = array ( + + // array data +/*1*/ array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data +/*6*/ NULL, + null, + + // boolean data +/*8*/ true, + false, + TRUE, + FALSE, + + // empty data +/*12*/ "", + '', + + // undefined data +/*14*/ @$undefined_var, + + // unset data +/*15*/ @$unset_var, + + // resource variable(dir and file handle) +/*16*/ $fp, + $dfp, + + // object data +/*18*/ new A() +); + +// loop through various elements of $unexpected_values to check the behavior of dir() +$iterator = 1; +foreach( $unexpected_values as $unexpected_value ) { + echo "\n-- Iteration $iterator --\n"; + var_dump( dir($unexpected_value) ); + $iterator++; +} + +fclose($fp); +closedir($dfp); +echo "Done"; +?> +--EXPECTF-- +*** Testing dir() : unexpected values for $directory argument *** + +-- Iteration 1 -- + +Warning: dir() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: dir() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: dir() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: dir() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: dir() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 6 -- +bool(false) + +-- Iteration 7 -- +bool(false) + +-- Iteration 8 -- + +Warning: dir(1): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 9 -- +bool(false) + +-- Iteration 10 -- + +Warning: dir(1): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 11 -- +bool(false) + +-- Iteration 12 -- +bool(false) + +-- Iteration 13 -- +bool(false) + +-- Iteration 14 -- +bool(false) + +-- Iteration 15 -- +bool(false) + +-- Iteration 16 -- + +Warning: dir() expects parameter 1 to be string, resource given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: dir() expects parameter 1 to be string, resource given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: dir() expects parameter 1 to be string, object given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/dir/dir_variation2.phpt b/ext/standard/tests/dir/dir_variation2.phpt new file mode 100644 index 0000000..ee42900 --- /dev/null +++ b/ext/standard/tests/dir/dir_variation2.phpt @@ -0,0 +1,223 @@ +--TEST-- +Test dir() function : usage variations - unexpected value for 'context' argument +--FILE-- +var = 10; + } +} + +// heredoc string +$heredoc = << 'red', 'item' => 'pen'), + + + // null data +/*15*/ NULL, + null, + + // boolean data +/*17*/ true, + false, + TRUE, + FALSE, + + // empty data +/*21*/ "", + '', + + // string data +/*23*/ "string", + 'string', + $heredoc, + + // object data +/*26*/ new classA(), + + // undefined data +/*27*/ @$undefined_var, + + // unset data +/*28*/ @$unset_var +); + +// loop through various elements of $unexpected_values to check the behavior of dir() +$iterator = 1; +foreach( $unexpected_values as $unexpected_value ) { + echo "\n-- Iteration $iterator --"; + var_dump( dir($directory, $unexpected_value) ); + $iterator++; +} + +echo "Done"; +?> +--CLEAN-- + +--EXPECTF-- +*** Testing dir() : unexpected values for $context argument *** + +-- Iteration 1 -- +Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 2 -- +Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 3 -- +Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 4 -- +Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 5 -- +Warning: dir() expects parameter 2 to be resource, double given in %s on line %d +NULL + +-- Iteration 6 -- +Warning: dir() expects parameter 2 to be resource, double given in %s on line %d +NULL + +-- Iteration 7 -- +Warning: dir() expects parameter 2 to be resource, double given in %s on line %d +NULL + +-- Iteration 8 -- +Warning: dir() expects parameter 2 to be resource, double given in %s on line %d +NULL + +-- Iteration 9 -- +Warning: dir() expects parameter 2 to be resource, double given in %s on line %d +NULL + +-- Iteration 10 -- +Warning: dir() expects parameter 2 to be resource, array given in %s on line %d +NULL + +-- Iteration 11 -- +Warning: dir() expects parameter 2 to be resource, array given in %s on line %d +NULL + +-- Iteration 12 -- +Warning: dir() expects parameter 2 to be resource, array given in %s on line %d +NULL + +-- Iteration 13 -- +Warning: dir() expects parameter 2 to be resource, array given in %s on line %d +NULL + +-- Iteration 14 -- +Warning: dir() expects parameter 2 to be resource, array given in %s on line %d +NULL + +-- Iteration 15 -- +Warning: dir() expects parameter 2 to be resource, null given in %s on line %d +NULL + +-- Iteration 16 -- +Warning: dir() expects parameter 2 to be resource, null given in %s on line %d +NULL + +-- Iteration 17 -- +Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 18 -- +Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 19 -- +Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 20 -- +Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 21 -- +Warning: dir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 22 -- +Warning: dir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 23 -- +Warning: dir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 24 -- +Warning: dir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 25 -- +Warning: dir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 26 -- +Warning: dir() expects parameter 2 to be resource, object given in %s on line %d +NULL + +-- Iteration 27 -- +Warning: dir() expects parameter 2 to be resource, null given in %s on line %d +NULL + +-- Iteration 28 -- +Warning: dir() expects parameter 2 to be resource, null given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/dir/dir_variation3.phpt b/ext/standard/tests/dir/dir_variation3.phpt new file mode 100644 index 0000000..f8d3258 --- /dev/null +++ b/ext/standard/tests/dir/dir_variation3.phpt @@ -0,0 +1,204 @@ +--TEST-- +Test dir() function : usage variations - different directory permissions +--SKIPIF-- + +--FILE-- +read()); + + // close directory + $d->close(); +} + +echo "Done"; +?> +--CLEAN-- + +--EXPECTF-- +*** Testing dir() : different directory permissions *** +-- Iteration 1 -- +bool(true) +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation3" + ["handle"]=> + resource(%d) of type (stream) +} +-- reading contents -- +string(%d) "%s" + +-- Iteration 2 -- +bool(true) +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation3" + ["handle"]=> + resource(%d) of type (stream) +} +-- reading contents -- +string(%d) "%s" + +-- Iteration 3 -- +bool(true) +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation3" + ["handle"]=> + resource(%d) of type (stream) +} +-- reading contents -- +string(%d) "%s" + +-- Iteration 4 -- +bool(true) +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation3" + ["handle"]=> + resource(%d) of type (stream) +} +-- reading contents -- +string(%d) "%s" + +-- Iteration 5 -- +bool(true) +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation3" + ["handle"]=> + resource(%d) of type (stream) +} +-- reading contents -- +string(%d) "%s" + +-- Iteration 6 -- +bool(true) +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation3" + ["handle"]=> + resource(%d) of type (stream) +} +-- reading contents -- +string(%d) "%s" + +-- Iteration 7 -- +bool(true) +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation3" + ["handle"]=> + resource(%d) of type (stream) +} +-- reading contents -- +string(%d) "%s" + +-- Iteration 8 -- +bool(true) +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation3" + ["handle"]=> + resource(%d) of type (stream) +} +-- reading contents -- +string(%d) "%s" + +-- Iteration 9 -- +bool(true) +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation3" + ["handle"]=> + resource(%d) of type (stream) +} +-- reading contents -- +string(%d) "%s" + +-- Iteration 10 -- +bool(true) +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation3" + ["handle"]=> + resource(%d) of type (stream) +} +-- reading contents -- +string(%d) "%s" +Done diff --git a/ext/standard/tests/dir/dir_variation4.phpt b/ext/standard/tests/dir/dir_variation4.phpt new file mode 100644 index 0000000..62b10b2 --- /dev/null +++ b/ext/standard/tests/dir/dir_variation4.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test dir() function : usage variations - operate on previously opened directory +--FILE-- +read() ); // with previous handle + +echo "-- reading directory contents with current handle --\n"; +var_dump( $e->read() ); // with current handle + +// delete temporary files +delete_files($dir_path, 3, "dir_variation4"); +echo "Done"; +?> +--CLEAN-- + +--EXPECTF-- +*** Testing dir() : operate on previously opened directory *** +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation4" + ["handle"]=> + resource(%d) of type (stream) +} +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation4" + ["handle"]=> + resource(%d) of type (stream) +} +-- reading directory contents with previous handle -- +string(%d) "%s" +-- reading directory contents with current handle -- +string(%d) "%s" +Done diff --git a/ext/standard/tests/dir/dir_variation5-win32.phpt b/ext/standard/tests/dir/dir_variation5-win32.phpt new file mode 100644 index 0000000..e70b9d3 --- /dev/null +++ b/ext/standard/tests/dir/dir_variation5-win32.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test dir() function : usage variations - open a file instead of directory +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing dir() : open a file instead of a directory *** + +Warning: dir(%s): The directory name is invalid. (code: %d) in %s on line %d + +Warning: dir(%s): failed to open dir: %s in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/dir/dir_variation5.phpt b/ext/standard/tests/dir/dir_variation5.phpt new file mode 100644 index 0000000..c7450ea --- /dev/null +++ b/ext/standard/tests/dir/dir_variation5.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test dir() function : usage variations - open a file instead of directory +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing dir() : open a file instead of a directory *** + +Warning: dir(%s): failed to open dir: %s in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/dir/dir_variation6-win32.phpt b/ext/standard/tests/dir/dir_variation6-win32.phpt new file mode 100644 index 0000000..e0e4749 --- /dev/null +++ b/ext/standard/tests/dir/dir_variation6-win32.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test dir() function : usage variations - non-existent directory +--SKIPIF-- + +--FILE-- +close(); //close the dir + +// remove directory and try to open the same(non-existent) directory again +rmdir($dir_path); +clearstatcache(); + +echo "-- opening previously removed directory --\n"; +var_dump( dir($dir_path) ); + +// point to a non-existent directory +$non_existent_dir = $file_path."/non_existent_dir"; +echo "-- opening non-existent directory --\n"; +$d = dir($non_existent_dir); +var_dump( $d ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing dir() : open a non-existent directory *** +-- opening previously removed directory -- + +Warning: dir(%s): The system cannot find the file specified. (code: %d) in %s on line %d + +Warning: dir(%s): failed to open dir: %s in %s on line %d +bool(false) +-- opening non-existent directory -- + +Warning: dir(%s): The system cannot find the file specified. (code: %d) in %s on line %d + +Warning: dir(%s): failed to open dir: %s in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/dir/dir_variation6.phpt b/ext/standard/tests/dir/dir_variation6.phpt new file mode 100644 index 0000000..71cbf1f --- /dev/null +++ b/ext/standard/tests/dir/dir_variation6.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test dir() function : usage variations - non-existent directory +--SKIPIF-- + +--FILE-- +close(); //close the dir + +// remove directory and try to open the same(non-existent) directory again +rmdir($dir_path); +clearstatcache(); + +echo "-- opening previously removed directory --\n"; +var_dump( dir($dir_path) ); + +// point to a non-existent directory +$non_existent_dir = $file_path."/non_existent_dir"; +echo "-- opening non-existent directory --\n"; +$d = dir($non_existent_dir); +var_dump( $d ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing dir() : open a non-existent directory *** +-- opening previously removed directory -- + +Warning: dir(%s): failed to open dir: %s in %s on line %d +bool(false) +-- opening non-existent directory -- + +Warning: dir(%s): failed to open dir: %s in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/dir/dir_variation7.phpt b/ext/standard/tests/dir/dir_variation7.phpt new file mode 100644 index 0000000..ca168f9 --- /dev/null +++ b/ext/standard/tests/dir/dir_variation7.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test dir() function : usage variations - directories with restricted permissions +--SKIPIF-- + +--FILE-- + sub_dir ( sub parent ) + |-> child_dir ( child dir) +*/ +$file_path = dirname(__FILE__); +$parent_dir_path = $file_path."/dir_variation7"; +@mkdir($parent_dir_path); +chmod($parent_dir_path, 0777); + +// create sub_dir +$sub_dir_path = $parent_dir_path."/sub_dir"; +@mkdir($sub_dir_path); +chmod($sub_dir_path, 0777); + +//create sub_sub_dir +$child_dir_path = $sub_dir_path."/child_dir"; +@mkdir($child_dir_path); + +// remove the write and execute permisson from sub parent +chmod($sub_dir_path, 0444); +echo "-- After restricting 1st level parent directory --\n"; +$d = dir($child_dir_path); // try to open, expected failure +var_dump( $d ); // dump it + +// remove the execute permisson from parent dir, allowing all permission for sub dir +chmod($sub_dir_path, 0777); // all permisson to sub dir +chmod($parent_dir_path, 0666); // restricting parent directory +echo "-- After restricting parent directory --\n"; +$d = dir($child_dir_path); // try to open, expected failure +var_dump( $d ); // dump it + +echo "Done"; +?> +--CLEAN-- + +--EXPECTF-- +*** Testing dir() : remove execute permission from the parent dir *** +-- After restricting 1st level parent directory -- + +Warning: dir(%s/dir_variation7/sub_dir/child_dir): failed to open dir: %s in %s on line %d +bool(false) +-- After restricting parent directory -- + +Warning: dir(%s/dir_variation7/sub_dir/child_dir): failed to open dir: %s in %s on line %d +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/dir/dir_variation8-win32.phpt b/ext/standard/tests/dir/dir_variation8-win32.phpt new file mode 100644 index 0000000..a56c98b --- /dev/null +++ b/ext/standard/tests/dir/dir_variation8-win32.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test dir() function : usage variations - checking with wildcard characters +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing dir() : checking with wildcard characters *** +-- wildcard = '*' -- + +Warning: dir(%s/dir_var*,%s/dir_var*): %r(No such file or directory|The system cannot find the path specified. \(code: 3\))%r in %s on line %d + +Warning: dir(%s/dir_var*): failed to open dir: %s in %s on line %d +bool(false) + +Warning: dir(%s/*,%s/*): %r(No such file or directory|The system cannot find the path specified. \(code: 3\))%r in %s on line %d + +Warning: dir(%s/*): failed to open dir: %s in %s on line %d +bool(false) +-- wildcard = '?' -- + +Warning: dir(%s/dir_variation81/sub_dir?,%s/dir_variation81/sub_dir?): %r(No such file or directory|The system cannot find the path specified. \(code: 3\))%r in %s on line %d + +Warning: dir(%s/dir_variation81/sub_dir?): failed to open dir: %s in %s on line %d +bool(false) + +Warning: dir(%s/dir_variation81/sub?dir1,%s/dir_variation81/sub?dir1): %r(No such file or directory|The system cannot find the path specified. \(code: 3\))%r in %s on line %d + +Warning: dir(%s/dir_variation81/sub?dir1): failed to open dir: %s in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/dir/dir_variation8.phpt b/ext/standard/tests/dir/dir_variation8.phpt new file mode 100644 index 0000000..5ecf449 --- /dev/null +++ b/ext/standard/tests/dir/dir_variation8.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test dir() function : usage variations - checking with wildcard characters +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing dir() : checking with wildcard characters *** +-- wildcard = '*' -- + +Warning: dir(%s/dir_var*): failed to open dir: %s in %s on line %d +bool(false) + +Warning: dir(%s/*): failed to open dir: %s in %s on line %d +bool(false) +-- wildcard = '?' -- + +Warning: dir(%s/dir_variation81/sub_dir?): failed to open dir: %s in %s on line %d +bool(false) + +Warning: dir(%s/dir_variation81/sub?dir1): failed to open dir: %s in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/dir/dir_variation9-win32.phpt b/ext/standard/tests/dir/dir_variation9-win32.phpt new file mode 100644 index 0000000..32b0bd9 --- /dev/null +++ b/ext/standard/tests/dir/dir_variation9-win32.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test dir() function : usage variations - relative valid and invalid paths +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing dir() : checking with valid and invalid paths *** + +-- With valid paths -- +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation91/sub_dir11/sub_dir111/.." + ["handle"]=> + resource(%d) of type (stream) +} +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation92/sub_dir21/../../dir_variation91" + ["handle"]=> + resource(%d) of type (stream) +} +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation92/sub_dir21/../../dir_variation91/sub_dir11/.." + ["handle"]=> + resource(%d) of type (stream) +} +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation91/sub_dir11/sub_dir111/../../../dir_variation92/sub_dir21/.." + ["handle"]=> + resource(%d) of type (stream) +} + +-- With invalid paths -- + +Warning: dir(%sdir_variation91/sub_dir12/sub_dir111/..,%sdir_variation91/sub_dir12/sub_dir111/..): The system cannot find the path specified. (code: 3) in %sdir_variation9-win32.php on line %d + +Warning: dir(%s/dir_variation91/sub_dir12/sub_dir111/..): failed to open dir: %s in %s on line %d +bool(false) + +Warning: dir(%sdir_variation92/sub_dir21/../dir_variation91,%sdir_variation92/sub_dir21/../dir_variation91): The system cannot find the file specified. (code: 2) in %sdir_variation9-win32.php on line %d + +Warning: dir(%s/dir_variation92/sub_dir21/../dir_variation91): failed to open dir: %s in %s on line %d +bool(false) + +Warning: dir(%sdir_variation92/sub_dir21/../../dir_variation91/sub_dir12/..,%sdir_variation92/sub_dir21/../../dir_variation91/sub_dir12/..): The system cannot find the file specified. (code: 2) in %sdir_variation9-win32.php on line %d + +Warning: dir(%s/dir_variation92/sub_dir21/../../dir_variation91/sub_dir12/..): failed to open dir: %s in %s on line %d +bool(false) + +Warning: dir(%sdir_variation91/sub_dir11/sub_dir111/../../dir_variation92/sub_dir21/..,%sdir_variation91/sub_dir11/sub_dir111/../../dir_variation92/sub_dir21/..): The system cannot find the path specified. (code: 3) in %sdir_variation9-win32.php on line %d + +Warning: dir(%s/dir_variation91/sub_dir11/sub_dir111/../../dir_variation92/sub_dir21/..): failed to open dir: %s in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/dir/dir_variation9.phpt b/ext/standard/tests/dir/dir_variation9.phpt new file mode 100644 index 0000000..458d0b8 --- /dev/null +++ b/ext/standard/tests/dir/dir_variation9.phpt @@ -0,0 +1,117 @@ +--TEST-- +Test dir() function : usage variations - relative valid and invalid paths +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing dir() : checking with valid and invalid paths *** + +-- With valid paths -- +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation91/sub_dir11/sub_dir111/.." + ["handle"]=> + resource(%d) of type (stream) +} +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation92/sub_dir21/../../dir_variation91" + ["handle"]=> + resource(%d) of type (stream) +} +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation92/sub_dir21/../../dir_variation91/sub_dir11/.." + ["handle"]=> + resource(%d) of type (stream) +} +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/dir_variation91/sub_dir11/sub_dir111/../../../dir_variation92/sub_dir21/.." + ["handle"]=> + resource(%d) of type (stream) +} + +-- With invalid paths -- + +Warning: dir(%s/dir_variation91/sub_dir12/sub_dir111/..): failed to open dir: %s in %s on line %d +bool(false) + +Warning: dir(%s/dir_variation92/sub_dir21/../dir_variation91): failed to open dir: %s in %s on line %d +bool(false) + +Warning: dir(%s/dir_variation92/sub_dir21/../../dir_variation91/sub_dir12/..): failed to open dir: %s in %s on line %d +bool(false) + +Warning: dir(%s/dir_variation91/sub_dir11/sub_dir111/../../dir_variation92/sub_dir21/..): failed to open dir: %s in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/dir/getcwd_basic.phpt b/ext/standard/tests/dir/getcwd_basic.phpt new file mode 100644 index 0000000..ef720d0 --- /dev/null +++ b/ext/standard/tests/dir/getcwd_basic.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test getcwd() function : basic functionality +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing getcwd() : basic functionality *** +string(%d) "%s" +string(%d) "%s%egetcwd_basic" +===DONE=== diff --git a/ext/standard/tests/dir/getcwd_error.phpt b/ext/standard/tests/dir/getcwd_error.phpt new file mode 100644 index 0000000..153f303 --- /dev/null +++ b/ext/standard/tests/dir/getcwd_error.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test getcwd() function : error conditions - Incorrect number of arguments +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing getcwd() : error conditions *** + +-- Testing getcwd() function with one argument -- + +Warning: getcwd() expects exactly 0 parameters, 1 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/opendir_basic.phpt b/ext/standard/tests/dir/opendir_basic.phpt new file mode 100644 index 0000000..17ada17 --- /dev/null +++ b/ext/standard/tests/dir/opendir_basic.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test opendir() function : basic functionality +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing opendir() : basic functionality *** + +-- Testing opendir() with absolute path: -- +resource(%d) of type (stream) + +-- Testing opendir() with relative paths: -- +bool(true) +resource(%d) of type (stream) + +-- Close directory handles: -- +resource(%d) of type (Unknown) +resource(%d) of type (Unknown) +===DONE=== diff --git a/ext/standard/tests/dir/opendir_error1.phpt b/ext/standard/tests/dir/opendir_error1.phpt new file mode 100644 index 0000000..92b8eee --- /dev/null +++ b/ext/standard/tests/dir/opendir_error1.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test opendir() function : error conditions - Incorrect number of args +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing opendir() : error conditions *** + +-- Testing opendir() function with Zero arguments -- + +Warning: opendir() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing opendir() function with more than expected no. of arguments -- + +Warning: opendir() expects at most 2 parameters, 3 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/opendir_error2-win32.phpt b/ext/standard/tests/dir/opendir_error2-win32.phpt new file mode 100644 index 0000000..c3ecd35 --- /dev/null +++ b/ext/standard/tests/dir/opendir_error2-win32.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test opendir() function : error conditions - Non-existent directory +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing opendir() : error conditions *** + +-- Pass a non-existent absolute path: -- + +Warning: opendir(%s/idonotexist,%s/idonotexist): The system cannot find the file specified. (code: %d) in %s on line %d + +Warning: opendir(%s/idonotexist): failed to open dir: %s in %s on line %d +bool(false) + +-- Pass a non-existent relative path: -- + +Warning: opendir(idonotexist,idonotexist): The system cannot find the file specified. (code: %d) in %s on line %d + +Warning: opendir(idonotexist): failed to open dir: %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/opendir_error2.phpt b/ext/standard/tests/dir/opendir_error2.phpt new file mode 100644 index 0000000..1c72409 --- /dev/null +++ b/ext/standard/tests/dir/opendir_error2.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test opendir() function : error conditions - Non-existent directory +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing opendir() : error conditions *** + +-- Pass a non-existent absolute path: -- + +Warning: opendir(%s/idonotexist): failed to open dir: %s in %s on line %d +bool(false) + +-- Pass a non-existent relative path: -- + +Warning: opendir(idonotexist): failed to open dir: %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/opendir_variation1-win32.phpt b/ext/standard/tests/dir/opendir_variation1-win32.phpt new file mode 100644 index 0000000..9a75a5b --- /dev/null +++ b/ext/standard/tests/dir/opendir_variation1-win32.phpt @@ -0,0 +1,248 @@ +--TEST-- +Test opendir() function : usage variations - different data types as $path arg +--SKIPIF-- + +--FILE-- +path = $path; + } + public function __toString() { + return $this->path; + } +} + +// heredoc string +$heredoc = << +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing opendir() : usage variations *** + +-- Iteration 1 -- + +Warning: opendir(0,0): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: opendir(0): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 2 -- + +Warning: opendir(1,1): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: opendir(1): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 3 -- + +Warning: opendir(12345,12345): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: opendir(12345): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 4 -- + +Warning: opendir(-2345,-2345): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: opendir(-2345): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 5 -- + +Warning: opendir(10.5,10.5): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: opendir(10.5): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: opendir(-10.5,-10.5): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: opendir(-10.5): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 7 -- + +Warning: opendir(123456789000,123456789000): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: opendir(123456789000): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 8 -- + +Warning: opendir(1.23456789E-9,1.23456789E-9): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: opendir(1.23456789E-9): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 9 -- + +Warning: opendir(0.5,0.5): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: opendir(0.5): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 10 -- +bool(false) + +-- Iteration 11 -- +bool(false) + +-- Iteration 12 -- + +Warning: opendir(1,1): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: opendir(1): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 13 -- +bool(false) + +-- Iteration 14 -- + +Warning: opendir(1,1): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: opendir(1): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 15 -- +bool(false) + +-- Iteration 16 -- +bool(false) + +-- Iteration 17 -- +bool(false) + +-- Iteration 18 -- + +Warning: opendir() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 19 -- +resource(%d) of type (stream) + +-- Iteration 20 -- + +Warning: opendir(string,string): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: opendir(string): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 21 -- +resource(%d) of type (stream) + +-- Iteration 22 -- +resource(%d) of type (stream) + +-- Iteration 23 -- +bool(false) + +-- Iteration 24 -- +bool(false) + +-- Iteration 25 -- + +Warning: opendir() expects parameter 1 to be string, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/opendir_variation1.phpt b/ext/standard/tests/dir/opendir_variation1.phpt new file mode 100644 index 0000000..8d195e1 --- /dev/null +++ b/ext/standard/tests/dir/opendir_variation1.phpt @@ -0,0 +1,224 @@ +--TEST-- +Test opendir() function : usage variations - different data types as $path arg +--SKIPIF-- + +--FILE-- +path = $path; + } + public function __toString() { + return $this->path; + } +} + +// heredoc string +$heredoc = << +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing opendir() : usage variations *** + +-- Iteration 1 -- + +Warning: opendir(0): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 2 -- + +Warning: opendir(1): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 3 -- + +Warning: opendir(12345): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 4 -- + +Warning: opendir(-2345): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 5 -- + +Warning: opendir(10.5): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: opendir(-10.5): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 7 -- + +Warning: opendir(123456789000): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 8 -- + +Warning: opendir(1.23456789E-9): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 9 -- + +Warning: opendir(0.5): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 10 -- +bool(false) + +-- Iteration 11 -- +bool(false) + +-- Iteration 12 -- + +Warning: opendir(1): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 13 -- +bool(false) + +-- Iteration 14 -- + +Warning: opendir(1): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 15 -- +bool(false) + +-- Iteration 16 -- +bool(false) + +-- Iteration 17 -- +bool(false) + +-- Iteration 18 -- + +Warning: opendir() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 19 -- +resource(%d) of type (stream) + +-- Iteration 20 -- + +Warning: opendir(string): failed to open dir: %s in %s on line %d +bool(false) + +-- Iteration 21 -- +resource(%d) of type (stream) + +-- Iteration 22 -- +resource(%d) of type (stream) + +-- Iteration 23 -- +bool(false) + +-- Iteration 24 -- +bool(false) + +-- Iteration 25 -- + +Warning: opendir() expects parameter 1 to be string, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/opendir_variation2.phpt b/ext/standard/tests/dir/opendir_variation2.phpt new file mode 100644 index 0000000..4236bec --- /dev/null +++ b/ext/standard/tests/dir/opendir_variation2.phpt @@ -0,0 +1,239 @@ +--TEST-- +Test opendir() function : usage variations - different data types as $context arg +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing opendir() : usage variation *** + +-- Iteration 1 -- + +Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: opendir() expects parameter 2 to be resource, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: opendir() expects parameter 2 to be resource, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: opendir(): supplied resource is not a valid Stream-Context resource in %s on line %d +resource(%d) of type (stream) +===DONE=== diff --git a/ext/standard/tests/dir/opendir_variation3.phpt b/ext/standard/tests/dir/opendir_variation3.phpt new file mode 100644 index 0000000..3de0dd3 --- /dev/null +++ b/ext/standard/tests/dir/opendir_variation3.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test opendir() function : usage variations - open a directory twice +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing opendir() : usage variation *** + +-- Open directory first time: -- +resource(%d) of type (stream) + +-- Open directory second time: -- +resource(%d) of type (stream) + +New resource created +===DONE=== diff --git a/ext/standard/tests/dir/opendir_variation4.phpt b/ext/standard/tests/dir/opendir_variation4.phpt new file mode 100644 index 0000000..b206417 --- /dev/null +++ b/ext/standard/tests/dir/opendir_variation4.phpt @@ -0,0 +1,107 @@ +--TEST-- +Test opendir() function : usage variations - different relative paths +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing opendir() : usage variation *** + +-- $path = './level_one': -- +bool(true) +resource(%d) of type (stream) + +-- $path = 'level_one/level_two': -- +bool(true) +resource(%d) of type (stream) + +-- $path = '..': -- +resource(%d) of type (stream) + +-- $path = 'level_two', '.': -- +bool(true) +resource(%d) of type (stream) + +-- $path = '../': -- +resource(%d) of type (stream) + +-- $path = './': -- +bool(true) +resource(%d) of type (stream) + +-- $path = '../../'level_one': -- +bool(true) +resource(%d) of type (stream) +===DONE=== diff --git a/ext/standard/tests/dir/opendir_variation5.phpt b/ext/standard/tests/dir/opendir_variation5.phpt new file mode 100644 index 0000000..f9bb38c --- /dev/null +++ b/ext/standard/tests/dir/opendir_variation5.phpt @@ -0,0 +1,103 @@ +--TEST-- +Test opendir() function : usage variations - directories with restricted permissions +--SKIPIF-- + +--FILE-- + sub_dir ( sub parent ) + * |-> child_dir ( child dir) + */ + +$parent_dir_path = dirname(__FILE__) . "/opendir_variation5"; +mkdir($parent_dir_path); +chmod($parent_dir_path, 0777); + +// create sub_dir +$sub_dir_path = $parent_dir_path . "/sub_dir"; +mkdir($sub_dir_path); +chmod($sub_dir_path, 0777); + +//create sub_sub_dir +$child_dir_path = $sub_dir_path."/child_dir"; +mkdir($child_dir_path); + +// remove the write and execute permisson from sub parent +chmod($sub_dir_path, 0444); + +echo "\n-- After restricting 1st level parent directory --\n"; +$dir_handle1 = opendir($child_dir_path); +var_dump( $dir_handle1 ); + +// remove the execute permisson from parent dir, allowing all permission for sub dir +chmod($sub_dir_path, 0777); // all permisson to sub dir +chmod($parent_dir_path, 0666); // restricting parent directory + +echo "\n-- After restricting parent directory --\n"; +$dir_handle2 = opendir($child_dir_path); // try to open, expected failure +var_dump( $dir_handle2 ); // dump it + +if (is_resource($dir_handle1)) { + closedir($dir_handle1); +} +if (is_resource($dir_handle2)) { + closedir($dir_handle2); +} +?> +===DONE=== +--CLEAN-- + + +--EXPECTF-- +*** Testing opendir() : usage variations *** + +-- After restricting 1st level parent directory -- + +Warning: opendir(%s/opendir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d +bool(false) + +-- After restricting parent directory -- + +Warning: opendir(%s/opendir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/opendir_variation6-win32.phpt b/ext/standard/tests/dir/opendir_variation6-win32.phpt new file mode 100644 index 0000000..f54a2ad --- /dev/null +++ b/ext/standard/tests/dir/opendir_variation6-win32.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test opendir() function : usage variations - Different wildcards +--SKIPIF-- + +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing opendir() : usage variations *** + +-- Wildcard = '*' -- + +Warning: opendir(%s/opendir_var*,%s/opendir_var*): %s in %s on line %d + +Warning: opendir(%s/opendir_var*): failed to open dir: %s in %s on line %d +bool(false) + +Warning: opendir(%s/*,%s/*): %s in %s on line %d + +Warning: opendir(%s/*): failed to open dir: %s in %s on line %d +bool(false) + +-- Wildcard = '?' -- + +Warning: opendir(%s/opendir_variation6/sub_dir?,%s/opendir_variation6/sub_dir?): %s in %s on line %d + +Warning: opendir(%s/opendir_variation6/sub_dir?): failed to open dir: %s in %s on line %d +bool(false) + +Warning: opendir(%s/opendir_variation6/sub?dir1,%s/opendir_variation6/sub?dir1): %s in %s on line %d + +Warning: opendir(%s/opendir_variation6/sub?dir1): failed to open dir: %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/opendir_variation6.phpt b/ext/standard/tests/dir/opendir_variation6.phpt new file mode 100644 index 0000000..f3fc0bd --- /dev/null +++ b/ext/standard/tests/dir/opendir_variation6.phpt @@ -0,0 +1,67 @@ +--TEST-- +Test opendir() function : usage variations - Different wildcards +--SKIPIF-- + +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing opendir() : usage variations *** + +-- Wildcard = '*' -- + +Warning: opendir(%s/opendir_var*): failed to open dir: %s in %s on line %d +bool(false) + +Warning: opendir(%s/*): failed to open dir: %s in %s on line %d +bool(false) + +-- Wildcard = '?' -- + +Warning: opendir(%s/opendir_variation6/sub_dir?): failed to open dir: %s in %s on line %d +bool(false) + +Warning: opendir(%s/opendir_variation6/sub?dir1): failed to open dir: %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/opendir_variation7.phpt b/ext/standard/tests/dir/opendir_variation7.phpt new file mode 100644 index 0000000..2ad41b1 --- /dev/null +++ b/ext/standard/tests/dir/opendir_variation7.phpt @@ -0,0 +1,127 @@ +--TEST-- +Test opendir() function : usage variations - different directory permissions +--SKIPIF-- + +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing opendir() : usage variations *** + +-- Iteration 1 -- +bool(true) +resource(%d) of type (stream) + +-- Iteration 2 -- +bool(true) +resource(%d) of type (stream) + +-- Iteration 3 -- +bool(true) +resource(%d) of type (stream) + +-- Iteration 4 -- +bool(true) +resource(%d) of type (stream) + +-- Iteration 5 -- +bool(true) +resource(%d) of type (stream) + +-- Iteration 6 -- +bool(true) +resource(%d) of type (stream) + +-- Iteration 7 -- +bool(true) +resource(%d) of type (stream) + +-- Iteration 8 -- +bool(true) +resource(%d) of type (stream) + +-- Iteration 9 -- +bool(true) +resource(%d) of type (stream) + +-- Iteration 10 -- +bool(true) +resource(%d) of type (stream) +===DONE=== diff --git a/ext/standard/tests/dir/readdir_basic.phpt b/ext/standard/tests/dir/readdir_basic.phpt new file mode 100644 index 0000000..572a9a0 --- /dev/null +++ b/ext/standard/tests/dir/readdir_basic.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test readdir() function : basic functionality +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing readdir() : basic functionality *** + +-- Call readdir() with $path argument -- +resource(%d) of type (stream) +string(1) "." +string(2) ".." +string(9) "file1.tmp" +string(9) "file2.tmp" +string(9) "file3.tmp" + +-- Call readdir() without $path argument -- +resource(%d) of type (stream) +string(1) "." +string(2) ".." +string(9) "file1.tmp" +string(9) "file2.tmp" +string(9) "file3.tmp" +===DONE=== diff --git a/ext/standard/tests/dir/readdir_error.phpt b/ext/standard/tests/dir/readdir_error.phpt new file mode 100644 index 0000000..23ba3df --- /dev/null +++ b/ext/standard/tests/dir/readdir_error.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test readdir() function : error conditions - Incorrect number of args +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing readdir() : error conditions *** + +-- Testing readdir() function with more than expected no. of arguments -- + +Warning: readdir() expects at most 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/readdir_variation1.phpt b/ext/standard/tests/dir/readdir_variation1.phpt new file mode 100644 index 0000000..7fe9970 --- /dev/null +++ b/ext/standard/tests/dir/readdir_variation1.phpt @@ -0,0 +1,210 @@ +--TEST-- +Test readdir() function : usage variations - different data types as $dir_handle arg +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing readdir() : usage variations *** + +-- Iteration 1 -- + +Warning: readdir() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: readdir() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: readdir() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: readdir() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: readdir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: readdir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: readdir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: readdir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: readdir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: readdir() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: readdir() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: readdir() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: readdir() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: readdir() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: readdir() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: readdir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: readdir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: readdir() expects parameter 1 to be resource, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: readdir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: readdir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: readdir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: readdir() expects parameter 1 to be resource, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: readdir() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: readdir() expects parameter 1 to be resource, null given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/readdir_variation2.phpt b/ext/standard/tests/dir/readdir_variation2.phpt new file mode 100644 index 0000000..c689ed9 --- /dev/null +++ b/ext/standard/tests/dir/readdir_variation2.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test readdir() function : usage variations - empty directories +--FILE-- + strlen($b) ? 1 : -1; +} +$entries = array(); +while(FALSE !== ($file = readdir($dir_handle))){ + $entries[] = $file; +} + +closedir($dir_handle); + +usort($entries, "mysort"); +foreach($entries as $entry) { + var_dump($entry); +} +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing readdir() : usage variations *** + +-- Pass an empty directory to readdir() -- +string(1) "." +string(2) ".." +===DONE=== diff --git a/ext/standard/tests/dir/readdir_variation3.phpt b/ext/standard/tests/dir/readdir_variation3.phpt new file mode 100644 index 0000000..4e73e74 --- /dev/null +++ b/ext/standard/tests/dir/readdir_variation3.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test readdir() function : usage variations - sub-directories +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing readdir() : usage variations *** +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(9) "file1.tmp" + [3]=> + string(9) "file2.tmp" + [4]=> + string(10) "sub_folder" +} +===DONE=== diff --git a/ext/standard/tests/dir/readdir_variation4.phpt b/ext/standard/tests/dir/readdir_variation4.phpt new file mode 100644 index 0000000..9b04a98 --- /dev/null +++ b/ext/standard/tests/dir/readdir_variation4.phpt @@ -0,0 +1,178 @@ +--TEST-- +Test readdir() function : usage variations - different file names +--FILE-- + $input) { + echo "\n-- Iteration $iterator --\n"; + $handle = "fp{$iterator}"; + var_dump( $$handle = fopen(@"$dir_path$input.tmp", 'w') ); + var_dump( fwrite($$handle, $key)); + fclose($$handle); + $iterator++; +}; + +echo "\n-- Call to readdir() --\n"; +$dir_handle = opendir($dir_path); +while(FALSE !== ($file = readdir($dir_handle))){ + + // different OS order files differently so will + // store file names into an array so can use sorted in expected output + $contents[] = $file; + + // remove files while going through directory + @unlink($dir_path . $file); +} + +// more important to check that all contents are present than order they are returned in +sort($contents); +var_dump($contents); + +closedir($dir_handle); +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing readdir() : usage variations *** + +-- Iteration 1 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 2 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 3 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 4 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 5 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 6 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 7 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 8 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 9 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 10 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 11 -- +resource(%d) of type (stream) +int(2) + +-- Iteration 12 -- +resource(%d) of type (stream) +int(2) + +-- Iteration 13 -- +resource(%d) of type (stream) +int(2) + +-- Iteration 14 -- +resource(%d) of type (stream) +int(2) + +-- Call to readdir() -- +array(16) { + [0]=> + string(9) "-10.5.tmp" + [1]=> + string(9) "-2345.tmp" + [2]=> + string(1) "." + [3]=> + string(2) ".." + [4]=> + string(4) ".tmp" + [5]=> + string(7) "0.5.tmp" + [6]=> + string(5) "0.tmp" + [7]=> + string(17) "1.23456789E-9.tmp" + [8]=> + string(5) "1.tmp" + [9]=> + string(8) "10.5.tmp" + [10]=> + string(9) "12345.tmp" + [11]=> + string(16) "123456789000.tmp" + [12]=> + string(9) "Array.tmp" + [13]=> + string(15) "double_file.tmp" + [14]=> + string(11) "hd_file.tmp" + [15]=> + string(15) "single_file.tmp" +} +===DONE=== diff --git a/ext/standard/tests/dir/readdir_variation5.phpt b/ext/standard/tests/dir/readdir_variation5.phpt new file mode 100644 index 0000000..8c12f13 --- /dev/null +++ b/ext/standard/tests/dir/readdir_variation5.phpt @@ -0,0 +1,144 @@ +--TEST-- +Test readdir() function : usage variations - different permissions +--SKIPIF-- + +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing readdir() : usage variations *** + +-- Iteration 1 -- +bool(true) +resource(%d) of type (stream) +-- Calling readdir() -- +string(%d) "%s" + +-- Iteration 2 -- +bool(true) +resource(%d) of type (stream) +-- Calling readdir() -- +string(%d) "%s" + +-- Iteration 3 -- +bool(true) +resource(%d) of type (stream) +-- Calling readdir() -- +string(%d) "%s" + +-- Iteration 4 -- +bool(true) +resource(%d) of type (stream) +-- Calling readdir() -- +string(%d) "%s" + +-- Iteration 5 -- +bool(true) +resource(%d) of type (stream) +-- Calling readdir() -- +string(%d) "%s" + +-- Iteration 6 -- +bool(true) +resource(%d) of type (stream) +-- Calling readdir() -- +string(%d) "%s" + +-- Iteration 7 -- +bool(true) +resource(%d) of type (stream) +-- Calling readdir() -- +string(%d) "%s" + +-- Iteration 8 -- +bool(true) +resource(%d) of type (stream) +-- Calling readdir() -- +string(%d) "%s" + +-- Iteration 9 -- +bool(true) +resource(%d) of type (stream) +-- Calling readdir() -- +string(%d) "%s" + +-- Iteration 10 -- +bool(true) +resource(%d) of type (stream) +-- Calling readdir() -- +string(%d) "%s" +===DONE=== diff --git a/ext/standard/tests/dir/readdir_variation6.phpt b/ext/standard/tests/dir/readdir_variation6.phpt new file mode 100644 index 0000000..eec673e --- /dev/null +++ b/ext/standard/tests/dir/readdir_variation6.phpt @@ -0,0 +1,80 @@ +--TEST-- +Test readdir() function : usage variations - operate on previously opened directory +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing readdir() : usage variations *** + +-- Reading Directory Contents with Previous Handle -- +string(1) "." +string(2) ".." +string(23) "readdir_variation61.tmp" +string(23) "readdir_variation62.tmp" +string(23) "readdir_variation63.tmp" + +-- Reading Directory Contents with Current Handle (no arguments supplied) -- +string(1) "." +string(2) ".." +string(23) "readdir_variation61.tmp" +string(23) "readdir_variation62.tmp" +string(23) "readdir_variation63.tmp" +===DONE=== diff --git a/ext/standard/tests/dir/readdir_variation7.phpt b/ext/standard/tests/dir/readdir_variation7.phpt new file mode 100644 index 0000000..bff87ce --- /dev/null +++ b/ext/standard/tests/dir/readdir_variation7.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test readdir() function : usage variations - use file pointers +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing readdir() : usage variations *** +resource(%d) of type (stream) + +Warning: readdir(): %d is not a valid Directory resource in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/rewinddir_basic.phpt b/ext/standard/tests/dir/rewinddir_basic.phpt new file mode 100644 index 0000000..2d1f783 --- /dev/null +++ b/ext/standard/tests/dir/rewinddir_basic.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test rewinddir() function : basic functionality +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing rewinddir() : basic functionality *** +resource(%d) of type (stream) +resource(%d) of type (stream) + +-- Read and rewind first directory (argument supplied) -- +array(3) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(9) "file1.tmp" +} +NULL +bool(true) + +-- Read and rewind second directory (no argument supplied) -- +array(3) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(9) "file2.tmp" +} +NULL +bool(true) +===DONE=== diff --git a/ext/standard/tests/dir/rewinddir_error.phpt b/ext/standard/tests/dir/rewinddir_error.phpt new file mode 100644 index 0000000..b3bb02b --- /dev/null +++ b/ext/standard/tests/dir/rewinddir_error.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test rewinddir() function : error conditions - incorrect number of args +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing rewinddir() : error conditions *** + +-- Testing rewinddir() function with more than expected no. of arguments -- + +Warning: rewinddir() expects at most 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/rewinddir_variation1.phpt b/ext/standard/tests/dir/rewinddir_variation1.phpt new file mode 100644 index 0000000..66cd1f6 --- /dev/null +++ b/ext/standard/tests/dir/rewinddir_variation1.phpt @@ -0,0 +1,211 @@ +--TEST-- +Test rewinddir() function : usage variations - different data types as $dir_handle arg +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing rewinddir() : usage variations *** + +-- Iteration 1 -- + +Warning: rewinddir() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: rewinddir() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: rewinddir() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: rewinddir() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: rewinddir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: rewinddir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: rewinddir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: rewinddir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: rewinddir() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: rewinddir() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: rewinddir() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: rewinddir() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: rewinddir() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: rewinddir() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: rewinddir() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: rewinddir() expects parameter 1 to be resource, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: rewinddir() expects parameter 1 to be resource, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: rewinddir() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: rewinddir() expects parameter 1 to be resource, null given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/rewinddir_variation2.phpt b/ext/standard/tests/dir/rewinddir_variation2.phpt new file mode 100644 index 0000000..7594cc2 --- /dev/null +++ b/ext/standard/tests/dir/rewinddir_variation2.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test rewinddir() function : usage variations - operate on a closed directory +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing rewinddir() : usage variations *** + +-- Create the directory handle, read and close the directory -- +resource(%d) of type (stream) +string(%d) "%s" + +-- Call to rewinddir() -- + +Warning: rewinddir(): %d is not a valid Directory resource in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/rewinddir_variation3.phpt b/ext/standard/tests/dir/rewinddir_variation3.phpt new file mode 100644 index 0000000..2a2af89 --- /dev/null +++ b/ext/standard/tests/dir/rewinddir_variation3.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test rewinddir() function : usage variations - file pointers +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing rewinddir() : usage variations *** + +-- Open a file using fopen -- +resource(%d) of type (stream) + +Warning: rewinddir(): %d is not a valid Directory resource in %s on line %d +bool(false) + +-- Check if rewinddir() has repositioned the file pointer -- +rewinddir() does not work on file pointers +===DONE=== diff --git a/ext/standard/tests/dir/scandir_basic.phpt b/ext/standard/tests/dir/scandir_basic.phpt new file mode 100644 index 0000000..7a044da --- /dev/null +++ b/ext/standard/tests/dir/scandir_basic.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test scandir() function : basic functionality +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : basic functionality *** + +-- scandir() with mandatory arguments -- +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(9) "file1.tmp" + [3]=> + string(9) "file2.tmp" + [4]=> + string(9) "file3.tmp" +} + +-- scandir() with all arguments -- +array(5) { + [0]=> + string(9) "file3.tmp" + [1]=> + string(9) "file2.tmp" + [2]=> + string(9) "file1.tmp" + [3]=> + string(2) ".." + [4]=> + string(1) "." +} +===DONE=== diff --git a/ext/standard/tests/dir/scandir_error1.phpt b/ext/standard/tests/dir/scandir_error1.phpt new file mode 100644 index 0000000..7fbffba --- /dev/null +++ b/ext/standard/tests/dir/scandir_error1.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test scandir() function : error conditions - Incorrect number of args +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : error conditions *** + +-- Testing scandir() function with Zero arguments -- + +Warning: scandir() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing scandir() function with more than expected no. of arguments -- + +Warning: scandir() expects at most 3 parameters, 4 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/scandir_error2-win32.phpt b/ext/standard/tests/dir/scandir_error2-win32.phpt new file mode 100644 index 0000000..9920be7 --- /dev/null +++ b/ext/standard/tests/dir/scandir_error2-win32.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test scandir() function : error conditions - Non-existent directory +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing scandir() : error conditions *** + +-- Pass scandir() an absolute path that does not exist -- + +Warning: scandir(%s/idonotexist,%s/idonotexist): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(%s/idonotexist): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Pass scandir() a relative path that does not exist -- + +Warning: scandir(/idonotexist,/idonotexist): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(/idonotexist): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/scandir_error2.phpt b/ext/standard/tests/dir/scandir_error2.phpt new file mode 100644 index 0000000..b5bfc28 --- /dev/null +++ b/ext/standard/tests/dir/scandir_error2.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test scandir() function : error conditions - Non-existent directory +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing scandir() : error conditions *** + +-- Pass scandir() an absolute path that does not exist -- + +Warning: scandir(%s/idonotexist): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Pass scandir() a relative path that does not exist -- + +Warning: scandir(/idonotexist): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation1-win32.phpt b/ext/standard/tests/dir/scandir_variation1-win32.phpt new file mode 100644 index 0000000..a2b5bd4 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation1-win32.phpt @@ -0,0 +1,289 @@ +--TEST-- +Test scandir() function : usage variations - different data types as $dir arg +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- + +Warning: scandir(0,0): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(0): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 2 -- + +Warning: scandir(1,1): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(1): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 3 -- + +Warning: scandir(12345,12345): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(12345): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 4 -- + +Warning: scandir(-2345,-2345): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(-2345): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 5 -- + +Warning: scandir(10.5,10.5): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(10.5): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: scandir(-10.5,-10.5): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(-10.5): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 7 -- + +Warning: scandir(123456789000,123456789000): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(123456789000): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 8 -- + +Warning: scandir(1.23456789E-9,1.23456789E-9): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(1.23456789E-9): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 9 -- + +Warning: scandir(0.5,0.5): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(0.5): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 10 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: scandir(1,1): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(1): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: scandir(1,1): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(1): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 15 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 16 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 17 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 18 -- + +Warning: scandir() expects parameter 1 to be a valid path, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: scandir(string,string): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(string): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 20 -- + +Warning: scandir(string,string): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(string): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 21 -- + +Warning: scandir(hello world,hello world): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(hello world): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 22 -- + +Warning: scandir(Class A object,Class A object): The system cannot find the file specified. (code: 2) in %s on line %d + +Warning: scandir(Class A object): failed to open dir: No such file or directory in %sscandir_variation1-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 23 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 24 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 25 -- + +Warning: scandir() expects parameter 1 to be a valid path, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation1.phpt b/ext/standard/tests/dir/scandir_variation1.phpt new file mode 100644 index 0000000..ccd5bb9 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation1.phpt @@ -0,0 +1,259 @@ +--TEST-- +Test scandir() function : usage variations - different data types as $dir arg +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- + +Warning: scandir(0): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 2 -- + +Warning: scandir(1): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 3 -- + +Warning: scandir(12345): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 4 -- + +Warning: scandir(-2345): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 5 -- + +Warning: scandir(10.5): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: scandir(-10.5): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 7 -- + +Warning: scandir(123456789000): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 8 -- + +Warning: scandir(1.23456789E-9): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 9 -- + +Warning: scandir(0.5): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 10 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: scandir(1): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: scandir(1): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 15 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 16 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 17 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 18 -- + +Warning: scandir() expects parameter 1 to be a valid path, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: scandir(string): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 20 -- + +Warning: scandir(string): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 21 -- + +Warning: scandir(hello world): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 22 -- + +Warning: scandir(Class A object): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 23 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 24 -- + +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) + +-- Iteration 25 -- + +Warning: scandir() expects parameter 1 to be a valid path, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation10.phpt b/ext/standard/tests/dir/scandir_variation10.phpt new file mode 100644 index 0000000..412836b --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation10.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test scandir() function : usage variations - different sorting constants +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +SCANDIR_SORT_ASCENDING: 0 +SCANDIR_SORT_DESCENDING: 1 +SCANDIR_SORT_NONE: 2 +*** Testing scandir() : usage variations *** +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(9) "file1.tmp" + [3]=> + string(9) "file2.tmp" +} +array(4) { + [0]=> + string(9) "file2.tmp" + [1]=> + string(9) "file1.tmp" + [2]=> + string(2) ".." + [3]=> + string(1) "." +} +int(4) +bool(true) +bool(true) +bool(true) +bool(true) +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation2.phpt b/ext/standard/tests/dir/scandir_variation2.phpt new file mode 100644 index 0000000..e6033f2 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation2.phpt @@ -0,0 +1,283 @@ +--TEST-- +Test scandir() function : usage variations - diff data types as $sorting_order arg +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 2 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 3 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 4 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 5 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 6 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 7 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 8 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 9 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 10 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 11 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 12 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 13 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 14 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 15 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 16 -- + +Warning: scandir() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: scandir() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: scandir() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: scandir() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: scandir() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: scandir() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: scandir() expects parameter 2 to be long, object given in %s on line %d +NULL + +-- Iteration 23 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 24 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 25 -- + +Warning: scandir() expects parameter 2 to be long, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation3.phpt b/ext/standard/tests/dir/scandir_variation3.phpt new file mode 100644 index 0000000..58da5e2 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation3.phpt @@ -0,0 +1,238 @@ +--TEST-- +Test scandir() function : usage variations - diff data types as $context arg +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: scandir() expects parameter 3 to be resource, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: scandir() expects parameter 3 to be resource, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: scandir(): supplied resource is not a valid Stream-Context resource in %s on line %d +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation4.phpt b/ext/standard/tests/dir/scandir_variation4.phpt new file mode 100644 index 0000000..f756cf1 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation4.phpt @@ -0,0 +1,169 @@ +--TEST-- +Test scandir() function : usage variations - different relative paths +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- $path = './level_one': -- +bool(true) +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(14) "level_one1.tmp" + [3]=> + string(14) "level_one2.tmp" + [4]=> + string(9) "level_two" +} + +-- $path = 'level_one/level_two': -- +bool(true) +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(14) "level_two1.tmp" + [3]=> + string(14) "level_two2.tmp" +} + +-- $path = '..': -- +bool(true) +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(14) "level_one1.tmp" + [3]=> + string(14) "level_one2.tmp" + [4]=> + string(9) "level_two" +} + +-- $path = 'level_two', '.': -- +bool(true) +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(14) "level_two1.tmp" + [3]=> + string(14) "level_two2.tmp" +} + +-- $path = '../': -- +bool(true) +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(14) "level_one1.tmp" + [3]=> + string(14) "level_one2.tmp" + [4]=> + string(9) "level_two" +} + +-- $path = './': -- +bool(true) +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(14) "level_two1.tmp" + [3]=> + string(14) "level_two2.tmp" +} + +-- $path = '../../'level_one': -- +bool(true) +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(14) "level_one1.tmp" + [3]=> + string(14) "level_one2.tmp" + [4]=> + string(9) "level_two" +} +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation5.phpt b/ext/standard/tests/dir/scandir_variation5.phpt new file mode 100644 index 0000000..d6d3c79 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation5.phpt @@ -0,0 +1,98 @@ +--TEST-- +Test scandir() function : usage variations - different directory permissions +--SKIPIF-- + +--FILE-- + sub_dir ( sub parent ) + * |-> child_dir ( child dir) + */ + +$parent_dir_path = dirname(__FILE__) . "/scandir_variation5"; +mkdir($parent_dir_path); +chmod($parent_dir_path, 0777); + +// create sub_dir +$sub_dir_path = $parent_dir_path . "/sub_dir"; +mkdir($sub_dir_path); +chmod($sub_dir_path, 0777); + +//create sub_sub_dir +$child_dir_path = $sub_dir_path."/child_dir"; +mkdir($child_dir_path); + +// remove the write and execute permisson from sub parent +chmod($sub_dir_path, 0444); + +echo "\n-- After restricting 1st level parent directory --\n"; +var_dump(scandir($child_dir_path)); + +// remove the execute permisson from parent dir, allowing all permission for sub dir +chmod($sub_dir_path, 0777); // all permisson to sub dir +chmod($parent_dir_path, 0666); // restricting parent directory + +echo "\n-- After restricting parent directory --\n"; +var_dump(scandir($child_dir_path)); +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- After restricting 1st level parent directory -- + +Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- After restricting parent directory -- + +Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation6-win32.phpt b/ext/standard/tests/dir/scandir_variation6-win32.phpt new file mode 100644 index 0000000..040dc78 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation6-win32.phpt @@ -0,0 +1,84 @@ +--TEST-- +Test scandir() function : usage variations - Wildcards in directory path +--SKIPIF-- + +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Wildcard = '*' -- + +Warning: scandir(%s/scandir_var*,%s/scandir_var*): No such file or directory in %s on line %d + +Warning: scandir(%s/scandir_var*): failed to open dir: No such file or directory in %sscandir_variation6-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +Warning: scandir(%s/*,%s/*): No such file or directory in %s on line %d + +Warning: scandir(%s/*): failed to open dir: No such file or directory in %sscandir_variation6-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Wildcard = '?' -- + +Warning: scandir(%s/scandir_variation6/sub_dir?,%s/scandir_variation6/sub_dir?): No such file or directory in %s on line %d + +Warning: scandir(%s/scandir_variation6/sub_dir?): failed to open dir: No such file or directory in %sscandir_variation6-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +Warning: scandir(%s/scandir_variation6/sub?dir1,%s/scandir_variation6/sub?dir1): No such file or directory in %s on line %d + +Warning: scandir(%s/scandir_variation6/sub?dir1): failed to open dir: No such file or directory in %sscandir_variation6-win32.php on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation6.phpt b/ext/standard/tests/dir/scandir_variation6.phpt new file mode 100644 index 0000000..754c615 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation6.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test scandir() function : usage variations - Wildcards in directory path +--SKIPIF-- + +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Wildcard = '*' -- + +Warning: scandir(%s/scandir_var*): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +Warning: scandir(%s/*): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Wildcard = '?' -- + +Warning: scandir(%s/scandir_variation6/sub_dir?): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +Warning: scandir(%s/scandir_variation6/sub?dir1): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation7.phpt b/ext/standard/tests/dir/scandir_variation7.phpt new file mode 100644 index 0000000..c7f7765 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation7.phpt @@ -0,0 +1,169 @@ +--TEST-- +Test scandir() function : usage variations - different directory permissions +--SKIPIF-- + +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 2 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 3 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 4 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 5 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 6 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 7 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 8 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 9 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 10 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation8.phpt b/ext/standard/tests/dir/scandir_variation8.phpt new file mode 100644 index 0000000..4e96e04 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation8.phpt @@ -0,0 +1,154 @@ +--TEST-- +Test scandir() function : usage variations - different file names +--FILE-- + $input) { + echo "\n-- Iteration $iterator --\n"; + $handle = "fp{$iterator}"; + var_dump( $$handle = fopen(@"$dir_path$input.tmp", 'w') ); + fclose($$handle); + $iterator++; +}; + +echo "\n-- Call to scandir() --\n"; +var_dump($content = scandir($dir_path)); + +// remove all files in directory so can remove directory in CLEAN section +foreach ($content as $file_name) { + // suppress errors as won't be able to remove "." and ".." entries + @unlink($dir_path . $file_name); +} +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- +resource(%d) of type (stream) + +-- Iteration 2 -- +resource(%d) of type (stream) + +-- Iteration 3 -- +resource(%d) of type (stream) + +-- Iteration 4 -- +resource(%d) of type (stream) + +-- Iteration 5 -- +resource(%d) of type (stream) + +-- Iteration 6 -- +resource(%d) of type (stream) + +-- Iteration 7 -- +resource(%d) of type (stream) + +-- Iteration 8 -- +resource(%d) of type (stream) + +-- Iteration 9 -- +resource(%d) of type (stream) + +-- Iteration 10 -- +resource(%d) of type (stream) + +-- Iteration 11 -- +resource(%d) of type (stream) + +-- Iteration 12 -- +resource(%d) of type (stream) + +-- Iteration 13 -- +resource(%d) of type (stream) + +-- Iteration 14 -- +resource(%d) of type (stream) + +-- Call to scandir() -- +array(16) { + [0]=> + string(9) "-10.5.tmp" + [1]=> + string(9) "-2345.tmp" + [2]=> + string(1) "." + [3]=> + string(2) ".." + [4]=> + string(4) ".tmp" + [5]=> + string(7) "0.5.tmp" + [6]=> + string(5) "0.tmp" + [7]=> + string(17) "1.23456789E-9.tmp" + [8]=> + string(5) "1.tmp" + [9]=> + string(8) "10.5.tmp" + [10]=> + string(9) "12345.tmp" + [11]=> + string(16) "123456789000.tmp" + [12]=> + string(9) "Array.tmp" + [13]=> + string(15) "double_file.tmp" + [14]=> + string(11) "hd_file.tmp" + [15]=> + string(15) "single_file.tmp" +} +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation9.phpt b/ext/standard/tests/dir/scandir_variation9.phpt new file mode 100644 index 0000000..2b1904c --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation9.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test scandir() function : usage variations - different ints as $sorting_order arg +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** +array(4) { + [0]=> + string(9) "file2.tmp" + [1]=> + string(9) "file1.tmp" + [2]=> + string(2) ".." + [3]=> + string(1) "." +} +array(4) { + [0]=> + string(9) "file2.tmp" + [1]=> + string(9) "file1.tmp" + [2]=> + string(2) ".." + [3]=> + string(1) "." +} +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(9) "file1.tmp" + [3]=> + string(9) "file2.tmp" +} +===DONE=== diff --git a/ext/standard/tests/directory/DirectoryClass_basic_001.phpt b/ext/standard/tests/directory/DirectoryClass_basic_001.phpt new file mode 100644 index 0000000..0accb2c --- /dev/null +++ b/ext/standard/tests/directory/DirectoryClass_basic_001.phpt @@ -0,0 +1,65 @@ +--TEST-- +Directory class behaviour. +--FILE-- +read()); + +?> +--EXPECTF-- +Structure of Directory class: +Class [ class Directory ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [3] { + Method [ public method close ] { + + - Parameters [1] { + Parameter #0 [ $dir_handle ] + } + } + + Method [ public method rewind ] { + + - Parameters [1] { + Parameter #0 [ $dir_handle ] + } + } + + Method [ public method read ] { + + - Parameters [1] { + Parameter #0 [ $dir_handle ] + } + } + } +} +Cannot instantiate a valid Directory directly: +object(Directory)#%d (0) { +} + +Warning: Directory::read(): Unable to find my handle property in %s on line 15 +bool(false) diff --git a/ext/standard/tests/directory/DirectoryClass_error_001.phpt b/ext/standard/tests/directory/DirectoryClass_error_001.phpt new file mode 100644 index 0000000..5b2771e --- /dev/null +++ b/ext/standard/tests/directory/DirectoryClass_error_001.phpt @@ -0,0 +1,59 @@ +--TEST-- +Directory class behaviour. +--FILE-- + Try all methods with bad handle:\n"; +$d = new Directory(getcwd()); +$d->handle = "Havoc!"; +var_dump($d->read()); +var_dump($d->rewind()); +var_dump($d->close()); + +echo "\n--> Try all methods with no handle:\n"; +$d = new Directory(getcwd()); +unset($d->handle); +var_dump($d->read()); +var_dump($d->rewind()); +var_dump($d->close()); + +echo "\n--> Try all methods with wrong number of args:\n"; +$d = new Directory(getcwd()); +var_dump($d->read(1,2)); +var_dump($d->rewind(1,2)); +var_dump($d->close(1,2)); + +?> +--EXPECTF-- +--> Try all methods with bad handle: + +Warning: Directory::read(): supplied argument is not a valid Directory resource in %s on line %d +bool(false) + +Warning: Directory::rewind(): supplied argument is not a valid Directory resource in %s on line %d +bool(false) + +Warning: Directory::close(): supplied argument is not a valid Directory resource in %s on line %d +bool(false) + +--> Try all methods with no handle: + +Warning: Directory::read(): Unable to find my handle property in %s on line %d +bool(false) + +Warning: Directory::rewind(): Unable to find my handle property in %s on line %d +bool(false) + +Warning: Directory::close(): Unable to find my handle property in %s on line %d +bool(false) + +--> Try all methods with wrong number of args: + +Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d +NULL + +Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d +NULL + +Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d +NULL diff --git a/ext/standard/tests/directory/directory_constants-win32.phpt b/ext/standard/tests/directory/directory_constants-win32.phpt new file mode 100644 index 0000000..6a9a066 --- /dev/null +++ b/ext/standard/tests/directory/directory_constants-win32.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test that the Directory extension constants are correctly defined. +--SKIPIF-- + +--FILE-- + +--EXPECT-- +\ +; +done diff --git a/ext/standard/tests/directory/directory_constants.phpt b/ext/standard/tests/directory/directory_constants.phpt new file mode 100644 index 0000000..f8e143b --- /dev/null +++ b/ext/standard/tests/directory/directory_constants.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test that the Directory extension constants are correctly defined. +--SKIPIF-- + +--FILE-- + +--EXPECT-- +/ +: +done diff --git a/ext/standard/tests/file/001-win32.phpt b/ext/standard/tests/file/001-win32.phpt new file mode 100644 index 0000000..ee52094 --- /dev/null +++ b/ext/standard/tests/file/001-win32.phpt @@ -0,0 +1,100 @@ +--TEST-- +File type functions +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECT-- +test.file does not exist +test.file exists +test.file is not a symlink +test.file exists +test.file is file +test.file permissions are 0666 +test.file size is 0 +test.file is writeable +test.file is readable +test.file is a regular file +../file is a directory +test.file is not a directory +test.file does not exist +test.file does not exist + diff --git a/ext/standard/tests/file/001.phpt b/ext/standard/tests/file/001.phpt new file mode 100644 index 0000000..d604699 --- /dev/null +++ b/ext/standard/tests/file/001.phpt @@ -0,0 +1,146 @@ +--TEST-- +File type functions +--SKIPIF-- + +--FILE-- + +--EXPECT-- +test.file does not exist +test.file exists +test.link exists +test.file is not a symlink +test.link is a symlink +test.file exists +test.link lstat and stat differ at element 1 +test.link lstat and stat differ at element 2 +test.link lstat and stat differ at element 7 +test.link lstat and stat differ at element 8 +test.link lstat and stat differ at element 9 +test.file is file +test.link is link +test.file permissions are 0744 +test.file size is 0 +test.file is writeable +test.file is readable +test.file is executable +test.file is a regular file +test.link is a regular file +test.link is not a directory +../file is a directory +test.file is not a directory +test.file does not exist +test.file does not exist diff --git a/ext/standard/tests/file/002.phpt b/ext/standard/tests/file/002.phpt new file mode 100644 index 0000000..134f541 --- /dev/null +++ b/ext/standard/tests/file/002.phpt @@ -0,0 +1,52 @@ +--TEST-- +File/Stream functions +--FILE-- + +--EXPECT-- +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah diff --git a/ext/standard/tests/file/003.phpt b/ext/standard/tests/file/003.phpt new file mode 100644 index 0000000..8eeaa93 --- /dev/null +++ b/ext/standard/tests/file/003.phpt @@ -0,0 +1,41 @@ +--TEST-- +is_*() and file_exists() return values are boolean. +--FILE-- + +--EXPECT-- +boolean +boolean +boolean +boolean +boolean +boolean +boolean +boolean +boolean +boolean diff --git a/ext/standard/tests/file/004.phpt b/ext/standard/tests/file/004.phpt new file mode 100644 index 0000000..f1fab47 --- /dev/null +++ b/ext/standard/tests/file/004.phpt @@ -0,0 +1,61 @@ +--TEST-- +file_put_contents() test +--FILE-- + +--EXPECT-- +String Test: OK +Integer Test: OK +Float Test: OK +Bool Test: OK +Array Test: OK diff --git a/ext/standard/tests/file/005_basic.phpt b/ext/standard/tests/file/005_basic.phpt new file mode 100644 index 0000000..5ed1118 --- /dev/null +++ b/ext/standard/tests/file/005_basic.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test fileatime(), filemtime(), filectime() & touch() functions : basic functionality +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing the basic functionality with file *** +%d:%s:%s:%d:%d:%d +%d:%s:%s:%d:%d:%d +%d:%s:%s:%d:%d:%d +%d:%s:%s:%d:%d:%d +*** Testing the basic functionality with dir *** +%d:%s:%s:%d:%d:%d +%d:%s:%s:%d:%d:%d +%d:%s:%s:%d:%d:%d +%d:%s:%s:%d:%d:%d + +*** Done *** diff --git a/ext/standard/tests/file/005_error.phpt b/ext/standard/tests/file/005_error.phpt new file mode 100644 index 0000000..fc4852e --- /dev/null +++ b/ext/standard/tests/file/005_error.phpt @@ -0,0 +1,126 @@ +--TEST-- +Test fileatime(), filemtime(), filectime() & touch() functions : error conditions +--FILE-- + +--EXPECTF-- +*** Testing error conditions *** + +-- Testing with Non-existing files -- +Warning: fileatime(): stat failed for /no/such/file/or/dir in %s on line %d +bool(false) + +Warning: filemtime(): stat failed for /no/such/file/or/dir in %s on line %d +bool(false) + +Warning: filectime(): stat failed for /no/such/file/or/dir in %s on line %d +bool(false) + +Warning: touch(): Unable to create file /no/such/file/or/dir because No such file or directory in %s on line %d +bool(false) + +Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: touch() expects at most 3 parameters, 4 given in %s on line %d +NULL + +-- Testing No.of arguments less than expected -- +Warning: fileatime() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: filemtime() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: filectime() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: touch() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing No.of arguments greater than expected -- +Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: touch() expects at most 3 parameters, 4 given in %s on line %d +NULL + +Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: touch() expects at most 3 parameters, 4 given in %s on line %d +NULL + +Done + diff --git a/ext/standard/tests/file/005_variation-win32.phpt b/ext/standard/tests/file/005_variation-win32.phpt new file mode 100644 index 0000000..3455875 --- /dev/null +++ b/ext/standard/tests/file/005_variation-win32.phpt @@ -0,0 +1,221 @@ +--TEST-- +Test fileatime(), filemtime(), filectime() & touch() functions : usage variation +--SKIPIF-- + +--FILE-- + "; + print( @date( 'Y:M:D:H:i:s', fileatime($filename) ) )."\n"; + clearstatcache(); + echo "-- File modification time is => "; + print( @date( 'Y:M:D:H:i:s', filemtime($filename) ) )."\n"; + clearstatcache(); + echo "-- inode change time is => "; + print( @date( 'Y:M:D:H:i:s', filectime($filename) ) )."\n"; + clearstatcache(); + +} + +echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n"; +$file_path = dirname(__FILE__); +// create files +$file_handle = fopen("$file_path/005_variation1.tmp", "w"); +fclose($file_handle); +stat_fn("$file_path/005_variation1.tmp"); +sleep(2); + +$file_handle = fopen("$file_path/005_variation2.tmp", "w"); +fclose($file_handle); +stat_fn("$file_path/005_variation2.tmp"); +sleep(2); + +$file_handle = fopen("$file_path/005_variation3.tmp", "w"); +fclose($file_handle); +stat_fn("$file_path/005_variation3.tmp"); + +// delete files +unlink("$file_path/005_variation1.tmp"); +unlink("$file_path/005_variation2.tmp"); +unlink("$file_path/005_variation3.tmp"); + +echo "\n-- Checking different times, just after creating the file --\n"; +$file_name = "$file_path/005_variation1.tmp"; +$file_write_handle = fopen($file_name, "w"); +fclose($file_write_handle); +stat_fn($file_name); +sleep(2); + +/* filectime + 2 */ +echo "\n-- Checking different times, after changing the file permission --\n"; +chmod($file_name, 0777); +stat_fn($file_name); +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"); +fclose($file_write_handle); +stat_fn($file_name); +sleep(2); + +/* fileatime + 2 */ +echo "\n-- Checking different times, after reading from the file --\n"; +$file_read_handle = fopen($file_name ,"r"); +fread($file_read_handle, 10); +fclose( $file_read_handle); +stat_fn($file_name); +sleep(2); + +/* No change */ +echo "\n-- Checking different times, after making a copy of the file --\n"; +$file_copy = "$file_path/005_variation_copy.tmp"; +copy($file_name, $file_copy); +stat_fn($file_name); +sleep(2); + +/* fileatime + 2 */ +echo "\n-- Checking different times, after performing is_file() operation on the file --\n"; +is_file($file_name); +stat_fn($file_name); +sleep(2); + + +echo "\n*** Testing touch() function with different time values ***\n"; +$file_name2 = $file_path."/005_variation_touch.tmp"; +$file_handle = fopen($file_name2, "w"); +fclose($file_handle); +sleep(2); + +/* Time is not mentioned */ +var_dump( touch($file_name2) ); //set to current system time +stat_fn($file_name2); +sleep(2); + +/* set to access(creation time of the file) time */ +var_dump( touch($file_name2, @date(fileatime($file_name2))) ); +stat_fn($file_name2); +sleep(2); + +/* set to access time of $file_name2 */ +var_dump( touch($file_path."/005_variation_touch_fly.tmp", @date(fileatime($file_name2)), time()) ); +stat_fn($file_name2); +sleep(2); + +/* set to default value, with Invalid timestamps */ +var_dump( touch($file_name2, 10) ); +stat_fn($file_name2); +var_dump( touch($file_name2, 10, 20) ); +stat_fn($file_name2); + +/* touch() after renaming the file */ +rename($file_name2, "$file_path/005_variation_touch_new.tmp"); +stat_fn("$file_path/005_variation_touch_new.tmp"); + +echo "Done\n"; +?> +--CLEAN-- + +--EXPECTF-- +*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations *** +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +-- Checking different times, just after creating the file -- +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +-- Checking different times, after changing the file permission -- +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +-- Checking different times, after writing into the file -- +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +-- Checking different times, after reading from the file -- +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +-- Checking different times, after making a copy of the file -- +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +-- Checking different times, after performing is_file() operation on the file -- +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +*** Testing touch() function with different time values *** +bool(true) +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +bool(true) +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +bool(true) +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +bool(true) +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +bool(true) +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +Done diff --git a/ext/standard/tests/file/005_variation.phpt b/ext/standard/tests/file/005_variation.phpt new file mode 100644 index 0000000..7e5eedc --- /dev/null +++ b/ext/standard/tests/file/005_variation.phpt @@ -0,0 +1,260 @@ +--TEST-- +Test fileatime(), filemtime(), filectime() & touch() functions : usage variation +--SKIPIF-- + +--FILE-- + "; + print( @date( 'Y:M:D:H:i:s', fileatime($filename) ) )."\n"; + clearstatcache(); + echo "-- File modification time is => "; + print( @date( 'Y:M:D:H:i:s', filemtime($filename) ) )."\n"; + clearstatcache(); + echo "-- inode change time is => "; + print( @date( 'Y:M:D:H:i:s', filectime($filename) ) )."\n"; + clearstatcache(); + +} + +echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n"; +$file_path = dirname(__FILE__); +// create files +$file_handle = fopen("$file_path/005_variation1.tmp", "w"); +fclose($file_handle); +stat_fn("$file_path/005_variation1.tmp"); +sleep(2); + +$file_handle = fopen("$file_path/005_variation2.tmp", "w"); +fclose($file_handle); +stat_fn("$file_path/005_variation2.tmp"); +sleep(2); + +$file_handle = fopen("$file_path/005_variation3.tmp", "w"); +fclose($file_handle); +stat_fn("$file_path/005_variation3.tmp"); + +// delete files +unlink("$file_path/005_variation1.tmp"); +unlink("$file_path/005_variation2.tmp"); +unlink("$file_path/005_variation3.tmp"); + +echo "\n-- Checking different times, just after creating the file --\n"; +$file_name = "$file_path/005_variation1.tmp"; +$file_write_handle = fopen($file_name, "w"); +fclose($file_write_handle); +stat_fn($file_name); +sleep(2); + +/* filectime + 2 */ +echo "\n-- Checking different times, after changing the file permission --\n"; +chmod($file_name, 0777); +stat_fn($file_name); +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, "Hello, world"); +fclose($file_write_handle); +stat_fn($file_name); +sleep(2); + +/* fileatime + 2 */ +echo "\n-- Checking different times, after reading from the file --\n"; +$file_read_handle = fopen($file_name ,"r"); +fread($file_read_handle, 10); +fclose( $file_read_handle); +stat_fn($file_name); +sleep(2); + +/* No change */ +echo "\n-- Checking different times, after creating a softlink to the file --\n"; +symlink($file_name, "$file_path/005_variation_softlink.tmp"); +stat_fn($file_name); +sleep(2); + +/* filectime + 2 */ +echo "\n-- Checking different times, after creating a hardlink to the file --\n"; +link($file_name, "$file_path/005_variation_hardlink.tmp"); +stat_fn($file_name); +sleep(2); + +/* No change */ +echo "\n-- Checking different times, after making a copy of the file --\n"; +$file_copy = "$file_path/005_variation_copy.tmp"; +copy($file_name, $file_copy); +stat_fn($file_name); +sleep(2); + +/* fileatime + 2 */ +echo "\n-- Checking different times, after performing is_file() operation on the file --\n"; +is_file($file_name); +stat_fn($file_name); +sleep(2); + + +echo "\n*** Testing touch() function with different time values ***\n"; +$file_name2 = $file_path."/005_variation_touch.tmp"; +$file_handle = fopen($file_name2, "w"); +fclose($file_handle); +sleep(2); + +/* Time is not mentioned */ +var_dump( touch($file_name2) ); //set to current system time +stat_fn($file_name2); +sleep(2); + +/* set to access(creation time of the file) time */ +var_dump( touch($file_name2, @date(fileatime($file_name2))) ); +stat_fn($file_name2); +sleep(2); + +/* set to access time of $file_name2 */ +var_dump( touch($file_path."/005_variation_touch_fly.tmp", @date(fileatime($file_name2)), time()) ); +stat_fn($file_name2); +sleep(2); + +/* set to default value, with Invalid timestamps */ +var_dump( touch($file_name2, 10) ); +stat_fn($file_name2); +var_dump( touch($file_name2, 10, 20) ); +stat_fn($file_name2); + +/* touch() after renaming the file */ +rename($file_name2, "$file_path/005_variation_touch_new.tmp"); +stat_fn("$file_path/005_variation_touch_new.tmp"); + +echo "Done\n"; +?> +--CLEAN-- + +--EXPECTF-- +*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations *** +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +-- Checking different times, just after creating the file -- +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +-- Checking different times, after changing the file permission -- +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +-- Checking different times, after writing into the file -- +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +-- Checking different times, after reading from the file -- +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +-- Checking different times, after creating a softlink to the file -- +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +-- Checking different times, after creating a hardlink to the file -- +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +-- Checking different times, after making a copy of the file -- +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +-- Checking different times, after performing is_file() operation on the file -- +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d + +*** Testing touch() function with different time values *** +bool(true) +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +bool(true) +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +bool(true) +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +bool(true) +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +bool(true) +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +-- File access time is => %d:%s:%s:%d:%d:%d +-- File modification time is => %d:%s:%s:%d:%d:%d +-- inode change time is => %d:%s:%s:%d:%d:%d +Done diff --git a/ext/standard/tests/file/005_variation2-win32.phpt b/ext/standard/tests/file/005_variation2-win32.phpt new file mode 100644 index 0000000..8508ecf --- /dev/null +++ b/ext/standard/tests/file/005_variation2-win32.phpt @@ -0,0 +1,119 @@ +--TEST-- +Test fileatime(), filemtime(), filectime() & touch() functions : usage variation +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + "; + echo fileatime($filename)."\n"; + clearstatcache(); + echo "-- File modification time is => "; + echo filemtime($filename)."\n"; + clearstatcache(); + echo "-- inode change time is => "; + echo filectime($filename)."\n"; + clearstatcache(); + + +} + +echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n"; +echo "\n*** testing file info ***"; +stat_fn(NULL); +stat_fn(false); +stat_fn(''); +stat_fn(' '); +stat_fn('|'); +echo "\n*** testing touch ***"; +var_dump(touch(NULL)); +var_dump(touch(false)); +var_dump(touch('')); + +//php generates permission denied, we generate No such file or dir. +var_dump(touch(' ')); +var_dump(touch('|')); + + +echo "Done"; +?> +--EXPECTF-- +*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations *** + +*** testing file info *** +-- File '' -- +-- File access time is => +-- File modification time is => +-- inode change time is => + +-- File '' -- +-- File access time is => +-- File modification time is => +-- inode change time is => + +-- File '' -- +-- File access time is => +-- File modification time is => +-- inode change time is => + +-- File ' ' -- +-- File access time is => +Warning: fileatime(): stat failed for in %s on line %d + +-- File modification time is => +Warning: filemtime(): stat failed for in %s on line %d + +-- inode change time is => +Warning: filectime(): stat failed for in %s on line %d + + +-- File '|' -- +-- File access time is => +Warning: fileatime(): stat failed for | in %s on line %d + +-- File modification time is => +Warning: filemtime(): stat failed for | in %s on line %d + +-- inode change time is => +Warning: filectime(): stat failed for | in %s on line %d + + +*** testing touch ***bool(false) +bool(false) +bool(false) + +Warning: touch(): %s in %s on line %d +bool(false) + +Warning: touch(): %s in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/file/005_variation2.phpt b/ext/standard/tests/file/005_variation2.phpt new file mode 100644 index 0000000..6d4ca5e --- /dev/null +++ b/ext/standard/tests/file/005_variation2.phpt @@ -0,0 +1,113 @@ +--TEST-- +Test fileatime(), filemtime(), filectime() & touch() functions : usage variation +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + "; + echo fileatime($filename)."\n"; + clearstatcache(); + echo "-- File modification time is => "; + echo filemtime($filename)."\n"; + clearstatcache(); + echo "-- inode change time is => "; + echo filectime($filename)."\n"; + clearstatcache(); + + +} + +echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n"; +echo "\n*** testing touch ***\n"; +$a = touch(NULL); +$b = touch(false); +$c = touch(''); +$d = touch(' '); +$e = touch('|'); + +var_dump($a); +var_dump($b); +var_dump($c); +var_dump($d); +var_dump($e); + +echo "\n*** testing file info ***"; +stat_fn(NULL); +stat_fn(false); +stat_fn(''); +stat_fn(' '); +stat_fn('|'); + +var_dump(unlink(' ')); +var_dump(unlink('|')); + +echo "Done"; +?> +--EXPECTF-- +*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations *** + +*** testing touch *** +bool(false) +bool(false) +bool(false) +bool(true) +bool(true) + +*** testing file info *** +-- File '' -- +-- File access time is => +-- File modification time is => +-- inode change time is => + +-- File '' -- +-- File access time is => +-- File modification time is => +-- inode change time is => + +-- File '' -- +-- File access time is => +-- File modification time is => +-- inode change time is => + +-- File ' ' -- +-- File access time is => %d +-- File modification time is => %d +-- inode change time is => %d + +-- File '|' -- +-- File access time is => %d +-- File modification time is => %d +-- inode change time is => %d +bool(true) +bool(true) +Done diff --git a/ext/standard/tests/file/006_basic.phpt b/ext/standard/tests/file/006_basic.phpt new file mode 100644 index 0000000..213442c --- /dev/null +++ b/ext/standard/tests/file/006_basic.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test fileperms() & chmod() functions: basic functionality +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing fileperms(), chmod() with files and dirs *** +bool(true) +100755 +bool(true) +40777 +Done diff --git a/ext/standard/tests/file/006_error.phpt b/ext/standard/tests/file/006_error.phpt new file mode 100644 index 0000000..04cc274 --- /dev/null +++ b/ext/standard/tests/file/006_error.phpt @@ -0,0 +1,107 @@ +--TEST-- +Test fileperms(), chmod() functions: error conditions +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing error conditions for fileperms(), chmod() *** + +Warning: chmod(): %s in %s on line %d +bool(false) +100%d44 + +Warning: chmod(): %s in %s on line %d +bool(false) +40755 + +Warning: chmod(): No such file or directory in %s on line %d +bool(false) + +Warning: fileperms(): stat failed for /no/such/file/dir in %s on line %d +bool(false) + + +Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d +NULL + +Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d +NULL + +Warning: chmod() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: fileperms() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +*** Done *** diff --git a/ext/standard/tests/file/006_variation1.phpt b/ext/standard/tests/file/006_variation1.phpt new file mode 100644 index 0000000..b752d21 --- /dev/null +++ b/ext/standard/tests/file/006_variation1.phpt @@ -0,0 +1,2627 @@ +--TEST-- +Test fileperms() & chmod() functions: usage variation - perms(0000-0777) +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing fileperms() & chmod() : usage variations *** +-- Testing all permission from octal 0000 to octal 0777 on file and dir -- +-- Iteration 1 -- +bool(true) +100000 +bool(true) +40000 +-- Iteration 2 -- +bool(true) +100001 +bool(true) +40001 +-- Iteration 3 -- +bool(true) +100002 +bool(true) +40002 +-- Iteration 4 -- +bool(true) +100003 +bool(true) +40003 +-- Iteration 5 -- +bool(true) +100004 +bool(true) +40004 +-- Iteration 6 -- +bool(true) +100005 +bool(true) +40005 +-- Iteration 7 -- +bool(true) +100006 +bool(true) +40006 +-- Iteration 8 -- +bool(true) +100007 +bool(true) +40007 +-- Iteration 9 -- +bool(true) +100010 +bool(true) +40010 +-- Iteration 10 -- +bool(true) +100011 +bool(true) +40011 +-- Iteration 11 -- +bool(true) +100012 +bool(true) +40012 +-- Iteration 12 -- +bool(true) +100013 +bool(true) +40013 +-- Iteration 13 -- +bool(true) +100014 +bool(true) +40014 +-- Iteration 14 -- +bool(true) +100015 +bool(true) +40015 +-- Iteration 15 -- +bool(true) +100016 +bool(true) +40016 +-- Iteration 16 -- +bool(true) +100017 +bool(true) +40017 +-- Iteration 17 -- +bool(true) +100020 +bool(true) +40020 +-- Iteration 18 -- +bool(true) +100021 +bool(true) +40021 +-- Iteration 19 -- +bool(true) +100022 +bool(true) +40022 +-- Iteration 20 -- +bool(true) +100023 +bool(true) +40023 +-- Iteration 21 -- +bool(true) +100024 +bool(true) +40024 +-- Iteration 22 -- +bool(true) +100025 +bool(true) +40025 +-- Iteration 23 -- +bool(true) +100026 +bool(true) +40026 +-- Iteration 24 -- +bool(true) +100027 +bool(true) +40027 +-- Iteration 25 -- +bool(true) +100030 +bool(true) +40030 +-- Iteration 26 -- +bool(true) +100031 +bool(true) +40031 +-- Iteration 27 -- +bool(true) +100032 +bool(true) +40032 +-- Iteration 28 -- +bool(true) +100033 +bool(true) +40033 +-- Iteration 29 -- +bool(true) +100034 +bool(true) +40034 +-- Iteration 30 -- +bool(true) +100035 +bool(true) +40035 +-- Iteration 31 -- +bool(true) +100036 +bool(true) +40036 +-- Iteration 32 -- +bool(true) +100037 +bool(true) +40037 +-- Iteration 33 -- +bool(true) +100040 +bool(true) +40040 +-- Iteration 34 -- +bool(true) +100041 +bool(true) +40041 +-- Iteration 35 -- +bool(true) +100042 +bool(true) +40042 +-- Iteration 36 -- +bool(true) +100043 +bool(true) +40043 +-- Iteration 37 -- +bool(true) +100044 +bool(true) +40044 +-- Iteration 38 -- +bool(true) +100045 +bool(true) +40045 +-- Iteration 39 -- +bool(true) +100046 +bool(true) +40046 +-- Iteration 40 -- +bool(true) +100047 +bool(true) +40047 +-- Iteration 41 -- +bool(true) +100050 +bool(true) +40050 +-- Iteration 42 -- +bool(true) +100051 +bool(true) +40051 +-- Iteration 43 -- +bool(true) +100052 +bool(true) +40052 +-- Iteration 44 -- +bool(true) +100053 +bool(true) +40053 +-- Iteration 45 -- +bool(true) +100054 +bool(true) +40054 +-- Iteration 46 -- +bool(true) +100055 +bool(true) +40055 +-- Iteration 47 -- +bool(true) +100056 +bool(true) +40056 +-- Iteration 48 -- +bool(true) +100057 +bool(true) +40057 +-- Iteration 49 -- +bool(true) +100060 +bool(true) +40060 +-- Iteration 50 -- +bool(true) +100061 +bool(true) +40061 +-- Iteration 51 -- +bool(true) +100062 +bool(true) +40062 +-- Iteration 52 -- +bool(true) +100063 +bool(true) +40063 +-- Iteration 53 -- +bool(true) +100064 +bool(true) +40064 +-- Iteration 54 -- +bool(true) +100065 +bool(true) +40065 +-- Iteration 55 -- +bool(true) +100066 +bool(true) +40066 +-- Iteration 56 -- +bool(true) +100067 +bool(true) +40067 +-- Iteration 57 -- +bool(true) +100070 +bool(true) +40070 +-- Iteration 58 -- +bool(true) +100071 +bool(true) +40071 +-- Iteration 59 -- +bool(true) +100072 +bool(true) +40072 +-- Iteration 60 -- +bool(true) +100073 +bool(true) +40073 +-- Iteration 61 -- +bool(true) +100074 +bool(true) +40074 +-- Iteration 62 -- +bool(true) +100075 +bool(true) +40075 +-- Iteration 63 -- +bool(true) +100076 +bool(true) +40076 +-- Iteration 64 -- +bool(true) +100077 +bool(true) +40077 +-- Iteration 65 -- +bool(true) +100100 +bool(true) +40100 +-- Iteration 66 -- +bool(true) +100101 +bool(true) +40101 +-- Iteration 67 -- +bool(true) +100102 +bool(true) +40102 +-- Iteration 68 -- +bool(true) +100103 +bool(true) +40103 +-- Iteration 69 -- +bool(true) +100104 +bool(true) +40104 +-- Iteration 70 -- +bool(true) +100105 +bool(true) +40105 +-- Iteration 71 -- +bool(true) +100106 +bool(true) +40106 +-- Iteration 72 -- +bool(true) +100107 +bool(true) +40107 +-- Iteration 73 -- +bool(true) +100110 +bool(true) +40110 +-- Iteration 74 -- +bool(true) +100111 +bool(true) +40111 +-- Iteration 75 -- +bool(true) +100112 +bool(true) +40112 +-- Iteration 76 -- +bool(true) +100113 +bool(true) +40113 +-- Iteration 77 -- +bool(true) +100114 +bool(true) +40114 +-- Iteration 78 -- +bool(true) +100115 +bool(true) +40115 +-- Iteration 79 -- +bool(true) +100116 +bool(true) +40116 +-- Iteration 80 -- +bool(true) +100117 +bool(true) +40117 +-- Iteration 81 -- +bool(true) +100120 +bool(true) +40120 +-- Iteration 82 -- +bool(true) +100121 +bool(true) +40121 +-- Iteration 83 -- +bool(true) +100122 +bool(true) +40122 +-- Iteration 84 -- +bool(true) +100123 +bool(true) +40123 +-- Iteration 85 -- +bool(true) +100124 +bool(true) +40124 +-- Iteration 86 -- +bool(true) +100125 +bool(true) +40125 +-- Iteration 87 -- +bool(true) +100126 +bool(true) +40126 +-- Iteration 88 -- +bool(true) +100127 +bool(true) +40127 +-- Iteration 89 -- +bool(true) +100130 +bool(true) +40130 +-- Iteration 90 -- +bool(true) +100131 +bool(true) +40131 +-- Iteration 91 -- +bool(true) +100132 +bool(true) +40132 +-- Iteration 92 -- +bool(true) +100133 +bool(true) +40133 +-- Iteration 93 -- +bool(true) +100134 +bool(true) +40134 +-- Iteration 94 -- +bool(true) +100135 +bool(true) +40135 +-- Iteration 95 -- +bool(true) +100136 +bool(true) +40136 +-- Iteration 96 -- +bool(true) +100137 +bool(true) +40137 +-- Iteration 97 -- +bool(true) +100140 +bool(true) +40140 +-- Iteration 98 -- +bool(true) +100141 +bool(true) +40141 +-- Iteration 99 -- +bool(true) +100142 +bool(true) +40142 +-- Iteration 100 -- +bool(true) +100143 +bool(true) +40143 +-- Iteration 101 -- +bool(true) +100144 +bool(true) +40144 +-- Iteration 102 -- +bool(true) +100145 +bool(true) +40145 +-- Iteration 103 -- +bool(true) +100146 +bool(true) +40146 +-- Iteration 104 -- +bool(true) +100147 +bool(true) +40147 +-- Iteration 105 -- +bool(true) +100150 +bool(true) +40150 +-- Iteration 106 -- +bool(true) +100151 +bool(true) +40151 +-- Iteration 107 -- +bool(true) +100152 +bool(true) +40152 +-- Iteration 108 -- +bool(true) +100153 +bool(true) +40153 +-- Iteration 109 -- +bool(true) +100154 +bool(true) +40154 +-- Iteration 110 -- +bool(true) +100155 +bool(true) +40155 +-- Iteration 111 -- +bool(true) +100156 +bool(true) +40156 +-- Iteration 112 -- +bool(true) +100157 +bool(true) +40157 +-- Iteration 113 -- +bool(true) +100160 +bool(true) +40160 +-- Iteration 114 -- +bool(true) +100161 +bool(true) +40161 +-- Iteration 115 -- +bool(true) +100162 +bool(true) +40162 +-- Iteration 116 -- +bool(true) +100163 +bool(true) +40163 +-- Iteration 117 -- +bool(true) +100164 +bool(true) +40164 +-- Iteration 118 -- +bool(true) +100165 +bool(true) +40165 +-- Iteration 119 -- +bool(true) +100166 +bool(true) +40166 +-- Iteration 120 -- +bool(true) +100167 +bool(true) +40167 +-- Iteration 121 -- +bool(true) +100170 +bool(true) +40170 +-- Iteration 122 -- +bool(true) +100171 +bool(true) +40171 +-- Iteration 123 -- +bool(true) +100172 +bool(true) +40172 +-- Iteration 124 -- +bool(true) +100173 +bool(true) +40173 +-- Iteration 125 -- +bool(true) +100174 +bool(true) +40174 +-- Iteration 126 -- +bool(true) +100175 +bool(true) +40175 +-- Iteration 127 -- +bool(true) +100176 +bool(true) +40176 +-- Iteration 128 -- +bool(true) +100177 +bool(true) +40177 +-- Iteration 129 -- +bool(true) +100200 +bool(true) +40200 +-- Iteration 130 -- +bool(true) +100201 +bool(true) +40201 +-- Iteration 131 -- +bool(true) +100202 +bool(true) +40202 +-- Iteration 132 -- +bool(true) +100203 +bool(true) +40203 +-- Iteration 133 -- +bool(true) +100204 +bool(true) +40204 +-- Iteration 134 -- +bool(true) +100205 +bool(true) +40205 +-- Iteration 135 -- +bool(true) +100206 +bool(true) +40206 +-- Iteration 136 -- +bool(true) +100207 +bool(true) +40207 +-- Iteration 137 -- +bool(true) +100210 +bool(true) +40210 +-- Iteration 138 -- +bool(true) +100211 +bool(true) +40211 +-- Iteration 139 -- +bool(true) +100212 +bool(true) +40212 +-- Iteration 140 -- +bool(true) +100213 +bool(true) +40213 +-- Iteration 141 -- +bool(true) +100214 +bool(true) +40214 +-- Iteration 142 -- +bool(true) +100215 +bool(true) +40215 +-- Iteration 143 -- +bool(true) +100216 +bool(true) +40216 +-- Iteration 144 -- +bool(true) +100217 +bool(true) +40217 +-- Iteration 145 -- +bool(true) +100220 +bool(true) +40220 +-- Iteration 146 -- +bool(true) +100221 +bool(true) +40221 +-- Iteration 147 -- +bool(true) +100222 +bool(true) +40222 +-- Iteration 148 -- +bool(true) +100223 +bool(true) +40223 +-- Iteration 149 -- +bool(true) +100224 +bool(true) +40224 +-- Iteration 150 -- +bool(true) +100225 +bool(true) +40225 +-- Iteration 151 -- +bool(true) +100226 +bool(true) +40226 +-- Iteration 152 -- +bool(true) +100227 +bool(true) +40227 +-- Iteration 153 -- +bool(true) +100230 +bool(true) +40230 +-- Iteration 154 -- +bool(true) +100231 +bool(true) +40231 +-- Iteration 155 -- +bool(true) +100232 +bool(true) +40232 +-- Iteration 156 -- +bool(true) +100233 +bool(true) +40233 +-- Iteration 157 -- +bool(true) +100234 +bool(true) +40234 +-- Iteration 158 -- +bool(true) +100235 +bool(true) +40235 +-- Iteration 159 -- +bool(true) +100236 +bool(true) +40236 +-- Iteration 160 -- +bool(true) +100237 +bool(true) +40237 +-- Iteration 161 -- +bool(true) +100240 +bool(true) +40240 +-- Iteration 162 -- +bool(true) +100241 +bool(true) +40241 +-- Iteration 163 -- +bool(true) +100242 +bool(true) +40242 +-- Iteration 164 -- +bool(true) +100243 +bool(true) +40243 +-- Iteration 165 -- +bool(true) +100244 +bool(true) +40244 +-- Iteration 166 -- +bool(true) +100245 +bool(true) +40245 +-- Iteration 167 -- +bool(true) +100246 +bool(true) +40246 +-- Iteration 168 -- +bool(true) +100247 +bool(true) +40247 +-- Iteration 169 -- +bool(true) +100250 +bool(true) +40250 +-- Iteration 170 -- +bool(true) +100251 +bool(true) +40251 +-- Iteration 171 -- +bool(true) +100252 +bool(true) +40252 +-- Iteration 172 -- +bool(true) +100253 +bool(true) +40253 +-- Iteration 173 -- +bool(true) +100254 +bool(true) +40254 +-- Iteration 174 -- +bool(true) +100255 +bool(true) +40255 +-- Iteration 175 -- +bool(true) +100256 +bool(true) +40256 +-- Iteration 176 -- +bool(true) +100257 +bool(true) +40257 +-- Iteration 177 -- +bool(true) +100260 +bool(true) +40260 +-- Iteration 178 -- +bool(true) +100261 +bool(true) +40261 +-- Iteration 179 -- +bool(true) +100262 +bool(true) +40262 +-- Iteration 180 -- +bool(true) +100263 +bool(true) +40263 +-- Iteration 181 -- +bool(true) +100264 +bool(true) +40264 +-- Iteration 182 -- +bool(true) +100265 +bool(true) +40265 +-- Iteration 183 -- +bool(true) +100266 +bool(true) +40266 +-- Iteration 184 -- +bool(true) +100267 +bool(true) +40267 +-- Iteration 185 -- +bool(true) +100270 +bool(true) +40270 +-- Iteration 186 -- +bool(true) +100271 +bool(true) +40271 +-- Iteration 187 -- +bool(true) +100272 +bool(true) +40272 +-- Iteration 188 -- +bool(true) +100273 +bool(true) +40273 +-- Iteration 189 -- +bool(true) +100274 +bool(true) +40274 +-- Iteration 190 -- +bool(true) +100275 +bool(true) +40275 +-- Iteration 191 -- +bool(true) +100276 +bool(true) +40276 +-- Iteration 192 -- +bool(true) +100277 +bool(true) +40277 +-- Iteration 193 -- +bool(true) +100300 +bool(true) +40300 +-- Iteration 194 -- +bool(true) +100301 +bool(true) +40301 +-- Iteration 195 -- +bool(true) +100302 +bool(true) +40302 +-- Iteration 196 -- +bool(true) +100303 +bool(true) +40303 +-- Iteration 197 -- +bool(true) +100304 +bool(true) +40304 +-- Iteration 198 -- +bool(true) +100305 +bool(true) +40305 +-- Iteration 199 -- +bool(true) +100306 +bool(true) +40306 +-- Iteration 200 -- +bool(true) +100307 +bool(true) +40307 +-- Iteration 201 -- +bool(true) +100310 +bool(true) +40310 +-- Iteration 202 -- +bool(true) +100311 +bool(true) +40311 +-- Iteration 203 -- +bool(true) +100312 +bool(true) +40312 +-- Iteration 204 -- +bool(true) +100313 +bool(true) +40313 +-- Iteration 205 -- +bool(true) +100314 +bool(true) +40314 +-- Iteration 206 -- +bool(true) +100315 +bool(true) +40315 +-- Iteration 207 -- +bool(true) +100316 +bool(true) +40316 +-- Iteration 208 -- +bool(true) +100317 +bool(true) +40317 +-- Iteration 209 -- +bool(true) +100320 +bool(true) +40320 +-- Iteration 210 -- +bool(true) +100321 +bool(true) +40321 +-- Iteration 211 -- +bool(true) +100322 +bool(true) +40322 +-- Iteration 212 -- +bool(true) +100323 +bool(true) +40323 +-- Iteration 213 -- +bool(true) +100324 +bool(true) +40324 +-- Iteration 214 -- +bool(true) +100325 +bool(true) +40325 +-- Iteration 215 -- +bool(true) +100326 +bool(true) +40326 +-- Iteration 216 -- +bool(true) +100327 +bool(true) +40327 +-- Iteration 217 -- +bool(true) +100330 +bool(true) +40330 +-- Iteration 218 -- +bool(true) +100331 +bool(true) +40331 +-- Iteration 219 -- +bool(true) +100332 +bool(true) +40332 +-- Iteration 220 -- +bool(true) +100333 +bool(true) +40333 +-- Iteration 221 -- +bool(true) +100334 +bool(true) +40334 +-- Iteration 222 -- +bool(true) +100335 +bool(true) +40335 +-- Iteration 223 -- +bool(true) +100336 +bool(true) +40336 +-- Iteration 224 -- +bool(true) +100337 +bool(true) +40337 +-- Iteration 225 -- +bool(true) +100340 +bool(true) +40340 +-- Iteration 226 -- +bool(true) +100341 +bool(true) +40341 +-- Iteration 227 -- +bool(true) +100342 +bool(true) +40342 +-- Iteration 228 -- +bool(true) +100343 +bool(true) +40343 +-- Iteration 229 -- +bool(true) +100344 +bool(true) +40344 +-- Iteration 230 -- +bool(true) +100345 +bool(true) +40345 +-- Iteration 231 -- +bool(true) +100346 +bool(true) +40346 +-- Iteration 232 -- +bool(true) +100347 +bool(true) +40347 +-- Iteration 233 -- +bool(true) +100350 +bool(true) +40350 +-- Iteration 234 -- +bool(true) +100351 +bool(true) +40351 +-- Iteration 235 -- +bool(true) +100352 +bool(true) +40352 +-- Iteration 236 -- +bool(true) +100353 +bool(true) +40353 +-- Iteration 237 -- +bool(true) +100354 +bool(true) +40354 +-- Iteration 238 -- +bool(true) +100355 +bool(true) +40355 +-- Iteration 239 -- +bool(true) +100356 +bool(true) +40356 +-- Iteration 240 -- +bool(true) +100357 +bool(true) +40357 +-- Iteration 241 -- +bool(true) +100360 +bool(true) +40360 +-- Iteration 242 -- +bool(true) +100361 +bool(true) +40361 +-- Iteration 243 -- +bool(true) +100362 +bool(true) +40362 +-- Iteration 244 -- +bool(true) +100363 +bool(true) +40363 +-- Iteration 245 -- +bool(true) +100364 +bool(true) +40364 +-- Iteration 246 -- +bool(true) +100365 +bool(true) +40365 +-- Iteration 247 -- +bool(true) +100366 +bool(true) +40366 +-- Iteration 248 -- +bool(true) +100367 +bool(true) +40367 +-- Iteration 249 -- +bool(true) +100370 +bool(true) +40370 +-- Iteration 250 -- +bool(true) +100371 +bool(true) +40371 +-- Iteration 251 -- +bool(true) +100372 +bool(true) +40372 +-- Iteration 252 -- +bool(true) +100373 +bool(true) +40373 +-- Iteration 253 -- +bool(true) +100374 +bool(true) +40374 +-- Iteration 254 -- +bool(true) +100375 +bool(true) +40375 +-- Iteration 255 -- +bool(true) +100376 +bool(true) +40376 +-- Iteration 256 -- +bool(true) +100377 +bool(true) +40377 +-- Iteration 257 -- +bool(true) +100400 +bool(true) +40400 +-- Iteration 258 -- +bool(true) +100401 +bool(true) +40401 +-- Iteration 259 -- +bool(true) +100402 +bool(true) +40402 +-- Iteration 260 -- +bool(true) +100403 +bool(true) +40403 +-- Iteration 261 -- +bool(true) +100404 +bool(true) +40404 +-- Iteration 262 -- +bool(true) +100405 +bool(true) +40405 +-- Iteration 263 -- +bool(true) +100406 +bool(true) +40406 +-- Iteration 264 -- +bool(true) +100407 +bool(true) +40407 +-- Iteration 265 -- +bool(true) +100410 +bool(true) +40410 +-- Iteration 266 -- +bool(true) +100411 +bool(true) +40411 +-- Iteration 267 -- +bool(true) +100412 +bool(true) +40412 +-- Iteration 268 -- +bool(true) +100413 +bool(true) +40413 +-- Iteration 269 -- +bool(true) +100414 +bool(true) +40414 +-- Iteration 270 -- +bool(true) +100415 +bool(true) +40415 +-- Iteration 271 -- +bool(true) +100416 +bool(true) +40416 +-- Iteration 272 -- +bool(true) +100417 +bool(true) +40417 +-- Iteration 273 -- +bool(true) +100420 +bool(true) +40420 +-- Iteration 274 -- +bool(true) +100421 +bool(true) +40421 +-- Iteration 275 -- +bool(true) +100422 +bool(true) +40422 +-- Iteration 276 -- +bool(true) +100423 +bool(true) +40423 +-- Iteration 277 -- +bool(true) +100424 +bool(true) +40424 +-- Iteration 278 -- +bool(true) +100425 +bool(true) +40425 +-- Iteration 279 -- +bool(true) +100426 +bool(true) +40426 +-- Iteration 280 -- +bool(true) +100427 +bool(true) +40427 +-- Iteration 281 -- +bool(true) +100430 +bool(true) +40430 +-- Iteration 282 -- +bool(true) +100431 +bool(true) +40431 +-- Iteration 283 -- +bool(true) +100432 +bool(true) +40432 +-- Iteration 284 -- +bool(true) +100433 +bool(true) +40433 +-- Iteration 285 -- +bool(true) +100434 +bool(true) +40434 +-- Iteration 286 -- +bool(true) +100435 +bool(true) +40435 +-- Iteration 287 -- +bool(true) +100436 +bool(true) +40436 +-- Iteration 288 -- +bool(true) +100437 +bool(true) +40437 +-- Iteration 289 -- +bool(true) +100440 +bool(true) +40440 +-- Iteration 290 -- +bool(true) +100441 +bool(true) +40441 +-- Iteration 291 -- +bool(true) +100442 +bool(true) +40442 +-- Iteration 292 -- +bool(true) +100443 +bool(true) +40443 +-- Iteration 293 -- +bool(true) +100444 +bool(true) +40444 +-- Iteration 294 -- +bool(true) +100445 +bool(true) +40445 +-- Iteration 295 -- +bool(true) +100446 +bool(true) +40446 +-- Iteration 296 -- +bool(true) +100447 +bool(true) +40447 +-- Iteration 297 -- +bool(true) +100450 +bool(true) +40450 +-- Iteration 298 -- +bool(true) +100451 +bool(true) +40451 +-- Iteration 299 -- +bool(true) +100452 +bool(true) +40452 +-- Iteration 300 -- +bool(true) +100453 +bool(true) +40453 +-- Iteration 301 -- +bool(true) +100454 +bool(true) +40454 +-- Iteration 302 -- +bool(true) +100455 +bool(true) +40455 +-- Iteration 303 -- +bool(true) +100456 +bool(true) +40456 +-- Iteration 304 -- +bool(true) +100457 +bool(true) +40457 +-- Iteration 305 -- +bool(true) +100460 +bool(true) +40460 +-- Iteration 306 -- +bool(true) +100461 +bool(true) +40461 +-- Iteration 307 -- +bool(true) +100462 +bool(true) +40462 +-- Iteration 308 -- +bool(true) +100463 +bool(true) +40463 +-- Iteration 309 -- +bool(true) +100464 +bool(true) +40464 +-- Iteration 310 -- +bool(true) +100465 +bool(true) +40465 +-- Iteration 311 -- +bool(true) +100466 +bool(true) +40466 +-- Iteration 312 -- +bool(true) +100467 +bool(true) +40467 +-- Iteration 313 -- +bool(true) +100470 +bool(true) +40470 +-- Iteration 314 -- +bool(true) +100471 +bool(true) +40471 +-- Iteration 315 -- +bool(true) +100472 +bool(true) +40472 +-- Iteration 316 -- +bool(true) +100473 +bool(true) +40473 +-- Iteration 317 -- +bool(true) +100474 +bool(true) +40474 +-- Iteration 318 -- +bool(true) +100475 +bool(true) +40475 +-- Iteration 319 -- +bool(true) +100476 +bool(true) +40476 +-- Iteration 320 -- +bool(true) +100477 +bool(true) +40477 +-- Iteration 321 -- +bool(true) +100500 +bool(true) +40500 +-- Iteration 322 -- +bool(true) +100501 +bool(true) +40501 +-- Iteration 323 -- +bool(true) +100502 +bool(true) +40502 +-- Iteration 324 -- +bool(true) +100503 +bool(true) +40503 +-- Iteration 325 -- +bool(true) +100504 +bool(true) +40504 +-- Iteration 326 -- +bool(true) +100505 +bool(true) +40505 +-- Iteration 327 -- +bool(true) +100506 +bool(true) +40506 +-- Iteration 328 -- +bool(true) +100507 +bool(true) +40507 +-- Iteration 329 -- +bool(true) +100510 +bool(true) +40510 +-- Iteration 330 -- +bool(true) +100511 +bool(true) +40511 +-- Iteration 331 -- +bool(true) +100512 +bool(true) +40512 +-- Iteration 332 -- +bool(true) +100513 +bool(true) +40513 +-- Iteration 333 -- +bool(true) +100514 +bool(true) +40514 +-- Iteration 334 -- +bool(true) +100515 +bool(true) +40515 +-- Iteration 335 -- +bool(true) +100516 +bool(true) +40516 +-- Iteration 336 -- +bool(true) +100517 +bool(true) +40517 +-- Iteration 337 -- +bool(true) +100520 +bool(true) +40520 +-- Iteration 338 -- +bool(true) +100521 +bool(true) +40521 +-- Iteration 339 -- +bool(true) +100522 +bool(true) +40522 +-- Iteration 340 -- +bool(true) +100523 +bool(true) +40523 +-- Iteration 341 -- +bool(true) +100524 +bool(true) +40524 +-- Iteration 342 -- +bool(true) +100525 +bool(true) +40525 +-- Iteration 343 -- +bool(true) +100526 +bool(true) +40526 +-- Iteration 344 -- +bool(true) +100527 +bool(true) +40527 +-- Iteration 345 -- +bool(true) +100530 +bool(true) +40530 +-- Iteration 346 -- +bool(true) +100531 +bool(true) +40531 +-- Iteration 347 -- +bool(true) +100532 +bool(true) +40532 +-- Iteration 348 -- +bool(true) +100533 +bool(true) +40533 +-- Iteration 349 -- +bool(true) +100534 +bool(true) +40534 +-- Iteration 350 -- +bool(true) +100535 +bool(true) +40535 +-- Iteration 351 -- +bool(true) +100536 +bool(true) +40536 +-- Iteration 352 -- +bool(true) +100537 +bool(true) +40537 +-- Iteration 353 -- +bool(true) +100540 +bool(true) +40540 +-- Iteration 354 -- +bool(true) +100541 +bool(true) +40541 +-- Iteration 355 -- +bool(true) +100542 +bool(true) +40542 +-- Iteration 356 -- +bool(true) +100543 +bool(true) +40543 +-- Iteration 357 -- +bool(true) +100544 +bool(true) +40544 +-- Iteration 358 -- +bool(true) +100545 +bool(true) +40545 +-- Iteration 359 -- +bool(true) +100546 +bool(true) +40546 +-- Iteration 360 -- +bool(true) +100547 +bool(true) +40547 +-- Iteration 361 -- +bool(true) +100550 +bool(true) +40550 +-- Iteration 362 -- +bool(true) +100551 +bool(true) +40551 +-- Iteration 363 -- +bool(true) +100552 +bool(true) +40552 +-- Iteration 364 -- +bool(true) +100553 +bool(true) +40553 +-- Iteration 365 -- +bool(true) +100554 +bool(true) +40554 +-- Iteration 366 -- +bool(true) +100555 +bool(true) +40555 +-- Iteration 367 -- +bool(true) +100556 +bool(true) +40556 +-- Iteration 368 -- +bool(true) +100557 +bool(true) +40557 +-- Iteration 369 -- +bool(true) +100560 +bool(true) +40560 +-- Iteration 370 -- +bool(true) +100561 +bool(true) +40561 +-- Iteration 371 -- +bool(true) +100562 +bool(true) +40562 +-- Iteration 372 -- +bool(true) +100563 +bool(true) +40563 +-- Iteration 373 -- +bool(true) +100564 +bool(true) +40564 +-- Iteration 374 -- +bool(true) +100565 +bool(true) +40565 +-- Iteration 375 -- +bool(true) +100566 +bool(true) +40566 +-- Iteration 376 -- +bool(true) +100567 +bool(true) +40567 +-- Iteration 377 -- +bool(true) +100570 +bool(true) +40570 +-- Iteration 378 -- +bool(true) +100571 +bool(true) +40571 +-- Iteration 379 -- +bool(true) +100572 +bool(true) +40572 +-- Iteration 380 -- +bool(true) +100573 +bool(true) +40573 +-- Iteration 381 -- +bool(true) +100574 +bool(true) +40574 +-- Iteration 382 -- +bool(true) +100575 +bool(true) +40575 +-- Iteration 383 -- +bool(true) +100576 +bool(true) +40576 +-- Iteration 384 -- +bool(true) +100577 +bool(true) +40577 +-- Iteration 385 -- +bool(true) +100600 +bool(true) +40600 +-- Iteration 386 -- +bool(true) +100601 +bool(true) +40601 +-- Iteration 387 -- +bool(true) +100602 +bool(true) +40602 +-- Iteration 388 -- +bool(true) +100603 +bool(true) +40603 +-- Iteration 389 -- +bool(true) +100604 +bool(true) +40604 +-- Iteration 390 -- +bool(true) +100605 +bool(true) +40605 +-- Iteration 391 -- +bool(true) +100606 +bool(true) +40606 +-- Iteration 392 -- +bool(true) +100607 +bool(true) +40607 +-- Iteration 393 -- +bool(true) +100610 +bool(true) +40610 +-- Iteration 394 -- +bool(true) +100611 +bool(true) +40611 +-- Iteration 395 -- +bool(true) +100612 +bool(true) +40612 +-- Iteration 396 -- +bool(true) +100613 +bool(true) +40613 +-- Iteration 397 -- +bool(true) +100614 +bool(true) +40614 +-- Iteration 398 -- +bool(true) +100615 +bool(true) +40615 +-- Iteration 399 -- +bool(true) +100616 +bool(true) +40616 +-- Iteration 400 -- +bool(true) +100617 +bool(true) +40617 +-- Iteration 401 -- +bool(true) +100620 +bool(true) +40620 +-- Iteration 402 -- +bool(true) +100621 +bool(true) +40621 +-- Iteration 403 -- +bool(true) +100622 +bool(true) +40622 +-- Iteration 404 -- +bool(true) +100623 +bool(true) +40623 +-- Iteration 405 -- +bool(true) +100624 +bool(true) +40624 +-- Iteration 406 -- +bool(true) +100625 +bool(true) +40625 +-- Iteration 407 -- +bool(true) +100626 +bool(true) +40626 +-- Iteration 408 -- +bool(true) +100627 +bool(true) +40627 +-- Iteration 409 -- +bool(true) +100630 +bool(true) +40630 +-- Iteration 410 -- +bool(true) +100631 +bool(true) +40631 +-- Iteration 411 -- +bool(true) +100632 +bool(true) +40632 +-- Iteration 412 -- +bool(true) +100633 +bool(true) +40633 +-- Iteration 413 -- +bool(true) +100634 +bool(true) +40634 +-- Iteration 414 -- +bool(true) +100635 +bool(true) +40635 +-- Iteration 415 -- +bool(true) +100636 +bool(true) +40636 +-- Iteration 416 -- +bool(true) +100637 +bool(true) +40637 +-- Iteration 417 -- +bool(true) +100640 +bool(true) +40640 +-- Iteration 418 -- +bool(true) +100641 +bool(true) +40641 +-- Iteration 419 -- +bool(true) +100642 +bool(true) +40642 +-- Iteration 420 -- +bool(true) +100643 +bool(true) +40643 +-- Iteration 421 -- +bool(true) +100644 +bool(true) +40644 +-- Iteration 422 -- +bool(true) +100645 +bool(true) +40645 +-- Iteration 423 -- +bool(true) +100646 +bool(true) +40646 +-- Iteration 424 -- +bool(true) +100647 +bool(true) +40647 +-- Iteration 425 -- +bool(true) +100650 +bool(true) +40650 +-- Iteration 426 -- +bool(true) +100651 +bool(true) +40651 +-- Iteration 427 -- +bool(true) +100652 +bool(true) +40652 +-- Iteration 428 -- +bool(true) +100653 +bool(true) +40653 +-- Iteration 429 -- +bool(true) +100654 +bool(true) +40654 +-- Iteration 430 -- +bool(true) +100655 +bool(true) +40655 +-- Iteration 431 -- +bool(true) +100656 +bool(true) +40656 +-- Iteration 432 -- +bool(true) +100657 +bool(true) +40657 +-- Iteration 433 -- +bool(true) +100660 +bool(true) +40660 +-- Iteration 434 -- +bool(true) +100661 +bool(true) +40661 +-- Iteration 435 -- +bool(true) +100662 +bool(true) +40662 +-- Iteration 436 -- +bool(true) +100663 +bool(true) +40663 +-- Iteration 437 -- +bool(true) +100664 +bool(true) +40664 +-- Iteration 438 -- +bool(true) +100665 +bool(true) +40665 +-- Iteration 439 -- +bool(true) +100666 +bool(true) +40666 +-- Iteration 440 -- +bool(true) +100667 +bool(true) +40667 +-- Iteration 441 -- +bool(true) +100670 +bool(true) +40670 +-- Iteration 442 -- +bool(true) +100671 +bool(true) +40671 +-- Iteration 443 -- +bool(true) +100672 +bool(true) +40672 +-- Iteration 444 -- +bool(true) +100673 +bool(true) +40673 +-- Iteration 445 -- +bool(true) +100674 +bool(true) +40674 +-- Iteration 446 -- +bool(true) +100675 +bool(true) +40675 +-- Iteration 447 -- +bool(true) +100676 +bool(true) +40676 +-- Iteration 448 -- +bool(true) +100677 +bool(true) +40677 +-- Iteration 449 -- +bool(true) +100700 +bool(true) +40700 +-- Iteration 450 -- +bool(true) +100701 +bool(true) +40701 +-- Iteration 451 -- +bool(true) +100702 +bool(true) +40702 +-- Iteration 452 -- +bool(true) +100703 +bool(true) +40703 +-- Iteration 453 -- +bool(true) +100704 +bool(true) +40704 +-- Iteration 454 -- +bool(true) +100705 +bool(true) +40705 +-- Iteration 455 -- +bool(true) +100706 +bool(true) +40706 +-- Iteration 456 -- +bool(true) +100707 +bool(true) +40707 +-- Iteration 457 -- +bool(true) +100710 +bool(true) +40710 +-- Iteration 458 -- +bool(true) +100711 +bool(true) +40711 +-- Iteration 459 -- +bool(true) +100712 +bool(true) +40712 +-- Iteration 460 -- +bool(true) +100713 +bool(true) +40713 +-- Iteration 461 -- +bool(true) +100714 +bool(true) +40714 +-- Iteration 462 -- +bool(true) +100715 +bool(true) +40715 +-- Iteration 463 -- +bool(true) +100716 +bool(true) +40716 +-- Iteration 464 -- +bool(true) +100717 +bool(true) +40717 +-- Iteration 465 -- +bool(true) +100720 +bool(true) +40720 +-- Iteration 466 -- +bool(true) +100721 +bool(true) +40721 +-- Iteration 467 -- +bool(true) +100722 +bool(true) +40722 +-- Iteration 468 -- +bool(true) +100723 +bool(true) +40723 +-- Iteration 469 -- +bool(true) +100724 +bool(true) +40724 +-- Iteration 470 -- +bool(true) +100725 +bool(true) +40725 +-- Iteration 471 -- +bool(true) +100726 +bool(true) +40726 +-- Iteration 472 -- +bool(true) +100727 +bool(true) +40727 +-- Iteration 473 -- +bool(true) +100730 +bool(true) +40730 +-- Iteration 474 -- +bool(true) +100731 +bool(true) +40731 +-- Iteration 475 -- +bool(true) +100732 +bool(true) +40732 +-- Iteration 476 -- +bool(true) +100733 +bool(true) +40733 +-- Iteration 477 -- +bool(true) +100734 +bool(true) +40734 +-- Iteration 478 -- +bool(true) +100735 +bool(true) +40735 +-- Iteration 479 -- +bool(true) +100736 +bool(true) +40736 +-- Iteration 480 -- +bool(true) +100737 +bool(true) +40737 +-- Iteration 481 -- +bool(true) +100740 +bool(true) +40740 +-- Iteration 482 -- +bool(true) +100741 +bool(true) +40741 +-- Iteration 483 -- +bool(true) +100742 +bool(true) +40742 +-- Iteration 484 -- +bool(true) +100743 +bool(true) +40743 +-- Iteration 485 -- +bool(true) +100744 +bool(true) +40744 +-- Iteration 486 -- +bool(true) +100745 +bool(true) +40745 +-- Iteration 487 -- +bool(true) +100746 +bool(true) +40746 +-- Iteration 488 -- +bool(true) +100747 +bool(true) +40747 +-- Iteration 489 -- +bool(true) +100750 +bool(true) +40750 +-- Iteration 490 -- +bool(true) +100751 +bool(true) +40751 +-- Iteration 491 -- +bool(true) +100752 +bool(true) +40752 +-- Iteration 492 -- +bool(true) +100753 +bool(true) +40753 +-- Iteration 493 -- +bool(true) +100754 +bool(true) +40754 +-- Iteration 494 -- +bool(true) +100755 +bool(true) +40755 +-- Iteration 495 -- +bool(true) +100756 +bool(true) +40756 +-- Iteration 496 -- +bool(true) +100757 +bool(true) +40757 +-- Iteration 497 -- +bool(true) +100760 +bool(true) +40760 +-- Iteration 498 -- +bool(true) +100761 +bool(true) +40761 +-- Iteration 499 -- +bool(true) +100762 +bool(true) +40762 +-- Iteration 500 -- +bool(true) +100763 +bool(true) +40763 +-- Iteration 501 -- +bool(true) +100764 +bool(true) +40764 +-- Iteration 502 -- +bool(true) +100765 +bool(true) +40765 +-- Iteration 503 -- +bool(true) +100766 +bool(true) +40766 +-- Iteration 504 -- +bool(true) +100767 +bool(true) +40767 +-- Iteration 505 -- +bool(true) +100770 +bool(true) +40770 +-- Iteration 506 -- +bool(true) +100771 +bool(true) +40771 +-- Iteration 507 -- +bool(true) +100772 +bool(true) +40772 +-- Iteration 508 -- +bool(true) +100773 +bool(true) +40773 +-- Iteration 509 -- +bool(true) +100774 +bool(true) +40774 +-- Iteration 510 -- +bool(true) +100775 +bool(true) +40775 +-- Iteration 511 -- +bool(true) +100776 +bool(true) +40776 +-- Iteration 512 -- +bool(true) +100777 +bool(true) +40777 +*** Done *** diff --git a/ext/standard/tests/file/006_variation2.phpt b/ext/standard/tests/file/006_variation2.phpt new file mode 100644 index 0000000..d56207a --- /dev/null +++ b/ext/standard/tests/file/006_variation2.phpt @@ -0,0 +1,186 @@ +--TEST-- +Test fileperms() & chmod() functions: usage variation - misc. perms +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing fileperms() & chmod() : usage variations *** + +*** Testing fileperms(), chmod() with miscellaneous permissions *** +-- Iteration 1 -- +bool(true) +107777 +bool(true) +47777 +-- Iteration 2 -- +bool(true) +100000 +bool(true) +40000 +-- Iteration 3 -- +bool(true) +101000 +bool(true) +41000 +-- Iteration 4 -- +bool(true) +101111 +bool(true) +41111 +-- Iteration 5 -- +bool(true) +107001 +bool(true) +47001 +-- Iteration 6 -- +bool(true) +100001 +bool(true) +40001 +-- Iteration 7 -- +bool(true) +101411 +bool(true) +41411 +-- Iteration 8 -- +bool(true) +107141 +bool(true) +47141 +-- Iteration 9 -- +bool(true) +100637 +bool(true) +40637 +-- Iteration 10 -- +bool(true) +103567 +bool(true) +43567 +-- Iteration 11 -- +bool(true) +103567 +bool(true) +43567 +-- Iteration 12 -- + +Warning: chmod() expects parameter 2 to be long, string given in %s on line %d +NULL +103567 + +Warning: chmod() expects parameter 2 to be long, string given in %s on line %d +NULL +43567 +-- Iteration 13 -- + +Warning: chmod() expects parameter 2 to be long, string given in %s on line %d +NULL +103567 + +Warning: chmod() expects parameter 2 to be long, string given in %s on line %d +NULL +43567 +-- Iteration 14 -- + +Warning: chmod() expects parameter 2 to be long, string given in %s on line %d +NULL +103567 + +Warning: chmod() expects parameter 2 to be long, string given in %s on line %d +NULL +43567 +-- Iteration 15 -- + +Warning: chmod() expects parameter 2 to be long, string given in %s on line %d +NULL +103567 + +Warning: chmod() expects parameter 2 to be long, string given in %s on line %d +NULL +43567 +*** Done *** diff --git a/ext/standard/tests/file/007_basic.phpt b/ext/standard/tests/file/007_basic.phpt new file mode 100644 index 0000000..eafadf7 --- /dev/null +++ b/ext/standard/tests/file/007_basic.phpt @@ -0,0 +1,412 @@ +--TEST-- +Test fopen(), fclose() & feof() functions: basic functionality +--FILE-- + +--FILE-- + +--EXPECTF-- +*** Testing error conditions for fopen(), fclsoe() & feof() *** + +Warning: fopen() expects at least 2 parameters, 1 given in %s on line %d +bool(false) + +Warning: fopen() expects at least 2 parameters, 0 given in %s on line %d +bool(false) + +Warning: fclose(): 5 is not a valid stream resource in %s on line %d +bool(false) + +Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d +bool(false) + +Warning: fclose() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: feof(): 5 is not a valid stream resource in %s on line %d +bool(false) + +Warning: feof() expects parameter 1 to be resource, string given in %s on line %d +bool(false) + +Warning: feof() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: fopen() expects at most 4 parameters, 5 given in %s on line %d +bool(false) + +Warning: fclose() expects exactly 1 parameter, 2 given in %s on line %d +bool(false) + +Warning: feof() expects exactly 1 parameter, 2 given in %s on line %d +bool(false) +-- Testing fopen(), fclose() & feof() with invalid arguments -- +-- Iteration 1 -- + +Warning: fopen(string): failed to open stream: No such file or directory in %s on line %d +bool(false) + +Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d +bool(false) + +Warning: feof() expects parameter 1 to be resource, string given in %s on line %d +bool(false) +-- Iteration 2 -- + +Warning: fopen(10): failed to open stream: No such file or directory in %s on line %d +bool(false) + +Warning: fclose() expects parameter 1 to be resource, integer given in %s on line %d +bool(false) + +Warning: feof() expects parameter 1 to be resource, integer given in %s on line %d +bool(false) +-- Iteration 3 -- + +Warning: fopen(10.5): failed to open stream: No such file or directory in %s on line %d +bool(false) + +Warning: fclose() expects parameter 1 to be resource, double given in %s on line %d +bool(false) + +Warning: feof() expects parameter 1 to be resource, double given in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: fopen(1): failed to open stream: No such file or directory in %s on line %d +bool(false) + +Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d +bool(false) + +Warning: feof() expects parameter 1 to be resource, boolean given in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: fopen() expects parameter 1 to be a valid path, array given in %s on line %d +bool(false) + +Warning: fclose() expects parameter 1 to be resource, array given in %s on line %d +bool(false) + +Warning: feof() expects parameter 1 to be resource, array given in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: fopen() expects parameter 1 to be a valid path, object given in %s on line %d +bool(false) + +Warning: fclose() expects parameter 1 to be resource, object given in %s on line %d +bool(false) + +Warning: feof() expects parameter 1 to be resource, object given in %s on line %d +bool(false) +-- Iteration 7 -- + +Warning: fopen(): Filename cannot be empty in %s on line %d +bool(false) + +Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d +bool(false) + +Warning: feof() expects parameter 1 to be resource, null given in %s on line %d +bool(false) +-- Iteration 8 -- + +Warning: fopen(): Filename cannot be empty in %s on line %d +bool(false) + +Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d +bool(false) + +Warning: feof() expects parameter 1 to be resource, string given in %s on line %d +bool(false) diff --git a/ext/standard/tests/file/007_variation1.phpt b/ext/standard/tests/file/007_variation1.phpt new file mode 100644 index 0000000..6cba146 --- /dev/null +++ b/ext/standard/tests/file/007_variation1.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "r" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'r' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +string(20) "line +line of text +li" +int(0) +bool(true) +string(7) "Unknown" +*** Done *** diff --git a/ext/standard/tests/file/007_variation10.phpt b/ext/standard/tests/file/007_variation10.phpt new file mode 100644 index 0000000..c9f3e01 --- /dev/null +++ b/ext/standard/tests/file/007_variation10.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "r+t" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'r+t' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +string(20) "line +line of text +li" +int(20) +int(37) +int(57) +bool(true) +string(7) "Unknown" +*** Done *** diff --git a/ext/standard/tests/file/007_variation11-win32.phpt b/ext/standard/tests/file/007_variation11-win32.phpt new file mode 100644 index 0000000..d9c6e83 --- /dev/null +++ b/ext/standard/tests/file/007_variation11-win32.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "wt" mode +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'wt' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +int(37) +int(37) +string(0) "" +int(0) +bool(true) +string(7) "Unknown" +int(39) +int(0) +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/007_variation11.phpt b/ext/standard/tests/file/007_variation11.phpt new file mode 100644 index 0000000..0656c64 --- /dev/null +++ b/ext/standard/tests/file/007_variation11.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "wt" mode +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'wt' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +int(37) +int(37) +string(0) "" +int(0) +bool(true) +string(7) "Unknown" +int(37) +int(0) +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/007_variation12-win32.phpt b/ext/standard/tests/file/007_variation12-win32.phpt new file mode 100644 index 0000000..0fb9ad8 --- /dev/null +++ b/ext/standard/tests/file/007_variation12-win32.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "w+t" mode +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'w+t' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +int(37) +int(37) +string(37) "abcdefghij +mnopqrst uvwxyz +0123456789" +int(37) +bool(true) +string(7) "Unknown" +int(39) +int(0) +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/007_variation12.phpt b/ext/standard/tests/file/007_variation12.phpt new file mode 100644 index 0000000..44488fa --- /dev/null +++ b/ext/standard/tests/file/007_variation12.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "w+t" mode +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'w+t' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +int(37) +int(37) +string(37) "abcdefghij +mnopqrst uvwxyz +0123456789" +int(37) +bool(true) +string(7) "Unknown" +int(37) +int(0) +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/007_variation13-win32.phpt b/ext/standard/tests/file/007_variation13-win32.phpt new file mode 100644 index 0000000..736b101 --- /dev/null +++ b/ext/standard/tests/file/007_variation13-win32.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "at" mode +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'at' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(37) +string(0) "" +int(0) +bool(true) +string(7) "Unknown" +int(59) +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/007_variation13.phpt b/ext/standard/tests/file/007_variation13.phpt new file mode 100644 index 0000000..0cb48d3 --- /dev/null +++ b/ext/standard/tests/file/007_variation13.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "at" mode +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'at' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(37) +string(0) "" +int(0) +bool(true) +string(7) "Unknown" +int(57) +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/007_variation14.phpt b/ext/standard/tests/file/007_variation14.phpt new file mode 100644 index 0000000..ed76ab4 --- /dev/null +++ b/ext/standard/tests/file/007_variation14.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "a+t" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'a+t' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(37) +string(57) "line +line of text +liabcdefghij +mnopqrst uvwxyz +0123456789" +int(57) +bool(true) +string(7) "Unknown" +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/007_variation15.phpt b/ext/standard/tests/file/007_variation15.phpt new file mode 100644 index 0000000..11eed0d --- /dev/null +++ b/ext/standard/tests/file/007_variation15.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "xt" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'xt' mode *** +resource(%d) of type (stream) +%unicode|string%(6) "stream" +int(0) +int(37) +int(37) +string(0) "" +int(0) +bool(true) +%unicode|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_variation16.phpt b/ext/standard/tests/file/007_variation16.phpt new file mode 100644 index 0000000..c725aa1 --- /dev/null +++ b/ext/standard/tests/file/007_variation16.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "x+t" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'x+t' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +int(37) +int(37) +string(37) "abcdefghij +mnopqrst uvwxyz +0123456789" +int(37) +bool(true) +string(7) "Unknown" + +Warning: fopen(%s): failed to open stream: File exists in %s on line %d +*** Done *** diff --git a/ext/standard/tests/file/007_variation17.phpt b/ext/standard/tests/file/007_variation17.phpt new file mode 100644 index 0000000..d3408e9 --- /dev/null +++ b/ext/standard/tests/file/007_variation17.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "rb" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'rb' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +string(20) "line +line of text +li" +int(0) +bool(true) +string(7) "Unknown" +*** Done *** diff --git a/ext/standard/tests/file/007_variation18.phpt b/ext/standard/tests/file/007_variation18.phpt new file mode 100644 index 0000000..991051d --- /dev/null +++ b/ext/standard/tests/file/007_variation18.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "r+b" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'r+b' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +string(20) "line +line of text +li" +int(20) +int(37) +int(57) +bool(true) +string(7) "Unknown" +*** Done *** diff --git a/ext/standard/tests/file/007_variation19.phpt b/ext/standard/tests/file/007_variation19.phpt new file mode 100644 index 0000000..3830e4f --- /dev/null +++ b/ext/standard/tests/file/007_variation19.phpt @@ -0,0 +1,71 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "wb" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'wb' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +int(37) +int(37) +string(0) "" +int(0) +bool(true) +string(7) "Unknown" +int(37) +int(0) +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/007_variation2.phpt b/ext/standard/tests/file/007_variation2.phpt new file mode 100644 index 0000000..4c883ea --- /dev/null +++ b/ext/standard/tests/file/007_variation2.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "r+" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'r+' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +string(20) "line +line of text +li" +int(20) +int(37) +int(57) +bool(true) +string(7) "Unknown" +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/007_variation20.phpt b/ext/standard/tests/file/007_variation20.phpt new file mode 100644 index 0000000..4d66dc7 --- /dev/null +++ b/ext/standard/tests/file/007_variation20.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "w+b" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'w+b' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +int(37) +int(37) +string(37) "abcdefghij +mnopqrst uvwxyz +0123456789" +int(37) +bool(true) +string(7) "Unknown" +int(37) +int(0) +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/007_variation21.phpt b/ext/standard/tests/file/007_variation21.phpt new file mode 100644 index 0000000..6c968f2 --- /dev/null +++ b/ext/standard/tests/file/007_variation21.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "ab" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'ab' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(37) +string(0) "" +int(0) +bool(true) +string(7) "Unknown" +int(57) +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/007_variation22.phpt b/ext/standard/tests/file/007_variation22.phpt new file mode 100644 index 0000000..d1456fe --- /dev/null +++ b/ext/standard/tests/file/007_variation22.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "a+b" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'a+b' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(37) +string(57) "line +line of text +liabcdefghij +mnopqrst uvwxyz +0123456789" +int(57) +bool(true) +string(7) "Unknown" +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/007_variation23.phpt b/ext/standard/tests/file/007_variation23.phpt new file mode 100644 index 0000000..528f05a --- /dev/null +++ b/ext/standard/tests/file/007_variation23.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "xb" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'xb' mode *** +resource(%d) of type (stream) +%unicode|string%(6) "stream" +int(0) +int(37) +int(37) +string(0) "" +int(0) +bool(true) +%unicode|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_variation24.phpt b/ext/standard/tests/file/007_variation24.phpt new file mode 100644 index 0000000..41fc24c --- /dev/null +++ b/ext/standard/tests/file/007_variation24.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "x+b" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'x+b' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +int(37) +int(37) +string(37) "abcdefghij +mnopqrst uvwxyz +0123456789" +int(37) +bool(true) +string(7) "Unknown" + +Warning: fopen(%s): failed to open stream: File exists in %s on line %d +*** Done *** diff --git a/ext/standard/tests/file/007_variation3.phpt b/ext/standard/tests/file/007_variation3.phpt new file mode 100644 index 0000000..cd31eba --- /dev/null +++ b/ext/standard/tests/file/007_variation3.phpt @@ -0,0 +1,71 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "w" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'w' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +int(37) +int(37) +string(0) "" +int(0) +bool(true) +string(7) "Unknown" +int(37) +int(0) +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/007_variation4.phpt b/ext/standard/tests/file/007_variation4.phpt new file mode 100644 index 0000000..e88324e --- /dev/null +++ b/ext/standard/tests/file/007_variation4.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "w+" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'w+' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +int(37) +int(37) +string(37) "abcdefghij +mnopqrst uvwxyz +0123456789" +int(37) +bool(true) +string(7) "Unknown" +int(37) +int(0) +bool(true) +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/007_variation5.phpt b/ext/standard/tests/file/007_variation5.phpt new file mode 100644 index 0000000..9311534 --- /dev/null +++ b/ext/standard/tests/file/007_variation5.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "a" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'a' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(37) +string(0) "" +int(0) +bool(true) +string(7) "Unknown" +int(57) +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/007_variation6.phpt b/ext/standard/tests/file/007_variation6.phpt new file mode 100644 index 0000000..b274b05 --- /dev/null +++ b/ext/standard/tests/file/007_variation6.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "a+" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'a+' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(37) +string(57) "line +line of text +liabcdefghij +mnopqrst uvwxyz +0123456789" +int(57) +bool(true) +string(7) "Unknown" +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/007_variation7.phpt b/ext/standard/tests/file/007_variation7.phpt new file mode 100644 index 0000000..131daff --- /dev/null +++ b/ext/standard/tests/file/007_variation7.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "x" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'x' mode *** +resource(%d) of type (stream) +%unicode|string%(6) "stream" +int(0) +int(37) +int(37) +string(0) "" +int(0) +bool(true) +%unicode|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_variation8.phpt b/ext/standard/tests/file/007_variation8.phpt new file mode 100644 index 0000000..aa84711 --- /dev/null +++ b/ext/standard/tests/file/007_variation8.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "x+" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'x+' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +int(37) +int(37) +string(37) "abcdefghij +mnopqrst uvwxyz +0123456789" +int(37) +bool(true) +string(7) "Unknown" + +Warning: fopen(%s): failed to open stream: File exists in %s on line %d +*** Done *** diff --git a/ext/standard/tests/file/007_variation9.phpt b/ext/standard/tests/file/007_variation9.phpt new file mode 100644 index 0000000..ab5f1ca --- /dev/null +++ b/ext/standard/tests/file/007_variation9.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "rt" mode +--FILE-- + +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'rt' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +string(20) "line +line of text +li" +int(0) +bool(true) +string(7) "Unknown" +*** Done *** diff --git a/ext/standard/tests/file/basename-win32.phpt b/ext/standard/tests/file/basename-win32.phpt new file mode 100644 index 0000000..5fd0f96 --- /dev/null +++ b/ext/standard/tests/file/basename-win32.phpt @@ -0,0 +1,341 @@ +--TEST-- +basename +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing basic operations *** + +--Iteration 1-- +string(3) "bar" + +--Iteration 2-- +string(3) "bar" + +--Iteration 3-- +string(3) "bar" + +--Iteration 4-- +string(3) "bar" + +--Iteration 5-- +string(3) "bar" + +--Iteration 6-- +string(3) "bar" + +--Iteration 7-- +string(3) "bar" + +--Iteration 8-- +string(3) "bar" + +--Iteration 9-- +string(3) "bar" + +--Iteration 10-- +string(3) "bar" + +--Iteration 11-- +string(7) "bar.zip" + +--Iteration 12-- +string(3) "bar" + +--Iteration 13-- +string(3) "bar" + +--Iteration 14-- +string(3) "bar" + +--Iteration 15-- +string(3) "bar" + +--Iteration 16-- +string(3) "bar" + +--Iteration 17-- +string(3) "bar" + +--Iteration 18-- +string(3) "bar" + +--Iteration 19-- +string(3) "bar" + +--Iteration 20-- +string(4) ".zip" + +--Iteration 21-- +string(4) ".zip" + +--Iteration 22-- +string(4) ".zip" + +--Iteration 23-- +string(4) ".zip" + +--Iteration 24-- +string(4) ".zip" + +--Iteration 25-- +string(4) ".zip" + +*** Testing possible variations in path and suffix *** + +--Iteration 1-- +string(3) "bar" + +--Iteration 2-- +string(3) "bar" + +--Iteration 3-- +string(3) "bar" + +--Iteration 4-- +string(3) "bar" + +--Iteration 5-- +string(3) "bar" + +--Iteration 6-- +string(7) "bar.tar" + +--Iteration 7-- +string(7) "bar.tar" + +--Iteration 8-- +string(7) "bar.tar" + +--Iteration 9-- +string(7) "bar.tar" + +--Iteration 10-- +string(7) "bar.tar" + +--Iteration 11-- +string(7) "bar.tar" + +--Iteration 12-- +string(4) "10.5" + +--Iteration 13-- +string(2) "10" + +--Iteration 14-- +string(4) "10.5" + +--Iteration 15-- +string(2) "10" + +--Iteration 16-- +string(2) "10" + +--Iteration 17-- +string(4) "10.5" + +--Iteration 18-- +string(4) "10.5" + +--Iteration 19-- +string(6) "10.zip" + +--Iteration 20-- +string(1) "0" + +--Iteration 21-- +string(1) "0" + +--Iteration 22-- +string(7) "bar.zip" + +--Iteration 23-- +string(7) "bar.zip" + +--Iteration 24-- +string(7) "bar.zip" + +--Iteration 25-- +string(1) " " + +--Iteration 26-- +string(1) " " + +--Iteration 27-- +string(0) "" + +--Iteration 28-- +string(1) " " + +--Iteration 29-- +string(1) " " + +--Iteration 30-- +string(0) "" + +--Iteration 31-- +string(0) "" + +--Iteration 32-- +string(0) "" + +*** Testing error conditions *** + +Warning: basename() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: basename() expects at most 2 parameters, 3 given in %s on line %d +NULL + +Warning: basename() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: basename() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: basename() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: basename() expects parameter 1 to be string, object given in %s on line %d +NULL + +Warning: basename() expects parameter 1 to be string, object given in %s on line %d +NULL + +Warning: basename() expects parameter 1 to be string, object given in %s on line %d +NULL + +Warning: basename() expects parameter 2 to be string, object given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/file/basename.phpt b/ext/standard/tests/file/basename.phpt new file mode 100644 index 0000000..c0e7498 Binary files /dev/null and b/ext/standard/tests/file/basename.phpt differ diff --git a/ext/standard/tests/file/basename_basic-win32.phpt b/ext/standard/tests/file/basename_basic-win32.phpt new file mode 100644 index 0000000..f575c5a --- /dev/null +++ b/ext/standard/tests/file/basename_basic-win32.phpt @@ -0,0 +1,101 @@ +--TEST-- +basename() basic functionality +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(4) "10.5" +string(4) "10.5" +string(4) "10.5" +string(3) "105" +string(4) "10.5" +string(4) "10.5" +string(4) "10.5" +string(4) "10.5" +string(6) "10.zip" +string(1) "0" +string(1) "0" +string(1) " " +string(1) " " +string(0) "" +string(0) "" +string(0) "" diff --git a/ext/standard/tests/file/basename_basic.phpt b/ext/standard/tests/file/basename_basic.phpt new file mode 100644 index 0000000..68aefb2 --- /dev/null +++ b/ext/standard/tests/file/basename_basic.phpt @@ -0,0 +1,101 @@ +--TEST-- +basename() basic functionality +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(8) "\foo\bar" +string(7) "foo\bar" +string(4) "\bar" +string(4) "bar\" +string(5) "\bar\" +string(9) "\foo\bar\" +string(8) "foo\bar\" +string(5) "\bar\" +string(9) "10.5\10.5" +string(4) "10.5" +string(4) "10.5" +string(3) "105" +string(4) "10.5" +string(5) "\10.5" +string(4) "10.5" +string(5) "10.5\" +string(6) "10.zip" +string(1) "0" +string(1) "0" +string(1) " " +string(1) " " +string(0) "" +string(0) "" +string(0) "" diff --git a/ext/standard/tests/file/basename_error.phpt b/ext/standard/tests/file/basename_error.phpt new file mode 100644 index 0000000..53c53cf --- /dev/null +++ b/ext/standard/tests/file/basename_error.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test basename() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing basename() : error conditions *** + +-- Testing basename() function with Zero arguments -- + +Warning: basename() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing basename() function with more than expected no. of arguments -- + +Warning: basename() expects at most 2 parameters, 3 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/file/basename_variation1-win32.phpt b/ext/standard/tests/file/basename_variation1-win32.phpt new file mode 100644 index 0000000..0f4293e --- /dev/null +++ b/ext/standard/tests/file/basename_variation1-win32.phpt @@ -0,0 +1,238 @@ +--TEST-- +basename() with various inputs +--SKIPIF-- + +--FILE-- + +--EXPECT-- +basename for path A:/foo is: +string(3) "foo" +basename for path A:/foo/ is: +string(3) "foo" +basename for path A:/foo\ is: +string(3) "foo" +basename for path A:/foo.bar is: +string(7) "foo.bar" +basename for path A:/foo.bar/ is: +string(7) "foo.bar" +basename for path A:/foo.bar\ is: +string(7) "foo.bar" +basename for path A:/dir/foo.bar is: +string(7) "foo.bar" +basename for path A:/dir\foo.bar is: +string(7) "foo.bar" +basename for path A:/dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path A:/dir with spaces\foo.bar is: +string(7) "foo.bar" +basename for path Z:/foo is: +string(3) "foo" +basename for path Z:/foo/ is: +string(3) "foo" +basename for path Z:/foo\ is: +string(3) "foo" +basename for path Z:/foo.bar is: +string(7) "foo.bar" +basename for path Z:/foo.bar/ is: +string(7) "foo.bar" +basename for path Z:/foo.bar\ is: +string(7) "foo.bar" +basename for path Z:/dir/foo.bar is: +string(7) "foo.bar" +basename for path Z:/dir\foo.bar is: +string(7) "foo.bar" +basename for path Z:/dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path Z:/dir with spaces\foo.bar is: +string(7) "foo.bar" +basename for path A:\foo is: +string(3) "foo" +basename for path A:\foo/ is: +string(3) "foo" +basename for path A:\foo\ is: +string(3) "foo" +basename for path A:\foo.bar is: +string(7) "foo.bar" +basename for path A:\foo.bar/ is: +string(7) "foo.bar" +basename for path A:\foo.bar\ is: +string(7) "foo.bar" +basename for path A:\dir/foo.bar is: +string(7) "foo.bar" +basename for path A:\dir\foo.bar is: +string(7) "foo.bar" +basename for path A:\dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path A:\dir with spaces\foo.bar is: +string(7) "foo.bar" +basename for path http://foo is: +string(3) "foo" +basename for path http://foo/ is: +string(3) "foo" +basename for path http://foo\ is: +string(3) "foo" +basename for path http://foo.bar is: +string(7) "foo.bar" +basename for path http://foo.bar/ is: +string(7) "foo.bar" +basename for path http://foo.bar\ is: +string(7) "foo.bar" +basename for path http://dir/foo.bar is: +string(7) "foo.bar" +basename for path http://dir\foo.bar is: +string(7) "foo.bar" +basename for path http://dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path http://dir with spaces\foo.bar is: +string(7) "foo.bar" +basename for path blah://foo is: +string(3) "foo" +basename for path blah://foo/ is: +string(3) "foo" +basename for path blah://foo\ is: +string(3) "foo" +basename for path blah://foo.bar is: +string(7) "foo.bar" +basename for path blah://foo.bar/ is: +string(7) "foo.bar" +basename for path blah://foo.bar\ is: +string(7) "foo.bar" +basename for path blah://dir/foo.bar is: +string(7) "foo.bar" +basename for path blah://dir\foo.bar is: +string(7) "foo.bar" +basename for path blah://dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path blah://dir with spaces\foo.bar is: +string(7) "foo.bar" +basename for path blah:\foo is: +string(3) "foo" +basename for path blah:\foo/ is: +string(3) "foo" +basename for path blah:\foo\ is: +string(3) "foo" +basename for path blah:\foo.bar is: +string(7) "foo.bar" +basename for path blah:\foo.bar/ is: +string(7) "foo.bar" +basename for path blah:\foo.bar\ is: +string(7) "foo.bar" +basename for path blah:\dir/foo.bar is: +string(7) "foo.bar" +basename for path blah:\dir\foo.bar is: +string(7) "foo.bar" +basename for path blah:\dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path blah:\dir with spaces\foo.bar is: +string(7) "foo.bar" +basename for path hostname:foo is: +string(12) "hostname:foo" +basename for path hostname:foo/ is: +string(12) "hostname:foo" +basename for path hostname:foo\ is: +string(12) "hostname:foo" +basename for path hostname:foo.bar is: +string(16) "hostname:foo.bar" +basename for path hostname:foo.bar/ is: +string(16) "hostname:foo.bar" +basename for path hostname:foo.bar\ is: +string(16) "hostname:foo.bar" +basename for path hostname:dir/foo.bar is: +string(7) "foo.bar" +basename for path hostname:dir\foo.bar is: +string(7) "foo.bar" +basename for path hostname:dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path hostname:dir with spaces\foo.bar is: +string(7) "foo.bar" +basename for path ~/foo is: +string(3) "foo" +basename for path ~/foo/ is: +string(3) "foo" +basename for path ~/foo\ is: +string(3) "foo" +basename for path ~/foo.bar is: +string(7) "foo.bar" +basename for path ~/foo.bar/ is: +string(7) "foo.bar" +basename for path ~/foo.bar\ is: +string(7) "foo.bar" +basename for path ~/dir/foo.bar is: +string(7) "foo.bar" +basename for path ~/dir\foo.bar is: +string(7) "foo.bar" +basename for path ~/dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path ~/dir with spaces\foo.bar is: +string(7) "foo.bar" +basename for path ~\foo is: +string(3) "foo" +basename for path ~\foo/ is: +string(3) "foo" +basename for path ~\foo\ is: +string(3) "foo" +basename for path ~\foo.bar is: +string(7) "foo.bar" +basename for path ~\foo.bar/ is: +string(7) "foo.bar" +basename for path ~\foo.bar\ is: +string(7) "foo.bar" +basename for path ~\dir/foo.bar is: +string(7) "foo.bar" +basename for path ~\dir\foo.bar is: +string(7) "foo.bar" +basename for path ~\dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path ~\dir with spaces\foo.bar is: +string(7) "foo.bar" + +done diff --git a/ext/standard/tests/file/basename_variation1.phpt b/ext/standard/tests/file/basename_variation1.phpt new file mode 100644 index 0000000..9358238 --- /dev/null +++ b/ext/standard/tests/file/basename_variation1.phpt @@ -0,0 +1,238 @@ +--TEST-- +basename() with various inputs +--SKIPIF-- + +--FILE-- + +--EXPECT-- +basename for path A:/foo is: +string(3) "foo" +basename for path A:/foo/ is: +string(3) "foo" +basename for path A:/foo\ is: +string(4) "foo\" +basename for path A:/foo.bar is: +string(7) "foo.bar" +basename for path A:/foo.bar/ is: +string(7) "foo.bar" +basename for path A:/foo.bar\ is: +string(8) "foo.bar\" +basename for path A:/dir/foo.bar is: +string(7) "foo.bar" +basename for path A:/dir\foo.bar is: +string(11) "dir\foo.bar" +basename for path A:/dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path A:/dir with spaces\foo.bar is: +string(23) "dir with spaces\foo.bar" +basename for path Z:/foo is: +string(3) "foo" +basename for path Z:/foo/ is: +string(3) "foo" +basename for path Z:/foo\ is: +string(4) "foo\" +basename for path Z:/foo.bar is: +string(7) "foo.bar" +basename for path Z:/foo.bar/ is: +string(7) "foo.bar" +basename for path Z:/foo.bar\ is: +string(8) "foo.bar\" +basename for path Z:/dir/foo.bar is: +string(7) "foo.bar" +basename for path Z:/dir\foo.bar is: +string(11) "dir\foo.bar" +basename for path Z:/dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path Z:/dir with spaces\foo.bar is: +string(23) "dir with spaces\foo.bar" +basename for path A:\foo is: +string(6) "A:\foo" +basename for path A:\foo/ is: +string(6) "A:\foo" +basename for path A:\foo\ is: +string(7) "A:\foo\" +basename for path A:\foo.bar is: +string(10) "A:\foo.bar" +basename for path A:\foo.bar/ is: +string(10) "A:\foo.bar" +basename for path A:\foo.bar\ is: +string(11) "A:\foo.bar\" +basename for path A:\dir/foo.bar is: +string(7) "foo.bar" +basename for path A:\dir\foo.bar is: +string(14) "A:\dir\foo.bar" +basename for path A:\dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path A:\dir with spaces\foo.bar is: +string(26) "A:\dir with spaces\foo.bar" +basename for path http://foo is: +string(3) "foo" +basename for path http://foo/ is: +string(3) "foo" +basename for path http://foo\ is: +string(4) "foo\" +basename for path http://foo.bar is: +string(7) "foo.bar" +basename for path http://foo.bar/ is: +string(7) "foo.bar" +basename for path http://foo.bar\ is: +string(8) "foo.bar\" +basename for path http://dir/foo.bar is: +string(7) "foo.bar" +basename for path http://dir\foo.bar is: +string(11) "dir\foo.bar" +basename for path http://dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path http://dir with spaces\foo.bar is: +string(23) "dir with spaces\foo.bar" +basename for path blah://foo is: +string(3) "foo" +basename for path blah://foo/ is: +string(3) "foo" +basename for path blah://foo\ is: +string(4) "foo\" +basename for path blah://foo.bar is: +string(7) "foo.bar" +basename for path blah://foo.bar/ is: +string(7) "foo.bar" +basename for path blah://foo.bar\ is: +string(8) "foo.bar\" +basename for path blah://dir/foo.bar is: +string(7) "foo.bar" +basename for path blah://dir\foo.bar is: +string(11) "dir\foo.bar" +basename for path blah://dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path blah://dir with spaces\foo.bar is: +string(23) "dir with spaces\foo.bar" +basename for path blah:\foo is: +string(9) "blah:\foo" +basename for path blah:\foo/ is: +string(9) "blah:\foo" +basename for path blah:\foo\ is: +string(10) "blah:\foo\" +basename for path blah:\foo.bar is: +string(13) "blah:\foo.bar" +basename for path blah:\foo.bar/ is: +string(13) "blah:\foo.bar" +basename for path blah:\foo.bar\ is: +string(14) "blah:\foo.bar\" +basename for path blah:\dir/foo.bar is: +string(7) "foo.bar" +basename for path blah:\dir\foo.bar is: +string(17) "blah:\dir\foo.bar" +basename for path blah:\dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path blah:\dir with spaces\foo.bar is: +string(29) "blah:\dir with spaces\foo.bar" +basename for path hostname:foo is: +string(12) "hostname:foo" +basename for path hostname:foo/ is: +string(12) "hostname:foo" +basename for path hostname:foo\ is: +string(13) "hostname:foo\" +basename for path hostname:foo.bar is: +string(16) "hostname:foo.bar" +basename for path hostname:foo.bar/ is: +string(16) "hostname:foo.bar" +basename for path hostname:foo.bar\ is: +string(17) "hostname:foo.bar\" +basename for path hostname:dir/foo.bar is: +string(7) "foo.bar" +basename for path hostname:dir\foo.bar is: +string(20) "hostname:dir\foo.bar" +basename for path hostname:dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path hostname:dir with spaces\foo.bar is: +string(32) "hostname:dir with spaces\foo.bar" +basename for path ~/foo is: +string(3) "foo" +basename for path ~/foo/ is: +string(3) "foo" +basename for path ~/foo\ is: +string(4) "foo\" +basename for path ~/foo.bar is: +string(7) "foo.bar" +basename for path ~/foo.bar/ is: +string(7) "foo.bar" +basename for path ~/foo.bar\ is: +string(8) "foo.bar\" +basename for path ~/dir/foo.bar is: +string(7) "foo.bar" +basename for path ~/dir\foo.bar is: +string(11) "dir\foo.bar" +basename for path ~/dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path ~/dir with spaces\foo.bar is: +string(23) "dir with spaces\foo.bar" +basename for path ~\foo is: +string(5) "~\foo" +basename for path ~\foo/ is: +string(5) "~\foo" +basename for path ~\foo\ is: +string(6) "~\foo\" +basename for path ~\foo.bar is: +string(9) "~\foo.bar" +basename for path ~\foo.bar/ is: +string(9) "~\foo.bar" +basename for path ~\foo.bar\ is: +string(10) "~\foo.bar\" +basename for path ~\dir/foo.bar is: +string(7) "foo.bar" +basename for path ~\dir\foo.bar is: +string(13) "~\dir\foo.bar" +basename for path ~\dir with spaces/foo.bar is: +string(7) "foo.bar" +basename for path ~\dir with spaces\foo.bar is: +string(25) "~\dir with spaces\foo.bar" + +done diff --git a/ext/standard/tests/file/basename_variation2-win32.phpt b/ext/standard/tests/file/basename_variation2-win32.phpt new file mode 100644 index 0000000..5e9961b --- /dev/null +++ b/ext/standard/tests/file/basename_variation2-win32.phpt @@ -0,0 +1,253 @@ +--TEST-- +Testing basename() with various values for the suffix parameter +--SKIPIF-- + +--FILE-- + +--EXPECT-- +basename for path foo, supplying suffix .bar is: +string(3) "foo" +basename for path foo, supplying suffix .b is: +string(3) "foo" +basename for path foo, supplying suffix . is: +string(3) "foo" +basename for path foo, supplying suffix is: +string(3) "foo" +basename for path foo, supplying suffix foo is: +string(3) "foo" +basename for path foo, supplying suffix foo.bar is: +string(3) "foo" +basename for path foo, supplying suffix foo/bar is: +string(3) "foo" +basename for path foo, supplying suffix foo\bar is: +string(3) "foo" +basename for path foo, supplying suffix / is: +string(3) "foo" +basename for path foo, supplying suffix \ is: +string(3) "foo" +basename for path foo/, supplying suffix .bar is: +string(3) "foo" +basename for path foo/, supplying suffix .b is: +string(3) "foo" +basename for path foo/, supplying suffix . is: +string(3) "foo" +basename for path foo/, supplying suffix is: +string(3) "foo" +basename for path foo/, supplying suffix foo is: +string(3) "foo" +basename for path foo/, supplying suffix foo.bar is: +string(3) "foo" +basename for path foo/, supplying suffix foo/bar is: +string(3) "foo" +basename for path foo/, supplying suffix foo\bar is: +string(3) "foo" +basename for path foo/, supplying suffix / is: +string(3) "foo" +basename for path foo/, supplying suffix \ is: +string(3) "foo" +basename for path foo\, supplying suffix .bar is: +string(3) "foo" +basename for path foo\, supplying suffix .b is: +string(3) "foo" +basename for path foo\, supplying suffix . is: +string(3) "foo" +basename for path foo\, supplying suffix is: +string(3) "foo" +basename for path foo\, supplying suffix foo is: +string(3) "foo" +basename for path foo\, supplying suffix foo.bar is: +string(3) "foo" +basename for path foo\, supplying suffix foo/bar is: +string(3) "foo" +basename for path foo\, supplying suffix foo\bar is: +string(3) "foo" +basename for path foo\, supplying suffix / is: +string(3) "foo" +basename for path foo\, supplying suffix \ is: +string(3) "foo" +basename for path foo.bar, supplying suffix .bar is: +string(3) "foo" +basename for path foo.bar, supplying suffix .b is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix . is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix foo is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix foo.bar is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix foo/bar is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix foo\bar is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix / is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix \ is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix .bar is: +string(3) "foo" +basename for path foo.bar/, supplying suffix .b is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix . is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix foo is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix foo.bar is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix foo/bar is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix foo\bar is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix / is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix \ is: +string(7) "foo.bar" +basename for path foo.bar\, supplying suffix .bar is: +string(3) "foo" +basename for path foo.bar\, supplying suffix .b is: +string(7) "foo.bar" +basename for path foo.bar\, supplying suffix . is: +string(7) "foo.bar" +basename for path foo.bar\, supplying suffix is: +string(7) "foo.bar" +basename for path foo.bar\, supplying suffix foo is: +string(7) "foo.bar" +basename for path foo.bar\, supplying suffix foo.bar is: +string(7) "foo.bar" +basename for path foo.bar\, supplying suffix foo/bar is: +string(7) "foo.bar" +basename for path foo.bar\, supplying suffix foo\bar is: +string(7) "foo.bar" +basename for path foo.bar\, supplying suffix / is: +string(7) "foo.bar" +basename for path foo.bar\, supplying suffix \ is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix .bar is: +string(3) "foo" +basename for path dir/foo.bar, supplying suffix .b is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix . is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix foo is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix foo.bar is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix foo/bar is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix foo\bar is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix / is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix \ is: +string(7) "foo.bar" +basename for path dir\foo.bar, supplying suffix .bar is: +string(3) "foo" +basename for path dir\foo.bar, supplying suffix .b is: +string(7) "foo.bar" +basename for path dir\foo.bar, supplying suffix . is: +string(7) "foo.bar" +basename for path dir\foo.bar, supplying suffix is: +string(7) "foo.bar" +basename for path dir\foo.bar, supplying suffix foo is: +string(7) "foo.bar" +basename for path dir\foo.bar, supplying suffix foo.bar is: +string(7) "foo.bar" +basename for path dir\foo.bar, supplying suffix foo/bar is: +string(7) "foo.bar" +basename for path dir\foo.bar, supplying suffix foo\bar is: +string(7) "foo.bar" +basename for path dir\foo.bar, supplying suffix / is: +string(7) "foo.bar" +basename for path dir\foo.bar, supplying suffix \ is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix .bar is: +string(3) "foo" +basename for path dir with spaces/foo.bar, supplying suffix .b is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix . is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix foo is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix foo.bar is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix foo/bar is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix foo\bar is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix / is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix \ is: +string(7) "foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix .bar is: +string(3) "foo" +basename for path dir with spaces\foo.bar, supplying suffix .b is: +string(7) "foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix . is: +string(7) "foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix is: +string(7) "foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix foo is: +string(7) "foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix foo.bar is: +string(7) "foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix foo/bar is: +string(7) "foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix foo\bar is: +string(7) "foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix / is: +string(7) "foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix \ is: +string(7) "foo.bar" + +done diff --git a/ext/standard/tests/file/basename_variation2.phpt b/ext/standard/tests/file/basename_variation2.phpt new file mode 100644 index 0000000..96cfd65 --- /dev/null +++ b/ext/standard/tests/file/basename_variation2.phpt @@ -0,0 +1,253 @@ +--TEST-- +Testing basename() with various values for the suffix parameter +--SKIPIF-- + +--FILE-- + +--EXPECT-- +basename for path foo, supplying suffix .bar is: +string(3) "foo" +basename for path foo, supplying suffix .b is: +string(3) "foo" +basename for path foo, supplying suffix . is: +string(3) "foo" +basename for path foo, supplying suffix is: +string(3) "foo" +basename for path foo, supplying suffix foo is: +string(3) "foo" +basename for path foo, supplying suffix foo.bar is: +string(3) "foo" +basename for path foo, supplying suffix foo/bar is: +string(3) "foo" +basename for path foo, supplying suffix foo\bar is: +string(3) "foo" +basename for path foo, supplying suffix / is: +string(3) "foo" +basename for path foo, supplying suffix \ is: +string(3) "foo" +basename for path foo/, supplying suffix .bar is: +string(3) "foo" +basename for path foo/, supplying suffix .b is: +string(3) "foo" +basename for path foo/, supplying suffix . is: +string(3) "foo" +basename for path foo/, supplying suffix is: +string(3) "foo" +basename for path foo/, supplying suffix foo is: +string(3) "foo" +basename for path foo/, supplying suffix foo.bar is: +string(3) "foo" +basename for path foo/, supplying suffix foo/bar is: +string(3) "foo" +basename for path foo/, supplying suffix foo\bar is: +string(3) "foo" +basename for path foo/, supplying suffix / is: +string(3) "foo" +basename for path foo/, supplying suffix \ is: +string(3) "foo" +basename for path foo\, supplying suffix .bar is: +string(4) "foo\" +basename for path foo\, supplying suffix .b is: +string(4) "foo\" +basename for path foo\, supplying suffix . is: +string(4) "foo\" +basename for path foo\, supplying suffix is: +string(4) "foo\" +basename for path foo\, supplying suffix foo is: +string(4) "foo\" +basename for path foo\, supplying suffix foo.bar is: +string(4) "foo\" +basename for path foo\, supplying suffix foo/bar is: +string(4) "foo\" +basename for path foo\, supplying suffix foo\bar is: +string(4) "foo\" +basename for path foo\, supplying suffix / is: +string(4) "foo\" +basename for path foo\, supplying suffix \ is: +string(3) "foo" +basename for path foo.bar, supplying suffix .bar is: +string(3) "foo" +basename for path foo.bar, supplying suffix .b is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix . is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix foo is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix foo.bar is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix foo/bar is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix foo\bar is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix / is: +string(7) "foo.bar" +basename for path foo.bar, supplying suffix \ is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix .bar is: +string(3) "foo" +basename for path foo.bar/, supplying suffix .b is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix . is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix foo is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix foo.bar is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix foo/bar is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix foo\bar is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix / is: +string(7) "foo.bar" +basename for path foo.bar/, supplying suffix \ is: +string(7) "foo.bar" +basename for path foo.bar\, supplying suffix .bar is: +string(8) "foo.bar\" +basename for path foo.bar\, supplying suffix .b is: +string(8) "foo.bar\" +basename for path foo.bar\, supplying suffix . is: +string(8) "foo.bar\" +basename for path foo.bar\, supplying suffix is: +string(8) "foo.bar\" +basename for path foo.bar\, supplying suffix foo is: +string(8) "foo.bar\" +basename for path foo.bar\, supplying suffix foo.bar is: +string(8) "foo.bar\" +basename for path foo.bar\, supplying suffix foo/bar is: +string(8) "foo.bar\" +basename for path foo.bar\, supplying suffix foo\bar is: +string(8) "foo.bar\" +basename for path foo.bar\, supplying suffix / is: +string(8) "foo.bar\" +basename for path foo.bar\, supplying suffix \ is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix .bar is: +string(3) "foo" +basename for path dir/foo.bar, supplying suffix .b is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix . is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix foo is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix foo.bar is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix foo/bar is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix foo\bar is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix / is: +string(7) "foo.bar" +basename for path dir/foo.bar, supplying suffix \ is: +string(7) "foo.bar" +basename for path dir\foo.bar, supplying suffix .bar is: +string(7) "dir\foo" +basename for path dir\foo.bar, supplying suffix .b is: +string(11) "dir\foo.bar" +basename for path dir\foo.bar, supplying suffix . is: +string(11) "dir\foo.bar" +basename for path dir\foo.bar, supplying suffix is: +string(11) "dir\foo.bar" +basename for path dir\foo.bar, supplying suffix foo is: +string(11) "dir\foo.bar" +basename for path dir\foo.bar, supplying suffix foo.bar is: +string(4) "dir\" +basename for path dir\foo.bar, supplying suffix foo/bar is: +string(11) "dir\foo.bar" +basename for path dir\foo.bar, supplying suffix foo\bar is: +string(11) "dir\foo.bar" +basename for path dir\foo.bar, supplying suffix / is: +string(11) "dir\foo.bar" +basename for path dir\foo.bar, supplying suffix \ is: +string(11) "dir\foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix .bar is: +string(3) "foo" +basename for path dir with spaces/foo.bar, supplying suffix .b is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix . is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix foo is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix foo.bar is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix foo/bar is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix foo\bar is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix / is: +string(7) "foo.bar" +basename for path dir with spaces/foo.bar, supplying suffix \ is: +string(7) "foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix .bar is: +string(19) "dir with spaces\foo" +basename for path dir with spaces\foo.bar, supplying suffix .b is: +string(23) "dir with spaces\foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix . is: +string(23) "dir with spaces\foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix is: +string(23) "dir with spaces\foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix foo is: +string(23) "dir with spaces\foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix foo.bar is: +string(16) "dir with spaces\" +basename for path dir with spaces\foo.bar, supplying suffix foo/bar is: +string(23) "dir with spaces\foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix foo\bar is: +string(23) "dir with spaces\foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix / is: +string(23) "dir with spaces\foo.bar" +basename for path dir with spaces\foo.bar, supplying suffix \ is: +string(23) "dir with spaces\foo.bar" + +done diff --git a/ext/standard/tests/file/basename_variation3.phpt b/ext/standard/tests/file/basename_variation3.phpt new file mode 100644 index 0000000..f01f550 --- /dev/null +++ b/ext/standard/tests/file/basename_variation3.phpt @@ -0,0 +1,185 @@ +--TEST-- +Test basename() function : first parameter type variations +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for path + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( basename($value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing basename() : usage variation *** + +--int 0-- +string(1) "0" + +--int 1-- +string(1) "1" + +--int 12345-- +string(5) "12345" + +--int -12345-- +string(5) "-2345" + +--float 10.5-- +string(4) "10.5" + +--float -10.5-- +string(5) "-10.5" + +--float 12.3456789000e10-- +string(12) "123456789000" + +--float -12.3456789000e10-- +string(13) "-123456789000" + +--float .5-- +string(3) "0.5" + +--empty array-- +Error: 2 - basename() expects parameter 1 to be string, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - basename() expects parameter 1 to be string, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - basename() expects parameter 1 to be string, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - basename() expects parameter 1 to be string, array given, %s(%d) +NULL + +--uppercase NULL-- +string(0) "" + +--lowercase null-- +string(0) "" + +--lowercase true-- +string(1) "1" + +--lowercase false-- +string(0) "" + +--uppercase TRUE-- +string(1) "1" + +--uppercase FALSE-- +string(0) "" + +--empty string DQ-- +string(0) "" + +--empty string SQ-- +string(0) "" + +--instance of classWithToString-- +string(14) "Class A object" + +--instance of classWithoutToString-- +Error: 2 - basename() expects parameter 1 to be string, object given, %s(%d) +NULL + +--undefined var-- +string(0) "" + +--unset var-- +string(0) "" +===DONE=== diff --git a/ext/standard/tests/file/basename_variation4.phpt b/ext/standard/tests/file/basename_variation4.phpt new file mode 100644 index 0000000..88ce61a --- /dev/null +++ b/ext/standard/tests/file/basename_variation4.phpt @@ -0,0 +1,188 @@ +--TEST-- +Test basename() function : second parameter type variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for suffix + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( basename($path, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing basename() : usage variation *** + +--int 0-- +string(4) "path" + +--int 1-- +string(4) "path" + +--int 12345-- +string(4) "path" + +--int -12345-- +string(4) "path" + +--float 10.5-- +string(4) "path" + +--float -10.5-- +string(4) "path" + +--float 12.3456789000e10-- +string(4) "path" + +--float -12.3456789000e10-- +string(4) "path" + +--float .5-- +string(4) "path" + +--empty array-- +Error: 2 - basename() expects parameter 2 to be string, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - basename() expects parameter 2 to be string, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - basename() expects parameter 2 to be string, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - basename() expects parameter 2 to be string, array given, %s(%d) +NULL + +--uppercase NULL-- +string(4) "path" + +--lowercase null-- +string(4) "path" + +--lowercase true-- +string(4) "path" + +--lowercase false-- +string(4) "path" + +--uppercase TRUE-- +string(4) "path" + +--uppercase FALSE-- +string(4) "path" + +--empty string DQ-- +string(4) "path" + +--empty string SQ-- +string(4) "path" + +--instance of classWithToString-- +string(4) "path" + +--instance of classWithoutToString-- +Error: 2 - basename() expects parameter 2 to be string, object given, %s(%d) +NULL + +--undefined var-- +string(4) "path" + +--unset var-- +string(4) "path" +===DONE=== diff --git a/ext/standard/tests/file/bug12556.phpt b/ext/standard/tests/file/bug12556.phpt new file mode 100644 index 0000000..c8e35cf --- /dev/null +++ b/ext/standard/tests/file/bug12556.phpt @@ -0,0 +1,48 @@ +--TEST-- +Bug #12556 (fgetcsv() ignores lengths when quotes not closed) +--FILE-- + +--EXPECT-- +array(4) { + [0]=> + string(1) "6" + [1]=> + string(1) "7" + [2]=> + string(1) "8" + [3]=> + string(5) "line1" +} +array(4) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" + [2]=> + string(1) "3" + [3]=> + string(186) "line2 +2,4,5,line3 +2,4,5,line3 +2,4,5,line3 +2,4,5,line3 +2,4,5,line3 +2,4,5,line3 +2,4,5,line3 +2,4,5,line3 +2,4,5,line3 +2,4,5,line3 +2,4,5,line3 +2,4,5,line3 +2,4,5,line3 +2,4,5,line3 +2,4,5,line3 +" +} diff --git a/ext/standard/tests/file/bug20424.phpt b/ext/standard/tests/file/bug20424.phpt new file mode 100644 index 0000000..b8f9dfd --- /dev/null +++ b/ext/standard/tests/file/bug20424.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #20424 (stream_get_meta_data crashes on a normal file stream) +--FILE-- + +--EXPECT-- +I'm alive! diff --git a/ext/standard/tests/file/bug22382.phpt b/ext/standard/tests/file/bug22382.phpt new file mode 100644 index 0000000..2ba36ee --- /dev/null +++ b/ext/standard/tests/file/bug22382.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #22382 (fgetcsv() does not handle escaped quotes correctly) +--FILE-- + +--EXPECT-- +array(6) { + [0]=> + string(3) "One" + [1]=> + string(7) "\"Two\"" + [2]=> + string(7) "Three\"" + [3]=> + string(4) "Four" + [4]=> + string(2) "\\" + [5]=> + string(28) "\\\\\\\\\\\\\\\\\\\\\\\"\\\\" +} diff --git a/ext/standard/tests/file/bug22414.phpt b/ext/standard/tests/file/bug22414.phpt new file mode 100644 index 0000000..9538c8e --- /dev/null +++ b/ext/standard/tests/file/bug22414.phpt @@ -0,0 +1,38 @@ +--TEST-- +Bug #22414 (passthru() does not read data correctly) +--INI-- +output_handler= +--FILE-- + '.$tmpfile ; + } else { + $cmd = $php . $args . ' -r \"readfile(@getenv(\\\\\\"TEST_PHP_EXECUTABLE\\\\\\")); \"'; + $cmd = $php . $args . ' -r " passthru(\''.$cmd.'\');" > '.$tmpfile ; + } + exec($cmd); + + if (md5_file($php) == md5_file($tmpfile)) { + echo "Works\n"; + } else { + echo "Does not work\n"; + } + + @unlink($tmpfile); +?> +--EXPECT-- +HELLO +Works diff --git a/ext/standard/tests/file/bug24313.phpt b/ext/standard/tests/file/bug24313.phpt new file mode 100644 index 0000000..e5bceee --- /dev/null +++ b/ext/standard/tests/file/bug24313.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #24313 (file_exists() throws a warning on nonexistent files when is open_basedir enabled) +--SKIPIF-- + +--INI-- +open_basedir=/dev +--FILE-- + +--EXPECT-- +bool(false) diff --git a/ext/standard/tests/file/bug24482.phpt b/ext/standard/tests/file/bug24482.phpt new file mode 100644 index 0000000..f545f1a --- /dev/null +++ b/ext/standard/tests/file/bug24482.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #24482 (GLOB_ONLYDIR not working) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +OK diff --git a/ext/standard/tests/file/bug26003.phpt b/ext/standard/tests/file/bug26003.phpt new file mode 100644 index 0000000..7d08374 Binary files /dev/null and b/ext/standard/tests/file/bug26003.phpt differ diff --git a/ext/standard/tests/file/bug26615.phpt b/ext/standard/tests/file/bug26615.phpt new file mode 100644 index 0000000..3689fdf --- /dev/null +++ b/ext/standard/tests/file/bug26615.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #26615 (exec crash on long input lines) +--INI-- +variables_order=E +--FILE-- + +--EXPECT-- +Array +( + [0] => 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 +) diff --git a/ext/standard/tests/file/bug26938.phpt b/ext/standard/tests/file/bug26938.phpt new file mode 100644 index 0000000..a68d572 --- /dev/null +++ b/ext/standard/tests/file/bug26938.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #26938 (exec does not read consecutive long lines correctly) +--FILE-- + +--EXPECT-- +md5(line 0)= e86410fa2d6e2634fd8ac5f4b3afe7f3 (length 10) +md5(line 1)= e84debf3a1d132871d7fe45c1c04c566 (length 20000) +md5(line 2)= c33b4d2f86908eea5d75ee5a61fd81f4 (length 10000) +md5(line 3)= 2ecdde3959051d913f61b14579ea136d (length 5) +md5(line 4)= c33b4d2f86908eea5d75ee5a61fd81f4 (length 10000) +md5(line 5)= 902fbdd2b1df0c4f70b4a5d23525e932 (length 3) diff --git a/ext/standard/tests/file/bug27508.phpt b/ext/standard/tests/file/bug27508.phpt new file mode 100644 index 0000000..7f012bd --- /dev/null +++ b/ext/standard/tests/file/bug27508.phpt @@ -0,0 +1,80 @@ +--TEST-- +Bug #27508 (userspace wrappers have bogus eof indicator) +--FILE-- +fp = fopen($url, $mode); + + return true; + } + + function stream_read($count) + { + return fread($this->fp, $count); + } + + function stream_write($data) + { + return fwrite($this->fp, $data); + } + + function stream_tell() + { + return ftell($this->fp); + } + + function stream_eof() + { + if (!$this->fp) { + return true; + } + return feof($this->fp); + } + + function stream_seek($offset, $whence) + { + return fseek($this->fp, $offset, $whence) == 0 ? true : false; + } +} + +stream_wrapper_register("myFile", "FileStream") + or die("Failed to register protocol"); + +$tmp_dir = __DIR__; +$tn = (binary) tempnam($tmp_dir, 'foo'); +if (!$tn) { + die("tempnam failed"); +} + +$fp = fopen("myFile://" . urlencode($tn), "w+"); +if (!$fp) { + die("fopen failed"); +} + +fwrite($fp, b"line1\n"); +fwrite($fp, b"line2\n"); +fwrite($fp, b"line3\n"); + +debug_zval_dump(feof($fp)); +rewind($fp); +echo ftell($fp) . "\n"; +debug_zval_dump(feof($fp)); +while ($fp && !feof($fp)) { + echo fgets($fp); +} +fclose($fp); + +unlink($tn); +?> +--EXPECT-- +bool(false) refcount(1) +0 +bool(false) refcount(1) +line1 +line2 +line3 diff --git a/ext/standard/tests/file/bug27619.phpt b/ext/standard/tests/file/bug27619.phpt new file mode 100644 index 0000000..095a18c --- /dev/null +++ b/ext/standard/tests/file/bug27619.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #27619 (filters not applied to pre-buffered data) +--FILE-- + +--EXPECT-- +this IS A LOWERCASE STRING. diff --git a/ext/standard/tests/file/bug30362.phpt b/ext/standard/tests/file/bug30362.phpt new file mode 100644 index 0000000..1c2b4be --- /dev/null +++ b/ext/standard/tests/file/bug30362.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #30362 (stream_get_line() not working as documented) +--FILE-- + +--EXPECT-- +111 +111111111 +111111111 +111111111 +111111111 +111111111 +111111111 +111111111 +111111111 +111111111 diff --git a/ext/standard/tests/file/bug30362.txt b/ext/standard/tests/file/bug30362.txt new file mode 100644 index 0000000..3a1b7f4 --- /dev/null +++ b/ext/standard/tests/file/bug30362.txt @@ -0,0 +1 @@ +111Y111111111Y111111111Y111111111Y111111111Y111111111Y111111111Y111111111Y111111111Y111111111 diff --git a/ext/standard/tests/file/bug32160.phpt b/ext/standard/tests/file/bug32160.phpt new file mode 100644 index 0000000..e496803 --- /dev/null +++ b/ext/standard/tests/file/bug32160.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #32160 (copying a file into itself leads to data loss) +--FILE-- + +--EXPECT-- +bool(false) +bool(false) +bool(false) diff --git a/ext/standard/tests/file/bug32160.txt b/ext/standard/tests/file/bug32160.txt new file mode 100644 index 0000000..1e4a6b5 --- /dev/null +++ b/ext/standard/tests/file/bug32160.txt @@ -0,0 +1 @@ +copy test diff --git a/ext/standard/tests/file/bug35740.phpt b/ext/standard/tests/file/bug35740.phpt new file mode 100644 index 0000000..3526b24 --- /dev/null +++ b/ext/standard/tests/file/bug35740.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #35740 (memory leak when including a directory) +--FILE-- + +--EXPECTF-- +Warning: include(%s): failed to open stream: %s in %s on line %d + +Warning: include(): Failed opening '%s' for inclusion (include_path='%s') in %s on line %d +Done diff --git a/ext/standard/tests/file/bug35781.phpt b/ext/standard/tests/file/bug35781.phpt new file mode 100644 index 0000000..5dc684a --- /dev/null +++ b/ext/standard/tests/file/bug35781.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #35781 (stream_filter_append() causes segfault) +--FILE-- + +--EXPECTF-- +string(15) "Guvf vf n grfg +" +Done diff --git a/ext/standard/tests/file/bug37158.phpt b/ext/standard/tests/file/bug37158.phpt new file mode 100644 index 0000000..48df46c --- /dev/null +++ b/ext/standard/tests/file/bug37158.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #37158 (if userspace stream is present, fread() reads in 8192 max, otherwise it works) +--FILE-- + +--EXPECT-- +string(26) "size of contents 1 = 20000" +string(26) "size of contents 2 = 40960" +Done diff --git a/ext/standard/tests/file/bug37864.phpt b/ext/standard/tests/file/bug37864.phpt new file mode 100644 index 0000000..f8743bd --- /dev/null +++ b/ext/standard/tests/file/bug37864.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #37864 (file_get_contents() leaks on empty file) +--FILE-- + +--EXPECT-- +string(0) "" +done. diff --git a/ext/standard/tests/file/bug38086.phpt b/ext/standard/tests/file/bug38086.phpt new file mode 100644 index 0000000..d92289e --- /dev/null +++ b/ext/standard/tests/file/bug38086.phpt @@ -0,0 +1,55 @@ +--TEST-- +Bug #38086 (stream_copy_to_stream() returns 0 when maxlen is bigger than the actual length) +--FILE-- + +--EXPECTF-- +int(%d) +string(134) "Nabgure qnl +Jura gur cnvaf bs yvsr jba'g one zl jnl +V'yy oernx gurfr punvaf +Gung ubyq zr qbja +V'yy grne lbh qbja vagb zl cevingr uryy +" +int(%d) +string(134) "Nabgure qnl +Jura gur cnvaf bs yvsr jba'g one zl jnl +V'yy oernx gurfr punvaf +Gung ubyq zr qbja +V'yy grne lbh qbja vagb zl cevingr uryy +" +Done diff --git a/ext/standard/tests/file/bug38086.txt b/ext/standard/tests/file/bug38086.txt new file mode 100644 index 0000000..8e32472 --- /dev/null +++ b/ext/standard/tests/file/bug38086.txt @@ -0,0 +1,5 @@ +Another day +When the pains of life won't bar my way +I'll break these chains +That hold me down +I'll tear you down into my private hell diff --git a/ext/standard/tests/file/bug38450.phpt b/ext/standard/tests/file/bug38450.phpt new file mode 100644 index 0000000..d108897 --- /dev/null +++ b/ext/standard/tests/file/bug38450.phpt @@ -0,0 +1,114 @@ +--TEST-- +Bug #38450 (constructor is not called for classes used in userspace stream wrappers) +--FILE-- +varname = $url["host"]; + $this->position = 0; + + return true; + } + + function stream_read($count) + { + $ret = substr($GLOBALS[$this->varname], $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + + function stream_write($data) + { + $left = substr($GLOBALS[$this->varname], 0, $this->position); + $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); + $GLOBALS[$this->varname] = $left . $data . $right; + $this->position += strlen($data); + return strlen($data); + } + + function stream_tell() + { + return $this->position; + } + + function stream_eof() + { + return $this->position >= strlen($GLOBALS[$this->varname]); + } + function stream_seek($offset, $whence) + { + switch ($whence) { + case SEEK_SET: + if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { + $this->position = $offset; + return true; + } else { + return false; + } + break; + + case SEEK_CUR: + if ($offset >= 0) { + $this->position += $offset; + return true; + } else { + return false; + } + break; + + case SEEK_END: + if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { + $this->position = strlen($GLOBALS[$this->varname]) + $offset; + return true; + } else { + return false; + } + break; + + default: + return false; + } + } +} + +stream_wrapper_register("var", "VariableStream") + or die("Failed to register protocol"); + +$myvar = ""; + +$fp = fopen("var://myvar", "r+"); + +fwrite($fp, b"line1\n"); +fwrite($fp, b"line2\n"); +fwrite($fp, b"line3\n"); + +rewind($fp); +while (!feof($fp)) { + echo fgets($fp); +} +fclose($fp); +var_dump($myvar); + +echo "Done\n"; +?> +--EXPECTF-- +Warning: Missing argument 1 for VariableStream::VariableStream() in %s on line %d +string(12) "constructor!" +line1 +line2 +line3 +string(18) "line1 +line2 +line3 +" +Done diff --git a/ext/standard/tests/file/bug38450_1.phpt b/ext/standard/tests/file/bug38450_1.phpt new file mode 100644 index 0000000..07e413b --- /dev/null +++ b/ext/standard/tests/file/bug38450_1.phpt @@ -0,0 +1,114 @@ +--TEST-- +Bug #38450 (constructor is not called for classes used in userspace stream wrappers) +--FILE-- +varname = $url["host"]; + $this->position = 0; + + return true; + } + + function stream_read($count) + { + $ret = substr($GLOBALS[$this->varname], $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + + function stream_write($data) + { + $left = substr($GLOBALS[$this->varname], 0, $this->position); + $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); + $GLOBALS[$this->varname] = $left . $data . $right; + $this->position += strlen($data); + return strlen($data); + } + + function stream_tell() + { + return $this->position; + } + + function stream_eof() + { + return $this->position >= strlen($GLOBALS[$this->varname]); + } + function stream_seek($offset, $whence) + { + switch ($whence) { + case SEEK_SET: + if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { + $this->position = $offset; + return true; + } else { + return false; + } + break; + + case SEEK_CUR: + if ($offset >= 0) { + $this->position += $offset; + return true; + } else { + return false; + } + break; + + case SEEK_END: + if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { + $this->position = strlen($GLOBALS[$this->varname]) + $offset; + return true; + } else { + return false; + } + break; + + default: + return false; + } + } +} + +stream_wrapper_register("var", "VariableStream") + or die("Failed to register protocol"); + +$myvar = ""; + +$fp = fopen("var://myvar", "r+"); + +fwrite($fp, b"line1\n"); +fwrite($fp, b"line2\n"); +fwrite($fp, b"line3\n"); + +rewind($fp); +while (!feof($fp)) { + echo fgets($fp); +} +fclose($fp); +var_dump($myvar); + +echo "Done\n"; +?> +--EXPECTF-- +Warning: Missing argument 1 for VariableStream::__construct() in %s on line %d +string(12) "constructor!" +line1 +line2 +line3 +string(18) "line1 +line2 +line3 +" +Done diff --git a/ext/standard/tests/file/bug38450_2.phpt b/ext/standard/tests/file/bug38450_2.phpt new file mode 100644 index 0000000..625fd7c --- /dev/null +++ b/ext/standard/tests/file/bug38450_2.phpt @@ -0,0 +1,114 @@ +--TEST-- +Bug #38450 (constructor is not called for classes used in userspace stream wrappers) +--FILE-- +varname = $url["host"]; + $this->position = 0; + + return true; + } + + function stream_read($count) + { + $ret = substr($GLOBALS[$this->varname], $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + + function stream_write($data) + { + $left = substr($GLOBALS[$this->varname], 0, $this->position); + $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); + $GLOBALS[$this->varname] = $left . $data . $right; + $this->position += strlen($data); + return strlen($data); + } + + function stream_tell() + { + return $this->position; + } + + function stream_eof() + { + return $this->position >= strlen($GLOBALS[$this->varname]); + } + function stream_seek($offset, $whence) + { + switch ($whence) { + case SEEK_SET: + if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { + $this->position = $offset; + return true; + } else { + return false; + } + break; + + case SEEK_CUR: + if ($offset >= 0) { + $this->position += $offset; + return true; + } else { + return false; + } + break; + + case SEEK_END: + if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { + $this->position = strlen($GLOBALS[$this->varname]) + $offset; + return true; + } else { + return false; + } + break; + + default: + return false; + } + } +} + +stream_wrapper_register("var", "VariableStream") + or die("Failed to register protocol"); + +$myvar = ""; + +$fp = fopen("var://myvar", "r+"); + +fwrite($fp, "line1\n"); +fwrite($fp, "line2\n"); +fwrite($fp, "line3\n"); + +rewind($fp); +while (!feof($fp)) { + echo fgets($fp); +} +fclose($fp); +var_dump($myvar); + +echo "Done\n"; +?> +--EXPECTF-- +Warning: Missing argument 1 for VariableStream::__construct() in %s on line %d + +Warning: fopen(var://myvar): failed to open stream: "VariableStream::stream_open" call failed in %s on line %d + +Fatal error: Uncaught exception 'Exception' with message 'constructor' in %s:%d +Stack trace: +#0 [internal function]: VariableStream->__construct() +#1 %s(%d): fopen('var://myvar', 'r+') +#2 {main} + thrown in %s on line %d diff --git a/ext/standard/tests/file/bug38450_3.phpt b/ext/standard/tests/file/bug38450_3.phpt new file mode 100644 index 0000000..389de87 --- /dev/null +++ b/ext/standard/tests/file/bug38450_3.phpt @@ -0,0 +1,105 @@ +--TEST-- +Bug #38450 (constructor is not called for classes used in userspace stream wrappers) +--FILE-- +varname = $url["host"]; + $this->position = 0; + + return true; + } + + function stream_read($count) + { + $ret = substr($GLOBALS[$this->varname], $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + + function stream_write($data) + { + $left = substr($GLOBALS[$this->varname], 0, $this->position); + $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); + $GLOBALS[$this->varname] = $left . $data . $right; + $this->position += strlen($data); + return strlen($data); + } + + function stream_tell() + { + return $this->position; + } + + function stream_eof() + { + return $this->position >= strlen($GLOBALS[$this->varname]); + } + function stream_seek($offset, $whence) + { + switch ($whence) { + case SEEK_SET: + if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { + $this->position = $offset; + return true; + } else { + return false; + } + break; + + case SEEK_CUR: + if ($offset >= 0) { + $this->position += $offset; + return true; + } else { + return false; + } + break; + + case SEEK_END: + if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { + $this->position = strlen($GLOBALS[$this->varname]) + $offset; + return true; + } else { + return false; + } + break; + + default: + return false; + } + } +} + +stream_wrapper_register("var", "VariableStream") + or die("Failed to register protocol"); + +$myvar = ""; + +$fp = fopen("var://myvar", "r+"); + +fwrite($fp, "line1\n"); +fwrite($fp, "line2\n"); +fwrite($fp, "line3\n"); + +rewind($fp); +while (!feof($fp)) { + echo fgets($fp); +} +fclose($fp); +var_dump($myvar); + +echo "Done\n"; +?> +--EXPECTF-- +Catchable fatal error: Argument 1 passed to VariableStream::__construct() must be of the type array, none given in %s on line %d diff --git a/ext/standard/tests/file/bug39367.phpt b/ext/standard/tests/file/bug39367.phpt new file mode 100644 index 0000000..f3e79fc --- /dev/null +++ b/ext/standard/tests/file/bug39367.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #39367 (clearstatcache() doesn't clear realpath cache) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +ok diff --git a/ext/standard/tests/file/bug39538.phpt b/ext/standard/tests/file/bug39538.phpt new file mode 100644 index 0000000..71b5dea --- /dev/null +++ b/ext/standard/tests/file/bug39538.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #39538 (fgetcsv can't handle starting newlines and trailing odd number of backslashes) +--FILE-- + +--EXPECT-- +Array +( + [0] => +this is an test + [1] => next data + [2] => p +arsed +) +Array +( + [0] => +this is an test + [1] => next data + [2] => p +arsed +) +Array +( + [0] => + this is an test + [1] => next data + [2] => p + arsed +) diff --git a/ext/standard/tests/file/bug39551.phpt b/ext/standard/tests/file/bug39551.phpt new file mode 100644 index 0000000..c047a30 --- /dev/null +++ b/ext/standard/tests/file/bug39551.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #39551 (Segfault with stream_bucket_new in user filter) +--FILE-- + +--EXPECTF-- +Done diff --git a/ext/standard/tests/file/bug39673.phpt b/ext/standard/tests/file/bug39673.phpt new file mode 100644 index 0000000..3836f21 --- /dev/null +++ b/ext/standard/tests/file/bug39673.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #39673 (file_get_contents causes bus error on certain offsets) +--FILE-- + +--EXPECTF-- +int(13824) +int(13824) +int(0) +int(1) +int(0) +int(11824) +int(8824) +int(0) +Done diff --git a/ext/standard/tests/file/bug39863.phpt b/ext/standard/tests/file/bug39863.phpt new file mode 100644 index 0000000..5e26b5a --- /dev/null +++ b/ext/standard/tests/file/bug39863.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #39863 (file_exists() silently truncates after a null byte) +--CREDITS-- +Andrew van der Stock, vanderaj @ owasp.org +--FILE-- + +===DONE=== + +--EXPECTF-- +Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d +PASS +===DONE=== + diff --git a/ext/standard/tests/file/bug40374.phpt b/ext/standard/tests/file/bug40374.phpt new file mode 100644 index 0000000..327289e --- /dev/null +++ b/ext/standard/tests/file/bug40374.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #40374 (php_shutdown_temporary_directory() tries to free local value) +--FILE-- + +--EXPECTF-- +string(%d) "%s" +Done diff --git a/ext/standard/tests/file/bug40501.csv b/ext/standard/tests/file/bug40501.csv new file mode 100644 index 0000000..c786ed9 --- /dev/null +++ b/ext/standard/tests/file/bug40501.csv @@ -0,0 +1,2 @@ +"this element contains the delimiter, and ends with an odd number of +backslashes (ex: 1)\",and it isn't the last element$ \ No newline at end of file diff --git a/ext/standard/tests/file/bug40501.phpt b/ext/standard/tests/file/bug40501.phpt new file mode 100644 index 0000000..806aba6 --- /dev/null +++ b/ext/standard/tests/file/bug40501.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #40501 (fgetcsv() can't handle trailing odd number of backslashes) +--FILE-- + +--EXPECTF-- +array(2) { + [0]=> + string(%d) "this element contains the delimiter, and ends with an odd number of +backslashes (ex: 1)\" + [1]=> + string(%d) "and it isn't the last element$" +} diff --git a/ext/standard/tests/file/bug41655_1.phpt b/ext/standard/tests/file/bug41655_1.phpt new file mode 100644 index 0000000..62d64df --- /dev/null +++ b/ext/standard/tests/file/bug41655_1.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #41655 (open_basedir bypass via glob()) 1/2 +--CREDITS-- +Dave Kelsey +--INI-- +open_basedir=/tmp +--FILE-- + +--EXPECT-- +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/bug41655_2.phpt b/ext/standard/tests/file/bug41655_2.phpt new file mode 100644 index 0000000..d406f1b --- /dev/null +++ b/ext/standard/tests/file/bug41655_2.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #41655 (open_basedir bypass via glob()) 2/2 +--INI-- +open_basedir=/ +--FILE-- + +--EXPECTF-- +Array +( + [0] => %stest.csv +) diff --git a/ext/standard/tests/file/bug41693.phpt b/ext/standard/tests/file/bug41693.phpt new file mode 100644 index 0000000..6c7ff5b --- /dev/null +++ b/ext/standard/tests/file/bug41693.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #41693 (scandir() allows empty directory names) +--FILE-- + +--EXPECTF-- +Warning: scandir(): Directory name cannot be empty in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/file/bug41815.phpt b/ext/standard/tests/file/bug41815.phpt new file mode 100644 index 0000000..f77468d --- /dev/null +++ b/ext/standard/tests/file/bug41815.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #41815 (Concurrent read/write fails when EOF is reached) +--FILE-- + 0) { + echo "OK\n"; +} + +fclose($writer); +fclose($reader); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +OK +Done diff --git a/ext/standard/tests/file/bug41874.phpt b/ext/standard/tests/file/bug41874.phpt new file mode 100644 index 0000000..827f486 --- /dev/null +++ b/ext/standard/tests/file/bug41874.phpt @@ -0,0 +1,15 @@ +--TEST-- +bug #41874 (Separate STDOUT and STDERR in exec functions) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +The system cannot find the drive specified. +The system cannot find the drive specified. diff --git a/ext/standard/tests/file/bug41874_1.phpt b/ext/standard/tests/file/bug41874_1.phpt new file mode 100644 index 0000000..c6ddef8 --- /dev/null +++ b/ext/standard/tests/file/bug41874_1.phpt @@ -0,0 +1,16 @@ +--TEST-- +bug #41874 (Separate STDOUT and STDERR in exec functions) +--CREDITS-- +Venkat Raman Don +--SKIPIF-- + +--FILE-- + +--EXPECT-- +The system cannot find the drive specified. \ No newline at end of file diff --git a/ext/standard/tests/file/bug41874_2.phpt b/ext/standard/tests/file/bug41874_2.phpt new file mode 100644 index 0000000..5d7b7ca --- /dev/null +++ b/ext/standard/tests/file/bug41874_2.phpt @@ -0,0 +1,17 @@ +--TEST-- +bug #41874 (Separate STDOUT and STDERR in exec functions) +--CREDITS-- +Venkat Raman Don +--SKIPIF-- + +--FILE-- + +--EXPECT-- +The system cannot find the drive specified. \ No newline at end of file diff --git a/ext/standard/tests/file/bug41874_3.phpt b/ext/standard/tests/file/bug41874_3.phpt new file mode 100644 index 0000000..4d7b139 --- /dev/null +++ b/ext/standard/tests/file/bug41874_3.phpt @@ -0,0 +1,16 @@ +--TEST-- +bug #41874 (Separate STDOUT and STDERR in exec functions) +--CREDITS-- +Venkat Raman Don +--SKIPIF-- + +--FILE-- + +--EXPECT-- +The system cannot find the drive specified. \ No newline at end of file diff --git a/ext/standard/tests/file/bug43008.phpt b/ext/standard/tests/file/bug43008.phpt new file mode 100644 index 0000000..d2e3efd --- /dev/null +++ b/ext/standard/tests/file/bug43008.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #43008 (php://filter uris ignore url encoded filternames and can't handle slashes) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(8) "foob%E2r" diff --git a/ext/standard/tests/file/bug43137.phpt b/ext/standard/tests/file/bug43137.phpt new file mode 100644 index 0000000..8125445 --- /dev/null +++ b/ext/standard/tests/file/bug43137.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #43137 (rmdir() and rename() do not clear statcache) +--FILE-- + +--EXPECT-- +bool(true) +bool(false) +bool(true) +bool(false) diff --git a/ext/standard/tests/file/bug43216.phpt b/ext/standard/tests/file/bug43216.phpt new file mode 100644 index 0000000..b7e4253 --- /dev/null +++ b/ext/standard/tests/file/bug43216.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #43216 (stream_is_local() returns false on file://) +--FILE-- + +--EXPECT-- +bool(true) diff --git a/ext/standard/tests/file/bug43248.phpt b/ext/standard/tests/file/bug43248.phpt new file mode 100644 index 0000000..1096435 --- /dev/null +++ b/ext/standard/tests/file/bug43248.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #43248 (backward compatibility break in realpath()) +--FILE-- + +--EXPECTF-- +%sfile diff --git a/ext/standard/tests/file/bug43353-win32.phpt b/ext/standard/tests/file/bug43353-win32.phpt new file mode 100644 index 0000000..0667f69 --- /dev/null +++ b/ext/standard/tests/file/bug43353-win32.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #43353 wrong detection of 'data' wrapper +--SKIPIF-- + +--INI-- +allow_url_fopen=1 +--FILE-- + +--EXPECTF-- +bool(false) +bool(false) +string(3) "foo" + +Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: Invalid argument in %s +bool(false) diff --git a/ext/standard/tests/file/bug43353.phpt b/ext/standard/tests/file/bug43353.phpt new file mode 100644 index 0000000..87d0650 --- /dev/null +++ b/ext/standard/tests/file/bug43353.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #43353 wrong detection of 'data' wrapper +--SKIPIF-- + +--INI-- +allow_url_fopen=1 +--FILE-- + +--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/bug43522.phpt b/ext/standard/tests/file/bug43522.phpt new file mode 100644 index 0000000..10e44fc --- /dev/null +++ b/ext/standard/tests/file/bug43522.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #43522 (stream_get_line() eats additional characters) +--FILE-- + +--EXPECT-- +Delimiter: ZZZ + "\\r", "\n" => "\\n")) . "\n"; + var_dump(file($url, FILE_IGNORE_NEW_LINES)); +} +?> +--EXPECTF-- +data://text/plain,foo\r\nbar\r\n +array(2) { + [0]=> + %unicode|string%(3) "foo" + [1]=> + %unicode|string%(3) "bar" +} +data://text/plain,\r\nfoo\r\nbar\r\n +array(3) { + [0]=> + %unicode|string%(0) "" + [1]=> + %unicode|string%(3) "foo" + [2]=> + %unicode|string%(3) "bar" +} +data://text/plain,foo\r\nbar +array(2) { + [0]=> + %unicode|string%(3) "foo" + [1]=> + %unicode|string%(3) "bar" +} diff --git a/ext/standard/tests/file/bug44607.phpt b/ext/standard/tests/file/bug44607.phpt new file mode 100644 index 0000000..dc5e4cb --- /dev/null +++ b/ext/standard/tests/file/bug44607.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #44607 (stream_get_line unable to correctly identify the "ending" in the stream content) +--FILE-- +'; +$tempnam = __DIR__ . '/' . 'tmpbug44607.txt'; +$data = str_repeat('.', 14000); +$data .= $eol; +$data .= $data; +file_put_contents($tempnam, $data); +$fd = fopen($tempnam, 'r'); +var_dump(strlen(stream_get_line($fd, 15000, $eol))); +var_dump(strlen(stream_get_line($fd, 15000, $eol))); +fseek($fd, 1, SEEK_SET); +var_dump(strlen(stream_get_line($fd, 15000, $eol))); +var_dump(strlen(stream_get_line($fd, 15000, $eol))); +fclose($fd); +unlink($tempnam); +?> +--EXPECT-- +int(14000) +int(14000) +int(13999) +int(14000) diff --git a/ext/standard/tests/file/bug44805.phpt b/ext/standard/tests/file/bug44805.phpt new file mode 100644 index 0000000..85f1255 --- /dev/null +++ b/ext/standard/tests/file/bug44805.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug#44806 (rename() function is not portable to Windows) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +reading file 2: this is file 1 diff --git a/ext/standard/tests/file/bug45181.phpt b/ext/standard/tests/file/bug45181.phpt new file mode 100644 index 0000000..d64fa89 --- /dev/null +++ b/ext/standard/tests/file/bug45181.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #45181 (chdir() should clear relative entries in stat cache) +--FILE-- + +--CLEAN-- + +--EXPECT-- +bool(true) +bool(false) diff --git a/ext/standard/tests/file/bug45303.phpt b/ext/standard/tests/file/bug45303.phpt new file mode 100644 index 0000000..0a4b33b --- /dev/null +++ b/ext/standard/tests/file/bug45303.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #45303 (Opening php:// wrapper in append mode results in a warning) +--FILE-- + +--EXPECTF-- +resource(%d) of type (stream) + +Warning: fseek(): stream does not support seeking in %s +int(-1) diff --git a/ext/standard/tests/file/bug45985.phpt b/ext/standard/tests/file/bug45985.phpt new file mode 100644 index 0000000..1b98da2 --- /dev/null +++ b/ext/standard/tests/file/bug45985.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #35740 (touch() opened file raises a warning) +--FILE-- + +--EXPECT-- +ok diff --git a/ext/standard/tests/file/bug46347.phpt b/ext/standard/tests/file/bug46347.phpt new file mode 100644 index 0000000..af81bc2 --- /dev/null +++ b/ext/standard/tests/file/bug46347.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #46347 (parse_ini_file() doesn't support * in keys) +--FILE-- + +--CLEAN-- + +--EXPECTF-- +array(1) { + [%u|b%"part1.*.part2"]=> + %unicode|string%(1) "1" +} diff --git a/ext/standard/tests/file/bug47767.phpt b/ext/standard/tests/file/bug47767.phpt new file mode 100644 index 0000000..312476a --- /dev/null +++ b/ext/standard/tests/file/bug47767.phpt @@ -0,0 +1,50 @@ +--TEST-- +bug #47767 (include_once does not resolve windows symlinks or junctions) +--CREDITS-- +Venkat Raman Don +--SKIPIF-- +&1', $out); +if (strpos($ret, 'privilege')) { + die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.'); +} +?> +--FILE-- +'; +file_put_contents($filename, $content); +$softlinkname = __DIR__ . '\\a_slink.php'; +symlink($filename, $softlinkname); +include_once("$filename"); +include_once("$softlinkname"); +include_once("$softlinkname"); + +echo "Testing include_once using directory symbolic link\n"; +$softdirlinkname = __DIR__ . "\\a_dir"; +symlink(__DIR__, $softdirlinkname); +include_once("$softdirlinkname" . '\\a.php'); + +echo "Testing include_once using junction points\n"; +$junctionname = __DIR__ . '\\a_jdir'; +exec("mklink /J $junctionname " . __DIR__); +include_once("$junctionname" . '\\a.php'); + +unlink($filename); +unlink($softlinkname); +rmdir($softdirlinkname); +rmdir($junctionname); +?> +--EXPECT-- +Testing include_once using file symbolic link +I am included +Testing include_once using directory symbolic link +Testing include_once using junction points \ No newline at end of file diff --git a/ext/standard/tests/file/bug49047.phpt b/ext/standard/tests/file/bug49047.phpt new file mode 100644 index 0000000..1ccc94e --- /dev/null +++ b/ext/standard/tests/file/bug49047.phpt @@ -0,0 +1,17 @@ +--TEST-- +Test fopen() function : variation: interesting paths, no use include path +--FILE-- + +--EXPECTF-- +Ok. diff --git a/ext/standard/tests/file/bug51094.phpt b/ext/standard/tests/file/bug51094.phpt new file mode 100644 index 0000000..f35dfb6 --- /dev/null +++ b/ext/standard/tests/file/bug51094.phpt @@ -0,0 +1,22 @@ +--TEST-- +Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that includes a semi-colon). +--FILE-- + +--EXPECTF-- +Warning: tempnam(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s) in %s on line %d diff --git a/ext/standard/tests/file/bug52820.phpt b/ext/standard/tests/file/bug52820.phpt new file mode 100644 index 0000000..91976b0 --- /dev/null +++ b/ext/standard/tests/file/bug52820.phpt @@ -0,0 +1,71 @@ +--TEST-- +Bug #52820 (writes to fopencookie FILE* not commited when seeking the stream) +--SKIPIF-- + +--EXPECT-- +bool(true) +Done. diff --git a/ext/standard/tests/file/bug53848.phpt b/ext/standard/tests/file/bug53848.phpt new file mode 100644 index 0000000..016d59d --- /dev/null +++ b/ext/standard/tests/file/bug53848.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #53848 (fgetcsv removes leading spaces from fields) +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" +} +array(2) { + [0]=> + string(3) " c" + [1]=> + string(3) " d" +} diff --git a/ext/standard/tests/file/bug55124.phpt b/ext/standard/tests/file/bug55124.phpt new file mode 100644 index 0000000..1915b7f --- /dev/null +++ b/ext/standard/tests/file/bug55124.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #55124 (recursive mkdir fails with current (dot) directory in path) +--FILE-- + +--EXPECT-- +OK diff --git a/ext/standard/tests/file/bug60120.phpt b/ext/standard/tests/file/bug60120.phpt new file mode 100644 index 0000000..8915bb8 --- /dev/null +++ b/ext/standard/tests/file/bug60120.phpt @@ -0,0 +1,74 @@ +--TEST-- +Bug #60120 (proc_open hangs when data in stdin/out/err is getting larger or equal to 2048) +--SKIPIF-- + +--FILE-- + 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. diff --git a/ext/standard/tests/file/bug61961.phpt b/ext/standard/tests/file/bug61961.phpt new file mode 100644 index 0000000..ff0279a --- /dev/null +++ b/ext/standard/tests/file/bug61961.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #61961 (file_get_content leaks when access empty file with max length) +--FILE-- + +==DONE== +--EXPECT-- +string(0) "" +==DONE== \ No newline at end of file diff --git a/ext/standard/tests/file/bug63512.phpt b/ext/standard/tests/file/bug63512.phpt new file mode 100644 index 0000000..049db26 --- /dev/null +++ b/ext/standard/tests/file/bug63512.phpt @@ -0,0 +1,33 @@ +--TEST-- +Fixed bug #63512 (parse_ini_file() with INI_SCANNER_RAW removes quotes from value). +--FILE-- + + string(3) "123" + ["constant"]=> + string(12) "INSTALL_ROOT" + ["quotedString"]=> + string(6) "string" + ["a"]=> + string(18) "INSTALL_ROOT "waa"" + ["b"]=> + string(12) "INSTALL_ROOT" + ["c"]=> + string(18) ""waa" INSTALL_ROOT" + ["d"]=> + string(27) "INSTALL_ROOT "INSTALL_ROOT"" +} + diff --git a/ext/standard/tests/file/chgrp.phpt b/ext/standard/tests/file/chgrp.phpt new file mode 100644 index 0000000..9c85f5c --- /dev/null +++ b/ext/standard/tests/file/chgrp.phpt @@ -0,0 +1,15 @@ +--TEST-- +chgrp() with NULL as group name +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: chgrp(): parameter 2 should be string or integer, null given in %schgrp.php on line 2 +ALIVE diff --git a/ext/standard/tests/file/chmod_basic-win32.phpt b/ext/standard/tests/file/chmod_basic-win32.phpt new file mode 100644 index 0000000..ca224f7 --- /dev/null +++ b/ext/standard/tests/file/chmod_basic-win32.phpt @@ -0,0 +1,545 @@ +--TEST-- +chmod() basic fuctionality +--SKIPIF-- + +--FILE-- += 0; $perms_to_set--) { + chmod($filename, $perms_to_set); + $set_perms = (fileperms($filename) & PERMISSIONS_MASK); + clearstatcache(); + printf("Setting mode %o gives mode %o\n", $perms_to_set, $set_perms); +} +var_dump(chmod($filename, 0777)); + +unlink($filename); +echo "done"; + +?> +--EXPECT-- +Setting mode 777 gives mode 666 +Setting mode 776 gives mode 666 +Setting mode 775 gives mode 666 +Setting mode 774 gives mode 666 +Setting mode 773 gives mode 666 +Setting mode 772 gives mode 666 +Setting mode 771 gives mode 666 +Setting mode 770 gives mode 666 +Setting mode 767 gives mode 666 +Setting mode 766 gives mode 666 +Setting mode 765 gives mode 666 +Setting mode 764 gives mode 666 +Setting mode 763 gives mode 666 +Setting mode 762 gives mode 666 +Setting mode 761 gives mode 666 +Setting mode 760 gives mode 666 +Setting mode 757 gives mode 666 +Setting mode 756 gives mode 666 +Setting mode 755 gives mode 666 +Setting mode 754 gives mode 666 +Setting mode 753 gives mode 666 +Setting mode 752 gives mode 666 +Setting mode 751 gives mode 666 +Setting mode 750 gives mode 666 +Setting mode 747 gives mode 666 +Setting mode 746 gives mode 666 +Setting mode 745 gives mode 666 +Setting mode 744 gives mode 666 +Setting mode 743 gives mode 666 +Setting mode 742 gives mode 666 +Setting mode 741 gives mode 666 +Setting mode 740 gives mode 666 +Setting mode 737 gives mode 666 +Setting mode 736 gives mode 666 +Setting mode 735 gives mode 666 +Setting mode 734 gives mode 666 +Setting mode 733 gives mode 666 +Setting mode 732 gives mode 666 +Setting mode 731 gives mode 666 +Setting mode 730 gives mode 666 +Setting mode 727 gives mode 666 +Setting mode 726 gives mode 666 +Setting mode 725 gives mode 666 +Setting mode 724 gives mode 666 +Setting mode 723 gives mode 666 +Setting mode 722 gives mode 666 +Setting mode 721 gives mode 666 +Setting mode 720 gives mode 666 +Setting mode 717 gives mode 666 +Setting mode 716 gives mode 666 +Setting mode 715 gives mode 666 +Setting mode 714 gives mode 666 +Setting mode 713 gives mode 666 +Setting mode 712 gives mode 666 +Setting mode 711 gives mode 666 +Setting mode 710 gives mode 666 +Setting mode 707 gives mode 666 +Setting mode 706 gives mode 666 +Setting mode 705 gives mode 666 +Setting mode 704 gives mode 666 +Setting mode 703 gives mode 666 +Setting mode 702 gives mode 666 +Setting mode 701 gives mode 666 +Setting mode 700 gives mode 666 +Setting mode 677 gives mode 666 +Setting mode 676 gives mode 666 +Setting mode 675 gives mode 666 +Setting mode 674 gives mode 666 +Setting mode 673 gives mode 666 +Setting mode 672 gives mode 666 +Setting mode 671 gives mode 666 +Setting mode 670 gives mode 666 +Setting mode 667 gives mode 666 +Setting mode 666 gives mode 666 +Setting mode 665 gives mode 666 +Setting mode 664 gives mode 666 +Setting mode 663 gives mode 666 +Setting mode 662 gives mode 666 +Setting mode 661 gives mode 666 +Setting mode 660 gives mode 666 +Setting mode 657 gives mode 666 +Setting mode 656 gives mode 666 +Setting mode 655 gives mode 666 +Setting mode 654 gives mode 666 +Setting mode 653 gives mode 666 +Setting mode 652 gives mode 666 +Setting mode 651 gives mode 666 +Setting mode 650 gives mode 666 +Setting mode 647 gives mode 666 +Setting mode 646 gives mode 666 +Setting mode 645 gives mode 666 +Setting mode 644 gives mode 666 +Setting mode 643 gives mode 666 +Setting mode 642 gives mode 666 +Setting mode 641 gives mode 666 +Setting mode 640 gives mode 666 +Setting mode 637 gives mode 666 +Setting mode 636 gives mode 666 +Setting mode 635 gives mode 666 +Setting mode 634 gives mode 666 +Setting mode 633 gives mode 666 +Setting mode 632 gives mode 666 +Setting mode 631 gives mode 666 +Setting mode 630 gives mode 666 +Setting mode 627 gives mode 666 +Setting mode 626 gives mode 666 +Setting mode 625 gives mode 666 +Setting mode 624 gives mode 666 +Setting mode 623 gives mode 666 +Setting mode 622 gives mode 666 +Setting mode 621 gives mode 666 +Setting mode 620 gives mode 666 +Setting mode 617 gives mode 666 +Setting mode 616 gives mode 666 +Setting mode 615 gives mode 666 +Setting mode 614 gives mode 666 +Setting mode 613 gives mode 666 +Setting mode 612 gives mode 666 +Setting mode 611 gives mode 666 +Setting mode 610 gives mode 666 +Setting mode 607 gives mode 666 +Setting mode 606 gives mode 666 +Setting mode 605 gives mode 666 +Setting mode 604 gives mode 666 +Setting mode 603 gives mode 666 +Setting mode 602 gives mode 666 +Setting mode 601 gives mode 666 +Setting mode 600 gives mode 666 +Setting mode 577 gives mode 444 +Setting mode 576 gives mode 444 +Setting mode 575 gives mode 444 +Setting mode 574 gives mode 444 +Setting mode 573 gives mode 444 +Setting mode 572 gives mode 444 +Setting mode 571 gives mode 444 +Setting mode 570 gives mode 444 +Setting mode 567 gives mode 444 +Setting mode 566 gives mode 444 +Setting mode 565 gives mode 444 +Setting mode 564 gives mode 444 +Setting mode 563 gives mode 444 +Setting mode 562 gives mode 444 +Setting mode 561 gives mode 444 +Setting mode 560 gives mode 444 +Setting mode 557 gives mode 444 +Setting mode 556 gives mode 444 +Setting mode 555 gives mode 444 +Setting mode 554 gives mode 444 +Setting mode 553 gives mode 444 +Setting mode 552 gives mode 444 +Setting mode 551 gives mode 444 +Setting mode 550 gives mode 444 +Setting mode 547 gives mode 444 +Setting mode 546 gives mode 444 +Setting mode 545 gives mode 444 +Setting mode 544 gives mode 444 +Setting mode 543 gives mode 444 +Setting mode 542 gives mode 444 +Setting mode 541 gives mode 444 +Setting mode 540 gives mode 444 +Setting mode 537 gives mode 444 +Setting mode 536 gives mode 444 +Setting mode 535 gives mode 444 +Setting mode 534 gives mode 444 +Setting mode 533 gives mode 444 +Setting mode 532 gives mode 444 +Setting mode 531 gives mode 444 +Setting mode 530 gives mode 444 +Setting mode 527 gives mode 444 +Setting mode 526 gives mode 444 +Setting mode 525 gives mode 444 +Setting mode 524 gives mode 444 +Setting mode 523 gives mode 444 +Setting mode 522 gives mode 444 +Setting mode 521 gives mode 444 +Setting mode 520 gives mode 444 +Setting mode 517 gives mode 444 +Setting mode 516 gives mode 444 +Setting mode 515 gives mode 444 +Setting mode 514 gives mode 444 +Setting mode 513 gives mode 444 +Setting mode 512 gives mode 444 +Setting mode 511 gives mode 444 +Setting mode 510 gives mode 444 +Setting mode 507 gives mode 444 +Setting mode 506 gives mode 444 +Setting mode 505 gives mode 444 +Setting mode 504 gives mode 444 +Setting mode 503 gives mode 444 +Setting mode 502 gives mode 444 +Setting mode 501 gives mode 444 +Setting mode 500 gives mode 444 +Setting mode 477 gives mode 444 +Setting mode 476 gives mode 444 +Setting mode 475 gives mode 444 +Setting mode 474 gives mode 444 +Setting mode 473 gives mode 444 +Setting mode 472 gives mode 444 +Setting mode 471 gives mode 444 +Setting mode 470 gives mode 444 +Setting mode 467 gives mode 444 +Setting mode 466 gives mode 444 +Setting mode 465 gives mode 444 +Setting mode 464 gives mode 444 +Setting mode 463 gives mode 444 +Setting mode 462 gives mode 444 +Setting mode 461 gives mode 444 +Setting mode 460 gives mode 444 +Setting mode 457 gives mode 444 +Setting mode 456 gives mode 444 +Setting mode 455 gives mode 444 +Setting mode 454 gives mode 444 +Setting mode 453 gives mode 444 +Setting mode 452 gives mode 444 +Setting mode 451 gives mode 444 +Setting mode 450 gives mode 444 +Setting mode 447 gives mode 444 +Setting mode 446 gives mode 444 +Setting mode 445 gives mode 444 +Setting mode 444 gives mode 444 +Setting mode 443 gives mode 444 +Setting mode 442 gives mode 444 +Setting mode 441 gives mode 444 +Setting mode 440 gives mode 444 +Setting mode 437 gives mode 444 +Setting mode 436 gives mode 444 +Setting mode 435 gives mode 444 +Setting mode 434 gives mode 444 +Setting mode 433 gives mode 444 +Setting mode 432 gives mode 444 +Setting mode 431 gives mode 444 +Setting mode 430 gives mode 444 +Setting mode 427 gives mode 444 +Setting mode 426 gives mode 444 +Setting mode 425 gives mode 444 +Setting mode 424 gives mode 444 +Setting mode 423 gives mode 444 +Setting mode 422 gives mode 444 +Setting mode 421 gives mode 444 +Setting mode 420 gives mode 444 +Setting mode 417 gives mode 444 +Setting mode 416 gives mode 444 +Setting mode 415 gives mode 444 +Setting mode 414 gives mode 444 +Setting mode 413 gives mode 444 +Setting mode 412 gives mode 444 +Setting mode 411 gives mode 444 +Setting mode 410 gives mode 444 +Setting mode 407 gives mode 444 +Setting mode 406 gives mode 444 +Setting mode 405 gives mode 444 +Setting mode 404 gives mode 444 +Setting mode 403 gives mode 444 +Setting mode 402 gives mode 444 +Setting mode 401 gives mode 444 +Setting mode 400 gives mode 444 +Setting mode 377 gives mode 666 +Setting mode 376 gives mode 666 +Setting mode 375 gives mode 666 +Setting mode 374 gives mode 666 +Setting mode 373 gives mode 666 +Setting mode 372 gives mode 666 +Setting mode 371 gives mode 666 +Setting mode 370 gives mode 666 +Setting mode 367 gives mode 666 +Setting mode 366 gives mode 666 +Setting mode 365 gives mode 666 +Setting mode 364 gives mode 666 +Setting mode 363 gives mode 666 +Setting mode 362 gives mode 666 +Setting mode 361 gives mode 666 +Setting mode 360 gives mode 666 +Setting mode 357 gives mode 666 +Setting mode 356 gives mode 666 +Setting mode 355 gives mode 666 +Setting mode 354 gives mode 666 +Setting mode 353 gives mode 666 +Setting mode 352 gives mode 666 +Setting mode 351 gives mode 666 +Setting mode 350 gives mode 666 +Setting mode 347 gives mode 666 +Setting mode 346 gives mode 666 +Setting mode 345 gives mode 666 +Setting mode 344 gives mode 666 +Setting mode 343 gives mode 666 +Setting mode 342 gives mode 666 +Setting mode 341 gives mode 666 +Setting mode 340 gives mode 666 +Setting mode 337 gives mode 666 +Setting mode 336 gives mode 666 +Setting mode 335 gives mode 666 +Setting mode 334 gives mode 666 +Setting mode 333 gives mode 666 +Setting mode 332 gives mode 666 +Setting mode 331 gives mode 666 +Setting mode 330 gives mode 666 +Setting mode 327 gives mode 666 +Setting mode 326 gives mode 666 +Setting mode 325 gives mode 666 +Setting mode 324 gives mode 666 +Setting mode 323 gives mode 666 +Setting mode 322 gives mode 666 +Setting mode 321 gives mode 666 +Setting mode 320 gives mode 666 +Setting mode 317 gives mode 666 +Setting mode 316 gives mode 666 +Setting mode 315 gives mode 666 +Setting mode 314 gives mode 666 +Setting mode 313 gives mode 666 +Setting mode 312 gives mode 666 +Setting mode 311 gives mode 666 +Setting mode 310 gives mode 666 +Setting mode 307 gives mode 666 +Setting mode 306 gives mode 666 +Setting mode 305 gives mode 666 +Setting mode 304 gives mode 666 +Setting mode 303 gives mode 666 +Setting mode 302 gives mode 666 +Setting mode 301 gives mode 666 +Setting mode 300 gives mode 666 +Setting mode 277 gives mode 666 +Setting mode 276 gives mode 666 +Setting mode 275 gives mode 666 +Setting mode 274 gives mode 666 +Setting mode 273 gives mode 666 +Setting mode 272 gives mode 666 +Setting mode 271 gives mode 666 +Setting mode 270 gives mode 666 +Setting mode 267 gives mode 666 +Setting mode 266 gives mode 666 +Setting mode 265 gives mode 666 +Setting mode 264 gives mode 666 +Setting mode 263 gives mode 666 +Setting mode 262 gives mode 666 +Setting mode 261 gives mode 666 +Setting mode 260 gives mode 666 +Setting mode 257 gives mode 666 +Setting mode 256 gives mode 666 +Setting mode 255 gives mode 666 +Setting mode 254 gives mode 666 +Setting mode 253 gives mode 666 +Setting mode 252 gives mode 666 +Setting mode 251 gives mode 666 +Setting mode 250 gives mode 666 +Setting mode 247 gives mode 666 +Setting mode 246 gives mode 666 +Setting mode 245 gives mode 666 +Setting mode 244 gives mode 666 +Setting mode 243 gives mode 666 +Setting mode 242 gives mode 666 +Setting mode 241 gives mode 666 +Setting mode 240 gives mode 666 +Setting mode 237 gives mode 666 +Setting mode 236 gives mode 666 +Setting mode 235 gives mode 666 +Setting mode 234 gives mode 666 +Setting mode 233 gives mode 666 +Setting mode 232 gives mode 666 +Setting mode 231 gives mode 666 +Setting mode 230 gives mode 666 +Setting mode 227 gives mode 666 +Setting mode 226 gives mode 666 +Setting mode 225 gives mode 666 +Setting mode 224 gives mode 666 +Setting mode 223 gives mode 666 +Setting mode 222 gives mode 666 +Setting mode 221 gives mode 666 +Setting mode 220 gives mode 666 +Setting mode 217 gives mode 666 +Setting mode 216 gives mode 666 +Setting mode 215 gives mode 666 +Setting mode 214 gives mode 666 +Setting mode 213 gives mode 666 +Setting mode 212 gives mode 666 +Setting mode 211 gives mode 666 +Setting mode 210 gives mode 666 +Setting mode 207 gives mode 666 +Setting mode 206 gives mode 666 +Setting mode 205 gives mode 666 +Setting mode 204 gives mode 666 +Setting mode 203 gives mode 666 +Setting mode 202 gives mode 666 +Setting mode 201 gives mode 666 +Setting mode 200 gives mode 666 +Setting mode 177 gives mode 444 +Setting mode 176 gives mode 444 +Setting mode 175 gives mode 444 +Setting mode 174 gives mode 444 +Setting mode 173 gives mode 444 +Setting mode 172 gives mode 444 +Setting mode 171 gives mode 444 +Setting mode 170 gives mode 444 +Setting mode 167 gives mode 444 +Setting mode 166 gives mode 444 +Setting mode 165 gives mode 444 +Setting mode 164 gives mode 444 +Setting mode 163 gives mode 444 +Setting mode 162 gives mode 444 +Setting mode 161 gives mode 444 +Setting mode 160 gives mode 444 +Setting mode 157 gives mode 444 +Setting mode 156 gives mode 444 +Setting mode 155 gives mode 444 +Setting mode 154 gives mode 444 +Setting mode 153 gives mode 444 +Setting mode 152 gives mode 444 +Setting mode 151 gives mode 444 +Setting mode 150 gives mode 444 +Setting mode 147 gives mode 444 +Setting mode 146 gives mode 444 +Setting mode 145 gives mode 444 +Setting mode 144 gives mode 444 +Setting mode 143 gives mode 444 +Setting mode 142 gives mode 444 +Setting mode 141 gives mode 444 +Setting mode 140 gives mode 444 +Setting mode 137 gives mode 444 +Setting mode 136 gives mode 444 +Setting mode 135 gives mode 444 +Setting mode 134 gives mode 444 +Setting mode 133 gives mode 444 +Setting mode 132 gives mode 444 +Setting mode 131 gives mode 444 +Setting mode 130 gives mode 444 +Setting mode 127 gives mode 444 +Setting mode 126 gives mode 444 +Setting mode 125 gives mode 444 +Setting mode 124 gives mode 444 +Setting mode 123 gives mode 444 +Setting mode 122 gives mode 444 +Setting mode 121 gives mode 444 +Setting mode 120 gives mode 444 +Setting mode 117 gives mode 444 +Setting mode 116 gives mode 444 +Setting mode 115 gives mode 444 +Setting mode 114 gives mode 444 +Setting mode 113 gives mode 444 +Setting mode 112 gives mode 444 +Setting mode 111 gives mode 444 +Setting mode 110 gives mode 444 +Setting mode 107 gives mode 444 +Setting mode 106 gives mode 444 +Setting mode 105 gives mode 444 +Setting mode 104 gives mode 444 +Setting mode 103 gives mode 444 +Setting mode 102 gives mode 444 +Setting mode 101 gives mode 444 +Setting mode 100 gives mode 444 +Setting mode 77 gives mode 444 +Setting mode 76 gives mode 444 +Setting mode 75 gives mode 444 +Setting mode 74 gives mode 444 +Setting mode 73 gives mode 444 +Setting mode 72 gives mode 444 +Setting mode 71 gives mode 444 +Setting mode 70 gives mode 444 +Setting mode 67 gives mode 444 +Setting mode 66 gives mode 444 +Setting mode 65 gives mode 444 +Setting mode 64 gives mode 444 +Setting mode 63 gives mode 444 +Setting mode 62 gives mode 444 +Setting mode 61 gives mode 444 +Setting mode 60 gives mode 444 +Setting mode 57 gives mode 444 +Setting mode 56 gives mode 444 +Setting mode 55 gives mode 444 +Setting mode 54 gives mode 444 +Setting mode 53 gives mode 444 +Setting mode 52 gives mode 444 +Setting mode 51 gives mode 444 +Setting mode 50 gives mode 444 +Setting mode 47 gives mode 444 +Setting mode 46 gives mode 444 +Setting mode 45 gives mode 444 +Setting mode 44 gives mode 444 +Setting mode 43 gives mode 444 +Setting mode 42 gives mode 444 +Setting mode 41 gives mode 444 +Setting mode 40 gives mode 444 +Setting mode 37 gives mode 444 +Setting mode 36 gives mode 444 +Setting mode 35 gives mode 444 +Setting mode 34 gives mode 444 +Setting mode 33 gives mode 444 +Setting mode 32 gives mode 444 +Setting mode 31 gives mode 444 +Setting mode 30 gives mode 444 +Setting mode 27 gives mode 444 +Setting mode 26 gives mode 444 +Setting mode 25 gives mode 444 +Setting mode 24 gives mode 444 +Setting mode 23 gives mode 444 +Setting mode 22 gives mode 444 +Setting mode 21 gives mode 444 +Setting mode 20 gives mode 444 +Setting mode 17 gives mode 444 +Setting mode 16 gives mode 444 +Setting mode 15 gives mode 444 +Setting mode 14 gives mode 444 +Setting mode 13 gives mode 444 +Setting mode 12 gives mode 444 +Setting mode 11 gives mode 444 +Setting mode 10 gives mode 444 +Setting mode 7 gives mode 444 +Setting mode 6 gives mode 444 +Setting mode 5 gives mode 444 +Setting mode 4 gives mode 444 +Setting mode 3 gives mode 444 +Setting mode 2 gives mode 444 +Setting mode 1 gives mode 444 +Setting mode 0 gives mode 444 +bool(true) +done diff --git a/ext/standard/tests/file/chmod_basic.phpt b/ext/standard/tests/file/chmod_basic.phpt new file mode 100644 index 0000000..582f273 --- /dev/null +++ b/ext/standard/tests/file/chmod_basic.phpt @@ -0,0 +1,35 @@ +--TEST-- +chmod() basic fuctionality +--SKIPIF-- + +--FILE-- += 0; $perms_to_set--) { + chmod($filename, $perms_to_set); + $set_perms = (fileperms($filename) & MODE_MASK); + clearstatcache(); + if ($set_perms != $perms_to_set) { + printf("Error: %o does not match %o\n", $set_perms, $perms_to_set); + } +} +var_dump(chmod($filename, 0777)); + +unlink($filename); +echo "done"; + +?> +--EXPECT-- +bool(true) +done diff --git a/ext/standard/tests/file/chmod_error.phpt b/ext/standard/tests/file/chmod_error.phpt new file mode 100644 index 0000000..f4cae3b --- /dev/null +++ b/ext/standard/tests/file/chmod_error.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test chmod() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing chmod() : error conditions *** + +-- Testing chmod() function with more than expected no. of arguments -- + +Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing chmod() function with less than expected no. of arguments -- + +Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d +NULL + +Warning: chmod(): No such file or directory in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/file/chmod_variation1.phpt b/ext/standard/tests/file/chmod_variation1.phpt new file mode 100644 index 0000000..f35e54e --- /dev/null +++ b/ext/standard/tests/file/chmod_variation1.phpt @@ -0,0 +1,34 @@ +--TEST-- +chmod() on a directory +--SKIPIF-- + +--FILE-- += 0; $perms_to_set--) { + chmod($dirname, $perms_to_set); + $set_perms = (fileperms($dirname) & PERMISSIONS_MASK); + clearstatcache(); + if ($set_perms != $perms_to_set) { + printf("Error: %o does not match %o\n", $set_perms, $perms_to_set); + } +} + +var_dump(chmod($dirname, 0777)); +rmdir($dirname); + +echo "done"; + +?> +--EXPECT-- +bool(true) +done diff --git a/ext/standard/tests/file/chmod_variation2-win32.phpt b/ext/standard/tests/file/chmod_variation2-win32.phpt new file mode 100644 index 0000000..bc379ff --- /dev/null +++ b/ext/standard/tests/file/chmod_variation2-win32.phpt @@ -0,0 +1,74 @@ +--TEST-- +chmod() with various paths +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +chmod() on a path containing .. and . +bool(true) +bool(true) +666 + +chmod() on a path containing .. with invalid directories +bool(true) +bool(true) +666 + +chmod() on a relative path from a different working directory +bool(true) +bool(true) +666 + +chmod() on a directory with a trailing / +bool(true) +bool(true) +666 diff --git a/ext/standard/tests/file/chmod_variation2.phpt b/ext/standard/tests/file/chmod_variation2.phpt new file mode 100644 index 0000000..b193acf --- /dev/null +++ b/ext/standard/tests/file/chmod_variation2.phpt @@ -0,0 +1,92 @@ +--TEST-- +chmod() with various paths +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +chmod() on a path containing .. and . +bool(true) +bool(true) +755 + +chmod() on a path containing .. with invalid directories +bool(true) + +Warning: chmod(): No such file or directory in %s on line %d +bool(false) +777 + +chmod() on a linked file +bool(true) +bool(true) +bool(true) +755 +bool(true) + +chmod() on a relative path from a different working directory +bool(true) +bool(true) +755 + +chmod() on a directory with a trailing / +bool(true) +bool(true) +755 diff --git a/ext/standard/tests/file/chmod_variation3.phpt b/ext/standard/tests/file/chmod_variation3.phpt new file mode 100644 index 0000000..7c637b8 --- /dev/null +++ b/ext/standard/tests/file/chmod_variation3.phpt @@ -0,0 +1,209 @@ +--TEST-- +Test chmod() function : first parameter variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for filename + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( chmod($value, $mode) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing chmod() : usage variation *** + +--int 0-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--int 1-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--int 12345-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--int -12345-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--float 10.5-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--float -10.5-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--float 12.3456789000e10-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--float -12.3456789000e10-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--float .5-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--empty array-- +Error: 2 - chmod() expects parameter 1 to be a valid path, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - chmod() expects parameter 1 to be a valid path, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - chmod() expects parameter 1 to be a valid path, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - chmod() expects parameter 1 to be a valid path, array given, %s(%d) +NULL + +--uppercase NULL-- +Error: 2 - chmod(): %s, %s(%d) +bool(false) + +--lowercase null-- +Error: 2 - chmod(): %s, %s(%d) +bool(false) + +--lowercase true-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--lowercase false-- +Error: 2 - chmod(): %s, %s(%d) +bool(false) + +--uppercase TRUE-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--uppercase FALSE-- +Error: 2 - chmod(): %s, %s(%d) +bool(false) + +--empty string DQ-- +Error: 2 - chmod(): %s, %s(%d) +bool(false) + +--empty string SQ-- +Error: 2 - chmod(): %s, %s(%d) +bool(false) + +--instance of classWithToString-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--instance of classWithoutToString-- +Error: 2 - chmod() expects parameter 1 to be a valid path, object given, %s(%d) +NULL + +--undefined var-- +Error: 2 - chmod(): %s, %s(%d) +bool(false) + +--unset var-- +Error: 2 - chmod(): %s, %s(%d) +bool(false) +===DONE=== + diff --git a/ext/standard/tests/file/chmod_variation4.phpt b/ext/standard/tests/file/chmod_variation4.phpt new file mode 100644 index 0000000..15310f1 --- /dev/null +++ b/ext/standard/tests/file/chmod_variation4.phpt @@ -0,0 +1,201 @@ +--TEST-- +Test chmod() function : second parameter variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for mode + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( chmod($filename, $value) ); +}; + +chmod($filename, 0777); +unlink($filename); + +?> +===DONE=== +--EXPECTF-- +*** Testing chmod() : usage variation *** + +--float 10.5-- +bool(true) + +--float -10.5-- +bool(true) + +--float 12.3456789000e10-- +bool(true) + +--float -12.3456789000e10-- +bool(true) + +--float .5-- +bool(true) + +--empty array-- +Error: 2 - chmod() expects parameter 2 to be long, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - chmod() expects parameter 2 to be long, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - chmod() expects parameter 2 to be long, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - chmod() expects parameter 2 to be long, array given, %s(%d) +NULL + +--uppercase NULL-- +bool(true) + +--lowercase null-- +bool(true) + +--lowercase true-- +bool(true) + +--lowercase false-- +bool(true) + +--uppercase TRUE-- +bool(true) + +--uppercase FALSE-- +bool(true) + +--empty string DQ-- +Error: 2 - chmod() expects parameter 2 to be long, string given, %s(%d) +NULL + +--empty string SQ-- +Error: 2 - chmod() expects parameter 2 to be long, string given, %s(%d) +NULL + +--string DQ-- +Error: 2 - chmod() expects parameter 2 to be long, string given, %s(%d) +NULL + +--string SQ-- +Error: 2 - chmod() expects parameter 2 to be long, string given, %s(%d) +NULL + +--mixed case string-- +Error: 2 - chmod() expects parameter 2 to be long, string given, %s(%d) +NULL + +--heredoc-- +Error: 2 - chmod() expects parameter 2 to be long, string given, %s(%d) +NULL + +--instance of classWithToString-- +Error: 2 - chmod() expects parameter 2 to be long, object given, %s(%d) +NULL + +--instance of classWithoutToString-- +Error: 2 - chmod() expects parameter 2 to be long, object given, %s(%d) +NULL + +--undefined var-- +bool(true) + +--unset var-- +bool(true) +===DONE=== + diff --git a/ext/standard/tests/file/chown.phpt b/ext/standard/tests/file/chown.phpt new file mode 100644 index 0000000..9075d3d --- /dev/null +++ b/ext/standard/tests/file/chown.phpt @@ -0,0 +1,15 @@ +--TEST-- +chown() with NULL as user name +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: chown(): parameter 2 should be string or integer, null given in %schown.php on line %d +ALIVE diff --git a/ext/standard/tests/file/chroot_001.phpt b/ext/standard/tests/file/chroot_001.phpt new file mode 100644 index 0000000..daa1a83 --- /dev/null +++ b/ext/standard/tests/file/chroot_001.phpt @@ -0,0 +1,30 @@ +--TEST-- +chroot() +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +bool(true) +bool(true) +bool(false) +%unicode|string%(1) "/" diff --git a/ext/standard/tests/file/clearstatcache_001.phpt b/ext/standard/tests/file/clearstatcache_001.phpt new file mode 100644 index 0000000..4282430 --- /dev/null +++ b/ext/standard/tests/file/clearstatcache_001.phpt @@ -0,0 +1,43 @@ +--TEST-- +clearstatcache() optional parameters +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +%unicode|string%(%d) "%s_dir1" +%unicode|string%(%d) "%s_dir1" +%unicode|string%(%d) "%s_dir1" +%unicode|string%(%d) "%s_dir1" +bool(false) diff --git a/ext/standard/tests/file/clearstatcache_error.phpt b/ext/standard/tests/file/clearstatcache_error.phpt new file mode 100644 index 0000000..ee7d1af --- /dev/null +++ b/ext/standard/tests/file/clearstatcache_error.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test clearstatcache() function: error conditions +--FILE-- + +--EXPECTF-- +*** Testing clearstatcache() function: error conditions *** + +Warning: clearstatcache() expects at most 2 parameters, 3 given in %s on line %d +NULL +*** Done *** diff --git a/ext/standard/tests/file/copy_basic.phpt b/ext/standard/tests/file/copy_basic.phpt new file mode 100644 index 0000000..32788f9 --- /dev/null +++ b/ext/standard/tests/file/copy_basic.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test copy() function: basic functionality +--FILE-- + + +--CLEAN-- + + +--EXPECTF-- +*** Testing copy() function: to copy file from source to destination -- +bool(true) +bool(true) +bool(true) +-- Checking whether the copy of file exists -- +bool(true) +bool(true) +-- Checking filepermissions of file and its copies -- +%d +%d +%d +*** Done *** + diff --git a/ext/standard/tests/file/copy_error.phpt b/ext/standard/tests/file/copy_error.phpt new file mode 100644 index 0000000..96072eb --- /dev/null +++ b/ext/standard/tests/file/copy_error.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test copy() function: error conditions +--FILE-- + + +--EXPECTF-- +*** Testing copy() function: error conditions -- + +Warning: copy(/no/file): failed to open stream: No such file or directory in %s on line %d +bool(false) + +Warning: copy() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: copy() expects at least 2 parameters, 1 given in %s on line %d +NULL + +Warning: copy() expects parameter 3 to be resource, string given in %s on line %d +NULL +*** Done *** + diff --git a/ext/standard/tests/file/copy_variation1.phpt b/ext/standard/tests/file/copy_variation1.phpt new file mode 100644 index 0000000..4d0a973 --- /dev/null +++ b/ext/standard/tests/file/copy_variation1.phpt @@ -0,0 +1,145 @@ +--TEST-- +Test copy() function: usage variations - destination file names(numerics/strings) +--FILE-- + "; +var_dump( filesize("$src_file_name") ); +clearstatcache(); + +echo "\n-- Now applying copy() on source file to create copies --"; +$count = 1; +foreach($dest_files as $dest_file) { + echo "\n-- Iteration $count --\n"; + + $dest_file_name = "$file_path/$dest_file"; + + echo "Copy operation => "; + var_dump( copy($src_file_name, $dest_file_name) ); + + echo "Existence of destination file => "; + var_dump( file_exists($dest_file_name) ); + + echo "Destination file name => "; + print($dest_file_name); + echo "\n"; + + echo "Size of source file => "; + var_dump( filesize($src_file_name) ); + clearstatcache(); + + echo "Size of destination file => "; + var_dump( filesize($dest_file_name) ); + clearstatcache(); + + unlink($dest_file_name); + + $count++; +} + +echo "*** Done ***\n"; +?> + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: destination file names containing numerics/strings *** +Size of the source file before copy operation => int(1500) + +-- Now applying copy() on source file to create copies -- +-- Iteration 1 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/copy.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 2 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/copy_copy_variation1.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 3 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 4 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/123.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 5 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/copy_variation1.123 +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 6 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/123 +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 7 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/123copy_variation1.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 8 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/copy_variation.tmp123 +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 9 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/copy1.tmp +Size of source file => int(1500) +Size of destination file => int(1500) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation10.phpt b/ext/standard/tests/file/copy_variation10.phpt new file mode 100644 index 0000000..98494af --- /dev/null +++ b/ext/standard/tests/file/copy_variation10.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test copy() function: usage variations - identical names +--FILE-- + + +--CLEAN-- + + +--EXPECTF-- +*** Test copy(): Trying to create a copy of file with the same source name *** +bool(false) +bool(true) +int(1500) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation11.phpt b/ext/standard/tests/file/copy_variation11.phpt new file mode 100644 index 0000000..adee8e1 --- /dev/null +++ b/ext/standard/tests/file/copy_variation11.phpt @@ -0,0 +1,71 @@ +--TEST-- +Test copy() function: usage variations - existing dir as destination +--FILE-- + "; +var_dump( filesize($file) ); //size of source before copy +clearstatcache(); +echo "Size of destination before copy operation => "; +var_dump( filesize($dir) ); //size of destination before copy +clearstatcache(); + +echo "\n-- Now applying copy() operation --\n"; +var_dump( copy($file, $dir) ); //expected: bool(false) + +var_dump( file_exists($file) ); //expected: bool(true) +var_dump( file_exists($dir) ); //expected: bool(true) + +var_dump( is_file($file) ); //expected: bool(true) +var_dump( is_dir($file) ); //expected: bool(false) + +var_dump( is_file($dir) ); //expected: bool(false) +var_dump( is_dir($dir) ); //expected: bool(true) + +var_dump( filesize($file) ); //size of source after copy +var_dump( filesize($dir) ); //size of destination after copy + +echo "*** Done ***\n"; +?> + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: Trying to create a copy of source file as a dir *** +Size of source before copy operation => int(300) +Size of destination before copy operation => int(%d) + +-- Now applying copy() operation -- + +Warning: %s +bool(false) +bool(true) +bool(true) +bool(true) +bool(false) +bool(false) +bool(true) +int(300) +int(%d) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation12-win32.phpt b/ext/standard/tests/file/copy_variation12-win32.phpt new file mode 100644 index 0000000..4d39de3 --- /dev/null +++ b/ext/standard/tests/file/copy_variation12-win32.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test copy() function: usage variations - dir as source +--SKIPIF-- + +--FILE-- + + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: Trying to create a copy of an existing dir *** + +Warning: copy(): The first argument to copy() function cannot be a directory in %s on line %d +bool(false) +bool(false) +int(0) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation12.phpt b/ext/standard/tests/file/copy_variation12.phpt new file mode 100644 index 0000000..7f96fd0 --- /dev/null +++ b/ext/standard/tests/file/copy_variation12.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test copy() function: usage variations - dir as source (Bug #42111) +--SKIPIF-- + + +--FILE-- + + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: Trying to create a copy of an existing dir *** + +Warning: copy(): The first argument to copy() function cannot be a directory in %scopy_variation12.php on line %d +bool(false) +bool(false) +int(%d) + +Warning: filesize(): stat failed for %scopy_copy_variation12 in %scopy_variation12.php on line %d +bool(false) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation13.phpt b/ext/standard/tests/file/copy_variation13.phpt new file mode 100644 index 0000000..779f82b --- /dev/null +++ b/ext/standard/tests/file/copy_variation13.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test copy() function: usage variations - src as dir and dest as an existing file(Bug #42243) +--FILE-- + + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: Trying to copy dir to file *** +*** Testing copy() in copying dir to file *** + +Warning: copy(): The first argument to copy() function cannot be a directory in %scopy_variation13.php on line %d +bool(false) +bool(true) +bool(true) +bool(false) +bool(true) +bool(true) +bool(false) +int(%d) +int(%d) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation14.phpt b/ext/standard/tests/file/copy_variation14.phpt new file mode 100644 index 0000000..1a39c1c --- /dev/null +++ b/ext/standard/tests/file/copy_variation14.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test copy() function: usage variations - non existing src/dest +--FILE-- + + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: Trying to create a copy of non-existing source in existing destination *** +Warning: copy(%s): %s +bool(false) +bool(false) + +*** Test copy() function: Trying to create copy of an existing source in non-existing destination *** +Warning: copy(%s): %s +bool(false) +bool(false) +int(1500) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation15.phpt b/ext/standard/tests/file/copy_variation15.phpt new file mode 100644 index 0000000..fbf5e7b --- /dev/null +++ b/ext/standard/tests/file/copy_variation15.phpt @@ -0,0 +1,64 @@ +--TEST-- +Test copy() function: usage variations - destination dir access perms +--SKIPIF-- + +--FILE-- + + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: Trying to create a copy of file in a dir which doesn't have write permissions *** +Warning: copy(%s): %s +bool(false) +bool(false) +int(300) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation16-win32.phpt b/ext/standard/tests/file/copy_variation16-win32.phpt new file mode 100644 index 0000000..7688f5e --- /dev/null +++ b/ext/standard/tests/file/copy_variation16-win32.phpt @@ -0,0 +1,144 @@ +--TEST-- +Test copy() function: usage variations - copy data file across dirs +--SKIPIF-- + +--FILE-- + "; +var_dump( filesize($src_file_name) ); +clearstatcache(); + +$dests = array( + $base_dir."/copy_copy_variation16.tmp", + $base_dir."/copy_variation16_sub/copy_copy_variation16.tmp", + "$sub_dir/copy_copy_variation16.tmp", + "$sub_dir/../copy_copy_variation16.tmp", + "$sub_dir/../copy_variation16_sub/copy_copy_variation16.tmp", + "$sub_dir/..///../copy_copy_variation16.tmp", + "$sub_dir/..///../*", + "$dirname_with_blank/copy_copy_variation16.tmp" +); + +echo "\n--- Now applying copy() on source file to create copies ---"; +$count = 1; +foreach($dests as $dest) { + echo "\n-- Iteration $count --\n"; + + echo "Size of source file => "; + var_dump( filesize($src_file_name) ); + + echo "Copy operation => "; + var_dump( copy($src_file_name, $dest) ); + + echo "Existence of destination file => "; + var_dump( file_exists($dest) ); + + if( file_exists($dest) ){ + echo "Destination file name is => "; + print($dest); + echo "\n"; + + echo "Size of destination file => "; + var_dump( filesize($dest) ); + clearstatcache(); + + unlink("$dest"); + } + $count++; +} + +unlink($src_file_name); +rmdir($dirname_with_blank); +rmdir($sub_dir); +rmdir($base_dir); + +echo "*** Done ***\n"; +?> + +--EXPECTF-- +*** Testing copy() function: copying data file across directories *** +- Size of source file => int(3500) + +--- Now applying copy() on source file to create copies --- +-- Iteration 1 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_copy_variation16.tmp +Size of destination file => int(3500) + +-- Iteration 2 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_variation16_sub/copy_copy_variation16.tmp +Size of destination file => int(3500) + +-- Iteration 3 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_variation16_sub/copy_copy_variation16.tmp +Size of destination file => int(3500) + +-- Iteration 4 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_variation16_sub/../copy_copy_variation16.tmp +Size of destination file => int(3500) + +-- Iteration 5 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_variation16_sub/../copy_variation16_sub/copy_copy_variation16.tmp +Size of destination file => int(3500) + +-- Iteration 6 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_variation16_sub/..///../copy_copy_variation16.tmp +Size of destination file => int(3500) + +-- Iteration 7 -- +Size of source file => int(3500) +Copy operation => +Warning: copy(%s): failed to open stream: No such file or directory in %s on line %s +bool(false) +Existence of destination file => bool(false) + +-- Iteration 8 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_variation16_sub/copy variation6/copy_copy_variation16.tmp +Size of destination file => int(3500) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation16.phpt b/ext/standard/tests/file/copy_variation16.phpt new file mode 100644 index 0000000..9ad834b --- /dev/null +++ b/ext/standard/tests/file/copy_variation16.phpt @@ -0,0 +1,143 @@ +--TEST-- +Test copy() function: usage variations - copy data file across dirs +--SKIPIF-- + +--FILE-- + "; +var_dump( filesize($src_file_name) ); +clearstatcache(); + +$dests = array( + $base_dir."/copy_copy_variation16.tmp", + $base_dir."/copy_variation16_sub/copy_copy_variation16.tmp", + "$sub_dir/copy_copy_variation16.tmp", + "$sub_dir/../copy_copy_variation16.tmp", + "$sub_dir/../copy_variation16_sub/copy_copy_variation16.tmp", + "$sub_dir/..///../copy_copy_variation16.tmp", + "$sub_dir/..///../*", + "$dirname_with_blank/copy_copy_variation16.tmp" +); + +echo "\n--- Now applying copy() on source file to create copies ---"; +$count = 1; +foreach($dests as $dest) { + echo "\n-- Iteration $count --\n"; + + echo "Size of source file => "; + var_dump( filesize($src_file_name) ); + + echo "Copy operation => "; + var_dump( copy($src_file_name, $dest) ); + + echo "Existence of destination file => "; + var_dump( file_exists($dest) ); + + echo "Destination file name is => "; + print($dest); + echo "\n"; + + echo "Size of destination file => "; + var_dump( filesize($dest) ); + clearstatcache(); + + unlink("$dest"); + + $count++; +} + +unlink($src_file_name); +rmdir($dirname_with_blank); +rmdir($sub_dir); +rmdir($base_dir); + +echo "*** Done ***\n"; +?> + +--EXPECTF-- +*** Testing copy() function: copying data file across directories *** +- Size of source file => int(3500) + +--- Now applying copy() on source file to create copies --- +-- Iteration 1 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_copy_variation16.tmp +Size of destination file => int(3500) + +-- Iteration 2 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_variation16_sub/copy_copy_variation16.tmp +Size of destination file => int(3500) + +-- Iteration 3 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_variation16_sub/copy_copy_variation16.tmp +Size of destination file => int(3500) + +-- Iteration 4 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_variation16_sub/../copy_copy_variation16.tmp +Size of destination file => int(3500) + +-- Iteration 5 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_variation16_sub/../copy_variation16_sub/copy_copy_variation16.tmp +Size of destination file => int(3500) + +-- Iteration 6 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_variation16_sub/..///../copy_copy_variation16.tmp +Size of destination file => int(3500) + +-- Iteration 7 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_variation16_sub/..///../* +Size of destination file => int(3500) + +-- Iteration 8 -- +Size of source file => int(3500) +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation16/copy_variation16_sub/copy variation6/copy_copy_variation16.tmp +Size of destination file => int(3500) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation17.phpt b/ext/standard/tests/file/copy_variation17.phpt new file mode 100644 index 0000000..97f1665 --- /dev/null +++ b/ext/standard/tests/file/copy_variation17.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test copy() function: usage variations - wildcard chars in source +--FILE-- + + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: With source file names containing wild-card chars *** +bool(true) +bool(true) +int(1500) + +Warning: copy(%s): %s +bool(false) +bool(false) + +Warning: copy(%s): %s +bool(false) +bool(false) + +Warning: copy(%s): %s +bool(false) +bool(false) + +Warning: copy(%s): %s +bool(false) +bool(false) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation18.phpt b/ext/standard/tests/file/copy_variation18.phpt new file mode 100644 index 0000000..53467af --- /dev/null +++ b/ext/standard/tests/file/copy_variation18.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test copy() function: usage variations - stat after copy +--FILE-- + "; +var_dump( copy($src_file_name, $dest_file_name) ); + +$stat_after_copy = stat($src_file_name); +clearstatcache(); + +// compare all stat fields except access time +$stat_keys_to_compare = array("dev", "ino", "mode", "nlink", "uid", "gid", + "rdev", "size", "mtime", "ctime", + "blksize", "blocks"); + +echo "Comparing the stats of file before and after copy operation => "; +var_dump( compare_stats($stat_before_copy, $stat_after_copy, $stat_keys_to_compare) ); + +echo "*** Done ***\n"; +?> + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: stat of file before and after copy *** +Copy operation => bool(true) +Comparing the stats of file before and after copy operation => bool(true) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation2-win32.phpt b/ext/standard/tests/file/copy_variation2-win32.phpt new file mode 100644 index 0000000..4819d63 --- /dev/null +++ b/ext/standard/tests/file/copy_variation2-win32.phpt @@ -0,0 +1,218 @@ +--TEST-- +Test copy() function: usage variations - destination file names(special chars) +--SKIPIF-- + +--FILE-- +copy_variation2.tmp", + "!copy_variation2.tmp", + "©_variation2.tmp", + "(copy_variation2.tmp", + ":copy_variation2.tmp", + ";copy_variation2.tmp", + "=copy_variation2.tmp", + "[copy_variation2.tmp", + "^copy_variation2.tmp", + "{copy_variation2.tmp", + "|copy_variation2.tmp", + "~copy_variation2.tmp", + "\$copy_variation2.tmp" +); + +echo "Size of the source file before copy operation => "; +var_dump( filesize("$src_file_name") ); +clearstatcache(); + +echo "\n--- Now applying copy() on source file to create copies ---"; +$count = 1; +foreach($dest_files as $dest_file) { + echo "\n-- Iteration $count --\n"; + $dest_file_name = $file_path."/$dest_file"; + + echo "Copy operation => "; + var_dump( copy($src_file_name, $dest_file_name) ); + + echo "Existence of destination file => "; + var_dump( file_exists($dest_file_name) ); + + if( file_exists($dest_file_name) ) { + echo "Destination file name => "; + print($dest_file_name); + echo "\n"; + + echo "Size of source file => "; + var_dump( filesize($src_file_name) ); + clearstatcache(); + + echo "Size of destination file => "; + var_dump( filesize($dest_file_name) ); + clearstatcache(); + + unlink($dest_file_name); + } + $count++; +} + +echo "*** Done ***\n"; +?> + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: destination file names containing special characters *** +Size of the source file before copy operation => int(1500) + +--- Now applying copy() on source file to create copies --- +-- Iteration 1 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/_copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 2 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/@copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 3 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/#copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 4 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/+copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 5 -- +Copy operation => +Warning: copy(%s): %s +bool(false) +Existence of destination file => bool(false) + +-- Iteration 6 -- +Copy operation => +Warning: copy(%s): %s +bool(false) +Existence of destination file => bool(false) + +-- Iteration 7 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/!copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 8 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/©_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 9 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/(copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 10 -- +Copy operation => +Warning: copy(%s): %s +bool(false) +Existence of destination file => bool(false) + +-- Iteration 11 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/;copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 12 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/=copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 13 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/[copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 14 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/^copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 15 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/{copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 16 -- +Copy operation => +Warning: copy(%s): %s +bool(false) +Existence of destination file => bool(false) + +-- Iteration 17 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/~copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 18 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/$copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation2.phpt b/ext/standard/tests/file/copy_variation2.phpt new file mode 100644 index 0000000..d99f5a8 --- /dev/null +++ b/ext/standard/tests/file/copy_variation2.phpt @@ -0,0 +1,237 @@ +--TEST-- +Test copy() function: usage variations - destination file names(special chars) +--SKIPIF-- + +--FILE-- +copy_variation2.tmp", + "!copy_variation2.tmp", + "©_variation2.tmp", + "(copy_variation2.tmp", + ":copy_variation2.tmp", + ";copy_variation2.tmp", + "=copy_variation2.tmp", + "[copy_variation2.tmp", + "^copy_variation2.tmp", + "{copy_variation2.tmp", + "|copy_variation2.tmp", + "~copy_variation2.tmp", + "\$copy_variation2.tmp" +); + +echo "Size of the source file before copy operation => "; +var_dump( filesize("$src_file_name") ); +clearstatcache(); + +echo "\n--- Now applying copy() on source file to create copies ---"; +$count = 1; +foreach($dest_files as $dest_file) { + echo "\n-- Iteration $count --\n"; + $dest_file_name = $file_path."/$dest_file"; + + echo "Copy operation => "; + var_dump( copy($src_file_name, $dest_file_name) ); + + echo "Existence of destination file => "; + var_dump( file_exists($dest_file_name) ); + + echo "Destination file name => "; + print($dest_file_name); + echo "\n"; + + echo "Size of source file => "; + var_dump( filesize($src_file_name) ); + clearstatcache(); + + echo "Size of destination file => "; + var_dump( filesize($dest_file_name) ); + clearstatcache(); + + unlink($dest_file_name); + + $count++; +} + +echo "*** Done ***\n"; +?> + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: destination file names containing special characters *** +Size of the source file before copy operation => int(1500) + +--- Now applying copy() on source file to create copies --- +-- Iteration 1 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/_copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 2 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/@copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 3 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/#copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 4 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/+copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 5 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/*copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 6 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/?copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 7 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/ int(1500) +Size of destination file => int(1500) + +-- Iteration 8 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/>copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 9 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/!copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 10 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/©_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 11 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/(copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 12 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/:copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 13 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/;copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 14 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/=copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 15 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/[copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 16 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/^copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 17 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/{copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 18 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/|copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 19 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/~copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 20 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/$copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation3-win32.phpt b/ext/standard/tests/file/copy_variation3-win32.phpt new file mode 100644 index 0000000..68ce4a1 --- /dev/null +++ b/ext/standard/tests/file/copy_variation3-win32.phpt @@ -0,0 +1,109 @@ +--TEST-- +Test copy() function: usage variations - destination file names(white spaces) +--SKIPIF-- + +--FILE-- + "; +var_dump( filesize("$src_file_name") ); +clearstatcache(); + +echo "\n-- Now applying copy() on source file to create copies --"; +$count = 1; +foreach($dest_files as $dest_file) { + + echo "\n-- Iteration $count --\n"; + $dest_file_name = $dest_file; + + echo "Copy operation => "; + var_dump( copy($src_file_name, $dest_file_name) ); + + echo "Existence of destination file => "; + var_dump( file_exists($dest_file_name) ); + + if( file_exists($dest_file_name) ) { + echo "Destination file name => "; + print($dest_file_name); + echo "\n"; + + echo "Size of source file => "; + var_dump( filesize($src_file_name) ); + clearstatcache(); + + echo "Size of destination file => "; + var_dump( filesize($dest_file_name) ); + clearstatcache(); + + unlink($dest_file_name); + } + $count++; +} + +echo "*** Done ***\n"; +?> + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: destination file names containing whitespaces *** +Size of the source file before copy operation => int(1500) + +-- Now applying copy() on source file to create copies -- +-- Iteration 1 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => copy variation3.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 2 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => copy_variation3.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 3 -- +Copy operation => +Warning: copy(%s): %s +bool(false) +Existence of destination file => bool(false) + +-- Iteration 4 -- +Copy operation => +Warning: copy(%s): %s +bool(false) +Existence of destination file => bool(false) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation3.phpt b/ext/standard/tests/file/copy_variation3.phpt new file mode 100644 index 0000000..1c45c8c --- /dev/null +++ b/ext/standard/tests/file/copy_variation3.phpt @@ -0,0 +1,110 @@ +--TEST-- +Test copy() function: usage variations - destination file names(white spaces) +--SKIPIF-- + +--FILE-- + "; +var_dump( filesize("$src_file_name") ); +clearstatcache(); + +echo "\n-- Now applying copy() on source file to create copies --"; +$count = 1; +foreach($dest_files as $dest_file) { + + echo "\n-- Iteration $count --\n"; + $dest_file_name = $dest_file; + + echo "Copy operation => "; + var_dump( copy($src_file_name, $dest_file_name) ); + + echo "Existence of destination file => "; + var_dump( file_exists($dest_file_name) ); + + echo "Destination file name => "; + print($dest_file_name); + echo "\n"; + + echo "Size of source file => "; + var_dump( filesize($src_file_name) ); + clearstatcache(); + + echo "Size of destination file => "; + var_dump( filesize($dest_file_name) ); + clearstatcache(); + + unlink($dest_file_name); + + $count++; +} + +echo "*** Done ***\n"; +?> + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: destination file names containing whitespaces *** +Size of the source file before copy operation => int(1500) + +-- Now applying copy() on source file to create copies -- +-- Iteration 1 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => copy variation3.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 2 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => copy_variation3.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 3 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => copy variation3.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 4 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => +Size of source file => int(1500) +Size of destination file => int(1500) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation4.phpt b/ext/standard/tests/file/copy_variation4.phpt new file mode 100644 index 0000000..3c8224d Binary files /dev/null and b/ext/standard/tests/file/copy_variation4.phpt differ diff --git a/ext/standard/tests/file/copy_variation5-win32.phpt b/ext/standard/tests/file/copy_variation5-win32.phpt new file mode 100644 index 0000000..baf7be4 --- /dev/null +++ b/ext/standard/tests/file/copy_variation5-win32.phpt @@ -0,0 +1,111 @@ +--TEST-- +Test copy() function: usage variations - destination file names(case sensitive) +--SKIPIF-- + +--FILE-- + "; +var_dump( filesize($src_file_name) ); +clearstatcache(); + +echo "\n-- Now applying copy() on source file to create copies --"; +$count = 1; +foreach($dest_files as $dest_file) { + + echo "\n-- Iteration $count --\n"; + $dest_file_name = $file_path."/$dest_file"; + + echo "Copy operation => "; + var_dump( copy($src_file_name, $dest_file_name) ); + + echo "Existence of destination file => "; + var_dump( file_exists($dest_file_name) ); + + echo "Destination file name => "; + print($dest_file_name); + echo "\n"; + + echo "Size of source file => "; + var_dump( filesize($src_file_name) ); + clearstatcache(); + + echo "Size of destination file => "; + var_dump( filesize($dest_file_name) ); + clearstatcache(); + + $count++; +} + + +$count = 1; +foreach($dest_files as $dest_file) { + unlink($file_path."/".$dest_file); + $count++; +} + +echo "*** Done ***\n"; +?> + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: checking case sensitivity in creation of destination file names *** +Size of the source file before copy operation => int(1500) + +-- Now applying copy() on source file to create copies -- +-- Iteration 1 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/COPY.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 2 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/COPY.TMP +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 3 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/CopY.TMP +Size of source file => int(1500) +Size of destination file => int(1500) + +Warning: unlink(%s/COPY.TMP): No such file or directory in %s on line %d + +Warning: unlink(%s/CopY.TMP): No such file or directory in %s on line %d +*** Done *** diff --git a/ext/standard/tests/file/copy_variation5.phpt b/ext/standard/tests/file/copy_variation5.phpt new file mode 100644 index 0000000..8abc9c9 --- /dev/null +++ b/ext/standard/tests/file/copy_variation5.phpt @@ -0,0 +1,106 @@ +--TEST-- +Test copy() function: usage variations - destination file names(case sensitive) +--SKIPIF-- + +--FILE-- + "; +var_dump( filesize($src_file_name) ); +clearstatcache(); + +echo "\n-- Now applying copy() on source file to create copies --"; +$count = 1; +foreach($dest_files as $dest_file) { + + echo "\n-- Iteration $count --\n"; + $dest_file_name = $file_path."/$dest_file"; + + echo "Copy operation => "; + var_dump( copy($src_file_name, $dest_file_name) ); + + echo "Existence of destination file => "; + var_dump( file_exists($dest_file_name) ); + + echo "Destination file name => "; + print($dest_file_name); + echo "\n"; + + echo "Size of source file => "; + var_dump( filesize($src_file_name) ); + clearstatcache(); + + echo "Size of destination file => "; + var_dump( filesize($dest_file_name) ); + clearstatcache(); + + $count++; +} + +$count = 1; +foreach($dest_files as $dest_file) { + unlink($file_path."/".$dest_file); + $count++; +} + +echo "*** Done ***\n"; +?> + +--CLEAN-- + + +--EXPECTF-- +*** Test copy() function: checking case sensitivity in creation of destination file names *** +Size of the source file before copy operation => int(1500) + +-- Now applying copy() on source file to create copies -- +-- Iteration 1 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/COPY.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 2 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/COPY.TMP +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 3 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/CopY.TMP +Size of source file => int(1500) +Size of destination file => int(1500) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation6-win32.phpt b/ext/standard/tests/file/copy_variation6-win32.phpt new file mode 100644 index 0000000..524b21d --- /dev/null +++ b/ext/standard/tests/file/copy_variation6-win32.phpt @@ -0,0 +1,143 @@ +--TEST-- +Test copy() function: usage variations - copy empty file across dirs +--SKIPIF-- + +--FILE-- + "; +var_dump( filesize($src_file_name) ); +clearstatcache(); + +$dests = array( + $base_dir."/copy_copy_variation6.tmp", + $base_dir."/copy_variation6_sub/copy_copy_variation6.tmp", + "$sub_dir/copy_copy_variation6.tmp", + "$sub_dir/../copy_copy_variation6.tmp", + "$sub_dir/../copy_variation6_sub/copy_copy_variation6.tmp", + "$sub_dir/..///../copy_copy_variation6.tmp", + "$sub_dir/..///../*", + "$dirname_with_blank/copy_copy_variation6.tmp" +); + +echo "\n-- Now applying copy() on source file to create copies --"; +$count = 1; +foreach($dests as $dest) { + echo "\n-- Iteration $count --\n"; + + echo "Copy operation => "; + var_dump( copy($src_file_name, $dest) ); + + echo "Existence of destination file => "; + var_dump( file_exists($dest) ); + + if( file_exists($dest) ) { + echo "Destination file name is => "; + print($dest); + echo "\n"; + + echo "Size of source file => "; + var_dump( filesize($src_file_name) ); + clearstatcache(); + + echo "Size of destination file => "; + var_dump( filesize($dest) ); + clearstatcache(); + + unlink("$dest"); + } + + $count++; +} + +unlink($src_file_name); +rmdir($dirname_with_blank); +rmdir($sub_dir); +rmdir($base_dir); + +echo "*** Done ***\n"; +?> + +--EXPECTF-- +*** Test copy() function: copying file across directories *** +Size of source file => int(0) + +-- Now applying copy() on source file to create copies -- +-- Iteration 1 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_copy_variation6.tmp +Size of source file => int(0) +Size of destination file => int(0) + +-- Iteration 2 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_variation6_sub/copy_copy_variation6.tmp +Size of source file => int(0) +Size of destination file => int(0) + +-- Iteration 3 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_variation6_sub/copy_copy_variation6.tmp +Size of source file => int(0) +Size of destination file => int(0) + +-- Iteration 4 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_variation6_sub/../copy_copy_variation6.tmp +Size of source file => int(0) +Size of destination file => int(0) + +-- Iteration 5 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_variation6_sub/../copy_variation6_sub/copy_copy_variation6.tmp +Size of source file => int(0) +Size of destination file => int(0) + +-- Iteration 6 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_variation6_sub/..///../copy_copy_variation6.tmp +Size of source file => int(0) +Size of destination file => int(0) + +-- Iteration 7 -- +Copy operation => +Warning: copy(%s/copy_variation6/copy_variation6_sub/..///../*): failed to open stream: No such file or directory in %s on line %d +bool(false) +Existence of destination file => bool(false) + +-- Iteration 8 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_variation6_sub/copy variation6/copy_copy_variation6.tmp +Size of source file => int(0) +Size of destination file => int(0) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation6.phpt b/ext/standard/tests/file/copy_variation6.phpt new file mode 100644 index 0000000..3213c6b --- /dev/null +++ b/ext/standard/tests/file/copy_variation6.phpt @@ -0,0 +1,142 @@ +--TEST-- +Test copy() function: usage variations - copy empty file across dirs +--SKIPIF-- + +--FILE-- + "; +var_dump( filesize($src_file_name) ); +clearstatcache(); + +$dests = array( + $base_dir."/copy_copy_variation6.tmp", + $base_dir."/copy_variation6_sub/copy_copy_variation6.tmp", + "$sub_dir/copy_copy_variation6.tmp", + "$sub_dir/../copy_copy_variation6.tmp", + "$sub_dir/../copy_variation6_sub/copy_copy_variation6.tmp", + "$sub_dir/..///../copy_copy_variation6.tmp", + "$sub_dir/..///../*", + "$dirname_with_blank/copy_copy_variation6.tmp" +); + +echo "\n-- Now applying copy() on source file to create copies --"; +$count = 1; +foreach($dests as $dest) { + echo "\n-- Iteration $count --\n"; + + echo "Copy operation => "; + var_dump( copy($src_file_name, $dest) ); + + echo "Existence of destination file => "; + var_dump( file_exists($dest) ); + + echo "Destination file name is => "; + print($dest); + echo "\n"; + + echo "Size of source file => "; + var_dump( filesize($src_file_name) ); + clearstatcache(); + + echo "Size of destination file => "; + var_dump( filesize($dest) ); + clearstatcache(); + + unlink("$dest"); + + $count++; +} + +unlink($src_file_name); +rmdir($dirname_with_blank); +rmdir($sub_dir); +rmdir($base_dir); + +echo "*** Done ***\n"; +?> + +--EXPECTF-- +*** Test copy() function: copying file across directories *** +Size of source file => int(0) + +-- Now applying copy() on source file to create copies -- +-- Iteration 1 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_copy_variation6.tmp +Size of source file => int(0) +Size of destination file => int(0) + +-- Iteration 2 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_variation6_sub/copy_copy_variation6.tmp +Size of source file => int(0) +Size of destination file => int(0) + +-- Iteration 3 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_variation6_sub/copy_copy_variation6.tmp +Size of source file => int(0) +Size of destination file => int(0) + +-- Iteration 4 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_variation6_sub/../copy_copy_variation6.tmp +Size of source file => int(0) +Size of destination file => int(0) + +-- Iteration 5 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_variation6_sub/../copy_variation6_sub/copy_copy_variation6.tmp +Size of source file => int(0) +Size of destination file => int(0) + +-- Iteration 6 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_variation6_sub/..///../copy_copy_variation6.tmp +Size of source file => int(0) +Size of destination file => int(0) + +-- Iteration 7 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_variation6_sub/..///../* +Size of source file => int(0) +Size of destination file => int(0) + +-- Iteration 8 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name is => %s/copy_variation6/copy_variation6_sub/copy variation6/copy_copy_variation6.tmp +Size of source file => int(0) +Size of destination file => int(0) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation7.phpt b/ext/standard/tests/file/copy_variation7.phpt new file mode 100644 index 0000000..d687b07 --- /dev/null +++ b/ext/standard/tests/file/copy_variation7.phpt @@ -0,0 +1,86 @@ +--TEST-- +Test copy() function: usage variations - links +--SKIPIF-- + + +--FILE-- + \n"; +var_dump( filesize($file_path."/copy_variation7_symlink.tmp") ); //size of the symlink itself +clearstatcache(); +var_dump( filesize($file_path."/copy_variation7_hardlink.tmp") ); //size of the file +clearstatcache(); + +echo "-- Now applying copy() on source link to create copies --\n"; +echo "-- With symlink --\n"; +var_dump( copy($symlink, $file_path."/copy_copy_variation7_symlink.tmp") ); +var_dump( file_exists($file_path."/copy_copy_variation7_symlink.tmp") ); +var_dump( is_link($file_path."/copy_copy_variation7_symlink.tmp") ); +var_dump( is_file($file_path."/copy_copy_variation7_symlink.tmp") ); +var_dump( filesize($file_path."/copy_copy_variation7_symlink.tmp") ); +clearstatcache(); + +echo "-- With hardlink --\n"; +var_dump( copy($hardlink, $file_path."/copy_copy_variation7_hardlink.tmp") ); +var_dump( file_exists($file_path."/copy_copy_variation7_hardlink.tmp") ); +var_dump( is_link($file_path."/copy_copy_variation7_hardlink.tmp") ); +var_dump( is_file($file_path."/copy_copy_variation7_hardlink.tmp") ); +var_dump( filesize($file_path."/copy_copy_variation7_hardlink.tmp") ); +clearstatcache(); + +echo "*** Done ***\n"; +?> + +--CLEAN-- + + +--EXPECTF-- +*** Testing copy() with symlink and hardlink *** +Size of source files => +int(%d) +int(3600) +-- Now applying copy() on source link to create copies -- +-- With symlink -- +bool(true) +bool(true) +bool(false) +bool(true) +int(3600) +-- With hardlink -- +bool(true) +bool(true) +bool(false) +bool(true) +int(3600) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation8.phpt b/ext/standard/tests/file/copy_variation8.phpt new file mode 100644 index 0000000..63f57f3 --- /dev/null +++ b/ext/standard/tests/file/copy_variation8.phpt @@ -0,0 +1,176 @@ +--TEST-- +Test copy() function: usage variations - copying links across dirs +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing copy() function: copying links across different directories *** + +-- Iteration 1 -- +- With symlink - +bool(true) +bool(true) +bool(false) +bool(true) +- With hardlink - +bool(true) +bool(true) +bool(false) +bool(true) + +-- Iteration 2 -- +- With symlink - +bool(true) +bool(true) +bool(false) +bool(true) +- With hardlink - +bool(true) +bool(true) +bool(false) +bool(true) + +-- Iteration 3 -- +- With symlink - +bool(true) +bool(true) +bool(false) +bool(true) +- With hardlink - +bool(true) +bool(true) +bool(false) +bool(true) + +-- Iteration 4 -- +- With symlink - +bool(true) +bool(true) +bool(false) +bool(true) +- With hardlink - +bool(true) +bool(true) +bool(false) +bool(true) + +-- Iteration 5 -- +- With symlink - +bool(true) +bool(true) +bool(false) +bool(true) +- With hardlink - +bool(true) +bool(true) +bool(false) +bool(true) + +-- Iteration 6 -- +- With symlink - +bool(true) +bool(true) +bool(false) +bool(true) +- With hardlink - +bool(true) +bool(true) +bool(false) +bool(true) + +-- Iteration 7 -- +- With symlink - +bool(true) +bool(true) +bool(false) +bool(true) +- With hardlink - +bool(true) +bool(true) +bool(false) +bool(true) + +-- Iteration 8 -- +- With symlink - +bool(true) +bool(true) +bool(false) +bool(true) +- With hardlink - +bool(true) +bool(true) +bool(false) +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/copy_variation9.phpt b/ext/standard/tests/file/copy_variation9.phpt new file mode 100644 index 0000000..824bed0 --- /dev/null +++ b/ext/standard/tests/file/copy_variation9.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test copy() function: usage variations - destination file access perms +--SKIPIF-- + +--FILE-- + + +--CLEAN-- + +--EXPECTF-- +*** Test copy() function: destination with/without write permissions *** + +-- With write permissions -- +bool(true) +bool(true) +bool(true) +int(1500) + +-- Without write permissions -- +bool(true) + +Warning: %s +bool(false) +bool(true) +int(1500) +*** Done *** diff --git a/ext/standard/tests/file/directory_wrapper_fstat_basic.phpt b/ext/standard/tests/file/directory_wrapper_fstat_basic.phpt new file mode 100644 index 0000000..87f8523 --- /dev/null +++ b/ext/standard/tests/file/directory_wrapper_fstat_basic.phpt @@ -0,0 +1,13 @@ +--TEST-- +Test function fstat() on directory wrapper +--FILE-- + +===DONE=== +--EXPECT-- +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/dirname_basic-win32.phpt b/ext/standard/tests/file/dirname_basic-win32.phpt new file mode 100644 index 0000000..61a6e33 --- /dev/null +++ b/ext/standard/tests/file/dirname_basic-win32.phpt @@ -0,0 +1,93 @@ +--TEST-- +Test dirname() function : basic functionality +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing dirname() : basic functionality *** +string(0) "" +string(1) "." +string(2) "c:" +string(3) "c:\" +string(3) "c:\" +string(1) "." +string(7) "c:\test" +string(7) "c:\test" +string(8) "c://test" +string(7) "c:\test" +string(15) "/usr/lib/locale" +string(17) "//usr/lib//locale" +string(1) "\" +string(1) "\" +string(1) "\" +string(1) "\" +string(1) "\" +string(15) "/usr/lib/locale" +string(31) "c:\windows/system32\drivers/etc" +string(15) "/usr\lib/locale" +string(15) " c:\test\adir" +string(12) "c:\test\adir" +string(15) " c:\test\adir" +string(18) " /usr/lib/locale" +string(15) "/usr/lib/locale" +string(18) " /usr/lib/locale" +string(1) "." +string(14) " c:\test\adir" +string(1) "\" +string(1) "\" +===DONE=== diff --git a/ext/standard/tests/file/dirname_basic.phpt b/ext/standard/tests/file/dirname_basic.phpt new file mode 100644 index 0000000..8f1944e --- /dev/null +++ b/ext/standard/tests/file/dirname_basic.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test dirname() function : basic functionality +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing dirname() : basic functionality *** +string(0) "" +string(1) "." +string(1) "." +string(1) "." +string(1) "." +string(1) "." +string(1) "." +string(1) "." +string(8) "c://test" +string(1) "." +string(15) "/usr/lib/locale" +string(17) "//usr/lib//locale" +string(1) "." +string(1) "." +string(1) "/" +string(1) "/" +string(1) "/" +string(15) "/usr/lib/locale" +string(27) "c:\windows/system32\drivers" +string(8) "/usr\lib" +string(1) "." +string(1) "." +string(1) "." +string(18) " /usr/lib/locale" +string(15) "/usr/lib/locale" +string(18) " /usr/lib/locale" +string(1) "." +string(1) "." +string(1) "/" +string(1) "/" +===DONE=== + diff --git a/ext/standard/tests/file/dirname_error.phpt b/ext/standard/tests/file/dirname_error.phpt new file mode 100644 index 0000000..dc7814f --- /dev/null +++ b/ext/standard/tests/file/dirname_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test dirname() function : error conditions +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing dirname() : error conditions *** + +-- Testing dirname() function with Zero arguments -- + +Warning: dirname() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing dirname() function with more than expected no. of arguments -- + +Warning: dirname() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===DONE=== + diff --git a/ext/standard/tests/file/dirname_variation1.phpt b/ext/standard/tests/file/dirname_variation1.phpt new file mode 100644 index 0000000..15041ff --- /dev/null +++ b/ext/standard/tests/file/dirname_variation1.phpt @@ -0,0 +1,190 @@ +--TEST-- +Test dirname() function : usage variation +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for path + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( dirname($value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing dirname() : usage variation *** + +--int 0-- +string(1) "." + +--int 1-- +string(1) "." + +--int 12345-- +string(1) "." + +--int -12345-- +string(1) "." + +--float 10.5-- +string(1) "." + +--float -10.5-- +string(1) "." + +--float 12.3456789000e10-- +string(1) "." + +--float -12.3456789000e10-- +string(1) "." + +--float .5-- +string(1) "." + +--empty array-- +Error: 2 - dirname() expects parameter 1 to be string, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - dirname() expects parameter 1 to be string, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - dirname() expects parameter 1 to be string, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - dirname() expects parameter 1 to be string, array given, %s(%d) +NULL + +--uppercase NULL-- +string(0) "" + +--lowercase null-- +string(0) "" + +--lowercase true-- +string(1) "." + +--lowercase false-- +string(0) "" + +--uppercase TRUE-- +string(1) "." + +--uppercase FALSE-- +string(0) "" + +--empty string DQ-- +string(0) "" + +--empty string SQ-- +string(0) "" + +--instance of classWithToString-- +string(1) "." + +--instance of classWithoutToString-- +Error: 2 - dirname() expects parameter 1 to be string, object given, %s(%d) +NULL + +--undefined var-- +string(0) "" + +--unset var-- +string(0) "" +===DONE=== + diff --git a/ext/standard/tests/file/disk.phpt b/ext/standard/tests/file/disk.phpt new file mode 100644 index 0000000..6eef4b4 --- /dev/null +++ b/ext/standard/tests/file/disk.phpt @@ -0,0 +1,48 @@ +--TEST-- +disk_total_space() and disk_free_space() tests +--INI-- +precision=14 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: disk_free_space(): No such file or directory in %s on line %d +bool(false) + +Warning: disk_total_space(): No such file or directory in %s on line %d +bool(false) +float(%d) +float(%d) + +Warning: disk_free_space(): No such file or directory in %s on line %d +bool(false) + +Warning: disk_total_space(): No such file or directory in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/file/disk_free_space_basic.phpt b/ext/standard/tests/file/disk_free_space_basic.phpt new file mode 100644 index 0000000..7ea8d36 --- /dev/null +++ b/ext/standard/tests/file/disk_free_space_basic.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test disk_free_space and its alias diskfreespace() functions : basic functionality +--INI-- +memory_limit=32M +--FILE-- + $space2 ) + echo "\n Free Space Value Is Correct\n"; +else + echo "\n Free Space Value Is Incorrect\n"; + +echo "*** Testing with Binary Input ***\n"; +var_dump( disk_free_space(b"$file_path") ); + +echo"\n--- Done ---"; +?> + +--CLEAN-- + + +--EXPECTF-- +*** Testing with existing directory *** +float(%d) +float(%d) +*** Testing with newly created directory *** + + Free Space before writing to a file +float(%d) + + Free Space after writing to a file +float(%d) + + Free Space Value Is Correct +*** Testing with Binary Input *** +float(%d) + +--- Done --- diff --git a/ext/standard/tests/file/disk_free_space_error-win32.phpt b/ext/standard/tests/file/disk_free_space_error-win32.phpt new file mode 100644 index 0000000..21e7bf6 --- /dev/null +++ b/ext/standard/tests/file/disk_free_space_error-win32.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test disk_free_space and its alias diskfreespace() functions : error conditions +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing error conditions *** + +Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: disk_free_space(): The system cannot find the path specified. + in %s on line %d +bool(false) + +Warning: diskfreespace(): The system cannot find the path specified. + in %s on line %d +bool(false) + +Warning: disk_free_space(): The directory name is invalid. + in %s on line %d +bool(false) + +Warning: diskfreespace(): The directory name is invalid. + in %s on line %d +bool(false) + +-- Done -- + diff --git a/ext/standard/tests/file/disk_free_space_error.phpt b/ext/standard/tests/file/disk_free_space_error.phpt new file mode 100644 index 0000000..ddd25a3 --- /dev/null +++ b/ext/standard/tests/file/disk_free_space_error.phpt @@ -0,0 +1,67 @@ +--TEST-- +Test disk_free_space and its alias diskfreespace() functions : error conditions. +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing error conditions *** + +Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: disk_free_space(): No such file or directory in %s on line %d +bool(false) + +Warning: diskfreespace(): No such file or directory in %s on line %d +bool(false) +float(%d) +float(%d) + +-- Done -- + diff --git a/ext/standard/tests/file/disk_free_space_variation.phpt b/ext/standard/tests/file/disk_free_space_variation.phpt new file mode 100644 index 0000000..adb1aca --- /dev/null +++ b/ext/standard/tests/file/disk_free_space_variation.phpt @@ -0,0 +1,139 @@ +--TEST-- +Test disk_free_space and its alias diskfreespace() functions : Usage Variations +--FILE-- + + +--CLEAN-- + + + +--EXPECTF-- +*** Testing with a directory *** +float(%d) +float(%d) + +Testing for the return type *** +bool(true) + +*** Testing with different directory combinations *** +-- Iteration 1 -- +float(%d) +float(%d) + +-- Iteration 2 -- +float(%d) +float(%d) + +-- Iteration 3 -- +float(%d) +float(%d) + +-- Iteration 4 -- +float(%d) +float(%d) + +-- Iteration 5 -- +float(%d) +float(%d) + +-- Iteration 6 -- +float(%d) +float(%d) + +-- Iteration 7 -- +float(%d) +float(%d) + +-- Iteration 8 -- +float(%d) +float(%d) + +-- Iteration 9 -- + +Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +--- Done --- diff --git a/ext/standard/tests/file/disk_total_space_basic.phpt b/ext/standard/tests/file/disk_total_space_basic.phpt new file mode 100644 index 0000000..d211f39 --- /dev/null +++ b/ext/standard/tests/file/disk_total_space_basic.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test disk_total_space() function : basic functionality +--FILE-- + +--CLEAN-- + + +--EXPECTF-- +*** Testing with normal directory *** +float(%d) +*** Testing with newly created directory *** +float(%d) + +Total Space after writing to a file +float(%d) + +-- Done -- diff --git a/ext/standard/tests/file/disk_total_space_error-win32.phpt b/ext/standard/tests/file/disk_total_space_error-win32.phpt new file mode 100644 index 0000000..a3ea183 --- /dev/null +++ b/ext/standard/tests/file/disk_total_space_error-win32.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test disk_total_space() function : error conditions +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing error conditions *** + +Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: disk_total_space(): The system cannot find the path specified. + in %s on line %d +bool(false) + +Warning: disk_total_space(): The directory name is invalid. + in %s on line %d +bool(false) + +--- Done --- + diff --git a/ext/standard/tests/file/disk_total_space_error.phpt b/ext/standard/tests/file/disk_total_space_error.phpt new file mode 100644 index 0000000..d986f77 --- /dev/null +++ b/ext/standard/tests/file/disk_total_space_error.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test disk_total_space() function : error conditions +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing error conditions *** + +Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: disk_total_space(): No such file or directory in %s on line %d +bool(false) +float(%d) + +--- Done --- + diff --git a/ext/standard/tests/file/disk_total_space_variation.phpt b/ext/standard/tests/file/disk_total_space_variation.phpt new file mode 100644 index 0000000..ba2ceb2 --- /dev/null +++ b/ext/standard/tests/file/disk_total_space_variation.phpt @@ -0,0 +1,123 @@ +--TEST-- +Testing disk_total_space() functions : Usage Variations. +--FILE-- + + +--CLEAN-- + + + +--EXPECTF-- +*** Testing with a directory *** +float(%d) + +Testing for the return type *** +bool(true) + +*** Testing with different directory combinations *** +-- Iteration 1 -- +float(%d) + +-- Iteration 2 -- +float(%d) + +-- Iteration 3 -- +float(%d) + +-- Iteration 4 -- +float(%d) + +-- Iteration 5 -- +float(%d) + +-- Iteration 6 -- +float(%d) + +-- Iteration 7 -- +float(%d) + +-- Iteration 8 -- +float(%d) + +-- Iteration 9 -- + +Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d +NULL +*** Testing with Binary Input *** +float(%d) + +--- Done --- diff --git a/ext/standard/tests/file/fclose_variation1.phpt b/ext/standard/tests/file/fclose_variation1.phpt new file mode 100644 index 0000000..43a6c34 --- /dev/null +++ b/ext/standard/tests/file/fclose_variation1.phpt @@ -0,0 +1,15 @@ +--TEST-- +fclose() actually closes streams with refcount > 1 +--FILE-- + +--FILE-- + +--EXPECTF-- +*** Testing feof() : basic functionality *** + +*** testing reading complete file using feof to stop *** +some data 10 +bool(false) +*** writing 10 lines, testing feof *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +*** testing feof on unclosed file after a read *** +bool(true) +*** testing feof after a seek to near the beginning *** +bool(false) +*** testing feof after a seek to end *** +bool(false) +*** testing feof after a seek passed the end *** +bool(false) +*** closing file, testing eof *** + +Warning: feof(): %d is not a valid stream resource in %s on line %d +Done diff --git a/ext/standard/tests/file/fflush_basic.phpt b/ext/standard/tests/file/fflush_basic.phpt new file mode 100644 index 0000000..f375c4f --- /dev/null +++ b/ext/standard/tests/file/fflush_basic.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test fflush() function: basic functionality +--FILE-- + + +--CLEAN-- + + +--EXPECTF-- +*** Testing fflush(): writing to a file and reading the contents *** +int(63) +bool(true) +first line of string +second line of string +third line of stringint(63) + +*** Testing fflush(): for return type *** +bool(true) + +*** Done *** diff --git a/ext/standard/tests/file/fflush_error.phpt b/ext/standard/tests/file/fflush_error.phpt new file mode 100644 index 0000000..6d7f731 --- /dev/null +++ b/ext/standard/tests/file/fflush_error.phpt @@ -0,0 +1,90 @@ +--TEST-- +Test fflush() function: error conditions +--FILE-- + + +--CLEAN-- + + +--EXPECTF-- +*** Testing error conditions *** +-- Testing fflush(): with zero argument -- + +Warning: fflush() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) +-- Testing fflush(): with more than expected number of arguments -- + +Warning: fflush() expects exactly 1 parameter, 2 given in %s on line %d +bool(false) +-- Testing fflush(): with invalid arguments -- +-- Iteration 1 -- + +Warning: fflush() expects parameter 1 to be resource, string given in %s on line %d +bool(false) +-- Iteration 2 -- + +Warning: fflush() expects parameter 1 to be resource, integer given in %s on line %d +bool(false) +-- Iteration 3 -- + +Warning: fflush() expects parameter 1 to be resource, double given in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: fflush() expects parameter 1 to be resource, boolean given in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: fflush() expects parameter 1 to be resource, array given in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: fflush() expects parameter 1 to be resource, object given in %s on line %d +bool(false) + +*** Done *** + diff --git a/ext/standard/tests/file/fflush_variation1-win32.phpt b/ext/standard/tests/file/fflush_variation1-win32.phpt new file mode 100644 index 0000000..0b6b096 --- /dev/null +++ b/ext/standard/tests/file/fflush_variation1-win32.phpt @@ -0,0 +1,531 @@ +--TEST-- +Test fflush() function: usage variations - files in different modes +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +*** Testing fflush(): with various types of files *** +-- Iteration 1 with file containing empty Data-- +-- File opened in w mode -- +bool(true) +bool(true) +int(0) +-- File opened in wb mode -- +bool(true) +bool(true) +int(0) +-- File opened in wt mode -- +bool(true) +bool(true) +int(0) +-- File opened in w+ mode -- +bool(true) +bool(true) +int(0) +-- File opened in w+b mode -- +bool(true) +bool(true) +int(0) +-- File opened in w+t mode -- +bool(true) +bool(true) +int(0) +-- File opened in a mode -- +bool(true) +bool(true) +int(0) +-- File opened in ab mode -- +bool(true) +bool(true) +int(0) +-- File opened in at mode -- +bool(true) +bool(true) +int(0) +-- File opened in a+ mode -- +bool(true) +bool(true) +int(0) +-- File opened in a+b mode -- +bool(true) +bool(true) +int(0) +-- File opened in a+t mode -- +bool(true) +bool(true) +int(0) +-- File opened in x mode -- +bool(true) +bool(true) +int(0) +-- File opened in xb mode -- +bool(true) +bool(true) +int(0) +-- File opened in xt mode -- +bool(true) +bool(true) +int(0) +-- File opened in x+ mode -- +bool(true) +bool(true) +int(0) +-- File opened in x+b mode -- +bool(true) +bool(true) +int(0) +-- File opened in x+t mode -- +bool(true) +bool(true) +int(0) +-- Iteration 2 with file containing numeric Data-- +-- File opened in w mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in wb mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in wt mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in w+ mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in w+b mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in w+t mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in a mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in ab mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in at mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in a+ mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in a+b mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in a+t mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in x mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in xb mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in xt mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in x+ mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in x+b mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in x+t mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- Iteration 3 with file containing text Data-- +-- File opened in w mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in wb mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in wt mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in w+ mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in w+b mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in w+t mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in a mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in ab mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in at mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in a+ mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in a+b mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in a+t mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in x mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in xb mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in xt mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in x+ mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in x+b mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in x+t mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- Iteration 4 with file containing text_with_new_line Data-- +-- File opened in w mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in wb mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in wt mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(55) +-- File opened in w+ mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in w+b mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in w+t mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(55) +-- File opened in a mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- File opened in ab mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- File opened in at mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(65) +-- File opened in a+ mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- File opened in a+b mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- File opened in a+t mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(65) +-- File opened in x mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in xb mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in xt mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(55) +-- File opened in x+ mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in x+b mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in x+t mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(55) +-- Iteration 5 with file containing alphanumeric Data-- +-- File opened in w mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in wb mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in wt mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in w+ mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in w+b mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in w+t mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in a mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in ab mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in at mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in a+ mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in a+b mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in a+t mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in x mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in xb mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in xt mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in x+ mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in x+b mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in x+t mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) + +*** Done *** + diff --git a/ext/standard/tests/file/fflush_variation1.phpt b/ext/standard/tests/file/fflush_variation1.phpt new file mode 100644 index 0000000..2ecf7ea --- /dev/null +++ b/ext/standard/tests/file/fflush_variation1.phpt @@ -0,0 +1,532 @@ +--TEST-- +Test fflush() function: usage variations - files in different modes +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +*** Testing fflush(): with various types of files *** +-- Iteration 1 with file containing empty Data-- +-- File opened in w mode -- +bool(true) +bool(true) +int(0) +-- File opened in wb mode -- +bool(true) +bool(true) +int(0) +-- File opened in wt mode -- +bool(true) +bool(true) +int(0) +-- File opened in w+ mode -- +bool(true) +bool(true) +int(0) +-- File opened in w+b mode -- +bool(true) +bool(true) +int(0) +-- File opened in w+t mode -- +bool(true) +bool(true) +int(0) +-- File opened in a mode -- +bool(true) +bool(true) +int(0) +-- File opened in ab mode -- +bool(true) +bool(true) +int(0) +-- File opened in at mode -- +bool(true) +bool(true) +int(0) +-- File opened in a+ mode -- +bool(true) +bool(true) +int(0) +-- File opened in a+b mode -- +bool(true) +bool(true) +int(0) +-- File opened in a+t mode -- +bool(true) +bool(true) +int(0) +-- File opened in x mode -- +bool(true) +bool(true) +int(0) +-- File opened in xb mode -- +bool(true) +bool(true) +int(0) +-- File opened in xt mode -- +bool(true) +bool(true) +int(0) +-- File opened in x+ mode -- +bool(true) +bool(true) +int(0) +-- File opened in x+b mode -- +bool(true) +bool(true) +int(0) +-- File opened in x+t mode -- +bool(true) +bool(true) +int(0) +-- Iteration 2 with file containing numeric Data-- +-- File opened in w mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in wb mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in wt mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in w+ mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in w+b mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in w+t mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in a mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in ab mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in at mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in a+ mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in a+b mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in a+t mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in x mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in xb mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in xt mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in x+ mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in x+b mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in x+t mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- Iteration 3 with file containing text Data-- +-- File opened in w mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in wb mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in wt mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in w+ mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in w+b mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in w+t mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in a mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in ab mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in at mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in a+ mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in a+b mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in a+t mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in x mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in xb mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in xt mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in x+ mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in x+b mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in x+t mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- Iteration 4 with file containing text_with_new_line Data-- +-- File opened in w mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in wb mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in wt mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in w+ mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in w+b mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in w+t mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in a mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- File opened in ab mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- File opened in at mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- File opened in a+ mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- File opened in a+b mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- File opened in a+t mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- File opened in x mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in xb mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in xt mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in x+ mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in x+b mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in x+t mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- Iteration 5 with file containing alphanumeric Data-- +-- File opened in w mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in wb mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in wt mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in w+ mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in w+b mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in w+t mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in a mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in ab mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in at mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in a+ mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in a+b mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in a+t mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in x mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in xb mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in xt mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in x+ mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in x+b mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in x+t mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) + +*** Done *** + diff --git a/ext/standard/tests/file/fflush_variation2.phpt b/ext/standard/tests/file/fflush_variation2.phpt new file mode 100644 index 0000000..651c716 --- /dev/null +++ b/ext/standard/tests/file/fflush_variation2.phpt @@ -0,0 +1,443 @@ +--TEST-- +Test fflush() function: usage variations - links as resource +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing fflush(): with soft links to files opened in diff modes *** +-- Iteration 1 with file containing empty data -- +-- link opened in w mode -- +bool(true) +bool(true) +bool(true) +int(0) +-- link opened in wb mode -- +bool(true) +bool(true) +bool(true) +int(0) +-- link opened in wt mode -- +bool(true) +bool(true) +bool(true) +int(0) +-- link opened in w+ mode -- +bool(true) +bool(true) +bool(true) +int(0) +-- link opened in w+b mode -- +bool(true) +bool(true) +bool(true) +int(0) +-- link opened in w+t mode -- +bool(true) +bool(true) +bool(true) +int(0) +-- link opened in a mode -- +bool(true) +bool(true) +bool(true) +int(0) +-- link opened in ab mode -- +bool(true) +bool(true) +bool(true) +int(0) +-- link opened in at mode -- +bool(true) +bool(true) +bool(true) +int(0) +-- link opened in a+ mode -- +bool(true) +bool(true) +bool(true) +int(0) +-- link opened in a+b mode -- +bool(true) +bool(true) +bool(true) +int(0) +-- link opened in a+t mode -- +bool(true) +bool(true) +bool(true) +int(0) +-- Iteration 2 with file containing numeric data -- +-- link opened in w mode -- +bool(true) +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- link opened in wb mode -- +bool(true) +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- link opened in wt mode -- +bool(true) +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- link opened in w+ mode -- +bool(true) +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- link opened in w+b mode -- +bool(true) +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- link opened in w+t mode -- +bool(true) +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- link opened in a mode -- +bool(true) +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- link opened in ab mode -- +bool(true) +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- link opened in at mode -- +bool(true) +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- link opened in a+ mode -- +bool(true) +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- link opened in a+b mode -- +bool(true) +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- link opened in a+t mode -- +bool(true) +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- Iteration 3 with file containing text data -- +-- link opened in w mode -- +bool(true) +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- link opened in wb mode -- +bool(true) +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- link opened in wt mode -- +bool(true) +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- link opened in w+ mode -- +bool(true) +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- link opened in w+b mode -- +bool(true) +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- link opened in w+t mode -- +bool(true) +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- link opened in a mode -- +bool(true) +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- link opened in ab mode -- +bool(true) +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- link opened in at mode -- +bool(true) +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- link opened in a+ mode -- +bool(true) +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- link opened in a+b mode -- +bool(true) +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- link opened in a+t mode -- +bool(true) +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- Iteration 4 with file containing text_with_new_line data -- +-- link opened in w mode -- +bool(true) +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- link opened in wb mode -- +bool(true) +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- link opened in wt mode -- +bool(true) +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- link opened in w+ mode -- +bool(true) +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- link opened in w+b mode -- +bool(true) +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- link opened in w+t mode -- +bool(true) +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- link opened in a mode -- +bool(true) +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- link opened in ab mode -- +bool(true) +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- link opened in at mode -- +bool(true) +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- link opened in a+ mode -- +bool(true) +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- link opened in a+b mode -- +bool(true) +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- link opened in a+t mode -- +bool(true) +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- Iteration 5 with file containing alphanumeric data -- +-- link opened in w mode -- +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- link opened in wb mode -- +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- link opened in wt mode -- +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- link opened in w+ mode -- +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- link opened in w+b mode -- +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- link opened in w+t mode -- +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- link opened in a mode -- +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- link opened in ab mode -- +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- link opened in at mode -- +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- link opened in a+ mode -- +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- link opened in a+b mode -- +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- link opened in a+t mode -- +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) + +*** Done *** + diff --git a/ext/standard/tests/file/fflush_variation3.phpt b/ext/standard/tests/file/fflush_variation3.phpt new file mode 100644 index 0000000..6dfd49b --- /dev/null +++ b/ext/standard/tests/file/fflush_variation3.phpt @@ -0,0 +1,383 @@ +--TEST-- +Test fflush() function: usage variations - hard links as resource +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing fflush(): with hard links to files opened in diff modes *** +-- Iteration 1 with file containing empty data -- +bool(true) +bool(true) +bool(true) +int(0) +bool(true) +bool(true) +bool(true) +int(0) +bool(true) +bool(true) +bool(true) +int(0) +bool(true) +bool(true) +bool(true) +int(0) +bool(true) +bool(true) +bool(true) +int(0) +bool(true) +bool(true) +bool(true) +int(0) +bool(true) +bool(true) +bool(true) +int(0) +bool(true) +bool(true) +bool(true) +int(0) +bool(true) +bool(true) +bool(true) +int(0) +bool(true) +bool(true) +bool(true) +int(0) +bool(true) +bool(true) +bool(true) +int(0) +bool(true) +bool(true) +bool(true) +int(0) +-- Iteration 2 with file containing numeric data -- +bool(true) +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +bool(true) +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +bool(true) +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +bool(true) +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +bool(true) +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +bool(true) +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +bool(true) +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +bool(true) +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +bool(true) +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +bool(true) +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +bool(true) +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +bool(true) +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- Iteration 3 with file containing text data -- +bool(true) +bool(true) +bool(true) +text text text text text text text text text text int(50) +bool(true) +bool(true) +bool(true) +text text text text text text text text text text int(50) +bool(true) +bool(true) +bool(true) +text text text text text text text text text text int(50) +bool(true) +bool(true) +bool(true) +text text text text text text text text text text int(50) +bool(true) +bool(true) +bool(true) +text text text text text text text text text text int(50) +bool(true) +bool(true) +bool(true) +text text text text text text text text text text int(50) +bool(true) +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +bool(true) +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +bool(true) +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +bool(true) +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +bool(true) +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +bool(true) +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- Iteration 4 with file containing text_with_new_line data -- +bool(true) +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +bool(true) +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +bool(true) +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +bool(true) +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +bool(true) +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +bool(true) +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +bool(true) +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +bool(true) +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +bool(true) +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +bool(true) +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +bool(true) +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +bool(true) +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- Iteration 5 with file containing alphanumeric data -- +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +bool(true) +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) + +*** Done *** + diff --git a/ext/standard/tests/file/fflush_variation4.phpt b/ext/standard/tests/file/fflush_variation4.phpt new file mode 100644 index 0000000..f98616c --- /dev/null +++ b/ext/standard/tests/file/fflush_variation4.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test fflush() function: usage variations - file opened in read-only mode +--FILE-- + +--EXPECTF-- +*** Testing fflush(): with file handles of files opened in various read modes *** +-- Iteration 1 with file opened in r mode -- +bool(true) +-- Iteration 2 with file opened in rb mode -- +bool(true) +-- Iteration 3 with file opened in rt mode -- +bool(true) + +*** Done *** + diff --git a/ext/standard/tests/file/fgetc_basic.phpt b/ext/standard/tests/file/fgetc_basic.phpt new file mode 100644 index 0000000..7851e43 --- /dev/null +++ b/ext/standard/tests/file/fgetc_basic.phpt @@ -0,0 +1,543 @@ +--TEST-- +Test fgetc() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing fgetc() : basic operations *** +--- Outerloop iteration 1 --- +-- Innerloop iteration 1 of Outerloop Iteration 1 -- +-- Testing fgetc() : file opened using r mode -- +string(1) "2" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 2 of Outerloop Iteration 1 -- +-- Testing fgetc() : file opened using rb mode -- +string(1) "2" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 3 of Outerloop Iteration 1 -- +-- Testing fgetc() : file opened using rt mode -- +string(1) "2" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 4 of Outerloop Iteration 1 -- +-- Testing fgetc() : file opened using r+ mode -- +string(1) "2" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 5 of Outerloop Iteration 1 -- +-- Testing fgetc() : file opened using r+b mode -- +string(1) "2" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 6 of Outerloop Iteration 1 -- +-- Testing fgetc() : file opened using r+t mode -- +string(1) "2" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "2" +int(6) +bool(false) +resource(%d) of type (stream) +--- Outerloop iteration 2 --- +-- Innerloop iteration 1 of Outerloop Iteration 2 -- +-- Testing fgetc() : file opened using r mode -- +string(1) "t" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "e" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "x" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "t" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) " " +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "t" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 2 of Outerloop Iteration 2 -- +-- Testing fgetc() : file opened using rb mode -- +string(1) "t" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "e" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "x" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "t" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) " " +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "t" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 3 of Outerloop Iteration 2 -- +-- Testing fgetc() : file opened using rt mode -- +string(1) "t" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "e" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "x" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "t" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) " " +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "t" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 4 of Outerloop Iteration 2 -- +-- Testing fgetc() : file opened using r+ mode -- +string(1) "t" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "e" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "x" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "t" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) " " +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "t" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 5 of Outerloop Iteration 2 -- +-- Testing fgetc() : file opened using r+b mode -- +string(1) "t" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "e" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "x" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "t" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) " " +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "t" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 6 of Outerloop Iteration 2 -- +-- Testing fgetc() : file opened using r+t mode -- +string(1) "t" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "e" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "x" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "t" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) " " +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "t" +int(6) +bool(false) +resource(%d) of type (stream) +--- Outerloop iteration 3 --- +-- Innerloop iteration 1 of Outerloop Iteration 3 -- +-- Testing fgetc() : file opened using r mode -- +string(1) "l" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "i" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "n" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "e" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) " +" +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "l" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 2 of Outerloop Iteration 3 -- +-- Testing fgetc() : file opened using rb mode -- +string(1) "l" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "i" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "n" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "e" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) " +" +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "l" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 3 of Outerloop Iteration 3 -- +-- Testing fgetc() : file opened using rt mode -- +string(1) "l" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "i" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "n" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "e" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) " +" +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "l" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 4 of Outerloop Iteration 3 -- +-- Testing fgetc() : file opened using r+ mode -- +string(1) "l" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "i" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "n" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "e" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) " +" +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "l" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 5 of Outerloop Iteration 3 -- +-- Testing fgetc() : file opened using r+b mode -- +string(1) "l" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "i" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "n" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "e" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) " +" +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "l" +int(6) +bool(false) +resource(%d) of type (stream) +-- Innerloop iteration 6 of Outerloop Iteration 3 -- +-- Testing fgetc() : file opened using r+t mode -- +string(1) "l" +int(1) +bool(false) +resource(%d) of type (stream) +string(1) "i" +int(2) +bool(false) +resource(%d) of type (stream) +string(1) "n" +int(3) +bool(false) +resource(%d) of type (stream) +string(1) "e" +int(4) +bool(false) +resource(%d) of type (stream) +string(1) " +" +int(5) +bool(false) +resource(%d) of type (stream) +string(1) "l" +int(6) +bool(false) +resource(%d) of type (stream) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgetc_error.phpt b/ext/standard/tests/file/fgetc_error.phpt new file mode 100644 index 0000000..15292d6 --- /dev/null +++ b/ext/standard/tests/file/fgetc_error.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test fgetc() function : error conditions +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing fgetc() : usage variations *** +-- Testing fgetc() with file whose file pointer is pointing to EOF -- +-- File opened in mode : r -- +int(0) +bool(false) +int(1024) +bool(false) +bool(true) +int(1024) +-- File opened in mode : rb -- +int(0) +bool(false) +int(1024) +bool(false) +bool(true) +int(1024) +-- File opened in mode : rt -- +int(0) +bool(false) +int(1024) +bool(false) +bool(true) +int(1024) +-- File opened in mode : r+ -- +int(0) +bool(false) +int(1024) +bool(false) +bool(true) +int(1024) +-- File opened in mode : r+b -- +int(0) +bool(false) +int(1024) +bool(false) +bool(true) +int(1024) +-- File opened in mode : r+t -- +int(0) +bool(false) +int(1024) +bool(false) +bool(true) +int(1024) +Done diff --git a/ext/standard/tests/file/fgetc_variation2.phpt b/ext/standard/tests/file/fgetc_variation2.phpt new file mode 100644 index 0000000..380c1aa --- /dev/null +++ b/ext/standard/tests/file/fgetc_variation2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test fgetc() function : usage variations - closed handle +--FILE-- + +--EXPECTF-- +*** Testing fgetc() : usage variations *** +-- Testing fgetc() with closed handle -- + +Warning: fgetc(): %d is not a valid stream resource in %s on line %d +bool(false) +-- Testing fgetc() with unset handle -- + +Notice: Undefined variable: file_handle in %s on line %d + +Warning: fgetc() expects parameter 1 to be resource, null given in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/file/fgetc_variation3.phpt b/ext/standard/tests/file/fgetc_variation3.phpt new file mode 100644 index 0000000..f834998 --- /dev/null +++ b/ext/standard/tests/file/fgetc_variation3.phpt @@ -0,0 +1,117 @@ +--TEST-- +Test fgetc() function : usage variations - write only modes (Bug #42036) +--FILE-- + +--EXPECTF-- +*** Testing fgetc() with file opened in write only mode *** +-- File opened in mode : w -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : wb -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : wt -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : a -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : ab -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : at -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : x -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : xb -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : xt -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetc_variation4.phpt b/ext/standard/tests/file/fgetc_variation4.phpt new file mode 100644 index 0000000..a2bc9e5 --- /dev/null +++ b/ext/standard/tests/file/fgetc_variation4.phpt @@ -0,0 +1,290 @@ +--TEST-- +Test fgetc() function : usage variations - different read modes +--FILE-- + +--EXPECTF-- + *** Testing fgetc() : usage variations *** +-- Testing fgetc() with files opened with different read modes -- +-- File opened in mode : a+ -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : a+b -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : a+t -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : x+ -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : x+b -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : x+t -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : w+ -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : w+b -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : w+t -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgetcsv.phpt b/ext/standard/tests/file/fgetcsv.phpt new file mode 100644 index 0000000..868212c --- /dev/null +++ b/ext/standard/tests/file/fgetcsv.phpt @@ -0,0 +1,158 @@ +--TEST-- +various fgetcsv() functionality tests +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + string(3) "aaa" + [1]=> + string(3) "bbb" +} +array(2) { + [0]=> + string(3) "aaa" + [1]=> + string(3) "bbb" +} +array(2) { + [0]=> + string(3) "aaa" + [1]=> + string(3) "bbb" +} +array(2) { + [0]=> + string(3) "aaa" + [1]=> + string(3) "bbb" +} +array(2) { + [0]=> + string(3) "aaa" + [1]=> + string(3) "bbb" +} +array(2) { + [0]=> + string(3) "aaa" + [1]=> + string(3) "bbb" +} +array(2) { + [0]=> + string(0) "" + [1]=> + string(0) "" +} +array(2) { + [0]=> + string(3) "aaa" + [1]=> + string(0) "" +} +array(2) { + [0]=> + string(0) "" + [1]=> + string(3) "aaa" +} +array(2) { + [0]=> + string(0) "" + [1]=> + string(0) "" +} +array(2) { + [0]=> + string(2) "\"" + [1]=> + string(3) "aaa" +} +array(2) { + [0]=> + string(2) """" + [1]=> + string(0) "" +} +array(1) { + [0]=> + string(7) """,aaa +" +} +array(1) { + [0]=> + string(8) "\"",aaa +" +} +array(2) { + [0]=> + string(3) "aaa" + [1]=> + string(10) "\"bbb,ccc +" +} +array(2) { + [0]=> + string(3) "aaa" + [1]=> + string(6) "bbb " +} +array(2) { + [0]=> + string(3) "aaa" + [1]=> + string(6) "bbb " +} +array(2) { + [0]=> + string(8) "aaa"aaa"" + [1]=> + string(6) "bbbbbb" +} +array(2) { + [0]=> + string(10) "aaa"aaa"""" + [1]=> + string(3) "bbb" +} +array(2) { + [0]=> + string(8) "aaa"\"a"" + [1]=> + string(3) "bbb" +} diff --git a/ext/standard/tests/file/fgetcsv_error.phpt b/ext/standard/tests/file/fgetcsv_error.phpt new file mode 100644 index 0000000..e2db9f8 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_error.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test fgetcsv() function : error conditions +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : with all parameters specified *** + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation10.phpt b/ext/standard/tests/file/fgetcsv_variation10.phpt new file mode 100644 index 0000000..250237c --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation10.phpt @@ -0,0 +1,1295 @@ +--TEST-- +Test fgetcsv() : usage variations - file pointer pointing to EOF +--FILE-- + +--EXPECTF-- +*** Testing fgetcsv() : with file pointer pointing to EOF *** + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(55) +bool(true) +bool(false) +int(55) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(55) +bool(true) +bool(false) +int(55) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(55) +bool(true) +bool(false) +int(55) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(55) +bool(true) +bool(false) +int(55) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(55) +bool(true) +bool(false) +int(55) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(55) +bool(true) +bool(false) +int(55) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(55) +bool(true) +bool(false) +int(55) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(55) +bool(true) +bool(false) +int(55) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(55) +bool(true) +bool(false) +int(55) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(55) +bool(true) +bool(false) +int(55) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(59) +bool(true) +bool(false) +int(59) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(59) +bool(true) +bool(false) +int(59) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(59) +bool(true) +bool(false) +int(59) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(59) +bool(true) +bool(false) +int(59) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(59) +bool(true) +bool(false) +int(59) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(59) +bool(true) +bool(false) +int(59) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(59) +bool(true) +bool(false) +int(59) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(59) +bool(true) +bool(false) +int(59) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(59) +bool(true) +bool(false) +int(59) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(59) +bool(true) +bool(false) +int(59) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(63) +bool(true) +bool(false) +int(63) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(63) +bool(true) +bool(false) +int(63) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(63) +bool(true) +bool(false) +int(63) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(63) +bool(true) +bool(false) +int(63) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(63) +bool(true) +bool(false) +int(63) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(63) +bool(true) +bool(false) +int(63) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(63) +bool(true) +bool(false) +int(63) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(63) +bool(true) +bool(false) +int(63) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(63) +bool(true) +bool(false) +int(63) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(63) +bool(true) +bool(false) +int(63) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(65) +bool(true) +bool(false) +int(65) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(65) +bool(true) +bool(false) +int(65) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(65) +bool(true) +bool(false) +int(65) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(65) +bool(true) +bool(false) +int(65) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(65) +bool(true) +bool(false) +int(65) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(65) +bool(true) +bool(false) +int(65) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(65) +bool(true) +bool(false) +int(65) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(65) +bool(true) +bool(false) +int(65) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(65) +bool(true) +bool(false) +int(65) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(65) +bool(true) +bool(false) +int(65) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +bool(false) +int(%d) +bool(true) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation11.phpt b/ext/standard/tests/file/fgetcsv_variation11.phpt new file mode 100644 index 0000000..815ede6 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation11.phpt @@ -0,0 +1,1835 @@ +--TEST-- +Test fgetcsv() : usage variations - with different enclosure but same delimiter +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : with different enclosure but same delimiter char *** + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(7) ""water"" + [1]=> + string(7) ""fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(7) "^water^" + [1]=> + string(7) "^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(7) "&water&" + [1]=> + string(7) "&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(6) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(5) "fruit" + [4]=> + string(3) "air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(9) { + [0]=> + string(0) "" + [1]=> + string(5) "water" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(5) "fruit" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(3) "air" + [8]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(6) { + [0]=> + string(6) "&""""&" + [1]=> + string(3) "&"&" + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(3) "&,&" + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgetcsv_variation12.phpt b/ext/standard/tests/file/fgetcsv_variation12.phpt new file mode 100644 index 0000000..e513fe6 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation12.phpt @@ -0,0 +1,957 @@ +--TEST-- +Test fgetcsv() : usage variations - two chars as enclosure & delimiter (various read and append modes) +--FILE-- + +--EXPECTF-- +*** Testing fgetcsv() : with two chars as enclosure & delimiter *** + +-- Testing fgetcsv() with file opened using r mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation13.phpt b/ext/standard/tests/file/fgetcsv_variation13.phpt new file mode 100644 index 0000000..a00405b --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation13.phpt @@ -0,0 +1,189 @@ +--TEST-- +Test fgetcsv() : usage variations - with line without any csv fields + +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : reading the line which is without csv fields *** + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation14.phpt b/ext/standard/tests/file/fgetcsv_variation14.phpt new file mode 100644 index 0000000..927bf8a --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation14.phpt @@ -0,0 +1,239 @@ +--TEST-- +Test fgetcsv() : usage variations - reading the blank line +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : reading the blank line *** + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +bool(false) +int(1) +bool(true) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation15.phpt b/ext/standard/tests/file/fgetcsv_variation15.phpt new file mode 100644 index 0000000..b36b88e --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation15.phpt @@ -0,0 +1,940 @@ +--TEST-- +Test fgetcsv() : usage variations - with default enclosure +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : with default enclosure *** + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation16.phpt b/ext/standard/tests/file/fgetcsv_variation16.phpt new file mode 100644 index 0000000..904c422 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation16.phpt @@ -0,0 +1,944 @@ +--TEST-- +Test fgetcsv() : usage variations - with default enclosure & length as 0 +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : with default enclosure & length as 0 *** + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation17.phpt b/ext/standard/tests/file/fgetcsv_variation17.phpt new file mode 100644 index 0000000..a54f8da --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation17.phpt @@ -0,0 +1,1565 @@ +--TEST-- +Test fgetcsv() : usage variations - with default enclosure & length less than line size +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : with default enclosure & length less than line size *** + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(3) "fru" +} +int(9) +bool(false) +array(1) { + [0]=> + string(2) "it" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(3) "air" +} +int(20) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(60) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(3) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" + [2]=> + string(43) "" +This is line of text without csv fields + +" +} +int(61) +bool(true) +bool(false) +int(61) +bool(true) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation18.phpt b/ext/standard/tests/file/fgetcsv_variation18.phpt new file mode 100644 index 0000000..19915e8 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation18.phpt @@ -0,0 +1,690 @@ +--TEST-- +Test fgetcsv() : usage variations - with default enclosure and different delimiter +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : with default enclosure and different delimiter *** + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation19.phpt b/ext/standard/tests/file/fgetcsv_variation19.phpt new file mode 100644 index 0000000..2e282e1 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation19.phpt @@ -0,0 +1,841 @@ +--TEST-- +Test fgetcsv() : usage variations - with default enclosure & delimiter of two chars +--FILE-- + +--EXPECTF-- +*** Testing fgetcsv() : with default enclosure & delimiter of two chars *** + +-- Testing fgetcsv() with file opened using r mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water,fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(11) "water fruit" +} +int(12) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(13) "water "fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(19) "water\"fruit"\"air"" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "water\"fruit"\"""" +} +int(20) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation2.phpt b/ext/standard/tests/file/fgetcsv_variation2.phpt new file mode 100644 index 0000000..7b875b8 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation2.phpt @@ -0,0 +1,1413 @@ +--TEST-- +Test fgetcsv() : usage variations - with length as 0 +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : with length as 0 *** + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(11) "water=fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(3) { + [0]=> + string(11) "water-fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation20.phpt b/ext/standard/tests/file/fgetcsv_variation20.phpt new file mode 100644 index 0000000..e96089e --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation20.phpt @@ -0,0 +1,191 @@ +--TEST-- +Test fgetcsv() : usage variations - with default enclosure, line without any csv fields +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : with default enclosure, line without any csv fields *** + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(40) +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgetcsv_variation21.phpt b/ext/standard/tests/file/fgetcsv_variation21.phpt new file mode 100644 index 0000000..e6a9ee5 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation21.phpt @@ -0,0 +1,191 @@ +--TEST-- +Test fgetcsv() : usage variations - with default enclosure, blank line +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : with default enclosure, blank line *** + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + NULL +} +int(1) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation22.phpt b/ext/standard/tests/file/fgetcsv_variation22.phpt new file mode 100644 index 0000000..9f35c1c --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation22.phpt @@ -0,0 +1,614 @@ +--TEST-- +Test fgetcsv() : usage variations - with default enclosure, file pointer pointing at end of file +--FILE-- + +--EXPECTF-- +*** Testing fgetcsv() : with default enclosure, file pointer pointing at end of file *** + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation23.phpt b/ext/standard/tests/file/fgetcsv_variation23.phpt new file mode 100644 index 0000000..b766f1e --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation23.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test fgetcsv() : usage variations - empty file +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : reading from file which is having zero content *** +bool(false) +int(0) +bool(false) +int(0) +bool(false) +int(0) +bool(false) +int(0) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation24.phpt b/ext/standard/tests/file/fgetcsv_variation24.phpt new file mode 100644 index 0000000..89b6d03 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation24.phpt @@ -0,0 +1,671 @@ +--TEST-- +Test fgetcsv() : usage variations - two chars as enclosure & delimiter (various write modes) +--FILE-- + +--EXPECTF-- +*** Testing fgetcsv() : with two chars as enclosure & delimiter *** + +-- Testing fgetcsv() with file opened using w+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Notice: fgetcsv(): delimiter must be a single character in %s on line %d + +Notice: fgetcsv(): enclosure must be a single character in %s on line %d +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation25.phpt b/ext/standard/tests/file/fgetcsv_variation25.phpt new file mode 100644 index 0000000..1877bc0 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation25.phpt @@ -0,0 +1,935 @@ +--TEST-- +Test fgetcsv() : usage variations - with negative length value along with enclosure and delimiter +--FILE-- + +--EXPECTF-- +*** Testing fgetcsv() : with negative length value *** + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation26.phpt b/ext/standard/tests/file/fgetcsv_variation26.phpt new file mode 100644 index 0000000..c042eb4 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation26.phpt @@ -0,0 +1,441 @@ +--TEST-- +Test fgetcsv() : usage variations - reading files opened in write only mode (Bug #42036) +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : reading the files opened in write only mode *** + +-- Testing fgetcsv() with file opened using w mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using ab mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using at mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using ab mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using at mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using ab mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using at mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using ab mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using at mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using ab mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using at mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using ab mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using at mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using ab mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using at mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using wt mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using ab mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using at mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xb mode -- +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using xt mode -- +bool(false) +int(0) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation27.phpt b/ext/standard/tests/file/fgetcsv_variation27.phpt new file mode 100644 index 0000000..aafc3ab --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation27.phpt @@ -0,0 +1,935 @@ +--TEST-- +Test fgetcsv() : usage variations - with negative length value along with delimiter and no enclosure +--FILE-- + +--EXPECTF-- +*** Testing fgetcsv() : with negative length value *** + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation28.phpt b/ext/standard/tests/file/fgetcsv_variation28.phpt new file mode 100644 index 0000000..56dd538 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation28.phpt @@ -0,0 +1,935 @@ +--TEST-- +Test fgetcsv() : usage variations - with negative length value along with neither enclosure and nor delimiter +--FILE-- + +--EXPECTF-- +*** Testing fgetcsv() : with negative length value *** + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): Length parameter may not be negative in %s on line %d +bool(false) +int(0) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation29.phpt b/ext/standard/tests/file/fgetcsv_variation29.phpt new file mode 100644 index 0000000..08c7503 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation29.phpt @@ -0,0 +1,615 @@ +--TEST-- +Test fgetcsv() : usage variations - with only file handle as argument, file pointer pointing at end of file +--FILE-- + +--EXPECTF-- +*** Testing fgetcsv() : with file handle as only argument and file pointer pointing at end of file *** + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation3.phpt b/ext/standard/tests/file/fgetcsv_variation3.phpt new file mode 100644 index 0000000..52c094f --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation3.phpt @@ -0,0 +1,933 @@ +--TEST-- +Test fgetcsv() : usage variations - with delimiter as NULL +--FILE-- + +--EXPECTF-- +*** Testing fgetcsv() : with delimiter as NULL *** + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation30.phpt b/ext/standard/tests/file/fgetcsv_variation30.phpt new file mode 100644 index 0000000..e474b2d --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation30.phpt @@ -0,0 +1,614 @@ +--TEST-- +Test fgetcsv() : usage variations - with file handle and length, file pointer pointing at end of file +--FILE-- + +--EXPECTF-- +*** Testing fgetcsv() : with file handle and length arguments, file pointer pointing at end of file *** + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation31.phpt b/ext/standard/tests/file/fgetcsv_variation31.phpt new file mode 100644 index 0000000..1d896b7 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation31.phpt @@ -0,0 +1,616 @@ +--TEST-- +Test fgetcsv() : usage variations - with length and enclosure, file pointer pointing at end of file +--FILE-- + +--EXPECTF-- +*** Testing fgetcsv() : with enclosure argument, file pointer pointing at end of file *** + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(53) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(57) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rb mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using rt mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using r+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using r+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using a+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using a+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using w+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using w+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) + +-- Testing fgetcsv() with file opened using x+ mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+b mode -- +int(0) +bool(false) +bool(false) +int(61) +bool(true) + +-- Testing fgetcsv() with file opened using x+t mode -- +int(0) +bool(false) +bool(false) +int(%d) +bool(true) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation4.phpt b/ext/standard/tests/file/fgetcsv_variation4.phpt new file mode 100644 index 0000000..0c84484 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation4.phpt @@ -0,0 +1,932 @@ +--TEST-- +Test fgetcsv() : usage variations - with enclosure as NULL +--FILE-- + +--EXPECTF-- +*** Testing fgetcsv() : with enclosure as NULL *** + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): enclosure must be a character in %s on line %d +bool(false) +int(0) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation5.phpt b/ext/standard/tests/file/fgetcsv_variation5.phpt new file mode 100644 index 0000000..283fa40 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation5.phpt @@ -0,0 +1,934 @@ +--TEST-- +Test fgetcsv() : usage variations - with delimiter & enclosure as NULL +--FILE-- + +--EXPECTF-- +*** Testing fgetcsv() : with delimiter & enclosure as NULL *** + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- + +Warning: fgetcsv(): delimiter must be a character in %s on line %d +bool(false) +int(0) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation6.phpt b/ext/standard/tests/file/fgetcsv_variation6.phpt new file mode 100644 index 0000000..9878cb9 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation6.phpt @@ -0,0 +1,2350 @@ +--TEST-- +Test fgetcsv() : usage variations - with length less than line size +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : with length less than line size *** + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(1) "f" +} +int(9) +bool(false) +array(1) { + [0]=> + string(4) "ruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(8) { + [0]=> + string(4) "This" + [1]=> + string(2) "is" + [2]=> + string(4) "line" + [3]=> + string(2) "of" + [4]=> + string(4) "text" + [5]=> + string(7) "without" + [6]=> + string(3) "csv" + [7]=> + string(6) "fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(56) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(6) "water=" +} +int(9) +bool(false) +array(2) { + [0]=> + string(5) "fruit" + [1]=> + string(0) "" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(58) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(6) "water-" +} +int(9) +bool(false) +array(3) { + [0]=> + string(5) "fruit" + [1]=> + string(3) "air" + [2]=> + string(0) "" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(6) { + [0]=> + string(4) """""" + [1]=> + string(1) """ + [2]=> + string(1) "," + [3]=> + string(1) """ + [4]=> + string(1) "," + [5]=> + string(4) ",,,," +} +int(24) +bool(false) +array(1) { + [0]=> + string(39) "This is line of text without csv fields" +} +int(64) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation7.phpt b/ext/standard/tests/file/fgetcsv_variation7.phpt new file mode 100644 index 0000000..723328e --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation7.phpt @@ -0,0 +1,1292 @@ +--TEST-- +Test fgetcsv() : usage variations - with default arguments value +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : with default arguments value *** + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(2) { + [0]=> + string(5) "water" + [1]=> + string(5) "fruit" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(7) { + [0]=> + string(11) "&""""&:&"&:" + [1]=> + string(4) ":":&" + [2]=> + string(2) "&:" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +int(24) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation8.phpt b/ext/standard/tests/file/fgetcsv_variation8.phpt new file mode 100644 index 0000000..21b6c88 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation8.phpt @@ -0,0 +1,1058 @@ +--TEST-- +Test fgetcsv() : usage variations - with different delimiter and enclosure +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : with different delimiter and enclosure *** + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(13) ""water",fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(15) ""water","fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(15) "^water^ ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(15) "&water&:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(15) "=water===fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(17) "-water--fruit-air" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(21) "-water---fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(23) "&""""&:&"&:,:":&,&:,,,," +} +int(24) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetcsv_variation9.phpt b/ext/standard/tests/file/fgetcsv_variation9.phpt new file mode 100644 index 0000000..6400fc8 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation9.phpt @@ -0,0 +1,1056 @@ +--TEST-- +Test fgetcsv() : usage variations - with different delimiter but same enclosure +--FILE-- + +--EXPECT-- +*** Testing fgetcsv() : with different delimiter but same enclosure *** + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(11) "water,fruit" +} +int(14) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(13) "water,"fruit"" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(13) "water ^fruit^" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(13) "water:&fruit&" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(12) "water=fruit=" +} +int(16) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(14) "water-fruitair" +} +int(18) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(18) "water-fruit---air-" +} +int(22) +bool(false) + +-- Testing fgetcsv() with file opened using r mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using rb mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using rt mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+ mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+b mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using r+t mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+ mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+b mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using a+t mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+ mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+b mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using w+t mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+ mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+b mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) + +-- Testing fgetcsv() with file opened using x+t mode -- +array(1) { + [0]=> + string(21) """"":&"&:,:":&,&:,,,," +} +int(24) +bool(false) +Done diff --git a/ext/standard/tests/file/fgets_basic.phpt b/ext/standard/tests/file/fgets_basic.phpt new file mode 100644 index 0000000..9865f1f --- /dev/null +++ b/ext/standard/tests/file/fgets_basic.phpt @@ -0,0 +1,318 @@ +--TEST-- +Test fgets() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing fgets() : basic functionality *** + +-- Testing fgets() with file opened using mode r -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode rb -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode rt -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode r+ -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode r+b -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode r+t -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgets_error.phpt b/ext/standard/tests/file/fgets_error.phpt new file mode 100644 index 0000000..51ae3c6 --- /dev/null +++ b/ext/standard/tests/file/fgets_error.phpt @@ -0,0 +1,108 @@ +--TEST-- +Test fgets() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing error conditions *** +-- Testing fgets() with zero argument -- + +Warning: fgets() expects at least 1 parameter, 0 given in %s on line %d +bool(false) +-- Testing fgets() with more than expected number of arguments -- + +Warning: fgets() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +-- Testing fgets() with invalid length arguments -- + +Warning: fgets(): Length parameter must be greater than 0 in %s on line %d +bool(false) + +Warning: fgets(): Length parameter must be greater than 0 in %s on line %d +bool(false) +bool(false) +-- Testing fgets() with invalid arguments -- +-- Iteration 1 -- + +Warning: fgets() expects parameter 1 to be resource, string given in %s on line %d +bool(false) +-- Iteration 2 -- + +Warning: fgets() expects parameter 1 to be resource, integer given in %s on line %d +bool(false) +-- Iteration 3 -- + +Warning: fgets() expects parameter 1 to be resource, double given in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: fgets() expects parameter 1 to be resource, boolean given in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: fgets() expects parameter 1 to be resource, array given in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: fgets() expects parameter 1 to be resource, object given in %s on line %d +bool(false) +-- Testing fgets() with closed/unset file handle -- +Warning: fgets(): %d is not a valid stream resource in %s on line %d +bool(false) + +Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d +bool(false) +Done + diff --git a/ext/standard/tests/file/fgets_socket_variation1.phpt b/ext/standard/tests/file/fgets_socket_variation1.phpt new file mode 100644 index 0000000..57944d8 --- /dev/null +++ b/ext/standard/tests/file/fgets_socket_variation1.phpt @@ -0,0 +1,56 @@ +--TEST-- +fgets() with a socket stream +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECT-- +Write some data: + + +Read a line from the client: +string(6) "line1 +" + + +Read another line from the client: +string(6) "line2 +" + + +Close the server side socket and read the remaining data from the client +done diff --git a/ext/standard/tests/file/fgets_socket_variation2.phpt b/ext/standard/tests/file/fgets_socket_variation2.phpt new file mode 100644 index 0000000..3500837 --- /dev/null +++ b/ext/standard/tests/file/fgets_socket_variation2.phpt @@ -0,0 +1,63 @@ +--TEST-- +fgets() over a socket with more than a buffer's worth of data +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECT-- +Write data from the file: +int(9000) + +Read lines from the client + +Close the server side socket and read the remaining data from the client +done diff --git a/ext/standard/tests/file/fgets_variation1.phpt b/ext/standard/tests/file/fgets_variation1.phpt new file mode 100644 index 0000000..48ea231 --- /dev/null +++ b/ext/standard/tests/file/fgets_variation1.phpt @@ -0,0 +1,116 @@ +--TEST-- +Test fgets() function : usage variations - write only modes (Bug #42036) +--FILE-- + +--EXPECTF-- +*** Testing fgets() with file opened in write only mode *** +-- File opened in mode : w -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : wb -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : wt -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : a -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : ab -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : at -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : x -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : xb -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : xt -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +Done diff --git a/ext/standard/tests/file/fgets_variation2.phpt b/ext/standard/tests/file/fgets_variation2.phpt new file mode 100644 index 0000000..964216b --- /dev/null +++ b/ext/standard/tests/file/fgets_variation2.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test fgets() function : usage variations - closed handle +--FILE-- + +--EXPECTF-- +*** Testing fgets() : usage variations *** +-- Testing fgets() with closed handle -- + +Warning: fgets(): %d is not a valid stream resource in %s on line %d +bool(false) + +Warning: fgets(): %d is not a valid stream resource in %s on line %d +bool(false) +-- Testing fgets() with unset handle -- + +Notice: Undefined variable: file_handle in %s on line %d + +Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d +bool(false) + +Notice: Undefined variable: file_handle in %s on line %d + +Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d +bool(false) +Done + diff --git a/ext/standard/tests/file/fgets_variation3.phpt b/ext/standard/tests/file/fgets_variation3.phpt new file mode 100644 index 0000000..4f03641 --- /dev/null +++ b/ext/standard/tests/file/fgets_variation3.phpt @@ -0,0 +1,500 @@ +--TEST-- +Test fgets() function : usage variations - read with/without length +--FILE-- + +--EXPECTF-- +*** Testing fgets() : usage variations *** + +-- Testing fgets() with file opened using mode w+ -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode w+b -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode w+t -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode a+ -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode a+b -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode a+t -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode x+ -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode x+b -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode x+t -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgets_variation4-win32.phpt b/ext/standard/tests/file/fgets_variation4-win32.phpt new file mode 100644 index 0000000..6d2bbf6 --- /dev/null +++ b/ext/standard/tests/file/fgets_variation4-win32.phpt @@ -0,0 +1,574 @@ +--TEST-- +Test fgets() function : usage variations - seek n read +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing fgets() : usage variations *** + +-- Testing fgets() with file opened using mode w+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode w+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode w+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(1) " +" +int(6) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(12) "ine of text +" +int(37) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(1) " +" +int(6) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(12) "ine of text +" +int(37) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(1) " +" +int(6) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(12) "ine of text +" +int(37) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) +Done diff --git a/ext/standard/tests/file/fgets_variation4.phpt b/ext/standard/tests/file/fgets_variation4.phpt new file mode 100644 index 0000000..4ffa3f1 --- /dev/null +++ b/ext/standard/tests/file/fgets_variation4.phpt @@ -0,0 +1,574 @@ +--TEST-- +Test fgets() function : usage variations - seek n read +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing fgets() : usage variations *** + +-- Testing fgets() with file opened using mode w+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode w+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode w+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgets_variation5.phpt b/ext/standard/tests/file/fgets_variation5.phpt new file mode 100644 index 0000000..4a1ed9f --- /dev/null +++ b/ext/standard/tests/file/fgets_variation5.phpt @@ -0,0 +1,302 @@ +--TEST-- +Test fgets() function : usage variations - read beyond filesize +--FILE-- + filesize --\n"; + rewind($file_handle); + + var_dump( ftell($file_handle) ); + var_dump( fgets($file_handle, 50 + 23) ); // expected: 50 + var_dump( ftell($file_handle) ); // ensure the file pointer position + var_dump( feof($file_handle) ); // enusre if eof set + + //close file + fclose($file_handle); + + // delete file + delete_file($filename); + } // file_content_type loop +} // file_mode loop + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing fgets() : usage variations *** + +-- Testing fgets() with file opened using mode w+ -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode w+b -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode w+t -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+ -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+b -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+t -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+ -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+b -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+t -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgets_variation6-win32.phpt b/ext/standard/tests/file/fgets_variation6-win32.phpt new file mode 100644 index 0000000..14cb46f --- /dev/null +++ b/ext/standard/tests/file/fgets_variation6-win32.phpt @@ -0,0 +1,372 @@ +--TEST-- +Test fgets() function : usage variations - read when file pointer at EOF +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing fgets() : usage variations *** + +-- Testing fgets() with file opened using mode w+ -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode w+b -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode w+t -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(55) +bool(false) +bool(false) +int(55) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+ -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+b -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+t -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(55) +bool(false) +bool(false) +int(55) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+ -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+b -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+t -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(55) +bool(false) +bool(false) +int(55) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +Done diff --git a/ext/standard/tests/file/fgets_variation6.phpt b/ext/standard/tests/file/fgets_variation6.phpt new file mode 100644 index 0000000..da6c214 --- /dev/null +++ b/ext/standard/tests/file/fgets_variation6.phpt @@ -0,0 +1,372 @@ +--TEST-- +Test fgets() function : usage variations - read when file pointer at EOF +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing fgets() : usage variations *** + +-- Testing fgets() with file opened using mode w+ -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode w+b -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode w+t -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+ -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+b -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+t -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+ -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+b -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+t -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgetss.phpt b/ext/standard/tests/file/fgetss.phpt new file mode 100644 index 0000000..b4ac211 --- /dev/null +++ b/ext/standard/tests/file/fgetss.phpt @@ -0,0 +1,83 @@ +--TEST-- +fgetss() tests +--FILE-- +aaaaaa\ndddddd", + "asdqw\naaaa<>qqqq", + "aaaqqq", + "asdasdblah", + "some another text <> hoho " + ); + +foreach ($array as $str) { + file_put_contents($filename, $str); + $fp = fopen($filename, "r"); + var_dump(fgetss($fp)); + var_dump(fgetss($fp)); +} + +foreach ($array as $str) { + file_put_contents($filename, $str); + $fp = fopen($filename, "r"); + var_dump(fgetss($fp, 10)); + var_dump(fgetss($fp, 10)); +} + +var_dump(fgetss($fp, -10)); +var_dump(fgetss($fp, 0)); +fclose($fp); +var_dump(fgetss($fp, 0)); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(18) "askasdfasdfaaaaaa +" +string(6) "dddddd" +string(6) "asdqw +" +string(8) "aaaaqqqq" +string(23) "aaafunction foo() {}qqq" +bool(false) +string(6) "asdasd" +string(0) "" +bool(false) +bool(false) +string(11) "some text +" +string(4) "blah" +string(24) "some another text hoho " +bool(false) +string(9) "askasdfas" +string(6) "dfaaaa" +string(5) "asdqw" +string(0) "" +string(3) "aaa" +string(7) "functio" +string(6) "asdasd" +string(0) "" +bool(false) +bool(false) +string(9) "some text" +string(2) " +" +string(9) "some anot" +string(9) "her text " + +Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d +bool(false) + +Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d +bool(false) + +Warning: fgetss(): %d is not a valid stream resource in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/file/fgetss1.phpt b/ext/standard/tests/file/fgetss1.phpt new file mode 100644 index 0000000..96b8b6f --- /dev/null +++ b/ext/standard/tests/file/fgetss1.phpt @@ -0,0 +1,69 @@ +--TEST-- +more fgetss() tests +--FILE-- +aaaaaa\ndddddd", + "asdqw\naaaa<>qqqq", + "aaaqqq", + "asdasdblah", + "some another text <> hoho " + ); + +foreach ($array as $str) { + file_put_contents($filename, $str); + $fp = fopen($filename, "r"); + var_dump(fgetss($fp, 1000, ",,")); + var_dump(fgetss($fp)); +} + +foreach ($array as $str) { + file_put_contents($filename, $str); + $fp = fopen($filename, "r"); + var_dump(fgetss($fp, 10)); + var_dump(fgetss($fp, 10, "", + '', + "hello

world

", + 'hello

world

', + "", + '' +); + + +// Calling strip_tags() with default arguments +// loop through the $string_array to test strip_tags on various inputs +$iteration = 1; +foreach($string_array as $string) +{ + echo "-- Iteration $iteration --\n"; + var_dump( strip_tags($string) ); + $iteration++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : basic functionality *** +-- Iteration 1 -- +string(5) "hello" +-- Iteration 2 -- +string(5) "hello" +-- Iteration 3 -- +string(0) "" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(0) "" +-- Iteration 6 -- +string(0) "" +-- Iteration 7 -- +string(0) "" +-- Iteration 8 -- +string(0) "" +-- Iteration 9 -- +string(12) " echo hello " +-- Iteration 10 -- +string(12) " echo hello " +-- Iteration 11 -- +string(10) "helloworld" +-- Iteration 12 -- +string(10) "helloworld" +-- Iteration 13 -- +string(0) "" +-- Iteration 14 -- +string(0) "" +Done diff --git a/ext/standard/tests/strings/strip_tags_basic2.phpt b/ext/standard/tests/strings/strip_tags_basic2.phpt new file mode 100644 index 0000000..4d61c94 --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_basic2.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test strip_tags() function : basic functionality - with all arguments +--INI-- +short_open_tag = on +--FILE-- +

hello

world
Other text"; + +$allowed_tags_array=array( + "", + '', + "

", + '

', + "", + '', + "

+--EXPECTF-- +*** Testing strip_tags() : basic functionality *** +-- Iteration 1 -- +string(33) "helloworldOther text" +-- Iteration 2 -- +string(33) "helloworldOther text" +-- Iteration 3 -- +string(27) "

hello

worldOther text" +-- Iteration 4 -- +string(27) "

hello

worldOther text" +-- Iteration 5 -- +string(44) "helloworld
Other text" +-- Iteration 6 -- +string(44) "helloworldOther text" +-- Iteration 7 -- +string(20) "helloworldOther text" +-- Iteration 8 -- +string(20) "helloworldOther text" +-- Iteration 9 -- +string(64) "

hello

worldOther text" +Done diff --git a/ext/standard/tests/strings/strip_tags_error.phpt b/ext/standard/tests/strings/strip_tags_error.phpt new file mode 100644 index 0000000..c45cbb1 --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test strip_tags() function : error conditions +--INI-- +short_open_tag = on +--FILE-- +hello"; +$allowable_tags = ""; +$extra_arg = 10; +var_dump( strip_tags($str, $allowable_tags, $extra_arg) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : error conditions *** + +-- Testing strip_tags() function with Zero arguments -- + +Warning: strip_tags() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing strip_tags() function with more than expected no. of arguments -- + +Warning: strip_tags() expects at most 2 parameters, 3 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/strings/strip_tags_variation1.phpt b/ext/standard/tests/strings/strip_tags_variation1.phpt new file mode 100644 index 0000000..56c8c28 --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_variation1.phpt @@ -0,0 +1,159 @@ +--TEST-- +Test strip_tags() function : usage variations - unexpected values for 'str' argument +--INI-- +set short_open_tag = on +--FILE-- + 'red', 'item' => 'pen'), + + // null data +/*15*/ NULL, + null, + + // boolean data +/*17*/ true, + false, + TRUE, + FALSE, + + // empty data +/*21*/ "", + '', + + // object data +/*23*/ new classA(), + + // undefined data +/*24*/ @$undefined_var, + + // unset data +/*25*/ @$unset_var, + + // resource variable +/*26*/ $fp + +); + +// loop through each element of the array for allowable_tags +$iterator = 1; +foreach($values as $value) { + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($value) ); + $iterator++; +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(5) "12345" +-- Iteration 4 -- +string(5) "-2345" +-- Iteration 5 -- +string(4) "10.5" +-- Iteration 6 -- +string(5) "-10.5" +-- Iteration 7 -- +string(12) "101234567000" +-- Iteration 8 -- +string(13) "1.07654321E-9" +-- Iteration 9 -- +string(3) "0.5" +-- Iteration 10 -- + +Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +string(0) "" +-- Iteration 16 -- +string(0) "" +-- Iteration 17 -- +string(1) "1" +-- Iteration 18 -- +string(0) "" +-- Iteration 19 -- +string(1) "1" +-- Iteration 20 -- +string(0) "" +-- Iteration 21 -- +string(0) "" +-- Iteration 22 -- +string(0) "" +-- Iteration 23 -- +string(14) "Class A object" +-- Iteration 24 -- +string(0) "" +-- Iteration 25 -- +string(0) "" +-- Iteration 26 -- + +Warning: strip_tags() expects parameter 1 to be string, resource given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/strip_tags_variation10.phpt b/ext/standard/tests/strings/strip_tags_variation10.phpt new file mode 100644 index 0000000..a70695b --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_variation10.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test strip_tags() function : usage variations - single quoted strings +--INI-- +short_open_tag = on +--FILE-- + \$ -> This represents the dollar sign', + '\t\r\v The quick brown fo\fx jumped over the lazy dog

', + 'This is a hyper text tag', + 'hello world\\t?>', + '

This is a paragraph

', + 'This is \ta text in bold letters\r\s\malong with slashes\n' +); + +$quotes = "

+--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(51) " \$ -> This represents the dollar sign" +-- Iteration 2 -- +string(63) "\t\r\v The quick brown fo\fx jumped over the lazy dog

" +-- Iteration 3 -- +string(31) "
This is a hyper text tag" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(26) "

This is a paragraph

" +-- Iteration 6 -- +string(65) "This is \ta text in bold letters\r\s\malong with slashes\n" +Done diff --git a/ext/standard/tests/strings/strip_tags_variation11.phpt b/ext/standard/tests/strings/strip_tags_variation11.phpt new file mode 100644 index 0000000..3b47b5c --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_variation11.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test strip_tags() function : obscure values within attributes +--INI-- +short_open_tag = on +--FILE-- + world', + 'hello world', + 'hello world', + "hello world" +); + + +// Calling strip_tags() with default arguments +// loop through the $string_array to test strip_tags on various inputs +$iteration = 1; +foreach($string_array as $string) +{ + echo "-- Iteration $iteration --\n"; + var_dump( strip_tags($string) ); + $iteration++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : obscure functionality *** +-- Iteration 1 -- +string(12) "hello world" +-- Iteration 2 -- +string(12) "hello world" +-- Iteration 3 -- +string(12) "hello world" +-- Iteration 4 -- +string(12) "hello world" +Done diff --git a/ext/standard/tests/strings/strip_tags_variation2.phpt b/ext/standard/tests/strings/strip_tags_variation2.phpt new file mode 100644 index 0000000..c0a6e92 --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_variation2.phpt @@ -0,0 +1,159 @@ +--TEST-- +Test strip_tags() function : usage variations - unexpected values for 'allowable_tags' +--INI-- +short_open_tag = on +--FILE-- +hello

world

"; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//get a resource variable +$fp = fopen(__FILE__, "r"); + +//get a class +class classA{ + public function __toString(){ + return "Class A Object"; + } +} + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.5e10, + 10.6E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new classA(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource variable + $fp +); + +// loop through each element of the array for allowable_tags +$iterator = 1; +foreach($values as $value) { + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($string, $value) ); + $iterator++; +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(10) "helloworld" +-- Iteration 2 -- +string(10) "helloworld" +-- Iteration 3 -- +string(10) "helloworld" +-- Iteration 4 -- +string(10) "helloworld" +-- Iteration 5 -- +string(10) "helloworld" +-- Iteration 6 -- +string(10) "helloworld" +-- Iteration 7 -- +string(10) "helloworld" +-- Iteration 8 -- +string(10) "helloworld" +-- Iteration 9 -- +string(10) "helloworld" +-- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d +string(10) "helloworld" +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(10) "helloworld" +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(10) "helloworld" +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(10) "helloworld" +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(10) "helloworld" +-- Iteration 15 -- +string(10) "helloworld" +-- Iteration 16 -- +string(10) "helloworld" +-- Iteration 17 -- +string(10) "helloworld" +-- Iteration 18 -- +string(10) "helloworld" +-- Iteration 19 -- +string(10) "helloworld" +-- Iteration 20 -- +string(10) "helloworld" +-- Iteration 21 -- +string(10) "helloworld" +-- Iteration 22 -- +string(10) "helloworld" +-- Iteration 23 -- +string(10) "helloworld" +-- Iteration 24 -- +string(10) "helloworld" +-- Iteration 25 -- +string(10) "helloworld" +-- Iteration 26 -- +string(10) "helloworld" +Done diff --git a/ext/standard/tests/strings/strip_tags_variation3.phpt b/ext/standard/tests/strings/strip_tags_variation3.phpt new file mode 100644 index 0000000..5b7c504 --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_variation3.phpt @@ -0,0 +1,159 @@ +--TEST-- +Test strip_tags() function : usage variations - unexpected values for both 'str' and 'allowable_tags' +--INI-- +set short_open_tag = on +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new classA(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource variable + $fp + +); + +// loop through each element of the array for allowable_tags +$iterator = 1; +foreach($values as $value) { + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($value, $value) ); + $iterator++; +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(5) "12345" +-- Iteration 4 -- +string(5) "-2345" +-- Iteration 5 -- +string(4) "10.5" +-- Iteration 6 -- +string(5) "-10.5" +-- Iteration 7 -- +string(12) "101234567000" +-- Iteration 8 -- +string(13) "1.07654321E-9" +-- Iteration 9 -- +string(3) "0.5" +-- Iteration 10 -- + +Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +string(0) "" +-- Iteration 16 -- +string(0) "" +-- Iteration 17 -- +string(1) "1" +-- Iteration 18 -- +string(0) "" +-- Iteration 19 -- +string(1) "1" +-- Iteration 20 -- +string(0) "" +-- Iteration 21 -- +string(0) "" +-- Iteration 22 -- +string(0) "" +-- Iteration 23 -- +string(14) "Class A object" +-- Iteration 24 -- +string(0) "" +-- Iteration 25 -- +string(0) "" +-- Iteration 26 -- + +Warning: strip_tags() expects parameter 1 to be string, resource given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/strip_tags_variation4.phpt b/ext/standard/tests/strings/strip_tags_variation4.phpt new file mode 100644 index 0000000..ab01979 --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_variation4.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test strip_tags() function : usage variations - invalid values for 'str' and valid 'allowable_tags' +--INI-- +short_open_tag = on +--FILE-- +hello \t\tworld... strip_tags_test", + 'hello \t\tworld... strip_tags_test', + "<%?php hello\t world?%>", + '<%?php hello\t world?%>', + "<>hello<>", + '<>hello<>', + "HtMl text", + 'HtMl text', + "I am not a valid html text", + 'I am not a valid html text', + "I am a quoted (\") string with special chars like \$,\!,\@,\%,\&", + 'I am a quoted (\") string with special chars like \$,\!,\@,\%,\&', +); + +//valid html and php tags +$quotes = "

"; + +//loop through the various elements of strings array to test strip_tags() functionality +$iterator = 1; +foreach($strings as $string_value) +{ + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($string_value, $quotes) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(32) "hello world... strip_tags_test" +-- Iteration 2 -- +string(34) "hello \t\tworld... strip_tags_test" +-- Iteration 3 -- +string(0) "" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(18) "hello" +-- Iteration 6 -- +string(18) "hello" +-- Iteration 7 -- +string(9) "HtMl text" +-- Iteration 8 -- +string(9) "HtMl text" +-- Iteration 9 -- +string(26) "I am not a valid html text" +-- Iteration 10 -- +string(26) "I am not a valid html text" +-- Iteration 11 -- +string(62) "I am a quoted (") string with special chars like $,\!,\@,\%,\&" +-- Iteration 12 -- +string(64) "I am a quoted (\") string with special chars like \$,\!,\@,\%,\&" +Done diff --git a/ext/standard/tests/strings/strip_tags_variation5.phpt b/ext/standard/tests/strings/strip_tags_variation5.phpt new file mode 100644 index 0000000..54601e9 --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_variation5.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test strip_tags() function : usage variations - heredoc strings +--INI-- +short_open_tag = on +--FILE-- +hello world +

13 < 25

+ +This is a double quoted string +EOT; + +// here doc with diferent whitespaces +$diff_whitespaces = <<hello\r world\t +1111\t\t != 2222\v\v + +EOT; + +// here doc with numeric values +$numeric_string = <<11 < 12. 123 >22 +

string

1111\t 0000\t = 0000\n +EOT; + +// heredoc with quote chars & slash +$quote_char_string = <<This's a string with quotes: +"strings in double quote"; +'strings in single quote'; +this\line is single quoted /with\slashes +EOT; + +$res_heredoc_strings = array( + //heredoc strings + $null_string, + $blank_line, + $multiline_string, + $diff_whitespaces, + $numeric_string, + $quote_char_string +); + +// initialize the second argument +$quotes = "
+--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(0) "" +-- Iteration 2 -- +string(0) "" +-- Iteration 3 -- +string(67) "hello world +13 < 25 + +This is a double quoted string" +-- Iteration 4 -- +string(44) "hello world +1111 != 2222 +" +-- Iteration 5 -- +string(56) "11 < 12. 123 >22 +string 1111 0000 = 0000 +" +-- Iteration 6 -- +string(150) "This's a string with quotes: +"strings in double quote"; +'strings in single quote'; +this\line is single quoted /with\slashes " +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/strip_tags_variation6.phpt b/ext/standard/tests/strings/strip_tags_variation6.phpt new file mode 100644 index 0000000..454f46e --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_variation6.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test strip_tags() function : usage variations - binary safe checking +--INI-- +short_open_tag = on +--FILE-- + I am html string ".chr(0)."", + " I am html string\0 ", + b"I am html string", + "I am html string".decbin(65)."" +); + +//loop through the strings array to check if strip_tags() is binary safe +$iterator = 1; +foreach($strings as $value) +{ + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($value) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(18) " I am html string " +-- Iteration 2 -- +string(18) " I am html string " +-- Iteration 3 -- +string(16) "I am html string" +-- Iteration 4 -- +string(23) "I am html string1000001" +Done diff --git a/ext/standard/tests/strings/strip_tags_variation7.phpt b/ext/standard/tests/strings/strip_tags_variation7.phpt new file mode 100644 index 0000000..784122e --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_variation7.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test strip_tags() function : usage variations - invalid values for 'str' and 'allowable_tags' +--INI-- +short_open_tag = on +--FILE-- +hello \t\tworld... strip_tags_test", + 'hello \t\tworld... strip_tags_test', + "<%?php hello\t world?%>", + '<%?php hello\t world?%>', + "<>hello<>", + '<>hello<>', + "HtMl text", + 'HtMl text', + "I am not a valid html text", + 'I am not a valid html text', + "I am a quoted (\") string with special chars like \$,\!,\@,\%,\&", + 'I am a quoted (\") string with special chars like \$,\!,\@,\%,\&', +); + +$quotes = "<%?<>"; + +//loop through the various elements of strings array to test strip_tags() functionality +$iterator = 1; +foreach($strings as $string_value) +{ + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($string_value, $quotes) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(43) "hello world... strip_tags_test" +-- Iteration 2 -- +string(45) "hello \t\tworld... strip_tags_test" +-- Iteration 3 -- +string(0) "" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(18) "hello" +-- Iteration 6 -- +string(18) "hello" +-- Iteration 7 -- +string(9) "HtMl text" +-- Iteration 8 -- +string(9) "HtMl text" +-- Iteration 9 -- +string(37) "I am not a valid html text" +-- Iteration 10 -- +string(37) "I am not a valid html text" +-- Iteration 11 -- +string(73) "I am a quoted (") string with special chars like $,\!,\@,\%,\&" +-- Iteration 12 -- +string(75) "I am a quoted (\") string with special chars like \$,\!,\@,\%,\&" +Done diff --git a/ext/standard/tests/strings/strip_tags_variation8.phpt b/ext/standard/tests/strings/strip_tags_variation8.phpt new file mode 100644 index 0000000..53482f7 --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_variation8.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test strip_tags() function : usage variations - valid value for 'str' and invalid values for 'allowable_tags' +--INI-- +short_open_tag = on +--FILE-- +hello \tworld...

strip_tags_test\v\f

"; + +$quotes = array ( + "", + '', + "", + '', + "<%?php", + '<%?php', + "<>", + '<>' +); + +//loop through the various elements of strings array to test strip_tags() functionality +$iterator = 1; +foreach($quotes as $string_value) +{ + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($strings, $string_value) ); + $iterator++; +} + +echo "Done"; +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(33) "hello world... strip_tags_test " +-- Iteration 2 -- +string(33) "hello world... strip_tags_test " +-- Iteration 3 -- +string(33) "hello world... strip_tags_test " +-- Iteration 4 -- +string(33) "hello world... strip_tags_test " +-- Iteration 5 -- +string(33) "hello world... strip_tags_test " +-- Iteration 6 -- +string(33) "hello world... strip_tags_test " +-- Iteration 7 -- +string(46) "hello world... strip_tags_test " +-- Iteration 8 -- +string(46) "hello world... strip_tags_test " +Done diff --git a/ext/standard/tests/strings/strip_tags_variation9.phpt b/ext/standard/tests/strings/strip_tags_variation9.phpt new file mode 100644 index 0000000..5edf078 --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_variation9.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test strip_tags() function : usage variations - double quoted strings +--INI-- +short_open_tag = on +--FILE-- + \$ -> This represents the dollar sign", + "\t\r\v The quick brown fo\fx jumped over the lazy dog

", + "This is a hyper text tag", + "hello world\\t?>", + "

This is a paragraph

", + "This is \ta text in bold letters\r\s\malong with slashes\n" +); + +$quotes = "

$ -> This represents the dollar sign" +-- Iteration 2 -- +string(59) " The quick brown fo x jumped over the lazy dog

" +-- Iteration 3 -- +string(31) "
This is a hyper text tag" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(26) "

This is a paragraph

" +-- Iteration 6 -- +string(62) "This is a text in bold letters \s\malong with slashes +" +Done diff --git a/ext/standard/tests/strings/stripcslashes_basic.phpt b/ext/standard/tests/strings/stripcslashes_basic.phpt new file mode 100644 index 0000000..bbd3ea4 --- /dev/null +++ b/ext/standard/tests/strings/stripcslashes_basic.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test stripcslashes() function : basic functionality +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing stripcslashes() : basic functionality *** +string(11) "Hello World" +string(13) "Hello World +" +string(11) "Hello World" +string(11) "Hello World" +===DONE=== + diff --git a/ext/standard/tests/strings/stripcslashes_error.phpt b/ext/standard/tests/strings/stripcslashes_error.phpt new file mode 100644 index 0000000..78103ec --- /dev/null +++ b/ext/standard/tests/strings/stripcslashes_error.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test stripcslashes() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing stripcslashes() : unexpected number of arguments *** +-- Testing stripcslashes() function with no arguments -- + +Warning: stripcslashes() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing stripcslashes() function with more than expected no. of arguments -- + +Warning: stripcslashes() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/strings/stripcslashes_variation1.phpt b/ext/standard/tests/strings/stripcslashes_variation1.phpt new file mode 100644 index 0000000..32c8963 --- /dev/null +++ b/ext/standard/tests/strings/stripcslashes_variation1.phpt @@ -0,0 +1,173 @@ +--TEST-- +Test stripcslashes() function : usage variations - non-string type argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values +/*15*/ true, + false, + TRUE, + FALSE, + + // empty string +/*19*/ "", + '', + + // undefined variable +/*21*/ $undefined_var, + + // unset variable +/*22*/ $unset_var, + + // objects +/*23*/ new sample(), + + // resource +/*24*/ $file_handle, + + // null values +/*25*/ NULL, + null +); + + +// loop through each element of the array and check the working of stripcslashes() +// when $str arugment is supplied with different values +echo "\n--- Testing stripcslashes() by supplying different values for 'str' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str = $values [$index]; + + var_dump( stripcslashes($str) ); + + $counter ++; +} + +// closing the file +fclose($file_handle); + +?> +===DONE=== +--EXPECTF-- +*** Testing stripcslashes() : with non-string type argument *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d + +--- Testing stripcslashes() by supplying different values for 'str' argument --- +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(5) "12345" +-- Iteration 4 -- +string(5) "-2345" +-- Iteration 5 -- +string(4) "10.5" +-- Iteration 6 -- +string(5) "-10.5" +-- Iteration 7 -- +string(12) "101234567000" +-- Iteration 8 -- +string(13) "1.07654321E-9" +-- Iteration 9 -- +string(3) "0.5" +-- Iteration 10 -- + +Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +string(1) "1" +-- Iteration 16 -- +string(0) "" +-- Iteration 17 -- +string(1) "1" +-- Iteration 18 -- +string(0) "" +-- Iteration 19 -- +string(0) "" +-- Iteration 20 -- +string(0) "" +-- Iteration 21 -- +string(0) "" +-- Iteration 22 -- +string(0) "" +-- Iteration 23 -- +string(6) "obj'ct" +-- Iteration 24 -- + +Warning: stripcslashes() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 25 -- +string(0) "" +-- Iteration 26 -- +string(0) "" +===DONE=== diff --git a/ext/standard/tests/strings/stripos.phpt b/ext/standard/tests/strings/stripos.phpt new file mode 100644 index 0000000..ef0efe5 --- /dev/null +++ b/ext/standard/tests/strings/stripos.phpt @@ -0,0 +1,55 @@ +--TEST-- +stripos() function test +--FILE-- + +--EXPECT-- +int(0) +int(5) +int(5) +int(3) +int(10) +int(2) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(1) +Done diff --git a/ext/standard/tests/strings/stripos_basic1.phpt b/ext/standard/tests/strings/stripos_basic1.phpt new file mode 100644 index 0000000..cffbdba --- /dev/null +++ b/ext/standard/tests/strings/stripos_basic1.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test stripos() function : basic functionality - with default arguments +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: basic functionality *** +-- With default arguments -- +int(0) +int(0) +int(7) +int(7) +int(4) +int(5) +int(0) +int(0) +int(0) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_basic2.phpt b/ext/standard/tests/strings/stripos_basic2.phpt new file mode 100644 index 0000000..3022bae --- /dev/null +++ b/ext/standard/tests/strings/stripos_basic2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test stripos() function : basic functionality - with all arguments +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: basic functionality *** +-- With all arguments -- +int(0) +bool(false) +int(7) +int(7) +int(0) +int(0) +bool(false) +int(0) +bool(false) +int(4) +int(8) +int(8) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_error.phpt b/ext/standard/tests/strings/stripos_error.phpt new file mode 100644 index 0000000..ef6ad9e --- /dev/null +++ b/ext/standard/tests/strings/stripos_error.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test stripos() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: error conditions *** + +-- With Zero arguments -- +Warning: stripos() expects at least 2 parameters, 0 given in %s on line %d +NULL + +-- With less than expected number of arguments -- +Warning: stripos() expects at least 2 parameters, 1 given in %s on line %d +NULL + +-- With more than expected number of arguments -- +Warning: stripos() expects at most 3 parameters, 4 given in %s on line %d +NULL +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation1.phpt b/ext/standard/tests/strings/stripos_variation1.phpt new file mode 100644 index 0000000..7aeda40 --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation1.phpt @@ -0,0 +1,218 @@ +--TEST-- +Test stripos() function : usage variations - double quoted strings for 'haystack' & 'needle' arguments +--FILE-- +?@hello123456he \x234 \101 "; +$needle = array( + //regular strings + "l", + "L", + "HELLO", + "hEllo", + + //escape characters + "\t", + "\T", //invalid input + " ", + "\n", + "\N", //invalid input + " +", //new line + + //nulls + "\0", + NULL, + null, + + //boolean false + FALSE, + false, + + //empty string + "", + + //special chars + " ", + "$", + " $", + "&", + "!#", + "%\o", + "\o,", + "()", + "*+", + "+", + "-", + ".", + ".;", + ":;", + ";", + "<=>", + ">", + "=>", + "?", + "@", + "@hEllo", + + "12345", //decimal numeric string + "\x23", //hexadecimal numeric string + "#", //respective ASCII char of \x23 + "\101", //octal numeric string + "A", //respective ASCII char of \101 + "456HEE", //numerics + chars + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECTF-- +*** Testing stripos() function: with double quoted strings *** +-- Iteration 1 -- +int(2) +int(2) +-- Iteration 2 -- +int(2) +int(2) +-- Iteration 3 -- +int(0) +int(34) +-- Iteration 4 -- +int(0) +int(34) +-- Iteration 5 -- +int(6) +int(6) +-- Iteration 6 -- +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +int(7) +int(7) +-- Iteration 9 -- +bool(false) +bool(false) +-- Iteration 10 -- +int(7) +int(9) +-- Iteration 11 -- +int(8) +bool(false) +-- Iteration 12 -- +int(8) +bool(false) +-- Iteration 13 -- +int(8) +bool(false) +-- Iteration 14 -- +int(8) +bool(false) +-- Iteration 15 -- +int(8) +bool(false) +-- Iteration 16 -- +bool(false) +bool(false) +-- Iteration 17 -- +int(10) +int(47) +-- Iteration 18 -- +int(12) +bool(false) +-- Iteration 19 -- +int(11) +bool(false) +-- Iteration 20 -- +int(13) +bool(false) +-- Iteration 21 -- +int(14) +bool(false) +-- Iteration 22 -- +int(16) +bool(false) +-- Iteration 23 -- +int(17) +bool(false) +-- Iteration 24 -- +int(20) +bool(false) +-- Iteration 25 -- +int(22) +bool(false) +-- Iteration 26 -- +int(23) +bool(false) +-- Iteration 27 -- +int(24) +bool(false) +-- Iteration 28 -- +int(25) +bool(false) +-- Iteration 29 -- +bool(false) +bool(false) +-- Iteration 30 -- +int(27) +bool(false) +-- Iteration 31 -- +int(28) +bool(false) +-- Iteration 32 -- +int(29) +bool(false) +-- Iteration 33 -- +int(31) +bool(false) +-- Iteration 34 -- +int(30) +bool(false) +-- Iteration 35 -- +int(32) +bool(false) +-- Iteration 36 -- +int(33) +bool(false) +-- Iteration 37 -- +int(33) +bool(false) +-- Iteration 38 -- +int(39) +int(39) +-- Iteration 39 -- +int(15) +int(48) +-- Iteration 40 -- +int(15) +int(48) +-- Iteration 41 -- +int(51) +int(51) +-- Iteration 42 -- +int(51) +int(51) +-- Iteration 43 -- +bool(false) +bool(false) +-- Iteration 44 -- +int(0) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation10.phpt b/ext/standard/tests/strings/stripos_variation10.phpt new file mode 100644 index 0000000..79ba0ed --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation10.phpt @@ -0,0 +1,188 @@ +--TEST-- +Test stripos() function : usage variations - unexpected inputs for 'needle' argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +// loop through each element of the 'needle' array to check the working of stripos() +$counter = 1; +for($index = 0; $index < count($needles); $index ++) { + echo "\n-- Iteration $counter --\n"; + var_dump( stripos($haystack, $needles[$index]) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing stripos() function with unexpected values for needle *** + +-- Iteration 1 -- +bool(false) + +-- Iteration 2 -- +bool(false) + +-- Iteration 3 -- +bool(false) + +-- Iteration 4 -- +bool(false) + +-- Iteration 5 -- +bool(false) + +-- Iteration 6 -- +bool(false) + +-- Iteration 7 -- +bool(false) + +-- Iteration 8 -- +bool(false) + +-- Iteration 9 -- +bool(false) + +-- Iteration 10 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 15 -- +bool(false) + +-- Iteration 16 -- +bool(false) + +-- Iteration 17 -- +bool(false) + +-- Iteration 18 -- +bool(false) + +-- Iteration 19 -- + +Notice: Object of class sample could not be converted to int in %s on line %d +bool(false) + +-- Iteration 20 -- +bool(false) + +-- Iteration 21 -- +bool(false) + +-- Iteration 22 -- +bool(false) + +-- Iteration 23 -- +bool(false) + +-- Iteration 24 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +%s + +-- Iteration 25 -- +bool(false) + +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation11.phpt b/ext/standard/tests/strings/stripos_variation11.phpt new file mode 100644 index 0000000..a754ffa --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation11.phpt @@ -0,0 +1,215 @@ +--TEST-- +Test stripos() function : usage variations - unexpected inputs for 'haystack' and 'needle' arguments +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop through each element of the array and check the working of stripos() +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $haystack = $values[$index]; + var_dump( stripos($values[$index], $values[$index]) ); + var_dump( stripos($values[$index], $values[$index], 1) ); + $counter ++; +} + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing stripos() function with unexpected values for haystack and needle *** +-- Iteration 1 -- +bool(false) +bool(false) +-- Iteration 2 -- +bool(false) +bool(false) +-- Iteration 3 -- +bool(false) +bool(false) +-- Iteration 4 -- +bool(false) +bool(false) +-- Iteration 5 -- +bool(false) +bool(false) +-- Iteration 6 -- +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +bool(false) +bool(false) +-- Iteration 9 -- +bool(false) +bool(false) +-- Iteration 10 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +bool(false) +bool(false) +-- Iteration 16 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 17 -- +bool(false) +bool(false) +-- Iteration 18 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 19 -- + +Notice: Object of class sample could not be converted to int in %s on line %d +bool(false) + +Notice: Object of class sample could not be converted to int in %s on line %d +bool(false) +-- Iteration 20 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 21 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 22 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 23 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 24 -- + +Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 25 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 26 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation12.phpt b/ext/standard/tests/strings/stripos_variation12.phpt new file mode 100644 index 0000000..bd0d8ae --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation12.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test stripos() function : usage variations - null terminated strings for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Test stripos() function: binary safe *** +int(5) +int(5) +int(0) +bool(false) +int(11) +int(11) +int(0) +bool(false) +int(5) +int(5) +int(0) +bool(false) +int(5) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation13.phpt b/ext/standard/tests/strings/stripos_variation13.phpt new file mode 100644 index 0000000..3c4508f --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation13.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test stripos() function : usage variations - null terminated strings for 'needle' argument +--FILE-- + +--EXPECTF-- +*** Test stripos() function: binary safe *** +int(1) +int(1) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(1) +bool(false) +int(0) +bool(false) +int(1) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation14.phpt b/ext/standard/tests/strings/stripos_variation14.phpt new file mode 100644 index 0000000..023585d --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation14.phpt @@ -0,0 +1,155 @@ +--TEST-- +Test stripos() function : usage variations - unexpected inputs for 'offset' argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + //resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop through each element of the array and check the working of stripos() +$counter = 1; +for($index = 0; $index < count($offsets); $index ++) { + echo "-- Iteration $counter --\n"; + var_dump( stripos($haystack, $needle, $offsets[$index]) ); + $counter ++; +} + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing stripos() function with unexpected values for offset *** +-- Iteration 1 -- +int(6) +-- Iteration 2 -- + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 3 -- + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 4 -- +int(6) +-- Iteration 5 -- +int(6) +-- Iteration 6 -- + +Warning: stripos() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: stripos() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: stripos() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: stripos() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: stripos() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 11 -- +int(6) +-- Iteration 12 -- +int(6) +-- Iteration 13 -- +int(6) +-- Iteration 14 -- +int(6) +-- Iteration 15 -- + +Warning: stripos() expects parameter 3 to be long, object given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: stripos() expects parameter 3 to be long, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: stripos() expects parameter 3 to be long, string given in %s on line %d +NULL +-- Iteration 18 -- +int(6) +-- Iteration 19 -- +int(6) +-- Iteration 20 -- + +Warning: stripos() expects parameter 3 to be long, resource given in %s on line %d +NULL +-- Iteration 21 -- +int(6) +-- Iteration 22 -- +int(6) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation15.phpt b/ext/standard/tests/strings/stripos_variation15.phpt new file mode 100644 index 0000000..2304c1d --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation15.phpt @@ -0,0 +1,171 @@ +--TEST-- +Test stripos() function : usage variations - unexpected inputs for 'haystack', 'needle' & 'offset' arguments +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + //resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop through each element of the array and check the working of stripos() +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + var_dump( stripos($values[$index], $values[$index], $values[$index]) ); + $counter ++; +} + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing stripos() function with unexpected values for haystack, needle & offset *** +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 7 -- + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +bool(false) +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- + +Warning: stripos() expects parameter 3 to be long, object given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: stripos() expects parameter 3 to be long, string given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: stripos() expects parameter 3 to be long, string given in %s on line %d +NULL +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- +bool(false) +-- Iteration 24 -- + +Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation2.phpt b/ext/standard/tests/strings/stripos_variation2.phpt new file mode 100644 index 0000000..c7f3db4 --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation2.phpt @@ -0,0 +1,226 @@ +--TEST-- +Test stripos() function : usage variations - single quoted strings for 'haystack' & 'needle' arguments +--FILE-- +?@hello123456he \x234 \101 '; +$needle = array( + //regular strings + 'l', + 'L', + 'HELLO', + 'hEllo', + + //escape characters + '\t', + '\T', + ' ', + '\n', + '\N', + ' +', //new line + + //nulls + '\0', + NULL, + null, + + //boolean false + FALSE, + false, + + //empty string + '', + + //special chars + ' ', + '$', + ' $', + '&', + '!#', + '%\o', + '\o,', + '()', + '*+', + '+', + '-', + '.', + '.;', + '.;', + ':;', + ';', + '<=>', + '>', + '=>', + '?', + '@', + '@hEllo', + + '12345', //decimal numeric string + '\x23', //hexadecimal numeric string + '#', //hexadecimal numeric string + '\101', //octal numeric string + 'A', + '456HEE', //numerics + chars + 42, //needle as int(ASCII value of '*') + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECTF-- +*** Testing stripos() function: with single quoted strings *** +-- Iteration 1 -- +int(2) +int(2) +-- Iteration 2 -- +int(2) +int(2) +-- Iteration 3 -- +int(0) +int(38) +-- Iteration 4 -- +int(0) +int(38) +-- Iteration 5 -- +int(6) +int(6) +-- Iteration 6 -- +int(6) +int(6) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +int(8) +int(8) +-- Iteration 9 -- +int(8) +int(8) +-- Iteration 10 -- +bool(false) +bool(false) +-- Iteration 11 -- +int(10) +int(10) +-- Iteration 12 -- +bool(false) +bool(false) +-- Iteration 13 -- +bool(false) +bool(false) +-- Iteration 14 -- +bool(false) +bool(false) +-- Iteration 15 -- +bool(false) +bool(false) +-- Iteration 16 -- +bool(false) +bool(false) +-- Iteration 17 -- +int(14) +int(51) +-- Iteration 18 -- +int(16) +bool(false) +-- Iteration 19 -- +int(15) +bool(false) +-- Iteration 20 -- +int(17) +bool(false) +-- Iteration 21 -- +int(18) +bool(false) +-- Iteration 22 -- +int(20) +bool(false) +-- Iteration 23 -- +int(21) +bool(false) +-- Iteration 24 -- +int(24) +int(24) +-- Iteration 25 -- +int(26) +int(26) +-- Iteration 26 -- +int(27) +int(27) +-- Iteration 27 -- +int(28) +int(28) +-- Iteration 28 -- +int(29) +int(29) +-- Iteration 29 -- +bool(false) +bool(false) +-- Iteration 30 -- +bool(false) +bool(false) +-- Iteration 31 -- +int(31) +int(31) +-- Iteration 32 -- +int(32) +int(32) +-- Iteration 33 -- +int(33) +int(33) +-- Iteration 34 -- +int(35) +int(35) +-- Iteration 35 -- +int(34) +int(34) +-- Iteration 36 -- +int(36) +int(36) +-- Iteration 37 -- +int(37) +int(37) +-- Iteration 38 -- +int(37) +int(37) +-- Iteration 39 -- +int(43) +int(43) +-- Iteration 40 -- +int(52) +int(52) +-- Iteration 41 -- +int(19) +bool(false) +-- Iteration 42 -- +int(58) +int(58) +-- Iteration 43 -- +bool(false) +bool(false) +-- Iteration 44 -- +bool(false) +bool(false) +-- Iteration 45 -- +int(26) +bool(false) +-- Iteration 46 -- +int(0) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation3.phpt b/ext/standard/tests/strings/stripos_variation3.phpt new file mode 100644 index 0000000..40cdea4 --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation3.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test stripos() function : usage variations - multi line heredoc string for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: with heredoc strings *** +-- With heredoc string containing multi lines -- +int(14) +int(23) +int(23) +bool(false) +int(7) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation4.phpt b/ext/standard/tests/strings/stripos_variation4.phpt new file mode 100644 index 0000000..8249ef0 --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation4.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test stripos() function : usage variations - heredoc string containing special chars for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: with heredoc strings *** +-- With heredoc string containing special chars -- +int(0) +bool(false) +int(38) +int(39) +int(55) +int(55) +int(57) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation5.phpt b/ext/standard/tests/strings/stripos_variation5.phpt new file mode 100644 index 0000000..900fe04 --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation5.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test stripos() function : usage variations - heredoc string containing escape chars for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: with heredoc strings *** +-- With heredoc string containing escape characters -- +int(12) +int(19) +int(12) +int(19) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation6.phpt b/ext/standard/tests/strings/stripos_variation6.phpt new file mode 100644 index 0000000..c69ee17 --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation6.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test stripos() function : usage variations - heredoc string containing quotes for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: with heredoc strings *** +-- With heredoc string containing quote & slash chars -- +int(88) +int(34) +int(34) +int(34) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation7.phpt b/ext/standard/tests/strings/stripos_variation7.phpt new file mode 100644 index 0000000..29a0a20 --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation7.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test stripos() function : usage variations - empty heredoc string for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: with heredoc strings *** +-- With empty heredoc string -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +bool(false) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation8.phpt b/ext/standard/tests/strings/stripos_variation8.phpt new file mode 100644 index 0000000..cbf96bf --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation8.phpt @@ -0,0 +1,216 @@ +--TEST-- +Test stripos() function : usage variations - repetitive chars for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: strings repetitive chars *** + +-- Iteration 1 -- +int(0) +int(2) +int(2) +int(4) +int(4) +int(6) +int(6) +int(8) +int(8) +int(10) +int(10) +int(12) +int(12) +int(14) +int(14) +int(16) +int(16) +bool(false) +bool(false) +bool(false) + +-- Iteration 2 -- +int(0) +int(2) +int(2) +int(4) +int(4) +int(6) +int(6) +int(8) +int(8) +int(10) +int(10) +int(12) +int(12) +int(14) +int(14) +int(16) +int(16) +bool(false) +bool(false) +bool(false) + +-- Iteration 3 -- +int(0) +int(2) +int(2) +int(4) +int(4) +int(6) +int(6) +int(8) +int(8) +int(10) +int(10) +int(12) +int(12) +int(14) +int(14) +int(16) +int(16) +bool(false) +bool(false) +bool(false) + +-- Iteration 4 -- +int(0) +int(2) +int(2) +int(4) +int(4) +int(6) +int(6) +int(8) +int(8) +int(10) +int(10) +int(12) +int(12) +int(14) +int(14) +int(16) +int(16) +bool(false) +bool(false) +bool(false) + +-- Iteration 5 -- +int(1) +int(1) +int(3) +int(3) +int(5) +int(5) +int(7) +int(7) +int(9) +int(9) +int(11) +int(11) +int(13) +int(13) +int(15) +int(15) +bool(false) +bool(false) +bool(false) +bool(false) + +-- Iteration 6 -- +int(1) +int(1) +int(3) +int(3) +int(5) +int(5) +int(7) +int(7) +int(9) +int(9) +int(11) +int(11) +int(13) +int(13) +int(15) +int(15) +bool(false) +bool(false) +bool(false) +bool(false) + +-- Iteration 7 -- +int(1) +int(1) +int(3) +int(3) +int(5) +int(5) +int(7) +int(7) +int(9) +int(9) +int(11) +int(11) +int(13) +int(13) +int(15) +int(15) +bool(false) +bool(false) +bool(false) +bool(false) + +-- Iteration 8 -- +int(1) +int(1) +int(3) +int(3) +int(5) +int(5) +int(7) +int(7) +int(9) +int(9) +int(11) +int(11) +int(13) +int(13) +int(15) +int(15) +bool(false) +bool(false) +bool(false) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation9.phpt b/ext/standard/tests/strings/stripos_variation9.phpt new file mode 100644 index 0000000..1401dcf --- /dev/null +++ b/ext/standard/tests/strings/stripos_variation9.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test stripos() function : usage variations - unexpected inputs for 'haystack' argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +$needle = "heredoc 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource"; + +// loop through each element of the array and check the working of stripos() +$counter = 1; +for($index = 0; $index < count($haystacks); $index ++) { + echo "\n-- Iteration $counter --\n"; + var_dump( stripos($haystacks[$index], $needle) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing stripos() function with unexpected values for haystack *** + +-- Iteration 1 -- +bool(false) + +-- Iteration 2 -- +bool(false) + +-- Iteration 3 -- +bool(false) + +-- Iteration 4 -- +bool(false) + +-- Iteration 5 -- +bool(false) + +-- Iteration 6 -- +bool(false) + +-- Iteration 7 -- +bool(false) + +-- Iteration 8 -- +bool(false) + +-- Iteration 9 -- +bool(false) + +-- Iteration 10 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 15 -- +bool(false) + +-- Iteration 16 -- +bool(false) + +-- Iteration 17 -- +bool(false) + +-- Iteration 18 -- +bool(false) + +-- Iteration 19 -- +bool(false) + +-- Iteration 20 -- +bool(false) + +-- Iteration 21 -- +bool(false) + +-- Iteration 22 -- +bool(false) + +-- Iteration 23 -- +bool(false) + +-- Iteration 24 -- + +Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d +NULL + +-- Iteration 25 -- +bool(false) + +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/stripslashes_basic.phpt b/ext/standard/tests/strings/stripslashes_basic.phpt new file mode 100644 index 0000000..548aee5 Binary files /dev/null and b/ext/standard/tests/strings/stripslashes_basic.phpt differ diff --git a/ext/standard/tests/strings/stripslashes_error.phpt b/ext/standard/tests/strings/stripslashes_error.phpt new file mode 100644 index 0000000..99d877f --- /dev/null +++ b/ext/standard/tests/strings/stripslashes_error.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test stripslashes() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing stripslashes() : error conditions *** + +-- Testing stripslashes() function with Zero arguments -- + +Warning: stripslashes() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing stripslashes() function with more than expected no. of arguments -- + +Warning: stripslashes() expects exactly 1 parameter, 2 given in %s on line %d +NULL +string(18) "\"hello\"\"world\"" +Done diff --git a/ext/standard/tests/strings/stripslashes_variation1.phpt b/ext/standard/tests/strings/stripslashes_variation1.phpt new file mode 100644 index 0000000..5693a26 --- /dev/null +++ b/ext/standard/tests/strings/stripslashes_variation1.phpt @@ -0,0 +1,172 @@ +--TEST-- +Test stripslashes() function : usage variations - non-string type argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values +/*15*/ true, + false, + TRUE, + FALSE, + + // empty string +/*19*/ "", + '', + + // undefined variable +/*21*/ $undefined_var, + + // unset variable +/*22*/ $unset_var, + + // objects +/*23*/ new sample(), + + // resource +/*24*/ $file_handle, + + // null values +/*25*/ NULL, + null +); + + +// loop through each element of the array and check the working of stripslashes() +// when $str arugment is supplied with different values +echo "\n--- Testing stripslashes() by supplying different values for 'str' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str = $values [$index]; + + var_dump( stripslashes($str) ); + + $counter ++; +} + +// closing the file +fclose($file_handle); + +?> +===DONE=== +--EXPECTF-- +*** Testing stripslashes() : with non-string type argument *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d + +--- Testing stripslashes() by supplying different values for 'str' argument --- +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(5) "12345" +-- Iteration 4 -- +string(5) "-2345" +-- Iteration 5 -- +string(4) "10.5" +-- Iteration 6 -- +string(5) "-10.5" +-- Iteration 7 -- +string(12) "101234567000" +-- Iteration 8 -- +string(13) "1.07654321E-9" +-- Iteration 9 -- +string(3) "0.5" +-- Iteration 10 -- + +Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +string(1) "1" +-- Iteration 16 -- +string(0) "" +-- Iteration 17 -- +string(1) "1" +-- Iteration 18 -- +string(0) "" +-- Iteration 19 -- +string(0) "" +-- Iteration 20 -- +string(0) "" +-- Iteration 21 -- +string(0) "" +-- Iteration 22 -- +string(0) "" +-- Iteration 23 -- +string(6) "obj'ct" +-- Iteration 24 -- + +Warning: stripslashes() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 25 -- +string(0) "" +-- Iteration 26 -- +string(0) "" +===DONE=== diff --git a/ext/standard/tests/strings/stripslashes_variation2.phpt b/ext/standard/tests/strings/stripslashes_variation2.phpt new file mode 100644 index 0000000..c86cd58 Binary files /dev/null and b/ext/standard/tests/strings/stripslashes_variation2.phpt differ diff --git a/ext/standard/tests/strings/stripslashes_variation3.phpt b/ext/standard/tests/strings/stripslashes_variation3.phpt new file mode 100644 index 0000000..2ccf97f --- /dev/null +++ b/ext/standard/tests/strings/stripslashes_variation3.phpt @@ -0,0 +1,124 @@ +--TEST-- +Test stripslashes() function : usage variations - strings with newline and tab characters +--FILE-- + +--EXPECTF-- +*** Testing stripslashes() : with strings containing newline and tab characters *** + +-- Iteration 1 -- +string(1) " +" + +-- Iteration 2 -- +string(1) "n" + +-- Iteration 3 -- +string(12) "Hello +world" + +-- Iteration 4 -- +string(12) "Hello nworld" + +-- Iteration 5 -- +string(1) "n" + +-- Iteration 6 -- +string(1) "n" + +-- Iteration 7 -- +string(12) "Hello nworld" + +-- Iteration 8 -- +string(12) "Hello nworld" + +-- Iteration 9 -- +string(71) "This is line 1 +of 'heredoc' string +This is line 2 +of "heredoc" string" + +-- Iteration 10 -- +string(1) " " + +-- Iteration 11 -- +string(1) "t" + +-- Iteration 12 -- +string(12) "Hello world" + +-- Iteration 13 -- +string(12) "Hello tworld" + +-- Iteration 14 -- +string(1) "t" + +-- Iteration 15 -- +string(1) "t" + +-- Iteration 16 -- +string(12) "Hello tworld" + +-- Iteration 17 -- +string(12) "Hello tworld" + +-- Iteration 18 -- +string(71) "This is line 1 of 'heredoc' string +This is line 2 of "heredoc" string" +Done diff --git a/ext/standard/tests/strings/stripslashes_variation4.phpt b/ext/standard/tests/strings/stripslashes_variation4.phpt new file mode 100644 index 0000000..eccca6a --- /dev/null +++ b/ext/standard/tests/strings/stripslashes_variation4.phpt @@ -0,0 +1,133 @@ +--TEST-- +Test stripslashes() function : usage variations - double dimensional arrays +--FILE-- + +--EXPECTF-- +*** Testing stripslashes() : with double dimensional arrays *** + +-- Iteration 1 -- +array(2) { + [0]=> + string(0) "" + [1]=> + array(0) { + } +} + +-- Iteration 2 -- +array(2) { + [0]=> + string(0) "" + [1]=> + array(1) { + [0]=> + string(0) "" + } +} + +-- Iteration 3 -- +array(3) { + [0]=> + string(4) "f'oo" + [1]=> + string(4) "b'ar" + [2]=> + array(2) { + [0]=> + string(4) "fo'o" + [1]=> + string(4) "b'ar" + } +} + +-- Iteration 4 -- +array(3) { + [0]=> + string(4) "f'oo" + [1]=> + string(4) "b'ar" + [2]=> + array(1) { + [0]=> + string(0) "" + } +} + +-- Iteration 5 -- +array(3) { + [0]=> + string(4) "f'oo" + [1]=> + string(4) "b'ar" + [2]=> + array(3) { + [0]=> + string(4) "fo'o" + [1]=> + string(4) "b'ar" + [2]=> + array(1) { + [0]=> + string(0) "" + } + } +} + +-- Iteration 6 -- +array(3) { + [0]=> + string(4) "f'oo" + [1]=> + string(4) "b'ar" + [2]=> + array(3) { + [0]=> + string(4) "fo'o" + [1]=> + string(4) "b'ar" + [2]=> + array(2) { + [0]=> + string(4) "fo'o" + [1]=> + string(4) "b'ar" + } + } +} +Done diff --git a/ext/standard/tests/strings/stristr.phpt b/ext/standard/tests/strings/stristr.phpt new file mode 100644 index 0000000..8fca54b --- /dev/null +++ b/ext/standard/tests/strings/stristr.phpt @@ -0,0 +1,43 @@ +--TEST-- +stristr() function +--FILE-- + +--EXPECTF-- +Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: stristr() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: stristr(): needle is not a string or an integer in %s on line %d +bool(false) + +Warning: stristr() expects parameter 1 to be string, array given in %s on line %d +NULL +string(11) "tEsT sTrInG" +string(6) "sTrInG" +string(6) "sTrInG" +string(8) "T sTrInG" +string(1) "G" +string(32) "7272696018bdeb2c9a3f8d01fc2a9273" +bool(false) +bool(false) +bool(false) +string(32) "6ec19f52f0766c463f3bb240f4396913" +string(7) " sTrInG" diff --git a/ext/standard/tests/strings/stristr2.phpt b/ext/standard/tests/strings/stristr2.phpt new file mode 100644 index 0000000..4b5ca49 --- /dev/null +++ b/ext/standard/tests/strings/stristr2.phpt @@ -0,0 +1,25 @@ +--TEST-- +stristr() - New parameter: before_needle +--FILE-- + +--EXPECT-- +string(7) "cCdEfGh" +string(2) "Ab" +string(5) "eEfGh" +string(4) "AbCd" +string(11) "azAbCdeEfGh" +string(1) "w" diff --git a/ext/standard/tests/strings/stristr_basic.phpt b/ext/standard/tests/strings/stristr_basic.phpt new file mode 100644 index 0000000..f0a863c --- /dev/null +++ b/ext/standard/tests/strings/stristr_basic.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test stristr() function : basic functionality +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing stristr() : basic functionality *** +string(11) "Test string" +string(6) "stRIng" +string(6) "StrinG" +string(8) "T string" +string(1) "G" +string(6) "005374" +string(4) "tEst" +string(4) "teSt" +string(6) "String" +string(5) "Test " +===DONE=== diff --git a/ext/standard/tests/strings/stristr_error.phpt b/ext/standard/tests/strings/stristr_error.phpt new file mode 100644 index 0000000..831d93f --- /dev/null +++ b/ext/standard/tests/strings/stristr_error.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test stristr() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing stristr() : error conditions *** + +-- Testing stristr() function with no arguments -- + +Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d +NULL + +-- Testing stristr() function with no needle -- + +Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d +NULL + +-- Testing stristr() function with more than expected no. of arguments -- + +Warning: stristr() expects at most 3 parameters, 4 given in %s on line %d +NULL + +-- Testing stristr() function with empty haystack -- + +Warning: stristr(): Empty delimiter in %s on line %d +bool(false) + +-- Testing stristr() function with empty needle -- + +Warning: stristr(): Empty delimiter in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/strings/stristr_variation1.phpt b/ext/standard/tests/strings/stristr_variation1.phpt new file mode 100644 index 0000000..fdbd470 --- /dev/null +++ b/ext/standard/tests/strings/stristr_variation1.phpt @@ -0,0 +1,133 @@ +--TEST-- +Test stristr() function : usage variations - test values for $haystack argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing stristr() function: with unexpected inputs for 'string' argument *** +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(false) +-- Iteration 4 -- +bool(false) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(false) +-- Iteration 7 -- +bool(false) +-- Iteration 8 -- + +Warning: stristr() expects parameter 1 to be string, array given in %s on line %d2 +NULL +-- Iteration 9 -- + +Warning: stristr() expects parameter 1 to be string, array given in %s on line %d2 +NULL +-- Iteration 10 -- + +Warning: stristr() expects parameter 1 to be string, array given in %s on line %d2 +NULL +-- Iteration 11 -- +bool(false) +-- Iteration 12 -- +bool(false) +-- Iteration 13 -- +bool(false) +-- Iteration 14 -- +bool(false) +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +string(7) " object" +-- Iteration 18 -- + +Warning: stristr() expects parameter 1 to be string, resource given in %s on line %d2 +NULL +-- Iteration 19 -- +bool(false) +-- Iteration 20 -- +bool(false) +===DONE=== diff --git a/ext/standard/tests/strings/stristr_variation2.phpt b/ext/standard/tests/strings/stristr_variation2.phpt new file mode 100644 index 0000000..335248d --- /dev/null +++ b/ext/standard/tests/strings/stristr_variation2.phpt @@ -0,0 +1,135 @@ +--TEST-- +Test stristr() function : usage variations - test values for $needle argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing stristr() function: with unexpected inputs for 'needle' argument *** +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(false) +-- Iteration 4 -- +bool(false) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(false) +-- Iteration 7 -- +bool(false) +-- Iteration 8 -- + +Warning: stristr(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 9 -- + +Warning: stristr(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 10 -- + +Warning: stristr(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 11 -- +bool(false) +-- Iteration 12 -- +bool(false) +-- Iteration 13 -- +bool(false) +-- Iteration 14 -- +bool(false) +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- + +Notice: Object of class sample could not be converted to int in %s on line %d +bool(false) +-- Iteration 18 -- + +Warning: stristr(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 19 -- +bool(false) +-- Iteration 20 -- +bool(false) +===DONE=== diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt new file mode 100644 index 0000000..5a1114d Binary files /dev/null and b/ext/standard/tests/strings/strlen.phpt differ diff --git a/ext/standard/tests/strings/strlen_basic.phpt b/ext/standard/tests/strings/strlen_basic.phpt new file mode 100644 index 0000000..3ed2b97 --- /dev/null +++ b/ext/standard/tests/strings/strlen_basic.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test strlen() function : basic functionality +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strlen() : basic functionality *** +int(6) +int(7) +int(0) +int(18) +===DONE=== diff --git a/ext/standard/tests/strings/strlen_error.phpt b/ext/standard/tests/strings/strlen_error.phpt new file mode 100644 index 0000000..552e7c1 --- /dev/null +++ b/ext/standard/tests/strings/strlen_error.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test strlen() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strlen() : unexpected number of arguments *** +-- Testing strlen() function with no arguments -- + +Warning: strlen() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing strlen() function with more than expected no. of arguments -- + +Warning: strlen() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/strings/strlen_variation1.phpt b/ext/standard/tests/strings/strlen_variation1.phpt new file mode 100644 index 0000000..9ba138e --- /dev/null +++ b/ext/standard/tests/strings/strlen_variation1.phpt @@ -0,0 +1,137 @@ +--TEST-- +Test strlen() function : usage variations - unexpected input for '$string' argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strlen() : with unexpected input for 'string' argument *** +-- Iteration 1 -- +int(1) +-- Iteration 2 -- +int(1) +-- Iteration 3 -- +int(2) +-- Iteration 4 -- +int(10) +-- Iteration 5 -- +int(11) +-- Iteration 6 -- +int(4) +-- Iteration 7 -- +int(5) +-- Iteration 8 -- +int(12) +-- Iteration 9 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- +int(1) +-- Iteration 13 -- +int(0) +-- Iteration 14 -- +int(1) +-- Iteration 15 -- +int(0) +-- Iteration 16 -- +int(0) +-- Iteration 17 -- +int(0) +-- Iteration 18 -- +int(13) +-- Iteration 19 -- + +Warning: strlen() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 20 -- +int(0) +-- Iteration 21 -- +int(0) +===DONE=== diff --git a/ext/standard/tests/strings/strnatcasecmp_basic.phpt b/ext/standard/tests/strings/strnatcasecmp_basic.phpt new file mode 100644 index 0000000..d385c19 --- /dev/null +++ b/ext/standard/tests/strings/strnatcasecmp_basic.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test strnatcasecmp() function : basic functionality +--CREDITS-- +Felix De Vliegher +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing strnatcasecmp() : basic functionality *** +int(0) +int(-1) +int(1) +int(-1) +int(1) +int(0) +int(1) +int(1) +int(-1) +int(-1) +int(0) +int(-1) +int(0) +===DONE=== diff --git a/ext/standard/tests/strings/strnatcasecmp_error.phpt b/ext/standard/tests/strings/strnatcasecmp_error.phpt new file mode 100644 index 0000000..45a15da --- /dev/null +++ b/ext/standard/tests/strings/strnatcasecmp_error.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test strnatcasecmp() function : error conditions +--FILE-- + +===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/strnatcasecmp_variation1.phpt b/ext/standard/tests/strings/strnatcasecmp_variation1.phpt new file mode 100644 index 0000000..fb0fb79 --- /dev/null +++ b/ext/standard/tests/strings/strnatcasecmp_variation1.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test strnatcasecmp() function : variation +--CREDITS-- +Felix De Vliegher +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing strnatcasecmp() : variation *** +int(1) +int(6) +int(-2) +int(-1) +int(0) +int(0) +===DONE=== diff --git a/ext/standard/tests/strings/strnatcmp_basic.phpt b/ext/standard/tests/strings/strnatcmp_basic.phpt new file mode 100644 index 0000000..140bd48 --- /dev/null +++ b/ext/standard/tests/strings/strnatcmp_basic.phpt @@ -0,0 +1,80 @@ +--TEST-- +Test strnatcmp() function : basic functionality +--FILE-- + +===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 new file mode 100644 index 0000000..09cc668 --- /dev/null +++ b/ext/standard/tests/strings/strnatcmp_error.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test strnatcmp() function : error conditions +--FILE-- + +===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/strncasecmp_basic.phpt b/ext/standard/tests/strings/strncasecmp_basic.phpt new file mode 100644 index 0000000..34a1b08 --- /dev/null +++ b/ext/standard/tests/strings/strncasecmp_basic.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test strncasecmp() function : basic functionality +--FILE-- + 0 + +echo "-- Testing strncasecmp() with double quoted string --\n"; +var_dump( strncasecmp("Hello", "Hello", 5) ); //expected: int(0) +var_dump( strncasecmp("Hello", "Hi", 5) ); //expected: value < 0 +var_dump( strncasecmp("Hi", "Hello", 5) ); //expected: value > 0 + +echo "-- Testing strncasecmp() with here-doc string --\n"; +$str = << 0 + +echo "*** Done ***"; +?> +--EXPECTREGEX-- +\*\*\* Testing strncasecmp\(\) function: basic functionality \*\*\* +-- Testing strncasecmp\(\) with single quoted string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Testing strncasecmp\(\) with double quoted string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Testing strncasecmp\(\) with here-doc string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +\*\*\* Done \*\*\* diff --git a/ext/standard/tests/strings/strncasecmp_error.phpt b/ext/standard/tests/strings/strncasecmp_error.phpt new file mode 100644 index 0000000..7b2d19e --- /dev/null +++ b/ext/standard/tests/strings/strncasecmp_error.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test strncasecmp() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strncasecmp() function: error conditions *** + +-- Testing strncasecmp() function with Zero arguments -- +Warning: strncasecmp() expects exactly 3 parameters, 0 given in %s on line %d +NULL + +-- Testing strncasecmp() function with less than expected number of arguments -- +Warning: strncasecmp() expects exactly 3 parameters, 1 given in %s on line %d +NULL + +Warning: strncasecmp() expects exactly 3 parameters, 2 given in %s on line %d +NULL + +-- Testing strncasecmp() function with more than expected number of arguments -- +Warning: strncasecmp() expects exactly 3 parameters, 4 given in %s on line %d +NULL + +-- Testing strncasecmp() function with invalid argument -- +Warning: Length must be greater than or equal to 0 in %s on line %d +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation1.phpt b/ext/standard/tests/strings/strncasecmp_variation1.phpt new file mode 100644 index 0000000..bcc6ad3 --- /dev/null +++ b/ext/standard/tests/strings/strncasecmp_variation1.phpt @@ -0,0 +1,135 @@ +--TEST-- +Test strncasecmp() function: usage variations - case-sensitivity +--FILE-- + +--EXPECTF-- +*** Test strncasecmp() function: with alphabets *** +-- Passing upper-case letters for 'str1' -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Passing lower-case letters for 'str1' -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation10.phpt b/ext/standard/tests/strings/strncasecmp_variation10.phpt new file mode 100644 index 0000000..adc9253 --- /dev/null +++ b/ext/standard/tests/strings/strncasecmp_variation10.phpt @@ -0,0 +1,188 @@ +--TEST-- +Test strncasecmp() function : usage variations - unexpected values for 'str1' +--FILE-- + 'red', 'item' => 'pen'), + + /* boolean values */ + true, + false, + TRUE, + FALSE, + + /* nulls */ + NULL, + null, + + /* empty string */ + "", + '', + + /* undefined variable */ + @$undefined_var, + + /* unset variable */ + @$unset_var, + + /* resource */ + $file_handle, + + /* object */ + new sample() +); + +/* loop through each element of the array and check the working of strncasecmp() */ +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str1 = $values[$index]; + $len = strlen($values[$index]) + 1; + var_dump( strncasecmp($str1, "string", $len) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Testing strncasecmp() function: with unexpected values for 'str1' *** +-- Iteration 1 -- +int(-%d) +-- Iteration 2 -- +int(-%d) +-- Iteration 3 -- +int(-%d) +-- Iteration 4 -- +int(-%d) +-- Iteration 5 -- +int(-%d) +-- Iteration 6 -- +int(-%d) +-- Iteration 7 -- +int(-%d) +-- Iteration 8 -- +int(-%d) +-- Iteration 9 -- +int(-%d) +-- Iteration 10 -- +int(-%d) +-- Iteration 11 -- +int(-%d) +-- Iteration 12 -- +int(-%d) +-- Iteration 13 -- +int(-%d) +-- Iteration 14 -- +int(-%d) +-- Iteration 15 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 + +Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 +NULL +-- Iteration 16 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 + +Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 +NULL +-- Iteration 17 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 + +Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 +NULL +-- Iteration 18 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 + +Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 +NULL +-- Iteration 19 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 + +Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 +NULL +-- Iteration 20 -- +int(-%d) +-- Iteration 21 -- +int(-%d) +-- Iteration 22 -- +int(-%d) +-- Iteration 23 -- +int(-%d) +-- Iteration 24 -- +int(-%d) +-- Iteration 25 -- +int(-%d) +-- Iteration 26 -- +int(-%d) +-- Iteration 27 -- +int(-%d) +-- Iteration 28 -- +int(-%d) +-- Iteration 29 -- +int(-%d) +-- Iteration 30 -- + +Warning: strlen() expects parameter 1 to be string, resource given in %s on line 88 + +Warning: strncasecmp() expects parameter 1 to be string, resource given in %s on line 89 +NULL +-- Iteration 31 -- +int(-%d) +*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation11.phpt b/ext/standard/tests/strings/strncasecmp_variation11.phpt new file mode 100644 index 0000000..03cc837 --- /dev/null +++ b/ext/standard/tests/strings/strncasecmp_variation11.phpt @@ -0,0 +1,189 @@ +--TEST-- +Test strncasecmp() function : usage variations - unexpected values for 'str2' +--FILE-- + 'red', 'item' => 'pen'), + + /* boolean values */ + true, + false, + TRUE, + FALSE, + + /* nulls */ + NULL, + null, + + /* empty string */ + "", + '', + + /* undefined variable */ + @$undefined_var, + + /* unset variable */ + @$unset_var, + + /* resource */ + $file_handle, + + /* object */ + new sample() +); + +/* loop through each element of the array and check the working of strncasecmp() */ +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str1 = $values[$index]; + $str2 = $values[$index]; + $len = strlen($values[$index]) + 1; + var_dump( strncasecmp("string", $str2, $len) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Testing strncasecmp() function: with unexpected values for 'str2' *** +-- Iteration 1 -- +int(%d) +-- Iteration 2 -- +int(%d) +-- Iteration 3 -- +int(%d) +-- Iteration 4 -- +int(%d) +-- Iteration 5 -- +int(%d) +-- Iteration 6 -- +int(%d) +-- Iteration 7 -- +int(%d) +-- Iteration 8 -- +int(%d) +-- Iteration 9 -- +int(%d) +-- Iteration 10 -- +int(%d) +-- Iteration 11 -- +int(%d) +-- Iteration 12 -- +int(%d) +-- Iteration 13 -- +int(%d) +-- Iteration 14 -- +int(%d) +-- Iteration 15 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 20 -- +int(%d) +-- Iteration 21 -- +int(%d) +-- Iteration 22 -- +int(%d) +-- Iteration 23 -- +int(%d) +-- Iteration 24 -- +int(%d) +-- Iteration 25 -- +int(%d) +-- Iteration 26 -- +int(%d) +-- Iteration 27 -- +int(%d) +-- Iteration 28 -- +int(%d) +-- Iteration 29 -- +int(%d) +-- Iteration 30 -- + +Warning: strlen() expects parameter 1 to be string, resource given in %s on line %d + +Warning: strncasecmp() expects parameter 2 to be string, resource given in %s on line %d +NULL +-- Iteration 31 -- +int(4) +*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation2.phpt b/ext/standard/tests/strings/strncasecmp_variation2.phpt new file mode 100644 index 0000000..a6f8c1e --- /dev/null +++ b/ext/standard/tests/strings/strncasecmp_variation2.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test strncasecmp() function: usage variations - double quoted strings +--FILE-- + +--EXPECTREGEX-- +\*\*\* Test strncasecmp\(\) function: with double quoted strings \*\*\* +-- Iteration 1 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 2 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 3 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 4 -- +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +-- Iteration 5 -- +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/ext/standard/tests/strings/strncasecmp_variation3.phpt b/ext/standard/tests/strings/strncasecmp_variation3.phpt new file mode 100644 index 0000000..8409260 --- /dev/null +++ b/ext/standard/tests/strings/strncasecmp_variation3.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test strncasecmp() function: usage variations - various lengths +--FILE-- += 0; $len--) { + var_dump( strncasecmp($str1, $str2, $len) ); +} +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Test strncasecmp() function: with different lengths *** +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation4.phpt b/ext/standard/tests/strings/strncasecmp_variation4.phpt new file mode 100644 index 0000000..9d46db9 --- /dev/null +++ b/ext/standard/tests/strings/strncasecmp_variation4.phpt @@ -0,0 +1,189 @@ +--TEST-- +Test strncasecmp() function : usage variations - unexpected values for 'str1' & 'str2' +--FILE-- + 'red', 'item' => 'pen'), + + /* boolean values */ + true, + false, + TRUE, + FALSE, + + /* nulls */ + NULL, + null, + + /* empty string */ + "", + '', + + /* undefined variable */ + @$undefined_var, + + /* unset variable */ + @$unset_var, + + /* resource */ + $file_handle, + + /* object */ + new sample() +); + +/* loop through each element of the array and check the working of strncasecmp() */ +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str1 = $values[$index]; + $str2 = $values[$index]; + $len = strlen($values[$index]) + 1; + var_dump( strncasecmp($str1, $str2, $len) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Testing strncasecmp() function: with unexpected values for 'str1' and 'str2' *** +-- Iteration 1 -- +int(0) +-- Iteration 2 -- +int(0) +-- Iteration 3 -- +int(0) +-- Iteration 4 -- +int(0) +-- Iteration 5 -- +int(0) +-- Iteration 6 -- +int(0) +-- Iteration 7 -- +int(0) +-- Iteration 8 -- +int(0) +-- Iteration 9 -- +int(0) +-- Iteration 10 -- +int(0) +-- Iteration 11 -- +int(0) +-- Iteration 12 -- +int(0) +-- Iteration 13 -- +int(0) +-- Iteration 14 -- +int(0) +-- Iteration 15 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 20 -- +int(0) +-- Iteration 21 -- +int(0) +-- Iteration 22 -- +int(0) +-- Iteration 23 -- +int(0) +-- Iteration 24 -- +int(0) +-- Iteration 25 -- +int(0) +-- Iteration 26 -- +int(0) +-- Iteration 27 -- +int(0) +-- Iteration 28 -- +int(0) +-- Iteration 29 -- +int(0) +-- Iteration 30 -- + +Warning: strlen() expects parameter 1 to be string, resource given in %s on line %d + +Warning: strncasecmp() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 31 -- +int(0) +*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation5.phpt b/ext/standard/tests/strings/strncasecmp_variation5.phpt new file mode 100644 index 0000000..c391ba3 --- /dev/null +++ b/ext/standard/tests/strings/strncasecmp_variation5.phpt @@ -0,0 +1,163 @@ +--TEST-- +Test strncasecmp() function : usage variations - unexpected values for 'len' +--FILE-- + 'red', 'item' => 'pen'), + + /* boolean values */ + true, + false, + TRUE, + FALSE, + + /* nulls */ + NULL, + null, + + /* empty string */ + "", + '', + + /* undefined variable */ + @$undefined_var, + + /* unset variable */ + @$unset_var, + + /* resource */ + $file_handle, + + /* object */ + new sample() +); + +/* loop through each element of the array and check the working of strncasecmp() */ +$counter = 1; +for($index = 0; $index < count($lengths); $index ++) { + $len = $lengths[$index]; + echo "-- Iteration $counter --\n"; + var_dump( strncasecmp($str1, $str2, $len) ); + $counter ++; +} +fclose($file_handle); + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Test strncasecmp() function: unexpected values for 'len' *** +-- Iteration 1 -- +int(0) +-- Iteration 2 -- +int(0) +-- Iteration 3 -- +int(0) +-- Iteration 4 -- +int(0) +-- Iteration 5 -- +int(0) +-- Iteration 6 -- +int(0) +-- Iteration 7 -- +int(0) +-- Iteration 8 -- + +Warning: strncasecmp() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: strncasecmp() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: strncasecmp() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: strncasecmp() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: strncasecmp() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 13 -- +int(0) +-- Iteration 14 -- +int(0) +-- Iteration 15 -- +int(0) +-- Iteration 16 -- +int(0) +-- Iteration 17 -- +int(0) +-- Iteration 18 -- +int(0) +-- Iteration 19 -- + +Warning: strncasecmp() expects parameter 3 to be long, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: strncasecmp() expects parameter 3 to be long, string given in %s on line %d +NULL +-- Iteration 21 -- +int(0) +-- Iteration 22 -- +int(0) +-- Iteration 23 -- + +Warning: strncasecmp() expects parameter 3 to be long, resource given in %s on line %d +NULL +-- Iteration 24 -- + +Warning: strncasecmp() expects parameter 3 to be long, object given in %s on line %d +NULL +*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation6.phpt b/ext/standard/tests/strings/strncasecmp_variation6.phpt new file mode 100644 index 0000000..765032b --- /dev/null +++ b/ext/standard/tests/strings/strncasecmp_variation6.phpt @@ -0,0 +1,810 @@ +--TEST-- +Test strncasecmp() function : usage variations - binary safe - all ASCII chars +--FILE-- + +--EXPECTF-- +*** Test strncasecmp() function: with binary inputs *** + +-- Checking with all 256 characters given, in binary format -- +-- Iteration 1 -- +int(0) +int(0) +-- Iteration 2 -- +int(0) +int(0) +-- Iteration 3 -- +int(0) +int(0) +-- Iteration 4 -- +int(0) +int(0) +-- Iteration 5 -- +int(0) +int(0) +-- Iteration 6 -- +int(0) +int(0) +-- Iteration 7 -- +int(0) +int(0) +-- Iteration 8 -- +int(0) +int(0) +-- Iteration 9 -- +int(0) +int(0) +-- Iteration 10 -- +int(0) +int(0) +-- Iteration 11 -- +int(0) +int(0) +-- Iteration 12 -- +int(0) +int(0) +-- Iteration 13 -- +int(0) +int(0) +-- Iteration 14 -- +int(0) +int(0) +-- Iteration 15 -- +int(0) +int(0) +-- Iteration 16 -- +int(0) +int(0) +-- Iteration 17 -- +int(0) +int(0) +-- Iteration 18 -- +int(0) +int(0) +-- Iteration 19 -- +int(0) +int(0) +-- Iteration 20 -- +int(0) +int(0) +-- Iteration 21 -- +int(0) +int(0) +-- Iteration 22 -- +int(0) +int(0) +-- Iteration 23 -- +int(0) +int(0) +-- Iteration 24 -- +int(0) +int(0) +-- Iteration 25 -- +int(0) +int(0) +-- Iteration 26 -- +int(0) +int(0) +-- Iteration 27 -- +int(0) +int(0) +-- Iteration 28 -- +int(0) +int(0) +-- Iteration 29 -- +int(0) +int(0) +-- Iteration 30 -- +int(0) +int(0) +-- Iteration 31 -- +int(0) +int(0) +-- Iteration 32 -- +int(0) +int(0) +-- Iteration 33 -- +int(0) +int(0) +-- Iteration 34 -- +int(0) +int(0) +-- Iteration 35 -- +int(0) +int(0) +-- Iteration 36 -- +int(0) +int(0) +-- Iteration 37 -- +int(0) +int(0) +-- Iteration 38 -- +int(0) +int(0) +-- Iteration 39 -- +int(0) +int(0) +-- Iteration 40 -- +int(0) +int(0) +-- Iteration 41 -- +int(0) +int(0) +-- Iteration 42 -- +int(0) +int(0) +-- Iteration 43 -- +int(0) +int(0) +-- Iteration 44 -- +int(0) +int(0) +-- Iteration 45 -- +int(0) +int(0) +-- Iteration 46 -- +int(0) +int(0) +-- Iteration 47 -- +int(0) +int(0) +-- Iteration 48 -- +int(0) +int(0) +-- Iteration 49 -- +int(0) +int(0) +-- Iteration 50 -- +int(0) +int(0) +-- Iteration 51 -- +int(0) +int(0) +-- Iteration 52 -- +int(0) +int(0) +-- Iteration 53 -- +int(0) +int(0) +-- Iteration 54 -- +int(0) +int(0) +-- Iteration 55 -- +int(0) +int(0) +-- Iteration 56 -- +int(0) +int(0) +-- Iteration 57 -- +int(0) +int(0) +-- Iteration 58 -- +int(0) +int(0) +-- Iteration 59 -- +int(0) +int(0) +-- Iteration 60 -- +int(0) +int(0) +-- Iteration 61 -- +int(0) +int(0) +-- Iteration 62 -- +int(0) +int(0) +-- Iteration 63 -- +int(0) +int(0) +-- Iteration 64 -- +int(0) +int(0) +-- Iteration 65 -- +int(0) +int(0) +-- Iteration 66 -- +int(0) +int(0) +-- Iteration 67 -- +int(0) +int(0) +-- Iteration 68 -- +int(0) +int(0) +-- Iteration 69 -- +int(0) +int(0) +-- Iteration 70 -- +int(0) +int(0) +-- Iteration 71 -- +int(0) +int(0) +-- Iteration 72 -- +int(0) +int(0) +-- Iteration 73 -- +int(0) +int(0) +-- Iteration 74 -- +int(0) +int(0) +-- Iteration 75 -- +int(0) +int(0) +-- Iteration 76 -- +int(0) +int(0) +-- Iteration 77 -- +int(0) +int(0) +-- Iteration 78 -- +int(0) +int(0) +-- Iteration 79 -- +int(0) +int(0) +-- Iteration 80 -- +int(0) +int(0) +-- Iteration 81 -- +int(0) +int(0) +-- Iteration 82 -- +int(0) +int(0) +-- Iteration 83 -- +int(0) +int(0) +-- Iteration 84 -- +int(0) +int(0) +-- Iteration 85 -- +int(0) +int(0) +-- Iteration 86 -- +int(0) +int(0) +-- Iteration 87 -- +int(0) +int(0) +-- Iteration 88 -- +int(0) +int(0) +-- Iteration 89 -- +int(0) +int(0) +-- Iteration 90 -- +int(0) +int(0) +-- Iteration 91 -- +int(0) +int(0) +-- Iteration 92 -- +int(0) +int(0) +-- Iteration 93 -- +int(0) +int(0) +-- Iteration 94 -- +int(0) +int(0) +-- Iteration 95 -- +int(0) +int(0) +-- Iteration 96 -- +int(0) +int(0) +-- Iteration 97 -- +int(0) +int(0) +-- Iteration 98 -- +int(0) +int(0) +-- Iteration 99 -- +int(0) +int(0) +-- Iteration 100 -- +int(0) +int(0) +-- Iteration 101 -- +int(0) +int(0) +-- Iteration 102 -- +int(0) +int(0) +-- Iteration 103 -- +int(0) +int(0) +-- Iteration 104 -- +int(0) +int(0) +-- Iteration 105 -- +int(0) +int(0) +-- Iteration 106 -- +int(0) +int(0) +-- Iteration 107 -- +int(0) +int(0) +-- Iteration 108 -- +int(0) +int(0) +-- Iteration 109 -- +int(0) +int(0) +-- Iteration 110 -- +int(0) +int(0) +-- Iteration 111 -- +int(0) +int(0) +-- Iteration 112 -- +int(0) +int(0) +-- Iteration 113 -- +int(0) +int(0) +-- Iteration 114 -- +int(0) +int(0) +-- Iteration 115 -- +int(0) +int(0) +-- Iteration 116 -- +int(0) +int(0) +-- Iteration 117 -- +int(0) +int(0) +-- Iteration 118 -- +int(0) +int(0) +-- Iteration 119 -- +int(0) +int(0) +-- Iteration 120 -- +int(0) +int(0) +-- Iteration 121 -- +int(0) +int(0) +-- Iteration 122 -- +int(0) +int(0) +-- Iteration 123 -- +int(0) +int(0) +-- Iteration 124 -- +int(0) +int(0) +-- Iteration 125 -- +int(0) +int(0) +-- Iteration 126 -- +int(0) +int(0) +-- Iteration 127 -- +int(0) +int(0) +-- Iteration 128 -- +int(0) +int(0) +-- Iteration 129 -- +int(0) +int(0) +-- Iteration 130 -- +int(0) +int(0) +-- Iteration 131 -- +int(0) +int(0) +-- Iteration 132 -- +int(0) +int(0) +-- Iteration 133 -- +int(0) +int(0) +-- Iteration 134 -- +int(0) +int(0) +-- Iteration 135 -- +int(0) +int(0) +-- Iteration 136 -- +int(0) +int(0) +-- Iteration 137 -- +int(0) +int(0) +-- Iteration 138 -- +int(0) +int(0) +-- Iteration 139 -- +int(0) +int(0) +-- Iteration 140 -- +int(0) +int(0) +-- Iteration 141 -- +int(0) +int(0) +-- Iteration 142 -- +int(0) +int(0) +-- Iteration 143 -- +int(0) +int(0) +-- Iteration 144 -- +int(0) +int(0) +-- Iteration 145 -- +int(0) +int(0) +-- Iteration 146 -- +int(0) +int(0) +-- Iteration 147 -- +int(0) +int(0) +-- Iteration 148 -- +int(0) +int(0) +-- Iteration 149 -- +int(0) +int(0) +-- Iteration 150 -- +int(0) +int(0) +-- Iteration 151 -- +int(0) +int(0) +-- Iteration 152 -- +int(0) +int(0) +-- Iteration 153 -- +int(0) +int(0) +-- Iteration 154 -- +int(0) +int(0) +-- Iteration 155 -- +int(0) +int(0) +-- Iteration 156 -- +int(0) +int(0) +-- Iteration 157 -- +int(0) +int(0) +-- Iteration 158 -- +int(0) +int(0) +-- Iteration 159 -- +int(0) +int(0) +-- Iteration 160 -- +int(0) +int(0) +-- Iteration 161 -- +int(0) +int(0) +-- Iteration 162 -- +int(0) +int(0) +-- Iteration 163 -- +int(0) +int(0) +-- Iteration 164 -- +int(0) +int(0) +-- Iteration 165 -- +int(0) +int(0) +-- Iteration 166 -- +int(0) +int(0) +-- Iteration 167 -- +int(0) +int(0) +-- Iteration 168 -- +int(0) +int(0) +-- Iteration 169 -- +int(0) +int(0) +-- Iteration 170 -- +int(0) +int(0) +-- Iteration 171 -- +int(0) +int(0) +-- Iteration 172 -- +int(0) +int(0) +-- Iteration 173 -- +int(0) +int(0) +-- Iteration 174 -- +int(0) +int(0) +-- Iteration 175 -- +int(0) +int(0) +-- Iteration 176 -- +int(0) +int(0) +-- Iteration 177 -- +int(0) +int(0) +-- Iteration 178 -- +int(0) +int(0) +-- Iteration 179 -- +int(0) +int(0) +-- Iteration 180 -- +int(0) +int(0) +-- Iteration 181 -- +int(0) +int(0) +-- Iteration 182 -- +int(0) +int(0) +-- Iteration 183 -- +int(0) +int(0) +-- Iteration 184 -- +int(0) +int(0) +-- Iteration 185 -- +int(0) +int(0) +-- Iteration 186 -- +int(0) +int(0) +-- Iteration 187 -- +int(0) +int(0) +-- Iteration 188 -- +int(0) +int(0) +-- Iteration 189 -- +int(0) +int(0) +-- Iteration 190 -- +int(0) +int(0) +-- Iteration 191 -- +int(0) +int(0) +-- Iteration 192 -- +int(0) +int(0) +-- Iteration 193 -- +int(0) +int(0) +-- Iteration 194 -- +int(0) +int(0) +-- Iteration 195 -- +int(0) +int(0) +-- Iteration 196 -- +int(0) +int(0) +-- Iteration 197 -- +int(0) +int(0) +-- Iteration 198 -- +int(0) +int(0) +-- Iteration 199 -- +int(0) +int(0) +-- Iteration 200 -- +int(0) +int(0) +-- Iteration 201 -- +int(0) +int(0) +-- Iteration 202 -- +int(0) +int(0) +-- Iteration 203 -- +int(0) +int(0) +-- Iteration 204 -- +int(0) +int(0) +-- Iteration 205 -- +int(0) +int(0) +-- Iteration 206 -- +int(0) +int(0) +-- Iteration 207 -- +int(0) +int(0) +-- Iteration 208 -- +int(0) +int(0) +-- Iteration 209 -- +int(0) +int(0) +-- Iteration 210 -- +int(0) +int(0) +-- Iteration 211 -- +int(0) +int(0) +-- Iteration 212 -- +int(0) +int(0) +-- Iteration 213 -- +int(0) +int(0) +-- Iteration 214 -- +int(0) +int(0) +-- Iteration 215 -- +int(0) +int(0) +-- Iteration 216 -- +int(0) +int(0) +-- Iteration 217 -- +int(0) +int(0) +-- Iteration 218 -- +int(0) +int(0) +-- Iteration 219 -- +int(0) +int(0) +-- Iteration 220 -- +int(0) +int(0) +-- Iteration 221 -- +int(0) +int(0) +-- Iteration 222 -- +int(0) +int(0) +-- Iteration 223 -- +int(0) +int(0) +-- Iteration 224 -- +int(0) +int(0) +-- Iteration 225 -- +int(0) +int(0) +-- Iteration 226 -- +int(0) +int(0) +-- Iteration 227 -- +int(0) +int(0) +-- Iteration 228 -- +int(0) +int(0) +-- Iteration 229 -- +int(0) +int(0) +-- Iteration 230 -- +int(0) +int(0) +-- Iteration 231 -- +int(0) +int(0) +-- Iteration 232 -- +int(0) +int(0) +-- Iteration 233 -- +int(0) +int(0) +-- Iteration 234 -- +int(0) +int(0) +-- Iteration 235 -- +int(0) +int(0) +-- Iteration 236 -- +int(0) +int(0) +-- Iteration 237 -- +int(0) +int(0) +-- Iteration 238 -- +int(0) +int(0) +-- Iteration 239 -- +int(0) +int(0) +-- Iteration 240 -- +int(0) +int(0) +-- Iteration 241 -- +int(0) +int(0) +-- Iteration 242 -- +int(0) +int(0) +-- Iteration 243 -- +int(0) +int(0) +-- Iteration 244 -- +int(0) +int(0) +-- Iteration 245 -- +int(0) +int(0) +-- Iteration 246 -- +int(0) +int(0) +-- Iteration 247 -- +int(0) +int(0) +-- Iteration 248 -- +int(0) +int(0) +-- Iteration 249 -- +int(0) +int(0) +-- Iteration 250 -- +int(0) +int(0) +-- Iteration 251 -- +int(0) +int(0) +-- Iteration 252 -- +int(0) +int(0) +-- Iteration 253 -- +int(0) +int(0) +-- Iteration 254 -- +int(0) +int(0) +-- Iteration 255 -- +int(0) +int(0) +-- Iteration 256 -- +int(0) +int(0) + +-- Checking with out of character's range, given in binary format -- +int(1) + +*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation7.phpt b/ext/standard/tests/strings/strncasecmp_variation7.phpt new file mode 100644 index 0000000..e22fad7 --- /dev/null +++ b/ext/standard/tests/strings/strncasecmp_variation7.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test strncasecmp() function : usage variations - binary safe +--FILE-- + +--EXPECTF-- +*** Test strncasecmp() function: with null terminated strings and binary inputs *** +int(5) +int(-119) +*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation8.phpt b/ext/standard/tests/strings/strncasecmp_variation8.phpt new file mode 100644 index 0000000..6011a7b --- /dev/null +++ b/ext/standard/tests/strings/strncasecmp_variation8.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test strncasecmp() function: usage variations - single quoted strings +--FILE-- + +--EXPECTREGEX-- +\*\*\* Test strncasecmp\(\) function: with single quoted strings \*\*\* +-- Iteration 1 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +-- Iteration 2 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +-- Iteration 3 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +-- Iteration 4 -- +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/ext/standard/tests/strings/strncasecmp_variation9.phpt b/ext/standard/tests/strings/strncasecmp_variation9.phpt new file mode 100644 index 0000000..0d71303 --- /dev/null +++ b/ext/standard/tests/strings/strncasecmp_variation9.phpt @@ -0,0 +1,92 @@ +--TEST-- +Test strncasecmp() function: usage variations - heredoc strings +--FILE-- + +--EXPECTF-- +*** Test strncasecmp() function: with here-doc strings *** +int(0) +int(63) +int(0) +int(84) +int(0) +int(-1) +int(0) +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +*** Done *** diff --git a/ext/standard/tests/strings/strncmp_basic.phpt b/ext/standard/tests/strings/strncmp_basic.phpt new file mode 100644 index 0000000..3170398 --- /dev/null +++ b/ext/standard/tests/strings/strncmp_basic.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test strncmp() function : basic functionality +--FILE-- + 0 + +echo "-- Testing strncmp() with double quoted string --\n"; +var_dump( strncmp("Hello", "Hello", 5) ); //expected: int(0) +var_dump( strncmp("Hello", "Hi", 5) ); //expected: value < 0 +var_dump( strncmp("Hi", "Hello", 5) ); //expected: value > 0 + +echo "-- Testing strncmp() with here-doc string --\n"; +$str = << 0 + +echo "*** Done ***"; +?> +--EXPECTREGEX-- +\*\*\* Testing strncmp\(\) function: basic functionality \*\*\* +-- Testing strncmp\(\) with single quoted string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Testing strncmp\(\) with double quoted string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Testing strncmp\(\) with here-doc string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +\*\*\* Done \*\*\* diff --git a/ext/standard/tests/strings/strncmp_error.phpt b/ext/standard/tests/strings/strncmp_error.phpt new file mode 100644 index 0000000..8e4d280 --- /dev/null +++ b/ext/standard/tests/strings/strncmp_error.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test strncmp() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strncmp() function: error conditions *** + +Warning: strncmp() expects exactly 3 parameters, 0 given in %s on line %d +NULL + +Warning: strncmp() expects exactly 3 parameters, 1 given in %s on line %d +NULL + +Warning: strncmp() expects exactly 3 parameters, 2 given in %s on line %d +NULL + +Warning: strncmp() expects exactly 3 parameters, 4 given in %s on line %d +NULL + +Warning: Length must be greater than or equal to 0 in %s on line %d +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strncmp_variation1.phpt b/ext/standard/tests/strings/strncmp_variation1.phpt new file mode 100644 index 0000000..2fc3c3d --- /dev/null +++ b/ext/standard/tests/strings/strncmp_variation1.phpt @@ -0,0 +1,135 @@ +--TEST-- +Test strncmp() function: usage variations - case-sensitivity +--FILE-- + 0 +} +echo "*** Done ***"; +?> +--EXPECTREGEX-- +\*\*\* Test strncmp\(\) function: with alphabets \*\*\* +-- Passing upper-case letters for 'str1' -- +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) + +-- Passing lower-case letters for 'str1' -- +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +\*\*\* Done \*\*\* diff --git a/ext/standard/tests/strings/strncmp_variation2.phpt b/ext/standard/tests/strings/strncmp_variation2.phpt new file mode 100644 index 0000000..3c74522 --- /dev/null +++ b/ext/standard/tests/strings/strncmp_variation2.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test strncmp() function: usage variations - double quoted strings +--FILE-- + +--EXPECTREGEX-- +\*\*\* Test strncmp\(\) function: with double quoted strings \*\*\* +-- Iteration 1 -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 2 -- +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 3 -- +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +-- Iteration 4 -- +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +-- Iteration 5 -- +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/ext/standard/tests/strings/strncmp_variation3.phpt b/ext/standard/tests/strings/strncmp_variation3.phpt new file mode 100644 index 0000000..6a703c7 --- /dev/null +++ b/ext/standard/tests/strings/strncmp_variation3.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test strncmp() function: usage variations - different lengths +--FILE-- += 0; $len--) { + var_dump( strncmp($str1, $str2, $len) ); +} +echo "*** Done ***\n"; +?> +--EXPECTREGEX-- +\*\*\* Test strncmp\(\) function: with different lengths \*\*\* +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/ext/standard/tests/strings/strncmp_variation4.phpt b/ext/standard/tests/strings/strncmp_variation4.phpt new file mode 100644 index 0000000..84684ea --- /dev/null +++ b/ext/standard/tests/strings/strncmp_variation4.phpt @@ -0,0 +1,192 @@ +--TEST-- +Test strncmp() function : usage variations - different inputs(all types) +--FILE-- + 'red', 'item' => 'pen'), + + /* boolean values */ + true, + false, + TRUE, + FALSE, + + /* nulls */ + NULL, + null, + + /* empty string */ + "", + '', + + /* undefined variable */ + $undefined_var, + + /* unset variable */ + $unset_var, + + /* resource */ + $file_handle, + + /* object */ + new sample() +); + +/* loop through each element of the array and check the working of strncmp() */ +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str1 = $values[$index]; + $str2 = $values[$index]; + $len = strlen($values[$index]) + 1; + var_dump( strncmp($str1, $str2, $len) ); + $counter ++; +} +fclose($file_handle); + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Testing strncmp() function: by supplying all types for 'str1' and 'str2' *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d +-- Iteration 1 -- +int(0) +-- Iteration 2 -- +int(0) +-- Iteration 3 -- +int(0) +-- Iteration 4 -- +int(0) +-- Iteration 5 -- +int(0) +-- Iteration 6 -- +int(0) +-- Iteration 7 -- +int(0) +-- Iteration 8 -- +int(0) +-- Iteration 9 -- +int(0) +-- Iteration 10 -- +int(0) +-- Iteration 11 -- +int(0) +-- Iteration 12 -- +int(0) +-- Iteration 13 -- +int(0) +-- Iteration 14 -- +int(0) +-- Iteration 15 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: strlen() expects parameter 1 to be string, array given in %s on line %d + +Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 20 -- +int(0) +-- Iteration 21 -- +int(0) +-- Iteration 22 -- +int(0) +-- Iteration 23 -- +int(0) +-- Iteration 24 -- +int(0) +-- Iteration 25 -- +int(0) +-- Iteration 26 -- +int(0) +-- Iteration 27 -- +int(0) +-- Iteration 28 -- +int(0) +-- Iteration 29 -- +int(0) +-- Iteration 30 -- + +Warning: strlen() expects parameter 1 to be string, resource given in %s on line %d + +Warning: strncmp() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 31 -- +int(0) +*** Done *** diff --git a/ext/standard/tests/strings/strncmp_variation5.phpt b/ext/standard/tests/strings/strncmp_variation5.phpt new file mode 100644 index 0000000..73d7e8f --- /dev/null +++ b/ext/standard/tests/strings/strncmp_variation5.phpt @@ -0,0 +1,177 @@ +--TEST-- +Test strncmp() function : usage variations - different lengths(all types) +--FILE-- + 'red', 'item' => 'pen'), + + /* boolean values */ + true, + false, + TRUE, + FALSE, + + /* nulls */ + NULL, + null, + + /* empty string */ + "", + '', + + /* undefined variable */ + $undefined_var, + + /* unset variable */ + $unset_var, + + /* resource */ + $file_handle, + + /* object */ + new sample() +); + +/* loop through each element of the array and check the working of strncmp() */ +$counter = 1; +for($index = 0; $index < count($lengths); $index ++) { + $len = $lengths[$index]; + echo "-- Iteration $counter --\n"; + var_dump( strncmp($str1, $str2, $len) ); + $counter ++; +} +fclose($file_handle); + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Test strncmp() function: by supplying all types for 'len' *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d +-- Iteration 1 -- +int(0) +-- Iteration 2 -- +int(0) +-- Iteration 3 -- +int(0) +-- Iteration 4 -- +int(0) +-- Iteration 5 -- +int(0) +-- Iteration 6 -- +int(0) +-- Iteration 7 -- +int(0) +-- Iteration 8 -- +int(0) +-- Iteration 9 -- +int(0) +-- Iteration 10 -- +int(0) +-- Iteration 11 -- + +Warning: strncmp() expects parameter 3 to be long, array given in%s on line %d +NULL +-- Iteration 12 -- + +Warning: strncmp() expects parameter 3 to be long, array given in%s on line %d +NULL +-- Iteration 13 -- + +Warning: strncmp() expects parameter 3 to be long, array given in%s on line %d +NULL +-- Iteration 14 -- + +Warning: strncmp() expects parameter 3 to be long, array given in%s on line %d +NULL +-- Iteration 15 -- + +Warning: strncmp() expects parameter 3 to be long, array given in%s on line %d +NULL +-- Iteration 16 -- +int(0) +-- Iteration 17 -- +int(0) +-- Iteration 18 -- +int(0) +-- Iteration 19 -- +int(0) +-- Iteration 20 -- +int(0) +-- Iteration 21 -- +int(0) +-- Iteration 22 -- + +Warning: strncmp() expects parameter 3 to be long, string given in%s on line %d +NULL +-- Iteration 23 -- + +Warning: strncmp() expects parameter 3 to be long, string given in%s on line %d +NULL +-- Iteration 24 -- +int(0) +-- Iteration 25 -- +int(0) +-- Iteration 26 -- + +Warning: strncmp() expects parameter 3 to be long, resource given in%s on line %d +NULL +-- Iteration 27 -- + +Warning: strncmp() expects parameter 3 to be long, object given in%s on line %d +NULL +*** Done *** diff --git a/ext/standard/tests/strings/strncmp_variation6.phpt b/ext/standard/tests/strings/strncmp_variation6.phpt new file mode 100644 index 0000000..7a79d29 --- /dev/null +++ b/ext/standard/tests/strings/strncmp_variation6.phpt @@ -0,0 +1,811 @@ +--TEST-- +Test strncmp() function : usage variations - binary safe(binary values) +--FILE-- + +--EXPECTF-- +*** Test strncmp() function: with binary inputs *** + +-- Checking with all 256 characters given, in binary format -- +-- Iteration 1 -- +int(0) +int(0) +-- Iteration 2 -- +int(0) +int(0) +-- Iteration 3 -- +int(0) +int(0) +-- Iteration 4 -- +int(0) +int(0) +-- Iteration 5 -- +int(0) +int(0) +-- Iteration 6 -- +int(0) +int(0) +-- Iteration 7 -- +int(0) +int(0) +-- Iteration 8 -- +int(0) +int(0) +-- Iteration 9 -- +int(0) +int(0) +-- Iteration 10 -- +int(0) +int(0) +-- Iteration 11 -- +int(0) +int(0) +-- Iteration 12 -- +int(0) +int(0) +-- Iteration 13 -- +int(0) +int(0) +-- Iteration 14 -- +int(0) +int(0) +-- Iteration 15 -- +int(0) +int(0) +-- Iteration 16 -- +int(0) +int(0) +-- Iteration 17 -- +int(0) +int(0) +-- Iteration 18 -- +int(0) +int(0) +-- Iteration 19 -- +int(0) +int(0) +-- Iteration 20 -- +int(0) +int(0) +-- Iteration 21 -- +int(0) +int(0) +-- Iteration 22 -- +int(0) +int(0) +-- Iteration 23 -- +int(0) +int(0) +-- Iteration 24 -- +int(0) +int(0) +-- Iteration 25 -- +int(0) +int(0) +-- Iteration 26 -- +int(0) +int(0) +-- Iteration 27 -- +int(0) +int(0) +-- Iteration 28 -- +int(0) +int(0) +-- Iteration 29 -- +int(0) +int(0) +-- Iteration 30 -- +int(0) +int(0) +-- Iteration 31 -- +int(0) +int(0) +-- Iteration 32 -- +int(0) +int(0) +-- Iteration 33 -- +int(0) +int(0) +-- Iteration 34 -- +int(0) +int(0) +-- Iteration 35 -- +int(0) +int(0) +-- Iteration 36 -- +int(0) +int(0) +-- Iteration 37 -- +int(0) +int(0) +-- Iteration 38 -- +int(0) +int(0) +-- Iteration 39 -- +int(0) +int(0) +-- Iteration 40 -- +int(0) +int(0) +-- Iteration 41 -- +int(0) +int(0) +-- Iteration 42 -- +int(0) +int(0) +-- Iteration 43 -- +int(0) +int(0) +-- Iteration 44 -- +int(0) +int(0) +-- Iteration 45 -- +int(0) +int(0) +-- Iteration 46 -- +int(0) +int(0) +-- Iteration 47 -- +int(0) +int(0) +-- Iteration 48 -- +int(0) +int(0) +-- Iteration 49 -- +int(0) +int(0) +-- Iteration 50 -- +int(0) +int(0) +-- Iteration 51 -- +int(0) +int(0) +-- Iteration 52 -- +int(0) +int(0) +-- Iteration 53 -- +int(0) +int(0) +-- Iteration 54 -- +int(0) +int(0) +-- Iteration 55 -- +int(0) +int(0) +-- Iteration 56 -- +int(0) +int(0) +-- Iteration 57 -- +int(0) +int(0) +-- Iteration 58 -- +int(0) +int(0) +-- Iteration 59 -- +int(0) +int(0) +-- Iteration 60 -- +int(0) +int(0) +-- Iteration 61 -- +int(0) +int(0) +-- Iteration 62 -- +int(0) +int(0) +-- Iteration 63 -- +int(0) +int(0) +-- Iteration 64 -- +int(0) +int(0) +-- Iteration 65 -- +int(0) +int(0) +-- Iteration 66 -- +int(0) +int(0) +-- Iteration 67 -- +int(0) +int(0) +-- Iteration 68 -- +int(0) +int(0) +-- Iteration 69 -- +int(0) +int(0) +-- Iteration 70 -- +int(0) +int(0) +-- Iteration 71 -- +int(0) +int(0) +-- Iteration 72 -- +int(0) +int(0) +-- Iteration 73 -- +int(0) +int(0) +-- Iteration 74 -- +int(0) +int(0) +-- Iteration 75 -- +int(0) +int(0) +-- Iteration 76 -- +int(0) +int(0) +-- Iteration 77 -- +int(0) +int(0) +-- Iteration 78 -- +int(0) +int(0) +-- Iteration 79 -- +int(0) +int(0) +-- Iteration 80 -- +int(0) +int(0) +-- Iteration 81 -- +int(0) +int(0) +-- Iteration 82 -- +int(0) +int(0) +-- Iteration 83 -- +int(0) +int(0) +-- Iteration 84 -- +int(0) +int(0) +-- Iteration 85 -- +int(0) +int(0) +-- Iteration 86 -- +int(0) +int(0) +-- Iteration 87 -- +int(0) +int(0) +-- Iteration 88 -- +int(0) +int(0) +-- Iteration 89 -- +int(0) +int(0) +-- Iteration 90 -- +int(0) +int(0) +-- Iteration 91 -- +int(0) +int(0) +-- Iteration 92 -- +int(0) +int(0) +-- Iteration 93 -- +int(0) +int(0) +-- Iteration 94 -- +int(0) +int(0) +-- Iteration 95 -- +int(0) +int(0) +-- Iteration 96 -- +int(0) +int(0) +-- Iteration 97 -- +int(0) +int(0) +-- Iteration 98 -- +int(0) +int(0) +-- Iteration 99 -- +int(0) +int(0) +-- Iteration 100 -- +int(0) +int(0) +-- Iteration 101 -- +int(0) +int(0) +-- Iteration 102 -- +int(0) +int(0) +-- Iteration 103 -- +int(0) +int(0) +-- Iteration 104 -- +int(0) +int(0) +-- Iteration 105 -- +int(0) +int(0) +-- Iteration 106 -- +int(0) +int(0) +-- Iteration 107 -- +int(0) +int(0) +-- Iteration 108 -- +int(0) +int(0) +-- Iteration 109 -- +int(0) +int(0) +-- Iteration 110 -- +int(0) +int(0) +-- Iteration 111 -- +int(0) +int(0) +-- Iteration 112 -- +int(0) +int(0) +-- Iteration 113 -- +int(0) +int(0) +-- Iteration 114 -- +int(0) +int(0) +-- Iteration 115 -- +int(0) +int(0) +-- Iteration 116 -- +int(0) +int(0) +-- Iteration 117 -- +int(0) +int(0) +-- Iteration 118 -- +int(0) +int(0) +-- Iteration 119 -- +int(0) +int(0) +-- Iteration 120 -- +int(0) +int(0) +-- Iteration 121 -- +int(0) +int(0) +-- Iteration 122 -- +int(0) +int(0) +-- Iteration 123 -- +int(0) +int(0) +-- Iteration 124 -- +int(0) +int(0) +-- Iteration 125 -- +int(0) +int(0) +-- Iteration 126 -- +int(0) +int(0) +-- Iteration 127 -- +int(0) +int(0) +-- Iteration 128 -- +int(0) +int(0) +-- Iteration 129 -- +int(0) +int(0) +-- Iteration 130 -- +int(0) +int(0) +-- Iteration 131 -- +int(0) +int(0) +-- Iteration 132 -- +int(0) +int(0) +-- Iteration 133 -- +int(0) +int(0) +-- Iteration 134 -- +int(0) +int(0) +-- Iteration 135 -- +int(0) +int(0) +-- Iteration 136 -- +int(0) +int(0) +-- Iteration 137 -- +int(0) +int(0) +-- Iteration 138 -- +int(0) +int(0) +-- Iteration 139 -- +int(0) +int(0) +-- Iteration 140 -- +int(0) +int(0) +-- Iteration 141 -- +int(0) +int(0) +-- Iteration 142 -- +int(0) +int(0) +-- Iteration 143 -- +int(0) +int(0) +-- Iteration 144 -- +int(0) +int(0) +-- Iteration 145 -- +int(0) +int(0) +-- Iteration 146 -- +int(0) +int(0) +-- Iteration 147 -- +int(0) +int(0) +-- Iteration 148 -- +int(0) +int(0) +-- Iteration 149 -- +int(0) +int(0) +-- Iteration 150 -- +int(0) +int(0) +-- Iteration 151 -- +int(0) +int(0) +-- Iteration 152 -- +int(0) +int(0) +-- Iteration 153 -- +int(0) +int(0) +-- Iteration 154 -- +int(0) +int(0) +-- Iteration 155 -- +int(0) +int(0) +-- Iteration 156 -- +int(0) +int(0) +-- Iteration 157 -- +int(0) +int(0) +-- Iteration 158 -- +int(0) +int(0) +-- Iteration 159 -- +int(0) +int(0) +-- Iteration 160 -- +int(0) +int(0) +-- Iteration 161 -- +int(0) +int(0) +-- Iteration 162 -- +int(0) +int(0) +-- Iteration 163 -- +int(0) +int(0) +-- Iteration 164 -- +int(0) +int(0) +-- Iteration 165 -- +int(0) +int(0) +-- Iteration 166 -- +int(0) +int(0) +-- Iteration 167 -- +int(0) +int(0) +-- Iteration 168 -- +int(0) +int(0) +-- Iteration 169 -- +int(0) +int(0) +-- Iteration 170 -- +int(0) +int(0) +-- Iteration 171 -- +int(0) +int(0) +-- Iteration 172 -- +int(0) +int(0) +-- Iteration 173 -- +int(0) +int(0) +-- Iteration 174 -- +int(0) +int(0) +-- Iteration 175 -- +int(0) +int(0) +-- Iteration 176 -- +int(0) +int(0) +-- Iteration 177 -- +int(0) +int(0) +-- Iteration 178 -- +int(0) +int(0) +-- Iteration 179 -- +int(0) +int(0) +-- Iteration 180 -- +int(0) +int(0) +-- Iteration 181 -- +int(0) +int(0) +-- Iteration 182 -- +int(0) +int(0) +-- Iteration 183 -- +int(0) +int(0) +-- Iteration 184 -- +int(0) +int(0) +-- Iteration 185 -- +int(0) +int(0) +-- Iteration 186 -- +int(0) +int(0) +-- Iteration 187 -- +int(0) +int(0) +-- Iteration 188 -- +int(0) +int(0) +-- Iteration 189 -- +int(0) +int(0) +-- Iteration 190 -- +int(0) +int(0) +-- Iteration 191 -- +int(0) +int(0) +-- Iteration 192 -- +int(0) +int(0) +-- Iteration 193 -- +int(0) +int(0) +-- Iteration 194 -- +int(0) +int(0) +-- Iteration 195 -- +int(0) +int(0) +-- Iteration 196 -- +int(0) +int(0) +-- Iteration 197 -- +int(0) +int(0) +-- Iteration 198 -- +int(0) +int(0) +-- Iteration 199 -- +int(0) +int(0) +-- Iteration 200 -- +int(0) +int(0) +-- Iteration 201 -- +int(0) +int(0) +-- Iteration 202 -- +int(0) +int(0) +-- Iteration 203 -- +int(0) +int(0) +-- Iteration 204 -- +int(0) +int(0) +-- Iteration 205 -- +int(0) +int(0) +-- Iteration 206 -- +int(0) +int(0) +-- Iteration 207 -- +int(0) +int(0) +-- Iteration 208 -- +int(0) +int(0) +-- Iteration 209 -- +int(0) +int(0) +-- Iteration 210 -- +int(0) +int(0) +-- Iteration 211 -- +int(0) +int(0) +-- Iteration 212 -- +int(0) +int(0) +-- Iteration 213 -- +int(0) +int(0) +-- Iteration 214 -- +int(0) +int(0) +-- Iteration 215 -- +int(0) +int(0) +-- Iteration 216 -- +int(0) +int(0) +-- Iteration 217 -- +int(0) +int(0) +-- Iteration 218 -- +int(0) +int(0) +-- Iteration 219 -- +int(0) +int(0) +-- Iteration 220 -- +int(0) +int(0) +-- Iteration 221 -- +int(0) +int(0) +-- Iteration 222 -- +int(0) +int(0) +-- Iteration 223 -- +int(0) +int(0) +-- Iteration 224 -- +int(0) +int(0) +-- Iteration 225 -- +int(0) +int(0) +-- Iteration 226 -- +int(0) +int(0) +-- Iteration 227 -- +int(0) +int(0) +-- Iteration 228 -- +int(0) +int(0) +-- Iteration 229 -- +int(0) +int(0) +-- Iteration 230 -- +int(0) +int(0) +-- Iteration 231 -- +int(0) +int(0) +-- Iteration 232 -- +int(0) +int(0) +-- Iteration 233 -- +int(0) +int(0) +-- Iteration 234 -- +int(0) +int(0) +-- Iteration 235 -- +int(0) +int(0) +-- Iteration 236 -- +int(0) +int(0) +-- Iteration 237 -- +int(0) +int(0) +-- Iteration 238 -- +int(0) +int(0) +-- Iteration 239 -- +int(0) +int(0) +-- Iteration 240 -- +int(0) +int(0) +-- Iteration 241 -- +int(0) +int(0) +-- Iteration 242 -- +int(0) +int(0) +-- Iteration 243 -- +int(0) +int(0) +-- Iteration 244 -- +int(0) +int(0) +-- Iteration 245 -- +int(0) +int(0) +-- Iteration 246 -- +int(0) +int(0) +-- Iteration 247 -- +int(0) +int(0) +-- Iteration 248 -- +int(0) +int(0) +-- Iteration 249 -- +int(0) +int(0) +-- Iteration 250 -- +int(0) +int(0) +-- Iteration 251 -- +int(0) +int(0) +-- Iteration 252 -- +int(0) +int(0) +-- Iteration 253 -- +int(0) +int(0) +-- Iteration 254 -- +int(0) +int(0) +-- Iteration 255 -- +int(0) +int(0) +-- Iteration 256 -- +int(0) +int(0) + +-- Checking with out of character's range, given in binary format -- +int(1) + +*** Done *** diff --git a/ext/standard/tests/strings/strncmp_variation7.phpt b/ext/standard/tests/strings/strncmp_variation7.phpt new file mode 100644 index 0000000..35d11d9 --- /dev/null +++ b/ext/standard/tests/strings/strncmp_variation7.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test strncmp() function : usage variations - binary safe(null terminated strings) +--FILE-- + +--EXPECTF-- +*** Test strncmp() function: Checking with the null terminated strings *** +int(5) +*** Done *** diff --git a/ext/standard/tests/strings/strncmp_variation8.phpt b/ext/standard/tests/strings/strncmp_variation8.phpt new file mode 100644 index 0000000..bc000d1 --- /dev/null +++ b/ext/standard/tests/strings/strncmp_variation8.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test strncmp() function: usage variations - single quoted strings +--FILE-- + +--EXPECTREGEX-- +\*\*\* Test strncmp\(\) function: with single quoted strings \*\*\* +-- Iteration 1 -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +-- Iteration 2 -- +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 3 -- +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +-- Iteration 4 -- +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/ext/standard/tests/strings/strncmp_variation9.phpt b/ext/standard/tests/strings/strncmp_variation9.phpt new file mode 100644 index 0000000..282f241 --- /dev/null +++ b/ext/standard/tests/strings/strncmp_variation9.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test strncmp() function: usage variations - different inputs(heredoc strings) +--FILE-- + +--EXPECTF-- +*** Test strncmp() function: with different input strings *** +int(0) +int(0) +int(0) +int(0) +*** Done *** diff --git a/ext/standard/tests/strings/strpbrk_basic.phpt b/ext/standard/tests/strings/strpbrk_basic.phpt new file mode 100644 index 0000000..23d59c2 --- /dev/null +++ b/ext/standard/tests/strings/strpbrk_basic.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test strpbrk() function : basic functionality +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing strpbrk() : basic functionality *** +string(20) "is is a Simple text." +string(12) "Simple text." +bool(false) +bool(false) +bool(false) +string(12) " aaa aaaSLR" +string(1) "5" +string(1) "5" +===DONE=== diff --git a/ext/standard/tests/strings/strpbrk_error.phpt b/ext/standard/tests/strings/strpbrk_error.phpt new file mode 100644 index 0000000..85729ea --- /dev/null +++ b/ext/standard/tests/strings/strpbrk_error.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test strpbrk() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strpbrk() : error conditions *** + +-- Testing strpbrk() function with more than expected no. of arguments -- + +Warning: strpbrk() expects exactly 2 parameters, 3 given in %s on line %d +bool(false) + +-- Testing strpbrk() function with less than expected no. of arguments -- + +Warning: strpbrk() expects exactly 2 parameters, 1 given in %s on line %d +bool(false) + +-- Testing strpbrk() function with empty second argument -- + +Warning: strpbrk(): The character list cannot be empty in %s on line %d +bool(false) + +-- Testing strpbrk() function with arrays -- + +Warning: strpbrk() expects parameter 2 to be string, array given in %s on line %d +bool(false) + +Warning: strpbrk() expects parameter 1 to be string, array given in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt new file mode 100644 index 0000000..9b44584 Binary files /dev/null and b/ext/standard/tests/strings/strpos.phpt differ diff --git a/ext/standard/tests/strings/strpos_number.phpt b/ext/standard/tests/strings/strpos_number.phpt new file mode 100644 index 0000000..73da095 --- /dev/null +++ b/ext/standard/tests/strings/strpos_number.phpt @@ -0,0 +1,15 @@ +--TEST-- +strpos() matching numbers +--FILE-- + +--EXPECT-- +bool(false) +int(1) +int(4) diff --git a/ext/standard/tests/strings/strrchr.phpt b/ext/standard/tests/strings/strrchr.phpt new file mode 100644 index 0000000..5a1fe12 --- /dev/null +++ b/ext/standard/tests/strings/strrchr.phpt @@ -0,0 +1,22 @@ +--TEST-- +strrchr() tests +--FILE-- + +--EXPECTF-- +bool(false) +bool(false) +bool(false) +string(3) "abc" +string(5) " test" +string(5) "tring" +Done diff --git a/ext/standard/tests/strings/strrchr_basic.phpt b/ext/standard/tests/strings/strrchr_basic.phpt new file mode 100644 index 0000000..f396834 --- /dev/null +++ b/ext/standard/tests/strings/strrchr_basic.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test strrchr() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: basic functionality *** +string(12) "Hello, World" +string(12) "Hello, World" +string(12) "Hello, World" +string(12) "Hello, World" +bool(false) +bool(false) +string(5) "World" +string(5) "World" +string(7) ", World" +string(7) ", World" +string(12) "Hello, World" +string(12) "Hello, World" +string(4) "orld" +string(4) "orld" +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrchr_error.phpt b/ext/standard/tests/strings/strrchr_error.phpt new file mode 100644 index 0000000..aa0adf4 --- /dev/null +++ b/ext/standard/tests/strings/strrchr_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test strrchr() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: error conditions *** + +-- Testing strrchr() function with Zero arguments -- +Warning: strrchr() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +-- Testing strrchr() function with less than expected no. of arguments -- +Warning: strrchr() expects exactly 2 parameters, 1 given in %s on line %d +NULL + +-- Testing strrchr() function with more than expected no. of arguments -- +Warning: strrchr() expects exactly 2 parameters, 3 given in %s on line %d +NULL +*** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation1.phpt b/ext/standard/tests/strings/strrchr_variation1.phpt new file mode 100644 index 0000000..91290ec Binary files /dev/null and b/ext/standard/tests/strings/strrchr_variation1.phpt differ diff --git a/ext/standard/tests/strings/strrchr_variation10.phpt b/ext/standard/tests/strings/strrchr_variation10.phpt new file mode 100644 index 0000000..a96f2b0 --- /dev/null +++ b/ext/standard/tests/strings/strrchr_variation10.phpt @@ -0,0 +1,200 @@ +--TEST-- +Test strrchr() function : usage variations - unexpected inputs for needle +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // null vlaues + NULL, + null, + + // objects + new sample(), + + // empty string + "", + '', + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +// loop through each element of the array and check the working of strrchr() +$count = 1; +for($index = 0; $index < count($haystacks); $index++) { + echo "-- Iteration $count --\n"; + var_dump( strrchr($haystacks[$index], $needles[$index]) ); + $count ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrchr() function with unexpected inputs for needle *** +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(false) +-- Iteration 4 -- +bool(false) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(false) +-- Iteration 7 -- +bool(false) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- + +Warning: strrchr(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 11 -- + +Warning: strrchr(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: strrchr(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: strrchr(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 14 -- + +Warning: strrchr(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +bool(false) +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- +bool(false) +-- Iteration 20 -- +bool(false) +-- Iteration 21 -- + +Notice: Object of class sample could not be converted to int in %s on line %d +bool(false) +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- +bool(false) +-- Iteration 24 -- + +Warning: strrchr(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation11.phpt b/ext/standard/tests/strings/strrchr_variation11.phpt new file mode 100644 index 0000000..ea2e7a6 --- /dev/null +++ b/ext/standard/tests/strings/strrchr_variation11.phpt @@ -0,0 +1,159 @@ +--TEST-- +Test strrchr() function : usage variations - unexpected inputs for haystack and needle +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop through each element of the array and check the working of strrchr() +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + var_dump( strrchr($values[$index], $values[$index]) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrchr() function: with unexpected inputs for haystack and needle *** +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(false) +-- Iteration 4 -- +bool(false) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(false) +-- Iteration 7 -- +bool(false) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- + +Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +bool(false) +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- + +Notice: Object of class sample could not be converted to int in %s on line %d +bool(false) +-- Iteration 20 -- +bool(false) +-- Iteration 21 -- +bool(false) +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- +bool(false) +-- Iteration 24 -- + +Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation12.phpt b/ext/standard/tests/strings/strrchr_variation12.phpt new file mode 100644 index 0000000..c31e0c8 Binary files /dev/null and b/ext/standard/tests/strings/strrchr_variation12.phpt differ diff --git a/ext/standard/tests/strings/strrchr_variation2.phpt b/ext/standard/tests/strings/strrchr_variation2.phpt new file mode 100644 index 0000000..0b15cee --- /dev/null +++ b/ext/standard/tests/strings/strrchr_variation2.phpt @@ -0,0 +1,220 @@ +--TEST-- +Test strrchr() function : usage variations - single quoted strings +--FILE-- +?@hello123456he \x234 \101 '; +$needle = array( + //regular strings + 'l', + 'L', + 'HELLO', + 'hEllo', + + //escape characters + '\t', + '\T', + ' ', + '\n', + '\N', + ' +', //new line + + //nulls + '\0', + NULL, + null, + + //boolean false + FALSE, + false, + + //empty string + '', + + //special chars + ' ', + '$', + ' $', + '&', + '!#', + '%\o', + '\o,', + '()', + '*+', + '+', + '-', + '.', + '.;', + ':;', + ';', + '<=>', + '>', + '=>', + '?', + '@', + '@hEllo', + + '12345', //decimal numeric string + '\x23', //hexadecimal numeric string + '#', //hexadecimal numeric string + '\101', //octal numeric string + 'A', + '456HEE', //numerics + chars + 42, //needle as int(ASCII value of '*') + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECTF-- +*** Testing strrchr() function: with various single quoted strings *** +-- Iteration 1 -- +string(22) "lo123456he \x234 \101 " + +-- Iteration 2 -- +bool(false) + +-- Iteration 3 -- +string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 4 -- +string(14) "he \x234 \101 " + +-- Iteration 5 -- +string(5) "\101 " + +-- Iteration 6 -- +string(5) "\101 " + +-- Iteration 7 -- +string(1) " " + +-- Iteration 8 -- +string(5) "\101 " + +-- Iteration 9 -- +string(5) "\101 " + +-- Iteration 10 -- +bool(false) + +-- Iteration 11 -- +string(5) "\101 " + +-- Iteration 12 -- +bool(false) + +-- Iteration 13 -- +bool(false) + +-- Iteration 14 -- +bool(false) + +-- Iteration 15 -- +bool(false) + +-- Iteration 16 -- +bool(false) + +-- Iteration 17 -- +string(1) " " + +-- Iteration 18 -- +string(47) "$&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 19 -- +string(1) " " + +-- Iteration 20 -- +string(46) "&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 21 -- +string(45) "!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 22 -- +string(43) "%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 23 -- +string(5) "\101 " + +-- Iteration 24 -- +string(39) "()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 25 -- +string(37) "*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 26 -- +string(36) "+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 27 -- +string(35) "-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 28 -- +string(34) "./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 29 -- +string(34) "./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 30 -- +string(32) ":;<=>?@hello123456he \x234 \101 " + +-- Iteration 31 -- +string(31) ";<=>?@hello123456he \x234 \101 " + +-- Iteration 32 -- +string(30) "<=>?@hello123456he \x234 \101 " + +-- Iteration 33 -- +string(28) ">?@hello123456he \x234 \101 " + +-- Iteration 34 -- +string(29) "=>?@hello123456he \x234 \101 " + +-- Iteration 35 -- +string(27) "?@hello123456he \x234 \101 " + +-- Iteration 36 -- +string(26) "@hello123456he \x234 \101 " + +-- Iteration 37 -- +string(26) "@hello123456he \x234 \101 " + +-- Iteration 38 -- +string(2) "1 " + +-- Iteration 39 -- +string(5) "\101 " + +-- Iteration 40 -- +string(44) "#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 41 -- +string(5) "\101 " + +-- Iteration 42 -- +bool(false) + +-- Iteration 43 -- +string(7) "4 \101 " + +-- Iteration 44 -- +string(37) "*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 45 -- +string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " +*** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation3.phpt b/ext/standard/tests/strings/strrchr_variation3.phpt new file mode 100644 index 0000000..1d0aa30 --- /dev/null +++ b/ext/standard/tests/strings/strrchr_variation3.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test strrchr() function : usage variations - multi line heredoc string for 'haystack' +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: with heredoc strings *** +string(19) "ing heredoc syntax." +bool(false) +string(8) " syntax." +string(63) "Example of string +spanning multiple lines +using heredoc syntax." +*** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation4.phpt b/ext/standard/tests/strings/strrchr_variation4.phpt new file mode 100644 index 0000000..8b2c10b --- /dev/null +++ b/ext/standard/tests/strings/strrchr_variation4.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test strrchr() function : usage variations - heredoc string containing special chars for 'haystack' +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: with heredoc strings *** +string(24) "!$#$^^&*(special) +chars." +string(31) "_")!#@@!$#$^^&*(special) +chars." +string(16) "(special) +chars." +string(21) "$^^&*(special) +chars." +string(16) "(special) +chars." +string(19) "^&*(special) +chars." +string(76) "Example of heredoc string contains +$#%^*&*_("_")!#@@!$#$^^&*(special) +chars." +*** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation5.phpt b/ext/standard/tests/strings/strrchr_variation5.phpt new file mode 100644 index 0000000..1ef2391 --- /dev/null +++ b/ext/standard/tests/strings/strrchr_variation5.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test strrchr() function : usage variations - heredoc string containing escape sequences for 'haystack' +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: with heredoc strings *** +string(32) " st ch using +scape \seque +ce" +string(9) "\seque +ce" +string(24) " using +scape \seque +ce" +string(9) "\seque +ce" +string(32) " st ch using +scape \seque +ce" +*** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation6.phpt b/ext/standard/tests/strings/strrchr_variation6.phpt new file mode 100644 index 0000000..ba0ffad --- /dev/null +++ b/ext/standard/tests/strings/strrchr_variation6.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test strrchr() function : usage variations - heredoc string containing quote chars for 'haystack' +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: with heredoc strings *** +string(3) "te'" +string(32) "" +'things' 'in' 'single' 'quote'" +bool(false) +string(14) "ingle' 'quote'" +string(6) "quote'" +string(32) "" +'things' 'in' 'single' 'quote'" +*** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation7.phpt b/ext/standard/tests/strings/strrchr_variation7.phpt new file mode 100644 index 0000000..ed5acdc --- /dev/null +++ b/ext/standard/tests/strings/strrchr_variation7.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test strrchr() function : usage variations - heredoc string containing blank line for 'haystack' +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: with heredoc strings *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation8.phpt b/ext/standard/tests/strings/strrchr_variation8.phpt new file mode 100644 index 0000000..3e298a0 --- /dev/null +++ b/ext/standard/tests/strings/strrchr_variation8.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test strrchr() function : usage variations - empty heredoc string for 'haystack' +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: with heredoc strings *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation9.phpt b/ext/standard/tests/strings/strrchr_variation9.phpt new file mode 100644 index 0000000..a41c091 --- /dev/null +++ b/ext/standard/tests/strings/strrchr_variation9.phpt @@ -0,0 +1,198 @@ +--TEST-- +Test strrchr() function : usage variations - unexpected inputs for haystack +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // null vlaues + NULL, + null, + + // objects + new sample(), + + // empty string + "", + '', + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +$needles = array ( + //integer numeric strings + "0", + "1", + "2", + "-2", + + //float numeric strings + "10.5", + "-10.5", + "10.5e10", + "10.6E-10", + ".5", + + //regular strings + "array", + "a", + "r", + "y", + "ay", + "true", + "false", + "TRUE", + "FALSE", + "NULL", + "null", + "object", + + //empty string + "", + '', + + //resource variable in string form + "\$file_handle", + + //undefined variable in string form + @"$undefined_var", + @"$unset_var" +); + +// loop through each element of the array and check the working of strrchr() +$count = 1; +for($index = 0; $index < count($haystacks); $index++) { + echo "-- Iteration $count --\n"; + var_dump( strrchr($haystacks[$index], $needles[$index]) ); + $count ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrchr() function: with unexpected inputs for haystack *** +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(4) "2345" +-- Iteration 4 -- +string(5) "-2345" +-- Iteration 5 -- +string(4) "10.5" +-- Iteration 6 -- +string(5) "-10.5" +-- Iteration 7 -- +string(12) "105000000000" +-- Iteration 8 -- +string(7) "1.06E-9" +-- Iteration 9 -- +string(2) ".5" +-- Iteration 10 -- + +Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +bool(false) +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- +bool(false) +-- Iteration 20 -- +bool(false) +-- Iteration 21 -- +string(6) "object" +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- +bool(false) +-- Iteration 24 -- + +Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrev.phpt b/ext/standard/tests/strings/strrev.phpt new file mode 100644 index 0000000..321aca5 --- /dev/null +++ b/ext/standard/tests/strings/strrev.phpt @@ -0,0 +1,19 @@ +--TEST-- +strrev() function +--FILE-- + +--EXPECT-- +string(32) "ec6df70f2569891eae50321a9179eb82" +string(0) "" +string(0) "" diff --git a/ext/standard/tests/strings/strrev_basic.phpt b/ext/standard/tests/strings/strrev_basic.phpt new file mode 100644 index 0000000..2cde4cd --- /dev/null +++ b/ext/standard/tests/strings/strrev_basic.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test strrev() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing strrev() : basic functionality *** +string(12) "dlroW ,olleH" +string(12) "dlroW ,olleH" +string(1) "H" +string(1) "H" +string(6) "HHHHHH" +string(6) "HhhhhH" +string(13) " +dlroW ,olleH" +string(14) "n\dlroW ,olleH" +string(12) "dlrow ,olleH" +*** Done *** diff --git a/ext/standard/tests/strings/strrev_error.phpt b/ext/standard/tests/strings/strrev_error.phpt new file mode 100644 index 0000000..ef64e80 --- /dev/null +++ b/ext/standard/tests/strings/strrev_error.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test strrev() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strrev() : error conditions *** +-- Testing strrev() function with Zero arguments -- +Warning: strrev() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing strrev() function with more than expected no. of arguments -- +Warning: strrev() expects exactly 1 parameter, 2 given in %s on line %d +NULL +*** Done *** diff --git a/ext/standard/tests/strings/strrev_variation1.phpt b/ext/standard/tests/strings/strrev_variation1.phpt new file mode 100644 index 0000000..c0f8946 Binary files /dev/null and b/ext/standard/tests/strings/strrev_variation1.phpt differ diff --git a/ext/standard/tests/strings/strrev_variation2.phpt b/ext/standard/tests/strings/strrev_variation2.phpt new file mode 100644 index 0000000..41e54d5 Binary files /dev/null and b/ext/standard/tests/strings/strrev_variation2.phpt differ diff --git a/ext/standard/tests/strings/strrev_variation3.phpt b/ext/standard/tests/strings/strrev_variation3.phpt new file mode 100644 index 0000000..8ab3e25 Binary files /dev/null and b/ext/standard/tests/strings/strrev_variation3.phpt differ diff --git a/ext/standard/tests/strings/strrev_variation4.phpt b/ext/standard/tests/strings/strrev_variation4.phpt new file mode 100644 index 0000000..fa347cd --- /dev/null +++ b/ext/standard/tests/strings/strrev_variation4.phpt @@ -0,0 +1,182 @@ +--TEST-- +Test strrev() function : usage variations - unexpected inputs +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new sample(), + + // resource + $resource, + + // undefined data + @$undefined_var, + + // unset data + @$unset_var +); + +// loop through each element of the array for str + +$count = 1; +foreach($values as $value) { + echo "\n-- Iterator $count --\n"; + var_dump( strrev($value) ); + $count++; +}; + +fclose($resource); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrev() : unexpected inputs for 'str' *** + +-- Iterator 1 -- +string(1) "0" + +-- Iterator 2 -- +string(1) "1" + +-- Iterator 3 -- +string(5) "54321" + +-- Iterator 4 -- +string(5) "5432-" + +-- Iterator 5 -- +string(4) "5.01" + +-- Iterator 6 -- +string(5) "5.01-" + +-- Iterator 7 -- +string(12) "000000000501" + +-- Iterator 8 -- +string(7) "9-E60.1" + +-- Iterator 9 -- +string(3) "5.0" + +-- Iterator 10 -- + +Warning: strrev() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iterator 11 -- + +Warning: strrev() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iterator 12 -- + +Warning: strrev() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iterator 13 -- + +Warning: strrev() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iterator 14 -- + +Warning: strrev() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iterator 15 -- +string(0) "" + +-- Iterator 16 -- +string(0) "" + +-- Iterator 17 -- +string(1) "1" + +-- Iterator 18 -- +string(0) "" + +-- Iterator 19 -- +string(1) "1" + +-- Iterator 20 -- +string(0) "" + +-- Iterator 21 -- +string(0) "" + +-- Iterator 22 -- +string(0) "" + +-- Iterator 23 -- +string(6) "tcejbo" + +-- Iterator 24 -- + +Warning: strrev() expects parameter 1 to be string, resource given in %s on line %d +NULL + +-- Iterator 25 -- +string(0) "" + +-- Iterator 26 -- +string(0) "" +*** Done *** diff --git a/ext/standard/tests/strings/strripos.phpt b/ext/standard/tests/strings/strripos.phpt new file mode 100644 index 0000000..eb4e70b --- /dev/null +++ b/ext/standard/tests/strings/strripos.phpt @@ -0,0 +1,33 @@ +--TEST-- +strripos() function +--FILE-- + +--EXPECT-- +int(5) +int(12) +int(18) +int(12) +int(10) +int(2) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +int(1) + diff --git a/ext/standard/tests/strings/strripos_basic1.phpt b/ext/standard/tests/strings/strripos_basic1.phpt new file mode 100644 index 0000000..759c231 --- /dev/null +++ b/ext/standard/tests/strings/strripos_basic1.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test strripos() function : basic functionality - with default arguments +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing strripos() function: basic functionality *** + +-- regular string for haystack & needle -- +int(0) +int(0) +int(7) +int(7) +bool(false) + +-- single char for needle -- +int(8) +int(5) + +-- heredoc string for haystack & needle -- +int(0) +int(0) +int(0) +===DONE=== diff --git a/ext/standard/tests/strings/strripos_basic2.phpt b/ext/standard/tests/strings/strripos_basic2.phpt new file mode 100644 index 0000000..d4a1a73 --- /dev/null +++ b/ext/standard/tests/strings/strripos_basic2.phpt @@ -0,0 +1,64 @@ +--TEST-- +Test strripos() function : basic functionality - with all arguments +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing strripos() function: basic functionality *** + +-- regular string for haystack & needle, with various offsets -- +int(0) +bool(false) +int(7) +int(7) + +-- heredoc string for haystack & needle, with various offsets -- +int(0) +int(0) +bool(false) +int(0) +bool(false) + +-- various +ve offsets -- +int(8) +int(8) +bool(false) + +-- various -ve offsets -- +int(8) +int(4) +bool(false) +===DONE=== diff --git a/ext/standard/tests/strings/strripos_error.phpt b/ext/standard/tests/strings/strripos_error.phpt new file mode 100644 index 0000000..59d5926 --- /dev/null +++ b/ext/standard/tests/strings/strripos_error.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test strripos() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strripos() function: error conditions *** +-- With Zero arguments -- +Warning: strripos() expects at least 2 parameters, 0 given in %s on line %d +bool(false) + +-- With less than expected number of arguments -- +Warning: strripos() expects at least 2 parameters, 1 given in %s on line %d +bool(false) + +-- With more than expected number of arguments -- +Warning: strripos() expects at most 3 parameters, 4 given in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/strings/strripos_offset.phpt b/ext/standard/tests/strings/strripos_offset.phpt new file mode 100644 index 0000000..524699a --- /dev/null +++ b/ext/standard/tests/strings/strripos_offset.phpt @@ -0,0 +1,45 @@ +--TEST-- +strripos() offset integer overflow +--FILE-- + +--EXPECTF-- +Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strripos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/strings/strripos_variation1.phpt b/ext/standard/tests/strings/strripos_variation1.phpt new file mode 100644 index 0000000..b8a8943 --- /dev/null +++ b/ext/standard/tests/strings/strripos_variation1.phpt @@ -0,0 +1,254 @@ +--TEST-- +Test strripos() function : usage variations - double quoted strings for 'haystack' & 'needle' arguments +--FILE-- +?@hello123456he \x234 \101 "; +$needles = array( + //regular strings +/*1*/ "l", + "L", + "HELLO", + "hEllo", + + //escape characters +/*5*/ "\t", + "\T", //invalid input + " ", + "\n", + "\N", //invalid input + " +", //new line + + //nulls +/*11*/ "\0", + NULL, + null, + + //boolean false +/*14*/ FALSE, + false, + + //empty string +/*16*/ "", + + //special chars +/*17*/ " ", + "$", + " $", + "&", + "!#", + "()", + "<=>", + ">", + "=>", + "?", + "@", + "@hEllo", + +/*29*/ "12345", //decimal numeric string + "\x23", //hexadecimal numeric string + "#", //respective ASCII char of \x23 + "\101", //octal numeric string + "A", //respective ASCII char of \101 + "456HEE", //numerics + chars + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +foreach ($needles as $needle) { + echo "-- Iteration $count --\n"; + var_dump( strripos($haystack, $needle) ); + var_dump( strripos($haystack, $needle, 1) ); + var_dump( strripos($haystack, $needle, 20) ); + var_dump( strripos($haystack, $needle, -1) ); + $count++; +} +?> +===DONE=== +--EXPECTF-- +*** Testing strripos() function: with double quoted strings *** +-- Iteration 1 -- +int(28) +int(28) +int(28) +int(28) +-- Iteration 2 -- +int(28) +int(28) +int(28) +int(28) +-- Iteration 3 -- +int(25) +int(25) +int(25) +int(25) +-- Iteration 4 -- +int(25) +int(25) +int(25) +int(25) +-- Iteration 5 -- +int(6) +int(6) +bool(false) +int(6) +-- Iteration 6 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 8 -- +int(9) +int(9) +bool(false) +int(9) +-- Iteration 9 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 10 -- +int(9) +int(9) +bool(false) +int(9) +-- Iteration 11 -- +int(8) +int(8) +bool(false) +int(8) +-- Iteration 12 -- +int(8) +int(8) +bool(false) +int(8) +-- Iteration 13 -- +int(8) +int(8) +bool(false) +int(8) +-- Iteration 14 -- +int(8) +int(8) +bool(false) +int(8) +-- Iteration 15 -- +int(8) +int(8) +bool(false) +int(8) +-- Iteration 16 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 17 -- +int(43) +int(43) +int(43) +int(43) +-- Iteration 18 -- +int(12) +int(12) +bool(false) +int(12) +-- Iteration 19 -- +int(11) +int(11) +bool(false) +int(11) +-- Iteration 20 -- +int(13) +int(13) +bool(false) +int(13) +-- Iteration 21 -- +int(14) +int(14) +bool(false) +int(14) +-- Iteration 22 -- +int(17) +int(17) +bool(false) +int(17) +-- Iteration 23 -- +int(20) +int(20) +int(20) +int(20) +-- Iteration 24 -- +int(22) +int(22) +int(22) +int(22) +-- Iteration 25 -- +int(21) +int(21) +int(21) +int(21) +-- Iteration 26 -- +int(23) +int(23) +int(23) +int(23) +-- Iteration 27 -- +int(24) +int(24) +int(24) +int(24) +-- Iteration 28 -- +int(24) +int(24) +int(24) +int(24) +-- Iteration 29 -- +int(30) +int(30) +int(30) +int(30) +-- Iteration 30 -- +int(39) +int(39) +int(39) +int(39) +-- Iteration 31 -- +int(39) +int(39) +int(39) +int(39) +-- Iteration 32 -- +int(42) +int(42) +int(42) +int(42) +-- Iteration 33 -- +int(42) +int(42) +int(42) +int(42) +-- Iteration 34 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 35 -- +int(0) +bool(false) +bool(false) +int(0) +===DONE=== diff --git a/ext/standard/tests/strings/strripos_variation2.phpt b/ext/standard/tests/strings/strripos_variation2.phpt new file mode 100644 index 0000000..d8caf73 --- /dev/null +++ b/ext/standard/tests/strings/strripos_variation2.phpt @@ -0,0 +1,260 @@ +--TEST-- +Test strripos() function : usage variations - single quoted strings for 'haystack' & 'needle' arguments +--FILE-- +?@hello123456he \x234 \101 '; +$needles = array( + //regular strings +/*1*/ 'l', + 'L', + 'HELLO', + 'hEllo', + + //escape characters +/*5*/ '\t', + '\T', + ' ', + '\n', + '\N', + ' + ', //new line + + //nulls +/*11*/ '\0', + NULL, + null, + + //boolean false +/*14*/ FALSE, + false, + + //empty string +/*16*/ '', + + //special chars +/*17*/ ' ', + '$', + ' $', + '&', + '!#', + '()', + '<=>', + '>', + '=>', + '?', + '@', + '@hEllo', + +/*29*/ '12345', //decimal numeric string + '\x23', //hexadecimal numeric string + '#', //respective ASCII char of \x23 + '\101', //octal numeric string + 'A', // respective ASCII char for \101 + '456HEE', //numerics + chars + 42, //needle as int(ASCII value of '*') + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +foreach ($needles as $needle) { + echo "-- Iteration $count --\n"; + var_dump( strripos($haystack, $needle) ); + var_dump( strripos($haystack, $needle, 1) ); + var_dump( strripos($haystack, $needle, 20) ); + var_dump( strripos($haystack, $needle, -1) ); + $count++; +} +?> +===DONE=== +--EXPECT-- +*** Testing strripos() function: with single quoted strings *** +-- Iteration 1 -- +int(32) +int(32) +int(32) +int(32) +-- Iteration 2 -- +int(32) +int(32) +int(32) +int(32) +-- Iteration 3 -- +int(29) +int(29) +int(29) +int(29) +-- Iteration 4 -- +int(29) +int(29) +int(29) +int(29) +-- Iteration 5 -- +int(6) +int(6) +bool(false) +int(6) +-- Iteration 6 -- +int(6) +int(6) +bool(false) +int(6) +-- Iteration 7 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 8 -- +int(12) +int(12) +bool(false) +int(12) +-- Iteration 9 -- +int(12) +int(12) +bool(false) +int(12) +-- Iteration 10 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 11 -- +int(10) +int(10) +bool(false) +int(10) +-- Iteration 12 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 13 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 14 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 15 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 16 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 17 -- +int(53) +int(53) +int(53) +int(53) +-- Iteration 18 -- +int(16) +int(16) +bool(false) +int(16) +-- Iteration 19 -- +int(15) +int(15) +bool(false) +int(15) +-- Iteration 20 -- +int(17) +int(17) +bool(false) +int(17) +-- Iteration 21 -- +int(18) +int(18) +bool(false) +int(18) +-- Iteration 22 -- +int(21) +int(21) +int(21) +int(21) +-- Iteration 23 -- +int(24) +int(24) +int(24) +int(24) +-- Iteration 24 -- +int(26) +int(26) +int(26) +int(26) +-- Iteration 25 -- +int(25) +int(25) +int(25) +int(25) +-- Iteration 26 -- +int(27) +int(27) +int(27) +int(27) +-- Iteration 27 -- +int(28) +int(28) +int(28) +int(28) +-- Iteration 28 -- +int(28) +int(28) +int(28) +int(28) +-- Iteration 29 -- +int(34) +int(34) +int(34) +int(34) +-- Iteration 30 -- +int(43) +int(43) +int(43) +int(43) +-- Iteration 31 -- +int(19) +int(19) +bool(false) +int(19) +-- Iteration 32 -- +int(49) +int(49) +int(49) +int(49) +-- Iteration 33 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 34 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 35 -- +int(23) +int(23) +int(23) +int(23) +-- Iteration 36 -- +int(0) +bool(false) +bool(false) +int(0) +===DONE=== diff --git a/ext/standard/tests/strings/strripos_variation3.phpt b/ext/standard/tests/strings/strripos_variation3.phpt new file mode 100644 index 0000000..c380106 --- /dev/null +++ b/ext/standard/tests/strings/strripos_variation3.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test strripos() function : usage variations - multi line heredoc string for 'haystack' argument +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing strripos() function: with heredoc strings *** +-- With heredoc string containing multi lines -- + +-- Multi line strings with +ve offsets -- +int(44) +int(44) +int(44) + +-- Multi line strings with +ve offsets -- +int(44) +int(44) +bool(false) + +-- Multi line strings with no offset -- +int(18) +int(31) +bool(false) +int(55) +===DONE=== diff --git a/ext/standard/tests/strings/strripos_variation4.phpt b/ext/standard/tests/strings/strripos_variation4.phpt new file mode 100644 index 0000000..c355330 --- /dev/null +++ b/ext/standard/tests/strings/strripos_variation4.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test strripos() function : usage variations - heredoc string containing special chars for 'haystack' argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strripos() function: with heredoc strings *** +-- With heredoc string containing special chars -- +int(0) +bool(false) +int(41) +int(39) +int(55) +int(55) +int(57) +===DONE=== diff --git a/ext/standard/tests/strings/strripos_variation5.phpt b/ext/standard/tests/strings/strripos_variation5.phpt new file mode 100644 index 0000000..5f6df79 --- /dev/null +++ b/ext/standard/tests/strings/strripos_variation5.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test strripos() function : usage variations - heredoc string containing escape chars for 'haystack' argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strripos() function: with heredoc strings *** +-- With heredoc string containing escape characters -- +int(13) +int(19) +int(13) +int(19) +===DONE=== diff --git a/ext/standard/tests/strings/strrpos.phpt b/ext/standard/tests/strings/strrpos.phpt new file mode 100644 index 0000000..691f67e --- /dev/null +++ b/ext/standard/tests/strings/strrpos.phpt @@ -0,0 +1,32 @@ +--TEST-- +strrpos() function +--FILE-- + +--EXPECT-- +int(5) +int(5) +int(18) +int(12) +int(10) +int(2) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(1) diff --git a/ext/standard/tests/strings/strrpos_basic1.phpt b/ext/standard/tests/strings/strrpos_basic1.phpt new file mode 100644 index 0000000..26497fb --- /dev/null +++ b/ext/standard/tests/strings/strrpos_basic1.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test strrpos() function : basic functionality - with default arguments +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: basic functionality *** +-- With default arguments -- +int(0) +bool(false) +int(7) +bool(false) +int(8) +int(5) +int(0) +int(0) +int(0) +*** Done *** diff --git a/ext/standard/tests/strings/strrpos_basic2.phpt b/ext/standard/tests/strings/strrpos_basic2.phpt new file mode 100644 index 0000000..a65bbf3 --- /dev/null +++ b/ext/standard/tests/strings/strrpos_basic2.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test strrpos() function : basic functionality - with all arguments +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: basic functionality *** +-- With all arguments -- +int(0) +bool(false) +int(7) +int(7) +int(0) +int(0) +bool(false) +int(0) +bool(false) +int(8) +int(8) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrpos_error.phpt b/ext/standard/tests/strings/strrpos_error.phpt new file mode 100644 index 0000000..3900cea --- /dev/null +++ b/ext/standard/tests/strings/strrpos_error.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test strrpos() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: error conditions *** +-- With Zero arguments -- +Warning: strrpos() expects at least 2 parameters, 0 given in %s on line %d +bool(false) + +-- With less than expected number of arguments -- +Warning: strrpos() expects at least 2 parameters, 1 given in %s on line %d +bool(false) + +-- With more than expected number of arguments -- +Warning: strrpos() expects at most 3 parameters, 4 given in %s on line %d +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrpos_offset.phpt b/ext/standard/tests/strings/strrpos_offset.phpt new file mode 100644 index 0000000..18b5847 --- /dev/null +++ b/ext/standard/tests/strings/strrpos_offset.phpt @@ -0,0 +1,41 @@ +--TEST-- +strrpos() offset integer overflow +--FILE-- + +--EXPECTF-- +Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/strings/strrpos_variation1.phpt b/ext/standard/tests/strings/strrpos_variation1.phpt new file mode 100644 index 0000000..a7ef3e9 --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation1.phpt @@ -0,0 +1,182 @@ +--TEST-- +Test strrpos() function : usage variations - double quoted strings for 'haystack' & 'needle' arguments +--FILE-- +?@hello123456he \x234 \101 "; +$needle = array( + //regular strings + "l", + "L", + "HELLO", + "hEllo", + + //escape characters + "\t", + "\T", //invalid input + " ", + "\n", + "\N", //invalid input + " +", //new line + + //nulls + "\0", + NULL, + null, + + //boolean false + FALSE, + false, + + //empty string + "", + + //special chars + " ", + "$", + " $", + "&", + "!#", + "()", + "<=>", + ">", + "=>", + "?", + "@", + "@hEllo", + + "12345", //decimal numeric string + "\x23", //hexadecimal numeric string + "#", //respective ASCII char of \x23 + "\101", //octal numeric string + "A", //respective ASCII char of \101 + "456HEE", //numerics + chars + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECTF-- +*** Testing strrpos() function: with double quoted strings *** +-- Iteration 1 -- +int(28) +int(28) +-- Iteration 2 -- +bool(false) +bool(false) +-- Iteration 3 -- +bool(false) +bool(false) +-- Iteration 4 -- +bool(false) +bool(false) +-- Iteration 5 -- +int(6) +int(6) +-- Iteration 6 -- +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +int(9) +int(9) +-- Iteration 9 -- +bool(false) +bool(false) +-- Iteration 10 -- +int(9) +int(9) +-- Iteration 11 -- +int(8) +bool(false) +-- Iteration 12 -- +int(8) +bool(false) +-- Iteration 13 -- +int(8) +bool(false) +-- Iteration 14 -- +int(8) +bool(false) +-- Iteration 15 -- +int(8) +bool(false) +-- Iteration 16 -- +bool(false) +bool(false) +-- Iteration 17 -- +int(43) +int(43) +-- Iteration 18 -- +int(12) +bool(false) +-- Iteration 19 -- +int(11) +bool(false) +-- Iteration 20 -- +int(13) +bool(false) +-- Iteration 21 -- +int(14) +bool(false) +-- Iteration 22 -- +int(17) +bool(false) +-- Iteration 23 -- +int(20) +bool(false) +-- Iteration 24 -- +int(22) +bool(false) +-- Iteration 25 -- +int(21) +bool(false) +-- Iteration 26 -- +int(23) +bool(false) +-- Iteration 27 -- +int(24) +bool(false) +-- Iteration 28 -- +bool(false) +bool(false) +-- Iteration 29 -- +int(30) +int(30) +-- Iteration 30 -- +int(39) +int(39) +-- Iteration 31 -- +int(39) +int(39) +-- Iteration 32 -- +int(42) +int(42) +-- Iteration 33 -- +int(42) +int(42) +-- Iteration 34 -- +bool(false) +bool(false) +-- Iteration 35 -- +int(0) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation10.phpt b/ext/standard/tests/strings/strrpos_variation10.phpt new file mode 100644 index 0000000..86ca6cf --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation10.phpt @@ -0,0 +1,162 @@ +--TEST-- +Test strrpos() function : usage variations - unexpected inputs for 'needle' argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +// loop through each element of the 'needle' array to check the working of strrpos() +$counter = 1; +for($index = 0; $index < count($needles); $index ++) { + echo "-- Iteration $counter --\n"; + var_dump( strrpos($haystack, $needles[$index]) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrpos() function with unexpected values for needle *** +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(false) +-- Iteration 4 -- +bool(false) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(false) +-- Iteration 7 -- +bool(false) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- + +Warning: strrpos(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 11 -- + +Warning: strrpos(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: strrpos(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: strrpos(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 14 -- + +Warning: strrpos(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +bool(false) +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- + +Notice: Object of class sample could not be converted to int in %s on line %d +bool(false) +-- Iteration 20 -- +bool(false) +-- Iteration 21 -- +bool(false) +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- +bool(false) +-- Iteration 24 -- + +Warning: strrpos(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation11.phpt b/ext/standard/tests/strings/strrpos_variation11.phpt new file mode 100644 index 0000000..5b5e7e3 --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation11.phpt @@ -0,0 +1,199 @@ +--TEST-- +Test strrpos() function : usage variations - unexpected inputs for 'haystack' and 'needle' arguments +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop through each element of the array and check the working of strrpos() +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $haystack = $values[$index]; + var_dump( strrpos($values[$index], $values[$index]) ); + var_dump( strrpos($values[$index], $values[$index], 1) ); + $counter ++; +} + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrpos() function with unexpected values for haystack and needle *** +-- Iteration 1 -- +bool(false) +bool(false) +-- Iteration 2 -- +bool(false) +bool(false) +-- Iteration 3 -- +bool(false) +bool(false) +-- Iteration 4 -- +bool(false) +bool(false) +-- Iteration 5 -- +bool(false) +bool(false) +-- Iteration 6 -- +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +bool(false) +bool(false) +-- Iteration 9 -- +bool(false) +bool(false) +-- Iteration 10 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 11 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 14 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 15 -- +bool(false) +bool(false) +-- Iteration 16 -- +bool(false) +bool(false) +-- Iteration 17 -- +bool(false) +bool(false) +-- Iteration 18 -- +bool(false) +bool(false) +-- Iteration 19 -- + +Notice: Object of class sample could not be converted to int in %s on line %d +bool(false) + +Notice: Object of class sample could not be converted to int in %s on line %d +bool(false) +-- Iteration 20 -- +bool(false) +bool(false) +-- Iteration 21 -- +bool(false) +bool(false) +-- Iteration 22 -- +bool(false) +bool(false) +-- Iteration 23 -- +bool(false) +bool(false) +-- Iteration 24 -- + +Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d +bool(false) + +Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d +bool(false) +-- Iteration 25 -- +bool(false) +bool(false) +-- Iteration 26 -- +bool(false) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation12.phpt b/ext/standard/tests/strings/strrpos_variation12.phpt new file mode 100644 index 0000000..87ac3b2 --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation12.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test strrpos() function : usage variations - checking binary safe with 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Test strrpos() function: binary safe *** +int(5) +int(5) +int(0) +bool(false) +int(11) +int(11) +int(2) +bool(false) +int(5) +int(5) +int(0) +bool(false) +int(5) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation13.phpt b/ext/standard/tests/strings/strrpos_variation13.phpt new file mode 100644 index 0000000..f85c3c4 --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation13.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test strrpos() function : usage variations - checking bianry safe with 'needle' argument +--FILE-- + +--EXPECTF-- +*** Test strrpos() function: binary safe *** +int(1) +int(1) +int(0) +bool(false) +int(12) +int(12) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +bool(false) +int(1) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation14.phpt b/ext/standard/tests/strings/strrpos_variation14.phpt new file mode 100644 index 0000000..53c123a --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation14.phpt @@ -0,0 +1,153 @@ +--TEST-- +Test strrpos() function : usage variations - unexpected inputs for 'offset' argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + //resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop through each element of the array and check the working of strrpos() +$counter = 1; +for($index = 0; $index < count($offsets); $index ++) { + echo "-- Iteration $counter --\n"; + var_dump( strrpos($haystack, $needle, $offsets[$index]) ); + $counter ++; +} + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrpos() function: with unexpected values for offset *** +-- Iteration 1 -- +int(6) +-- Iteration 2 -- +int(6) +-- Iteration 3 -- + +Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +-- Iteration 4 -- +int(6) +-- Iteration 5 -- +int(6) +-- Iteration 6 -- + +Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d +bool(false) +-- Iteration 7 -- + +Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d +bool(false) +-- Iteration 8 -- + +Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d +bool(false) +-- Iteration 9 -- + +Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d +bool(false) +-- Iteration 10 -- + +Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d +bool(false) +-- Iteration 11 -- +int(6) +-- Iteration 12 -- +int(6) +-- Iteration 13 -- +int(6) +-- Iteration 14 -- +int(6) +-- Iteration 15 -- + +Warning: strrpos() expects parameter 3 to be long, object given in %s on line %d +bool(false) +-- Iteration 16 -- + +Warning: strrpos() expects parameter 3 to be long, string given in %s on line %d +bool(false) +-- Iteration 17 -- + +Warning: strrpos() expects parameter 3 to be long, string given in %s on line %d +bool(false) +-- Iteration 18 -- +int(6) +-- Iteration 19 -- +int(6) +-- Iteration 20 -- + +Warning: strrpos() expects parameter 3 to be long, resource given in %s on line %d +bool(false) +-- Iteration 21 -- +int(6) +-- Iteration 22 -- +int(6) +*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation15.phpt b/ext/standard/tests/strings/strrpos_variation15.phpt new file mode 100644 index 0000000..d958cdc --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation15.phpt @@ -0,0 +1,171 @@ +--TEST-- +Test strrpos() function : usage variations - unexpected inputs for 'haystack', 'needle' & 'offset' arguments +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + //resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop through each element of the array and check the working of strrpos() +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + var_dump( strrpos($values[$index], $values[$index], $values[$index]) ); + $counter ++; +} + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrpos() function: with unexpected values for haystack, needle & offset *** +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- + +Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +-- Iteration 7 -- + +Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 11 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 14 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +bool(false) +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- + +Warning: strrpos() expects parameter 3 to be long, object given in %s on line %d +bool(false) +-- Iteration 20 -- + +Warning: strrpos() expects parameter 3 to be long, string given in %s on line %d +bool(false) +-- Iteration 21 -- + +Warning: strrpos() expects parameter 3 to be long, string given in %s on line %d +bool(false) +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- +bool(false) +-- Iteration 24 -- + +Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d +bool(false) +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation2.phpt b/ext/standard/tests/strings/strrpos_variation2.phpt new file mode 100644 index 0000000..5364586 --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation2.phpt @@ -0,0 +1,186 @@ +--TEST-- +Test strrpos() function : usage variations - single quoted strings for 'haystack' & 'needle' arguments +--FILE-- +?@hello123456he \x234 \101 '; +$needle = array( + //regular strings + 'l', + 'L', + 'HELLO', + 'hEllo', + + //escape characters + '\t', + '\T', + ' ', + '\n', + '\N', + ' +', //new line + + //nulls + '\0', + NULL, + null, + + //boolean false + FALSE, + false, + + //empty string + '', + + //special chars + ' ', + '$', + ' $', + '&', + '!#', + '()', + '<=>', + '>', + '=>', + '?', + '@', + '@hEllo', + + '12345', //decimal numeric string + '\x23', //hexadecimal numeric string + '#', //hexadecimal numeric string + '\101', //octal numeric string + 'A', + '456HEE', //numerics + chars + 42, //needle as int(ASCII value of '*') + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECTF-- +*** Testing strrpos() function: with single quoted strings *** +-- Iteration 1 -- +int(32) +int(32) +-- Iteration 2 -- +bool(false) +bool(false) +-- Iteration 3 -- +bool(false) +bool(false) +-- Iteration 4 -- +bool(false) +bool(false) +-- Iteration 5 -- +int(6) +int(6) +-- Iteration 6 -- +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +int(12) +int(12) +-- Iteration 9 -- +bool(false) +bool(false) +-- Iteration 10 -- +bool(false) +bool(false) +-- Iteration 11 -- +int(10) +int(10) +-- Iteration 12 -- +bool(false) +bool(false) +-- Iteration 13 -- +bool(false) +bool(false) +-- Iteration 14 -- +bool(false) +bool(false) +-- Iteration 15 -- +bool(false) +bool(false) +-- Iteration 16 -- +bool(false) +bool(false) +-- Iteration 17 -- +int(53) +int(53) +-- Iteration 18 -- +int(16) +bool(false) +-- Iteration 19 -- +int(15) +bool(false) +-- Iteration 20 -- +int(17) +bool(false) +-- Iteration 21 -- +int(18) +bool(false) +-- Iteration 22 -- +int(21) +int(21) +-- Iteration 23 -- +int(24) +int(24) +-- Iteration 24 -- +int(26) +int(26) +-- Iteration 25 -- +int(25) +int(25) +-- Iteration 26 -- +int(27) +int(27) +-- Iteration 27 -- +int(28) +int(28) +-- Iteration 28 -- +bool(false) +bool(false) +-- Iteration 29 -- +int(34) +int(34) +-- Iteration 30 -- +int(43) +int(43) +-- Iteration 31 -- +int(19) +bool(false) +-- Iteration 32 -- +int(49) +int(49) +-- Iteration 33 -- +bool(false) +bool(false) +-- Iteration 34 -- +bool(false) +bool(false) +-- Iteration 35 -- +int(23) +bool(false) +-- Iteration 36 -- +int(0) +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation3.phpt b/ext/standard/tests/strings/strrpos_variation3.phpt new file mode 100644 index 0000000..a0a0d27 --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation3.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test strrpos() function : usage variations - multi line heredoc string for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: with heredoc strings *** +-- With heredoc string containing multi lines -- +int(44) +int(44) +int(44) +bool(false) +int(55) +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/strings/strrpos_variation4.phpt b/ext/standard/tests/strings/strrpos_variation4.phpt new file mode 100644 index 0000000..1ccf529 --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation4.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test strrpos() function : usage variations - heredoc string containing special chars for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: with heredoc strings *** +-- With heredoc string containing special chars -- +int(0) +bool(false) +int(41) +int(39) +int(55) +int(55) +int(57) +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/strings/strrpos_variation5.phpt b/ext/standard/tests/strings/strrpos_variation5.phpt new file mode 100644 index 0000000..f9537da --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation5.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test strrpos() function : usage variations - heredoc string containing escape chars for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: with heredoc strings *** +-- With heredoc string containing escape characters -- +int(13) +int(19) +int(13) +int(19) +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/strings/strrpos_variation6.phpt b/ext/standard/tests/strings/strrpos_variation6.phpt new file mode 100644 index 0000000..c879a91 --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation6.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test strrpos() function : usage variations - heredoc string containing quotes for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: with heredoc strings *** +-- With heredoc string containing quote & slash chars -- +int(88) +int(59) +int(59) +int(59) +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/strings/strrpos_variation7.phpt b/ext/standard/tests/strings/strrpos_variation7.phpt new file mode 100644 index 0000000..239dc24 --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation7.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test strrpos() function : usage variations - empty heredoc string for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: with heredoc strings *** +-- With empty heredoc string -- +bool(false) +bool(false) +bool(false) +bool(false) +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/strings/strrpos_variation8.phpt b/ext/standard/tests/strings/strrpos_variation8.phpt new file mode 100644 index 0000000..eac7d8f --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation8.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test strrpos() function : usage variations - repetitive chars for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: strings repetitive chars *** +-- Iteration 1 -- +int(4) +-- Iteration 2 -- +int(4) +-- Iteration 3 -- +int(4) +-- Iteration 4 -- +int(4) +-- Iteration 5 -- +int(4) +-- Iteration 6 -- +int(4) +-- Iteration 7 -- +bool(false) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- +bool(false) +-- Iteration 11 -- +bool(false) +-- Iteration 12 -- +bool(false) +-- Iteration 13 -- +bool(false) +-- Iteration 14 -- +bool(false) +-- Iteration 15 -- +bool(false) +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/strings/strrpos_variation9.phpt b/ext/standard/tests/strings/strrpos_variation9.phpt new file mode 100644 index 0000000..9b3b8d6 --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation9.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test strrpos() function : usage variations - unexpected inputs for 'haystack' argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +$needle = "heredoc 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource"; + +// loop through each element of the array and check the working of strrpos() +$counter = 1; +for($index = 0; $index < count($haystacks); $index ++) { + echo "\n-- Iteration $counter --\n"; + var_dump( strrpos($haystacks[$index], $needle) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrpos() function with unexpected values for haystack *** + +-- Iteration 1 -- +bool(false) + +-- Iteration 2 -- +bool(false) + +-- Iteration 3 -- +bool(false) + +-- Iteration 4 -- +bool(false) + +-- Iteration 5 -- +bool(false) + +-- Iteration 6 -- +bool(false) + +-- Iteration 7 -- +bool(false) + +-- Iteration 8 -- +bool(false) + +-- Iteration 9 -- +bool(false) + +-- Iteration 10 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +-- Iteration 15 -- +bool(false) + +-- Iteration 16 -- +bool(false) + +-- Iteration 17 -- +bool(false) + +-- Iteration 18 -- +bool(false) + +-- Iteration 19 -- +bool(false) + +-- Iteration 20 -- +bool(false) + +-- Iteration 21 -- +bool(false) + +-- Iteration 22 -- +bool(false) + +-- Iteration 23 -- +bool(false) + +-- Iteration 24 -- + +Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d +bool(false) + +-- Iteration 25 -- +bool(false) + +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strspn.phpt b/ext/standard/tests/strings/strspn.phpt new file mode 100644 index 0000000..9f498b8 --- /dev/null +++ b/ext/standard/tests/strings/strspn.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test strspn() behavior +--FILE-- + +--EXPECT-- +string(25) "22222222aaaa bbb1111 cccc" +string(4) "1234" +int(8) +int(6) +int(3) diff --git a/ext/standard/tests/strings/strspn_basic.phpt b/ext/standard/tests/strings/strspn_basic.phpt new file mode 100644 index 0000000..d9b1a33 --- /dev/null +++ b/ext/standard/tests/strings/strspn_basic.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test strspn() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing strspn() : basic functionality *** +int(11) +int(11) +int(2) +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/strspn_error.phpt b/ext/standard/tests/strings/strspn_error.phpt new file mode 100644 index 0000000..caa1f90 --- /dev/null +++ b/ext/standard/tests/strings/strspn_error.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test strspn() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strspn() : error conditions *** + +-- Testing strspn() function with Zero arguments -- + +Warning: strspn() expects at least 2 parameters, 0 given in %s on line %d +NULL + +-- Testing strspn() function with more than expected no. of arguments -- + +Warning: strspn() expects at most 4 parameters, 5 given in %s on line %d +NULL + +-- Testing strspn() function with less than expected no. of arguments -- + +Warning: strspn() expects at least 2 parameters, 1 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/strings/strspn_variation1.phpt b/ext/standard/tests/strings/strspn_variation1.phpt new file mode 100644 index 0000000..45e71ed --- /dev/null +++ b/ext/standard/tests/strings/strspn_variation1.phpt @@ -0,0 +1,273 @@ +--TEST-- +Test strspn() function : usage variations - unexpected values for str argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new sample, + + // undefined data + $undefined_var, + + // unset data + $unset_var, + + // resource + $file_handle +); + +// loop through each element of the array for str + +foreach($values as $value) { + echo "\n-- Iteration with str value as \"$value\"\n"; + var_dump( strspn($value,$mask) ); // with default args + var_dump( strspn($value,$mask,$start) ); // with default len value + var_dump( strspn($value,$mask,$start,$len) ); // with all args +}; + +// closing the resource +fclose($file_handle); + +echo "Done" +?> +--EXPECTF-- +*** Testing strspn() : with unexpected values for str argument *** + +-- Iteration with str value as "0" +int(1) +int(0) +int(0) + +-- Iteration with str value as "1" +int(1) +int(0) +int(0) + +-- Iteration with str value as "12345" +int(5) +int(4) +int(4) + +-- Iteration with str value as "-2345" +int(0) +int(4) +int(4) + +-- Iteration with str value as "10.5" +int(2) +int(1) +int(1) + +-- Iteration with str value as "-10.5" +int(0) +int(2) +int(2) + +-- Iteration with str value as "101234567000" +int(12) +int(11) +int(10) + +-- Iteration with str value as "1.07654321E-9" +int(1) +int(0) +int(0) + +-- Iteration with str value as "0.5" +int(1) +int(0) +int(0) + +-- Iteration with str value as "Array" + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration with str value as "Array" + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration with str value as "Array" + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration with str value as "Array" + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration with str value as "Array" + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "1" +int(1) +int(0) +int(0) + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "1" +int(1) +int(0) +int(0) + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "object" +int(2) +int(1) +int(1) + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "Resource id #%d" + +Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/strspn_variation10.phpt b/ext/standard/tests/strings/strspn_variation10.phpt new file mode 100644 index 0000000..318d16c --- /dev/null +++ b/ext/standard/tests/strings/strspn_variation10.phpt @@ -0,0 +1,274 @@ +--TEST-- +Test strspn() function : usage variations - with varying mask & default start and len args +--FILE-- + +--EXPECTF-- +*** Testing strspn() : with different mask strings and default start and len arguments *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 3 -- +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) + +-- Iteration 4 -- +int(0) +int(0) +int(1) +int(2) +int(0) +int(1) +int(1) +int(1) +int(0) +int(1) + +-- Iteration 5 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 6 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 7 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 8 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 9 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 10 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 11 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 12 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 13 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 14 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 15 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 16 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 17 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/strspn_variation11.phpt b/ext/standard/tests/strings/strspn_variation11.phpt new file mode 100644 index 0000000..209981e --- /dev/null +++ b/ext/standard/tests/strings/strspn_variation11.phpt @@ -0,0 +1,1306 @@ +--TEST-- +Test strspn() function : usage variations - with varying start and default len args +--FILE-- + +--EXPECTF-- +*** Testing strspn() : with different start and default len values *** + +-- Iteration 1 -- +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 2 -- +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 3 -- +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(1) +int(0) +bool(false) +int(1) +int(1) +bool(false) +int(1) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(1) +int(0) +bool(false) +int(1) +int(1) +bool(false) +int(1) + +-- Iteration 4 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(1) +int(0) +int(0) +int(0) +int(1) +bool(false) +int(1) +int(2) +int(1) +int(0) +int(1) +int(2) +bool(false) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(1) +int(0) +int(0) +int(0) +int(1) +bool(false) +int(1) +int(1) +int(0) +int(0) +int(0) +int(1) +bool(false) +int(1) +int(1) +int(0) +int(0) +int(0) +int(1) +bool(false) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(1) +int(0) +int(0) +int(0) +int(1) +bool(false) +int(1) + +-- Iteration 5 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(1) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(1) +int(0) +bool(false) +int(4) + +-- Iteration 6 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(1) +int(2) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(1) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) + +-- Iteration 7 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 8 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 9 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(1) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(1) +int(0) +bool(false) +int(4) + +-- Iteration 10 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) + +-- Iteration 11 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 12 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 13 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 14 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) + +-- Iteration 15 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) + +-- Iteration 16 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) + +-- Iteration 17 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/strspn_variation12.phpt b/ext/standard/tests/strings/strspn_variation12.phpt new file mode 100644 index 0000000..9e2eaf0 --- /dev/null +++ b/ext/standard/tests/strings/strspn_variation12.phpt @@ -0,0 +1,2878 @@ +--TEST-- +Test strspn() function : usage variations - with varying start and len args +--FILE-- + +--EXPECTF-- +*** Testing strspn() : with different start and len values *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 3 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) + +-- Iteration 4 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) + +-- Iteration 5 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 6 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 7 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 8 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 9 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 10 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 11 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/strspn_variation2.phpt b/ext/standard/tests/strings/strspn_variation2.phpt new file mode 100644 index 0000000..7af61e5 --- /dev/null +++ b/ext/standard/tests/strings/strspn_variation2.phpt @@ -0,0 +1,272 @@ +--TEST-- +Test strspn() function : usage variations - unexpected values for mask argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new sample(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, + + // resource + $file_handle +); + +// loop through each element of the array for mask + +foreach($values as $value) { + echo "\n-- Iteration with mask value as \"$value\" --\n"; + var_dump( strspn($str,$value) ); // with defalut args + var_dump( strspn($str,$value,$start) ); // with default len value + var_dump( strspn($str,$value,$start,$len) ); // with all args +}; + +// close the resource +fclose($file_handle); + +echo "Done" +?> +--EXPECTF-- +*** Testing strspn() : with diferent unexpected values of mask argument *** + +-- Iteration with mask value as "0" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "1" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "12345" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "-2345" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "10.5" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "-10.5" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "101234567000" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "1.07654321E-9" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "0.5" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "Array" -- + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +-- Iteration with mask value as "Array" -- + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +-- Iteration with mask value as "Array" -- + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +-- Iteration with mask value as "Array" -- + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +-- Iteration with mask value as "Array" -- + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "1" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "1" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "object" -- +int(0) +int(1) +int(1) + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "Resource id #%d" -- + +Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/strspn_variation3.phpt b/ext/standard/tests/strings/strspn_variation3.phpt new file mode 100644 index 0000000..3195220 --- /dev/null +++ b/ext/standard/tests/strings/strspn_variation3.phpt @@ -0,0 +1,243 @@ +--TEST-- +Test strspn() function : usage variations - unexpected values of start argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new sample(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, + + // resource + $file_handle +); + +// loop through each element of the array for start + +foreach($values as $value) { + echo "\n-- Iteration with start value as \"$value\" --\n"; + var_dump( strspn($str,$mask,$value) ); // with default len value + var_dump( strspn($str,$mask,$value,$len) ); // with all args +}; + +// closing the resource +fclose($file_handle); + +echo "Done" +?> +--EXPECTF-- +*** Testing strspn() : with unexpected values of start argument *** + +-- Iteration with start value as "10.5" -- +int(0) +int(0) + +-- Iteration with start value as "-10.5" -- +int(2) +int(2) + +-- Iteration with start value as "1012345670" -- +bool(false) +bool(false) + +-- Iteration with start value as "1.07654321E-7" -- +int(2) +int(2) + +-- Iteration with start value as "0.5" -- +int(2) +int(2) + +-- Iteration with start value as "Array" -- + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "" -- +int(2) +int(2) + +-- Iteration with start value as "" -- +int(2) +int(2) + +-- Iteration with start value as "1" -- +int(1) +int(1) + +-- Iteration with start value as "" -- +int(2) +int(2) + +-- Iteration with start value as "1" -- +int(1) +int(1) + +-- Iteration with start value as "" -- +int(2) +int(2) + +-- Iteration with start value as "" -- + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "" -- + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "string" -- + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "string" -- + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "object" -- + +Warning: strspn() expects parameter 3 to be long, object given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, object given in %s on line %d +NULL + +-- Iteration with start value as "" -- +int(2) +int(2) + +-- Iteration with start value as "" -- +int(2) +int(2) + +-- Iteration with start value as "Resource id #%d" -- + +Warning: strspn() expects parameter 3 to be long, resource given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, resource given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/strspn_variation4.phpt b/ext/standard/tests/strings/strspn_variation4.phpt new file mode 100644 index 0000000..87dceac --- /dev/null +++ b/ext/standard/tests/strings/strspn_variation4.phpt @@ -0,0 +1,196 @@ +--TEST-- +Test strspn() function : usage variations - unexpected values of len argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new sample(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, + + // resource + $file_handle +); + +// loop through each element of the array for start + +foreach($values as $value) { + echo "\n-- Iteration with len value as \"$value\" --\n"; + var_dump( strspn($str,$mask,$start,$value) ); // with all args +}; + +// closing the resource +fclose($file_handle); + +echo "Done" +?> +--EXPECTF-- +*** Testing strspn() : with unexpected values of len argument *** + +-- Iteration with len value as "10.5" -- +int(2) + +-- Iteration with len value as "-10.5" -- +int(0) + +-- Iteration with len value as "1012345670" -- +int(2) + +-- Iteration with len value as "1.07654321E-7" -- +int(0) + +-- Iteration with len value as "0.5" -- +int(0) + +-- Iteration with len value as "Array" -- + +Warning: strspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "" -- +int(0) + +-- Iteration with len value as "" -- +int(0) + +-- Iteration with len value as "1" -- +int(1) + +-- Iteration with len value as "" -- +int(0) + +-- Iteration with len value as "1" -- +int(1) + +-- Iteration with len value as "" -- +int(0) + +-- Iteration with len value as "" -- + +Warning: strspn() expects parameter 4 to be long, string given in %s on line %d +NULL + +-- Iteration with len value as "" -- + +Warning: strspn() expects parameter 4 to be long, string given in %s on line %d +NULL + +-- Iteration with len value as "string" -- + +Warning: strspn() expects parameter 4 to be long, string given in %s on line %d +NULL + +-- Iteration with len value as "string" -- + +Warning: strspn() expects parameter 4 to be long, string given in %s on line %d +NULL + +-- Iteration with len value as "object" -- + +Warning: strspn() expects parameter 4 to be long, object given in %s on line %d +NULL + +-- Iteration with len value as "" -- +int(0) + +-- Iteration with len value as "" -- +int(0) + +-- Iteration with len value as "Resource id #%d" -- + +Warning: strspn() expects parameter 4 to be long, resource given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/strspn_variation5.phpt b/ext/standard/tests/strings/strspn_variation5.phpt new file mode 100644 index 0000000..514af55 Binary files /dev/null and b/ext/standard/tests/strings/strspn_variation5.phpt differ diff --git a/ext/standard/tests/strings/strspn_variation6.phpt b/ext/standard/tests/strings/strspn_variation6.phpt new file mode 100644 index 0000000..413198d --- /dev/null +++ b/ext/standard/tests/strings/strspn_variation6.phpt @@ -0,0 +1,179 @@ +--TEST-- +Test strspn() function : usage variations - with heredoc strings, varying mask & default start and len args +--FILE-- + +--EXPECTF-- +*** Testing strspn() : with different mask strings *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 3 -- +int(0) +int(0) +int(8) +int(11) +int(0) +int(0) +int(0) +int(1) +int(0) +int(2) + +-- Iteration 4 -- +int(0) +int(0) +int(4) +int(4) +int(0) +int(0) +int(0) +int(1) +int(0) +int(4) + +-- Iteration 5 -- +int(0) +int(0) +int(4) +int(4) +int(0) +int(0) +int(0) +int(1) +int(0) +int(4) + +-- Iteration 6 -- +int(0) +int(0) +int(4) +int(4) +int(0) +int(0) +int(0) +int(1) +int(0) +int(4) + +-- Iteration 7 -- +int(0) +int(0) +int(4) +int(4) +int(0) +int(0) +int(0) +int(1) +int(0) +int(4) +Done diff --git a/ext/standard/tests/strings/strspn_variation7.phpt b/ext/standard/tests/strings/strspn_variation7.phpt new file mode 100644 index 0000000..d0ebee3 --- /dev/null +++ b/ext/standard/tests/strings/strspn_variation7.phpt @@ -0,0 +1,612 @@ +--TEST-- +Test strspn() function : usage variations - with heredoc strings, varying start and default len args +--FILE-- + +--EXPECTF-- +*** Testing strspn() : with different start values *** + +-- Iteration 1 -- +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(1) +int(2) +bool(false) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(1) +int(2) +bool(false) +int(2) + +-- Iteration 3 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(8) +int(7) +int(6) +int(0) +int(0) +bool(false) +int(8) +int(11) +int(10) +int(9) +int(0) +int(1) +bool(false) +int(11) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) + +-- Iteration 4 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(1) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(1) +int(0) +bool(false) +int(2) + +-- Iteration 5 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) + +-- Iteration 6 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) + +-- Iteration 7 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/strspn_variation8.phpt b/ext/standard/tests/strings/strspn_variation8.phpt new file mode 100644 index 0000000..3e9e9dd --- /dev/null +++ b/ext/standard/tests/strings/strspn_variation8.phpt @@ -0,0 +1,1894 @@ +--TEST-- +Test strspn() function : usage variations - with heredoc strings, varying start and len args +--FILE-- + +--EXPECTF-- +*** Testing strspn() : with different start and len values *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 3 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(8) +int(8) +int(0) +int(0) +int(1) +int(2) +int(7) +int(7) +int(0) +int(0) +int(1) +int(2) +int(6) +int(6) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(8) +int(8) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) + +-- Iteration 4 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 5 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 6 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 7 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/strspn_variation9.phpt b/ext/standard/tests/strings/strspn_variation9.phpt new file mode 100644 index 0000000..14af0ca Binary files /dev/null and b/ext/standard/tests/strings/strspn_variation9.phpt differ diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt new file mode 100644 index 0000000..1c8d753 Binary files /dev/null and b/ext/standard/tests/strings/strstr.phpt differ diff --git a/ext/standard/tests/strings/strstr2.phpt b/ext/standard/tests/strings/strstr2.phpt new file mode 100644 index 0000000..fadeb10 --- /dev/null +++ b/ext/standard/tests/strings/strstr2.phpt @@ -0,0 +1,40 @@ +--TEST-- +strstr() - New parameter: before_needle +--FILE-- + +--EXPECT-- +bool(false) +bool(false) +string(12) "@example.com" +string(1) "a" +string(2) "@e" +string(10) "asdfasdfas" +string(1) "@" +string(0) "" +string(5) "eE@fF" +string(0) "" +string(4) "E@fF" +string(1) "e" +bool(false) diff --git a/ext/standard/tests/strings/strtok_basic.phpt b/ext/standard/tests/strings/strtok_basic.phpt new file mode 100644 index 0000000..6ba48f4 --- /dev/null +++ b/ext/standard/tests/strings/strtok_basic.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test strtok() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing strtok() : basic functionality *** + +The Input string is: +"This testcase test strtok() function." + +The token string is: +" ()." + +--- Token 1 --- +string(4) "This" + +--- Token 2 --- +string(8) "testcase" + +--- Token 3 --- +string(4) "test" + +--- Token 4 --- +string(6) "strtok" + +--- Token 5 --- +string(8) "function" + +--- Token 6 --- +bool(false) + +--- Token 7 --- +bool(false) +Done diff --git a/ext/standard/tests/strings/strtok_error.phpt b/ext/standard/tests/strings/strtok_error.phpt new file mode 100644 index 0000000..58044e7 --- /dev/null +++ b/ext/standard/tests/strings/strtok_error.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test strtok() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strtok() : error conditions *** + +-- Testing strtok() function with Zero arguments -- + +Warning: strtok() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing strtok() function with more than expected no. of arguments -- + +Warning: strtok() expects at most 2 parameters, 3 given in %s on line %d +NULL +string(13) "sample string" + +-- Testing strtok() with less than expected no. of arguments -- +bool(false) +string(10) "string val" +Done diff --git a/ext/standard/tests/strings/strtok_variation1.phpt b/ext/standard/tests/strings/strtok_variation1.phpt new file mode 100644 index 0000000..b8febac --- /dev/null +++ b/ext/standard/tests/strings/strtok_variation1.phpt @@ -0,0 +1,174 @@ +--TEST-- +Test strtok() function : usage variations - first argument as non-string +--FILE-- + 'red-color', 'item' => 'pen-color'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // undefined variable + $undefined_var, + + // unset variable + $unset_var, + + // resource + $file_handle +); + + +// loop through each element of the array and check the working of strtok() +// when $str arugment is supplied with different values + +echo "\n--- Testing strtok() by supplying different values for 'str' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str = $values [$index]; + + var_dump( strtok($str, $token) ); + + $counter ++; +} + +//closing the resource +fclose($file_handle); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing strtok() : with first argument as non-string *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d + +--- Testing strtok() by supplying different values for 'str' argument --- +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(5) "12345" +-- Iteration 4 -- +string(4) "2345" +-- Iteration 5 -- +string(4) "10.5" +-- Iteration 6 -- +string(4) "10.5" +-- Iteration 7 -- +string(12) "101234567000" +-- Iteration 8 -- +string(11) "1.07654321E" +-- Iteration 9 -- +string(3) "0.5" +-- Iteration 10 -- + +Warning: strtok() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: strtok() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: strtok() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: strtok() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: strtok() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +string(1) "1" +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +string(1) "1" +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- +string(3) "obj" +-- Iteration 20 -- +bool(false) +-- Iteration 21 -- +bool(false) +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- +bool(false) +-- Iteration 24 -- +bool(false) +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- + +Warning: strtok() expects parameter 1 to be string, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/strings/strtok_variation2.phpt b/ext/standard/tests/strings/strtok_variation2.phpt new file mode 100644 index 0000000..19a6f26 --- /dev/null +++ b/ext/standard/tests/strings/strtok_variation2.phpt @@ -0,0 +1,174 @@ +--TEST-- +Test strtok() function : usage variations - with different token strings +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // undefined variable + $undefined_var, + + // unset variable + $unset_var, + + // resource + $file_handle +); + + +// loop through each element of the array and check the working of strtok() +// when $token arugment is supplied with different values + +echo "\n--- Testing strtok() by supplying different values for 'token' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $token = $values [$index]; + + var_dump( strtok($str, $token) ); + + $counter ++; +} + +// closing the resource +fclose($file_handle); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing strtok() : with different token strings *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d + +--- Testing strtok() by supplying different values for 'token' argument --- +-- Iteration 1 -- +string(37) "this testcase test strtok() function " +-- Iteration 2 -- +string(37) "this testcase test strtok() function " +-- Iteration 3 -- +string(37) "this testcase test strtok() function " +-- Iteration 4 -- +string(37) "this testcase test strtok() function " +-- Iteration 5 -- +string(37) "this testcase test strtok() function " +-- Iteration 6 -- +string(37) "this testcase test strtok() function " +-- Iteration 7 -- +string(37) "this testcase test strtok() function " +-- Iteration 8 -- +string(37) "this testcase test strtok() function " +-- Iteration 9 -- +string(37) "this testcase test strtok() function " +-- Iteration 10 -- + +Warning: strtok() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: strtok() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: strtok() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: strtok() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: strtok() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +string(37) "this testcase test strtok() function " +-- Iteration 16 -- +string(37) "this testcase test strtok() function " +-- Iteration 17 -- +string(37) "this testcase test strtok() function " +-- Iteration 18 -- +string(37) "this testcase test strtok() function " +-- Iteration 19 -- +string(4) "his " +-- Iteration 20 -- +string(37) "this testcase test strtok() function " +-- Iteration 21 -- +string(37) "this testcase test strtok() function " +-- Iteration 22 -- +string(37) "this testcase test strtok() function " +-- Iteration 23 -- +string(37) "this testcase test strtok() function " +-- Iteration 24 -- +string(37) "this testcase test strtok() function " +-- Iteration 25 -- +string(37) "this testcase test strtok() function " +-- Iteration 26 -- + +Warning: strtok() expects parameter 2 to be string, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/strings/strtok_variation3.phpt b/ext/standard/tests/strings/strtok_variation3.phpt new file mode 100644 index 0000000..3026d86 --- /dev/null +++ b/ext/standard/tests/strings/strtok_variation3.phpt @@ -0,0 +1,150 @@ +--TEST-- +Test strtok() function : usage variations - with heredoc strings +--FILE-- + +--EXPECTF-- +*** Testing strtok() : with heredoc strings *** + +--- Iteration 1 --- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 2 --- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 3 --- +string(11) "first line " +string(7) "f hered" +string(8) "c string" +string(3) "sec" +string(8) "nd line " +string(7) "f hered" +string(8) "c string" +string(11) "third line " +string(7) "f hered" +string(7) "cstring" +bool(false) + +--- Iteration 4 --- +string(4) "hell" +string(1) "w" +string(3) "rld" +string(4) "hell" +string(1) "w" +string(3) "rld" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 5 --- +string(4) "hell" +string(4) "123w" +string(4) "rld4" +string(1) "6" +string(8) "1234hell" +string(4) "1234" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 6 --- +string(4) "hell" +string(1) "w" +string(3) "rld" +string(4) "hell" +string(4) "hell" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +Done diff --git a/ext/standard/tests/strings/strtok_variation4.phpt b/ext/standard/tests/strings/strtok_variation4.phpt new file mode 100644 index 0000000..6f4fa66 --- /dev/null +++ b/ext/standard/tests/strings/strtok_variation4.phpt @@ -0,0 +1,110 @@ +--TEST-- +Test strtok() function : usage variations - with embedded nulls in the strings +--FILE-- + +--EXPECTF-- +*** Testing strtok() : with embedded nulls in the strings *** + +--- Iteration 1 --- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 2 --- +string(2) "\0" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 3 --- +string(5) "hello" +string(5) "world" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 4 --- +string(3) "hel" +string(2) "lo" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 5 --- +string(5) "hello" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 6 --- +string(11) "hello world" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 7 --- +string(4) "\0he" +string(5) "llo\0" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 8 --- +string(9) "hello\0\0" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +Done diff --git a/ext/standard/tests/strings/strtok_variation5.phpt b/ext/standard/tests/strings/strtok_variation5.phpt new file mode 100644 index 0000000..c49f7de --- /dev/null +++ b/ext/standard/tests/strings/strtok_variation5.phpt @@ -0,0 +1,150 @@ +--TEST-- +Test strtok() function : usage variations - miscellaneous inputs +--FILE-- + +--EXPECTF-- +*** Testing strtok() : with miscellaneous inputs *** + +--- Iteration 1 --- +string(11) "HELLO WORLD" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 2 --- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 3 --- +string(5) "HELLO" +string(5) "WORLD" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 4 --- +string(5) "hello" +string(3) "wor" +string(2) "ld" +bool(false) +bool(false) +bool(false) + +--- Iteration 5 --- +string(3) "hel" +string(2) "lo" +string(5) "world" +bool(false) +bool(false) +bool(false) + +--- Iteration 6 --- +string(3) "one" +string(1) "$" +string(3) "two" +string(1) "!" +string(5) "three" +string(1) "#" + +--- Iteration 7 --- +string(11) "hello/r/wor" +string(3) "rld" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 8 --- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 9 --- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 10 --- +string(5) "hello" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 11 --- +string(5) "hello" +string(5) "world" +bool(false) +bool(false) +bool(false) +bool(false) +Done diff --git a/ext/standard/tests/strings/strtok_variation6.phpt b/ext/standard/tests/strings/strtok_variation6.phpt new file mode 100644 index 0000000..73ea366 --- /dev/null +++ b/ext/standard/tests/strings/strtok_variation6.phpt @@ -0,0 +1,160 @@ +--TEST-- +Test strtok() function : usage variations - invalid escape sequences as tokens +--FILE-- + +--EXPECTF-- +*** Testing strtok() : with invalid escape sequences in token *** + +--- Iteration 1 --- +string(5) "hello" +string(6) " world" +bool(false) +bool(false) + +string(7) "khellok" +string(6) "worldk" +bool(false) +bool(false) + +string(5) "hello" +string(6) " world" +bool(false) +bool(false) + +string(5) "hello" +string(6) " world" +bool(false) +bool(false) + +string(1) " " +string(1) "r" +bool(false) +bool(false) + + +--- Iteration 2 --- +string(1) "\" +string(6) "hello\" +string(7) " world\" +bool(false) + +string(9) "\khello\k" +string(7) "world\k" +bool(false) +bool(false) + +string(1) "\" +string(6) "hello\" +string(7) " world\" +bool(false) + +string(5) "hello" +string(6) " world" +bool(false) +bool(false) + +string(1) " " +string(1) "r" +bool(false) +bool(false) + + +--- Iteration 3 --- +string(1) "/" +string(6) "hello\" +string(7) " world/" +bool(false) + +string(8) "khello\k" +string(5) "world" +string(1) "k" +bool(false) + +string(6) "hello\" +string(6) " world" +bool(false) +bool(false) + +string(1) "/" +string(5) "hello" +string(7) " world/" +bool(false) + +string(1) "/" +string(1) " " +string(1) "r" +string(1) "/" + + +--- Iteration 4 --- +string(6) "/hello" +string(7) "/ world" +bool(false) +bool(false) + +string(6) "hellok" +string(5) "world" +bool(false) +bool(false) + +string(5) "hello" +string(6) " world" +bool(false) +bool(false) + +string(6) "/hello" +string(7) "/ world" +bool(false) +bool(false) + +string(1) "/" +string(2) "/ " +string(1) "r" +bool(false) + +Done diff --git a/ext/standard/tests/strings/strtok_variation7.phpt b/ext/standard/tests/strings/strtok_variation7.phpt new file mode 100644 index 0000000..28cbf7d --- /dev/null +++ b/ext/standard/tests/strings/strtok_variation7.phpt @@ -0,0 +1,108 @@ +--TEST-- +Test strtok() function : usage variations - modifying the input string while tokenising +--FILE-- + +--EXPECTF-- +*** Testing strtok() : with modification of input string in between tokenising *** + +*** Testing strtok() when string being tokenised is prefixed with another string in between the process *** +string(4) "this" + +-- Token 1 is -- +string(2) "is" + +-- Input str is "extra string this is a sample string" -- + +-- Token 2 is -- +string(1) "a" + +-- Input str is "extra string this is a sample string" -- + +-- Token 3 is -- +string(6) "sample" + +-- Input str is "extra string this is a sample string" -- + +-- Token 4 is -- +string(6) "string" + +-- Input str is "extra string this is a sample string" -- + +-- Token 5 is -- +bool(false) + +-- Input str is "extra string this is a sample string" -- + +-- Token 6 is -- +bool(false) + +-- Input str is "extra string this is a sample string" -- + +*** Testing strtok() when string being tokenised is suffixed with another string in between the process *** +string(5) "extra" + +-- Token 1 is -- +string(6) "string" + +-- Token 2 is -- +string(4) "this" + +-- Token 3 is -- +string(2) "is" + +-- Token 4 is -- +string(1) "a" + +-- Token 5 is -- +string(6) "sample" + +-- Token 6 is -- +string(6) "string" + +-- Token 7 is -- +bool(false) + +-- Token 8 is -- +bool(false) + +-- Token 9 is -- +bool(false) + +-- Token 10 is -- +bool(false) +Done diff --git a/ext/standard/tests/strings/strtolower-win32.phpt b/ext/standard/tests/strings/strtolower-win32.phpt new file mode 100644 index 0000000..ffaa148 Binary files /dev/null and b/ext/standard/tests/strings/strtolower-win32.phpt differ diff --git a/ext/standard/tests/strings/strtolower.phpt b/ext/standard/tests/strings/strtolower.phpt new file mode 100644 index 0000000..166b5cc Binary files /dev/null and b/ext/standard/tests/strings/strtolower.phpt differ diff --git a/ext/standard/tests/strings/strtoupper.phpt b/ext/standard/tests/strings/strtoupper.phpt new file mode 100644 index 0000000..41bc5e6 --- /dev/null +++ b/ext/standard/tests/strings/strtoupper.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test strtoupper on non-ASCII characters +--SKIPIF-- + +--FILE-- + +--EXPECT-- +ÄÖÜ diff --git a/ext/standard/tests/strings/strtoupper1-win32.phpt b/ext/standard/tests/strings/strtoupper1-win32.phpt new file mode 100644 index 0000000..e0adc64 Binary files /dev/null and b/ext/standard/tests/strings/strtoupper1-win32.phpt differ diff --git a/ext/standard/tests/strings/strtoupper1.phpt b/ext/standard/tests/strings/strtoupper1.phpt new file mode 100644 index 0000000..b83a8a3 Binary files /dev/null and b/ext/standard/tests/strings/strtoupper1.phpt differ diff --git a/ext/standard/tests/strings/strtr.phpt b/ext/standard/tests/strings/strtr.phpt new file mode 100644 index 0000000..80ed722 --- /dev/null +++ b/ext/standard/tests/strings/strtr.phpt @@ -0,0 +1,10 @@ +--TEST-- +strtr() function +--FILE-- +"hi", "hi"=>"hello", "a"=>"A", "world"=>"planet"); +var_dump(strtr("# hi all, I said hello world! #", $trans)); +?> +--EXPECT-- +string(32) "# hello All, I sAid hi planet! #" \ No newline at end of file diff --git a/ext/standard/tests/strings/strtr_basic.phpt b/ext/standard/tests/strings/strtr_basic.phpt new file mode 100644 index 0000000..2892ab0 --- /dev/null +++ b/ext/standard/tests/strings/strtr_basic.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test strtr() function : basic functionality +--FILE-- + "T", "e" => "E", "st" => "ST"); +$trans2_arr = array('t' => 'T', 'e' => 'E', 'st' => 'ST'); +$heredoc_str = << +--EXPECTF-- +*** Testing strtr() : basic functionality *** +string(10) "TesT sTrTr" +string(10) "TesT sTrTr" +string(10) "TesT sTrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +*** Done *** diff --git a/ext/standard/tests/strings/strtr_error.phpt b/ext/standard/tests/strings/strtr_error.phpt new file mode 100644 index 0000000..f34085f --- /dev/null +++ b/ext/standard/tests/strings/strtr_error.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test strtr() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strtr() : error conditions *** + +-- Testing strtr() function with Zero arguments -- +Warning: strtr() expects at least 2 parameters, 0 given in %s on line %d +NULL + +-- Testing strtr() function with less than expected no. of arguments -- +Warning: strtr() expects at least 2 parameters, 1 given in %s on line %d +NULL + +-- Testing strtr() function with more than expected no. of arguments -- +Warning: strtr() expects at most 3 parameters, 4 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/strings/strtr_variation1.phpt b/ext/standard/tests/strings/strtr_variation1.phpt new file mode 100644 index 0000000..640194f --- /dev/null +++ b/ext/standard/tests/strings/strtr_variation1.phpt @@ -0,0 +1,86 @@ +--TEST-- +Test strtr() function : usage variations - regular & numeric strings for 'str' argument +--FILE-- + "a", "a" => 1, "2b3c" => "b2c3", "b2c3" => "3c2b"); + +/* loop through to test strtr() with each element of $str_arr */ +for($index = 0; $index < count($str_arr); $index++) { + echo "-- Iteration $count --\n"; + + $str = $str_arr[$index]; //getting the $str_arr element in $str variable + + //strtr() call in three args syntax form + var_dump( strtr($str, $from, $to) ); + + //strtr() call in two args syntax form + var_dump( strtr($str, $replace_pairs) ); + + $count++; +} +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strtr() : numeric & regular double quoted strings *** +-- Iteration 1 -- +string(3) "abc" +string(3) "a23" +-- Iteration 2 -- +string(3) "123" +string(3) "1bc" +-- Iteration 3 -- +string(6) "a1b2c3" +string(6) "a1b2c3" +-- Iteration 4 -- +string(3) "abc" +string(3) "a23" +-- Iteration 5 -- +string(3) "123" +string(3) "1bc" +-- Iteration 6 -- +string(6) "a1b2c3" +string(6) "a1b2c3" +-- Iteration 7 -- +string(14) "abc +123 +a1b2c3" +string(14) "a23 +1bc +a1b2c3" +*** Done *** diff --git a/ext/standard/tests/strings/strtr_variation2.phpt b/ext/standard/tests/strings/strtr_variation2.phpt new file mode 100644 index 0000000..5772f01 --- /dev/null +++ b/ext/standard/tests/strings/strtr_variation2.phpt @@ -0,0 +1,90 @@ +--TEST-- +Test strtr() function : usage variations - string containing special chars for 'str' argument +--FILE-- + "%", "%" => "$", "#*&@()" => "()@&*#"); + +/* loop through to test strtr() with each element of $str_arr */ +for($index = 0; $index < count($str_arr); $index++) { + echo "-- Iteration $count --\n"; + + $str = $str_arr[$index]; //getting the array element in 'str' variable + + //strtr() call in three args syntax form + var_dump( strtr($str, $from, $to) ); + + //strtr() call in two args syntax form + var_dump( strtr($str, $replace_pairs) ); + + $count++; +} +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strtr() : string containing special chars for 'str' arg *** +-- Iteration 1 -- +string(1) "s" +string(1) "$" +-- Iteration 2 -- +string(3) "pec" +string(3) "#%*" +-- Iteration 3 -- +string(10) "text i als" +string(10) "text & @()" +-- Iteration 4 -- +string(1) "s" +string(1) "$" +-- Iteration 5 -- +string(3) "pec" +string(3) "#%*" +-- Iteration 6 -- +string(10) "text i als" +string(10) "text & @()" +-- Iteration 7 -- +string(17) "s +peci +text i als" +string(17) "$ +#%*& +text & @()" +*** Done *** diff --git a/ext/standard/tests/strings/strtr_variation3.phpt b/ext/standard/tests/strings/strtr_variation3.phpt new file mode 100644 index 0000000..fe546dc --- /dev/null +++ b/ext/standard/tests/strings/strtr_variation3.phpt @@ -0,0 +1,103 @@ +--TEST-- +Test strtr() function : usage variations - string containing escape sequences for 'str' argument +--FILE-- + "t", "\r\n" => "T", "\n\r\t\\" => "TEST"); + +/* loop through to test strtr() with each element of $str_arr */ +for($index = 0; $index < count($str_arr); $index++) { + echo "-- Iteration $count --\n"; + + $str = $str_arr[$index]; //getting the array element in 'str' variable + + //strtr() call in three args syntax form + var_dump( strtr($str, $from, $to) ); + + //strtr() call in two args syntax form + var_dump( strtr($str, $replace_pairs) ); + + $count++; +} +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strtr() : string containing escape sequences for 'str' arg *** +-- Iteration 1 -- +string(9) "SesSTsttE" +string(9) " es \stt " +-- Iteration 2 -- +string(12) "TtestTTstrtr" +string(12) "\test\\strtr" +-- Iteration 3 -- +string(12) "TtestETstrtr" +string(11) "ttestTstrtr" +-- Iteration 4 -- +string(9) "$variable" +string(9) "$variable" +-- Iteration 5 -- +string(7) ""quotes" +string(7) ""quotes" +-- Iteration 6 -- +string(12) "TtesTtTsttTr" +string(12) "\tes\t\stt\r" +-- Iteration 7 -- +string(12) "TtestTTstrtr" +string(12) "\test\\strtr" +-- Iteration 8 -- +string(15) "TntestTrTnstrtr" +string(15) "\ntest\r\nstrtr" +-- Iteration 9 -- +string(10) "T$variable" +string(10) "\$variable" +-- Iteration 10 -- +string(8) "T"quotes" +string(8) "\"quotes" +-- Iteration 11 -- +string(54) "SesSTsttETTtestTTstrtrTTtestETstrtrT$variableTT"quotes" +string(52) " es \sttT\test\\strtrtttestTstrtrt$variablet\"quotes" +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/strings/strtr_variation4.phpt b/ext/standard/tests/strings/strtr_variation4.phpt new file mode 100644 index 0000000..faec849 --- /dev/null +++ b/ext/standard/tests/strings/strtr_variation4.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test strtr() function : usage variations - empty string & null for 'str' argument +--FILE-- + "t", '' => "TEST"); + + +/* loop through to test strtr() with each element of $str_arr */ +for($index = 0; $index < count($str_arr); $index++) { + echo "-- Iteration $count --\n"; + + $str = $str_arr[$index]; //getting the array element in 'str' variable + + //strtr() call in three args syntax form + var_dump( strtr($str, $from, $to) ); + + //strtr() call in two args syntax form + var_dump( strtr($str, $replace_pairs) ); + + $count++; +} +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strtr() : empty string & null for 'str' arg *** +-- Iteration 1 -- +string(0) "" +string(0) "" +-- Iteration 2 -- +string(0) "" +string(0) "" +-- Iteration 3 -- +string(0) "" +string(0) "" +-- Iteration 4 -- +string(0) "" +string(0) "" +-- Iteration 5 -- +string(0) "" +string(0) "" +-- Iteration 6 -- +string(0) "" +string(0) "" +-- Iteration 7 -- +string(0) "" +string(0) "" +*** Done *** diff --git a/ext/standard/tests/strings/strtr_variation5.phpt b/ext/standard/tests/strings/strtr_variation5.phpt new file mode 100644 index 0000000..c90e028 --- /dev/null +++ b/ext/standard/tests/strings/strtr_variation5.phpt @@ -0,0 +1,139 @@ +--TEST-- +Test strtr() function : usage variations - unexpected inputs for 'str' argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strtr() function: with unexpected inputs for 'str' *** +-- Iteration 1 -- +string(1) "a" +-- Iteration 2 -- +string(1) "t" +-- Iteration 3 -- +string(2) "-m" +-- Iteration 4 -- +string(4) "ta.5" +-- Iteration 5 -- +string(5) "-ma.5" +-- Iteration 6 -- +string(12) "tatm34567aaa" +-- Iteration 7 -- + +Warning: strtr() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: strtr() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: strtr() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 10 -- +string(1) "t" +-- Iteration 11 -- +string(0) "" +-- Iteration 12 -- +string(1) "t" +-- Iteration 13 -- +string(0) "" +-- Iteration 14 -- +string(0) "" +-- Iteration 15 -- +string(0) "" +-- Iteration 16 -- +string(13) "s02ple objec1" +-- Iteration 17 -- + +Warning: strtr() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 18 -- +string(0) "" +-- Iteration 19 -- +string(0) "" +===DONE=== diff --git a/ext/standard/tests/strings/strtr_variation6.phpt b/ext/standard/tests/strings/strtr_variation6.phpt new file mode 100644 index 0000000..46f9e78 --- /dev/null +++ b/ext/standard/tests/strings/strtr_variation6.phpt @@ -0,0 +1,136 @@ +--TEST-- +Test strtr() function : usage variations - unexpected inputs for 'from' argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strtr() function: with unexpected inputs for 'from' *** +-- Iteration 1 -- +string(6) "a12atm" +-- Iteration 2 -- +string(6) "0a2atm" +-- Iteration 3 -- +string(6) "01tatm" +-- Iteration 4 -- +string(6) "ta2atm" +-- Iteration 5 -- +string(6) "m1tatm" +-- Iteration 6 -- +string(6) "tm0atm" +-- Iteration 7 -- + +Notice: Array to string conversion in %s on line %d +string(6) "0120tm" +-- Iteration 8 -- + +Notice: Array to string conversion in %s on line %d +string(6) "0120tm" +-- Iteration 9 -- + +Notice: Array to string conversion in %s on line %d +string(6) "0120tm" +-- Iteration 10 -- +string(6) "0a2atm" +-- Iteration 11 -- +string(6) "012atm" +-- Iteration 12 -- +string(6) "0a2atm" +-- Iteration 13 -- +string(6) "012atm" +-- Iteration 14 -- +string(6) "012atm" +-- Iteration 15 -- +string(6) "012atm" +-- Iteration 16 -- +string(6) "012ttm" +-- Iteration 17 -- +string(6) "012atm" +-- Iteration 18 -- +string(6) "012atm" +-- Iteration 19 -- +string(6) "012atm" +===DONE=== diff --git a/ext/standard/tests/strings/strtr_variation7.phpt b/ext/standard/tests/strings/strtr_variation7.phpt new file mode 100644 index 0000000..fa2a5eb --- /dev/null +++ b/ext/standard/tests/strings/strtr_variation7.phpt @@ -0,0 +1,158 @@ +--TEST-- +Test strtr() function : usage variations - unexpected inputs for 'to' argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strtr() function: with unexpected inputs for 'to' *** + +-- Iteration 1 -- +string(6) "0120tm" + +-- Iteration 2 -- +string(6) "0121tm" + +-- Iteration 3 -- +string(6) "012-2m" + +-- Iteration 4 -- +string(6) "51210." + +-- Iteration 5 -- +string(6) ".52-20" + +-- Iteration 6 -- +string(6) "234101" + +-- Iteration 7 -- + +Warning: strtr() expects parameter 3 to be string, array given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: strtr() expects parameter 3 to be string, array given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: strtr() expects parameter 3 to be string, array given in %s on line %d +NULL + +-- Iteration 10 -- +string(6) "0121tm" + +-- Iteration 11 -- +string(6) "012atm" + +-- Iteration 12 -- +string(6) "0121tm" + +-- Iteration 13 -- +string(6) "012atm" + +-- Iteration 14 -- +string(6) "012atm" + +-- Iteration 15 -- +string(6) "012atm" + +-- Iteration 16 -- +string(6) "plesam" + +-- Iteration 17 -- + +Warning: strtr() expects parameter 3 to be string, resource given in %s on line %d +NULL + +-- Iteration 18 -- +string(6) "012atm" + +-- Iteration 19 -- +string(6) "012atm" +===DONE=== diff --git a/ext/standard/tests/strings/strtr_variation8.phpt b/ext/standard/tests/strings/strtr_variation8.phpt new file mode 100644 index 0000000..4d2b42b --- /dev/null +++ b/ext/standard/tests/strings/strtr_variation8.phpt @@ -0,0 +1,179 @@ +--TEST-- +Test strtr() function : usage variations - unexpected inputs for 'replace_pairs' argument +--FILE-- + +--EXPECTF-- +*** Testing strtr() function: with unexpected inputs for 'replace_pairs' *** + +-- Iteration 1 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 2 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 3 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 4 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 5 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 7 -- +string(6) "012atm" + +-- Iteration 8 -- +string(6) "012atm" + +-- Iteration 9 -- +string(6) "122atm" + +-- Iteration 10 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 15 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 16 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 17 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 18 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 19 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) +*** Done *** diff --git a/ext/standard/tests/strings/strtr_variation9.phpt b/ext/standard/tests/strings/strtr_variation9.phpt new file mode 100644 index 0000000..c7d4d99 --- /dev/null +++ b/ext/standard/tests/strings/strtr_variation9.phpt @@ -0,0 +1,225 @@ +--TEST-- +Test strtr() function : usage variations - unexpected inputs for all arguments +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values +/*12*/ true, + false, + TRUE, + FALSE, + + // null vlaues +/*16*/ NULL, + null, + + // objects +/*18*/ new sample(), + + // resource +/*19*/ $file_handle, + + // undefined variable +/*20*/ @$undefined_var, + + // unset variable +/*21*/ @$unset_var +); + +// loop through with each element of the $values array to test strtr() function +$count = 1; +for($index = 0; $index < count($values); $index++) { + echo "\n-- Iteration $count --\n"; + var_dump( strtr($values[$index], $values[$index], $values[$index]) ); //fn call with three args + var_dump( strtr($values[$index], $values[$index]) ); //fn call with two args + $count ++; +} + +fclose($file_handle); //closing the file handle + +?> +===DONE=== +--EXPECTF-- +*** Testing strtr() function: with unexpected inputs for all arguments *** + +-- Iteration 1 -- +string(1) "0" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 2 -- +string(1) "1" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 3 -- +string(2) "-2" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 4 -- +string(4) "10.5" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 5 -- +string(5) "-20.5" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 6 -- +string(12) "101234567000" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 7 -- + +Warning: strtr() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strtr() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: strtr() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strtr() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: strtr() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strtr() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: strtr() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strtr() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: strtr() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strtr() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 12 -- +string(1) "1" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 13 -- +string(0) "" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 14 -- +string(1) "1" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 15 -- +string(0) "" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 16 -- +string(0) "" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 17 -- +string(0) "" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 18 -- +string(13) "sample object" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 19 -- + +Warning: strtr() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: strtr() expects parameter 1 to be string, resource given in %s on line %d +NULL + +-- Iteration 20 -- +string(0) "" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 21 -- +string(0) "" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/strings/strval.phpt b/ext/standard/tests/strings/strval.phpt new file mode 100644 index 0000000..b837a07 --- /dev/null +++ b/ext/standard/tests/strings/strval.phpt @@ -0,0 +1,26 @@ +--TEST-- +strval() function +--FILE-- + +--EXPECTF-- +string(3) "bar" +string(3) "BAR" +string(6) "foobar" +string(1) "1" +string(3) "1.1" +string(1) "1" +string(0) "" + +Notice: Array to string conversion in %sstrval.php on line %d +string(5) "Array" diff --git a/ext/standard/tests/strings/strval_basic.phpt b/ext/standard/tests/strings/strval_basic.phpt new file mode 100644 index 0000000..c099058 --- /dev/null +++ b/ext/standard/tests/strings/strval_basic.phpt @@ -0,0 +1,77 @@ +--TEST-- +Test strval() function : basic functionality +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strval() : basic variations *** + +-- Iteration 1 -- +string(11) "Hello World" + +-- Iteration 2 -- +string(11) "Hello World" + +-- Iteration 3 -- +string(32) "String +with +control +characters +" + +-- Iteration 4 -- +string(20) "String with "quotes"" + +-- Iteration 5 -- +string(6) "123456" + +-- Iteration 6 -- +string(5) "0xABC" + +-- Iteration 7 -- +string(21) "Simple HEREDOC string" +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/strval_error.phpt b/ext/standard/tests/strings/strval_error.phpt new file mode 100644 index 0000000..c31a2ab --- /dev/null +++ b/ext/standard/tests/strings/strval_error.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test strval() function : usage variations - error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strval() : error conditions *** + +-- Testing strval() function with more than expected no. of arguments -- + +Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +-- Testing strval() function with less than expected no. of arguments -- + +Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing strval() function with object which has not toString() method -- + +Catchable fatal error: Object of class MyClass could not be converted to string in %s on line %d \ No newline at end of file diff --git a/ext/standard/tests/strings/strval_variation1.phpt b/ext/standard/tests/strings/strval_variation1.phpt new file mode 100644 index 0000000..430a436 --- /dev/null +++ b/ext/standard/tests/strings/strval_variation1.phpt @@ -0,0 +1,190 @@ +--TEST-- +Test strval() function : usage variations - Pass different data types as strval +--FILE-- + 'red', 'item' => 'pen'), + + // null data +/*20*/ NULL, + null, + + // boolean data +/*22*/ true, + false, + TRUE, + FALSE, + + // empty data +/*26*/ "", + '', + + // object data +/*28*/ new MyClass(), + + // resource +/*29*/ $file_handle, + + // undefined data +/*30*/ @$undefined_var, + + // unset data +/*31*/ @$unset_var, +); + +// loop through each element of the array for strval +$iterator = 1; +foreach($values as $value) { + echo "\n-- Iteration $iterator --\n"; + var_dump( strval($value) ); + $iterator++; +}; +?> +===DONE=== +--EXPECTF-- +*** Testing strval() : usage variations *** + +-- Iteration 1 -- +string(1) "0" + +-- Iteration 2 -- +string(1) "1" + +-- Iteration 3 -- +string(5) "12345" + +-- Iteration 4 -- +string(6) "-12345" + +-- Iteration 5 -- +string(1) "2" + +-- Iteration 6 -- +string(1) "8" + +-- Iteration 7 -- +string(5) "12345" + +-- Iteration 8 -- +string(6) "-12345" + +-- Iteration 9 -- +string(1) "0" + +-- Iteration 10 -- +string(1) "1" + +-- Iteration 11 -- +string(5) "43981" + +-- Iteration 12 -- +string(6) "-43981" + +-- Iteration 13 -- +string(5) "100.5" + +-- Iteration 14 -- +string(6) "-100.5" + +-- Iteration 15 -- +string(13) "1001234567000" + +-- Iteration 16 -- +string(14) "1.007654321E-8" + +-- Iteration 17 -- +string(3) "0.5" + +-- Iteration 18 -- +string(5) "Array" + +-- Iteration 19 -- +string(5) "Array" + +-- Iteration 20 -- +string(0) "" + +-- Iteration 21 -- +string(0) "" + +-- Iteration 22 -- +string(1) "1" + +-- Iteration 23 -- +string(0) "" + +-- Iteration 24 -- +string(1) "1" + +-- Iteration 25 -- +string(0) "" + +-- Iteration 26 -- +string(0) "" + +-- Iteration 27 -- +string(0) "" + +-- Iteration 28 -- +string(7) "MyClass" + +-- Iteration 29 -- +string(%d) "Resource id #%d" + +-- Iteration 30 -- +string(0) "" + +-- Iteration 31 -- +string(0) "" +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/strval_variation2.phpt b/ext/standard/tests/strings/strval_variation2.phpt new file mode 100644 index 0000000..da74973 --- /dev/null +++ b/ext/standard/tests/strings/strval_variation2.phpt @@ -0,0 +1,82 @@ +--TEST-- +Test strval() function : usage variations - Pass all valid char codes +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strval() : usage variations - Pass all valid char codes *** +000102030405060708090a0b0c0d0e0f +101112131415161718191a1b1c1d1e1f +202122232425262728292a2b2c2d2e2f +303132333435363738393a3b3c3d3e3f +404142434445464748494a4b4c4d4e4f +505152535455565758595a5b5c5d5e5f +606162636465666768696a6b6c6d6e6f +707172737475767778797a7b7c7d7e7f +808182838485868788898a8b8c8d8e8f +909192939495969798999a9b9c9d9e9f +a0a1a2a3a4a5a6a7a8a9aaabacadaeaf +b0b1b2b3b4b5b6b7b8b9babbbcbdbebf +c0c1c2c3c4c5c6c7c8c9cacbcccdcecf +d0d1d2d3d4d5d6d7d8d9dadbdcdddedf +e0e1e2e3e4e5e6e7e8e9eaebecedeeef +f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/substr.phpt b/ext/standard/tests/strings/substr.phpt new file mode 100644 index 0000000..5a8db16 Binary files /dev/null and b/ext/standard/tests/strings/substr.phpt differ diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt new file mode 100644 index 0000000..c647506 --- /dev/null +++ b/ext/standard/tests/strings/substr_compare.phpt @@ -0,0 +1,41 @@ +--TEST-- +substr_compare() +--FILE-- + +--EXPECTF-- +int(0) +int(0) +int(0) +int(1) +int(-1) + +Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d +bool(false) +int(-1) + +Warning: substr_compare() expects parameter 5 to be boolean, object given in %s on line %d +bool(false) +Test + +Warning: substr_compare(): The length must be greater than zero in %s on line %d +bool(false) + +Warning: substr_compare() expects parameter 4 to be long, string given in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/strings/substr_count_basic.phpt b/ext/standard/tests/strings/substr_count_basic.phpt new file mode 100644 index 0000000..f880e94 --- /dev/null +++ b/ext/standard/tests/strings/substr_count_basic.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test substr_count() function (basic) +--FILE-- + +--EXPECTF-- +***Testing basic operations *** +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(100) +int(200) +int(160) +int(10) +Done diff --git a/ext/standard/tests/strings/substr_count_error.phpt b/ext/standard/tests/strings/substr_count_error.phpt new file mode 100644 index 0000000..6f7e772 --- /dev/null +++ b/ext/standard/tests/strings/substr_count_error.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test substr_count() function (error conditions) +--FILE-- + size of the string */ +var_dump(substr_count($str, "t", 25)); + +/* Using offset and length to go beyond the size of the string: + Warning message expected, as length+offset > length of string */ +var_dump( substr_count($str, "i", 5, 15) ); + +/* length as Null */ +var_dump( substr_count($str, "t", "", "") ); +var_dump( substr_count($str, "i", NULL, NULL) ); + +echo "Done\n"; + +?> +--EXPECTF-- +*** Testing error conditions *** + +Warning: substr_count() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count() expects at most 4 parameters, 5 given in %s on line %d +NULL + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Offset should be greater than or equal to 0 in %s on line %d +bool(false) + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Offset value 25 exceeds string length in %s on line %d +bool(false) + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Offset value 5 exceeds string length in %s on line %d +bool(false) + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count() expects parameter 3 to be long, string given in %s on line %d +NULL + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Length should be greater than 0 in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/strings/substr_count_variation_001.phpt b/ext/standard/tests/strings/substr_count_variation_001.phpt new file mode 100644 index 0000000..6277d4d --- /dev/null +++ b/ext/standard/tests/strings/substr_count_variation_001.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test substr_count() function (variation - 1) +--FILE-- + +--EXPECTF-- +*** Testing possible variations *** +-- 3rd or 4th arg as string -- +int(1) +int(1) + +Notice: A non well formed numeric value encountered in %s on line %d +int(2) + +Notice: A non well formed numeric value encountered in %s on line %d + +Notice: A non well formed numeric value encountered in %s on line %d +int(2) + +-- 3rd or 4th arg as NULL -- + +Warning: substr_count() expects parameter 3 to be long, string given %s on line %d +NULL + +Warning: substr_count() expects parameter 3 to be long, string given %s on line %d +NULL + +Warning: substr_count() expects parameter 3 to be long, string given %s on line %d +NULL +int(0) +int(2) + +-- overlapped substrings -- +int(2) +int(2) + +-- complex strings containing other than 7-bit chars -- +int(2) +int(2) +int(1) + +-- heredoc string -- +int(14) +int(16) + +-- heredoc null string -- +int(0) +int(0) +int(0) +Done diff --git a/ext/standard/tests/strings/substr_count_variation_002.phpt b/ext/standard/tests/strings/substr_count_variation_002.phpt new file mode 100644 index 0000000..f8b62bd --- /dev/null +++ b/ext/standard/tests/strings/substr_count_variation_002.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test substr_count() function (variation - 2) +--FILE-- + +--EXPECTF-- +*** Testing possible variations *** + +-- complex strings containing other than 7-bit chars -- +int(2) +int(2) +int(1) + +-- heredoc string -- +int(14) +int(16) + +-- heredoc null string -- +int(0) +int(0) +int(0) +Done diff --git a/ext/standard/tests/strings/substr_replace.phpt b/ext/standard/tests/strings/substr_replace.phpt new file mode 100644 index 0000000..27620de --- /dev/null +++ b/ext/standard/tests/strings/substr_replace.phpt @@ -0,0 +1,810 @@ +--TEST-- +substr_replace() function +--FILE-- + +--EXPECT-- +substr_replace('try this', 'bala ', 2) +string(7) "trbala " + +substr_replace('try this', 'bala ', 2, 3) +string(10) "trbala his" + +substr_replace('try this', 'bala ', 2, 0) +string(13) "trbala y this" + +substr_replace('try this', 'bala ', 2, -2) +string(9) "trbala is" + + + +substr_replace('try this', array ( 0 => 'bala ',), 4 +string(9) "try bala " + +substr_replace('try this', array ( 0 => 'bala ',), 4 +string(10) "try bala s" + + + + +substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,) +array(1) { + [0]=> + string(9) "ala bala " +} + +substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => 3,)) +array(1) { + [0]=> + string(15) "ala bala tokala" +} + +substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => 0,)) +array(1) { + [0]=> + string(18) "ala bala portokala" +} + +substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => -2,)) +array(1) { + [0]=> + string(11) "ala bala la" +} + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',4) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(5) "try s" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(10) "try bala s" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(8) "try this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(13) "try bala this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(6) "try is" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(11) "try bala is" +} + + + + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4,)) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(5) " this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(10) "bala this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(8) "try this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(13) "bala try this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(2) "is" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(7) "bala is" +} + + + + + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,)) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(5) "trhis" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(10) "trbala his" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(8) "try this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(13) "trbala y this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(4) "tris" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(9) "trbala is" +} + + + + + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,)) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 3,)) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(2) "tr" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 3,)) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(7) "trbala " +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 0,)) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(2) "tr" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 0,)) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(7) "trbala " +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => -2,)) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(2) "tr" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => -2,)) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(7) "trbala " +} + + + + + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,)) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 3, 1 => 2,)) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(6) "trthis" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 3, 1 => 2,)) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(11) "trbala this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 0, 1 => 0,)) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(8) "try this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 0, 1 => 0,)) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(13) "trbala y this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => -2, 1 => -3,)) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(5) "trhis" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => -2, 1 => -3,)) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(10) "trbala his" +} + diff --git a/ext/standard/tests/strings/substr_replace_array.phpt b/ext/standard/tests/strings/substr_replace_array.phpt new file mode 100644 index 0000000..dbb8b17 --- /dev/null +++ b/ext/standard/tests/strings/substr_replace_array.phpt @@ -0,0 +1,19 @@ +--TEST-- +substr_replace() function - array +--FILE-- + 'llsskdkk','def' => 'llsskjkkdd', 4 => 'hello', 42 => 'world'); +$newarr = substr_replace($arr, 'zzz', 0, -2); + +print_r($newarr); + +?> +--EXPECTF-- +Array +( + [abc] => zzzkk + [def] => zzzdd + [4] => zzzlo + [42] => zzzld +) diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt new file mode 100644 index 0000000..7d3a695 --- /dev/null +++ b/ext/standard/tests/strings/substr_replace_error.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test substr_replace() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing substr_replace() : error conditions *** + +-- Testing substr_replace() function with less than expected no. of arguments -- + +Warning: substr_replace() expects at least 3 parameters, 0 given in %s on line %d +NULL + +Warning: substr_replace() expects at least 3 parameters, 2 given in %s on line %d +NULL + +-- Testing substr_replace() function with more than expected no. of arguments -- + +Warning: substr_replace() expects at most 4 parameters, 5 given in %s on line %d +NULL + +-- Testing substr_replace() function with start and length different types -- + +Warning: substr_replace(): 'from' and 'len' should be of same type - numerical or array in %s on line %d +string(12) "Good morning" + +Warning: substr_replace(): 'from' and 'len' should be of same type - numerical or array in %s on line %d +string(12) "Good morning" + +-- Testing substr_replace() function with start and length with a different number of elments -- + +Warning: substr_replace(): 'from' and 'len' should have the same number of elements in %s on line %d +string(12) "Good morning" + +-- Testing substr_replace() function with start and length as arrays but string not-- + +Warning: substr_replace(): Functionality of 'from' and 'len' as arrays is not implemented in %s on line %d +string(12) "Good morning" +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/trim.phpt b/ext/standard/tests/strings/trim.phpt new file mode 100644 index 0000000..a69f17c --- /dev/null +++ b/ext/standard/tests/strings/trim.phpt @@ -0,0 +1,27 @@ +--TEST-- +trim(), rtrim() and ltrim() functions +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing trim() : basic functionality *** + +-- Trim string with all white space characters -- +string(27) "---These are a few words---" + +-- Trim non-whitespace from a string -- +string(11) "Hello World" + +-- Trim some non-white space characters from a string -- +string(19) "!===Hello World===!" + +-- Trim the ASCII control characters at the beginning of a string -- +string(14) "Example string" +===DONE=== diff --git a/ext/standard/tests/strings/trim_error.phpt b/ext/standard/tests/strings/trim_error.phpt new file mode 100644 index 0000000..092deb6 --- /dev/null +++ b/ext/standard/tests/strings/trim_error.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test trim() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing trim() : error conditions *** + +-- Testing trim() function with no arguments -- + +Warning: trim() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing trim() function with more than expected no. of arguments -- + +Warning: trim() expects at most 2 parameters, 3 given in %s on line %d +NULL + +-- Test trim function with various invalid charlists -- + +Warning: trim(): Invalid '..'-range, no character to the left of '..' in %s on line %d +string(14) " Hello World +" + +Warning: trim(): Invalid '..'-range, no character to the right of '..' in %s on line %d +string(14) " Hello World +" + +Warning: trim(): Invalid '..'-range, '..'-range needs to be incrementing in %s on line %d +string(14) " Hello World +" + +Warning: trim(): Invalid '..'-range in %s on line %d +string(14) " Hello World +" +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/trim_variation1.phpt b/ext/standard/tests/strings/trim_variation1.phpt new file mode 100644 index 0000000..625ec31 --- /dev/null +++ b/ext/standard/tests/strings/trim_variation1.phpt @@ -0,0 +1,138 @@ +--TEST-- +Test trim() function : usage variations - test values for $str argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing trim() function: with unexpected inputs for 'str' argument *** +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(3) "255" +-- Iteration 4 -- +string(3) "256" +-- Iteration 5 -- +string(10) "2147483647" +-- Iteration 6 -- +string(10) "2147483648" +-- Iteration 7 -- +string(4) "10.5" +-- Iteration 8 -- +string(4) "20.5" +-- Iteration 9 -- +string(12) "101234567000" +-- Iteration 10 -- + +Warning: trim() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: trim() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: trim() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- +string(1) "1" +-- Iteration 14 -- +string(0) "" +-- Iteration 15 -- +string(1) "1" +-- Iteration 16 -- +string(0) "" +-- Iteration 17 -- +string(0) "" +-- Iteration 18 -- +string(0) "" +-- Iteration 19 -- +string(13) "sample object" +-- Iteration 20 -- + +Warning: trim() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 21 -- +string(0) "" +-- Iteration 22 -- +string(0) "" +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/trim_variation2.phpt b/ext/standard/tests/strings/trim_variation2.phpt new file mode 100644 index 0000000..009d61b --- /dev/null +++ b/ext/standard/tests/strings/trim_variation2.phpt @@ -0,0 +1,138 @@ +--TEST-- +Test trim() function : usage variations - test values for $charlist argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing trim() function: with unexpected inputs for 'charlist' argument *** +-- Iteration 1 -- +string(19) "!---Hello World---!" +-- Iteration 2 -- +string(19) "!---Hello World---!" +-- Iteration 3 -- +string(19) "!---Hello World---!" +-- Iteration 4 -- +string(19) "!---Hello World---!" +-- Iteration 5 -- +string(19) "!---Hello World---!" +-- Iteration 6 -- +string(19) "!---Hello World---!" +-- Iteration 7 -- +string(19) "!---Hello World---!" +-- Iteration 8 -- +string(19) "!---Hello World---!" +-- Iteration 9 -- +string(19) "!---Hello World---!" +-- Iteration 10 -- + +Warning: trim() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: trim() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: trim() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- +string(19) "!---Hello World---!" +-- Iteration 14 -- +string(19) "!---Hello World---!" +-- Iteration 15 -- +string(19) "!---Hello World---!" +-- Iteration 16 -- +string(19) "!---Hello World---!" +-- Iteration 17 -- +string(19) "!---Hello World---!" +-- Iteration 18 -- +string(19) "!---Hello World---!" +-- Iteration 19 -- +string(19) "!---Hello World---!" +-- Iteration 20 -- + +Warning: trim() expects parameter 2 to be string, resource given in %s on line %d +NULL +-- Iteration 21 -- +string(19) "!---Hello World---!" +-- Iteration 22 -- +string(19) "!---Hello World---!" +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt new file mode 100644 index 0000000..bae4095 Binary files /dev/null and b/ext/standard/tests/strings/ucfirst.phpt differ diff --git a/ext/standard/tests/strings/ucwords_basic.phpt b/ext/standard/tests/strings/ucwords_basic.phpt new file mode 100644 index 0000000..bba0d9b --- /dev/null +++ b/ext/standard/tests/strings/ucwords_basic.phpt @@ -0,0 +1,83 @@ +--TEST-- +Test ucwords() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing ucwords() : basic functionality *** +-- Iteration 1 -- +string(15) "Testing Ucwords" +-- Iteration 2 -- +string(15) "Testing Ucwords" +-- Iteration 3 -- +string(16) "Testing\tucwords" +-- Iteration 4 -- +string(15) "Testing Ucwords" +-- Iteration 5 -- +string(15) "Testing +Ucwords" +-- Iteration 6 -- +string(16) "Testing\nucwords" +-- Iteration 7 -- +string(15) "Testing Ucwords" +-- Iteration 8 -- +string(16) "Testing\vucwords" +-- Iteration 9 -- +string(7) "Testing" +-- Iteration 10 -- +string(7) "Testing" +-- Iteration 11 -- +string(8) " Testing" +-- Iteration 12 -- +string(8) " Testing" +-- Iteration 13 -- +string(16) "Testing Ucwords" +-- Iteration 14 -- +string(16) "Testing Ucwords" +-- Iteration 15 -- +string(16) "Testing\rucwords" +-- Iteration 16 -- +string(15) "Testing Ucwords" +-- Iteration 17 -- +string(16) "Testing\fucwords" +-- Iteration 18 -- +string(15) "Testing Ucwords" +Done diff --git a/ext/standard/tests/strings/ucwords_error.phpt b/ext/standard/tests/strings/ucwords_error.phpt new file mode 100644 index 0000000..d79e569 --- /dev/null +++ b/ext/standard/tests/strings/ucwords_error.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test ucwords() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing ucwords() : error conditions *** + +-- Testing ucwords() function with Zero arguments -- + +Warning: ucwords() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing ucwords() function with more than expected no. of arguments -- + +Warning: ucwords() expects exactly 1 parameter, 2 given in %s on line %d +NULL +string(10) "string_val" +Done diff --git a/ext/standard/tests/strings/ucwords_variation1.phpt b/ext/standard/tests/strings/ucwords_variation1.phpt new file mode 100644 index 0000000..22c2916 --- /dev/null +++ b/ext/standard/tests/strings/ucwords_variation1.phpt @@ -0,0 +1,201 @@ +--TEST-- +Test ucwords() function : usage variations - unexpected input values +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new my(), + + // empty string + "", + '', + + //NULL + NULL, + null, + + // hex in string + "0x123", + '0x123', + "0xFF12", + "-0xFF12", + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var, + + // resource variable + $fp +); + +// loop through each element of the array and check the working of ucwords() +// when $str arugment is supplied with different values +echo "\n--- Testing ucwords() by supplying different values for 'str' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str = $values [$index]; + + var_dump( ucwords($str) ); + + $counter ++; +} + +// close the file handle +fclose($fp); +echo "Done\n"; +?> +--EXPECTF-- +*** Testing ucwords() : usage variations *** + +--- Testing ucwords() by supplying different values for 'str' argument --- +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(5) "12345" +-- Iteration 4 -- +string(5) "-2345" +-- Iteration 5 -- +string(2) "16" +-- Iteration 6 -- +string(2) "32" +-- Iteration 7 -- +string(3) "170" +-- Iteration 8 -- +string(4) "-245" +-- Iteration 9 -- +string(2) "83" +-- Iteration 10 -- +string(4) "-226" +-- Iteration 11 -- +string(4) "10.5" +-- Iteration 12 -- +string(5) "-10.5" +-- Iteration 13 -- +string(12) "101234567000" +-- Iteration 14 -- +string(13) "1.07654321E-9" +-- Iteration 15 -- +string(3) "0.5" +-- Iteration 16 -- + +Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 21 -- +string(1) "1" +-- Iteration 22 -- +string(0) "" +-- Iteration 23 -- +string(1) "1" +-- Iteration 24 -- +string(0) "" +-- Iteration 25 -- +string(8) "MyString" +-- Iteration 26 -- +string(0) "" +-- Iteration 27 -- +string(0) "" +-- Iteration 28 -- +string(0) "" +-- Iteration 29 -- +string(0) "" +-- Iteration 30 -- +string(5) "0x123" +-- Iteration 31 -- +string(5) "0x123" +-- Iteration 32 -- +string(6) "0xFF12" +-- Iteration 33 -- +string(7) "-0xFF12" +-- Iteration 34 -- +string(0) "" +-- Iteration 35 -- +string(0) "" +-- Iteration 36 -- + +Warning: ucwords() expects parameter 1 to be string, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/strings/ucwords_variation2.phpt b/ext/standard/tests/strings/ucwords_variation2.phpt new file mode 100644 index 0000000..ab6eb2f --- /dev/null +++ b/ext/standard/tests/strings/ucwords_variation2.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test ucwords() function : usage variations - heredoc strings +--FILE-- + +--EXPECTF-- +*** Testing ucwords() : usage variations *** +-- Iteration 1 -- +string(0) "" +-- Iteration 2 -- +string(0) "" +-- Iteration 3 -- +string(52) "Testing Ucword() With +Multiline String Using +Heredoc" +-- Iteration 4 -- +string(93) "Testing Ucword(str) With +Multiline String Using +Heredoc +String.with Different White Spaces" +-- Iteration 5 -- +string(53) "12sting 123string 4567 +String 123string 12 Test +5test" +-- Iteration 6 -- +string(108) "It's Bright,but I Cann't See It. +"things In Double Quote" +'things In Single Quote' +This\line Is /with\slashs" +Done diff --git a/ext/standard/tests/strings/ucwords_variation3.phpt b/ext/standard/tests/strings/ucwords_variation3.phpt new file mode 100644 index 0000000..e6f7c40 --- /dev/null +++ b/ext/standard/tests/strings/ucwords_variation3.phpt @@ -0,0 +1,97 @@ +--TEST-- +Test ucwords() function : usage variations - single quoted string +--FILE-- + +--EXPECTF-- +*** Testing ucwords() : usage variations *** +-- Iteration 1 -- +string(18) "Testing Ucwords" +-- Iteration 2 -- +string(30) "T E S T I N G U C W O R D S " +-- Iteration 3 -- +string(25) "Testing Function(ucwords)" +-- Iteration 4 -- +string(38) "(testing ( Function (ucwords) )a )test" +-- Iteration 5 -- +string(3) "(t)" +-- Iteration 6 -- +string(7) " ( T )t" +-- Iteration 7 -- +string(23) ""testing",ucword,"test"" +-- Iteration 8 -- +string(14) ""t""t",test, T" +-- Iteration 9 -- +string(11) "'t 't',test" +-- Iteration 10 -- +string(27) "\ttesting\ttesting\tucwords" +-- Iteration 11 -- +string(32) "Testing\rucwords Testing Ucwords" +-- Iteration 12 -- +string(37) "Testing\fucwords \f Testing \nucwords" +-- Iteration 13 -- +string(39) "\ntesting\nucwords\n Testing \n Ucwords" +-- Iteration 14 -- +string(20) "Using\vvertical\vtab" +-- Iteration 15 -- +string(42) "T@@#$% %test ^test &test *test +test -test" +-- Iteration 16 -- +string(40) "!test ~test `test` =test= @test@test.com" +-- Iteration 17 -- +string(40) "/test/r\test\ucwords\t\y\y\u\3 \yy\ /uu/" +-- Iteration 18 -- +string(16) "!@#$%^&*()_+=-`~" +Done diff --git a/ext/standard/tests/strings/ucwords_variation4.phpt b/ext/standard/tests/strings/ucwords_variation4.phpt new file mode 100644 index 0000000..bed6550 --- /dev/null +++ b/ext/standard/tests/strings/ucwords_variation4.phpt @@ -0,0 +1,124 @@ +--TEST-- +Test ucwords() function : usage variations - double quoted string +--FILE-- + +--EXPECTF-- +*** Testing ucwords() : usage variations *** +-- Iteration 1 -- +string(18) "Testing Ucwords" +-- Iteration 2 -- +string(30) "T E S T I N G U C W O R D S " +-- Iteration 3 -- +string(25) "Testing Function(ucwords)" +-- Iteration 4 -- +string(38) "(testing ( Function (ucwords) )a )test" +-- Iteration 5 -- +string(3) "(t)" +-- Iteration 6 -- +string(7) " ( T )t" +-- Iteration 7 -- +string(24) ""testing",ucwords,"test"" +-- Iteration 8 -- +string(14) ""t""t",test, T" +-- Iteration 9 -- +string(14) "\'t \'t\',test" +-- Iteration 10 -- +string(10) "Jack's Pen" +-- Iteration 11 -- +string(14) "P't'y 't It's " +-- Iteration 12 -- +string(24) " Testing Testing Ucwords" +-- Iteration 13 -- +string(26) "\ttesting\ttesting Ucwords" +-- Iteration 14 -- +string(31) "Testing Ucwords Testing Ucwords" +-- Iteration 15 -- +string(32) "Testing\rucwords Testing Ucwords" +-- Iteration 16 -- +string(34) "Testing Ucwords Testing +Ucwords" +-- Iteration 17 -- +string(36) "Testing\fucwords \f Testing +Ucwords" +-- Iteration 18 -- +string(35) " +Testing +Ucwords + Testing + Ucwords" +-- Iteration 19 -- +string(39) "\ntesting\nucwords\n Testing \n Ucwords" +-- Iteration 20 -- +string(18) "Using Vertical Tab" +-- Iteration 21 -- +string(20) "Using\vvertical\vtab" +-- Iteration 22 -- +string(42) "T@@#$% %test ^test &test *test +test -test" +-- Iteration 23 -- +string(40) "!test ~test `test` =test= @test@test.com" +-- Iteration 24 -- +string(37) "/test/r Est\ucwords \y\y\u \yy\ /uu/" +-- Iteration 25 -- +string(16) "!@#$%^&*()_+=-`~" +Done diff --git a/ext/standard/tests/strings/unpack.phpt b/ext/standard/tests/strings/unpack.phpt new file mode 100644 index 0000000..26f3f2e --- /dev/null +++ b/ext/standard/tests/strings/unpack.phpt @@ -0,0 +1,11 @@ +--TEST-- +Invalid format type validation +--FILE-- + +--EXPECTF-- +Warning: unpack(): Invalid format type - in %sunpack.php on line %d +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/unpack_error.phpt b/ext/standard/tests/strings/unpack_error.phpt new file mode 100644 index 0000000..43b2df1 --- /dev/null +++ b/ext/standard/tests/strings/unpack_error.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test unpack() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing unpack() : error conditions *** + +-- Testing unpack() function with no arguments -- + +Warning: unpack() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +-- Testing unpack() function with more than expected no. of arguments -- + +Warning: unpack() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing unpack() function with invalid format character -- + +Warning: unpack(): Invalid format type Z in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/strings/url_t.phpt b/ext/standard/tests/strings/url_t.phpt new file mode 100644 index 0000000..e0e5411 --- /dev/null +++ b/ext/standard/tests/strings/url_t.phpt @@ -0,0 +1,712 @@ +--TEST-- +parse_url() function +--FILE-- + +--EXPECT-- +array(1) { + ["path"]=> + string(0) "" +} +array(1) { + ["path"]=> + string(12) "64.246.30.37" +} +array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(12) "64.246.30.37" +} +array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(12) "64.246.30.37" + ["path"]=> + string(1) "/" +} +array(1) { + ["path"]=> + string(13) "64.246.30.37/" +} +array(3) { + ["host"]=> + string(12) "64.246.30.37" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} +array(1) { + ["path"]=> + string(7) "php.net" +} +array(1) { + ["path"]=> + string(8) "php.net/" +} +array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "php.net" +} +array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "php.net" + ["path"]=> + string(1) "/" +} +array(1) { + ["path"]=> + string(11) "www.php.net" +} +array(1) { + ["path"]=> + string(12) "www.php.net/" +} +array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" +} +array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" +} +array(2) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) +} +array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} +array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" +} +array(1) { + ["path"]=> + string(12) "www.php.net/" +} +array(3) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} +array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(18) "/foo/bar/index.php" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +} +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" + ["query"]=> + string(37) "lots=1&of=2¶meters=3&too=4&here=5" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(45) "/this/is/a/very/deep/directory/structure/and/" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(28) "/this/../a/../deep/directory" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(29) "/this/../a/../deep/directory/" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(42) "/this/is/a/very/deep/directory/../file.php" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" +} +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["fragment"]=> + string(3) "foo" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["query"]=> + string(6) "test=1" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" + ["query"]=> + string(7) "test=1&" +} +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["query"]=> + string(1) "&" +} +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(7) "test=1&" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(1) "&" +} +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(4) "foo&" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(4) "&foo" +} +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" +} +array(5) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} +array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} +array(6) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["user"]=> + string(6) "secret" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} +array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} +array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} +array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(14) "secret@hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} +array(8) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hid:out" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} +array(2) { + ["scheme"]=> + string(4) "nntp" + ["host"]=> + string(12) "news.php.net" +} +array(3) { + ["scheme"]=> + string(3) "ftp" + ["host"]=> + string(11) "ftp.gnu.org" + ["path"]=> + string(22) "/gnu/glic/glibc.tar.gz" +} +array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(14) "http://foo@bar" +} +array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(12) "filename.txt" +} +array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(25) "/path/to/my/file/file.txt" +} +array(3) { + ["scheme"]=> + string(3) "foo" + ["host"]=> + string(3) "bar" + ["user"]=> + string(3) "foo" +} +array(2) { + ["scheme"]=> + string(6) "mailto" + ["path"]=> + string(15) "me@mydomain.com" +} +array(2) { + ["path"]=> + string(8) "/foo.php" + ["query"]=> + string(7) "a=b&c=d" +} +array(2) { + ["path"]=> + string(7) "foo.php" + ["query"]=> + string(7) "a=b&c=d" +} +array(6) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(15) "www.example.com" + ["port"]=> + int(8080) + ["user"]=> + string(4) "user" + ["pass"]=> + string(6) "passwd" + ["query"]=> + string(12) "bar=1&boom=0" +} +array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(13) "/path/to/file" +} +array(3) { + ["scheme"]=> + string(4) "file" + ["host"]=> + string(4) "path" + ["path"]=> + string(8) "/to/file" +} +array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(13) "/path/to/file" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "1.2.3.4" + ["path"]=> + string(8) "/abc.asp" + ["query"]=> + string(7) "a=1&b=2" +} +array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "foo.com" + ["fragment"]=> + string(3) "bar" +} +array(1) { + ["scheme"]=> + string(6) "scheme" +} +array(4) { + ["scheme"]=> + string(7) "foo+bar" + ["host"]=> + string(4) "bang" + ["user"]=> + string(3) "baz" + ["path"]=> + string(4) "/bla" +} +array(2) { + ["scheme"]=> + string(2) "gg" + ["path"]=> + string(7) "9130731" +} +array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(4) "host" + ["user"]=> + string(4) "user" + ["pass"]=> + string(5) "@pass" + ["path"]=> + string(5) "/path" + ["query"]=> + string(14) "argument?value" + ["fragment"]=> + string(3) "etc" +} +string(4) "http" +string(11) "www.php.net" +int(80) +string(6) "secret" +string(7) "hideout" +string(10) "/index.php" +string(31) "test=1&test2=char&test3=mixesCI" +string(16) "some_page_ref123" diff --git a/ext/standard/tests/strings/uuencode.phpt b/ext/standard/tests/strings/uuencode.phpt new file mode 100644 index 0000000..3671cd7 --- /dev/null +++ b/ext/standard/tests/strings/uuencode.phpt @@ -0,0 +1,40 @@ +--TEST-- +uuencode family tests +--FILE-- + +--EXPECTF-- +Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d +bool(false) +bool(false) +bool(false) +string(60) "J?B%`(R0E7B8J*"E??7M03TE5651215=145-$1D=(2DM,.CQ-3D)60UA: +` +" +string(1) "%s" +string(42) "~!@#$%^&*()_}{POIUYTREWQQSDFGHJKL: +--INI-- +precision=14 +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing vfprintf() : basic functionality *** +string(17) "Foo is 30 and bar" +int(17) +string(11) "bar bar bar" +int(11) +string(8) "54 digit" +int(8) +string(3) "1 0" +int(3) +string(5) "A B C" +int(5) +string(35) "1.000000e+3 2.000000E+4 2.000000e+2" +int(35) +string(2) "50" +int(2) +string(35) "Testing 1001 6 2.550200 foobar f 41" +int(35) +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_basic1.phpt b/ext/standard/tests/strings/vfprintf_basic1.phpt new file mode 100644 index 0000000..3129d4f --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic1.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test vfprintf() function : basic functionality - string format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using string format *** +int(4) +int(8) +int(14) +one +one two +one two three +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_basic2.phpt b/ext/standard/tests/strings/vfprintf_basic2.phpt new file mode 100644 index 0000000..b758cae --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic2.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test vfprintf() function : basic functionality - integer format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using integer format *** +111 +111 222 +111 222 333 +===DONE=== + + diff --git a/ext/standard/tests/strings/vfprintf_basic3.phpt b/ext/standard/tests/strings/vfprintf_basic3.phpt new file mode 100644 index 0000000..b675b3d --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic3.phpt @@ -0,0 +1,64 @@ +--TEST-- +Test vfprintf() function : basic functionality - float format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using float format *** +11.110000 +11.110000 +11.110000 22.220000 +11.110000 22.220000 +11.110000 22.220000 33.330000 +11.110000 22.220000 33.330000 +===DONE=== + diff --git a/ext/standard/tests/strings/vfprintf_basic4.phpt b/ext/standard/tests/strings/vfprintf_basic4.phpt new file mode 100644 index 0000000..1595f03 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic4.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test vfprintf() function : basic functionality - bool format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using bool format *** +1 +1 0 +1 0 1 +===DONE=== + diff --git a/ext/standard/tests/strings/vfprintf_basic5.phpt b/ext/standard/tests/strings/vfprintf_basic5.phpt new file mode 100644 index 0000000..a080c9e --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic5.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test vfprintf() function : basic functionality - char format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using char format *** +A +A B +A B C +===DONE=== + + diff --git a/ext/standard/tests/strings/vfprintf_basic6.phpt b/ext/standard/tests/strings/vfprintf_basic6.phpt new file mode 100644 index 0000000..ed88a28 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic6.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test vfprintf() function : basic functionality - exponential format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using exponential format *** +1.000000e+3 +1.000000e+3 2.000000e+3 +1.000000e+3 2.000000e+3 3.000000e+3 +===DONE=== + diff --git a/ext/standard/tests/strings/vfprintf_basic7.phpt b/ext/standard/tests/strings/vfprintf_basic7.phpt new file mode 100644 index 0000000..45544a3 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic7.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test vfprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using unsigned format *** +4294966185 +4294966185 4293732729 +4294966185 4293732729 4292621864 +===DONE=== + + diff --git a/ext/standard/tests/strings/vfprintf_basic7_64bit.phpt b/ext/standard/tests/strings/vfprintf_basic7_64bit.phpt new file mode 100644 index 0000000..77fae2c --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic7_64bit.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test vfprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using unsigned format *** +18446744073709550505 +18446744073709550505 18446744073708317049 +18446744073709550505 18446744073708317049 18446744073707206184 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_basic8.phpt b/ext/standard/tests/strings/vfprintf_basic8.phpt new file mode 100644 index 0000000..6fe2151 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic8.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test vfprintf() function : basic functionality - octal format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using octal format *** +21 +21 347 +21 347 567 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_basic9.phpt b/ext/standard/tests/strings/vfprintf_basic9.phpt new file mode 100644 index 0000000..8294c84 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic9.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test vfprintf) function : basic functionality - hexadecimal format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf) : basic functionality - using hexadecimal format *** +b +B +b 84 +B 84 +b 84 b1 +B 84 B1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_error1.phpt b/ext/standard/tests/strings/vfprintf_error1.phpt new file mode 100644 index 0000000..8ef086d --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_error1.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test vfprintf() function : error conditions (more than expected arguments) +--CREDITS-- +Felix De Vliegher +--INI-- +precision=14 +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +-- Testing vfprintf() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for vfprintf() in %s on line %d +NULL + +Warning: Wrong parameter count for vfprintf() in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_error2.phpt b/ext/standard/tests/strings/vfprintf_error2.phpt new file mode 100644 index 0000000..bcf7e27 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_error2.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test vfprintf() function : error conditions (less than expected arguments) +--CREDITS-- +Felix De Vliegher +--INI-- +precision=14 +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +-- Testing vfprintf() function with less than expected no. of arguments -- + +Warning: Wrong parameter count for vfprintf() in %s on line %d +NULL + +Warning: Wrong parameter count for vfprintf() in %s on line %d +NULL + +Warning: Wrong parameter count for vfprintf() in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_error3.phpt b/ext/standard/tests/strings/vfprintf_error3.phpt new file mode 100644 index 0000000..5a20780 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_error3.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test vfprintf() function : error conditions (wrong argument types) +--CREDITS-- +Felix De Vliegher +--INI-- +precision=14 +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +-- Testing vfprintf() function with wrong variable types as argument -- + +Notice: Array to string conversion in %s on line %d +int(5) +string(5) "Array" +int(9) +string(9) "Foo fake" +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_error4.phpt b/ext/standard/tests/strings/vfprintf_error4.phpt new file mode 100644 index 0000000..131b047 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_error4.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test vfprintf() function : error conditions (various conditions) +--CREDITS-- +Felix De Vliegher +--INI-- +precision=14 +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +-- Testing vfprintf() function with other strangeties -- + +Warning: vfprintf() expects parameter 1 to be resource, string given in %s on line %d +bool(false) + +Warning: vfprintf(): Argument number must be greater than zero in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation1.phpt b/ext/standard/tests/strings/vfprintf_variation1.phpt new file mode 100644 index 0000000..316e55c --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation1.phpt @@ -0,0 +1,86 @@ +--TEST-- +Test vfprintf() function : variation functionality +--CREDITS-- +Felix De Vliegher +--INI-- +precision=14 +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing vfprintf() : variation functionality *** +string(6) "format" +int(6) +string(17) "Foo is 30 and bar" +int(17) +string(14) "Foobar testing" +int(14) +string(11) "bar bar bar" +int(11) +string(2) "50" +int(2) +string(0) "" +int(0) +string(38) "Testing 1001 6 2.550200 30 foobar f 41" +int(38) +bool(false) +bool(false) +bool(false) +bool(false) +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation10.phpt b/ext/standard/tests/strings/vfprintf_variation10.phpt new file mode 100644 index 0000000..e2c066e Binary files /dev/null and b/ext/standard/tests/strings/vfprintf_variation10.phpt differ diff --git a/ext/standard/tests/strings/vfprintf_variation11.phpt b/ext/standard/tests/strings/vfprintf_variation11.phpt new file mode 100644 index 0000000..45f1f61 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation11.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test vfprintf() function : usage variations - octal formats with octal values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : octal formats with octal values *** + +-- Iteration 1 -- +0 +-- Iteration 2 -- +37777777777 1 +-- Iteration 3 -- +20000000000 o, 17777777777 20000000001 +-- Iteration 4 -- + 37776543211 0000 +-- Iteration 5 -- +111 2222 37777444445 37733333334 +-- Iteration 6 -- +11073 7653 123 12 +-- Iteration 7 -- +% %o o +-- Iteration 8 -- +1 2 3 4 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation11_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation11_64bit.phpt new file mode 100644 index 0000000..d654984 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation11_64bit.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test vfprintf() function : usage variations - octal formats with octal values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : octal formats with octal values *** + +-- Iteration 1 -- +0 +-- Iteration 2 -- +1777777777777777777777 1 +-- Iteration 3 -- +1777777777760000000000 o, 17777777777 1777777777760000000001 +-- Iteration 4 -- + 1777777777777776543211 0000 +-- Iteration 5 -- +111 2222 1777777777777777444445 1777777777777733333334 +-- Iteration 6 -- +11073 7653 123 12 +-- Iteration 7 -- +% %o o +-- Iteration 8 -- +1 2 3 4 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation12.phpt b/ext/standard/tests/strings/vfprintf_variation12.phpt new file mode 100644 index 0000000..e95fd5b --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation12.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test vfprintf() function : usage variations - octal formats with non-octal values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different octal formats from the above $format array +// and with non-octal values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : octal formats and non-octal values *** + +-- Iteration 1 -- +2 0 12 + 361100 o 37777775456 2322 + + 30071 14 37777777764 37777416700 + 12 361100 2 0 +-- Iteration 2 -- +2 37777777776 2 + 361100 o 37720715133 57062645 + + 57060664 4475347 37721631371 37720717336 + 2 361100 2 37777777776 +-- Iteration 3 -- +0 0 0 + 173 o 37777777605 173 + + 2322 0 $0 _0 + 0 173 0 0 +-- Iteration 4 -- +1 1 1 + 1 o 1 1 + + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 5 -- +1 1 0 + 1 o 0 1 + + #0 1 $1 _0 + 0 1 1 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation12_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation12_64bit.phpt new file mode 100644 index 0000000..a1e57bc --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation12_64bit.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test vfprintf() function : usage variations - octal formats with non-octal values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different octal formats from the above $format array +// and with non-octal values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : octal formats and non-octal values *** + +-- Iteration 1 -- +2 0 12 + 361100 o 1777777777777777775456 2322 + + 30071 14 1777777777777777777764 1777777777777777416700 + 12 361100 2 0 +-- Iteration 2 -- +2 1777777777777777777776 2 + 361100 o 1777777777777720715133 57062645 + + 57060664 4475347 1777777777777721631371 1777777777777720717336 + 2 361100 2 1777777777777777777776 +-- Iteration 3 -- +0 0 0 + 173 o 1777777777777777777605 173 + + 2322 0 $0 _0 + 0 173 0 0 +-- Iteration 4 -- +1 1 1 + 1 o 1 1 + + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 5 -- +1 1 0 + 1 o 0 1 + + #0 1 $1 _0 + 0 1 1 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation13.phpt b/ext/standard/tests/strings/vfprintf_variation13.phpt new file mode 100644 index 0000000..245feb5 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation13.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test vfprintf() function : usage variations - hexa formats with hexa values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : hexa formats with hexa values *** + +-- Iteration 1 -- +0 +-- Iteration 2 -- +ffffffff 1 22 +-- Iteration 3 -- +7fffffff x, 7000000 80000000 +-- Iteration 4 -- + ffed2979 0000 +-- Iteration 5 -- +#1 2222 1b6db bbbbbbbc +-- Iteration 6 -- +123b fab 0 a +-- Iteration 7 -- +%34 x +-- Iteration 8 -- +1 2 3 4 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation13_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation13_64bit.phpt new file mode 100644 index 0000000..bf6fcb5 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation13_64bit.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test vfprintf() function : usage variations - hexa formats with hexa values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : hexa formats with hexa values *** + +-- Iteration 1 -- +0 +-- Iteration 2 -- +ffffffffffffffff 1 22 +-- Iteration 3 -- +7fffffff x, 7000000 ffffffff80000000 +-- Iteration 4 -- + ffffffffffed2979 0000 +-- Iteration 5 -- +#1 2222 1b6db ffffffffbbbbbbbc +-- Iteration 6 -- +123b fab 0 a +-- Iteration 7 -- +%34 x +-- Iteration 8 -- +1 2 3 4 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation14.phpt b/ext/standard/tests/strings/vfprintf_variation14.phpt new file mode 100644 index 0000000..c714d89 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation14.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test vfprintf() function : usage variations - hexa formats with non-hexa values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different hexa formats from the above $format array +// and with non-hexa values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : hexa formats and non-hexa values *** + +-- Iteration 1 -- +2 0 a + 1e240 x fffffb2e 4d2 + + 3039 c fffffff4 fffe1dc0 + a 1e240 2 0 +-- Iteration 2 -- +2 fffffffe 2 + 1e240 x ff439a5b bc65a5 + + bc61b4 127ae7 ff4732f9 ff439ede + 2 1e240 2 fffffffe +-- Iteration 3 -- +0 0 0 + 7b x ffffff85 7b + + 4d2 0 $0 _0 + 0 7b 0 0 +-- Iteration 4 -- +1 1 1 + 1 x 1 1 + + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 5 -- +1 1 0 + 1 x 0 1 + + #0 1 $1 _0 + 0 1 1 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation14_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation14_64bit.phpt new file mode 100644 index 0000000..930ee3d --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation14_64bit.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test vfprintf() function : usage variations - hexa formats with non-hexa values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different hexa formats from the above $format array +// and with non-hexa values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : hexa formats and non-hexa values *** + +-- Iteration 1 -- +2 0 a + 1e240 x fffffffffffffb2e 4d2 + + 3039 c fffffffffffffff4 fffffffffffe1dc0 + a 1e240 2 0 +-- Iteration 2 -- +2 fffffffffffffffe 2 + 1e240 x ffffffffff439a5b bc65a5 + + bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede + 2 1e240 2 fffffffffffffffe +-- Iteration 3 -- +0 0 0 + 7b x ffffffffffffff85 7b + + 4d2 0 $0 _0 + 0 7b 0 0 +-- Iteration 4 -- +1 1 1 + 1 x 1 1 + + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 5 -- +1 1 0 + 1 x 0 1 + + #0 1 $1 _0 + 0 1 1 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation15.phpt b/ext/standard/tests/strings/vfprintf_variation15.phpt new file mode 100644 index 0000000..95667b5 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation15.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test vfprintf() function : usage variations - unsigned formats with unsigned values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : unsigned formats and unsigned values *** + +-- Iteration 1 -- +1234567 342391 0 +-- Iteration 2 -- +3755744308 u 1234 12345 +-- Iteration 3 -- + 1234000 2450319192 120 +-- Iteration 4 -- +#1 0 $0 10 +-- Iteration 5 -- +1 2 3 4 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation15_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation15_64bit.phpt new file mode 100644 index 0000000..d2e331c --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation15_64bit.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test vfprintf() function : usage variations - unsigned formats with unsigned values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : unsigned formats and unsigned values *** + +-- Iteration 1 -- +1234567 342391 0 +-- Iteration 2 -- +12345678900 u 1234 12345 +-- Iteration 3 -- + 1234000 101234567000 120 +-- Iteration 4 -- +#1 0 $0 10 +-- Iteration 5 -- +1 2 3 4 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation16.phpt b/ext/standard/tests/strings/vfprintf_variation16.phpt new file mode 100644 index 0000000..2163052 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation16.phpt @@ -0,0 +1,112 @@ +--TEST-- +Test vfprintf() function : usage variations - unsigned formats with signed and other types of values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different unsigned formats from the above $format array +// and with signed and other types of values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : unsigned formats and signed & other types of values *** + +-- Iteration 1 -- +2 0 10 + 123456 u 1234 2820130816 + 2840207360 1177509888 12345 + 12 4294967284 4294843840 _3 + 10 123456 2 0 +-- Iteration 2 -- +0 0 0 + 123 u 4294967173 123 + 0 0 0 + 1234 0 $0 _0 + 0 123 0 0 +-- Iteration 3 -- +1 1 1 + 1 u 1 1 + 1 1 1 + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 4 -- +1 1 0 + 1 u 0 1 + 1 1 0 + #0 1 $1 _0 + 0 1 1 1 +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/vfprintf_variation16_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation16_64bit.phpt new file mode 100644 index 0000000..381e67c --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation16_64bit.phpt @@ -0,0 +1,112 @@ +--TEST-- +Test vfprintf() function : usage variations - unsigned formats with signed and other types of values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different unsigned formats from the above $format array +// and with signed and other types of values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : unsigned formats and signed & other types of values *** + +-- Iteration 1 -- +2 0 10 + 123456 u 1234 20000000000 + 2000000000000 22000000000000 12345 + 12 18446744073709551604 18446744073709428160 _3 + 10 123456 2 0 +-- Iteration 2 -- +0 0 0 + 123 u 18446744073709551493 123 + 0 0 0 + 1234 0 $0 _0 + 0 123 0 0 +-- Iteration 3 -- +1 1 1 + 1 u 1 1 + 1 1 1 + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 4 -- +1 1 0 + 1 u 0 1 + 1 1 0 + #0 1 $1 _0 + 0 1 1 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation17.phpt b/ext/standard/tests/strings/vfprintf_variation17.phpt new file mode 100644 index 0000000..871ae98 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation17.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test vfprintf() function : usage variations - scientific formats with scientific values +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : scientific formats and scientific values *** + +-- Iteration 1 -- +0.000000e+0 +1.000000e+0 1.000000e+3 +-- Iteration 2 -- +2.200000e+2 e 1.000000e+1 1.000000e+10 +-- Iteration 3 -- +-2.2000e+13 1.0000e+21 1.2000e+2 +-- Iteration 4 -- +#########1.000000e+1 1.000000e+2 $$$$$$$$-1.000000e+3 _________1.000000e+2 +-- Iteration 5 -- +1.000000e+3 2.000000e+3 3.000000e+3 4.000000e+3 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation18.phpt b/ext/standard/tests/strings/vfprintf_variation18.phpt new file mode 100644 index 0000000..7616862 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation18.phpt @@ -0,0 +1,107 @@ +--TEST-- +Test vfprintf() function : usage variations - scientific formats with non-scientific values +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different scientific formats from the above $format array +// and with non-scientific values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : scientific formats and non-scientific values *** + +-- Iteration 1 -- +2.200000e+0 +2.000000e-1 1.020000e+1 + 1.234562e+5 e -1.234679e+3 1.234679e+3 + 2.0000e+1 2.1220e+2 -4.110000e+11 2.2120e+3 + 1.234578e+4 1.200000e+1 -1.200000e+1 -1.234562e+5 + 1.020000e+1 1.234562e+5 2.200000e+0 2.000000e-1 +-- Iteration 2 -- +0.000000e+0 +0.000000e+0 0.000000e+0 + 1.230000e+2 e -1.230000e+2 1.230000e+2 + 0.0000e+0 0.0000e+0 1.234560e+5 0.0000e+0 + 1.234000e+3 0.000000e+0 0.000000e+0 0.000000e+0 + 0.000000e+0 1.230000e+2 0.000000e+0 0.000000e+0 +-- Iteration 3 -- +1.000000e+0 +1.000000e+0 1.000000e+0 + 1.000000e+0 e 1.000000e+0 1.000000e+0 + 1.0000e+0 1.0000e+0 1.000000e+0 1.0000e+0 + 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0 + 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0 +-- Iteration 4 -- +1.000000e+0 +1.000000e+0 0.000000e+0 + 1.000000e+0 e 0.000000e+0 1.000000e+0 + 1.0000e+0 0.0000e+0 1.000000e+0 0.0000e+0 + 0.000000e+0 1.000000e+0 1.000000e+0 0.000000e+0 + 0.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation19.phpt b/ext/standard/tests/strings/vfprintf_variation19.phpt new file mode 100644 index 0000000..7ee01a9 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation19.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test vfprintf() function : usage variations - with whitespaces in format strings +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : with white spaces in format strings *** + +-- Iteration 1 -- +111 222 333 +-- Iteration 2 -- +1.100000 0.200000 -0.600000 +-- Iteration 3 -- +1.120000 -1.130000 0.230000 +-- Iteration 4 -- +1 10 11 +-- Iteration 5 -- +A B C +-- Iteration 6 -- +2.000000e+1 2.000000e-1 -2.000000e+1 +-- Iteration 7 -- +4294967285 22 33 +-- Iteration 8 -- +12 37777777755 23 +-- Iteration 9 -- +11 ffffffde 33 +-- Iteration 10 -- +11 FFFFFFDE 33 +-- Iteration 11 -- +2.000000E+1 2.000000E-1 -2.000000E+1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation19_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation19_64bit.phpt new file mode 100644 index 0000000..58810a8 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation19_64bit.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test vfprintf() function : usage variations - with whitespaces in format strings +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : with white spaces in format strings *** + +-- Iteration 1 -- +111 222 333 +-- Iteration 2 -- +1.100000 0.200000 -0.600000 +-- Iteration 3 -- +1.120000 -1.130000 0.230000 +-- Iteration 4 -- +1 10 11 +-- Iteration 5 -- +A B C +-- Iteration 6 -- +2.000000e+1 2.000000e-1 -2.000000e+1 +-- Iteration 7 -- +18446744073709551605 22 33 +-- Iteration 8 -- +12 1777777777777777777755 23 +-- Iteration 9 -- +11 ffffffffffffffde 33 +-- Iteration 10 -- +11 FFFFFFFFFFFFFFDE 33 +-- Iteration 11 -- +2.000000E+1 2.000000E-1 -2.000000E+1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation20.phpt b/ext/standard/tests/strings/vfprintf_variation20.phpt new file mode 100644 index 0000000..cd348d8 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation20.phpt @@ -0,0 +1,175 @@ +--TEST-- +Test vfprintf() function : usage variations - unexpected values for the format argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data +/*15*/ NULL, + null, + + // boolean data +/*17*/ true, + false, + TRUE, + FALSE, + + // empty data +/*21*/ "", + '', + + // object data +/*23*/ new sample(), + + // undefined data +/*24*/ @$undefined_var, + + // unset data +/*25*/ @$unset_var, + + // resource data +/*26*/ $file_handle +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +fprintf($fp, "\n*** Testing vprintf() with with unexpected values for format argument ***\n"); + +$counter = 1; +foreach( $values as $value ) { + fprintf( $fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $value, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECTF-- +*** Testing vfprintf() : with unexpected values for format argument *** + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +*** Testing vprintf() with with unexpected values for format argument *** + +-- Iteration 1 -- +0 +-- Iteration 2 -- +1 +-- Iteration 3 -- +12345 +-- Iteration 4 -- +-2345 +-- Iteration 5 -- +10.5 +-- Iteration 6 -- +-10.5 +-- Iteration 7 -- +101234567000 +-- Iteration 8 -- +1.07654321E-9 +-- Iteration 9 -- +0.5 +-- Iteration 10 -- +Array +-- Iteration 11 -- +Array +-- Iteration 12 -- +Array +-- Iteration 13 -- +Array +-- Iteration 14 -- +Array +-- Iteration 15 -- + +-- Iteration 16 -- + +-- Iteration 17 -- +1 +-- Iteration 18 -- + +-- Iteration 19 -- +1 +-- Iteration 20 -- + +-- Iteration 21 -- + +-- Iteration 22 -- + +-- Iteration 23 -- +object +-- Iteration 24 -- + +-- Iteration 25 -- + +-- Iteration 26 -- +Resource id #%d +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation21.phpt b/ext/standard/tests/strings/vfprintf_variation21.phpt new file mode 100644 index 0000000..4dc9ed5 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation21.phpt @@ -0,0 +1,168 @@ +--TEST-- +Test vfprintf() function : usage variations - unexpected values for args argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing vfprintf() : with unexpected values for args argument *** + +Warning: vfprintf(): Too few arguments in %s on line %d + +Warning: vfprintf(): Too few arguments in %s on line %d + +Warning: vfprintf(): Too few arguments in %s on line %d + +Warning: vfprintf(): Too few arguments in %s on line %d + +Warning: vfprintf(): Too few arguments in %s on line %d + +*** Testing vprintf() with unexpected values for args argument *** + +-- Iteration 1 -- +0 +-- Iteration 2 -- +1 +-- Iteration 3 -- +12345 +-- Iteration 4 -- +-2345 +-- Iteration 5 -- +10.5 +-- Iteration 6 -- +-10.5 +-- Iteration 7 -- +101234567000 +-- Iteration 8 -- +1.07654321E-9 +-- Iteration 9 -- +0.5 +-- Iteration 10 -- + +-- Iteration 11 -- + +-- Iteration 12 -- +1 +-- Iteration 13 -- + +-- Iteration 14 -- +1 +-- Iteration 15 -- + +-- Iteration 16 -- + +-- Iteration 17 -- + +-- Iteration 18 -- +string +-- Iteration 19 -- +string +-- Iteration 20 -- + +-- Iteration 21 -- + +-- Iteration 22 -- + +-- Iteration 23 -- +Resource id #%d +===DONE=== + diff --git a/ext/standard/tests/strings/vfprintf_variation3.phpt b/ext/standard/tests/strings/vfprintf_variation3.phpt new file mode 100644 index 0000000..02535ce --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation3.phpt @@ -0,0 +1,87 @@ +--TEST-- +Test vfprintf() function : usage variations - int formats with int values +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : int formats with int values *** + +-- Iteration 1 -- +0 +-- Iteration 2 -- +-1 1 +-- Iteration 3 -- +2147483647 d, 2147483640 -2147483640 +-- Iteration 4 -- + 123456 12345678 -1234567 1234567 +-- Iteration 5 -- +111 2222 333333 44444444 +-- Iteration 6 -- +4667 4011 83 10 +-- Iteration 7 -- +%-5678 d +-- Iteration 8 -- +1 2 3 4 +===DONE=== + diff --git a/ext/standard/tests/strings/vfprintf_variation4.phpt b/ext/standard/tests/strings/vfprintf_variation4.phpt new file mode 100644 index 0000000..72ca9fe --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation4.phpt @@ -0,0 +1,113 @@ +--TEST-- +Test vfprintf() function : usage variations - int formats with non-integer values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different int formats from the above $format array +// and with non-int values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : int formats and non-integer values *** + +-- Iteration 1 -- +2 +0 10 + 123456 d -1234 1234 + -1474836480 200000 4000 22000000 + 12345 12 -12 -123456 + 10 123456 2 0 +-- Iteration 2 -- +0 +0 0 + 123 d -123 123 + 0 0 123456 0000 + 1234 0 $0 _0 + 0 123 0 0 +-- Iteration 3 -- +1 +1 1 + 1 d 1 1 + 1 1 1 0001 + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 4 -- +1 +1 0 + 1 d 0 1 + 1 0 1 0000 + #0 1 $1 _0 + 0 1 1 1 +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/vfprintf_variation4_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation4_64bit.phpt new file mode 100644 index 0000000..f7038ff --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation4_64bit.phpt @@ -0,0 +1,113 @@ +--TEST-- +Test vfprintf() function : usage variations - int formats with non-integer values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different int formats from the above $format array +// and with non-int values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : int formats and non-integer values *** + +-- Iteration 1 -- +2 +0 10 + 123456 d -1234 1234 + 20000000000 200000 4000 22000000 + 12345 12 -12 -123456 + 10 123456 2 0 +-- Iteration 2 -- +0 +0 0 + 123 d -123 123 + 0 0 123456 0000 + 1234 0 $0 _0 + 0 123 0 0 +-- Iteration 3 -- +1 +1 1 + 1 d 1 1 + 1 1 1 0001 + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 4 -- +1 +1 0 + 1 d 0 1 + 1 0 1 0000 + #0 1 $1 _0 + 0 1 1 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation5.phpt b/ext/standard/tests/strings/vfprintf_variation5.phpt new file mode 100644 index 0000000..4bac1eb --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation5.phpt @@ -0,0 +1,86 @@ +--TEST-- +Test vfprintf() function : usage variations - float formats with float values +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : int formats with float values *** + +-- Iteration 1 -- +0.000000 +-- Iteration 2 -- +-0.100000 0.100000 10.000001 +-- Iteration 3 -- +2147483649.000000 f, 2147483640.000000 -2147483640.000000 +-- Iteration 4 -- +200000.0000 0.0000 -200000.000000 -0.0000 +-- Iteration 5 -- +20000.000000 -1999999999999999879418332743206357172224.000000 0.000000 20000000000000000000.000000 +-- Iteration 6 -- +4667.000000 4011.000000 83.000000 10.000000 +-- Iteration 7 -- +%-5678.567800 f +-- Iteration 8 -- +1.110000 2.220000 3.330000 4.440000 +===DONE=== + diff --git a/ext/standard/tests/strings/vfprintf_variation6.phpt b/ext/standard/tests/strings/vfprintf_variation6.phpt new file mode 100644 index 0000000..6b5425d --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation6.phpt @@ -0,0 +1,108 @@ +--TEST-- +Test vfprintf() function : usage variations - float formats with non-float values +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different float formats from the above $format array +// and with non-float values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : float formats and non-float values *** + +-- Iteration 1 -- +2.000000 -2.000000 2.000000 + 123456.000000 f -12346789.000000 12346789.000000 + 123200.0000 20000.0000 -40000.000000 22212.0000 + 12345780.000000 1211111.000000 -12111111.000000 -12345634.000000 + 2.000000 123456.000000 2.000000 -2.000000 +-- Iteration 2 -- +0.000000 +0.000000 0.000000 + 123.000000 f -123.000000 123.000000 + 0.0000 0.0000 123456.000000 0.0000 + 1234.000000 0.000000 0.000000 0.000000 + 0.000000 123.000000 0.000000 0.000000 +-- Iteration 3 -- +1.000000 +1.000000 1.000000 + 1.000000 f 1.000000 1.000000 + 1.0000 1.0000 1.000000 1.0000 + 1.000000 1.000000 1.000000 1.000000 + 1.000000 1.000000 1.000000 1.000000 +-- Iteration 4 -- +1.000000 +1.000000 0.000000 + 1.000000 f 0.000000 1.000000 + 1.0000 0.0000 1.000000 0.0000 + 0.000000 1.000000 1.000000 0.000000 + 0.000000 1.000000 1.000000 1.000000 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation7.phpt b/ext/standard/tests/strings/vfprintf_variation7.phpt new file mode 100644 index 0000000..a206fd8 Binary files /dev/null and b/ext/standard/tests/strings/vfprintf_variation7.phpt differ diff --git a/ext/standard/tests/strings/vfprintf_variation8.phpt b/ext/standard/tests/strings/vfprintf_variation8.phpt new file mode 100644 index 0000000..cda05c4 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation8.phpt @@ -0,0 +1,111 @@ +--TEST-- +Test vfprintf() function : usage variations - string formats with non-string values +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different string formats from the above $format array +// and with non-string values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : string formats and non-string values *** + +-- Iteration 1 -- +2.2 0.2 10.2 + 123456.234 s -1234.6789 1234.6789 + 2123 2765 -27654321000 1234 + 12.000000011111 -12.00000111111 -123456.234 3.33 + 10.2 123456.234 2.2 0.2 +-- Iteration 2 -- +2 -2 2 + 123456 s -12346789 12346789 + 1232 2000 -40000 2221 + 12345780 1211111 -12111111 -12345634 + 2 123456 2 -2 +-- Iteration 3 -- +Array Array Array + Array s Array Array + Arra Arra Array Arra + Array Array Array Array + Array Array Array Array +-- Iteration 4 -- +1 1 + 1 s 1 + 1 0001 0000 + #0 1 $1 _0 + 1 1 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation9.phpt b/ext/standard/tests/strings/vfprintf_variation9.phpt new file mode 100644 index 0000000..d10c8ae Binary files /dev/null and b/ext/standard/tests/strings/vfprintf_variation9.phpt differ diff --git a/ext/standard/tests/strings/vprintf_basic1.phpt b/ext/standard/tests/strings/vprintf_basic1.phpt new file mode 100644 index 0000000..f694155 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_basic1.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test vprintf() function : basic functionality - string format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : basic functionality - using string format *** +one +int(3) +one two +int(7) +one two three +int(13) +===DONE=== + diff --git a/ext/standard/tests/strings/vprintf_basic2.phpt b/ext/standard/tests/strings/vprintf_basic2.phpt new file mode 100644 index 0000000..cdf6c2d --- /dev/null +++ b/ext/standard/tests/strings/vprintf_basic2.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test vprintf() function : basic functionality - integer format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : basic functionality - using integer format *** +111 +int(3) +111 222 +int(7) +111 222 333 +int(11) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_basic3.phpt b/ext/standard/tests/strings/vprintf_basic3.phpt new file mode 100644 index 0000000..966ea56 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_basic3.phpt @@ -0,0 +1,66 @@ +--TEST-- +Test vprintf() function : basic functionality - float format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : basic functionality - using float format *** +11.110000 +int(9) +11.110000 +int(9) +11.110000 22.220000 +int(19) +11.110000 22.220000 +int(19) +11.110000 22.220000 33.330000 +int(29) +11.110000 22.220000 33.330000 +int(29) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_basic4.phpt b/ext/standard/tests/strings/vprintf_basic4.phpt new file mode 100644 index 0000000..89494e1 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_basic4.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test vprintf() function : basic functionality - bool format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : basic functionality - using bool format *** +1 +int(1) +1 0 +int(3) +1 0 1 +int(5) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_basic5.phpt b/ext/standard/tests/strings/vprintf_basic5.phpt new file mode 100644 index 0000000..e999417 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_basic5.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test vprintf() function : basic functionality - char format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : basic functionality - using char format *** +A +int(1) +A B +int(3) +A B C +int(5) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_basic6.phpt b/ext/standard/tests/strings/vprintf_basic6.phpt new file mode 100644 index 0000000..7f1bbd1 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_basic6.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test vprintf() function : basic functionality - exponential format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : basic functionality - using exponential format *** +1.000000e+3 +int(11) +1.000000e+3 2.000000e+3 +int(23) +1.000000e+3 2.000000e+3 3.000000e+3 +int(35) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_basic7.phpt b/ext/standard/tests/strings/vprintf_basic7.phpt new file mode 100644 index 0000000..fdf90fd --- /dev/null +++ b/ext/standard/tests/strings/vprintf_basic7.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test vprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : basic functionality - using unsigned format *** +4294966185 +int(10) +4294966185 4293732729 +int(21) +4294966185 4293732729 4292621864 +int(32) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_basic7_64bit.phpt b/ext/standard/tests/strings/vprintf_basic7_64bit.phpt new file mode 100644 index 0000000..32aa338 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_basic7_64bit.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test vprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing vprintf() : basic functionality - using unsigned format *** +18446744073709550505 +int(20) +18446744073709550505 18446744073708317049 +int(41) +18446744073709550505 18446744073708317049 18446744073707206184 +int(62) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_basic8.phpt b/ext/standard/tests/strings/vprintf_basic8.phpt new file mode 100644 index 0000000..91c6dd7 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_basic8.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test vprintf() function : basic functionality - octal format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : basic functionality - using octal format *** +21 +int(2) +21 347 +int(6) +21 347 567 +int(10) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_basic9.phpt b/ext/standard/tests/strings/vprintf_basic9.phpt new file mode 100644 index 0000000..4aa12a0 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_basic9.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test vprintf() function : basic functionality - hexadecimal format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : basic functionality - using hexadecimal format *** +b +int(1) +B +int(1) +b 84 +int(4) +B 84 +int(4) +b 84 b1 +int(7) +B 84 B1 +int(7) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_error.phpt b/ext/standard/tests/strings/vprintf_error.phpt new file mode 100644 index 0000000..91fc1bd --- /dev/null +++ b/ext/standard/tests/strings/vprintf_error.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test vprintf() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing vprintf() : error conditions *** + +-- Testing vprintf() function with Zero arguments -- + +Warning: vprintf() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing vprintf() function with less than expected no. of arguments -- + +Warning: Wrong parameter count for vprintf() in %s on line %d +bool(false) + +-- testing vprintf() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for vprintf() in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation1.phpt b/ext/standard/tests/strings/vprintf_variation1.phpt new file mode 100644 index 0000000..18f314f --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation1.phpt @@ -0,0 +1,219 @@ +--TEST-- +Test vprintf() function : usage variations - unexpected values for the format argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data +/*15*/ NULL, + null, + + // boolean data +/*17*/ true, + false, + TRUE, + FALSE, + + // empty data +/*21*/ "", + '', + + // object data +/*23*/ new sample(), + + // undefined data +/*24*/ @$undefined_var, + + // unset data +/*25*/ @$unset_var, + + // resource data +/*26*/ $file_handle +); + +// loop through each element of the array for format + +$counter = 1; +foreach($values as $value) { + echo "\n -- Iteration $counter --\n"; + $result = vprintf($value,$args); + echo "\n"; + var_dump($result); + $counter++; + +}; + +// closing the resource +fclose($file_handle); + +?> +===DONE=== +--EXPECTF-- +*** Testing vprintf() : with unexpected values for format argument *** + + -- Iteration 1 -- +0 +int(1) + + -- Iteration 2 -- +1 +int(1) + + -- Iteration 3 -- +12345 +int(5) + + -- Iteration 4 -- +-2345 +int(5) + + -- Iteration 5 -- +10.5 +int(4) + + -- Iteration 6 -- +-10.5 +int(5) + + -- Iteration 7 -- +101234567000 +int(12) + + -- Iteration 8 -- +1.07654321E-9 +int(13) + + -- Iteration 9 -- +0.5 +int(3) + + -- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d +Array +int(5) + + -- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +Array +int(5) + + -- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +Array +int(5) + + -- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +Array +int(5) + + -- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +Array +int(5) + + -- Iteration 15 -- + +int(0) + + -- Iteration 16 -- + +int(0) + + -- Iteration 17 -- +1 +int(1) + + -- Iteration 18 -- + +int(0) + + -- Iteration 19 -- +1 +int(1) + + -- Iteration 20 -- + +int(0) + + -- Iteration 21 -- + +int(0) + + -- Iteration 22 -- + +int(0) + + -- Iteration 23 -- +object +int(6) + + -- Iteration 24 -- + +int(0) + + -- Iteration 25 -- + +int(0) + + -- Iteration 26 -- +Resource id #%d +int(%d) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation10.phpt b/ext/standard/tests/strings/vprintf_variation10.phpt new file mode 100644 index 0000000..d63738e Binary files /dev/null and b/ext/standard/tests/strings/vprintf_variation10.phpt differ diff --git a/ext/standard/tests/strings/vprintf_variation11.phpt b/ext/standard/tests/strings/vprintf_variation11.phpt new file mode 100644 index 0000000..f803e96 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation11.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test vprintf() function : usage variations - octal formats with octal values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : octal formats with octal values *** + +-- Iteration 1 -- +0 +int(1) + +-- Iteration 2 -- +37777777777 1 +int(14) + +-- Iteration 3 -- +20000000000 o, 17777777777 20000000001 +int(38) + +-- Iteration 4 -- + 37776543211 0000 +int(38) + +-- Iteration 5 -- +111 2222 37777444445 37733333334 +int(32) + +-- Iteration 6 -- +11073 7653 123 12 +int(17) + +-- Iteration 7 -- +% %o o +int(6) + +-- Iteration 8 -- +1 2 3 4 +int(7) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation11_64bit.phpt b/ext/standard/tests/strings/vprintf_variation11_64bit.phpt new file mode 100644 index 0000000..5f65c5f --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation11_64bit.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test vprintf() function : usage variations - octal formats with octal values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : octal formats with octal values *** + +-- Iteration 1 -- +0 +int(1) + +-- Iteration 2 -- +1777777777777777777777 1 +int(25) + +-- Iteration 3 -- +1777777777760000000000 o, 17777777777 1777777777760000000001 +int(60) + +-- Iteration 4 -- + 1777777777777776543211 0000 +int(49) + +-- Iteration 5 -- +111 2222 1777777777777777444445 1777777777777733333334 +int(54) + +-- Iteration 6 -- +11073 7653 123 12 +int(17) + +-- Iteration 7 -- +% %o o +int(6) + +-- Iteration 8 -- +1 2 3 4 +int(7) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation12.phpt b/ext/standard/tests/strings/vprintf_variation12.phpt new file mode 100644 index 0000000..9993850 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation12.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test vprintf() function : usage variations - octal formats with non-octal values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different octal formats from the above $format array +// and with non-octal values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +===DONE=== +--EXPECT-- +*** Testing vprintf() : octal formats and non-octal values *** + +-- Iteration 1 -- +2 0 12 + 361100 o 37777775456 2322 + + 30071 14 37777777764 37777416700 + 12 361100 2 0 +int(116) + +-- Iteration 2 -- +2 37777777776 2 + 361100 o 37720715133 57062645 + + 57060664 4475347 37721631371 37720717336 + 2 361100 2 37777777776 +int(146) + +-- Iteration 3 -- +0 0 0 + 173 o 37777777605 173 + + 2322 0 $0 _0 + 0 173 0 0 +int(88) + +-- Iteration 4 -- +1 1 1 + 1 o 1 1 + + #1 1 $1 _1 + 1 1 1 1 +int(75) + +-- Iteration 5 -- +1 1 0 + 1 o 0 1 + + #0 1 $1 _0 + 0 1 1 1 +int(75) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation12_64bit.phpt b/ext/standard/tests/strings/vprintf_variation12_64bit.phpt new file mode 100644 index 0000000..32dc01b --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation12_64bit.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test vprintf() function : usage variations - octal formats with non-octal values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different octal formats from the above $format array +// and with non-octal values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +===DONE=== +--EXPECTF-- +*** Testing vprintf() : octal formats and non-octal values *** + +-- Iteration 1 -- +2 0 12 + 361100 o 1777777777777777775456 2322 + + 30071 14 1777777777777777777764 1777777777777777416700 + 12 361100 2 0 +int(149) + +-- Iteration 2 -- +2 1777777777777777777776 2 + 361100 o 1777777777777720715133 57062645 + + 57060664 4475347 1777777777777721631371 1777777777777720717336 + 2 361100 2 1777777777777777777776 +int(201) + +-- Iteration 3 -- +0 0 0 + 173 o 1777777777777777777605 173 + + 2322 0 $0 _0 + 0 173 0 0 +int(99) + +-- Iteration 4 -- +1 1 1 + 1 o 1 1 + + #1 1 $1 _1 + 1 1 1 1 +int(75) + +-- Iteration 5 -- +1 1 0 + 1 o 0 1 + + #0 1 $1 _0 + 0 1 1 1 +int(75) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation13.phpt b/ext/standard/tests/strings/vprintf_variation13.phpt new file mode 100644 index 0000000..6b629c8 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation13.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test vprintf() function : usage variations - hexa formats with hexa values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : hexa formats with hexa values *** + +-- Iteration 1 -- +0 +int(1) + +-- Iteration 2 -- +ffffffff 1 22 +int(13) + +-- Iteration 3 -- +7fffffff x, 7000000 80000000 +int(28) + +-- Iteration 4 -- + ffed2979 0000 +int(35) + +-- Iteration 5 -- +#1 2222 1b6db bbbbbbbc +int(22) + +-- Iteration 6 -- +123b fab 0 a +int(12) + +-- Iteration 7 -- +%34 x +int(5) + +-- Iteration 8 -- +1 2 3 4 +int(7) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation13_64bit.phpt b/ext/standard/tests/strings/vprintf_variation13_64bit.phpt new file mode 100644 index 0000000..8cf768b --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation13_64bit.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test vprintf() function : usage variations - hexa formats with hexa values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : hexa formats with hexa values *** + +-- Iteration 1 -- +0 +int(1) + +-- Iteration 2 -- +ffffffffffffffff 1 22 +int(21) + +-- Iteration 3 -- +7fffffff x, 7000000 ffffffff80000000 +int(36) + +-- Iteration 4 -- + ffffffffffed2979 0000 +int(43) + +-- Iteration 5 -- +#1 2222 1b6db ffffffffbbbbbbbc +int(30) + +-- Iteration 6 -- +123b fab 0 a +int(12) + +-- Iteration 7 -- +%34 x +int(5) + +-- Iteration 8 -- +1 2 3 4 +int(7) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation14.phpt b/ext/standard/tests/strings/vprintf_variation14.phpt new file mode 100644 index 0000000..bbb15e1 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation14.phpt @@ -0,0 +1,126 @@ +--TEST-- +Test vprintf() function : usage variations - hexa formats with non-hexa values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different hexa formats from the above $format array +// and with non-hexa values from the above $args_array array + +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +===DONE=== +--EXPECT-- +*** Testing vprintf() : hexa formats and non-hexa values *** + +-- Iteration 1 -- +2 0 a + 1e240 x fffffb2e 4d2 + + 3039 c fffffff4 fffe1dc0 + a 1e240 2 0 +int(101) + +-- Iteration 2 -- +2 fffffffe 2 + 1e240 x ff439a5b bc65a5 + + bc61b4 127ae7 ff4732f9 ff439ede + 2 1e240 2 fffffffe +int(124) + +-- Iteration 3 -- +0 0 0 + 7b x ffffff85 7b + + 4d2 0 $0 _0 + 0 7b 0 0 +int(82) + +-- Iteration 4 -- +1 1 1 + 1 x 1 1 + + #1 1 $1 _1 + 1 1 1 1 +int(75) + +-- Iteration 5 -- +1 1 0 + 1 x 0 1 + + #0 1 $1 _0 + 0 1 1 1 +int(75) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation14_64bit.phpt b/ext/standard/tests/strings/vprintf_variation14_64bit.phpt new file mode 100644 index 0000000..51b2f47 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation14_64bit.phpt @@ -0,0 +1,126 @@ +--TEST-- +Test vprintf() function : usage variations - hexa formats with non-hexa values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different hexa formats from the above $format array +// and with non-hexa values from the above $args_array array + +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +===DONE=== +--EXPECT-- +*** Testing vprintf() : hexa formats and non-hexa values *** + +-- Iteration 1 -- +2 0 a + 1e240 x fffffffffffffb2e 4d2 + + 3039 c fffffffffffffff4 fffffffffffe1dc0 + a 1e240 2 0 +int(125) + +-- Iteration 2 -- +2 fffffffffffffffe 2 + 1e240 x ffffffffff439a5b bc65a5 + + bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede + 2 1e240 2 fffffffffffffffe +int(164) + +-- Iteration 3 -- +0 0 0 + 7b x ffffffffffffff85 7b + + 4d2 0 $0 _0 + 0 7b 0 0 +int(90) + +-- Iteration 4 -- +1 1 1 + 1 x 1 1 + + #1 1 $1 _1 + 1 1 1 1 +int(75) + +-- Iteration 5 -- +1 1 0 + 1 x 0 1 + + #0 1 $1 _0 + 0 1 1 1 +int(75) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation15.phpt b/ext/standard/tests/strings/vprintf_variation15.phpt new file mode 100644 index 0000000..97b1bc5 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation15.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test vprintf() function : usage variations - unsigned formats with unsigned values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : unsigned formats and unsigned values *** + +-- Iteration 1 -- +1234567 342391 0 +int(16) + +-- Iteration 2 -- +3755744308 u 1234 12345 +int(23) + +-- Iteration 3 -- + 1234000 2450319192 120 +int(25) + +-- Iteration 4 -- +#1 0 $0 10 +int(10) + +-- Iteration 5 -- +1 2 3 4 +int(7) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation15_64bit.phpt b/ext/standard/tests/strings/vprintf_variation15_64bit.phpt new file mode 100644 index 0000000..226f175 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation15_64bit.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test vprintf() function : usage variations - unsigned formats with unsigned values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing vprintf() : unsigned formats and unsigned values *** + +-- Iteration 1 -- +1234567 342391 0 +int(16) + +-- Iteration 2 -- +12345678900 u 1234 12345 +int(24) + +-- Iteration 3 -- + 1234000 0 120 +int(25) + +-- Iteration 4 -- +#1 0 $0 10 +int(10) + +-- Iteration 5 -- +1 2 3 4 +int(7) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation16.phpt b/ext/standard/tests/strings/vprintf_variation16.phpt new file mode 100644 index 0000000..8c3d66d --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation16.phpt @@ -0,0 +1,109 @@ +--TEST-- +Test vprintf() function : usage variations - unsigned formats with signed and other types of values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different unsigned formats from the above $format array +// and with signed and other types of values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} +?> +===DONE=== +--EXPECT-- +*** Testing vprintf() : unsigned formats and signed & other types of values *** + +-- Iteration 1 -- +2 0 10 + 123456 u 1234 2820130816 + 2840207360 1177509888 12345 + 12 4294967284 4294843840 _3 + 10 123456 2 0 +int(115) + +-- Iteration 2 -- +0 0 0 + 123 u 4294967173 123 + 0 0 0 + 1234 0 $0 _0 + 0 123 0 0 +int(88) + +-- Iteration 3 -- +1 1 1 + 1 u 1 1 + 1 1 1 + #1 1 $1 _1 + 1 1 1 1 +int(76) + +-- Iteration 4 -- +1 1 0 + 1 u 0 1 + 1 1 0 + #0 1 $1 _0 + 0 1 1 1 +int(76) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation16_64bit.phpt b/ext/standard/tests/strings/vprintf_variation16_64bit.phpt new file mode 100644 index 0000000..dab90d1 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation16_64bit.phpt @@ -0,0 +1,110 @@ +--TEST-- +Test vprintf() function : usage variations - unsigned formats with signed and other types of values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different unsigned formats from the above $format array +// and with signed and other types of values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +===DONE=== +--EXPECT-- +*** Testing vprintf() : unsigned formats and signed & other types of values *** + +-- Iteration 1 -- +2 0 10 + 123456 u 1234 20000000000 + 2000000000000 22000000000000 12345 + 12 18446744073709551604 18446744073709428160 _3 + 10 123456 2 0 +int(143) + +-- Iteration 2 -- +0 0 0 + 123 u 18446744073709551493 123 + 0 0 0 + 1234 0 $0 _0 + 0 123 0 0 +int(98) + +-- Iteration 3 -- +1 1 1 + 1 u 1 1 + 1 1 1 + #1 1 $1 _1 + 1 1 1 1 +int(76) + +-- Iteration 4 -- +1 1 0 + 1 u 0 1 + 1 1 0 + #0 1 $1 _0 + 0 1 1 1 +int(76) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation17.phpt b/ext/standard/tests/strings/vprintf_variation17.phpt new file mode 100644 index 0000000..e2e8530 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation17.phpt @@ -0,0 +1,71 @@ +--TEST-- +Test vsprintf() function : usage variations - scientific formats with scientific values +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : scientific formats and scientific values *** + +-- Iteration 1 -- +0.000000e+0 +1.000000e+0 1.000000e+3 +int(36) + +-- Iteration 2 -- +2.200000e+2 e 1.000000e+1 1.000000e+10 +int(38) + +-- Iteration 3 -- +-2.2000e+13 1.0000e+21 1.2000e+2 +int(32) + +-- Iteration 4 -- +#########1.000000e+1 1.000000e+2 $$$$$$$$-1.000000e+3 _________1.000000e+2 +int(74) + +-- Iteration 5 -- +1.000000e+3 2.000000e+3 3.000000e+3 4.000000e+3 +int(47) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation18.phpt b/ext/standard/tests/strings/vprintf_variation18.phpt new file mode 100644 index 0000000..8b30ae7 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation18.phpt @@ -0,0 +1,106 @@ +--TEST-- +Test vprintf() function : usage variations - scientific formats with non-scientific values +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different scientific formats from the above $format array +// and with non-scientific values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +===DONE=== +--EXPECT-- +*** Testing vprintf() : scientific formats and non-scientific values *** + +-- Iteration 1 -- +2.200000e+0 +2.000000e-1 1.020000e+1 + 1.234562e+5 e -1.234679e+3 1.234679e+3 + 2.0000e+1 2.1220e+2 -4.110000e+11 2.2120e+3 + 1.234578e+4 1.200000e+1 -1.200000e+1 -1.234562e+5 + 1.020000e+1 1.234562e+5 2.200000e+0 2.000000e-1 +int(232) + +-- Iteration 2 -- +0.000000e+0 +0.000000e+0 0.000000e+0 + 1.230000e+2 e -1.230000e+2 1.230000e+2 + 0.0000e+0 0.0000e+0 1.234560e+5 0.0000e+0 + 1.234000e+3 0.000000e+0 0.000000e+0 0.000000e+0 + 0.000000e+0 1.230000e+2 0.000000e+0 0.000000e+0 +int(228) + +-- Iteration 3 -- +1.000000e+0 +1.000000e+0 1.000000e+0 + 1.000000e+0 e 1.000000e+0 1.000000e+0 + 1.0000e+0 1.0000e+0 1.000000e+0 1.0000e+0 + 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0 + 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0 +int(227) + +-- Iteration 4 -- +1.000000e+0 +1.000000e+0 0.000000e+0 + 1.000000e+0 e 0.000000e+0 1.000000e+0 + 1.0000e+0 0.0000e+0 1.000000e+0 0.0000e+0 + 0.000000e+0 1.000000e+0 1.000000e+0 0.000000e+0 + 0.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0 +int(227) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation19.phpt b/ext/standard/tests/strings/vprintf_variation19.phpt new file mode 100644 index 0000000..a9288a1 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation19.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test vprintf() function : usage variations - with whitespaces in format strings +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : with white spaces in format strings *** + +-- Iteration 1 -- +111 222 333 +int(13) + +-- Iteration 2 -- +1.100000 0.200000 -0.600000 +int(29) + +-- Iteration 3 -- +1.120000 -1.130000 0.230000 +int(29) + +-- Iteration 4 -- +1 10 11 +int(9) + +-- Iteration 5 -- +A B C +int(7) + +-- Iteration 6 -- +2.000000e+1 2.000000e-1 -2.000000e+1 +int(38) + +-- Iteration 7 -- +4294967285 22 33 +int(18) + +-- Iteration 8 -- +12 37777777755 23 +int(19) + +-- Iteration 9 -- +11 ffffffde 33 +int(16) + +-- Iteration 10 -- +11 FFFFFFDE 33 +int(16) + +-- Iteration 11 -- +2.000000E+1 2.000000E-1 -2.000000E+1 +int(38) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation19_64bit.phpt b/ext/standard/tests/strings/vprintf_variation19_64bit.phpt new file mode 100644 index 0000000..d981996 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation19_64bit.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test vprintf() function : usage variations - with whitespaces in format strings +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : with white spaces in format strings *** + +-- Iteration 1 -- +111 222 333 +int(13) + +-- Iteration 2 -- +1.100000 0.200000 -0.600000 +int(29) + +-- Iteration 3 -- +1.120000 -1.130000 0.230000 +int(29) + +-- Iteration 4 -- +1 10 11 +int(9) + +-- Iteration 5 -- +A B C +int(7) + +-- Iteration 6 -- +2.000000e+1 2.000000e-1 -2.000000e+1 +int(38) + +-- Iteration 7 -- +18446744073709551605 22 33 +int(28) + +-- Iteration 8 -- +12 1777777777777777777755 23 +int(30) + +-- Iteration 9 -- +11 ffffffffffffffde 33 +int(24) + +-- Iteration 10 -- +11 FFFFFFFFFFFFFFDE 33 +int(24) + +-- Iteration 11 -- +2.000000E+1 2.000000E-1 -2.000000E+1 +int(38) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation2.phpt b/ext/standard/tests/strings/vprintf_variation2.phpt new file mode 100644 index 0000000..63c3dfe --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation2.phpt @@ -0,0 +1,202 @@ +--TEST-- +Test vprintf() function : usage variations - unexpected values for args argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing vprintf() : with unexpected values for args argument *** + +-- Iteration 1 -- +0 +int(1) + +-- Iteration 2 -- +1 +int(1) + +-- Iteration 3 -- +12345 +int(5) + +-- Iteration 4 -- +-2345 +int(5) + +-- Iteration 5 -- +10.5 +int(4) + +-- Iteration 6 -- +-10.5 +int(5) + +-- Iteration 7 -- +101234567000 +int(12) + +-- Iteration 8 -- +1.07654321E-9 +int(13) + +-- Iteration 9 -- +0.5 +int(3) + +-- Iteration 10 -- + +Warning: vprintf(): Too few arguments in %s on line %d + +bool(false) + +-- Iteration 11 -- + +Warning: vprintf(): Too few arguments in %s on line %d + +bool(false) + +-- Iteration 12 -- +1 +int(1) + +-- Iteration 13 -- + +int(0) + +-- Iteration 14 -- +1 +int(1) + +-- Iteration 15 -- + +int(0) + +-- Iteration 16 -- + +int(0) + +-- Iteration 17 -- + +int(0) + +-- Iteration 18 -- +string +int(6) + +-- Iteration 19 -- +string +int(6) + +-- Iteration 20 -- + +Warning: vprintf(): Too few arguments in %s on line %d + +bool(false) + +-- Iteration 21 -- + +Warning: vprintf(): Too few arguments in %s on line %d + +bool(false) + +-- Iteration 22 -- + +Warning: vprintf(): Too few arguments in %s on line %d + +bool(false) + +-- Iteration 23 -- +Resource id #%d +int(%d) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation3.phpt b/ext/standard/tests/strings/vprintf_variation3.phpt new file mode 100644 index 0000000..41c7648 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation3.phpt @@ -0,0 +1,91 @@ +--TEST-- +Test vprintf() function : usage variations - int formats with int values +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : int formats with int values *** + +-- Iteration 1 -- +0 +int(1) + +-- Iteration 2 -- +-1 1 +int(5) + +-- Iteration 3 -- +2147483647 d, 2147483640 -2147483640 +int(36) + +-- Iteration 4 -- + 123456 12345678 -1234567 1234567 +int(38) + +-- Iteration 5 -- +111 2222 333333 44444444 +int(24) + +-- Iteration 6 -- +4667 4011 83 10 +int(15) + +-- Iteration 7 -- +%-5678 d +int(8) + +-- Iteration 8 -- +1 2 3 4 +int(7) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation4.phpt b/ext/standard/tests/strings/vprintf_variation4.phpt new file mode 100644 index 0000000..8d56fc9 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation4.phpt @@ -0,0 +1,110 @@ +--TEST-- +Test vprintf() function : usage variations - int formats with non-integer values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different int formats from the above $format array +// and with non-int values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +===DONE=== +--EXPECT-- +*** Testing vprintf() : int formats and non-integer values *** + +-- Iteration 1 -- +2 +0 10 + 123456 d -1234 1234 + -1474836480 200000 4000 22000000 + 12345 12 -12 -123456 + 10 123456 2 0 +int(112) + +-- Iteration 2 -- +0 +0 0 + 123 d -123 123 + 0 0 123456 0000 + 1234 0 $0 _0 + 0 123 0 0 +int(92) + +-- Iteration 3 -- +1 +1 1 + 1 d 1 1 + 1 1 1 0001 + #1 1 $1 _1 + 1 1 1 1 +int(81) + +-- Iteration 4 -- +1 +1 0 + 1 d 0 1 + 1 0 1 0000 + #0 1 $1 _0 + 0 1 1 1 +int(81) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation4_64bit.phpt b/ext/standard/tests/strings/vprintf_variation4_64bit.phpt new file mode 100644 index 0000000..f81dba3 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation4_64bit.phpt @@ -0,0 +1,110 @@ +--TEST-- +Test vprintf() function : usage variations - int formats with non-integer values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different int formats from the above $format array +// and with non-int values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +===DONE=== +--EXPECT-- +*** Testing vprintf() : int formats and non-integer values *** + +-- Iteration 1 -- +2 +0 10 + 123456 d -1234 1234 + 20000000000 200000 4000 22000000 + 12345 12 -12 -123456 + 10 123456 2 0 +int(112) + +-- Iteration 2 -- +0 +0 0 + 123 d -123 123 + 0 0 123456 0000 + 1234 0 $0 _0 + 0 123 0 0 +int(92) + +-- Iteration 3 -- +1 +1 1 + 1 d 1 1 + 1 1 1 0001 + #1 1 $1 _1 + 1 1 1 1 +int(81) + +-- Iteration 4 -- +1 +1 0 + 1 d 0 1 + 1 0 1 0000 + #0 1 $1 _0 + 0 1 1 1 +int(81) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation5.phpt b/ext/standard/tests/strings/vprintf_variation5.phpt new file mode 100644 index 0000000..6388f28 --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation5.phpt @@ -0,0 +1,91 @@ +--TEST-- +Test vprintf() function : usage variations - float formats with float values +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vprintf() : int formats with float values *** + +-- Iteration 1 -- +0.000000 +int(8) + +-- Iteration 2 -- +-0.100000 0.100000 10.000001 +int(28) + +-- Iteration 3 -- +2147483649.000000 f, 2147483640.000000 -2147483640.000000 +int(57) + +-- Iteration 4 -- +200000.0000 0.0000 -200000.000000 -0.0000 +int(45) + +-- Iteration 5 -- +20000.000000 -1999999999999999879418332743206357172224.000000 0.000000 20000000000000000000.000000 +int(98) + +-- Iteration 6 -- +4667.000000 4011.000000 83.000000 10.000000 +int(43) + +-- Iteration 7 -- +%-5678.567800 f +int(15) + +-- Iteration 8 -- +1.110000 2.220000 3.330000 4.440000 +int(35) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation6.phpt b/ext/standard/tests/strings/vprintf_variation6.phpt new file mode 100644 index 0000000..265948b --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation6.phpt @@ -0,0 +1,106 @@ +--TEST-- +Test vprintf() function : usage variations - float formats with non-float values +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different float formats from the above $format array +// and with non-float values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +===DONE=== +--EXPECT-- +*** Testing vprintf() : float formats and non-float values *** + +-- Iteration 1 -- +2.000000 -2.000000 2.000000 + 123456.000000 f -12346789.000000 12346789.000000 + 123200.0000 20000.0000 -40000.000000 22212.0000 + 12345780.000000 1211111.000000 -12111111.000000 -12345634.000000 + 2.000000 123456.000000 2.000000 -2.000000 +int(244) + +-- Iteration 2 -- +0.000000 +0.000000 0.000000 + 123.000000 f -123.000000 123.000000 + 0.0000 0.0000 123456.000000 0.0000 + 1234.000000 0.000000 0.000000 0.000000 + 0.000000 123.000000 0.000000 0.000000 +int(196) + +-- Iteration 3 -- +1.000000 +1.000000 1.000000 + 1.000000 f 1.000000 1.000000 + 1.0000 1.0000 1.000000 1.0000 + 1.000000 1.000000 1.000000 1.000000 + 1.000000 1.000000 1.000000 1.000000 +int(179) + +-- Iteration 4 -- +1.000000 +1.000000 0.000000 + 1.000000 f 0.000000 1.000000 + 1.0000 0.0000 1.000000 0.0000 + 0.000000 1.000000 1.000000 0.000000 + 0.000000 1.000000 1.000000 1.000000 +int(179) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation7.phpt b/ext/standard/tests/strings/vprintf_variation7.phpt new file mode 100644 index 0000000..ef2bfec Binary files /dev/null and b/ext/standard/tests/strings/vprintf_variation7.phpt differ diff --git a/ext/standard/tests/strings/vprintf_variation8.phpt b/ext/standard/tests/strings/vprintf_variation8.phpt new file mode 100644 index 0000000..c0558ff --- /dev/null +++ b/ext/standard/tests/strings/vprintf_variation8.phpt @@ -0,0 +1,109 @@ +--TEST-- +Test vprintf() function : usage variations - string formats with non-string values +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different string formats from the above $format array +// and with non-string values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +===DONE=== +--EXPECT-- +*** Testing vprintf() : string formats and non-string values *** + +-- Iteration 1 -- +2.2 0.2 10.2 + 123456.234 s -1234.6789 1234.6789 + 2123 2765 -27654321000 1234 + 12.000000011111 -12.00000111111 -123456.234 3.33 + 10.2 123456.234 2.2 0.2 +int(172) + +-- Iteration 2 -- +2 -2 2 + 123456 s -12346789 12346789 + 1232 2000 -40000 2221 + 12345780 1211111 -12111111 -12345634 + 2 123456 2 -2 +int(132) + +-- Iteration 3 -- +Array Array Array + Array s Array Array + Arra Arra Array Arra + Array Array Array Array + Array Array Array Array +int(131) + +-- Iteration 4 -- +1 1 + 1 s 1 + 1 0001 0000 + #0 1 $1 _0 + 1 1 1 +int(81) +===DONE=== diff --git a/ext/standard/tests/strings/vprintf_variation9.phpt b/ext/standard/tests/strings/vprintf_variation9.phpt new file mode 100644 index 0000000..a7b513f Binary files /dev/null and b/ext/standard/tests/strings/vprintf_variation9.phpt differ diff --git a/ext/standard/tests/strings/vsprintf_basic1.phpt b/ext/standard/tests/strings/vsprintf_basic1.phpt new file mode 100644 index 0000000..6639ac3 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_basic1.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test vsprintf() function : basic functionality - string format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using string format *** +string(3) "one" +string(7) "one two" +string(13) "one two three" +Done diff --git a/ext/standard/tests/strings/vsprintf_basic2.phpt b/ext/standard/tests/strings/vsprintf_basic2.phpt new file mode 100644 index 0000000..3e78aab --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_basic2.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test vsprintf() function : basic functionality - integer format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using integer format *** +string(3) "111" +string(7) "111 222" +string(11) "111 222 333" +Done diff --git a/ext/standard/tests/strings/vsprintf_basic3.phpt b/ext/standard/tests/strings/vsprintf_basic3.phpt new file mode 100644 index 0000000..bbb6a32 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_basic3.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test vsprintf() function : basic functionality - float format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using float format *** +string(9) "11.110000" +string(9) "11.110000" +string(19) "11.110000 22.220000" +string(19) "11.110000 22.220000" +string(29) "11.110000 22.220000 33.330000" +string(29) "11.110000 22.220000 33.330000" +Done diff --git a/ext/standard/tests/strings/vsprintf_basic4.phpt b/ext/standard/tests/strings/vsprintf_basic4.phpt new file mode 100644 index 0000000..a82df93 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_basic4.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test vsprintf() function : basic functionality - bool format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using bool format *** +string(1) "1" +string(3) "1 0" +string(5) "1 0 1" +Done diff --git a/ext/standard/tests/strings/vsprintf_basic5.phpt b/ext/standard/tests/strings/vsprintf_basic5.phpt new file mode 100644 index 0000000..a4a43d0 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_basic5.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test vsprintf() function : basic functionality - char format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using char format *** +string(1) "A" +string(3) "A B" +string(5) "A B C" +Done diff --git a/ext/standard/tests/strings/vsprintf_basic6.phpt b/ext/standard/tests/strings/vsprintf_basic6.phpt new file mode 100644 index 0000000..f6f6ed5 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_basic6.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test vsprintf() function : basic functionality - exponential format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using exponential format *** +string(11) "1.000000e+3" +string(23) "1.000000e+3 2.000000e+3" +string(35) "1.000000e+3 2.000000e+3 3.000000e+3" +Done diff --git a/ext/standard/tests/strings/vsprintf_basic7.phpt b/ext/standard/tests/strings/vsprintf_basic7.phpt new file mode 100644 index 0000000..daf5143 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_basic7.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test vsprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using unsigned format *** +string(10) "4294966185" +string(21) "4294966185 4293732729" +string(32) "4294966185 4293732729 4292621864" +Done diff --git a/ext/standard/tests/strings/vsprintf_basic7_64bit.phpt b/ext/standard/tests/strings/vsprintf_basic7_64bit.phpt new file mode 100644 index 0000000..022919e --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_basic7_64bit.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test vsprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using unsigned format *** +string(20) "18446744073709550505" +string(41) "18446744073709550505 18446744073708317049" +string(62) "18446744073709550505 18446744073708317049 18446744073707206184" +Done diff --git a/ext/standard/tests/strings/vsprintf_basic8.phpt b/ext/standard/tests/strings/vsprintf_basic8.phpt new file mode 100644 index 0000000..59f17b6 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_basic8.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test vsprintf() function : basic functionality - octal format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using octal format *** +string(2) "21" +string(6) "21 347" +string(10) "21 347 567" +Done diff --git a/ext/standard/tests/strings/vsprintf_basic9.phpt b/ext/standard/tests/strings/vsprintf_basic9.phpt new file mode 100644 index 0000000..42012a5 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_basic9.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test vsprintf() function : basic functionality - hexadecimal format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using hexadecimal format *** +string(1) "b" +string(1) "B" +string(4) "b 84" +string(4) "B 84" +string(7) "b 84 b1" +string(7) "B 84 B1" +Done diff --git a/ext/standard/tests/strings/vsprintf_error.phpt b/ext/standard/tests/strings/vsprintf_error.phpt new file mode 100644 index 0000000..8d58147 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_error.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test vsprintf() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : error conditions *** + +-- Testing vsprintf() function with Zero arguments -- + +Warning: vsprintf() expects at least %d parameter, %d given in %s on line %d +bool(false) + +-- Testing vsprintf() function with less than expected no. of arguments -- + +Warning: Wrong parameter count for vsprintf() in %s on line %d +bool(false) + +-- testing vsprintf() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for vsprintf() in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/strings/vsprintf_variation1.phpt b/ext/standard/tests/strings/vsprintf_variation1.phpt new file mode 100644 index 0000000..3911587 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation1.phpt @@ -0,0 +1,191 @@ +--TEST-- +Test vsprintf() function : usage variations - unexpected values for the format argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new sample(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource data + $file_handle +); + +// loop through each element of the array for format + +$counter = 1; +foreach($values as $value) { + echo "\n -- Iteration $counter --\n"; + var_dump( vsprintf($value,$args) ); + $counter++; + +}; + +// closing the resource +fclose($file_handle); + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : with unexpected values for format argument *** + + -- Iteration 1 -- +string(1) "0" + + -- Iteration 2 -- +string(1) "1" + + -- Iteration 3 -- +string(5) "12345" + + -- Iteration 4 -- +string(5) "-2345" + + -- Iteration 5 -- +string(4) "10.5" + + -- Iteration 6 -- +string(5) "-10.5" + + -- Iteration 7 -- +string(12) "101234567000" + + -- Iteration 8 -- +string(13) "1.07654321E-9" + + -- Iteration 9 -- +string(3) "0.5" + + -- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + + -- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + + -- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + + -- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + + -- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + + -- Iteration 15 -- +string(0) "" + + -- Iteration 16 -- +string(0) "" + + -- Iteration 17 -- +string(1) "1" + + -- Iteration 18 -- +string(0) "" + + -- Iteration 19 -- +string(1) "1" + + -- Iteration 20 -- +string(0) "" + + -- Iteration 21 -- +string(0) "" + + -- Iteration 22 -- +string(0) "" + + -- Iteration 23 -- +string(6) "object" + + -- Iteration 24 -- +string(0) "" + + -- Iteration 25 -- +string(0) "" + + -- Iteration 26 -- +string(%d) "Resource id #%d" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation10.phpt b/ext/standard/tests/strings/vsprintf_variation10.phpt new file mode 100644 index 0000000..42ba267 Binary files /dev/null and b/ext/standard/tests/strings/vsprintf_variation10.phpt differ diff --git a/ext/standard/tests/strings/vsprintf_variation11.phpt b/ext/standard/tests/strings/vsprintf_variation11.phpt new file mode 100644 index 0000000..e7fe663 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation11.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test vsprintf() function : usage variations - octal formats with octal values +--SKIPIF-- + +--FILE-- + + +--EXPECTF-- +*** Testing vsprintf() : octal formats with octal values *** + +-- Iteration 1 -- +string(1) "0" + +-- Iteration 2 -- +string(14) "37777777777 1 " + +-- Iteration 3 -- +string(38) "20000000000 o, 17777777777 20000000001" + +-- Iteration 4 -- +string(38) " 37776543211 0000" + +-- Iteration 5 -- +string(32) "111 2222 37777444445 37733333334" + +-- Iteration 6 -- +string(17) "11073 7653 123 12" + +-- Iteration 7 -- +string(6) "% %o o" + +-- Iteration 8 -- +string(7) "1 2 3 4" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation11_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation11_64bit.phpt new file mode 100644 index 0000000..61327c8 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation11_64bit.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test vsprintf() function : usage variations - octal formats with octal values +--SKIPIF-- + +--FILE-- + + +--EXPECTF-- +*** Testing vsprintf() : octal formats with octal values *** + +-- Iteration 1 -- +string(1) "0" + +-- Iteration 2 -- +string(25) "1777777777777777777777 1 " + +-- Iteration 3 -- +string(60) "1777777777760000000000 o, 17777777777 1777777777760000000001" + +-- Iteration 4 -- +string(49) " 1777777777777776543211 0000" + +-- Iteration 5 -- +string(54) "111 2222 1777777777777777444445 1777777777777733333334" + +-- Iteration 6 -- +string(17) "11073 7653 123 12" + +-- Iteration 7 -- +string(6) "% %o o" + +-- Iteration 8 -- +string(7) "1 2 3 4" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation12.phpt b/ext/standard/tests/strings/vsprintf_variation12.phpt new file mode 100644 index 0000000..ab67cc8 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation12.phpt @@ -0,0 +1,118 @@ +--TEST-- +Test vsprintf() function : usage variations - octal formats with non-octal values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different octal formats from the above $format array +// and with non-octal values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : octal formats and non-octal values *** + +-- Iteration 1 -- +string(116) "2 0 12 + 361100 o 37777775456 2322 + + 30071 14 37777777764 37777416700 + 12 361100 2 0" + +-- Iteration 2 -- +string(146) "2 37777777776 2 + 361100 o 37720715133 57062645 + + 57060664 4475347 37721631371 37720717336 + 2 361100 2 37777777776" + +-- Iteration 3 -- +string(88) "0 0 0 + 173 o 37777777605 173 + + 2322 0 $0 _0 + 0 173 0 0" + +-- Iteration 4 -- +string(75) "1 1 1 + 1 o 1 1 + + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 5 -- +string(75) "1 1 0 + 1 o 0 1 + + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt new file mode 100644 index 0000000..530f05b --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt @@ -0,0 +1,118 @@ +--TEST-- +Test vsprintf() function : usage variations - octal formats with non-octal values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different octal formats from the above $format array +// and with non-octal values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : octal formats and non-octal values *** + +-- Iteration 1 -- +string(149) "2 0 12 + 361100 o 1777777777777777775456 2322 + + 30071 14 1777777777777777777764 1777777777777777416700 + 12 361100 2 0" + +-- Iteration 2 -- +string(201) "2 1777777777777777777776 2 + 361100 o 1777777777777720715133 57062645 + + 57060664 4475347 1777777777777721631371 1777777777777720717336 + 2 361100 2 1777777777777777777776" + +-- Iteration 3 -- +string(99) "0 0 0 + 173 o 1777777777777777777605 173 + + 2322 0 $0 _0 + 0 173 0 0" + +-- Iteration 4 -- +string(75) "1 1 1 + 1 o 1 1 + + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 5 -- +string(75) "1 1 0 + 1 o 0 1 + + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation13.phpt b/ext/standard/tests/strings/vsprintf_variation13.phpt new file mode 100644 index 0000000..3e89fa3 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation13.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test vsprintf() function : usage variations - hexa formats with hexa values +--SKIPIF-- + +--FILE-- + + +--EXPECTF-- +*** Testing vsprintf() : hexa formats with hexa values *** + +-- Iteration 1 -- +string(1) "0" + +-- Iteration 2 -- +string(13) "ffffffff 1 22" + +-- Iteration 3 -- +string(28) "7fffffff x, 7000000 80000000" + +-- Iteration 4 -- +string(35) " ffed2979 0000" + +-- Iteration 5 -- +string(22) "#1 2222 1b6db bbbbbbbc" + +-- Iteration 6 -- +string(12) "123b fab 0 a" + +-- Iteration 7 -- +string(5) "%34 x" + +-- Iteration 8 -- +string(7) "1 2 3 4" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation13_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation13_64bit.phpt new file mode 100644 index 0000000..749a4a8 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation13_64bit.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test vsprintf() function : usage variations - hexa formats with hexa values +--SKIPIF-- + +--FILE-- + + +--EXPECTF-- +*** Testing vsprintf() : hexa formats with hexa values *** + +-- Iteration 1 -- +string(1) "0" + +-- Iteration 2 -- +string(21) "ffffffffffffffff 1 22" + +-- Iteration 3 -- +string(36) "7fffffff x, 7000000 ffffffff80000000" + +-- Iteration 4 -- +string(43) " ffffffffffed2979 0000" + +-- Iteration 5 -- +string(30) "#1 2222 1b6db ffffffffbbbbbbbc" + +-- Iteration 6 -- +string(12) "123b fab 0 a" + +-- Iteration 7 -- +string(5) "%34 x" + +-- Iteration 8 -- +string(7) "1 2 3 4" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation14.phpt b/ext/standard/tests/strings/vsprintf_variation14.phpt new file mode 100644 index 0000000..bfe816e --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation14.phpt @@ -0,0 +1,119 @@ +--TEST-- +Test vsprintf() function : usage variations - hexa formats with non-hexa values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different hexa formats from the above $format array +// and with non-hexa values from the above $args_array array + +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : hexa formats and non-hexa values *** + +-- Iteration 1 -- +string(101) "2 0 a + 1e240 x fffffb2e 4d2 + + 3039 c fffffff4 fffe1dc0 + a 1e240 2 0" + +-- Iteration 2 -- +string(124) "2 fffffffe 2 + 1e240 x ff439a5b bc65a5 + + bc61b4 127ae7 ff4732f9 ff439ede + 2 1e240 2 fffffffe" + +-- Iteration 3 -- +string(82) "0 0 0 + 7b x ffffff85 7b + + 4d2 0 $0 _0 + 0 7b 0 0" + +-- Iteration 4 -- +string(75) "1 1 1 + 1 x 1 1 + + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 5 -- +string(75) "1 1 0 + 1 x 0 1 + + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt new file mode 100644 index 0000000..f1940ef --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt @@ -0,0 +1,119 @@ +--TEST-- +Test vsprintf() function : usage variations - hexa formats with non-hexa values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different hexa formats from the above $format array +// and with non-hexa values from the above $args_array array + +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : hexa formats and non-hexa values *** + +-- Iteration 1 -- +string(125) "2 0 a + 1e240 x fffffffffffffb2e 4d2 + + 3039 c fffffffffffffff4 fffffffffffe1dc0 + a 1e240 2 0" + +-- Iteration 2 -- +string(164) "2 fffffffffffffffe 2 + 1e240 x ffffffffff439a5b bc65a5 + + bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede + 2 1e240 2 fffffffffffffffe" + +-- Iteration 3 -- +string(90) "0 0 0 + 7b x ffffffffffffff85 7b + + 4d2 0 $0 _0 + 0 7b 0 0" + +-- Iteration 4 -- +string(75) "1 1 1 + 1 x 1 1 + + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 5 -- +string(75) "1 1 0 + 1 x 0 1 + + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation15.phpt b/ext/standard/tests/strings/vsprintf_variation15.phpt new file mode 100644 index 0000000..bc1d786 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation15.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test vsprintf() function : usage variations - unsigned formats with unsigned values +--SKIPIF-- + +--FILE-- + +===Done=== +--EXPECT-- +*** Testing vsprintf() : unsigned formats and unsigned values *** + +-- Iteration 1 -- +string(16) "1234567 342391 0" + +-- Iteration 2 -- +string(23) "3755744308 u 1234 12345" + +-- Iteration 3 -- +string(25) " 1234000 1012345 120" + +-- Iteration 4 -- +string(10) "#1 0 $0 10" + +-- Iteration 5 -- +string(7) "1 2 3 4" +===Done=== diff --git a/ext/standard/tests/strings/vsprintf_variation15_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation15_64bit.phpt new file mode 100644 index 0000000..3af1738 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation15_64bit.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test vsprintf() function : usage variations - unsigned formats with unsigned values +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : unsigned formats and unsigned values *** + +-- Iteration 1 -- +string(16) "1234567 342391 0" + +-- Iteration 2 -- +string(24) "12345678900 u 1234 12345" + +-- Iteration 3 -- +string(25) " 1234000 0 120" + +-- Iteration 4 -- +string(10) "#1 0 $0 10" + +-- Iteration 5 -- +string(7) "1 2 3 4" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation16.phpt b/ext/standard/tests/strings/vsprintf_variation16.phpt new file mode 100644 index 0000000..01bcc66 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation16.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test vsprintf() function : usage variations - unsigned formats with signed and other types of values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different unsigned formats from the above $format array +// and with signed and other types of values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : unsigned formats and signed & other types of values *** + +-- Iteration 1 -- +string(115) "2 0 10 + 123456 u 1234 2820130816 + 2840207360 1177509888 12345 + 12 4294967284 4294843840 _3 + 10 123456 2 0" + +-- Iteration 2 -- +string(88) "0 0 0 + 123 u 4294967173 123 + 0 0 0 + 1234 0 $0 _0 + 0 123 0 0" + +-- Iteration 3 -- +string(76) "1 1 1 + 1 u 1 1 + 1 1 1 + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 4 -- +string(76) "1 1 0 + 1 u 0 1 + 1 1 0 + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt new file mode 100644 index 0000000..91a69c7 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test vsprintf() function : usage variations - unsigned formats with signed and other types of values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different unsigned formats from the above $format array +// and with signed and other types of values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : unsigned formats and signed & other types of values *** + +-- Iteration 1 -- +string(143) "2 0 10 + 123456 u 1234 20000000000 + 2000000000000 22000000000000 12345 + 12 18446744073709551604 18446744073709428160 _3 + 10 123456 2 0" + +-- Iteration 2 -- +string(98) "0 0 0 + 123 u 18446744073709551493 123 + 0 0 0 + 1234 0 $0 _0 + 0 123 0 0" + +-- Iteration 3 -- +string(76) "1 1 1 + 1 u 1 1 + 1 1 1 + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 4 -- +string(76) "1 1 0 + 1 u 0 1 + 1 1 0 + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation17.phpt b/ext/standard/tests/strings/vsprintf_variation17.phpt new file mode 100644 index 0000000..88cacdd --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation17.phpt @@ -0,0 +1,64 @@ +--TEST-- +Test vsprintf() function : usage variations - scientific formats with scientific values +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : scientific formats and scientific values *** + +-- Iteration 1 -- +string(36) "0.000000e+0 +1.000000e+0 1.000000e+3" + +-- Iteration 2 -- +string(38) "2.200000e+2 e 1.000000e+1 1.000000e+10" + +-- Iteration 3 -- +string(32) "-2.2000e+13 1.0000e+21 1.2000e+2" + +-- Iteration 4 -- +string(74) "#########1.000000e+1 1.000000e+2 $$$$$$$$-1.000000e+3 _________1.000000e+2" + +-- Iteration 5 -- +string(47) "1.000000e+3 2.000000e+3 3.000000e+3 4.000000e+3" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation18.phpt b/ext/standard/tests/strings/vsprintf_variation18.phpt new file mode 100644 index 0000000..3d1aeba --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation18.phpt @@ -0,0 +1,100 @@ +--TEST-- +Test vsprintf() function : usage variations - scientific formats with non-scientific values +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different scientific formats from the above $format array +// and with non-scientific values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : scientific formats and non-scientific values *** + +-- Iteration 1 -- +string(232) "2.200000e+0 +2.000000e-1 1.020000e+1 + 1.234562e+5 e -1.234679e+3 1.234679e+3 + 2.0000e+1 2.1220e+2 -4.110000e+11 2.2120e+3 + 1.234578e+4 1.200000e+1 -1.200000e+1 -1.234562e+5 + 1.020000e+1 1.234562e+5 2.200000e+0 2.000000e-1" + +-- Iteration 2 -- +string(228) "0.000000e+0 +0.000000e+0 0.000000e+0 + 1.230000e+2 e -1.230000e+2 1.230000e+2 + 0.0000e+0 0.0000e+0 1.234560e+5 0.0000e+0 + 1.234000e+3 0.000000e+0 0.000000e+0 0.000000e+0 + 0.000000e+0 1.230000e+2 0.000000e+0 0.000000e+0" + +-- Iteration 3 -- +string(227) "1.000000e+0 +1.000000e+0 1.000000e+0 + 1.000000e+0 e 1.000000e+0 1.000000e+0 + 1.0000e+0 1.0000e+0 1.000000e+0 1.0000e+0 + 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0 + 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0" + +-- Iteration 4 -- +string(227) "1.000000e+0 +1.000000e+0 0.000000e+0 + 1.000000e+0 e 0.000000e+0 1.000000e+0 + 1.0000e+0 0.0000e+0 1.000000e+0 0.0000e+0 + 0.000000e+0 1.000000e+0 1.000000e+0 0.000000e+0 + 0.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation19.phpt b/ext/standard/tests/strings/vsprintf_variation19.phpt new file mode 100644 index 0000000..4ad276a --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation19.phpt @@ -0,0 +1,91 @@ +--TEST-- +Test vsprintf() function : usage variations - with whitespaces in format strings +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : with white spaces in format strings *** + +-- Iteration 1 -- +string(13) "111 222 333" + +-- Iteration 2 -- +string(29) "1.100000 0.200000 -0.600000" + +-- Iteration 3 -- +string(29) "1.120000 -1.130000 0.230000" + +-- Iteration 4 -- +string(9) "1 10 11" + +-- Iteration 5 -- +string(7) "A B C" + +-- Iteration 6 -- +string(38) "2.000000e+1 2.000000e-1 -2.000000e+1" + +-- Iteration 7 -- +string(18) "4294967285 22 33" + +-- Iteration 8 -- +string(19) "12 37777777755 23" + +-- Iteration 9 -- +string(16) "11 ffffffde 33" + +-- Iteration 10 -- +string(16) "11 FFFFFFDE 33" + +-- Iteration 11 -- +string(38) "2.000000E+1 2.000000E-1 -2.000000E+1" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation19_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation19_64bit.phpt new file mode 100644 index 0000000..6e805fe --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation19_64bit.phpt @@ -0,0 +1,91 @@ +--TEST-- +Test vsprintf() function : usage variations - with whitespaces in format strings +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : with white spaces in format strings *** + +-- Iteration 1 -- +string(13) "111 222 333" + +-- Iteration 2 -- +string(29) "1.100000 0.200000 -0.600000" + +-- Iteration 3 -- +string(29) "1.120000 -1.130000 0.230000" + +-- Iteration 4 -- +string(9) "1 10 11" + +-- Iteration 5 -- +string(7) "A B C" + +-- Iteration 6 -- +string(38) "2.000000e+1 2.000000e-1 -2.000000e+1" + +-- Iteration 7 -- +string(28) "18446744073709551605 22 33" + +-- Iteration 8 -- +string(30) "12 1777777777777777777755 23" + +-- Iteration 9 -- +string(24) "11 ffffffffffffffde 33" + +-- Iteration 10 -- +string(24) "11 FFFFFFFFFFFFFFDE 33" + +-- Iteration 11 -- +string(38) "2.000000E+1 2.000000E-1 -2.000000E+1" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation2.phpt b/ext/standard/tests/strings/vsprintf_variation2.phpt new file mode 100644 index 0000000..acf4bea --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation2.phpt @@ -0,0 +1,177 @@ +--TEST-- +Test vsprintf() function : usage variations - unexpected values for args argument +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : with unexpected values for args argument *** + +-- Iteration 1 -- +string(1) "0" + +-- Iteration 2 -- +string(1) "1" + +-- Iteration 3 -- +string(5) "12345" + +-- Iteration 4 -- +string(5) "-2345" + +-- Iteration 5 -- +string(4) "10.5" + +-- Iteration 6 -- +string(5) "-10.5" + +-- Iteration 7 -- +string(12) "101234567000" + +-- Iteration 8 -- +string(13) "1.07654321E-9" + +-- Iteration 9 -- +string(3) "0.5" + +-- Iteration 10 -- + +Warning: vsprintf(): Too few arguments in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: vsprintf(): Too few arguments in %s on line %d +bool(false) + +-- Iteration 12 -- +string(1) "1" + +-- Iteration 13 -- +string(0) "" + +-- Iteration 14 -- +string(1) "1" + +-- Iteration 15 -- +string(0) "" + +-- Iteration 16 -- +string(0) "" + +-- Iteration 17 -- +string(0) "" + +-- Iteration 18 -- +string(6) "string" + +-- Iteration 19 -- +string(6) "string" + +-- Iteration 20 -- + +Warning: vsprintf(): Too few arguments in %s on line %d +bool(false) + +-- Iteration 21 -- + +Warning: vsprintf(): Too few arguments in %s on line %d +bool(false) + +-- Iteration 22 -- + +Warning: vsprintf(): Too few arguments in %s on line %d +bool(false) + +-- Iteration 23 -- +string(%d) "Resource id #%d" +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/vsprintf_variation3.phpt b/ext/standard/tests/strings/vsprintf_variation3.phpt new file mode 100644 index 0000000..fff82c8 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation3.phpt @@ -0,0 +1,82 @@ +--TEST-- +Test vsprintf() function : usage variations - int formats with int values +--FILE-- + + +--EXPECTF-- +*** Testing vsprintf() : int formats with int values *** + +-- Iteration 1 -- +string(1) "0" + +-- Iteration 2 -- +string(5) "-1 1 " + +-- Iteration 3 -- +string(36) "2147483647 d, 2147483640 -2147483640" + +-- Iteration 4 -- +string(38) " 123456 12345678 -1234567 1234567" + +-- Iteration 5 -- +string(24) "111 2222 333333 44444444" + +-- Iteration 6 -- +string(15) "4667 4011 83 10" + +-- Iteration 7 -- +string(8) "%-5678 d" + +-- Iteration 8 -- +string(7) "1 2 3 4" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation4.phpt b/ext/standard/tests/strings/vsprintf_variation4.phpt new file mode 100644 index 0000000..e3e6737 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation4.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test vsprintf() function : usage variations - int formats with non-integer values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different int formats from the above $format array +// and with non-int values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : int formats and non-integer values *** + +-- Iteration 1 -- +string(112) "2 +0 10 + 123456 d -1234 1234 + -1474836480 200000 4000 22000000 + 12345 12 -12 -123456 + 10 123456 2 0" + +-- Iteration 2 -- +string(92) "0 +0 0 + 123 d -123 123 + 0 0 123456 0000 + 1234 0 $0 _0 + 0 123 0 0" + +-- Iteration 3 -- +string(81) "1 +1 1 + 1 d 1 1 + 1 1 1 0001 + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 4 -- +string(81) "1 +1 0 + 1 d 0 1 + 1 0 1 0000 + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation4_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation4_64bit.phpt new file mode 100644 index 0000000..c6b6db5 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation4_64bit.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test vsprintf() function : usage variations - int formats with non-integer values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different int formats from the above $format array +// and with non-int values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : int formats and non-integer values *** + +-- Iteration 1 -- +string(112) "2 +0 10 + 123456 d -1234 1234 + 20000000000 200000 4000 22000000 + 12345 12 -12 -123456 + 10 123456 2 0" + +-- Iteration 2 -- +string(92) "0 +0 0 + 123 d -123 123 + 0 0 123456 0000 + 1234 0 $0 _0 + 0 123 0 0" + +-- Iteration 3 -- +string(81) "1 +1 1 + 1 d 1 1 + 1 1 1 0001 + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 4 -- +string(81) "1 +1 0 + 1 d 0 1 + 1 0 1 0000 + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation5.phpt b/ext/standard/tests/strings/vsprintf_variation5.phpt new file mode 100644 index 0000000..dd356fb --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation5.phpt @@ -0,0 +1,82 @@ +--TEST-- +Test vsprintf() function : usage variations - float formats with float values +--FILE-- + + +--EXPECTF-- +*** Testing vsprintf() : int formats with float values *** + +-- Iteration 1 -- +string(8) "0.000000" + +-- Iteration 2 -- +string(28) "-0.100000 0.100000 10.000001" + +-- Iteration 3 -- +string(57) "2147483649.000000 f, 2147483640.000000 -2147483640.000000" + +-- Iteration 4 -- +string(45) "200000.0000 0.0000 -200000.000000 -0.0000" + +-- Iteration 5 -- +string(98) "20000.000000 -1999999999999999879418332743206357172224.000000 0.000000 20000000000000000000.000000" + +-- Iteration 6 -- +string(43) "4667.000000 4011.000000 83.000000 10.000000" + +-- Iteration 7 -- +string(15) "%-5678.567800 f" + +-- Iteration 8 -- +string(35) "1.110000 2.220000 3.330000 4.440000" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation6.phpt b/ext/standard/tests/strings/vsprintf_variation6.phpt new file mode 100644 index 0000000..00f9467 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation6.phpt @@ -0,0 +1,100 @@ +--TEST-- +Test vsprintf() function : usage variations - float formats with non-float values +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different float formats from the above $format array +// and with non-float values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : float formats and non-float values *** + +-- Iteration 1 -- +string(244) "2.000000 -2.000000 2.000000 + 123456.000000 f -12346789.000000 12346789.000000 + 123200.0000 20000.0000 -40000.000000 22212.0000 + 12345780.000000 1211111.000000 -12111111.000000 -12345634.000000 + 2.000000 123456.000000 2.000000 -2.000000" + +-- Iteration 2 -- +string(196) "0.000000 +0.000000 0.000000 + 123.000000 f -123.000000 123.000000 + 0.0000 0.0000 123456.000000 0.0000 + 1234.000000 0.000000 0.000000 0.000000 + 0.000000 123.000000 0.000000 0.000000" + +-- Iteration 3 -- +string(179) "1.000000 +1.000000 1.000000 + 1.000000 f 1.000000 1.000000 + 1.0000 1.0000 1.000000 1.0000 + 1.000000 1.000000 1.000000 1.000000 + 1.000000 1.000000 1.000000 1.000000" + +-- Iteration 4 -- +string(179) "1.000000 +1.000000 0.000000 + 1.000000 f 0.000000 1.000000 + 1.0000 0.0000 1.000000 0.0000 + 0.000000 1.000000 1.000000 0.000000 + 0.000000 1.000000 1.000000 1.000000" +Done diff --git a/ext/standard/tests/strings/vsprintf_variation7.phpt b/ext/standard/tests/strings/vsprintf_variation7.phpt new file mode 100644 index 0000000..0085138 Binary files /dev/null and b/ext/standard/tests/strings/vsprintf_variation7.phpt differ diff --git a/ext/standard/tests/strings/vsprintf_variation8.phpt b/ext/standard/tests/strings/vsprintf_variation8.phpt new file mode 100644 index 0000000..f44eae2 --- /dev/null +++ b/ext/standard/tests/strings/vsprintf_variation8.phpt @@ -0,0 +1,103 @@ +--TEST-- +Test vsprintf() function : usage variations - string formats with non-string values +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different string formats from the above $format array +// and with non-string values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +?> +===DONE=== +--EXPECT-- +*** Testing vsprintf() : string formats and non-string values *** + +-- Iteration 1 -- +string(174) "2.2 0.2 10.2 + 123456.234 -1234.6789 1234.6789 + 2123 2765 -27654321000 2123 + 12345.78 12.000000011111 -12.00000111111 -123456.234 + 10.2 123456.234 2.2 0.2" + +-- Iteration 2 -- +string(130) "2 -2 2 + 123456 -12346789 12346789 + 1232 2000 -40000 2221 + 12345780 1211111 -12111111 -12345634 + 2 123456 2 -2" + +-- Iteration 3 -- +string(129) "Array Array Array + Array Array Array + Arra Arra Array Arra + Array Array Array Array + Array Array Array Array" + +-- Iteration 4 -- +string(79) "1 1 + 1 1 + 1 0001 0000 + #0 1 $1 _0 + 1 1 1" +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/vsprintf_variation9.phpt b/ext/standard/tests/strings/vsprintf_variation9.phpt new file mode 100644 index 0000000..2d46637 Binary files /dev/null and b/ext/standard/tests/strings/vsprintf_variation9.phpt differ diff --git a/ext/standard/tests/strings/wordwrap.phpt b/ext/standard/tests/strings/wordwrap.phpt new file mode 100644 index 0000000..c1f3b05 --- /dev/null +++ b/ext/standard/tests/strings/wordwrap.phpt @@ -0,0 +1,37 @@ +--TEST-- +wordwrap() function +--FILE-- +\n'; + +// Calling wordwrap() with default arguments +var_dump( wordwrap($str) ); + +// Calling wordwrap() with all possible optional arguments +// with $width arg +var_dump( wordwrap($str, $width) ); +// with $break arg +var_dump( wordwrap($str, $width, $break) ); + +// Calling wordwrap() with all arguments +// $cut as true +$width = 10; +$cut = true; +var_dump( wordwrap($str, $width, $break, $cut) ); + +// $cut as false +$width = 10; +$cut = false; +var_dump( wordwrap($str, $width, $break, $cut) ); +echo "Done\n"; +?> +--EXPECTF-- +*** Testing wordwrap() : basic functionality *** +string(96) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy +doooooooooooooooooooooog." +string(96) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy +doooooooooooooooooooooog." +string(103) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy
\ndoooooooooooooooooooooog." +string(178) "The quick
\nbrown
\nfooooooooo
\nox
\njummmmmmmm
\nmmmmped
\nover the
\nlazzzzzzzz
\nzzzy
\ndooooooooo
\noooooooooo
\nooog." +string(138) "The quick
\nbrown
\nfoooooooooox
\njummmmmmmmmmmmped
\nover the
\nlazzzzzzzzzzzy
\ndoooooooooooooooooooooog." +Done diff --git a/ext/standard/tests/strings/wordwrap_error.phpt b/ext/standard/tests/strings/wordwrap_error.phpt new file mode 100644 index 0000000..98f199a --- /dev/null +++ b/ext/standard/tests/strings/wordwrap_error.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test wordwrap() function : error conditions +--FILE-- +\n'; +$cut = true; +$extra_arg = "extra_arg"; + +var_dump( wordwrap($str, $width, $break, $cut, $extra_arg) ); + +// $width arg as negative value +echo "\n-- Testing wordwrap() function with negative/zero value for width argument --\n"; +echo "-- width = 0 & cut = false --\n"; +// width as zero and cut as false +$width = 0; +$cut = false; +var_dump( wordwrap($str, $width, $break, $cut) ); + +echo "-- width = 0 & cut = true --\n"; +// width as zero and cut as true +$width = 0; +$cut = true; +var_dump( wordwrap($str, $width, $break, $cut) ); + +echo "-- width = -10 & cut = false --\n"; +// width as -ne and cut as false +$width = -10; +$cut = false; +var_dump( wordwrap($str, $width, $break, $cut) ); + +echo "-- width = -10 & cut = true --\n"; +// width as -ne and cut as true +$width = -10; +$cut = true; +var_dump( wordwrap($str, $width, $break, $cut) ); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing wordwrap() : error conditions *** + +-- Testing wordwrap() function with Zero arguments -- + +Warning: wordwrap() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing wordwrap() function with more than expected no. of arguments -- + +Warning: wordwrap() expects at most 4 parameters, 5 given in %s on line %d +NULL + +-- Testing wordwrap() function with negative/zero value for width argument -- +-- width = 0 & cut = false -- +string(39) "testing
\nwordwrap
\nfunction" +-- width = 0 & cut = true -- + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +-- width = -10 & cut = false -- +string(39) "testing
\nwordwrap
\nfunction" +-- width = -10 & cut = true -- +string(223) "
\nt
\ne
\ns
\nt
\ni
\nn
\ng
\n
\nw
\no
\nr
\nd
\nw
\nr
\na
\np
\n
\nf
\nu
\nn
\nc
\nt
\ni
\no
\nn" +Done diff --git a/ext/standard/tests/strings/wordwrap_variation1.phpt b/ext/standard/tests/strings/wordwrap_variation1.phpt new file mode 100644 index 0000000..d13e7de --- /dev/null +++ b/ext/standard/tests/strings/wordwrap_variation1.phpt @@ -0,0 +1,335 @@ +--TEST-- +Test wordwrap() function : usage variations - unexpected values for str argument +--FILE-- +\n'; +$cut = true; + +// resource variable +$fp = fopen(__FILE__, "r"); + +// get an unset variable +$unset_var = 'string_val'; +unset($unset_var); + +// array with different values +$values = array ( + + // integer values + 0, + 1, + 12345, + -2345, + + // float values + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array values + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new stdclass(), + + // Null + NULL, + null, + + // empty string + "", + '', + + // resource variable + $fp, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +// loop though each element of the array and check the working of wordwrap() +// when $str arugment is supplied with different values +echo "\n--- Testing wordwrap() by supplying different values for 'str' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str = $values [$index]; + + var_dump( wordwrap($str) ); + var_dump( wordwrap($str, $width) ); + var_dump( wordwrap($str, $width, $break) ); + + // $cut as false + $cut = false; + var_dump( wordwrap($str, $width, $break, $cut) ); + + // $cut as true + $cut = true; + var_dump( wordwrap($str, $width, $break, $cut) ); + + $counter ++; +} + +// close the resource +fclose($fp); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing wordwrap() : usage variations *** + +--- Testing wordwrap() by supplying different values for 'str' argument --- +-- Iteration 1 -- +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +-- Iteration 2 -- +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +-- Iteration 3 -- +string(5) "12345" +string(5) "12345" +string(5) "12345" +string(5) "12345" +string(13) "123
\n45" +-- Iteration 4 -- +string(5) "-2345" +string(5) "-2345" +string(5) "-2345" +string(5) "-2345" +string(13) "-23
\n45" +-- Iteration 5 -- +string(4) "10.5" +string(4) "10.5" +string(4) "10.5" +string(4) "10.5" +string(12) "10.
\n5" +-- Iteration 6 -- +string(5) "-10.5" +string(5) "-10.5" +string(5) "-10.5" +string(5) "-10.5" +string(13) "-10
\n.5" +-- Iteration 7 -- +string(12) "101234567000" +string(12) "101234567000" +string(12) "101234567000" +string(12) "101234567000" +string(36) "101
\n234
\n567
\n000" +-- Iteration 8 -- +string(13) "1.07654321E-9" +string(13) "1.07654321E-9" +string(13) "1.07654321E-9" +string(13) "1.07654321E-9" +string(45) "1.0
\n765
\n432
\n1E-
\n9" +-- Iteration 9 -- +string(3) "0.5" +string(3) "0.5" +string(3) "0.5" +string(3) "0.5" +string(3) "0.5" +-- Iteration 10 -- + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +-- Iteration 16 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- Iteration 17 -- +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +-- Iteration 18 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- Iteration 19 -- + +Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d +NULL +-- Iteration 20 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- Iteration 21 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- Iteration 22 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- Iteration 23 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- Iteration 24 -- + +Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 25 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- Iteration 26 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/wordwrap_variation2.phpt b/ext/standard/tests/strings/wordwrap_variation2.phpt new file mode 100644 index 0000000..2718791 --- /dev/null +++ b/ext/standard/tests/strings/wordwrap_variation2.phpt @@ -0,0 +1,340 @@ +--TEST-- +Test wordwrap() function : usage variations - unexpected values for width argument +--FILE-- +\n'; +$cut = true; + +// resource var +$fp = fopen(__FILE__, "r"); + +// get an unset variable +$unset_var = 10; +unset($unset_var); + + +// array with different values as width +$values = array ( + // zerovalue for width + 0, + + // -ve value for width + -1, + -10, + + // array values + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // string values + "string", + 'string', + + // objects + new stdclass(), + + // Null value + NULL, + null, + + // empty string + "", + '', + + // resource variable + $fp, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop though each element of the array and check the working of wordwrap() +// when $width arugment is supplied with different values +echo "\n--- Testing wordwrap() by supplying different values for 'width' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $width = $values [$index]; + + var_dump( wordwrap($str, $width) ); + var_dump( wordwrap($str, $width, $break) ); + + // cut as false + $cut = false; + var_dump( wordwrap($str, $width, $break, $cut) ); + + // cut as true + $cut = true; + var_dump( wordwrap($str, $width, $break, $cut) ); + + $counter ++; +} + +// close the resource +fclose($fp); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing wordwrap() : usage variations *** + +--- Testing wordwrap() by supplying different values for 'width' argument --- +-- Iteration 1 -- +string(25) "testing +wordwrap +function" +string(39) "testing
\nwordwrap
\nfunction" +string(39) "testing
\nwordwrap
\nfunction" + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +-- Iteration 2 -- +string(25) "testing +wordwrap +function" +string(39) "testing
\nwordwrap
\nfunction" +string(39) "testing
\nwordwrap
\nfunction" +string(223) "
\nt
\ne
\ns
\nt
\ni
\nn
\ng
\n
\nw
\no
\nr
\nd
\nw
\nr
\na
\np
\n
\nf
\nu
\nn
\nc
\nt
\ni
\no
\nn" +-- Iteration 3 -- +string(25) "testing +wordwrap +function" +string(39) "testing
\nwordwrap
\nfunction" +string(39) "testing
\nwordwrap
\nfunction" +string(223) "
\nt
\ne
\ns
\nt
\ni
\nn
\ng
\n
\nw
\no
\nr
\nd
\nw
\nr
\na
\np
\n
\nf
\nu
\nn
\nc
\nt
\ni
\no
\nn" +-- Iteration 4 -- + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 9 -- +string(25) "testing +wordwrap +function" +string(39) "testing
\nwordwrap
\nfunction" +string(39) "testing
\nwordwrap
\nfunction" +string(199) "t
\ne
\ns
\nt
\ni
\nn
\ng
\nw
\no
\nr
\nd
\nw
\nr
\na
\np
\nf
\nu
\nn
\nc
\nt
\ni
\no
\nn" +-- Iteration 10 -- +string(25) "testing +wordwrap +function" +string(39) "testing
\nwordwrap
\nfunction" +string(39) "testing
\nwordwrap
\nfunction" + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +-- Iteration 11 -- +string(25) "testing +wordwrap +function" +string(39) "testing
\nwordwrap
\nfunction" +string(39) "testing
\nwordwrap
\nfunction" +string(199) "t
\ne
\ns
\nt
\ni
\nn
\ng
\nw
\no
\nr
\nd
\nw
\nr
\na
\np
\nf
\nu
\nn
\nc
\nt
\ni
\no
\nn" +-- Iteration 12 -- +string(25) "testing +wordwrap +function" +string(39) "testing
\nwordwrap
\nfunction" +string(39) "testing
\nwordwrap
\nfunction" + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d +NULL +-- Iteration 16 -- +string(25) "testing +wordwrap +function" +string(39) "testing
\nwordwrap
\nfunction" +string(39) "testing
\nwordwrap
\nfunction" + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +-- Iteration 17 -- +string(25) "testing +wordwrap +function" +string(39) "testing
\nwordwrap
\nfunction" +string(39) "testing
\nwordwrap
\nfunction" + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +-- Iteration 18 -- + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d +NULL +-- Iteration 21 -- +string(25) "testing +wordwrap +function" +string(39) "testing
\nwordwrap
\nfunction" +string(39) "testing
\nwordwrap
\nfunction" + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +-- Iteration 22 -- +string(25) "testing +wordwrap +function" +string(39) "testing
\nwordwrap
\nfunction" +string(39) "testing
\nwordwrap
\nfunction" + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/strings/wordwrap_variation3.phpt b/ext/standard/tests/strings/wordwrap_variation3.phpt new file mode 100644 index 0000000..7d0c816 --- /dev/null +++ b/ext/standard/tests/strings/wordwrap_variation3.phpt @@ -0,0 +1,301 @@ +--TEST-- +Test wordwrap() function : usage variations - unexptected values for break argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new stdclass(), + + // empty string + "", + '', + + //Null + NULL, + null, + + // resource var + $fp, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +// loop though each element of the array and check the working of wordwrap() +// when $break arugment is supplied with different values +echo "\n--- Testing wordwrap() by supplying different values for 'break' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $break = $values [$index]; + + var_dump( wordwrap($str, $width, $break) ); + + // $cut as false + $cut = false; + var_dump( wordwrap($str, $width, $break, $cut) ); + + // $cut as true + $cut = true; + var_dump( wordwrap($str, $width, $break, $cut) ); + + $counter ++; +} + +// close the resource used +fclose($fp); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing wordwrap() : usage variations *** + +--- Testing wordwrap() by supplying different values for 'break' argument --- +-- Iteration 1 -- +string(25) "testing0wordwrap0function" +string(25) "testing0wordwrap0function" +string(25) "testing0wordwrap0function" +-- Iteration 2 -- +string(25) "testing1wordwrap1function" +string(25) "testing1wordwrap1function" +string(25) "testing1wordwrap1function" +-- Iteration 3 -- +string(33) "testing12345wordwrap12345function" +string(33) "testing12345wordwrap12345function" +string(33) "testing12345wordwrap12345function" +-- Iteration 4 -- +string(33) "testing-2345wordwrap-2345function" +string(33) "testing-2345wordwrap-2345function" +string(33) "testing-2345wordwrap-2345function" +-- Iteration 5 -- +string(31) "testing10.5wordwrap10.5function" +string(31) "testing10.5wordwrap10.5function" +string(31) "testing10.5wordwrap10.5function" +-- Iteration 6 -- +string(33) "testing-10.5wordwrap-10.5function" +string(33) "testing-10.5wordwrap-10.5function" +string(33) "testing-10.5wordwrap-10.5function" +-- Iteration 7 -- +string(47) "testing101234567000wordwrap101234567000function" +string(47) "testing101234567000wordwrap101234567000function" +string(47) "testing101234567000wordwrap101234567000function" +-- Iteration 8 -- +string(49) "testing1.07654321E-9wordwrap1.07654321E-9function" +string(49) "testing1.07654321E-9wordwrap1.07654321E-9function" +string(49) "testing1.07654321E-9wordwrap1.07654321E-9function" +-- Iteration 9 -- +string(29) "testing0.5wordwrap0.5function" +string(29) "testing0.5wordwrap0.5function" +string(29) "testing0.5wordwrap0.5function" +-- Iteration 10 -- + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +string(25) "testing1wordwrap1function" +string(25) "testing1wordwrap1function" +string(25) "testing1wordwrap1function" +-- Iteration 16 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +-- Iteration 17 -- +string(25) "testing1wordwrap1function" +string(25) "testing1wordwrap1function" +string(25) "testing1wordwrap1function" +-- Iteration 18 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +-- Iteration 19 -- + +Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +-- Iteration 21 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +-- Iteration 22 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +-- Iteration 23 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +-- Iteration 24 -- + +Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d +NULL +-- Iteration 25 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +-- Iteration 26 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/strings/wordwrap_variation4.phpt b/ext/standard/tests/strings/wordwrap_variation4.phpt new file mode 100644 index 0000000..440e937 --- /dev/null +++ b/ext/standard/tests/strings/wordwrap_variation4.phpt @@ -0,0 +1,144 @@ +--TEST-- +Test wordwrap() function : usage variations - unexptected value for cut argument +--FILE-- +\n'; + +// get an unset variable +$unset_var = true; +unset($unset_var); + +// resource variable +$fp = fopen(__FILE__, "r"); + +// array with different values +$values = array ( + + // integer values + 0, + 1, + 12345, + -2345, + + // float values + 10.5, + -10.5, + 10.5e10, + 10.6E-10, + .5, + + // array values + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // string values + "string", + 'string', + + // objects + new stdclass(), + + // empty string + "", + '', + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +// loop though each element of the array and check the working of wordwrap() +// when $cut arugment is supplied with different values +echo "\n--- Testing wordwrap() by supplying different values for 'cut' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $cut = $values [$index]; + + var_dump( wordwrap($str, $width, $break, $cut) ); + + $counter ++; +} + +// close the resource +fclose($fp); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing wordwrap() : usage variations *** + +--- Testing wordwrap() by supplying different values for 'cut' argument --- +-- Iteration 1 -- +string(39) "testing
\nwordwrap
\nfunction" +-- Iteration 2 -- +string(39) "testing
\nwordwrap
\nfunction" +-- Iteration 3 -- +string(39) "testing
\nwordwrap
\nfunction" +-- Iteration 4 -- +string(39) "testing
\nwordwrap
\nfunction" +-- Iteration 5 -- +string(39) "testing
\nwordwrap
\nfunction" +-- Iteration 6 -- +string(39) "testing
\nwordwrap
\nfunction" +-- Iteration 7 -- +string(39) "testing
\nwordwrap
\nfunction" +-- Iteration 8 -- +string(39) "testing
\nwordwrap
\nfunction" +-- Iteration 9 -- +string(39) "testing
\nwordwrap
\nfunction" +-- Iteration 10 -- + +Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d +NULL +-- Iteration 15 -- +string(39) "testing
\nwordwrap
\nfunction" +-- Iteration 16 -- +string(39) "testing
\nwordwrap
\nfunction" +-- Iteration 17 -- + +Warning: wordwrap() expects parameter 4 to be boolean, object given in %s on line %d +NULL +-- Iteration 18 -- +string(39) "testing
\nwordwrap
\nfunction" +-- Iteration 19 -- +string(39) "testing
\nwordwrap
\nfunction" +-- Iteration 20 -- +string(39) "testing
\nwordwrap
\nfunction" +-- Iteration 21 -- +string(39) "testing
\nwordwrap
\nfunction" +Done diff --git a/ext/standard/tests/strings/wordwrap_variation5.phpt b/ext/standard/tests/strings/wordwrap_variation5.phpt new file mode 100644 index 0000000..b0911a8 --- /dev/null +++ b/ext/standard/tests/strings/wordwrap_variation5.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test wordwrap() function : usage variations - valid break arguments(spaces) +--FILE-- + +--EXPECTF-- +*** Testing wordwrap() : usage variations *** + +-- Testing wordwrap() with default break value and single space as value -- +-- with default break and cut value -- +string(24) "Testing +wordrap +function" +-- with default cut value -- +string(24) "Testing wordrap function" +string(26) "Testing wordrap function" +-- with cut value as false -- +string(24) "Testing wordrap function" +string(26) "Testing wordrap function" +-- with cut value as true -- +string(43) "T e s t i n g w o r d r a p f u n c t i o n" +string(64) "T e s t i n g w o r d r a p f u n c t i o n" +Done diff --git a/ext/standard/tests/time/001.phpt b/ext/standard/tests/time/001.phpt new file mode 100644 index 0000000..3b0ed8a --- /dev/null +++ b/ext/standard/tests/time/001.phpt @@ -0,0 +1,34 @@ +--TEST-- +microtime() function +--SKIPIF-- + +--FILE-- + $last_t || ($time == $last_t && $micro >= $last_m)) { + $passed++; + } else if ($failed++ <=10) { + $result .= sprintf('%06d', $i).": $time $micro < $last_t $last_m\n"; + } + $last_m = $micro; + $last_t = $time; +} +echo "Passed: $passed\n"; +echo "Failed: $failed\n"; +echo $result; +?> +--EXPECT-- +Passed: 100000 +Failed: 0 diff --git a/ext/standard/tests/time/bug38524.phpt b/ext/standard/tests/time/bug38524.phpt new file mode 100644 index 0000000..77d0f4f --- /dev/null +++ b/ext/standard/tests/time/bug38524.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #38524 (strptime() does not initialize the internal date storage structure) +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +array(9) { + ["tm_sec"]=> + int(0) + ["tm_min"]=> + int(0) + ["tm_hour"]=> + int(0) + ["tm_mday"]=> + int(20) + ["tm_mon"]=> + int(7) + ["tm_year"]=> + int(106) + ["tm_wday"]=> + int(0) + ["tm_yday"]=> + int(%d) + ["unparsed"]=> + string(0) "" +} +===DONE=== diff --git a/ext/standard/tests/time/bug60222.phpt b/ext/standard/tests/time/bug60222.phpt new file mode 100644 index 0000000..8053a81 --- /dev/null +++ b/ext/standard/tests/time/bug60222.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #60222 (time_nanosleep() does validate input params) +--FILE-- + +===DONE=== +--EXPECTF-- +Warning: time_nanosleep(): The seconds value must be greater than 0 in %s on line %d +bool(false) + +Warning: time_nanosleep(): The nanoseconds value must be greater than 0 in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/time/idate.phpt b/ext/standard/tests/time/idate.phpt new file mode 100644 index 0000000..0b54405 --- /dev/null +++ b/ext/standard/tests/time/idate.phpt @@ -0,0 +1,31 @@ +--TEST-- +idate() function +--FILE-- + +--EXPECT-- +U: 1043324459 +Y: 2003 +z: 22 +y: 3 +m: 1 +n: 1 +d: 23 +j: 23 +H: 12 +G: 12 +h: 12 +g: 12 +i: 20 +s: 59 +t: 31 +w: 4 +L: 0 +B: 556 +I: 0 +W: 4 diff --git a/ext/standard/tests/time/strptime_basic.phpt b/ext/standard/tests/time/strptime_basic.phpt new file mode 100644 index 0000000..194a78f --- /dev/null +++ b/ext/standard/tests/time/strptime_basic.phpt @@ -0,0 +1,100 @@ +--TEST-- +Test strptime() function : basic functionality +--SKIPIF-- + + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strptime() : basic functionality *** +array(9) { + ["tm_sec"]=> + int(0) + ["tm_min"]=> + int(0) + ["tm_hour"]=> + int(10) + ["tm_mday"]=> + int(2) + ["tm_mon"]=> + int(6) + ["tm_year"]=> + int(63) + ["tm_wday"]=> + int(2) + ["tm_yday"]=> + int(182) + ["unparsed"]=> + string(3) "GMT" +} +array(9) { + ["tm_sec"]=> + int(0) + ["tm_min"]=> + int(0) + ["tm_hour"]=> + int(10) + ["tm_mday"]=> + int(2) + ["tm_mon"]=> + int(6) + ["tm_year"]=> + int(163) + ["tm_wday"]=> + int(1) + ["tm_yday"]=> + int(182) + ["unparsed"]=> + string(0) "" +} +array(9) { + ["tm_sec"]=> + int(0) + ["tm_min"]=> + int(0) + ["tm_hour"]=> + int(10) + ["tm_mday"]=> + int(2) + ["tm_mon"]=> + int(6) + ["tm_year"]=> + int(0) + ["tm_wday"]=> + int(2) + ["tm_yday"]=> + int(182) + ["unparsed"]=> + string(0) "" +} +===DONE=== diff --git a/ext/standard/tests/time/strptime_error.phpt b/ext/standard/tests/time/strptime_error.phpt new file mode 100644 index 0000000..92c7ca3 --- /dev/null +++ b/ext/standard/tests/time/strptime_error.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test localtime() function : error conditions +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strptime() : error conditions *** + +-- Testing strptime() function with Zero arguments -- + +Warning: strptime() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +-- Testing strptime() function with less than expected no. of arguments -- + +Warning: strptime() expects exactly 2 parameters, 1 given in %s on line %d +NULL + +-- Testing strptime() function with more than expected no. of arguments -- + +Warning: strptime() expects exactly 2 parameters, 3 given in %s on line %d +NULL +===DONE=== + diff --git a/ext/standard/tests/time/strptime_parts.phpt b/ext/standard/tests/time/strptime_parts.phpt new file mode 100644 index 0000000..fbe684b --- /dev/null +++ b/ext/standard/tests/time/strptime_parts.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test strptime() function : basic functionality +--SKIPIF-- + + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing strptime() : basic functionality *** +int(20) +int(1) +int(10) +int(2) +int(6) +int(63) +int(20) +int(1) +int(10) +int(2) +int(6) +int(163) +int(0) +int(1) +int(10) +int(2) +int(6) +int(0) +===DONE=== diff --git a/ext/standard/tests/url/base64_decode_basic_001.phpt b/ext/standard/tests/url/base64_decode_basic_001.phpt new file mode 100644 index 0000000..7aba807 --- /dev/null +++ b/ext/standard/tests/url/base64_decode_basic_001.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test base64_decode() function : basic functionality - ensure all base64 alphabet is supported. +--FILE-- + +--EXPECTF-- +Decode an input string containing the whole base64 alphabet: +string(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf" +string(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf" +string(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf" +Done \ No newline at end of file diff --git a/ext/standard/tests/url/base64_decode_basic_002.phpt b/ext/standard/tests/url/base64_decode_basic_002.phpt new file mode 100644 index 0000000..1289894 --- /dev/null +++ b/ext/standard/tests/url/base64_decode_basic_002.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test base64_decode() function : basic functionality - strict vs non-strict with non-base64 chars. +--FILE-- + +--EXPECTF-- +Decode 'hello world!': +string(12) "hello world!" +string(12) "hello world!" +string(12) "hello world!" + +Whitespace does not affect base64_decode, even with $strict===true: +string(12) "hello world!" +string(12) "hello world!" +string(12) "hello world!" + +Other chars outside the base64 alphabet are ignored when $strict===false, but cause failure with $strict===true: +string(12) "hello world!" +string(12) "hello world!" +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/base64_decode_error_001.phpt b/ext/standard/tests/url/base64_decode_error_001.phpt new file mode 100644 index 0000000..2725164 --- /dev/null +++ b/ext/standard/tests/url/base64_decode_error_001.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test base64_decode() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing base64_decode() : error conditions *** + +-- Testing base64_decode() function with Zero arguments -- + +Warning: base64_decode() expects at least 1 parameter, 0 given in %s on line 12 +NULL + +-- Testing base64_decode() function with more than expected no. of arguments -- + +Warning: base64_decode() expects at most 2 parameters, 3 given in %s on line 19 +NULL +Done diff --git a/ext/standard/tests/url/base64_decode_variation_001.phpt b/ext/standard/tests/url/base64_decode_variation_001.phpt new file mode 100644 index 0000000..8734a96 --- /dev/null +++ b/ext/standard/tests/url/base64_decode_variation_001.phpt @@ -0,0 +1,181 @@ +--TEST-- +Test base64_decode() function : usage variations - unexpected types for arg 1 +--FILE-- + 0, + "1" => 1, + "12345" => 12345, + "-2345" => -2345, + + // float data + "10.5" => 10.5, + "-10.5" => -10.5, + "10.1234567e10" => 10.1234567e10, + "10.7654321E-10" => 10.7654321E-10, + ".5" => .5, + + // array data + "array()" => array(), + "array(0)" => array(0), + "array(1)" => array(1), + "array(1, 2)" => array(1, 2), + "array('color' => 'red', 'item' => 'pen'" => array('color' => 'red', 'item' => 'pen'), + + // null data + "NULL" => NULL, + "null" => null, + + // boolean data + "true" => true, + "false" => false, + "TRUE" => TRUE, + "FALSE" => FALSE, + + // empty data + "\"\"" => "", + "''" => '', + + // object data + "stdClass object" => new stdclass(), + + // undefined data + "undefined variable" => $undefined_var, + + // unset data + "unset variable" => $unset_var, + + // resource data + "resource" => $file_handle +); + +// loop through each element of the array for str argument + +foreach($values as $key=>$value) { + echo "\n-- Arg value $key --\n"; + $output = base64_decode($value, $strict); + + if (is_string($output)) { + var_dump(bin2hex($output)); + } else { + var_dump($output); + } +}; + +?> +===Done=== +--EXPECTF-- +*** Testing base64_decode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(%d) +Error: 8 - Undefined variable: unset_var, %s(%d) + +-- Arg value 0 -- +string(0) "" + +-- Arg value 1 -- +string(0) "" + +-- Arg value 12345 -- +string(6) "d76df8" + +-- Arg value -2345 -- +bool(false) + +-- Arg value 10.5 -- +bool(false) + +-- Arg value -10.5 -- +bool(false) + +-- Arg value 10.1234567e10 -- +string(18) "d74d76df8e7aef4d34" + +-- Arg value 10.7654321E-10 -- +bool(false) + +-- Arg value .5 -- +bool(false) + +-- Arg value array() -- +Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(%d) +NULL + +-- Arg value array(0) -- +Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(%d) +NULL + +-- Arg value array(1) -- +Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(%d) +NULL + +-- Arg value array(1, 2) -- +Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(%d) +NULL + +-- Arg value array('color' => 'red', 'item' => 'pen' -- +Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(%d) +NULL + +-- Arg value NULL -- +string(0) "" + +-- Arg value null -- +string(0) "" + +-- Arg value true -- +string(0) "" + +-- Arg value false -- +string(0) "" + +-- Arg value TRUE -- +string(0) "" + +-- Arg value FALSE -- +string(0) "" + +-- Arg value "" -- +string(0) "" + +-- Arg value '' -- +string(0) "" + +-- Arg value stdClass object -- +Error: 2 - base64_decode() expects parameter 1 to be string, object given, %s(%d) +NULL + +-- Arg value undefined variable -- +string(0) "" + +-- Arg value unset variable -- +string(0) "" + +-- Arg value resource -- +Error: 2 - base64_decode() expects parameter 1 to be string, resource given, %s(%d) +NULL +===Done=== \ No newline at end of file diff --git a/ext/standard/tests/url/base64_decode_variation_002.phpt b/ext/standard/tests/url/base64_decode_variation_002.phpt new file mode 100644 index 0000000..20bf357 --- /dev/null +++ b/ext/standard/tests/url/base64_decode_variation_002.phpt @@ -0,0 +1,175 @@ +--TEST-- +Test base64_decode() function : usage variations - unexpected types for arg 2 +--FILE-- + 0, + "1" => 1, + "12345" => 12345, + "-2345" => -2345, + + // float data + "10.5" => 10.5, + "-10.5" => -10.5, + "10.1234567e10" => 10.1234567e10, + "10.7654321E-10" => 10.7654321E-10, + ".5" => .5, + + // array data + "array()" => array(), + "array(0)" => array(0), + "array(1)" => array(1), + "array(1, 2)" => array(1, 2), + "array('color' => 'red', 'item' => 'pen'" => array('color' => 'red', 'item' => 'pen'), + + // null data + "NULL" => NULL, + "null" => null, + + // boolean data + "true" => true, + "false" => false, + "TRUE" => TRUE, + "FALSE" => FALSE, + + // empty data + "\"\"" => "", + "''" => '', + + // object data + "stdClass object" => new stdclass(), + + // undefined data + "undefined variable" => $undefined_var, + + // unset data + "unset variable" => $unset_var, + + // resource data + "resource" => $file_handle +); + +// loop through each element of the array for strict argument + +foreach($values as $key=>$value) { + echo "\n-- Arg value $key --\n"; + var_dump(base64_decode($str, $value)); +}; + +?> +===Done=== +--EXPECTF-- +*** Testing base64_decode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(%d) +Error: 8 - Undefined variable: unset_var, %s(%d) + +-- Arg value 0 -- +string(12) "hello world!" + +-- Arg value 1 -- +bool(false) + +-- Arg value 12345 -- +bool(false) + +-- Arg value -2345 -- +bool(false) + +-- Arg value 10.5 -- +bool(false) + +-- Arg value -10.5 -- +bool(false) + +-- Arg value 10.1234567e10 -- +bool(false) + +-- Arg value 10.7654321E-10 -- +bool(false) + +-- Arg value .5 -- +bool(false) + +-- Arg value array() -- +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(%d) +NULL + +-- Arg value array(0) -- +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(%d) +NULL + +-- Arg value array(1) -- +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(%d) +NULL + +-- Arg value array(1, 2) -- +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(%d) +NULL + +-- Arg value array('color' => 'red', 'item' => 'pen' -- +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(%d) +NULL + +-- Arg value NULL -- +string(12) "hello world!" + +-- Arg value null -- +string(12) "hello world!" + +-- Arg value true -- +bool(false) + +-- Arg value false -- +string(12) "hello world!" + +-- Arg value TRUE -- +bool(false) + +-- Arg value FALSE -- +string(12) "hello world!" + +-- Arg value "" -- +string(12) "hello world!" + +-- Arg value '' -- +string(12) "hello world!" + +-- Arg value stdClass object -- +Error: 2 - base64_decode() expects parameter 2 to be boolean, object given, %s(%d) +NULL + +-- Arg value undefined variable -- +string(12) "hello world!" + +-- Arg value unset variable -- +string(12) "hello world!" + +-- Arg value resource -- +Error: 2 - base64_decode() expects parameter 2 to be boolean, resource given, %s(%d) +NULL +===Done=== \ No newline at end of file diff --git a/ext/standard/tests/url/base64_encode_basic_001.phpt b/ext/standard/tests/url/base64_encode_basic_001.phpt new file mode 100644 index 0000000..6ab57f4 --- /dev/null +++ b/ext/standard/tests/url/base64_encode_basic_001.phpt @@ -0,0 +1,283 @@ +--TEST-- +Test base64_encode() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing base64_encode() : basic functionality *** +0x0: AA== +0x1: AQ== +0x2: Ag== +0x3: Aw== +0x4: BA== +0x5: BQ== +0x6: Bg== +0x7: Bw== +0x8: CA== +0x9: CQ== +0xA: Cg== +0xB: Cw== +0xC: DA== +0xD: DQ== +0xE: Dg== +0xF: Dw== +0x10: EA== +0x11: EQ== +0x12: Eg== +0x13: Ew== +0x14: FA== +0x15: FQ== +0x16: Fg== +0x17: Fw== +0x18: GA== +0x19: GQ== +0x1A: Gg== +0x1B: Gw== +0x1C: HA== +0x1D: HQ== +0x1E: Hg== +0x1F: Hw== +0x20: IA== +0x21: IQ== +0x22: Ig== +0x23: Iw== +0x24: JA== +0x25: JQ== +0x26: Jg== +0x27: Jw== +0x28: KA== +0x29: KQ== +0x2A: Kg== +0x2B: Kw== +0x2C: LA== +0x2D: LQ== +0x2E: Lg== +0x2F: Lw== +0x30: MA== +0x31: MQ== +0x32: Mg== +0x33: Mw== +0x34: NA== +0x35: NQ== +0x36: Ng== +0x37: Nw== +0x38: OA== +0x39: OQ== +0x3A: Og== +0x3B: Ow== +0x3C: PA== +0x3D: PQ== +0x3E: Pg== +0x3F: Pw== +0x40: QA== +0x41: QQ== +0x42: Qg== +0x43: Qw== +0x44: RA== +0x45: RQ== +0x46: Rg== +0x47: Rw== +0x48: SA== +0x49: SQ== +0x4A: Sg== +0x4B: Sw== +0x4C: TA== +0x4D: TQ== +0x4E: Tg== +0x4F: Tw== +0x50: UA== +0x51: UQ== +0x52: Ug== +0x53: Uw== +0x54: VA== +0x55: VQ== +0x56: Vg== +0x57: Vw== +0x58: WA== +0x59: WQ== +0x5A: Wg== +0x5B: Ww== +0x5C: XA== +0x5D: XQ== +0x5E: Xg== +0x5F: Xw== +0x60: YA== +0x61: YQ== +0x62: Yg== +0x63: Yw== +0x64: ZA== +0x65: ZQ== +0x66: Zg== +0x67: Zw== +0x68: aA== +0x69: aQ== +0x6A: ag== +0x6B: aw== +0x6C: bA== +0x6D: bQ== +0x6E: bg== +0x6F: bw== +0x70: cA== +0x71: cQ== +0x72: cg== +0x73: cw== +0x74: dA== +0x75: dQ== +0x76: dg== +0x77: dw== +0x78: eA== +0x79: eQ== +0x7A: eg== +0x7B: ew== +0x7C: fA== +0x7D: fQ== +0x7E: fg== +0x7F: fw== +0x80: gA== +0x81: gQ== +0x82: gg== +0x83: gw== +0x84: hA== +0x85: hQ== +0x86: hg== +0x87: hw== +0x88: iA== +0x89: iQ== +0x8A: ig== +0x8B: iw== +0x8C: jA== +0x8D: jQ== +0x8E: jg== +0x8F: jw== +0x90: kA== +0x91: kQ== +0x92: kg== +0x93: kw== +0x94: lA== +0x95: lQ== +0x96: lg== +0x97: lw== +0x98: mA== +0x99: mQ== +0x9A: mg== +0x9B: mw== +0x9C: nA== +0x9D: nQ== +0x9E: ng== +0x9F: nw== +0xA0: oA== +0xA1: oQ== +0xA2: og== +0xA3: ow== +0xA4: pA== +0xA5: pQ== +0xA6: pg== +0xA7: pw== +0xA8: qA== +0xA9: qQ== +0xAA: qg== +0xAB: qw== +0xAC: rA== +0xAD: rQ== +0xAE: rg== +0xAF: rw== +0xB0: sA== +0xB1: sQ== +0xB2: sg== +0xB3: sw== +0xB4: tA== +0xB5: tQ== +0xB6: tg== +0xB7: tw== +0xB8: uA== +0xB9: uQ== +0xBA: ug== +0xBB: uw== +0xBC: vA== +0xBD: vQ== +0xBE: vg== +0xBF: vw== +0xC0: wA== +0xC1: wQ== +0xC2: wg== +0xC3: ww== +0xC4: xA== +0xC5: xQ== +0xC6: xg== +0xC7: xw== +0xC8: yA== +0xC9: yQ== +0xCA: yg== +0xCB: yw== +0xCC: zA== +0xCD: zQ== +0xCE: zg== +0xCF: zw== +0xD0: 0A== +0xD1: 0Q== +0xD2: 0g== +0xD3: 0w== +0xD4: 1A== +0xD5: 1Q== +0xD6: 1g== +0xD7: 1w== +0xD8: 2A== +0xD9: 2Q== +0xDA: 2g== +0xDB: 2w== +0xDC: 3A== +0xDD: 3Q== +0xDE: 3g== +0xDF: 3w== +0xE0: 4A== +0xE1: 4Q== +0xE2: 4g== +0xE3: 4w== +0xE4: 5A== +0xE5: 5Q== +0xE6: 5g== +0xE7: 5w== +0xE8: 6A== +0xE9: 6Q== +0xEA: 6g== +0xEB: 6w== +0xEC: 7A== +0xED: 7Q== +0xEE: 7g== +0xEF: 7w== +0xF0: 8A== +0xF1: 8Q== +0xF2: 8g== +0xF3: 8w== +0xF4: 9A== +0xF5: 9Q== +0xF6: 9g== +0xF7: 9w== +0xF8: +A== +0xF9: +Q== +0xFA: +g== +0xFB: +w== +0xFC: /A== +0xFD: /Q== +0xFE: /g== +0xFF: /w== +Done diff --git a/ext/standard/tests/url/base64_encode_basic_002.phpt b/ext/standard/tests/url/base64_encode_basic_002.phpt new file mode 100644 index 0000000..cff8f41 --- /dev/null +++ b/ext/standard/tests/url/base64_encode_basic_002.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test base64_encode() function : basic functionality - check algorithm round trips +--FILE-- + +===Done=== +--EXPECTF-- +*** Testing base64_encode() : basic functionality *** + +--- Testing base64_encode() with binary string input --- +-- Iteration 1 -- +TEST PASSED +-- Iteration 2 -- +TEST PASSED +-- Iteration 3 -- +TEST PASSED +-- Iteration 4 -- +TEST PASSED +-- Iteration 5 -- +TEST PASSED +===Done=== diff --git a/ext/standard/tests/url/base64_encode_error_001.phpt b/ext/standard/tests/url/base64_encode_error_001.phpt new file mode 100644 index 0000000..a8883ac --- /dev/null +++ b/ext/standard/tests/url/base64_encode_error_001.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test base64_encode() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing base64_encode() : error conditions - wrong number of args *** + +-- Testing base64_encode() function with Zero arguments -- + +Warning: base64_encode() expects exactly 1 parameter, 0 given in %s on line 12 +NULL + +-- Testing base64_encode() function with more than expected no. of arguments -- + +Warning: base64_encode() expects exactly 1 parameter, 2 given in %s on line 18 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/url/base64_encode_variation_001.phpt b/ext/standard/tests/url/base64_encode_variation_001.phpt new file mode 100644 index 0000000..f632beb --- /dev/null +++ b/ext/standard/tests/url/base64_encode_variation_001.phpt @@ -0,0 +1,172 @@ +--TEST-- +Test base64_encode() function : usage variations - unexpected types for argument 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for str + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( base64_encode($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing base64_encode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(63) +Error: 8 - Undefined variable: unset_var, %s(66) + +Arg value 0 +string(4) "MA==" + +Arg value 1 +string(4) "MQ==" + +Arg value 12345 +string(8) "MTIzNDU=" + +Arg value -2345 +string(8) "LTIzNDU=" + +Arg value 10.5 +string(8) "MTAuNQ==" + +Arg value -10.5 +string(8) "LTEwLjU=" + +Arg value 101234567000 +string(16) "MTAxMjM0NTY3MDAw" + +Arg value 1.07654321E-9 +string(20) "MS4wNzY1NDMyMUUtOQ==" + +Arg value 0.5 +string(4) "MC41" +Error: 8 - Array to string conversion, %sbase64_encode_variation_001.php(%d) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %sbase64_encode_variation_001.php(%d) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %sbase64_encode_variation_001.php(%d) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %sbase64_encode_variation_001.php(%d) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %sbase64_encode_variation_001.php(%d) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(4) "MQ==" + +Arg value +string(0) "" + +Arg value 1 +string(4) "MQ==" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(72) + +Arg value +Error: 2 - base64_encode() expects parameter 1 to be string, object given, %s(73) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done diff --git a/ext/standard/tests/url/bug47174.phpt b/ext/standard/tests/url/bug47174.phpt new file mode 100644 index 0000000..0296dbe --- /dev/null +++ b/ext/standard/tests/url/bug47174.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #47174 (base64_decode() interprets pad char in mid string as terminator) +--FILE-- + +--EXPECT-- +Invalid Signature +string(10) "Zm9v==YmFy" +string(6) "foobar" diff --git a/ext/standard/tests/url/bug52327.phpt b/ext/standard/tests/url/bug52327.phpt new file mode 100644 index 0000000..fb2e0fa --- /dev/null +++ b/ext/standard/tests/url/bug52327.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #52327 (base64_decode() improper handling of leading padding) +--FILE-- + +--EXPECT-- +string(51) "The '=' symbols aren't allowed where i put them o.O" +bool(false) diff --git a/ext/standard/tests/url/bug53248.phpt b/ext/standard/tests/url/bug53248.phpt new file mode 100644 index 0000000..5e31c51 --- /dev/null +++ b/ext/standard/tests/url/bug53248.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #53248 (rawurlencode RFC 3986 EBCDIC support) +--FILE-- + +--EXPECTF-- +string(6) "A1_-.~" +string(6) "A1_-.~" \ No newline at end of file diff --git a/ext/standard/tests/url/bug54180.phpt b/ext/standard/tests/url/bug54180.phpt new file mode 100644 index 0000000..2e64e27 --- /dev/null +++ b/ext/standard/tests/url/bug54180.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #54180 (parse_url() incorrectly parses path when ? in fragment) +--FILE-- + +--EXPECTF-- +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "example.com" + ["path"]=> + string(17) "/path/script.html" + ["query"]=> + string(3) "t=1" + ["fragment"]=> + string(13) "fragment?data" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "example.com" + ["path"]=> + string(17) "/path/script.html" + ["fragment"]=> + string(13) "fragment?data" +} diff --git a/ext/standard/tests/url/bug55273.phpt b/ext/standard/tests/url/bug55273.phpt new file mode 100644 index 0000000..1408506 --- /dev/null +++ b/ext/standard/tests/url/bug55273.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #55273 (base64_decode() with strict rejects whitespace after pad) +--FILE-- + +--EXPECT-- +string(6) "UEhQ +" +string(3) "PHP" +string(6) "UEg= +" +string(2) "PH" +string(6) "UA== +" +string(1) "P" diff --git a/ext/standard/tests/url/bug55399.phpt b/ext/standard/tests/url/bug55399.phpt new file mode 100644 index 0000000..619c08d --- /dev/null +++ b/ext/standard/tests/url/bug55399.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #55399 (parse_url() incorrectly treats ':' as a valid path) +--FILE-- + +--EXPECT-- +bool(false) diff --git a/ext/standard/tests/url/bug63162.phpt b/ext/standard/tests/url/bug63162.phpt new file mode 100644 index 0000000..ea5205e --- /dev/null +++ b/ext/standard/tests/url/bug63162.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test parse_url() for bug #63162 +--DESCRIPTION-- +This test covers tests the inputs: +[0]=> http://user:pass@host +[1]=> //user:pass@host +[2]=> //user@host +--FILE-- + +--EXPECT-- +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(4) "host" + ["user"]=> + string(4) "user" + ["pass"]=> + string(4) "pass" +} +array(3) { + ["host"]=> + string(4) "host" + ["user"]=> + string(4) "user" + ["pass"]=> + string(4) "pass" +} +array(2) { + ["host"]=> + string(4) "host" + ["user"]=> + string(4) "user" +} diff --git a/ext/standard/tests/url/get_headers_error_001.phpt b/ext/standard/tests/url/get_headers_error_001.phpt new file mode 100644 index 0000000..8d5fd11 --- /dev/null +++ b/ext/standard/tests/url/get_headers_error_001.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test get_headers() function : error conditions - wrong number of args +--CREDITS-- +June Henriksen +#PHPTestFest2009 Norway 2009-06-09 \o/ +--FILE-- + +--EXPECTF-- +*** Testing get_headers() : error conditions *** + +-- Testing get_headers() function with Zero arguments -- + +Warning: get_headers() expects at least 1 parameter, 0 given in %s on line 12 +NULL + +-- Testing get_headers() function with more than expected no. of arguments -- + +Warning: get_headers() expects at most 2 parameters, 3 given in %s on line 19 +NULL +Done + + + diff --git a/ext/standard/tests/url/get_headers_error_002.phpt b/ext/standard/tests/url/get_headers_error_002.phpt new file mode 100644 index 0000000..9626211 --- /dev/null +++ b/ext/standard/tests/url/get_headers_error_002.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test get_headers() function: wrong type for argument format +--CREDITS-- +June Henriksen +#PHPTestFest2009 Norway 2009-06-09 \o/ +--FILE-- + +--EXPECTF-- +*** Testing get_headers() : error conditions *** + +-- Testing get_headers() function with format argument as type string -- + +Warning: get_headers() expects parameter 2 to be long, string given in %s on line 13 +NULL + +-- Testing get_headers() function with format argument as type array -- + +Warning: get_headers() expects parameter 2 to be long, array given in %s on line 17 +NULL + +-- Testing get_headers() function with format argument as type object -- + +Warning: get_headers() expects parameter 2 to be long, object given in %s on line 26 +NULL +Done + diff --git a/ext/standard/tests/url/parse_url_basic_001.phpt b/ext/standard/tests/url/parse_url_basic_001.phpt new file mode 100644 index 0000000..1edc32e --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_001.phpt @@ -0,0 +1,866 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying the component +--FILE-- + $url: "; + var_dump(parse_url($url)); +} + +echo "Done"; +?> +--EXPECTF-- + +--> 64.246.30.37: array(1) { + ["path"]=> + string(12) "64.246.30.37" +} + +--> http://64.246.30.37: array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(12) "64.246.30.37" +} + +--> http://64.246.30.37/: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(12) "64.246.30.37" + ["path"]=> + string(1) "/" +} + +--> 64.246.30.37/: array(1) { + ["path"]=> + string(13) "64.246.30.37/" +} + +--> 64.246.30.37:80/: array(3) { + ["host"]=> + string(12) "64.246.30.37" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} + +--> php.net: array(1) { + ["path"]=> + string(7) "php.net" +} + +--> php.net/: array(1) { + ["path"]=> + string(8) "php.net/" +} + +--> http://php.net: array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "php.net" +} + +--> http://php.net/: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "php.net" + ["path"]=> + string(1) "/" +} + +--> www.php.net: array(1) { + ["path"]=> + string(11) "www.php.net" +} + +--> www.php.net/: array(1) { + ["path"]=> + string(12) "www.php.net/" +} + +--> http://www.php.net: array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" +} + +--> http://www.php.net/: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" +} + +--> www.php.net:80: array(2) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) +} + +--> http://www.php.net:80: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) +} + +--> http://www.php.net:80/: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} + +--> http://www.php.net/index.php: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" +} + +--> www.php.net/?: array(1) { + ["path"]=> + string(12) "www.php.net/" +} + +--> www.php.net:80/?: array(3) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} + +--> http://www.php.net/?: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" +} + +--> http://www.php.net:80/?: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} + +--> http://www.php.net:80/index.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" +} + +--> http://www.php.net:80/foo/bar/index.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(18) "/foo/bar/index.php" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" + ["query"]=> + string(37) "lots=1&of=2¶meters=3&too=4&here=5" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(45) "/this/is/a/very/deep/directory/structure/and/" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +} + +--> http://www.php.net:80/this/../a/../deep/directory: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(28) "/this/../a/../deep/directory" +} + +--> http://www.php.net:80/this/../a/../deep/directory/: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(29) "/this/../a/../deep/directory/" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(42) "/this/is/a/very/deep/directory/../file.php" +} + +--> http://www.php.net:80/index.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" +} + +--> http://www.php.net:80/index.php?: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" +} + +--> http://www.php.net:80/#foo: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["fragment"]=> + string(3) "foo" +} + +--> http://www.php.net:80/?#: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} + +--> http://www.php.net:80/?test=1: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["query"]=> + string(6) "test=1" +} + +--> http://www.php.net/?test=1&: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" + ["query"]=> + string(7) "test=1&" +} + +--> http://www.php.net:80/?&: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["query"]=> + string(1) "&" +} + +--> http://www.php.net:80/index.php?test=1&: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(7) "test=1&" +} + +--> http://www.php.net/index.php?&: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(1) "&" +} + +--> http://www.php.net:80/index.php?foo&: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(4) "foo&" +} + +--> http://www.php.net/index.php?&foo: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(4) "&foo" +} + +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" +} + +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(5) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(6) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["user"]=> + string(6) "secret" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(14) "secret@hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(8) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hid:out" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> nntp://news.php.net: array(2) { + ["scheme"]=> + string(4) "nntp" + ["host"]=> + string(12) "news.php.net" +} + +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz: array(3) { + ["scheme"]=> + string(3) "ftp" + ["host"]=> + string(11) "ftp.gnu.org" + ["path"]=> + string(22) "/gnu/glic/glibc.tar.gz" +} + +--> zlib:http://foo@bar: array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(14) "http://foo@bar" +} + +--> zlib:filename.txt: array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(12) "filename.txt" +} + +--> zlib:/path/to/my/file/file.txt: array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(25) "/path/to/my/file/file.txt" +} + +--> foo://foo@bar: array(3) { + ["scheme"]=> + string(3) "foo" + ["host"]=> + string(3) "bar" + ["user"]=> + string(3) "foo" +} + +--> mailto:me@mydomain.com: array(2) { + ["scheme"]=> + string(6) "mailto" + ["path"]=> + string(15) "me@mydomain.com" +} + +--> /foo.php?a=b&c=d: array(2) { + ["path"]=> + string(8) "/foo.php" + ["query"]=> + string(7) "a=b&c=d" +} + +--> foo.php?a=b&c=d: array(2) { + ["path"]=> + string(7) "foo.php" + ["query"]=> + string(7) "a=b&c=d" +} + +--> http://user:passwd@www.example.com:8080?bar=1&boom=0: array(6) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(15) "www.example.com" + ["port"]=> + int(8080) + ["user"]=> + string(4) "user" + ["pass"]=> + string(6) "passwd" + ["query"]=> + string(12) "bar=1&boom=0" +} + +--> file:///path/to/file: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(13) "/path/to/file" +} + +--> file://path/to/file: array(3) { + ["scheme"]=> + string(4) "file" + ["host"]=> + string(4) "path" + ["path"]=> + string(8) "/to/file" +} + +--> file:/path/to/file: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(13) "/path/to/file" +} + +--> http://1.2.3.4:/abc.asp?a=1&b=2: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "1.2.3.4" + ["path"]=> + string(8) "/abc.asp" + ["query"]=> + string(7) "a=1&b=2" +} + +--> http://foo.com#bar: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "foo.com" + ["fragment"]=> + string(3) "bar" +} + +--> scheme:: array(1) { + ["scheme"]=> + string(6) "scheme" +} + +--> foo+bar://baz@bang/bla: array(4) { + ["scheme"]=> + string(7) "foo+bar" + ["host"]=> + string(4) "bang" + ["user"]=> + string(3) "baz" + ["path"]=> + string(4) "/bla" +} + +--> gg:9130731: array(2) { + ["scheme"]=> + string(2) "gg" + ["path"]=> + string(7) "9130731" +} + +--> http://user:@pass@host/path?argument?value#etc: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(4) "host" + ["user"]=> + string(4) "user" + ["pass"]=> + string(5) "@pass" + ["path"]=> + string(5) "/path" + ["query"]=> + string(14) "argument?value" + ["fragment"]=> + string(3) "etc" +} + +--> http://10.10.10.10/:80: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "10.10.10.10" + ["path"]=> + string(4) "/:80" +} + +--> http://x:?: array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(1) "x" +} + +--> x:blah.com: array(2) { + ["scheme"]=> + string(1) "x" + ["path"]=> + string(8) "blah.com" +} + +--> x:/blah.com: array(2) { + ["scheme"]=> + string(1) "x" + ["path"]=> + string(9) "/blah.com" +} + +--> x://::abc/?: bool(false) + +--> http://::?: array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(1) ":" +} + +--> x://::6.5: array(3) { + ["scheme"]=> + string(1) "x" + ["host"]=> + string(1) ":" + ["port"]=> + int(6) +} + +--> http://?:/: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(1) "?" + ["path"]=> + string(1) "/" +} + +--> http://@?:/: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(1) "?" + ["user"]=> + string(0) "" + ["path"]=> + string(1) "/" +} + +--> file:///:: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(2) "/:" +} + +--> file:///a:/: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(3) "a:/" +} + +--> file:///ab:/: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(5) "/ab:/" +} + +--> file:///a:/: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(3) "a:/" +} + +--> file:///@:/: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(3) "@:/" +} + +--> file:///:80/: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(5) "/:80/" +} + +--> []: array(1) { + ["path"]=> + string(2) "[]" +} + +--> http://[x:80]/: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(6) "[x:80]" + ["path"]=> + string(1) "/" +} + +--> : array(1) { + ["path"]=> + string(0) "" +} + +--> /: array(1) { + ["path"]=> + string(1) "/" +} + +--> http:///blah.com: bool(false) + +--> http://:80: bool(false) + +--> http://user@:80: bool(false) + +--> http://user:pass@:80: bool(false) + +--> http://:: bool(false) + +--> http://@/: bool(false) + +--> http://@:/: bool(false) + +--> http://:/: bool(false) + +--> http://?: bool(false) + +--> http://?:: bool(false) + +--> http://:?: bool(false) + +--> http://blah.com:123456: bool(false) + +--> http://blah.com:abcdef: bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_002.phpt b/ext/standard/tests/url/parse_url_basic_002.phpt new file mode 100644 index 0000000..464e977 --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_002.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_SCHEME as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_SCHEME)); + +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : string(4) "http" +--> http://64.246.30.37/ : string(4) "http" +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : string(4) "http" +--> http://php.net/ : string(4) "http" +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : string(4) "http" +--> http://www.php.net/ : string(4) "http" +--> www.php.net:80 : NULL +--> http://www.php.net:80 : string(4) "http" +--> http://www.php.net:80/ : string(4) "http" +--> http://www.php.net/index.php : string(4) "http" +--> www.php.net/? : NULL +--> www.php.net:80/? : NULL +--> http://www.php.net/? : string(4) "http" +--> http://www.php.net:80/? : string(4) "http" +--> http://www.php.net:80/index.php : string(4) "http" +--> http://www.php.net:80/foo/bar/index.php : string(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : string(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : string(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(4) "http" +--> http://www.php.net:80/this/../a/../deep/directory : string(4) "http" +--> http://www.php.net:80/this/../a/../deep/directory/ : string(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : string(4) "http" +--> http://www.php.net:80/index.php : string(4) "http" +--> http://www.php.net:80/index.php? : string(4) "http" +--> http://www.php.net:80/#foo : string(4) "http" +--> http://www.php.net:80/?# : string(4) "http" +--> http://www.php.net:80/?test=1 : string(4) "http" +--> http://www.php.net/?test=1& : string(4) "http" +--> http://www.php.net:80/?& : string(4) "http" +--> http://www.php.net:80/index.php?test=1& : string(4) "http" +--> http://www.php.net/index.php?& : string(4) "http" +--> http://www.php.net:80/index.php?foo& : string(4) "http" +--> http://www.php.net/index.php?&foo : string(4) "http" +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(4) "http" +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http" +--> nntp://news.php.net : string(4) "nntp" +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(3) "ftp" +--> zlib:http://foo@bar : string(4) "zlib" +--> zlib:filename.txt : string(4) "zlib" +--> zlib:/path/to/my/file/file.txt : string(4) "zlib" +--> foo://foo@bar : string(3) "foo" +--> mailto:me@mydomain.com : string(6) "mailto" +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(4) "http" +--> file:///path/to/file : string(4) "file" +--> file://path/to/file : string(4) "file" +--> file:/path/to/file : string(4) "file" +--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(4) "http" +--> http://foo.com#bar : string(4) "http" +--> scheme: : string(6) "scheme" +--> foo+bar://baz@bang/bla : string(7) "foo+bar" +--> gg:9130731 : string(2) "gg" +--> http://user:@pass@host/path?argument?value#etc : string(4) "http" +--> http://10.10.10.10/:80 : string(4) "http" +--> http://x:? : string(4) "http" +--> x:blah.com : string(1) "x" +--> x:/blah.com : string(1) "x" +--> x://::abc/? : bool(false) +--> http://::? : string(4) "http" +--> x://::6.5 : string(1) "x" +--> http://?:/ : string(4) "http" +--> http://@?:/ : string(4) "http" +--> file:///: : string(4) "file" +--> file:///a:/ : string(4) "file" +--> file:///ab:/ : string(4) "file" +--> file:///a:/ : string(4) "file" +--> file:///@:/ : string(4) "file" +--> file:///:80/ : string(4) "file" +--> [] : NULL +--> http://[x:80]/ : string(4) "http" +--> : NULL +--> / : NULL +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_003.phpt b/ext/standard/tests/url/parse_url_basic_003.phpt new file mode 100644 index 0000000..57f182b --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_003.phpt @@ -0,0 +1,124 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_HOST as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_HOST)); +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : string(12) "64.246.30.37" +--> http://64.246.30.37/ : string(12) "64.246.30.37" +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : string(12) "64.246.30.37" +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : string(7) "php.net" +--> http://php.net/ : string(7) "php.net" +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : string(11) "www.php.net" +--> http://www.php.net/ : string(11) "www.php.net" +--> www.php.net:80 : string(11) "www.php.net" +--> http://www.php.net:80 : string(11) "www.php.net" +--> http://www.php.net:80/ : string(11) "www.php.net" +--> http://www.php.net/index.php : string(11) "www.php.net" +--> www.php.net/? : NULL +--> www.php.net:80/? : string(11) "www.php.net" +--> http://www.php.net/? : string(11) "www.php.net" +--> http://www.php.net:80/? : string(11) "www.php.net" +--> http://www.php.net:80/index.php : string(11) "www.php.net" +--> http://www.php.net:80/foo/bar/index.php : string(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : string(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : string(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(11) "www.php.net" +--> http://www.php.net:80/this/../a/../deep/directory : string(11) "www.php.net" +--> http://www.php.net:80/this/../a/../deep/directory/ : string(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : string(11) "www.php.net" +--> http://www.php.net:80/index.php : string(11) "www.php.net" +--> http://www.php.net:80/index.php? : string(11) "www.php.net" +--> http://www.php.net:80/#foo : string(11) "www.php.net" +--> http://www.php.net:80/?# : string(11) "www.php.net" +--> http://www.php.net:80/?test=1 : string(11) "www.php.net" +--> http://www.php.net/?test=1& : string(11) "www.php.net" +--> http://www.php.net:80/?& : string(11) "www.php.net" +--> http://www.php.net:80/index.php?test=1& : string(11) "www.php.net" +--> http://www.php.net/index.php?& : string(11) "www.php.net" +--> http://www.php.net:80/index.php?foo& : string(11) "www.php.net" +--> http://www.php.net/index.php?&foo : string(11) "www.php.net" +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(11) "www.php.net" +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +--> nntp://news.php.net : string(12) "news.php.net" +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(11) "ftp.gnu.org" +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : string(3) "bar" +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(15) "www.example.com" +--> file:///path/to/file : NULL +--> file://path/to/file : string(4) "path" +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(7) "1.2.3.4" +--> http://foo.com#bar : string(7) "foo.com" +--> scheme: : NULL +--> foo+bar://baz@bang/bla : string(4) "bang" +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : string(4) "host" +--> http://10.10.10.10/:80 : string(11) "10.10.10.10" +--> http://x:? : string(1) "x" +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : bool(false) +--> http://::? : string(1) ":" +--> x://::6.5 : string(1) ":" +--> http://?:/ : string(1) "?" +--> http://@?:/ : string(1) "?" +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : string(6) "[x:80]" +--> : NULL +--> / : NULL +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_004.phpt b/ext/standard/tests/url/parse_url_basic_004.phpt new file mode 100644 index 0000000..6abf4ed --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_004.phpt @@ -0,0 +1,124 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PORT as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_PORT)); +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : NULL +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : int(80) +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : NULL +--> http://php.net/ : NULL +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : NULL +--> http://www.php.net/ : NULL +--> www.php.net:80 : int(80) +--> http://www.php.net:80 : int(80) +--> http://www.php.net:80/ : int(80) +--> http://www.php.net/index.php : NULL +--> www.php.net/? : NULL +--> www.php.net:80/? : int(80) +--> http://www.php.net/? : NULL +--> http://www.php.net:80/? : int(80) +--> http://www.php.net:80/index.php : int(80) +--> http://www.php.net:80/foo/bar/index.php : int(80) +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : int(80) +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : int(80) +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : int(80) +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : int(80) +--> http://www.php.net:80/this/../a/../deep/directory : int(80) +--> http://www.php.net:80/this/../a/../deep/directory/ : int(80) +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : int(80) +--> http://www.php.net:80/index.php : int(80) +--> http://www.php.net:80/index.php? : int(80) +--> http://www.php.net:80/#foo : int(80) +--> http://www.php.net:80/?# : int(80) +--> http://www.php.net:80/?test=1 : int(80) +--> http://www.php.net/?test=1& : NULL +--> http://www.php.net:80/?& : int(80) +--> http://www.php.net:80/index.php?test=1& : int(80) +--> http://www.php.net/index.php?& : NULL +--> http://www.php.net:80/index.php?foo& : int(80) +--> http://www.php.net/index.php?&foo : NULL +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : int(80) +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80) +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80) +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80) +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80) +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80) +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : NULL +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : int(8080) +--> file:///path/to/file : NULL +--> file://path/to/file : NULL +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL +--> http://foo.com#bar : NULL +--> scheme: : NULL +--> foo+bar://baz@bang/bla : NULL +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : NULL +--> http://10.10.10.10/:80 : NULL +--> http://x:? : NULL +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : bool(false) +--> http://::? : NULL +--> x://::6.5 : int(6) +--> http://?:/ : NULL +--> http://@?:/ : NULL +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : NULL +--> : NULL +--> / : NULL +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_005.phpt b/ext/standard/tests/url/parse_url_basic_005.phpt new file mode 100644 index 0000000..3bcc891 --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_005.phpt @@ -0,0 +1,124 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_USER as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_USER)); +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : NULL +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : NULL +--> http://php.net/ : NULL +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : NULL +--> http://www.php.net/ : NULL +--> www.php.net:80 : NULL +--> http://www.php.net:80 : NULL +--> http://www.php.net:80/ : NULL +--> http://www.php.net/index.php : NULL +--> www.php.net/? : NULL +--> www.php.net:80/? : NULL +--> http://www.php.net/? : NULL +--> http://www.php.net:80/? : NULL +--> http://www.php.net:80/index.php : NULL +--> http://www.php.net:80/foo/bar/index.php : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/../a/../deep/directory : NULL +--> http://www.php.net:80/this/../a/../deep/directory/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL +--> http://www.php.net:80/index.php : NULL +--> http://www.php.net:80/index.php? : NULL +--> http://www.php.net:80/#foo : NULL +--> http://www.php.net:80/?# : NULL +--> http://www.php.net:80/?test=1 : NULL +--> http://www.php.net/?test=1& : NULL +--> http://www.php.net:80/?& : NULL +--> http://www.php.net:80/index.php?test=1& : NULL +--> http://www.php.net/index.php?& : NULL +--> http://www.php.net:80/index.php?foo& : NULL +--> http://www.php.net/index.php?&foo : NULL +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(14) "secret@hideout" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : string(3) "foo" +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(4) "user" +--> file:///path/to/file : NULL +--> file://path/to/file : NULL +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL +--> http://foo.com#bar : NULL +--> scheme: : NULL +--> foo+bar://baz@bang/bla : string(3) "baz" +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : string(4) "user" +--> http://10.10.10.10/:80 : NULL +--> http://x:? : NULL +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : bool(false) +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : NULL +--> http://@?:/ : string(0) "" +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : NULL +--> : NULL +--> / : NULL +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_006.phpt b/ext/standard/tests/url/parse_url_basic_006.phpt new file mode 100644 index 0000000..741a424 --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_006.phpt @@ -0,0 +1,124 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PASS as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_PASS)); +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : NULL +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : NULL +--> http://php.net/ : NULL +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : NULL +--> http://www.php.net/ : NULL +--> www.php.net:80 : NULL +--> http://www.php.net:80 : NULL +--> http://www.php.net:80/ : NULL +--> http://www.php.net/index.php : NULL +--> www.php.net/? : NULL +--> www.php.net:80/? : NULL +--> http://www.php.net/? : NULL +--> http://www.php.net:80/? : NULL +--> http://www.php.net:80/index.php : NULL +--> http://www.php.net:80/foo/bar/index.php : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/../a/../deep/directory : NULL +--> http://www.php.net:80/this/../a/../deep/directory/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL +--> http://www.php.net:80/index.php : NULL +--> http://www.php.net:80/index.php? : NULL +--> http://www.php.net:80/#foo : NULL +--> http://www.php.net:80/?# : NULL +--> http://www.php.net:80/?test=1 : NULL +--> http://www.php.net/?test=1& : NULL +--> http://www.php.net:80/?& : NULL +--> http://www.php.net:80/index.php?test=1& : NULL +--> http://www.php.net/index.php?& : NULL +--> http://www.php.net:80/index.php?foo& : NULL +--> http://www.php.net/index.php?&foo : NULL +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hideout" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hideout" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hid:out" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : NULL +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(6) "passwd" +--> file:///path/to/file : NULL +--> file://path/to/file : NULL +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL +--> http://foo.com#bar : NULL +--> scheme: : NULL +--> foo+bar://baz@bang/bla : NULL +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : string(5) "@pass" +--> http://10.10.10.10/:80 : NULL +--> http://x:? : NULL +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : bool(false) +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : NULL +--> http://@?:/ : NULL +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : NULL +--> : NULL +--> / : NULL +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_007.phpt b/ext/standard/tests/url/parse_url_basic_007.phpt new file mode 100644 index 0000000..bf8f980 --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_007.phpt @@ -0,0 +1,124 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PATH as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_PATH)); +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : string(12) "64.246.30.37" +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : string(1) "/" +--> 64.246.30.37/ : string(13) "64.246.30.37/" +--> 64.246.30.37:80/ : string(1) "/" +--> php.net : string(7) "php.net" +--> php.net/ : string(8) "php.net/" +--> http://php.net : NULL +--> http://php.net/ : string(1) "/" +--> www.php.net : string(11) "www.php.net" +--> www.php.net/ : string(12) "www.php.net/" +--> http://www.php.net : NULL +--> http://www.php.net/ : string(1) "/" +--> www.php.net:80 : NULL +--> http://www.php.net:80 : NULL +--> http://www.php.net:80/ : string(1) "/" +--> http://www.php.net/index.php : string(10) "/index.php" +--> www.php.net/? : string(12) "www.php.net/" +--> www.php.net:80/? : string(1) "/" +--> http://www.php.net/? : string(1) "/" +--> http://www.php.net:80/? : string(1) "/" +--> http://www.php.net:80/index.php : string(10) "/index.php" +--> http://www.php.net:80/foo/bar/index.php : string(18) "/foo/bar/index.php" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : string(45) "/this/is/a/very/deep/directory/structure/and/" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +--> http://www.php.net:80/this/../a/../deep/directory : string(28) "/this/../a/../deep/directory" +--> http://www.php.net:80/this/../a/../deep/directory/ : string(29) "/this/../a/../deep/directory/" +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : string(42) "/this/is/a/very/deep/directory/../file.php" +--> http://www.php.net:80/index.php : string(10) "/index.php" +--> http://www.php.net:80/index.php? : string(10) "/index.php" +--> http://www.php.net:80/#foo : string(1) "/" +--> http://www.php.net:80/?# : string(1) "/" +--> http://www.php.net:80/?test=1 : string(1) "/" +--> http://www.php.net/?test=1& : string(1) "/" +--> http://www.php.net:80/?& : string(1) "/" +--> http://www.php.net:80/index.php?test=1& : string(10) "/index.php" +--> http://www.php.net/index.php?& : string(10) "/index.php" +--> http://www.php.net:80/index.php?foo& : string(10) "/index.php" +--> http://www.php.net/index.php?&foo : string(10) "/index.php" +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(10) "/index.php" +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php" +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(22) "/gnu/glic/glibc.tar.gz" +--> zlib:http://foo@bar : string(14) "http://foo@bar" +--> zlib:filename.txt : string(12) "filename.txt" +--> zlib:/path/to/my/file/file.txt : string(25) "/path/to/my/file/file.txt" +--> foo://foo@bar : NULL +--> mailto:me@mydomain.com : string(15) "me@mydomain.com" +--> /foo.php?a=b&c=d : string(8) "/foo.php" +--> foo.php?a=b&c=d : string(7) "foo.php" +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : NULL +--> file:///path/to/file : string(13) "/path/to/file" +--> file://path/to/file : string(8) "/to/file" +--> file:/path/to/file : string(13) "/path/to/file" +--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(8) "/abc.asp" +--> http://foo.com#bar : NULL +--> scheme: : NULL +--> foo+bar://baz@bang/bla : string(4) "/bla" +--> gg:9130731 : string(7) "9130731" +--> http://user:@pass@host/path?argument?value#etc : string(5) "/path" +--> http://10.10.10.10/:80 : string(4) "/:80" +--> http://x:? : NULL +--> x:blah.com : string(8) "blah.com" +--> x:/blah.com : string(9) "/blah.com" +--> x://::abc/? : bool(false) +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : string(1) "/" +--> http://@?:/ : string(1) "/" +--> file:///: : string(2) "/:" +--> file:///a:/ : string(3) "a:/" +--> file:///ab:/ : string(5) "/ab:/" +--> file:///a:/ : string(3) "a:/" +--> file:///@:/ : string(3) "@:/" +--> file:///:80/ : string(5) "/:80/" +--> [] : string(2) "[]" +--> http://[x:80]/ : string(1) "/" +--> : string(0) "" +--> / : string(1) "/" +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_008.phpt b/ext/standard/tests/url/parse_url_basic_008.phpt new file mode 100644 index 0000000..a61fd06 --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_008.phpt @@ -0,0 +1,124 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_QUERY as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_QUERY)); +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : NULL +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : NULL +--> http://php.net/ : NULL +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : NULL +--> http://www.php.net/ : NULL +--> www.php.net:80 : NULL +--> http://www.php.net:80 : NULL +--> http://www.php.net:80/ : NULL +--> http://www.php.net/index.php : NULL +--> www.php.net/? : NULL +--> www.php.net:80/? : NULL +--> http://www.php.net/? : NULL +--> http://www.php.net:80/? : NULL +--> http://www.php.net:80/index.php : NULL +--> http://www.php.net:80/foo/bar/index.php : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : string(37) "lots=1&of=2¶meters=3&too=4&here=5" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/../a/../deep/directory : NULL +--> http://www.php.net:80/this/../a/../deep/directory/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL +--> http://www.php.net:80/index.php : NULL +--> http://www.php.net:80/index.php? : NULL +--> http://www.php.net:80/#foo : NULL +--> http://www.php.net:80/?# : NULL +--> http://www.php.net:80/?test=1 : string(6) "test=1" +--> http://www.php.net/?test=1& : string(7) "test=1&" +--> http://www.php.net:80/?& : string(1) "&" +--> http://www.php.net:80/index.php?test=1& : string(7) "test=1&" +--> http://www.php.net/index.php?& : string(1) "&" +--> http://www.php.net:80/index.php?foo& : string(4) "foo&" +--> http://www.php.net/index.php?&foo : string(4) "&foo" +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(31) "test=1&test2=char&test3=mixesCI" +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI" +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : NULL +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : string(7) "a=b&c=d" +--> foo.php?a=b&c=d : string(7) "a=b&c=d" +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(12) "bar=1&boom=0" +--> file:///path/to/file : NULL +--> file://path/to/file : NULL +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(7) "a=1&b=2" +--> http://foo.com#bar : NULL +--> scheme: : NULL +--> foo+bar://baz@bang/bla : NULL +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : string(14) "argument?value" +--> http://10.10.10.10/:80 : NULL +--> http://x:? : NULL +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : bool(false) +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : NULL +--> http://@?:/ : NULL +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : NULL +--> : NULL +--> / : NULL +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_009.phpt b/ext/standard/tests/url/parse_url_basic_009.phpt new file mode 100644 index 0000000..5302388 --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_009.phpt @@ -0,0 +1,124 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_FRAGMENT as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_FRAGMENT)); +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : NULL +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : NULL +--> http://php.net/ : NULL +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : NULL +--> http://www.php.net/ : NULL +--> www.php.net:80 : NULL +--> http://www.php.net:80 : NULL +--> http://www.php.net:80/ : NULL +--> http://www.php.net/index.php : NULL +--> www.php.net/? : NULL +--> www.php.net:80/? : NULL +--> http://www.php.net/? : NULL +--> http://www.php.net:80/? : NULL +--> http://www.php.net:80/index.php : NULL +--> http://www.php.net:80/foo/bar/index.php : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/../a/../deep/directory : NULL +--> http://www.php.net:80/this/../a/../deep/directory/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL +--> http://www.php.net:80/index.php : NULL +--> http://www.php.net:80/index.php? : NULL +--> http://www.php.net:80/#foo : string(3) "foo" +--> http://www.php.net:80/?# : NULL +--> http://www.php.net:80/?test=1 : NULL +--> http://www.php.net/?test=1& : NULL +--> http://www.php.net:80/?& : NULL +--> http://www.php.net:80/index.php?test=1& : NULL +--> http://www.php.net/index.php?& : NULL +--> http://www.php.net:80/index.php?foo& : NULL +--> http://www.php.net/index.php?&foo : NULL +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123" +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : NULL +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : NULL +--> file:///path/to/file : NULL +--> file://path/to/file : NULL +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL +--> http://foo.com#bar : string(3) "bar" +--> scheme: : NULL +--> foo+bar://baz@bang/bla : NULL +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : string(3) "etc" +--> http://10.10.10.10/:80 : NULL +--> http://x:? : NULL +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : bool(false) +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : NULL +--> http://@?:/ : NULL +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : NULL +--> : NULL +--> / : NULL +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_010.phpt b/ext/standard/tests/url/parse_url_basic_010.phpt new file mode 100644 index 0000000..3bb2dba --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_010.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test parse_url() function : check values of URL related constants +--FILE-- + $constantValue) { + if (strpos($constantName, 'PHP_URL')===0) { + echo "$constantName: $constantValue \n"; + } +} + +echo "Done"; +?> +--EXPECTF-- +PHP_URL_SCHEME: 0 +PHP_URL_HOST: 1 +PHP_URL_PORT: 2 +PHP_URL_USER: 3 +PHP_URL_PASS: 4 +PHP_URL_PATH: 5 +PHP_URL_QUERY: 6 +PHP_URL_FRAGMENT: 7 +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_error_001.phpt b/ext/standard/tests/url/parse_url_error_001.phpt new file mode 100644 index 0000000..0280a87 --- /dev/null +++ b/ext/standard/tests/url/parse_url_error_001.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test parse_url() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing parse_url() : error conditions *** + +-- Testing parse_url() function with Zero arguments -- + +Warning: parse_url() expects at least 1 parameter, 0 given in %s on line 12 +NULL + +-- Testing parse_url() function with more than expected no. of arguments -- + +Warning: parse_url() expects at most 2 parameters, 3 given in %s on line 19 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_error_002.phpt b/ext/standard/tests/url/parse_url_error_002.phpt new file mode 100644 index 0000000..45c20f4 --- /dev/null +++ b/ext/standard/tests/url/parse_url_error_002.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test parse_url() function: url component specifier out of range +--FILE-- + Below range:"; +var_dump(parse_url($url, -1)); + +echo "\n\n--> Above range:"; +var_dump(parse_url($url, 99)); + +echo "Done" +?> +--EXPECTF-- +*** Testing parse_url() : error conditions: url component specifier out of range *** +--> Below range:array(8) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + + +--> Above range: +Warning: parse_url(): Invalid URL component identifier 99 in %s on line 15 +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_relative_scheme.phpt b/ext/standard/tests/url/parse_url_relative_scheme.phpt new file mode 100644 index 0000000..7c8952d --- /dev/null +++ b/ext/standard/tests/url/parse_url_relative_scheme.phpt @@ -0,0 +1,11 @@ +--TEST-- +Test parse_url() function: Checks relative URL schemes (e.g. "//example.com") +--FILE-- + + string(11) "example.org" +} + diff --git a/ext/standard/tests/url/parse_url_variation_001.phpt b/ext/standard/tests/url/parse_url_variation_001.phpt new file mode 100644 index 0000000..0b804ee --- /dev/null +++ b/ext/standard/tests/url/parse_url_variation_001.phpt @@ -0,0 +1,226 @@ +--TEST-- +Test parse_url() function : usage variations - unexpected type for arg 1. +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for url + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( parse_url($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing parse_url() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(60) +Error: 8 - Undefined variable: unset_var, %s(63) + +Arg value 0 +array(1) { + ["path"]=> + string(1) "0" +} + +Arg value 1 +array(1) { + ["path"]=> + string(1) "1" +} + +Arg value 12345 +array(1) { + ["path"]=> + string(5) "12345" +} + +Arg value -2345 +array(1) { + ["path"]=> + string(5) "-2345" +} + +Arg value 10.5 +array(1) { + ["path"]=> + string(4) "10.5" +} + +Arg value -10.5 +array(1) { + ["path"]=> + string(5) "-10.5" +} + +Arg value 101234567000 +array(1) { + ["path"]=> + string(12) "101234567000" +} + +Arg value 1.07654321E-9 +array(1) { + ["path"]=> + string(13) "1.07654321E-9" +} + +Arg value 0.5 +array(1) { + ["path"]=> + string(3) "0.5" +} +Error: 8 - Array to string conversion, %sparse_url_variation_001.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70) +NULL +Error: 8 - Array to string conversion, %sparse_url_variation_001.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70) +NULL +Error: 8 - Array to string conversion, %sparse_url_variation_001.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70) +NULL +Error: 8 - Array to string conversion, %sparse_url_variation_001.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70) +NULL +Error: 8 - Array to string conversion, %sparse_url_variation_001.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70) +NULL + +Arg value +array(1) { + ["path"]=> + string(0) "" +} + +Arg value +array(1) { + ["path"]=> + string(0) "" +} + +Arg value 1 +array(1) { + ["path"]=> + string(1) "1" +} + +Arg value +array(1) { + ["path"]=> + string(0) "" +} + +Arg value 1 +array(1) { + ["path"]=> + string(1) "1" +} + +Arg value +array(1) { + ["path"]=> + string(0) "" +} + +Arg value +array(1) { + ["path"]=> + string(0) "" +} + +Arg value +array(1) { + ["path"]=> + string(0) "" +} +Error: 4096 - Object of class stdClass could not be converted to string, %s(69) + +Arg value +Error: 2 - parse_url() expects parameter 1 to be string, object given, %s(70) +NULL + +Arg value +array(1) { + ["path"]=> + string(0) "" +} + +Arg value +array(1) { + ["path"]=> + string(0) "" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_variation_002_32bit.phpt b/ext/standard/tests/url/parse_url_variation_002_32bit.phpt new file mode 100644 index 0000000..aefb37a --- /dev/null +++ b/ext/standard/tests/url/parse_url_variation_002_32bit.phpt @@ -0,0 +1,205 @@ +--TEST-- +Test parse_url() function : usage variations - unexpected type for arg 2. +--SKIPIF-- + +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for url_component + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( parse_url($url, $value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing parse_url() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(61) +Error: 8 - Undefined variable: unset_var, %s(64) + +Arg value 10.5 +Error: 2 - parse_url(): Invalid URL component identifier 10, %s(71) +bool(false) + +Arg value -10.5 +array(8) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +Arg value 101234567000 +array(8) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +Arg value 1.07654321E-9 +string(4) "http" + +Arg value 0.5 +string(4) "http" +Error: 8 - Array to string conversion, %sparse_url_variation_002_32bit.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %sparse_url_variation_002_32bit.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %sparse_url_variation_002_32bit.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %sparse_url_variation_002_32bit.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %sparse_url_variation_002_32bit.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL + +Arg value +string(4) "http" + +Arg value +string(4) "http" + +Arg value 1 +string(11) "www.php.net" + +Arg value +string(4) "http" + +Arg value 1 +string(11) "www.php.net" + +Arg value +string(4) "http" + +Arg value +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +NULL + +Arg value +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +NULL + +Arg value string +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +NULL + +Arg value string +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +NULL +Error: 4096 - Object of class stdClass could not be converted to string, %s(70) + +Arg value +Error: 2 - parse_url() expects parameter 2 to be long, object given, %s(71) +NULL + +Arg value +string(4) "http" + +Arg value +string(4) "http" +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_variation_002_64bit.phpt b/ext/standard/tests/url/parse_url_variation_002_64bit.phpt new file mode 100644 index 0000000..35a600c --- /dev/null +++ b/ext/standard/tests/url/parse_url_variation_002_64bit.phpt @@ -0,0 +1,189 @@ +--TEST-- +Test parse_url() function : usage variations - unexpected type for arg 2. +--SKIPIF-- + +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for url_component + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( parse_url($url, $value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing parse_url() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(61) +Error: 8 - Undefined variable: unset_var, %s(64) + +Arg value 10.5 +Error: 2 - parse_url(): Invalid URL component identifier 10, %s(71) +bool(false) + +Arg value -10.5 +array(8) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +Arg value 101234567000 +Error: 2 - parse_url(): Invalid URL component identifier %d, %s(71) +bool(false) + +Arg value 1.07654321E-9 +string(4) "http" + +Arg value 0.5 +string(4) "http" +Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL + +Arg value +string(4) "http" + +Arg value +string(4) "http" + +Arg value 1 +string(11) "www.php.net" + +Arg value +string(4) "http" + +Arg value 1 +string(11) "www.php.net" + +Arg value +string(4) "http" + +Arg value +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +NULL + +Arg value +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +NULL + +Arg value string +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +NULL + +Arg value string +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +NULL +Error: 4096 - Object of class stdClass could not be converted to string, %s(70) + +Arg value +Error: 2 - parse_url() expects parameter 2 to be long, object given, %s(71) +NULL + +Arg value +string(4) "http" + +Arg value +string(4) "http" +Done \ No newline at end of file diff --git a/ext/standard/tests/url/rawurldecode_error_001.phpt b/ext/standard/tests/url/rawurldecode_error_001.phpt new file mode 100644 index 0000000..1dcaf40 --- /dev/null +++ b/ext/standard/tests/url/rawurldecode_error_001.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test rawurldecode() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing rawurldecode() : error conditions *** + +-- Testing rawurldecode() function with Zero arguments -- + +Warning: rawurldecode() expects exactly 1 parameter, 0 given in %s on line 14 +NULL + +-- Testing rawurldecode() function with more than expected no. of arguments -- + +Warning: rawurldecode() expects exactly 1 parameter, 2 given in %s on line 20 +NULL +Done diff --git a/ext/standard/tests/url/rawurldecode_variation_001.phpt b/ext/standard/tests/url/rawurldecode_variation_001.phpt new file mode 100644 index 0000000..9527fe6 --- /dev/null +++ b/ext/standard/tests/url/rawurldecode_variation_001.phpt @@ -0,0 +1,173 @@ +--TEST-- +Test rawurldecode() function : usage variations - unexpected type for arg 1. +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for str + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( rawurldecode($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing rawurldecode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(13) "1.07654321E-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %srawurldecode_variation_001.php(%d) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %srawurldecode_variation_001.php(%d) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %srawurldecode_variation_001.php(%d) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %srawurldecode_variation_001.php(%d) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %srawurldecode_variation_001.php(%d) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 2 - rawurldecode() expects parameter 1 to be string, object given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done \ No newline at end of file diff --git a/ext/standard/tests/url/rawurlencode_error_001.phpt b/ext/standard/tests/url/rawurlencode_error_001.phpt new file mode 100644 index 0000000..7acce9e --- /dev/null +++ b/ext/standard/tests/url/rawurlencode_error_001.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test rawurlencode() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing rawurlencode() : error conditions *** + +-- Testing rawurlencode() function with Zero arguments -- + +Warning: rawurlencode() expects exactly 1 parameter, 0 given in %s on line 14 +NULL + +-- Testing rawurlencode() function with more than expected no. of arguments -- + +Warning: rawurlencode() expects exactly 1 parameter, 2 given in %s on line 20 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/url/rawurlencode_variation_001.phpt b/ext/standard/tests/url/rawurlencode_variation_001.phpt new file mode 100644 index 0000000..a344336 --- /dev/null +++ b/ext/standard/tests/url/rawurlencode_variation_001.phpt @@ -0,0 +1,173 @@ +--TEST-- +Test rawurlencode() function : usage variations - unexpected type for arg 1. +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for str + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( rawurlencode($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing rawurlencode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(13) "1.07654321E-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 2 - rawurlencode() expects parameter 1 to be string, object given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done \ No newline at end of file diff --git a/ext/standard/tests/url/urldecode_error_001.phpt b/ext/standard/tests/url/urldecode_error_001.phpt new file mode 100644 index 0000000..f0e5ae0 --- /dev/null +++ b/ext/standard/tests/url/urldecode_error_001.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test urldecode() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing urldecode() : error conditions *** + +-- Testing urldecode() function with Zero arguments -- + +Warning: urldecode() expects exactly 1 parameter, 0 given in %s on line 14 +NULL + +-- Testing urldecode() function with more than expected no. of arguments -- + +Warning: urldecode() expects exactly 1 parameter, 2 given in %s on line 20 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/url/urldecode_variation_001.phpt b/ext/standard/tests/url/urldecode_variation_001.phpt new file mode 100644 index 0000000..42026d1 --- /dev/null +++ b/ext/standard/tests/url/urldecode_variation_001.phpt @@ -0,0 +1,173 @@ +--TEST-- +Test urldecode() function : usage variations - +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for str + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( urldecode($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing urldecode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(13) "1.07654321E-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %surldecode_variation_001.php(%d) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %surldecode_variation_001.php(%d) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %surldecode_variation_001.php(%d) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %surldecode_variation_001.php(%d) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %surldecode_variation_001.php(%d) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 2 - urldecode() expects parameter 1 to be string, object given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done \ No newline at end of file diff --git a/ext/standard/tests/url/urlencode_error_001.phpt b/ext/standard/tests/url/urlencode_error_001.phpt new file mode 100644 index 0000000..fc00b05 --- /dev/null +++ b/ext/standard/tests/url/urlencode_error_001.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test urlencode() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing urlencode() : error conditions *** + +-- Testing urlencode() function with Zero arguments -- + +Warning: urlencode() expects exactly 1 parameter, 0 given in %s on line 14 +NULL + +-- Testing urlencode() function with more than expected no. of arguments -- + +Warning: urlencode() expects exactly 1 parameter, 2 given in %s on line 20 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/url/urlencode_variation_001.phpt b/ext/standard/tests/url/urlencode_variation_001.phpt new file mode 100644 index 0000000..04d0921 --- /dev/null +++ b/ext/standard/tests/url/urlencode_variation_001.phpt @@ -0,0 +1,173 @@ +--TEST-- +Test urlencode() function : usage variations - +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for str + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( urlencode($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing urlencode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(13) "1.07654321E-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %surlencode_variation_001.php(%d) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %surlencode_variation_001.php(%d) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %surlencode_variation_001.php(%d) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %surlencode_variation_001.php(%d) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %surlencode_variation_001.php(%d) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 2 - urlencode() expects parameter 1 to be string, object given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done \ No newline at end of file diff --git a/ext/standard/tests/url/urls.inc b/ext/standard/tests/url/urls.inc new file mode 100644 index 0000000..27521c8 --- /dev/null +++ b/ext/standard/tests/url/urls.inc @@ -0,0 +1,109 @@ + \ No newline at end of file diff --git a/ext/standard/tests/versioning/php_sapi_name.phpt b/ext/standard/tests/versioning/php_sapi_name.phpt new file mode 100644 index 0000000..c9d4988 --- /dev/null +++ b/ext/standard/tests/versioning/php_sapi_name.phpt @@ -0,0 +1,9 @@ +--TEST-- +php_sapi_name test +--FILE-- + +--EXPECT-- +cgi-fcgi diff --git a/ext/standard/tests/versioning/version_compare.phpt b/ext/standard/tests/versioning/version_compare.phpt new file mode 100644 index 0000000..145fb93 --- /dev/null +++ b/ext/standard/tests/versioning/version_compare.phpt @@ -0,0 +1,795 @@ +--TEST-- +version_compare test +--FILE-- +", + "ge", ">=", + "eq", "=", "==", + "ne", "<>", "!=" +); +test("1", "2"); +test("10", "2"); +test("1.0", "1.1"); +test("1.2", "1.0.1"); +foreach ($special_forms as $f1) { + foreach ($special_forms as $f2) { + test("1.0$f1", "1.0$f2"); + } +} +print "TESTING OPERATORS\n"; +foreach ($special_forms as $f1) { + foreach ($special_forms as $f2) { + foreach ($operators as $op) { + $v1 = "1.0$f1"; + $v2 = "1.0$f2"; + $test = version_compare($v1, $v2, $op) ? "true" : "false"; + printf("%7s %2s %-7s : %s\n", $v1, $op, $v2, $test); + } + } +} + +function test($v1, $v2) { + $compare = version_compare($v1, $v2); + switch ($compare) { + case -1: + print "$v1 < $v2\n"; + break; + case 1: + print "$v1 > $v2\n"; + break; + case 0: + default: + print "$v1 = $v2\n"; + break; + } +} + +?> +--EXPECT-- +TESTING COMPARE +1 < 2 +10 > 2 +1.0 < 1.1 +1.2 > 1.0.1 +1.0-dev = 1.0-dev +1.0-dev < 1.0a1 +1.0-dev < 1.0b1 +1.0-dev < 1.0RC1 +1.0-dev < 1.0rc1 +1.0-dev < 1.0 +1.0-dev < 1.0pl1 +1.0a1 > 1.0-dev +1.0a1 = 1.0a1 +1.0a1 < 1.0b1 +1.0a1 < 1.0RC1 +1.0a1 < 1.0rc1 +1.0a1 < 1.0 +1.0a1 < 1.0pl1 +1.0b1 > 1.0-dev +1.0b1 > 1.0a1 +1.0b1 = 1.0b1 +1.0b1 < 1.0RC1 +1.0b1 < 1.0rc1 +1.0b1 < 1.0 +1.0b1 < 1.0pl1 +1.0RC1 > 1.0-dev +1.0RC1 > 1.0a1 +1.0RC1 > 1.0b1 +1.0RC1 = 1.0RC1 +1.0RC1 = 1.0rc1 +1.0RC1 < 1.0 +1.0RC1 < 1.0pl1 +1.0rc1 > 1.0-dev +1.0rc1 > 1.0a1 +1.0rc1 > 1.0b1 +1.0rc1 = 1.0RC1 +1.0rc1 = 1.0rc1 +1.0rc1 < 1.0 +1.0rc1 < 1.0pl1 +1.0 > 1.0-dev +1.0 > 1.0a1 +1.0 > 1.0b1 +1.0 > 1.0RC1 +1.0 > 1.0rc1 +1.0 = 1.0 +1.0 < 1.0pl1 +1.0pl1 > 1.0-dev +1.0pl1 > 1.0a1 +1.0pl1 > 1.0b1 +1.0pl1 > 1.0RC1 +1.0pl1 > 1.0rc1 +1.0pl1 > 1.0 +1.0pl1 = 1.0pl1 +TESTING OPERATORS +1.0-dev lt 1.0-dev : false +1.0-dev < 1.0-dev : false +1.0-dev le 1.0-dev : true +1.0-dev <= 1.0-dev : true +1.0-dev gt 1.0-dev : false +1.0-dev > 1.0-dev : false +1.0-dev ge 1.0-dev : true +1.0-dev >= 1.0-dev : true +1.0-dev eq 1.0-dev : true +1.0-dev = 1.0-dev : true +1.0-dev == 1.0-dev : true +1.0-dev ne 1.0-dev : false +1.0-dev <> 1.0-dev : false +1.0-dev != 1.0-dev : false +1.0-dev lt 1.0a1 : true +1.0-dev < 1.0a1 : true +1.0-dev le 1.0a1 : true +1.0-dev <= 1.0a1 : true +1.0-dev gt 1.0a1 : false +1.0-dev > 1.0a1 : false +1.0-dev ge 1.0a1 : false +1.0-dev >= 1.0a1 : false +1.0-dev eq 1.0a1 : false +1.0-dev = 1.0a1 : false +1.0-dev == 1.0a1 : false +1.0-dev ne 1.0a1 : true +1.0-dev <> 1.0a1 : true +1.0-dev != 1.0a1 : true +1.0-dev lt 1.0b1 : true +1.0-dev < 1.0b1 : true +1.0-dev le 1.0b1 : true +1.0-dev <= 1.0b1 : true +1.0-dev gt 1.0b1 : false +1.0-dev > 1.0b1 : false +1.0-dev ge 1.0b1 : false +1.0-dev >= 1.0b1 : false +1.0-dev eq 1.0b1 : false +1.0-dev = 1.0b1 : false +1.0-dev == 1.0b1 : false +1.0-dev ne 1.0b1 : true +1.0-dev <> 1.0b1 : true +1.0-dev != 1.0b1 : true +1.0-dev lt 1.0RC1 : true +1.0-dev < 1.0RC1 : true +1.0-dev le 1.0RC1 : true +1.0-dev <= 1.0RC1 : true +1.0-dev gt 1.0RC1 : false +1.0-dev > 1.0RC1 : false +1.0-dev ge 1.0RC1 : false +1.0-dev >= 1.0RC1 : false +1.0-dev eq 1.0RC1 : false +1.0-dev = 1.0RC1 : false +1.0-dev == 1.0RC1 : false +1.0-dev ne 1.0RC1 : true +1.0-dev <> 1.0RC1 : true +1.0-dev != 1.0RC1 : true +1.0-dev lt 1.0rc1 : true +1.0-dev < 1.0rc1 : true +1.0-dev le 1.0rc1 : true +1.0-dev <= 1.0rc1 : true +1.0-dev gt 1.0rc1 : false +1.0-dev > 1.0rc1 : false +1.0-dev ge 1.0rc1 : false +1.0-dev >= 1.0rc1 : false +1.0-dev eq 1.0rc1 : false +1.0-dev = 1.0rc1 : false +1.0-dev == 1.0rc1 : false +1.0-dev ne 1.0rc1 : true +1.0-dev <> 1.0rc1 : true +1.0-dev != 1.0rc1 : true +1.0-dev lt 1.0 : true +1.0-dev < 1.0 : true +1.0-dev le 1.0 : true +1.0-dev <= 1.0 : true +1.0-dev gt 1.0 : false +1.0-dev > 1.0 : false +1.0-dev ge 1.0 : false +1.0-dev >= 1.0 : false +1.0-dev eq 1.0 : false +1.0-dev = 1.0 : false +1.0-dev == 1.0 : false +1.0-dev ne 1.0 : true +1.0-dev <> 1.0 : true +1.0-dev != 1.0 : true +1.0-dev lt 1.0pl1 : true +1.0-dev < 1.0pl1 : true +1.0-dev le 1.0pl1 : true +1.0-dev <= 1.0pl1 : true +1.0-dev gt 1.0pl1 : false +1.0-dev > 1.0pl1 : false +1.0-dev ge 1.0pl1 : false +1.0-dev >= 1.0pl1 : false +1.0-dev eq 1.0pl1 : false +1.0-dev = 1.0pl1 : false +1.0-dev == 1.0pl1 : false +1.0-dev ne 1.0pl1 : true +1.0-dev <> 1.0pl1 : true +1.0-dev != 1.0pl1 : true + 1.0a1 lt 1.0-dev : false + 1.0a1 < 1.0-dev : false + 1.0a1 le 1.0-dev : false + 1.0a1 <= 1.0-dev : false + 1.0a1 gt 1.0-dev : true + 1.0a1 > 1.0-dev : true + 1.0a1 ge 1.0-dev : true + 1.0a1 >= 1.0-dev : true + 1.0a1 eq 1.0-dev : false + 1.0a1 = 1.0-dev : false + 1.0a1 == 1.0-dev : false + 1.0a1 ne 1.0-dev : true + 1.0a1 <> 1.0-dev : true + 1.0a1 != 1.0-dev : true + 1.0a1 lt 1.0a1 : false + 1.0a1 < 1.0a1 : false + 1.0a1 le 1.0a1 : true + 1.0a1 <= 1.0a1 : true + 1.0a1 gt 1.0a1 : false + 1.0a1 > 1.0a1 : false + 1.0a1 ge 1.0a1 : true + 1.0a1 >= 1.0a1 : true + 1.0a1 eq 1.0a1 : true + 1.0a1 = 1.0a1 : true + 1.0a1 == 1.0a1 : true + 1.0a1 ne 1.0a1 : false + 1.0a1 <> 1.0a1 : false + 1.0a1 != 1.0a1 : false + 1.0a1 lt 1.0b1 : true + 1.0a1 < 1.0b1 : true + 1.0a1 le 1.0b1 : true + 1.0a1 <= 1.0b1 : true + 1.0a1 gt 1.0b1 : false + 1.0a1 > 1.0b1 : false + 1.0a1 ge 1.0b1 : false + 1.0a1 >= 1.0b1 : false + 1.0a1 eq 1.0b1 : false + 1.0a1 = 1.0b1 : false + 1.0a1 == 1.0b1 : false + 1.0a1 ne 1.0b1 : true + 1.0a1 <> 1.0b1 : true + 1.0a1 != 1.0b1 : true + 1.0a1 lt 1.0RC1 : true + 1.0a1 < 1.0RC1 : true + 1.0a1 le 1.0RC1 : true + 1.0a1 <= 1.0RC1 : true + 1.0a1 gt 1.0RC1 : false + 1.0a1 > 1.0RC1 : false + 1.0a1 ge 1.0RC1 : false + 1.0a1 >= 1.0RC1 : false + 1.0a1 eq 1.0RC1 : false + 1.0a1 = 1.0RC1 : false + 1.0a1 == 1.0RC1 : false + 1.0a1 ne 1.0RC1 : true + 1.0a1 <> 1.0RC1 : true + 1.0a1 != 1.0RC1 : true + 1.0a1 lt 1.0rc1 : true + 1.0a1 < 1.0rc1 : true + 1.0a1 le 1.0rc1 : true + 1.0a1 <= 1.0rc1 : true + 1.0a1 gt 1.0rc1 : false + 1.0a1 > 1.0rc1 : false + 1.0a1 ge 1.0rc1 : false + 1.0a1 >= 1.0rc1 : false + 1.0a1 eq 1.0rc1 : false + 1.0a1 = 1.0rc1 : false + 1.0a1 == 1.0rc1 : false + 1.0a1 ne 1.0rc1 : true + 1.0a1 <> 1.0rc1 : true + 1.0a1 != 1.0rc1 : true + 1.0a1 lt 1.0 : true + 1.0a1 < 1.0 : true + 1.0a1 le 1.0 : true + 1.0a1 <= 1.0 : true + 1.0a1 gt 1.0 : false + 1.0a1 > 1.0 : false + 1.0a1 ge 1.0 : false + 1.0a1 >= 1.0 : false + 1.0a1 eq 1.0 : false + 1.0a1 = 1.0 : false + 1.0a1 == 1.0 : false + 1.0a1 ne 1.0 : true + 1.0a1 <> 1.0 : true + 1.0a1 != 1.0 : true + 1.0a1 lt 1.0pl1 : true + 1.0a1 < 1.0pl1 : true + 1.0a1 le 1.0pl1 : true + 1.0a1 <= 1.0pl1 : true + 1.0a1 gt 1.0pl1 : false + 1.0a1 > 1.0pl1 : false + 1.0a1 ge 1.0pl1 : false + 1.0a1 >= 1.0pl1 : false + 1.0a1 eq 1.0pl1 : false + 1.0a1 = 1.0pl1 : false + 1.0a1 == 1.0pl1 : false + 1.0a1 ne 1.0pl1 : true + 1.0a1 <> 1.0pl1 : true + 1.0a1 != 1.0pl1 : true + 1.0b1 lt 1.0-dev : false + 1.0b1 < 1.0-dev : false + 1.0b1 le 1.0-dev : false + 1.0b1 <= 1.0-dev : false + 1.0b1 gt 1.0-dev : true + 1.0b1 > 1.0-dev : true + 1.0b1 ge 1.0-dev : true + 1.0b1 >= 1.0-dev : true + 1.0b1 eq 1.0-dev : false + 1.0b1 = 1.0-dev : false + 1.0b1 == 1.0-dev : false + 1.0b1 ne 1.0-dev : true + 1.0b1 <> 1.0-dev : true + 1.0b1 != 1.0-dev : true + 1.0b1 lt 1.0a1 : false + 1.0b1 < 1.0a1 : false + 1.0b1 le 1.0a1 : false + 1.0b1 <= 1.0a1 : false + 1.0b1 gt 1.0a1 : true + 1.0b1 > 1.0a1 : true + 1.0b1 ge 1.0a1 : true + 1.0b1 >= 1.0a1 : true + 1.0b1 eq 1.0a1 : false + 1.0b1 = 1.0a1 : false + 1.0b1 == 1.0a1 : false + 1.0b1 ne 1.0a1 : true + 1.0b1 <> 1.0a1 : true + 1.0b1 != 1.0a1 : true + 1.0b1 lt 1.0b1 : false + 1.0b1 < 1.0b1 : false + 1.0b1 le 1.0b1 : true + 1.0b1 <= 1.0b1 : true + 1.0b1 gt 1.0b1 : false + 1.0b1 > 1.0b1 : false + 1.0b1 ge 1.0b1 : true + 1.0b1 >= 1.0b1 : true + 1.0b1 eq 1.0b1 : true + 1.0b1 = 1.0b1 : true + 1.0b1 == 1.0b1 : true + 1.0b1 ne 1.0b1 : false + 1.0b1 <> 1.0b1 : false + 1.0b1 != 1.0b1 : false + 1.0b1 lt 1.0RC1 : true + 1.0b1 < 1.0RC1 : true + 1.0b1 le 1.0RC1 : true + 1.0b1 <= 1.0RC1 : true + 1.0b1 gt 1.0RC1 : false + 1.0b1 > 1.0RC1 : false + 1.0b1 ge 1.0RC1 : false + 1.0b1 >= 1.0RC1 : false + 1.0b1 eq 1.0RC1 : false + 1.0b1 = 1.0RC1 : false + 1.0b1 == 1.0RC1 : false + 1.0b1 ne 1.0RC1 : true + 1.0b1 <> 1.0RC1 : true + 1.0b1 != 1.0RC1 : true + 1.0b1 lt 1.0rc1 : true + 1.0b1 < 1.0rc1 : true + 1.0b1 le 1.0rc1 : true + 1.0b1 <= 1.0rc1 : true + 1.0b1 gt 1.0rc1 : false + 1.0b1 > 1.0rc1 : false + 1.0b1 ge 1.0rc1 : false + 1.0b1 >= 1.0rc1 : false + 1.0b1 eq 1.0rc1 : false + 1.0b1 = 1.0rc1 : false + 1.0b1 == 1.0rc1 : false + 1.0b1 ne 1.0rc1 : true + 1.0b1 <> 1.0rc1 : true + 1.0b1 != 1.0rc1 : true + 1.0b1 lt 1.0 : true + 1.0b1 < 1.0 : true + 1.0b1 le 1.0 : true + 1.0b1 <= 1.0 : true + 1.0b1 gt 1.0 : false + 1.0b1 > 1.0 : false + 1.0b1 ge 1.0 : false + 1.0b1 >= 1.0 : false + 1.0b1 eq 1.0 : false + 1.0b1 = 1.0 : false + 1.0b1 == 1.0 : false + 1.0b1 ne 1.0 : true + 1.0b1 <> 1.0 : true + 1.0b1 != 1.0 : true + 1.0b1 lt 1.0pl1 : true + 1.0b1 < 1.0pl1 : true + 1.0b1 le 1.0pl1 : true + 1.0b1 <= 1.0pl1 : true + 1.0b1 gt 1.0pl1 : false + 1.0b1 > 1.0pl1 : false + 1.0b1 ge 1.0pl1 : false + 1.0b1 >= 1.0pl1 : false + 1.0b1 eq 1.0pl1 : false + 1.0b1 = 1.0pl1 : false + 1.0b1 == 1.0pl1 : false + 1.0b1 ne 1.0pl1 : true + 1.0b1 <> 1.0pl1 : true + 1.0b1 != 1.0pl1 : true + 1.0RC1 lt 1.0-dev : false + 1.0RC1 < 1.0-dev : false + 1.0RC1 le 1.0-dev : false + 1.0RC1 <= 1.0-dev : false + 1.0RC1 gt 1.0-dev : true + 1.0RC1 > 1.0-dev : true + 1.0RC1 ge 1.0-dev : true + 1.0RC1 >= 1.0-dev : true + 1.0RC1 eq 1.0-dev : false + 1.0RC1 = 1.0-dev : false + 1.0RC1 == 1.0-dev : false + 1.0RC1 ne 1.0-dev : true + 1.0RC1 <> 1.0-dev : true + 1.0RC1 != 1.0-dev : true + 1.0RC1 lt 1.0a1 : false + 1.0RC1 < 1.0a1 : false + 1.0RC1 le 1.0a1 : false + 1.0RC1 <= 1.0a1 : false + 1.0RC1 gt 1.0a1 : true + 1.0RC1 > 1.0a1 : true + 1.0RC1 ge 1.0a1 : true + 1.0RC1 >= 1.0a1 : true + 1.0RC1 eq 1.0a1 : false + 1.0RC1 = 1.0a1 : false + 1.0RC1 == 1.0a1 : false + 1.0RC1 ne 1.0a1 : true + 1.0RC1 <> 1.0a1 : true + 1.0RC1 != 1.0a1 : true + 1.0RC1 lt 1.0b1 : false + 1.0RC1 < 1.0b1 : false + 1.0RC1 le 1.0b1 : false + 1.0RC1 <= 1.0b1 : false + 1.0RC1 gt 1.0b1 : true + 1.0RC1 > 1.0b1 : true + 1.0RC1 ge 1.0b1 : true + 1.0RC1 >= 1.0b1 : true + 1.0RC1 eq 1.0b1 : false + 1.0RC1 = 1.0b1 : false + 1.0RC1 == 1.0b1 : false + 1.0RC1 ne 1.0b1 : true + 1.0RC1 <> 1.0b1 : true + 1.0RC1 != 1.0b1 : true + 1.0RC1 lt 1.0RC1 : false + 1.0RC1 < 1.0RC1 : false + 1.0RC1 le 1.0RC1 : true + 1.0RC1 <= 1.0RC1 : true + 1.0RC1 gt 1.0RC1 : false + 1.0RC1 > 1.0RC1 : false + 1.0RC1 ge 1.0RC1 : true + 1.0RC1 >= 1.0RC1 : true + 1.0RC1 eq 1.0RC1 : true + 1.0RC1 = 1.0RC1 : true + 1.0RC1 == 1.0RC1 : true + 1.0RC1 ne 1.0RC1 : false + 1.0RC1 <> 1.0RC1 : false + 1.0RC1 != 1.0RC1 : false + 1.0RC1 lt 1.0rc1 : false + 1.0RC1 < 1.0rc1 : false + 1.0RC1 le 1.0rc1 : true + 1.0RC1 <= 1.0rc1 : true + 1.0RC1 gt 1.0rc1 : false + 1.0RC1 > 1.0rc1 : false + 1.0RC1 ge 1.0rc1 : true + 1.0RC1 >= 1.0rc1 : true + 1.0RC1 eq 1.0rc1 : true + 1.0RC1 = 1.0rc1 : true + 1.0RC1 == 1.0rc1 : true + 1.0RC1 ne 1.0rc1 : false + 1.0RC1 <> 1.0rc1 : false + 1.0RC1 != 1.0rc1 : false + 1.0RC1 lt 1.0 : true + 1.0RC1 < 1.0 : true + 1.0RC1 le 1.0 : true + 1.0RC1 <= 1.0 : true + 1.0RC1 gt 1.0 : false + 1.0RC1 > 1.0 : false + 1.0RC1 ge 1.0 : false + 1.0RC1 >= 1.0 : false + 1.0RC1 eq 1.0 : false + 1.0RC1 = 1.0 : false + 1.0RC1 == 1.0 : false + 1.0RC1 ne 1.0 : true + 1.0RC1 <> 1.0 : true + 1.0RC1 != 1.0 : true + 1.0RC1 lt 1.0pl1 : true + 1.0RC1 < 1.0pl1 : true + 1.0RC1 le 1.0pl1 : true + 1.0RC1 <= 1.0pl1 : true + 1.0RC1 gt 1.0pl1 : false + 1.0RC1 > 1.0pl1 : false + 1.0RC1 ge 1.0pl1 : false + 1.0RC1 >= 1.0pl1 : false + 1.0RC1 eq 1.0pl1 : false + 1.0RC1 = 1.0pl1 : false + 1.0RC1 == 1.0pl1 : false + 1.0RC1 ne 1.0pl1 : true + 1.0RC1 <> 1.0pl1 : true + 1.0RC1 != 1.0pl1 : true + 1.0rc1 lt 1.0-dev : false + 1.0rc1 < 1.0-dev : false + 1.0rc1 le 1.0-dev : false + 1.0rc1 <= 1.0-dev : false + 1.0rc1 gt 1.0-dev : true + 1.0rc1 > 1.0-dev : true + 1.0rc1 ge 1.0-dev : true + 1.0rc1 >= 1.0-dev : true + 1.0rc1 eq 1.0-dev : false + 1.0rc1 = 1.0-dev : false + 1.0rc1 == 1.0-dev : false + 1.0rc1 ne 1.0-dev : true + 1.0rc1 <> 1.0-dev : true + 1.0rc1 != 1.0-dev : true + 1.0rc1 lt 1.0a1 : false + 1.0rc1 < 1.0a1 : false + 1.0rc1 le 1.0a1 : false + 1.0rc1 <= 1.0a1 : false + 1.0rc1 gt 1.0a1 : true + 1.0rc1 > 1.0a1 : true + 1.0rc1 ge 1.0a1 : true + 1.0rc1 >= 1.0a1 : true + 1.0rc1 eq 1.0a1 : false + 1.0rc1 = 1.0a1 : false + 1.0rc1 == 1.0a1 : false + 1.0rc1 ne 1.0a1 : true + 1.0rc1 <> 1.0a1 : true + 1.0rc1 != 1.0a1 : true + 1.0rc1 lt 1.0b1 : false + 1.0rc1 < 1.0b1 : false + 1.0rc1 le 1.0b1 : false + 1.0rc1 <= 1.0b1 : false + 1.0rc1 gt 1.0b1 : true + 1.0rc1 > 1.0b1 : true + 1.0rc1 ge 1.0b1 : true + 1.0rc1 >= 1.0b1 : true + 1.0rc1 eq 1.0b1 : false + 1.0rc1 = 1.0b1 : false + 1.0rc1 == 1.0b1 : false + 1.0rc1 ne 1.0b1 : true + 1.0rc1 <> 1.0b1 : true + 1.0rc1 != 1.0b1 : true + 1.0rc1 lt 1.0RC1 : false + 1.0rc1 < 1.0RC1 : false + 1.0rc1 le 1.0RC1 : true + 1.0rc1 <= 1.0RC1 : true + 1.0rc1 gt 1.0RC1 : false + 1.0rc1 > 1.0RC1 : false + 1.0rc1 ge 1.0RC1 : true + 1.0rc1 >= 1.0RC1 : true + 1.0rc1 eq 1.0RC1 : true + 1.0rc1 = 1.0RC1 : true + 1.0rc1 == 1.0RC1 : true + 1.0rc1 ne 1.0RC1 : false + 1.0rc1 <> 1.0RC1 : false + 1.0rc1 != 1.0RC1 : false + 1.0rc1 lt 1.0rc1 : false + 1.0rc1 < 1.0rc1 : false + 1.0rc1 le 1.0rc1 : true + 1.0rc1 <= 1.0rc1 : true + 1.0rc1 gt 1.0rc1 : false + 1.0rc1 > 1.0rc1 : false + 1.0rc1 ge 1.0rc1 : true + 1.0rc1 >= 1.0rc1 : true + 1.0rc1 eq 1.0rc1 : true + 1.0rc1 = 1.0rc1 : true + 1.0rc1 == 1.0rc1 : true + 1.0rc1 ne 1.0rc1 : false + 1.0rc1 <> 1.0rc1 : false + 1.0rc1 != 1.0rc1 : false + 1.0rc1 lt 1.0 : true + 1.0rc1 < 1.0 : true + 1.0rc1 le 1.0 : true + 1.0rc1 <= 1.0 : true + 1.0rc1 gt 1.0 : false + 1.0rc1 > 1.0 : false + 1.0rc1 ge 1.0 : false + 1.0rc1 >= 1.0 : false + 1.0rc1 eq 1.0 : false + 1.0rc1 = 1.0 : false + 1.0rc1 == 1.0 : false + 1.0rc1 ne 1.0 : true + 1.0rc1 <> 1.0 : true + 1.0rc1 != 1.0 : true + 1.0rc1 lt 1.0pl1 : true + 1.0rc1 < 1.0pl1 : true + 1.0rc1 le 1.0pl1 : true + 1.0rc1 <= 1.0pl1 : true + 1.0rc1 gt 1.0pl1 : false + 1.0rc1 > 1.0pl1 : false + 1.0rc1 ge 1.0pl1 : false + 1.0rc1 >= 1.0pl1 : false + 1.0rc1 eq 1.0pl1 : false + 1.0rc1 = 1.0pl1 : false + 1.0rc1 == 1.0pl1 : false + 1.0rc1 ne 1.0pl1 : true + 1.0rc1 <> 1.0pl1 : true + 1.0rc1 != 1.0pl1 : true + 1.0 lt 1.0-dev : false + 1.0 < 1.0-dev : false + 1.0 le 1.0-dev : false + 1.0 <= 1.0-dev : false + 1.0 gt 1.0-dev : true + 1.0 > 1.0-dev : true + 1.0 ge 1.0-dev : true + 1.0 >= 1.0-dev : true + 1.0 eq 1.0-dev : false + 1.0 = 1.0-dev : false + 1.0 == 1.0-dev : false + 1.0 ne 1.0-dev : true + 1.0 <> 1.0-dev : true + 1.0 != 1.0-dev : true + 1.0 lt 1.0a1 : false + 1.0 < 1.0a1 : false + 1.0 le 1.0a1 : false + 1.0 <= 1.0a1 : false + 1.0 gt 1.0a1 : true + 1.0 > 1.0a1 : true + 1.0 ge 1.0a1 : true + 1.0 >= 1.0a1 : true + 1.0 eq 1.0a1 : false + 1.0 = 1.0a1 : false + 1.0 == 1.0a1 : false + 1.0 ne 1.0a1 : true + 1.0 <> 1.0a1 : true + 1.0 != 1.0a1 : true + 1.0 lt 1.0b1 : false + 1.0 < 1.0b1 : false + 1.0 le 1.0b1 : false + 1.0 <= 1.0b1 : false + 1.0 gt 1.0b1 : true + 1.0 > 1.0b1 : true + 1.0 ge 1.0b1 : true + 1.0 >= 1.0b1 : true + 1.0 eq 1.0b1 : false + 1.0 = 1.0b1 : false + 1.0 == 1.0b1 : false + 1.0 ne 1.0b1 : true + 1.0 <> 1.0b1 : true + 1.0 != 1.0b1 : true + 1.0 lt 1.0RC1 : false + 1.0 < 1.0RC1 : false + 1.0 le 1.0RC1 : false + 1.0 <= 1.0RC1 : false + 1.0 gt 1.0RC1 : true + 1.0 > 1.0RC1 : true + 1.0 ge 1.0RC1 : true + 1.0 >= 1.0RC1 : true + 1.0 eq 1.0RC1 : false + 1.0 = 1.0RC1 : false + 1.0 == 1.0RC1 : false + 1.0 ne 1.0RC1 : true + 1.0 <> 1.0RC1 : true + 1.0 != 1.0RC1 : true + 1.0 lt 1.0rc1 : false + 1.0 < 1.0rc1 : false + 1.0 le 1.0rc1 : false + 1.0 <= 1.0rc1 : false + 1.0 gt 1.0rc1 : true + 1.0 > 1.0rc1 : true + 1.0 ge 1.0rc1 : true + 1.0 >= 1.0rc1 : true + 1.0 eq 1.0rc1 : false + 1.0 = 1.0rc1 : false + 1.0 == 1.0rc1 : false + 1.0 ne 1.0rc1 : true + 1.0 <> 1.0rc1 : true + 1.0 != 1.0rc1 : true + 1.0 lt 1.0 : false + 1.0 < 1.0 : false + 1.0 le 1.0 : true + 1.0 <= 1.0 : true + 1.0 gt 1.0 : false + 1.0 > 1.0 : false + 1.0 ge 1.0 : true + 1.0 >= 1.0 : true + 1.0 eq 1.0 : true + 1.0 = 1.0 : true + 1.0 == 1.0 : true + 1.0 ne 1.0 : false + 1.0 <> 1.0 : false + 1.0 != 1.0 : false + 1.0 lt 1.0pl1 : true + 1.0 < 1.0pl1 : true + 1.0 le 1.0pl1 : true + 1.0 <= 1.0pl1 : true + 1.0 gt 1.0pl1 : false + 1.0 > 1.0pl1 : false + 1.0 ge 1.0pl1 : false + 1.0 >= 1.0pl1 : false + 1.0 eq 1.0pl1 : false + 1.0 = 1.0pl1 : false + 1.0 == 1.0pl1 : false + 1.0 ne 1.0pl1 : true + 1.0 <> 1.0pl1 : true + 1.0 != 1.0pl1 : true + 1.0pl1 lt 1.0-dev : false + 1.0pl1 < 1.0-dev : false + 1.0pl1 le 1.0-dev : false + 1.0pl1 <= 1.0-dev : false + 1.0pl1 gt 1.0-dev : true + 1.0pl1 > 1.0-dev : true + 1.0pl1 ge 1.0-dev : true + 1.0pl1 >= 1.0-dev : true + 1.0pl1 eq 1.0-dev : false + 1.0pl1 = 1.0-dev : false + 1.0pl1 == 1.0-dev : false + 1.0pl1 ne 1.0-dev : true + 1.0pl1 <> 1.0-dev : true + 1.0pl1 != 1.0-dev : true + 1.0pl1 lt 1.0a1 : false + 1.0pl1 < 1.0a1 : false + 1.0pl1 le 1.0a1 : false + 1.0pl1 <= 1.0a1 : false + 1.0pl1 gt 1.0a1 : true + 1.0pl1 > 1.0a1 : true + 1.0pl1 ge 1.0a1 : true + 1.0pl1 >= 1.0a1 : true + 1.0pl1 eq 1.0a1 : false + 1.0pl1 = 1.0a1 : false + 1.0pl1 == 1.0a1 : false + 1.0pl1 ne 1.0a1 : true + 1.0pl1 <> 1.0a1 : true + 1.0pl1 != 1.0a1 : true + 1.0pl1 lt 1.0b1 : false + 1.0pl1 < 1.0b1 : false + 1.0pl1 le 1.0b1 : false + 1.0pl1 <= 1.0b1 : false + 1.0pl1 gt 1.0b1 : true + 1.0pl1 > 1.0b1 : true + 1.0pl1 ge 1.0b1 : true + 1.0pl1 >= 1.0b1 : true + 1.0pl1 eq 1.0b1 : false + 1.0pl1 = 1.0b1 : false + 1.0pl1 == 1.0b1 : false + 1.0pl1 ne 1.0b1 : true + 1.0pl1 <> 1.0b1 : true + 1.0pl1 != 1.0b1 : true + 1.0pl1 lt 1.0RC1 : false + 1.0pl1 < 1.0RC1 : false + 1.0pl1 le 1.0RC1 : false + 1.0pl1 <= 1.0RC1 : false + 1.0pl1 gt 1.0RC1 : true + 1.0pl1 > 1.0RC1 : true + 1.0pl1 ge 1.0RC1 : true + 1.0pl1 >= 1.0RC1 : true + 1.0pl1 eq 1.0RC1 : false + 1.0pl1 = 1.0RC1 : false + 1.0pl1 == 1.0RC1 : false + 1.0pl1 ne 1.0RC1 : true + 1.0pl1 <> 1.0RC1 : true + 1.0pl1 != 1.0RC1 : true + 1.0pl1 lt 1.0rc1 : false + 1.0pl1 < 1.0rc1 : false + 1.0pl1 le 1.0rc1 : false + 1.0pl1 <= 1.0rc1 : false + 1.0pl1 gt 1.0rc1 : true + 1.0pl1 > 1.0rc1 : true + 1.0pl1 ge 1.0rc1 : true + 1.0pl1 >= 1.0rc1 : true + 1.0pl1 eq 1.0rc1 : false + 1.0pl1 = 1.0rc1 : false + 1.0pl1 == 1.0rc1 : false + 1.0pl1 ne 1.0rc1 : true + 1.0pl1 <> 1.0rc1 : true + 1.0pl1 != 1.0rc1 : true + 1.0pl1 lt 1.0 : false + 1.0pl1 < 1.0 : false + 1.0pl1 le 1.0 : false + 1.0pl1 <= 1.0 : false + 1.0pl1 gt 1.0 : true + 1.0pl1 > 1.0 : true + 1.0pl1 ge 1.0 : true + 1.0pl1 >= 1.0 : true + 1.0pl1 eq 1.0 : false + 1.0pl1 = 1.0 : false + 1.0pl1 == 1.0 : false + 1.0pl1 ne 1.0 : true + 1.0pl1 <> 1.0 : true + 1.0pl1 != 1.0 : true + 1.0pl1 lt 1.0pl1 : false + 1.0pl1 < 1.0pl1 : false + 1.0pl1 le 1.0pl1 : true + 1.0pl1 <= 1.0pl1 : true + 1.0pl1 gt 1.0pl1 : false + 1.0pl1 > 1.0pl1 : false + 1.0pl1 ge 1.0pl1 : true + 1.0pl1 >= 1.0pl1 : true + 1.0pl1 eq 1.0pl1 : true + 1.0pl1 = 1.0pl1 : true + 1.0pl1 == 1.0pl1 : true + 1.0pl1 ne 1.0pl1 : false + 1.0pl1 <> 1.0pl1 : false + 1.0pl1 != 1.0pl1 : false \ No newline at end of file diff --git a/ext/standard/tests/zend_logo_guid.phpt b/ext/standard/tests/zend_logo_guid.phpt new file mode 100644 index 0000000..44e213b --- /dev/null +++ b/ext/standard/tests/zend_logo_guid.phpt @@ -0,0 +1,12 @@ +--TEST-- +Checking the zend_logo_guid() function +--CREDITS-- +Sebastian SchÃŒrmann +sschuermann@chip.de +Testfest 2009 Munich +--FILE-- + +--EXPECT-- +PHPE9568F35-D428-11d2-A769-00AA001ACF42 diff --git a/ext/standard/type.c b/ext/standard/type.c new file mode 100644 index 0000000..5c4085a --- /dev/null +++ b/ext/standard/type.c @@ -0,0 +1,396 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Rasmus Lerdorf | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "php_incomplete_class.h" + +/* {{{ proto string gettype(mixed var) + Returns the type of the variable */ +PHP_FUNCTION(gettype) +{ + zval **arg; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) == FAILURE) { + return; + } + + switch (Z_TYPE_PP(arg)) { + case IS_NULL: + RETVAL_STRING("NULL", 1); + break; + + case IS_BOOL: + RETVAL_STRING("boolean", 1); + break; + + case IS_LONG: + RETVAL_STRING("integer", 1); + break; + + case IS_DOUBLE: + RETVAL_STRING("double", 1); + break; + + case IS_STRING: + RETVAL_STRING("string", 1); + break; + + case IS_ARRAY: + RETVAL_STRING("array", 1); + break; + + case IS_OBJECT: + RETVAL_STRING("object", 1); + /* + { + 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, 0); + } + */ + break; + + case IS_RESOURCE: + { + const char *type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(arg) TSRMLS_CC); + + if (type_name) { + RETVAL_STRING("resource", 1); + break; + } + } + + default: + RETVAL_STRING("unknown type", 1); + } +} +/* }}} */ + +/* {{{ proto bool settype(mixed var, string type) + Set the type of the variable */ +PHP_FUNCTION(settype) +{ + zval **var; + char *type; + int type_len = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zs", &var, &type, &type_len) == FAILURE) { + return; + } + + if (!strcasecmp(type, "integer")) { + convert_to_long(*var); + } else if (!strcasecmp(type, "int")) { + convert_to_long(*var); + } else if (!strcasecmp(type, "float")) { + convert_to_double(*var); + } else if (!strcasecmp(type, "double")) { /* deprecated */ + convert_to_double(*var); + } else if (!strcasecmp(type, "string")) { + convert_to_string(*var); + } else if (!strcasecmp(type, "array")) { + convert_to_array(*var); + } else if (!strcasecmp(type, "object")) { + convert_to_object(*var); + } else if (!strcasecmp(type, "bool")) { + convert_to_boolean(*var); + } else if (!strcasecmp(type, "boolean")) { + convert_to_boolean(*var); + } else if (!strcasecmp(type, "null")) { + convert_to_null(*var); + } else if (!strcasecmp(type, "resource")) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot convert to resource type"); + RETURN_FALSE; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid type"); + RETURN_FALSE; + } + RETVAL_TRUE; +} +/* }}} */ + +/* {{{ proto int intval(mixed var [, int base]) + Get the integer value of a variable using the optional base for the conversion */ +PHP_FUNCTION(intval) +{ + zval **num; + long arg_base; + int base; + + switch (ZEND_NUM_ARGS()) { + case 1: + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &num) == FAILURE) { + return; + } + base = 10; + break; + + case 2: + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zl", &num, &arg_base) == FAILURE) { + return; + } + base = arg_base; + break; + + default: + WRONG_PARAM_COUNT; + } + + RETVAL_ZVAL(*num, 1, 0); + convert_to_long_base(return_value, base); +} +/* }}} */ + +/* {{{ proto float floatval(mixed var) + Get the float value of a variable */ +PHP_FUNCTION(floatval) +{ + zval **num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &num) == FAILURE) { + return; + } + + RETVAL_ZVAL(*num, 1, 0); + convert_to_double(return_value); +} +/* }}} */ + +/* {{{ proto string strval(mixed var) + Get the string value of a variable */ +PHP_FUNCTION(strval) +{ + zval **num, *tmp; + zval expr_copy; + int use_copy; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &num) == FAILURE) { + return; + } + + zend_make_printable_zval(*num, &expr_copy, &use_copy); + if (use_copy) { + tmp = &expr_copy; + RETVAL_ZVAL(tmp, 0, 0); + } else { + RETVAL_ZVAL(*num, 1, 0); + } +} +/* }}} */ + +static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type) +{ + zval **arg; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) == FAILURE) { + RETURN_FALSE; + } + + if (Z_TYPE_PP(arg) == type) { + if (type == IS_OBJECT) { + zend_class_entry *ce; + if(Z_OBJ_HT_PP(arg)->get_class_entry == NULL) { + /* if there's no get_class_entry it's not a PHP object, so it can't be INCOMPLETE_CLASS */ + RETURN_TRUE; + } + ce = Z_OBJCE_PP(arg); + if (!strcmp(ce->name, INCOMPLETE_CLASS)) { + RETURN_FALSE; + } + } + if (type == IS_RESOURCE) { + const char *type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(arg) TSRMLS_CC); + if (!type_name) { + RETURN_FALSE; + } + } + RETURN_TRUE; + } else { + RETURN_FALSE; + } +} + + +/* {{{ proto bool is_null(mixed var) + Returns true if variable is null */ +PHP_FUNCTION(is_null) +{ + php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_NULL); +} +/* }}} */ + +/* {{{ proto bool is_resource(mixed var) + Returns true if variable is a resource */ +PHP_FUNCTION(is_resource) +{ + php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_RESOURCE); +} +/* }}} */ + +/* {{{ proto bool is_bool(mixed var) + Returns true if variable is a boolean */ +PHP_FUNCTION(is_bool) +{ + php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_BOOL); +} +/* }}} */ + +/* {{{ proto bool is_long(mixed var) + Returns true if variable is a long (integer) */ +PHP_FUNCTION(is_long) +{ + php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_LONG); +} +/* }}} */ + +/* {{{ proto bool is_float(mixed var) + Returns true if variable is float point*/ +PHP_FUNCTION(is_float) +{ + php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_DOUBLE); +} +/* }}} */ + +/* {{{ proto bool is_string(mixed var) + Returns true if variable is a string */ +PHP_FUNCTION(is_string) +{ + php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_STRING); +} +/* }}} */ + +/* {{{ proto bool is_array(mixed var) + Returns true if variable is an array */ +PHP_FUNCTION(is_array) +{ + php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_ARRAY); +} +/* }}} */ + +/* {{{ proto bool is_object(mixed var) + Returns true if variable is an object */ +PHP_FUNCTION(is_object) +{ + php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_OBJECT); +} +/* }}} */ + +/* {{{ proto bool is_numeric(mixed value) + Returns true if value is a number or a numeric string */ +PHP_FUNCTION(is_numeric) +{ + zval **arg; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) == FAILURE) { + return; + } + + switch (Z_TYPE_PP(arg)) { + case IS_LONG: + case IS_DOUBLE: + RETURN_TRUE; + break; + + case IS_STRING: + if (is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), NULL, NULL, 0)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } + break; + + default: + RETURN_FALSE; + break; + } +} +/* }}} */ + +/* {{{ proto bool is_scalar(mixed value) + Returns true if value is a scalar */ +PHP_FUNCTION(is_scalar) +{ + zval **arg; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) == FAILURE) { + return; + } + + switch (Z_TYPE_PP(arg)) { + case IS_BOOL: + case IS_DOUBLE: + case IS_LONG: + case IS_STRING: + RETURN_TRUE; + break; + + default: + RETURN_FALSE; + break; + } +} +/* }}} */ + +/* {{{ proto bool is_callable(mixed var [, bool syntax_only [, string callable_name]]) + Returns true if var is callable. */ +PHP_FUNCTION(is_callable) +{ + zval *var, **callable_name = NULL; + char *name; + char *error; + zend_bool retval; + zend_bool syntax_only = 0; + int check_flags = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|bZ", &var, + &syntax_only, &callable_name) == FAILURE) { + return; + } + + if (syntax_only) { + check_flags |= IS_CALLABLE_CHECK_SYNTAX_ONLY; + } + if (ZEND_NUM_ARGS() > 2) { + retval = zend_is_callable_ex(var, NULL, check_flags, &name, NULL, NULL, &error TSRMLS_CC); + zval_dtor(*callable_name); + ZVAL_STRING(*callable_name, name, 0); + } else { + retval = zend_is_callable_ex(var, NULL, check_flags, NULL, NULL, NULL, &error TSRMLS_CC); + } + if (error) { + /* ignore errors */ + efree(error); + } + + RETURN_BOOL(retval); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c new file mode 100644 index 0000000..eac389c --- /dev/null +++ b/ext/standard/uniqid.c @@ -0,0 +1,96 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Stig Sæther Bakken | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#include "php.h" + +#include +#if HAVE_UNISTD_H +#include +#endif + +#include +#include + +#include +#ifdef PHP_WIN32 +#include "win32/time.h" +#else +#include +#endif + +#include "php_lcg.h" +#include "uniqid.h" + +/* {{{ proto string uniqid([string prefix [, bool more_entropy]]) + Generates a unique ID */ +#ifdef HAVE_GETTIMEOFDAY +PHP_FUNCTION(uniqid) +{ + char *prefix = ""; +#if defined(__CYGWIN__) + zend_bool more_entropy = 1; +#else + zend_bool more_entropy = 0; +#endif + char *uniqid; + int sec, usec, prefix_len = 0; + struct timeval tv; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sb", &prefix, &prefix_len, + &more_entropy)) { + return; + } + +#if HAVE_USLEEP && !defined(PHP_WIN32) + if (!more_entropy) { +#if defined(__CYGWIN__) + php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must use 'more entropy' under CYGWIN"); + RETURN_FALSE; +#else + usleep(1); +#endif + } +#endif + gettimeofday((struct timeval *) &tv, (struct timezone *) NULL); + sec = (int) tv.tv_sec; + usec = (int) (tv.tv_usec % 0x100000); + + /* The max value usec can have is 0xF423F, so we use only five hex + * digits for usecs. + */ + if (more_entropy) { + spprintf(&uniqid, 0, "%s%08x%05x%.8F", prefix, sec, usec, php_combined_lcg(TSRMLS_C) * 10); + } else { + spprintf(&uniqid, 0, "%s%08x%05x", prefix, sec, usec); + } + + RETURN_STRING(uniqid, 0); +} +#endif +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/uniqid.h b/ext/standard/uniqid.h new file mode 100644 index 0000000..1d08040 --- /dev/null +++ b/ext/standard/uniqid.h @@ -0,0 +1,28 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Stig Sæther Bakken | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#ifndef UNIQID_H +#define UNIQID_H + +#ifdef HAVE_GETTIMEOFDAY +PHP_FUNCTION(uniqid); +#endif + +#endif /* UNIQID_H */ diff --git a/ext/standard/url.c b/ext/standard/url.c new file mode 100644 index 0000000..94f6638 --- /dev/null +++ b/ext/standard/url.c @@ -0,0 +1,785 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Jim Winstead | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#include +#include +#include +#include + +#include "php.h" + +#include "url.h" +#include "file.h" +#ifdef _OSD_POSIX +#ifndef APACHE +#error On this EBCDIC platform, PHP is only supported as an Apache module. +#else /*APACHE*/ +#ifndef CHARSET_EBCDIC +#define CHARSET_EBCDIC /* this machine uses EBCDIC, not ASCII! */ +#endif +#include "ebcdic.h" +#endif /*APACHE*/ +#endif /*_OSD_POSIX*/ + +/* {{{ free_url + */ +PHPAPI void php_url_free(php_url *theurl) +{ + if (theurl->scheme) + efree(theurl->scheme); + if (theurl->user) + efree(theurl->user); + if (theurl->pass) + efree(theurl->pass); + if (theurl->host) + efree(theurl->host); + if (theurl->path) + efree(theurl->path); + if (theurl->query) + efree(theurl->query); + if (theurl->fragment) + efree(theurl->fragment); + efree(theurl); +} +/* }}} */ + +/* {{{ php_replace_controlchars + */ +PHPAPI char *php_replace_controlchars_ex(char *str, int len) +{ + unsigned char *s = (unsigned char *)str; + unsigned char *e = (unsigned char *)str + len; + + if (!str) { + return (NULL); + } + + while (s < e) { + + if (iscntrl(*s)) { + *s='_'; + } + s++; + } + + return (str); +} +/* }}} */ + +PHPAPI char *php_replace_controlchars(char *str) +{ + return php_replace_controlchars_ex(str, strlen(str)); +} + +PHPAPI php_url *php_url_parse(char const *str) +{ + return php_url_parse_ex(str, strlen(str)); +} + +/* {{{ php_url_parse + */ +PHPAPI php_url *php_url_parse_ex(char const *str, int length) +{ + char port_buf[6]; + php_url *ret = ecalloc(1, sizeof(php_url)); + char const *s, *e, *p, *pp, *ue; + + s = str; + ue = s + length; + + /* parse scheme */ + if ((e = memchr(s, ':', length)) && (e - s)) { + /* validate scheme */ + p = s; + while (p < e) { + /* scheme = 1*[ lowalpha | digit | "+" | "-" | "." ] */ + if (!isalpha(*p) && !isdigit(*p) && *p != '+' && *p != '.' && *p != '-') { + if (e + 1 < ue) { + goto parse_port; + } else { + goto just_path; + } + } + p++; + } + + if (*(e + 1) == '\0') { /* only scheme is available */ + ret->scheme = estrndup(s, (e - s)); + php_replace_controlchars_ex(ret->scheme, (e - s)); + goto end; + } + + /* + * certain schemas like mailto: and zlib: may not have any / after them + * this check ensures we support those. + */ + if (*(e+1) != '/') { + /* check if the data we get is a port this allows us to + * correctly parse things like a.com:80 + */ + p = e + 1; + while (isdigit(*p)) { + p++; + } + + if ((*p == '\0' || *p == '/') && (p - e) < 7) { + goto parse_port; + } + + ret->scheme = estrndup(s, (e-s)); + php_replace_controlchars_ex(ret->scheme, (e - s)); + + length -= ++e - s; + s = e; + goto just_path; + } else { + ret->scheme = estrndup(s, (e-s)); + php_replace_controlchars_ex(ret->scheme, (e - s)); + + if (*(e+2) == '/') { + s = e + 3; + if (!strncasecmp("file", ret->scheme, sizeof("file"))) { + if (*(e + 3) == '/') { + /* support windows drive letters as in: + file:///c:/somedir/file.txt + */ + if (*(e + 5) == ':') { + s = e + 4; + } + goto nohost; + } + } + } else { + if (!strncasecmp("file", ret->scheme, sizeof("file"))) { + s = e + 1; + goto nohost; + } else { + length -= ++e - s; + s = e; + goto just_path; + } + } + } + } else if (e) { /* no scheme; starts with colon: look for port */ + parse_port: + p = e + 1; + pp = p; + + while (pp-p < 6 && isdigit(*pp)) { + pp++; + } + + if (pp - p > 0 && pp - p < 6 && (*pp == '/' || *pp == '\0')) { + long port; + memcpy(port_buf, p, (pp - p)); + port_buf[pp - p] = '\0'; + port = strtol(port_buf, NULL, 10); + if (port > 0 && port <= 65535) { + ret->port = (unsigned short) port; + } else { + STR_FREE(ret->scheme); + efree(ret); + return NULL; + } + } else if (p == pp && *pp == '\0') { + STR_FREE(ret->scheme); + efree(ret); + return NULL; + } else if (*s == '/' && *(s+1) == '/') { /* relative-scheme URL */ + s += 2; + } else { + goto just_path; + } + } else if (*s == '/' && *(s+1) == '/') { /* relative-scheme URL */ + s += 2; + } else { + just_path: + ue = s + length; + goto nohost; + } + + e = ue; + + if (!(p = memchr(s, '/', (ue - s)))) { + char *query, *fragment; + + query = memchr(s, '?', (ue - s)); + fragment = memchr(s, '#', (ue - s)); + + if (query && fragment) { + if (query > fragment) { + e = fragment; + } else { + e = query; + } + } else if (query) { + e = query; + } else if (fragment) { + e = fragment; + } + } else { + e = p; + } + + /* check for login and password */ + if ((p = zend_memrchr(s, '@', (e-s)))) { + if ((pp = memchr(s, ':', (p-s)))) { + if ((pp-s) > 0) { + ret->user = estrndup(s, (pp-s)); + php_replace_controlchars_ex(ret->user, (pp - s)); + } + + pp++; + if (p-pp > 0) { + ret->pass = estrndup(pp, (p-pp)); + php_replace_controlchars_ex(ret->pass, (p-pp)); + } + } else { + ret->user = estrndup(s, (p-s)); + php_replace_controlchars_ex(ret->user, (p-s)); + } + + s = p + 1; + } + + /* check for port */ + if (*s == '[' && *(e-1) == ']') { + /* Short circuit portscan, + we're dealing with an + IPv6 embedded address */ + p = s; + } else { + /* memrchr is a GNU specific extension + Emulate for wide compatability */ + for(p = e; *p != ':' && p >= s; p--); + } + + if (p >= s && *p == ':') { + if (!ret->port) { + p++; + if (e-p > 5) { /* port cannot be longer then 5 characters */ + STR_FREE(ret->scheme); + STR_FREE(ret->user); + STR_FREE(ret->pass); + efree(ret); + return NULL; + } else if (e - p > 0) { + long port; + memcpy(port_buf, p, (e - p)); + port_buf[e - p] = '\0'; + port = strtol(port_buf, NULL, 10); + if (port > 0 && port <= 65535) { + ret->port = (unsigned short)port; + } else { + STR_FREE(ret->scheme); + STR_FREE(ret->user); + STR_FREE(ret->pass); + efree(ret); + return NULL; + } + } + p--; + } + } else { + p = e; + } + + /* check if we have a valid host, if we don't reject the string as url */ + if ((p-s) < 1) { + STR_FREE(ret->scheme); + STR_FREE(ret->user); + STR_FREE(ret->pass); + efree(ret); + return NULL; + } + + ret->host = estrndup(s, (p-s)); + php_replace_controlchars_ex(ret->host, (p - s)); + + if (e == ue) { + return ret; + } + + s = e; + + nohost: + + if ((p = memchr(s, '?', (ue - s)))) { + pp = strchr(s, '#'); + + if (pp && pp < p) { + if (pp - s) { + ret->path = estrndup(s, (pp-s)); + php_replace_controlchars_ex(ret->path, (pp - s)); + } + p = pp; + goto label_parse; + } + + if (p - s) { + ret->path = estrndup(s, (p-s)); + php_replace_controlchars_ex(ret->path, (p - s)); + } + + if (pp) { + if (pp - ++p) { + ret->query = estrndup(p, (pp-p)); + php_replace_controlchars_ex(ret->query, (pp - p)); + } + p = pp; + goto label_parse; + } else if (++p - ue) { + ret->query = estrndup(p, (ue-p)); + php_replace_controlchars_ex(ret->query, (ue - p)); + } + } else if ((p = memchr(s, '#', (ue - s)))) { + if (p - s) { + ret->path = estrndup(s, (p-s)); + php_replace_controlchars_ex(ret->path, (p - s)); + } + + label_parse: + p++; + + if (ue - p) { + ret->fragment = estrndup(p, (ue-p)); + php_replace_controlchars_ex(ret->fragment, (ue - p)); + } + } else { + ret->path = estrndup(s, (ue-s)); + php_replace_controlchars_ex(ret->path, (ue - s)); + } +end: + return ret; +} +/* }}} */ + +/* {{{ proto mixed parse_url(string url, [int url_component]) + Parse a URL and return its components */ +PHP_FUNCTION(parse_url) +{ + char *str; + int str_len; + php_url *resource; + long key = -1; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &key) == FAILURE) { + return; + } + + resource = php_url_parse_ex(str, str_len); + if (resource == NULL) { + /* @todo Find a method to determine why php_url_parse_ex() failed */ + RETURN_FALSE; + } + + if (key > -1) { + switch (key) { + case PHP_URL_SCHEME: + if (resource->scheme != NULL) RETVAL_STRING(resource->scheme, 1); + break; + case PHP_URL_HOST: + if (resource->host != NULL) RETVAL_STRING(resource->host, 1); + break; + case PHP_URL_PORT: + if (resource->port != 0) RETVAL_LONG(resource->port); + break; + case PHP_URL_USER: + if (resource->user != NULL) RETVAL_STRING(resource->user, 1); + break; + case PHP_URL_PASS: + if (resource->pass != NULL) RETVAL_STRING(resource->pass, 1); + break; + case PHP_URL_PATH: + if (resource->path != NULL) RETVAL_STRING(resource->path, 1); + break; + case PHP_URL_QUERY: + if (resource->query != NULL) RETVAL_STRING(resource->query, 1); + break; + case PHP_URL_FRAGMENT: + if (resource->fragment != NULL) RETVAL_STRING(resource->fragment, 1); + break; + default: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL component identifier %ld", key); + RETVAL_FALSE; + } + goto done; + } + + /* allocate an array for return */ + array_init(return_value); + + /* add the various elements to the array */ + if (resource->scheme != NULL) + add_assoc_string(return_value, "scheme", resource->scheme, 1); + if (resource->host != NULL) + add_assoc_string(return_value, "host", resource->host, 1); + if (resource->port != 0) + add_assoc_long(return_value, "port", resource->port); + if (resource->user != NULL) + add_assoc_string(return_value, "user", resource->user, 1); + if (resource->pass != NULL) + add_assoc_string(return_value, "pass", resource->pass, 1); + if (resource->path != NULL) + add_assoc_string(return_value, "path", resource->path, 1); + if (resource->query != NULL) + add_assoc_string(return_value, "query", resource->query, 1); + if (resource->fragment != NULL) + add_assoc_string(return_value, "fragment", resource->fragment, 1); +done: + php_url_free(resource); +} +/* }}} */ + +/* {{{ php_htoi + */ +static int php_htoi(char *s) +{ + int value; + int c; + + c = ((unsigned char *)s)[0]; + if (isupper(c)) + c = tolower(c); + value = (c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16; + + c = ((unsigned char *)s)[1]; + if (isupper(c)) + c = tolower(c); + value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10; + + return (value); +} +/* }}} */ + +/* rfc1738: + + ...The characters ";", + "/", "?", ":", "@", "=" and "&" are the characters which may be + reserved for special meaning within a scheme... + + ...Thus, only alphanumerics, the special characters "$-_.+!*'(),", and + reserved characters used for their reserved purposes may be used + unencoded within a URL... + + For added safety, we only leave -_. unencoded. + */ + +static unsigned char hexchars[] = "0123456789ABCDEF"; + +/* {{{ php_url_encode + */ +PHPAPI char *php_url_encode(char const *s, int len, int *new_length) +{ + register unsigned char c; + unsigned char *to, *start; + unsigned char const *from, *end; + + from = (unsigned char *)s; + end = (unsigned char *)s + len; + start = to = (unsigned char *) safe_emalloc(3, len, 1); + + while (from < end) { + c = *from++; + + if (c == ' ') { + *to++ = '+'; +#ifndef CHARSET_EBCDIC + } else if ((c < '0' && c != '-' && c != '.') || + (c < 'A' && c > '9') || + (c > 'Z' && c < 'a' && c != '_') || + (c > 'z')) { + to[0] = '%'; + to[1] = hexchars[c >> 4]; + to[2] = hexchars[c & 15]; + to += 3; +#else /*CHARSET_EBCDIC*/ + } else if (!isalnum(c) && strchr("_-.", c) == NULL) { + /* Allow only alphanumeric chars and '_', '-', '.'; escape the rest */ + to[0] = '%'; + to[1] = hexchars[os_toascii[c] >> 4]; + to[2] = hexchars[os_toascii[c] & 15]; + to += 3; +#endif /*CHARSET_EBCDIC*/ + } else { + *to++ = c; + } + } + *to = 0; + if (new_length) { + *new_length = to - start; + } + return (char *) start; +} +/* }}} */ + +/* {{{ proto string urlencode(string str) + URL-encodes string */ +PHP_FUNCTION(urlencode) +{ + char *in_str, *out_str; + int in_str_len, out_str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str, + &in_str_len) == FAILURE) { + return; + } + + out_str = php_url_encode(in_str, in_str_len, &out_str_len); + RETURN_STRINGL(out_str, out_str_len, 0); +} +/* }}} */ + +/* {{{ proto string urldecode(string str) + Decodes URL-encoded string */ +PHP_FUNCTION(urldecode) +{ + char *in_str, *out_str; + int in_str_len, out_str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str, + &in_str_len) == FAILURE) { + return; + } + + out_str = estrndup(in_str, in_str_len); + out_str_len = php_url_decode(out_str, in_str_len); + + RETURN_STRINGL(out_str, out_str_len, 0); +} +/* }}} */ + +/* {{{ php_url_decode + */ +PHPAPI int php_url_decode(char *str, int len) +{ + char *dest = str; + char *data = str; + + while (len--) { + if (*data == '+') { + *dest = ' '; + } + else if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) + && isxdigit((int) *(data + 2))) { +#ifndef CHARSET_EBCDIC + *dest = (char) php_htoi(data + 1); +#else + *dest = os_toebcdic[(char) php_htoi(data + 1)]; +#endif + data += 2; + len -= 2; + } else { + *dest = *data; + } + data++; + dest++; + } + *dest = '\0'; + return dest - str; +} +/* }}} */ + +/* {{{ php_raw_url_encode + */ +PHPAPI char *php_raw_url_encode(char const *s, int len, int *new_length) +{ + register int x, y; + unsigned char *str; + + str = (unsigned char *) safe_emalloc(3, len, 1); + for (x = 0, y = 0; len--; x++, y++) { + str[y] = (unsigned char) s[x]; +#ifndef CHARSET_EBCDIC + if ((str[y] < '0' && str[y] != '-' && str[y] != '.') || + (str[y] < 'A' && str[y] > '9') || + (str[y] > 'Z' && str[y] < 'a' && str[y] != '_') || + (str[y] > 'z' && str[y] != '~')) { + str[y++] = '%'; + str[y++] = hexchars[(unsigned char) s[x] >> 4]; + str[y] = hexchars[(unsigned char) s[x] & 15]; +#else /*CHARSET_EBCDIC*/ + if (!isalnum(str[y]) && strchr("_-.~", str[y]) != NULL) { + str[y++] = '%'; + str[y++] = hexchars[os_toascii[(unsigned char) s[x]] >> 4]; + str[y] = hexchars[os_toascii[(unsigned char) s[x]] & 15]; +#endif /*CHARSET_EBCDIC*/ + } + } + str[y] = '\0'; + if (new_length) { + *new_length = y; + } + return ((char *) str); +} +/* }}} */ + +/* {{{ proto string rawurlencode(string str) + URL-encodes string */ +PHP_FUNCTION(rawurlencode) +{ + char *in_str, *out_str; + int in_str_len, out_str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str, + &in_str_len) == FAILURE) { + return; + } + + out_str = php_raw_url_encode(in_str, in_str_len, &out_str_len); + RETURN_STRINGL(out_str, out_str_len, 0); +} +/* }}} */ + +/* {{{ proto string rawurldecode(string str) + Decodes URL-encodes string */ +PHP_FUNCTION(rawurldecode) +{ + char *in_str, *out_str; + int in_str_len, out_str_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str, + &in_str_len) == FAILURE) { + return; + } + + out_str = estrndup(in_str, in_str_len); + out_str_len = php_raw_url_decode(out_str, in_str_len); + + RETURN_STRINGL(out_str, out_str_len, 0); +} +/* }}} */ + +/* {{{ php_raw_url_decode + */ +PHPAPI int php_raw_url_decode(char *str, int len) +{ + char *dest = str; + char *data = str; + + while (len--) { + if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) + && isxdigit((int) *(data + 2))) { +#ifndef CHARSET_EBCDIC + *dest = (char) php_htoi(data + 1); +#else + *dest = os_toebcdic[(char) php_htoi(data + 1)]; +#endif + data += 2; + len -= 2; + } else { + *dest = *data; + } + data++; + dest++; + } + *dest = '\0'; + return dest - str; +} +/* }}} */ + +/* {{{ proto array get_headers(string url[, int format]) + fetches all the headers sent by the server in response to a HTTP request */ +PHP_FUNCTION(get_headers) +{ + char *url; + int url_len; + php_stream_context *context; + php_stream *stream; + zval **prev_val, **hdr = NULL, **h; + HashPosition pos; + HashTable *hashT; + long format = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &url, &url_len, &format) == FAILURE) { + return; + } + context = FG(default_context) ? FG(default_context) : (FG(default_context) = php_stream_context_alloc(TSRMLS_C)); + + if (!(stream = php_stream_open_wrapper_ex(url, "r", REPORT_ERRORS | STREAM_USE_URL | STREAM_ONLY_GET_HEADERS, NULL, context))) { + RETURN_FALSE; + } + + if (!stream->wrapperdata || Z_TYPE_P(stream->wrapperdata) != IS_ARRAY) { + php_stream_close(stream); + RETURN_FALSE; + } + + array_init(return_value); + + /* check for curl-wrappers that provide headers via a special "headers" element */ + if (zend_hash_find(HASH_OF(stream->wrapperdata), "headers", sizeof("headers"), (void **)&h) != FAILURE && Z_TYPE_PP(h) == IS_ARRAY) { + /* curl-wrappers don't load data until the 1st read */ + if (!Z_ARRVAL_PP(h)->nNumOfElements) { + php_stream_getc(stream); + } + zend_hash_find(HASH_OF(stream->wrapperdata), "headers", sizeof("headers"), (void **)&h); + hashT = Z_ARRVAL_PP(h); + } else { + hashT = HASH_OF(stream->wrapperdata); + } + + zend_hash_internal_pointer_reset_ex(hashT, &pos); + while (zend_hash_get_current_data_ex(hashT, (void**)&hdr, &pos) != FAILURE) { + if (!hdr || Z_TYPE_PP(hdr) != IS_STRING) { + zend_hash_move_forward_ex(hashT, &pos); + continue; + } + if (!format) { +no_name_header: + add_next_index_stringl(return_value, Z_STRVAL_PP(hdr), Z_STRLEN_PP(hdr), 1); + } else { + char c; + char *s, *p; + + if ((p = strchr(Z_STRVAL_PP(hdr), ':'))) { + c = *p; + *p = '\0'; + s = p + 1; + while (isspace((int)*(unsigned char *)s)) { + s++; + } + + if (zend_hash_find(HASH_OF(return_value), Z_STRVAL_PP(hdr), (p - Z_STRVAL_PP(hdr) + 1), (void **) &prev_val) == FAILURE) { + add_assoc_stringl_ex(return_value, Z_STRVAL_PP(hdr), (p - Z_STRVAL_PP(hdr) + 1), s, (Z_STRLEN_PP(hdr) - (s - Z_STRVAL_PP(hdr))), 1); + } else { /* some headers may occur more then once, therefor we need to remake the string into an array */ + convert_to_array(*prev_val); + add_next_index_stringl(*prev_val, s, (Z_STRLEN_PP(hdr) - (s - Z_STRVAL_PP(hdr))), 1); + } + + *p = c; + } else { + goto no_name_header; + } + } + zend_hash_move_forward_ex(hashT, &pos); + } + + php_stream_close(stream); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/url.h b/ext/standard/url.h new file mode 100644 index 0000000..87e2efb --- /dev/null +++ b/ext/standard/url.h @@ -0,0 +1,68 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Jim Winstead | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#ifndef URL_H +#define URL_H + +typedef struct php_url { + char *scheme; + char *user; + char *pass; + char *host; + unsigned short port; + char *path; + char *query; + char *fragment; +} php_url; + +PHPAPI void php_url_free(php_url *theurl); +PHPAPI php_url *php_url_parse(char const *str); +PHPAPI php_url *php_url_parse_ex(char const *str, int length); +PHPAPI int php_url_decode(char *str, int len); /* return value: length of decoded string */ +PHPAPI int php_raw_url_decode(char *str, int len); /* return value: length of decoded string */ +PHPAPI char *php_url_encode(char const *s, int len, int *new_length); +PHPAPI char *php_raw_url_encode(char const *s, int len, int *new_length); + +PHP_FUNCTION(parse_url); +PHP_FUNCTION(urlencode); +PHP_FUNCTION(urldecode); +PHP_FUNCTION(rawurlencode); +PHP_FUNCTION(rawurldecode); +PHP_FUNCTION(get_headers); + +#define PHP_URL_SCHEME 0 +#define PHP_URL_HOST 1 +#define PHP_URL_PORT 2 +#define PHP_URL_USER 3 +#define PHP_URL_PASS 4 +#define PHP_URL_PATH 5 +#define PHP_URL_QUERY 6 +#define PHP_URL_FRAGMENT 7 + +#define PHP_QUERY_RFC1738 1 +#define PHP_QUERY_RFC3986 2 + +#endif /* URL_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c new file mode 100644 index 0000000..2ceda13 --- /dev/null +++ b/ext/standard/url_scanner_ex.c @@ -0,0 +1,1054 @@ +/* Generated by re2c 0.13.5 on Tue Jan 1 16:28:14 2013 */ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Sascha Schumann | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" + +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_LIMITS_H +#include +#endif + +#include +#include +#include + +#include "php_ini.h" +#include "php_globals.h" +#define STATE_TAG SOME_OTHER_STATE_TAG +#include "basic_functions.h" +#include "url.h" +#undef STATE_TAG + +#define url_scanner url_scanner_ex + +#include "php_smart_str.h" + +static PHP_INI_MH(OnUpdateTags) +{ + url_adapt_state_ex_t *ctx; + char *key; + char *lasts; + char *tmp; + + ctx = &BG(url_adapt_state_ex); + + tmp = estrndup(new_value, new_value_length); + + if (ctx->tags) + zend_hash_destroy(ctx->tags); + else { + ctx->tags = malloc(sizeof(HashTable)); + if (!ctx->tags) { + return FAILURE; + } + } + + zend_hash_init(ctx->tags, 0, NULL, NULL, 1); + + for (key = php_strtok_r(tmp, ",", &lasts); + key; + key = php_strtok_r(NULL, ",", &lasts)) { + char *val; + + val = strchr(key, '='); + if (val) { + char *q; + int keylen; + + *val++ = '\0'; + for (q = key; *q; q++) + *q = tolower(*q); + keylen = q - key; + /* key is stored withOUT NUL + val is stored WITH NUL */ + zend_hash_add(ctx->tags, key, keylen, val, strlen(val)+1, NULL); + } + } + + efree(tmp); + + return SUCCESS; +} + +PHP_INI_BEGIN() + STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=,fieldset=", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals) +PHP_INI_END() + + + +#define YYFILL(n) goto done +#define YYCTYPE unsigned char +#define YYCURSOR p +#define YYLIMIT q +#define YYMARKER r + +static inline void append_modified_url(smart_str *url, smart_str *dest, smart_str *url_app, const char *separator) +{ + register const char *p, *q; + const char *bash = NULL; + const char *sep = "?"; + + q = (p = url->c) + url->len; + +scan: + +{ + YYCTYPE yych; + static const unsigned char yybm[] = { + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 0, 128, 128, 128, 128, 0, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + }; + + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy8; + } + if (yych <= '9') goto yy6; + if (yych >= ';') goto yy4; + ++YYCURSOR; + { smart_str_append(dest, url); return; } +yy4: + ++YYCURSOR; + { sep = separator; goto scan; } +yy6: + ++YYCURSOR; + { bash = p - 1; goto done; } +yy8: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy8; + } + { goto scan; } +} + +done: + + /* Don't modify URLs of the format "#mark" */ + if (bash && bash - url->c == 0) { + smart_str_append(dest, url); + return; + } + + if (bash) + smart_str_appendl(dest, url->c, bash - url->c); + else + smart_str_append(dest, url); + + smart_str_appends(dest, sep); + smart_str_append(dest, url_app); + + if (bash) + smart_str_appendl(dest, bash, q - bash); +} + + +#undef YYFILL +#undef YYCTYPE +#undef YYCURSOR +#undef YYLIMIT +#undef YYMARKER + +static inline void tag_arg(url_adapt_state_ex_t *ctx, char quotes, char type TSRMLS_DC) +{ + char f = 0; + + if (strncasecmp(ctx->arg.c, ctx->lookup_data, ctx->arg.len) == 0) + f = 1; + + if (quotes) + smart_str_appendc(&ctx->result, type); + if (f) { + append_modified_url(&ctx->val, &ctx->result, &ctx->url_app, PG(arg_separator).output); + } else { + smart_str_append(&ctx->result, &ctx->val); + } + if (quotes) + smart_str_appendc(&ctx->result, type); +} + +enum { + STATE_PLAIN = 0, + STATE_TAG, + STATE_NEXT_ARG, + STATE_ARG, + STATE_BEFORE_VAL, + STATE_VAL +}; + +#define YYFILL(n) goto stop +#define YYCTYPE unsigned char +#define YYCURSOR xp +#define YYLIMIT end +#define YYMARKER q +#define STATE ctx->state + +#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR TSRMLS_DC +#define STD_ARGS ctx, start, xp TSRMLS_CC + +#if SCANNER_DEBUG +#define scdebug(x) printf x +#else +#define scdebug(x) +#endif + +static inline void passthru(STD_PARA) +{ + scdebug(("appending %d chars, starting with %c\n", YYCURSOR-start, *start)); + smart_str_appendl(&ctx->result, start, YYCURSOR - start); +} + +/* + * This function appends a hidden input field after a
or + *
. The latter is important for XHTML. + */ + +static void handle_form(STD_PARA) +{ + int doit = 0; + + if (ctx->form_app.len > 0) { + switch (ctx->tag.len) { + case sizeof("form") - 1: + if (!strncasecmp(ctx->tag.c, "form", sizeof("form") - 1)) { + doit = 1; + } + if (doit && ctx->val.c && ctx->lookup_data && *ctx->lookup_data) { + char *e, *p = zend_memnstr(ctx->val.c, "://", sizeof("://") - 1, ctx->val.c + ctx->val.len); + if (p) { + e = memchr(p, '/', (ctx->val.c + ctx->val.len) - p); + if (!e) { + e = ctx->val.c + ctx->val.len; + } + if ((e - p) && strncasecmp(p, ctx->lookup_data, (e - p))) { + doit = 0; + } + } + } + break; + + case sizeof("fieldset") - 1: + if (!strncasecmp(ctx->tag.c, "fieldset", sizeof("fieldset") - 1)) { + doit = 1; + } + break; + } + + if (doit) + smart_str_append(&ctx->result, &ctx->form_app); + } +} + +/* + * HANDLE_TAG copies the HTML Tag and checks whether we + * have that tag in our table. If we might modify it, + * we continue to scan the tag, otherwise we simply copy the complete + * HTML stuff to the result buffer. + */ + +static inline void handle_tag(STD_PARA) +{ + int ok = 0; + unsigned int i; + + ctx->tag.len = 0; + smart_str_appendl(&ctx->tag, start, YYCURSOR - start); + for (i = 0; i < ctx->tag.len; i++) + ctx->tag.c[i] = tolower((int)(unsigned char)ctx->tag.c[i]); + if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS) + ok = 1; + STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN; +} + +static inline void handle_arg(STD_PARA) +{ + ctx->arg.len = 0; + smart_str_appendl(&ctx->arg, start, YYCURSOR - start); +} + +static inline void handle_val(STD_PARA, char quotes, char type) +{ + smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2); + tag_arg(ctx, quotes, type TSRMLS_CC); +} + +static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen TSRMLS_DC) +{ + char *end, *q; + char *xp; + char *start; + int rest; + + smart_str_appendl(&ctx->buf, newdata, newlen); + + YYCURSOR = ctx->buf.c; + YYLIMIT = ctx->buf.c + ctx->buf.len; + + switch (STATE) { + case STATE_PLAIN: goto state_plain; + case STATE_TAG: goto state_tag; + case STATE_NEXT_ARG: goto state_next_arg; + case STATE_ARG: goto state_arg; + case STATE_BEFORE_VAL: goto state_before_val; + case STATE_VAL: goto state_val; + } + + +state_plain_begin: + STATE = STATE_PLAIN; + +state_plain: + start = YYCURSOR; + +{ + YYCTYPE yych; + static const unsigned char yybm[] = { + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 0, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + }; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy15; + } + ++YYCURSOR; + { passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; } +yy15: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy15; + } + { passthru(STD_ARGS); goto state_plain; } +} + + +state_tag: + start = YYCURSOR; + +{ + YYCTYPE yych; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 128, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych != ':') goto yy22; + } else { + if (yych <= 'Z') goto yy20; + if (yych <= '`') goto yy22; + if (yych >= '{') goto yy22; + } +yy20: + ++YYCURSOR; + yych = *YYCURSOR; + goto yy25; +yy21: + { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; } +yy22: + ++YYCURSOR; + { passthru(STD_ARGS); goto state_plain_begin; } +yy24: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy25: + if (yybm[0+yych] & 128) { + goto yy24; + } + goto yy21; +} + + +state_next_arg_begin: + STATE = STATE_NEXT_ARG; + +state_next_arg: + start = YYCURSOR; + +{ + YYCTYPE yych; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 0, 128, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= ' ') { + if (yych <= '\f') { + if (yych <= 0x08) goto yy34; + if (yych <= '\v') goto yy30; + goto yy34; + } else { + if (yych <= '\r') goto yy30; + if (yych <= 0x1F) goto yy34; + goto yy30; + } + } else { + if (yych <= '@') { + if (yych != '>') goto yy34; + } else { + if (yych <= 'Z') goto yy32; + if (yych <= '`') goto yy34; + if (yych <= 'z') goto yy32; + goto yy34; + } + } + ++YYCURSOR; + { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } +yy30: + ++YYCURSOR; + yych = *YYCURSOR; + goto yy37; +yy31: + { passthru(STD_ARGS); goto state_next_arg; } +yy32: + ++YYCURSOR; + { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } +yy34: + ++YYCURSOR; + { passthru(STD_ARGS); goto state_plain_begin; } +yy36: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy37: + if (yybm[0+yych] & 128) { + goto yy36; + } + goto yy31; +} + + +state_arg: + start = YYCURSOR; + +{ + YYCTYPE yych; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 128, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= '@') goto yy42; + if (yych <= 'Z') goto yy40; + if (yych <= '`') goto yy42; + if (yych >= '{') goto yy42; +yy40: + ++YYCURSOR; + yych = *YYCURSOR; + goto yy45; +yy41: + { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; } +yy42: + ++YYCURSOR; + { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; } +yy44: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy45: + if (yybm[0+yych] & 128) { + goto yy44; + } + goto yy41; +} + + +state_before_val: + start = YYCURSOR; + +{ + YYCTYPE yych; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych == ' ') goto yy48; + if (yych == '=') goto yy50; + goto yy52; +yy48: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == ' ') goto yy55; + if (yych == '=') goto yy53; +yy49: + { --YYCURSOR; goto state_next_arg_begin; } +yy50: + ++YYCURSOR; + yych = *YYCURSOR; + goto yy54; +yy51: + { passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; } +yy52: + yych = *++YYCURSOR; + goto yy49; +yy53: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy54: + if (yybm[0+yych] & 128) { + goto yy53; + } + goto yy51; +yy55: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych == ' ') goto yy55; + if (yych == '=') goto yy53; + YYCURSOR = YYMARKER; + goto yy49; +} + + + +state_val: + start = YYCURSOR; + +{ + YYCTYPE yych; + static const unsigned char yybm[] = { + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 160, 160, 248, 248, 160, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 160, 248, 56, 248, 248, 248, 248, 200, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 0, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + }; + if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); + yych = *YYCURSOR; + if (yych <= ' ') { + if (yych <= '\f') { + if (yych <= 0x08) goto yy63; + if (yych <= '\n') goto yy64; + goto yy63; + } else { + if (yych <= '\r') goto yy64; + if (yych <= 0x1F) goto yy63; + goto yy64; + } + } else { + if (yych <= '&') { + if (yych != '"') goto yy63; + } else { + if (yych <= '\'') goto yy62; + if (yych == '>') goto yy64; + goto yy63; + } + } + yych = *(YYMARKER = ++YYCURSOR); + goto yy77; +yy61: + { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } +yy62: + yych = *(YYMARKER = ++YYCURSOR); + goto yy69; +yy63: + yych = *++YYCURSOR; + goto yy67; +yy64: + ++YYCURSOR; + { passthru(STD_ARGS); goto state_next_arg_begin; } +yy66: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy67: + if (yybm[0+yych] & 8) { + goto yy66; + } + goto yy61; +yy68: + YYMARKER = ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; +yy69: + if (yybm[0+yych] & 16) { + goto yy68; + } + if (yych <= '&') goto yy72; + if (yych >= '(') goto yy61; + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy66; + } +yy71: + { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } +yy72: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy72; + } + if (yych <= '=') goto yy75; +yy74: + YYCURSOR = YYMARKER; + goto yy61; +yy75: + yych = *++YYCURSOR; + goto yy71; +yy76: + YYMARKER = ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; +yy77: + if (yybm[0+yych] & 64) { + goto yy76; + } + if (yych <= '!') goto yy80; + if (yych >= '#') goto yy61; + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy66; + } +yy79: + { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } +yy80: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy80; + } + if (yych >= '>') goto yy74; + ++YYCURSOR; + yych = *YYCURSOR; + goto yy79; +} + + +stop: + rest = YYLIMIT - start; + scdebug(("stopped in state %d at pos %d (%d:%c) %d\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *YYCURSOR, rest)); + /* XXX: Crash avoidance. Need to work with reporter to figure out what goes wrong */ + if (rest < 0) rest = 0; + + if (rest) memmove(ctx->buf.c, start, rest); + ctx->buf.len = rest; +} + +char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen TSRMLS_DC) +{ + smart_str surl = {0}; + smart_str buf = {0}; + smart_str url_app = {0}; + + smart_str_setl(&surl, url, urllen); + + smart_str_appends(&url_app, name); + smart_str_appendc(&url_app, '='); + smart_str_appends(&url_app, value); + + append_modified_url(&surl, &buf, &url_app, PG(arg_separator).output); + + smart_str_0(&buf); + if (newlen) *newlen = buf.len; + + smart_str_free(&url_app); + + return buf.c; +} + + +static char *url_adapt_ext(const char *src, size_t srclen, size_t *newlen, zend_bool do_flush TSRMLS_DC) +{ + url_adapt_state_ex_t *ctx; + char *retval; + + ctx = &BG(url_adapt_state_ex); + + xx_mainloop(ctx, src, srclen TSRMLS_CC); + + *newlen = ctx->result.len; + if (!ctx->result.c) { + smart_str_appendl(&ctx->result, "", 0); + } + smart_str_0(&ctx->result); + if (do_flush) { + smart_str_appendl(&ctx->result, ctx->buf.c, ctx->buf.len); + *newlen += ctx->buf.len; + smart_str_free(&ctx->buf); + } + retval = ctx->result.c; + ctx->result.c = NULL; + ctx->result.len = 0; + return retval; +} + +static int php_url_scanner_ex_activate(TSRMLS_D) +{ + url_adapt_state_ex_t *ctx; + + ctx = &BG(url_adapt_state_ex); + + memset(ctx, 0, ((size_t) &((url_adapt_state_ex_t *)0)->tags)); + + return SUCCESS; +} + +static int php_url_scanner_ex_deactivate(TSRMLS_D) +{ + url_adapt_state_ex_t *ctx; + + ctx = &BG(url_adapt_state_ex); + + smart_str_free(&ctx->result); + smart_str_free(&ctx->buf); + smart_str_free(&ctx->tag); + smart_str_free(&ctx->arg); + + return SUCCESS; +} + +static void php_url_scanner_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC) +{ + size_t len; + + if (BG(url_adapt_state_ex).url_app.len != 0) { + *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & (PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_CONT | PHP_OUTPUT_HANDLER_FLUSH | PHP_OUTPUT_HANDLER_FINAL) ? 1 : 0) TSRMLS_CC); + if (sizeof(uint) < sizeof(size_t)) { + if (len > UINT_MAX) + len = UINT_MAX; + } + *handled_output_len = len; + } else if (BG(url_adapt_state_ex).url_app.len == 0) { + url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex); + if (ctx->buf.len) { + smart_str_appendl(&ctx->result, ctx->buf.c, ctx->buf.len); + smart_str_appendl(&ctx->result, output, output_len); + + *handled_output = ctx->result.c; + *handled_output_len = ctx->buf.len + output_len; + + ctx->result.c = NULL; + ctx->result.len = 0; + smart_str_free(&ctx->buf); + } else { + *handled_output = estrndup(output, *handled_output_len = output_len); + } + } else { + *handled_output = NULL; + } +} + +PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC) +{ + char *encoded; + int encoded_len; + smart_str val; + + if (! BG(url_adapt_state_ex).active) { + php_url_scanner_ex_activate(TSRMLS_C); + php_output_start_internal(ZEND_STRL("URL-Rewriter"), php_url_scanner_output_handler, 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC); + BG(url_adapt_state_ex).active = 1; + } + + + if (BG(url_adapt_state_ex).url_app.len != 0) { + smart_str_appends(&BG(url_adapt_state_ex).url_app, PG(arg_separator).output); + } + + if (urlencode) { + encoded = php_url_encode(value, value_len, &encoded_len); + smart_str_setl(&val, encoded, encoded_len); + } else { + smart_str_setl(&val, value, value_len); + } + + smart_str_appendl(&BG(url_adapt_state_ex).url_app, name, name_len); + smart_str_appendc(&BG(url_adapt_state_ex).url_app, '='); + smart_str_append(&BG(url_adapt_state_ex).url_app, &val); + + smart_str_appends(&BG(url_adapt_state_ex).form_app, ""); + + if (urlencode) + efree(encoded); + + return SUCCESS; +} + +PHPAPI int php_url_scanner_reset_vars(TSRMLS_D) +{ + BG(url_adapt_state_ex).form_app.len = 0; + BG(url_adapt_state_ex).url_app.len = 0; + + return SUCCESS; +} + +PHP_MINIT_FUNCTION(url_scanner) +{ + BG(url_adapt_state_ex).tags = NULL; + + BG(url_adapt_state_ex).form_app.c = BG(url_adapt_state_ex).url_app.c = 0; + BG(url_adapt_state_ex).form_app.len = BG(url_adapt_state_ex).url_app.len = 0; + + REGISTER_INI_ENTRIES(); + return SUCCESS; +} + +PHP_MSHUTDOWN_FUNCTION(url_scanner) +{ + UNREGISTER_INI_ENTRIES(); + + return SUCCESS; +} + +PHP_RINIT_FUNCTION(url_scanner) +{ + BG(url_adapt_state_ex).active = 0; + + return SUCCESS; +} + +PHP_RSHUTDOWN_FUNCTION(url_scanner) +{ + if (BG(url_adapt_state_ex).active) { + php_url_scanner_ex_deactivate(TSRMLS_C); + BG(url_adapt_state_ex).active = 0; + } + + smart_str_free(&BG(url_adapt_state_ex).form_app); + smart_str_free(&BG(url_adapt_state_ex).url_app); + + return SUCCESS; +} diff --git a/ext/standard/url_scanner_ex.h b/ext/standard/url_scanner_ex.h new file mode 100644 index 0000000..667c56c --- /dev/null +++ b/ext/standard/url_scanner_ex.h @@ -0,0 +1,58 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Sascha Schumann | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef URL_SCANNER_EX_H +#define URL_SCANNER_EX_H + +PHP_MINIT_FUNCTION(url_scanner_ex); +PHP_MSHUTDOWN_FUNCTION(url_scanner_ex); + +PHP_RINIT_FUNCTION(url_scanner_ex); +PHP_RSHUTDOWN_FUNCTION(url_scanner_ex); + +PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen TSRMLS_DC); +PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC); +PHPAPI int php_url_scanner_reset_vars(TSRMLS_D); + +#include "php_smart_str_public.h" + +typedef struct { + /* Used by the mainloop of the scanner */ + smart_str tag; /* read only */ + smart_str arg; /* read only */ + smart_str val; /* read only */ + smart_str buf; + + /* The result buffer */ + smart_str result; + + /* The data which is appended to each relative URL/FORM */ + smart_str form_app, url_app; + + int active; + + char *lookup_data; + int state; + + /* Everything above is zeroed in RINIT */ + HashTable *tags; +} url_adapt_state_ex_t; + +#endif diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re new file mode 100644 index 0000000..760f725 --- /dev/null +++ b/ext/standard/url_scanner_ex.re @@ -0,0 +1,548 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Sascha Schumann | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" + +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_LIMITS_H +#include +#endif + +#include +#include +#include + +#include "php_ini.h" +#include "php_globals.h" +#define STATE_TAG SOME_OTHER_STATE_TAG +#include "basic_functions.h" +#include "url.h" +#undef STATE_TAG + +#define url_scanner url_scanner_ex + +#include "php_smart_str.h" + +static PHP_INI_MH(OnUpdateTags) +{ + url_adapt_state_ex_t *ctx; + char *key; + char *lasts; + char *tmp; + + ctx = &BG(url_adapt_state_ex); + + tmp = estrndup(new_value, new_value_length); + + if (ctx->tags) + zend_hash_destroy(ctx->tags); + else { + ctx->tags = malloc(sizeof(HashTable)); + if (!ctx->tags) { + return FAILURE; + } + } + + zend_hash_init(ctx->tags, 0, NULL, NULL, 1); + + for (key = php_strtok_r(tmp, ",", &lasts); + key; + key = php_strtok_r(NULL, ",", &lasts)) { + char *val; + + val = strchr(key, '='); + if (val) { + char *q; + int keylen; + + *val++ = '\0'; + for (q = key; *q; q++) + *q = tolower(*q); + keylen = q - key; + /* key is stored withOUT NUL + val is stored WITH NUL */ + zend_hash_add(ctx->tags, key, keylen, val, strlen(val)+1, NULL); + } + } + + efree(tmp); + + return SUCCESS; +} + +PHP_INI_BEGIN() + STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=,fieldset=", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals) +PHP_INI_END() + +/*!re2c +any = [\000-\377]; +N = (any\[<]); +alpha = [a-zA-Z]; +alphanamespace = [a-zA-Z:]; +alphadash = ([a-zA-Z] | "-"); +*/ + +#define YYFILL(n) goto done +#define YYCTYPE unsigned char +#define YYCURSOR p +#define YYLIMIT q +#define YYMARKER r + +static inline void append_modified_url(smart_str *url, smart_str *dest, smart_str *url_app, const char *separator) +{ + register const char *p, *q; + const char *bash = NULL; + const char *sep = "?"; + + q = (p = url->c) + url->len; + +scan: +/*!re2c + ":" { smart_str_append(dest, url); return; } + "?" { sep = separator; goto scan; } + "#" { bash = p - 1; goto done; } + (any\[:?#])+ { goto scan; } +*/ +done: + + /* Don't modify URLs of the format "#mark" */ + if (bash && bash - url->c == 0) { + smart_str_append(dest, url); + return; + } + + if (bash) + smart_str_appendl(dest, url->c, bash - url->c); + else + smart_str_append(dest, url); + + smart_str_appends(dest, sep); + smart_str_append(dest, url_app); + + if (bash) + smart_str_appendl(dest, bash, q - bash); +} + + +#undef YYFILL +#undef YYCTYPE +#undef YYCURSOR +#undef YYLIMIT +#undef YYMARKER + +static inline void tag_arg(url_adapt_state_ex_t *ctx, char quotes, char type TSRMLS_DC) +{ + char f = 0; + + if (strncasecmp(ctx->arg.c, ctx->lookup_data, ctx->arg.len) == 0) + f = 1; + + if (quotes) + smart_str_appendc(&ctx->result, type); + if (f) { + append_modified_url(&ctx->val, &ctx->result, &ctx->url_app, PG(arg_separator).output); + } else { + smart_str_append(&ctx->result, &ctx->val); + } + if (quotes) + smart_str_appendc(&ctx->result, type); +} + +enum { + STATE_PLAIN = 0, + STATE_TAG, + STATE_NEXT_ARG, + STATE_ARG, + STATE_BEFORE_VAL, + STATE_VAL +}; + +#define YYFILL(n) goto stop +#define YYCTYPE unsigned char +#define YYCURSOR xp +#define YYLIMIT end +#define YYMARKER q +#define STATE ctx->state + +#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR TSRMLS_DC +#define STD_ARGS ctx, start, xp TSRMLS_CC + +#if SCANNER_DEBUG +#define scdebug(x) printf x +#else +#define scdebug(x) +#endif + +static inline void passthru(STD_PARA) +{ + scdebug(("appending %d chars, starting with %c\n", YYCURSOR-start, *start)); + smart_str_appendl(&ctx->result, start, YYCURSOR - start); +} + +/* + * This function appends a hidden input field after a or + *
. The latter is important for XHTML. + */ + +static void handle_form(STD_PARA) +{ + int doit = 0; + + if (ctx->form_app.len > 0) { + switch (ctx->tag.len) { + case sizeof("form") - 1: + if (!strncasecmp(ctx->tag.c, "form", sizeof("form") - 1)) { + doit = 1; + } + if (doit && ctx->val.c && ctx->lookup_data && *ctx->lookup_data) { + char *e, *p = zend_memnstr(ctx->val.c, "://", sizeof("://") - 1, ctx->val.c + ctx->val.len); + if (p) { + e = memchr(p, '/', (ctx->val.c + ctx->val.len) - p); + if (!e) { + e = ctx->val.c + ctx->val.len; + } + if ((e - p) && strncasecmp(p, ctx->lookup_data, (e - p))) { + doit = 0; + } + } + } + break; + + case sizeof("fieldset") - 1: + if (!strncasecmp(ctx->tag.c, "fieldset", sizeof("fieldset") - 1)) { + doit = 1; + } + break; + } + + if (doit) + smart_str_append(&ctx->result, &ctx->form_app); + } +} + +/* + * HANDLE_TAG copies the HTML Tag and checks whether we + * have that tag in our table. If we might modify it, + * we continue to scan the tag, otherwise we simply copy the complete + * HTML stuff to the result buffer. + */ + +static inline void handle_tag(STD_PARA) +{ + int ok = 0; + unsigned int i; + + ctx->tag.len = 0; + smart_str_appendl(&ctx->tag, start, YYCURSOR - start); + for (i = 0; i < ctx->tag.len; i++) + ctx->tag.c[i] = tolower((int)(unsigned char)ctx->tag.c[i]); + if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS) + ok = 1; + STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN; +} + +static inline void handle_arg(STD_PARA) +{ + ctx->arg.len = 0; + smart_str_appendl(&ctx->arg, start, YYCURSOR - start); +} + +static inline void handle_val(STD_PARA, char quotes, char type) +{ + smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2); + tag_arg(ctx, quotes, type TSRMLS_CC); +} + +static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen TSRMLS_DC) +{ + char *end, *q; + char *xp; + char *start; + int rest; + + smart_str_appendl(&ctx->buf, newdata, newlen); + + YYCURSOR = ctx->buf.c; + YYLIMIT = ctx->buf.c + ctx->buf.len; + + switch (STATE) { + case STATE_PLAIN: goto state_plain; + case STATE_TAG: goto state_tag; + case STATE_NEXT_ARG: goto state_next_arg; + case STATE_ARG: goto state_arg; + case STATE_BEFORE_VAL: goto state_before_val; + case STATE_VAL: goto state_val; + } + + +state_plain_begin: + STATE = STATE_PLAIN; + +state_plain: + start = YYCURSOR; +/*!re2c + "<" { passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; } + N+ { passthru(STD_ARGS); goto state_plain; } +*/ + +state_tag: + start = YYCURSOR; +/*!re2c + alphanamespace+ { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; } + any { passthru(STD_ARGS); goto state_plain_begin; } +*/ + +state_next_arg_begin: + STATE = STATE_NEXT_ARG; + +state_next_arg: + start = YYCURSOR; +/*!re2c + ">" { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } + [ \v\r\t\n]+ { passthru(STD_ARGS); goto state_next_arg; } + alpha { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } + any { passthru(STD_ARGS); goto state_plain_begin; } +*/ + +state_arg: + start = YYCURSOR; +/*!re2c + alpha alphadash* { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; } + any { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; } +*/ + +state_before_val: + start = YYCURSOR; +/*!re2c + [ ]* "=" [ ]* { passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; } + any { --YYCURSOR; goto state_next_arg_begin; } +*/ + + +state_val: + start = YYCURSOR; +/*!re2c + ["] (any\[">])* ["] { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } + ['] (any\['>])* ['] { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } + (any\[ \r\t\n>])+ { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } + any { passthru(STD_ARGS); goto state_next_arg_begin; } +*/ + +stop: + rest = YYLIMIT - start; + scdebug(("stopped in state %d at pos %d (%d:%c) %d\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *YYCURSOR, rest)); + /* XXX: Crash avoidance. Need to work with reporter to figure out what goes wrong */ + if (rest < 0) rest = 0; + + if (rest) memmove(ctx->buf.c, start, rest); + ctx->buf.len = rest; +} + +char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen TSRMLS_DC) +{ + smart_str surl = {0}; + smart_str buf = {0}; + smart_str url_app = {0}; + + smart_str_setl(&surl, url, urllen); + + smart_str_appends(&url_app, name); + smart_str_appendc(&url_app, '='); + smart_str_appends(&url_app, value); + + append_modified_url(&surl, &buf, &url_app, PG(arg_separator).output); + + smart_str_0(&buf); + if (newlen) *newlen = buf.len; + + smart_str_free(&url_app); + + return buf.c; +} + + +static char *url_adapt_ext(const char *src, size_t srclen, size_t *newlen, zend_bool do_flush TSRMLS_DC) +{ + url_adapt_state_ex_t *ctx; + char *retval; + + ctx = &BG(url_adapt_state_ex); + + xx_mainloop(ctx, src, srclen TSRMLS_CC); + + *newlen = ctx->result.len; + if (!ctx->result.c) { + smart_str_appendl(&ctx->result, "", 0); + } + smart_str_0(&ctx->result); + if (do_flush) { + smart_str_appendl(&ctx->result, ctx->buf.c, ctx->buf.len); + *newlen += ctx->buf.len; + smart_str_free(&ctx->buf); + } + retval = ctx->result.c; + ctx->result.c = NULL; + ctx->result.len = 0; + return retval; +} + +static int php_url_scanner_ex_activate(TSRMLS_D) +{ + url_adapt_state_ex_t *ctx; + + ctx = &BG(url_adapt_state_ex); + + memset(ctx, 0, ((size_t) &((url_adapt_state_ex_t *)0)->tags)); + + return SUCCESS; +} + +static int php_url_scanner_ex_deactivate(TSRMLS_D) +{ + url_adapt_state_ex_t *ctx; + + ctx = &BG(url_adapt_state_ex); + + smart_str_free(&ctx->result); + smart_str_free(&ctx->buf); + smart_str_free(&ctx->tag); + smart_str_free(&ctx->arg); + + return SUCCESS; +} + +static void php_url_scanner_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC) +{ + size_t len; + + if (BG(url_adapt_state_ex).url_app.len != 0) { + *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & (PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_CONT | PHP_OUTPUT_HANDLER_FLUSH | PHP_OUTPUT_HANDLER_FINAL) ? 1 : 0) TSRMLS_CC); + if (sizeof(uint) < sizeof(size_t)) { + if (len > UINT_MAX) + len = UINT_MAX; + } + *handled_output_len = len; + } else if (BG(url_adapt_state_ex).url_app.len == 0) { + url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex); + if (ctx->buf.len) { + smart_str_appendl(&ctx->result, ctx->buf.c, ctx->buf.len); + smart_str_appendl(&ctx->result, output, output_len); + + *handled_output = ctx->result.c; + *handled_output_len = ctx->buf.len + output_len; + + ctx->result.c = NULL; + ctx->result.len = 0; + smart_str_free(&ctx->buf); + } else { + *handled_output = estrndup(output, *handled_output_len = output_len); + } + } else { + *handled_output = NULL; + } +} + +PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC) +{ + char *encoded; + int encoded_len; + smart_str val; + + if (! BG(url_adapt_state_ex).active) { + php_url_scanner_ex_activate(TSRMLS_C); + php_output_start_internal(ZEND_STRL("URL-Rewriter"), php_url_scanner_output_handler, 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC); + BG(url_adapt_state_ex).active = 1; + } + + + if (BG(url_adapt_state_ex).url_app.len != 0) { + smart_str_appends(&BG(url_adapt_state_ex).url_app, PG(arg_separator).output); + } + + if (urlencode) { + encoded = php_url_encode(value, value_len, &encoded_len); + smart_str_setl(&val, encoded, encoded_len); + } else { + smart_str_setl(&val, value, value_len); + } + + smart_str_appendl(&BG(url_adapt_state_ex).url_app, name, name_len); + smart_str_appendc(&BG(url_adapt_state_ex).url_app, '='); + smart_str_append(&BG(url_adapt_state_ex).url_app, &val); + + smart_str_appends(&BG(url_adapt_state_ex).form_app, ""); + + if (urlencode) + efree(encoded); + + return SUCCESS; +} + +PHPAPI int php_url_scanner_reset_vars(TSRMLS_D) +{ + BG(url_adapt_state_ex).form_app.len = 0; + BG(url_adapt_state_ex).url_app.len = 0; + + return SUCCESS; +} + +PHP_MINIT_FUNCTION(url_scanner) +{ + BG(url_adapt_state_ex).tags = NULL; + + BG(url_adapt_state_ex).form_app.c = BG(url_adapt_state_ex).url_app.c = 0; + BG(url_adapt_state_ex).form_app.len = BG(url_adapt_state_ex).url_app.len = 0; + + REGISTER_INI_ENTRIES(); + return SUCCESS; +} + +PHP_MSHUTDOWN_FUNCTION(url_scanner) +{ + UNREGISTER_INI_ENTRIES(); + + return SUCCESS; +} + +PHP_RINIT_FUNCTION(url_scanner) +{ + BG(url_adapt_state_ex).active = 0; + + return SUCCESS; +} + +PHP_RSHUTDOWN_FUNCTION(url_scanner) +{ + if (BG(url_adapt_state_ex).active) { + php_url_scanner_ex_deactivate(TSRMLS_C); + BG(url_adapt_state_ex).active = 0; + } + + smart_str_free(&BG(url_adapt_state_ex).form_app); + smart_str_free(&BG(url_adapt_state_ex).url_app); + + return SUCCESS; +} diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c new file mode 100644 index 0000000..b009e67 --- /dev/null +++ b/ext/standard/user_filters.c @@ -0,0 +1,623 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: | + | Wez Furlong (wez@thebrainroom.com) | + | Sara Golemon (pollita@php.net) | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "php_globals.h" +#include "ext/standard/basic_functions.h" +#include "ext/standard/file.h" + +#define PHP_STREAM_BRIGADE_RES_NAME "userfilter.bucket brigade" +#define PHP_STREAM_BUCKET_RES_NAME "userfilter.bucket" +#define PHP_STREAM_FILTER_RES_NAME "userfilter.filter" + +struct php_user_filter_data { + zend_class_entry *ce; + /* variable length; this *must* be last in the structure */ + char classname[1]; +}; + +/* to provide context for calling into the next filter from user-space */ +static int le_userfilters; +static int le_bucket_brigade; +static int le_bucket; + +#define GET_FILTER_FROM_OBJ() { \ + zval **tmp; \ + if (FAILURE == zend_hash_index_find(Z_OBJPROP_P(this_ptr), 0, (void**)&tmp)) { \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "filter property vanished"); \ + RETURN_FALSE; \ + } \ + ZEND_FETCH_RESOURCE(filter, php_stream_filter*, tmp, -1, "filter", le_userfilters); \ +} + +/* define the base filter class */ + +PHP_FUNCTION(user_filter_nop) +{ +} +ZEND_BEGIN_ARG_INFO(arginfo_php_user_filter_filter, 0) + ZEND_ARG_INFO(0, in) + ZEND_ARG_INFO(0, out) + ZEND_ARG_INFO(1, consumed) + ZEND_ARG_INFO(0, closing) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_php_user_filter_onCreate, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_php_user_filter_onClose, 0) +ZEND_END_ARG_INFO() + +static const zend_function_entry user_filter_class_funcs[] = { + PHP_NAMED_FE(filter, PHP_FN(user_filter_nop), arginfo_php_user_filter_filter) + PHP_NAMED_FE(onCreate, PHP_FN(user_filter_nop), arginfo_php_user_filter_onCreate) + PHP_NAMED_FE(onClose, PHP_FN(user_filter_nop), arginfo_php_user_filter_onClose) + PHP_FE_END +}; + +static zend_class_entry user_filter_class_entry; + +static ZEND_RSRC_DTOR_FUNC(php_bucket_dtor) +{ + php_stream_bucket *bucket = (php_stream_bucket *)rsrc->ptr; + if (bucket) { + php_stream_bucket_delref(bucket TSRMLS_CC); + bucket = NULL; + } +} + +PHP_MINIT_FUNCTION(user_filters) +{ + zend_class_entry *php_user_filter; + /* init the filter class ancestor */ + INIT_CLASS_ENTRY(user_filter_class_entry, "php_user_filter", user_filter_class_funcs); + if ((php_user_filter = zend_register_internal_class(&user_filter_class_entry TSRMLS_CC)) == NULL) { + return FAILURE; + } + zend_declare_property_string(php_user_filter, "filtername", sizeof("filtername")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); + zend_declare_property_string(php_user_filter, "params", sizeof("params")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); + + /* init the filter resource; it has no dtor, as streams will always clean it up + * at the correct time */ + le_userfilters = zend_register_list_destructors_ex(NULL, NULL, PHP_STREAM_FILTER_RES_NAME, 0); + + if (le_userfilters == FAILURE) { + return FAILURE; + } + + /* Filters will dispose of their brigades */ + le_bucket_brigade = zend_register_list_destructors_ex(NULL, NULL, PHP_STREAM_BRIGADE_RES_NAME, module_number); + /* Brigades will dispose of their buckets */ + le_bucket = zend_register_list_destructors_ex(php_bucket_dtor, NULL, PHP_STREAM_BUCKET_RES_NAME, module_number); + + if (le_bucket_brigade == FAILURE) { + return FAILURE; + } + + REGISTER_LONG_CONSTANT("PSFS_PASS_ON", PSFS_PASS_ON, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PSFS_FEED_ME", PSFS_FEED_ME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PSFS_ERR_FATAL", PSFS_ERR_FATAL, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("PSFS_FLAG_NORMAL", PSFS_FLAG_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PSFS_FLAG_FLUSH_INC", PSFS_FLAG_FLUSH_INC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PSFS_FLAG_FLUSH_CLOSE", PSFS_FLAG_FLUSH_CLOSE, CONST_CS | CONST_PERSISTENT); + + return SUCCESS; +} + +PHP_RSHUTDOWN_FUNCTION(user_filters) +{ + if (BG(user_filter_map)) { + zend_hash_destroy(BG(user_filter_map)); + efree(BG(user_filter_map)); + BG(user_filter_map) = NULL; + } + + return SUCCESS; +} + +static void userfilter_dtor(php_stream_filter *thisfilter TSRMLS_DC) +{ + zval *obj = (zval*)thisfilter->abstract; + zval func_name; + zval *retval = NULL; + + if (obj == NULL) { + /* If there's no object associated then there's nothing to dispose of */ + return; + } + + ZVAL_STRINGL(&func_name, "onclose", sizeof("onclose")-1, 0); + + call_user_function_ex(NULL, + &obj, + &func_name, + &retval, + 0, NULL, + 0, NULL TSRMLS_CC); + + if (retval) + zval_ptr_dtor(&retval); + + /* kill the object */ + zval_ptr_dtor(&obj); +} + +php_stream_filter_status_t userfilter_filter( + php_stream *stream, + php_stream_filter *thisfilter, + php_stream_bucket_brigade *buckets_in, + php_stream_bucket_brigade *buckets_out, + size_t *bytes_consumed, + int flags + TSRMLS_DC) +{ + int ret = PSFS_ERR_FATAL; + zval *obj = (zval*)thisfilter->abstract; + zval func_name; + zval *retval = NULL; + zval **args[4]; + zval *zclosing, *zconsumed, *zin, *zout, *zstream; + zval zpropname; + int call_result; + + if (FAILURE == zend_hash_find(Z_OBJPROP_P(obj), "stream", sizeof("stream"), (void**)&zstream)) { + /* Give the userfilter class a hook back to the stream */ + ALLOC_INIT_ZVAL(zstream); + php_stream_to_zval(stream, zstream); + zval_copy_ctor(zstream); + add_property_zval(obj, "stream", zstream); + /* add_property_zval increments the refcount which is unwanted here */ + zval_ptr_dtor(&zstream); + } + + ZVAL_STRINGL(&func_name, "filter", sizeof("filter")-1, 0); + + /* Setup calling arguments */ + ALLOC_INIT_ZVAL(zin); + ZEND_REGISTER_RESOURCE(zin, buckets_in, le_bucket_brigade); + args[0] = &zin; + + ALLOC_INIT_ZVAL(zout); + ZEND_REGISTER_RESOURCE(zout, buckets_out, le_bucket_brigade); + args[1] = &zout; + + ALLOC_INIT_ZVAL(zconsumed); + if (bytes_consumed) { + ZVAL_LONG(zconsumed, *bytes_consumed); + } else { + ZVAL_NULL(zconsumed); + } + args[2] = &zconsumed; + + ALLOC_INIT_ZVAL(zclosing); + ZVAL_BOOL(zclosing, flags & PSFS_FLAG_FLUSH_CLOSE); + args[3] = &zclosing; + + call_result = call_user_function_ex(NULL, + &obj, + &func_name, + &retval, + 4, args, + 0, NULL TSRMLS_CC); + + if (call_result == SUCCESS && retval != NULL) { + convert_to_long(retval); + ret = Z_LVAL_P(retval); + } else if (call_result == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to call filter function"); + } + + if (bytes_consumed) { + *bytes_consumed = Z_LVAL_P(zconsumed); + } + + if (retval) { + zval_ptr_dtor(&retval); + } + + if (buckets_in->head) { + php_stream_bucket *bucket = buckets_in->head; + + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unprocessed filter buckets remaining on input brigade"); + while ((bucket = buckets_in->head)) { + /* Remove unconsumed buckets from the brigade */ + php_stream_bucket_unlink(bucket TSRMLS_CC); + php_stream_bucket_delref(bucket TSRMLS_CC); + } + } + if (ret != PSFS_PASS_ON) { + php_stream_bucket *bucket = buckets_out->head; + while (bucket != NULL) { + php_stream_bucket_unlink(bucket TSRMLS_CC); + php_stream_bucket_delref(bucket TSRMLS_CC); + bucket = buckets_out->head; + } + } + + /* filter resources are cleaned up by the stream destructor, + * keeping a reference to the stream resource here would prevent it + * from being destroyed properly */ + INIT_ZVAL(zpropname); + ZVAL_STRINGL(&zpropname, "stream", sizeof("stream")-1, 0); + Z_OBJ_HANDLER_P(obj, unset_property)(obj, &zpropname, 0 TSRMLS_CC); + + zval_ptr_dtor(&zclosing); + zval_ptr_dtor(&zconsumed); + zval_ptr_dtor(&zout); + zval_ptr_dtor(&zin); + + return ret; +} + +static php_stream_filter_ops userfilter_ops = { + userfilter_filter, + userfilter_dtor, + "user-filter" +}; + +static php_stream_filter *user_filter_factory_create(const char *filtername, + zval *filterparams, int persistent TSRMLS_DC) +{ + struct php_user_filter_data *fdat = NULL; + php_stream_filter *filter; + zval *obj, *zfilter; + zval func_name; + zval *retval = NULL; + int len; + + /* some sanity checks */ + if (persistent) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "cannot use a user-space filter with a persistent stream"); + return NULL; + } + + len = strlen(filtername); + + /* determine the classname/class entry */ + if (FAILURE == zend_hash_find(BG(user_filter_map), (char*)filtername, len + 1, (void**)&fdat)) { + char *period; + + /* Userspace Filters using ambiguous wildcards could cause problems. + i.e.: myfilter.foo.bar will always call into myfilter.foo.* + never seeing myfilter.* + TODO: Allow failed userfilter creations to continue + scanning through the list */ + if ((period = strrchr(filtername, '.'))) { + char *wildcard = emalloc(len + 3); + + /* Search for wildcard matches instead */ + memcpy(wildcard, filtername, len + 1); /* copy \0 */ + period = wildcard + (period - filtername); + while (period) { + *period = '\0'; + strncat(wildcard, ".*", 2); + if (SUCCESS == zend_hash_find(BG(user_filter_map), wildcard, strlen(wildcard) + 1, (void**)&fdat)) { + period = NULL; + } else { + *period = '\0'; + period = strrchr(wildcard, '.'); + } + } + efree(wildcard); + } + if (fdat == NULL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "Err, filter \"%s\" is not in the user-filter map, but somehow the user-filter-factory was invoked for it!?", filtername); + return NULL; + } + } + + /* bind the classname to the actual class */ + if (fdat->ce == NULL) { + if (FAILURE == zend_lookup_class(fdat->classname, strlen(fdat->classname), + (zend_class_entry ***)&fdat->ce TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "user-filter \"%s\" requires class \"%s\", but that class is not defined", + filtername, fdat->classname); + return NULL; + } + fdat->ce = *(zend_class_entry**)fdat->ce; + + } + + filter = php_stream_filter_alloc(&userfilter_ops, NULL, 0); + if (filter == NULL) { + return NULL; + } + + /* create the object */ + ALLOC_ZVAL(obj); + object_init_ex(obj, fdat->ce); + Z_SET_REFCOUNT_P(obj, 1); + Z_SET_ISREF_P(obj); + + /* filtername */ + add_property_string(obj, "filtername", (char*)filtername, 1); + + /* and the parameters, if any */ + if (filterparams) { + add_property_zval(obj, "params", filterparams); + } else { + add_property_null(obj, "params"); + } + + /* invoke the constructor */ + ZVAL_STRINGL(&func_name, "oncreate", sizeof("oncreate")-1, 0); + + call_user_function_ex(NULL, + &obj, + &func_name, + &retval, + 0, NULL, + 0, NULL TSRMLS_CC); + + if (retval) { + if (Z_TYPE_P(retval) == IS_BOOL && Z_LVAL_P(retval) == 0) { + /* User reported filter creation error "return false;" */ + zval_ptr_dtor(&retval); + + /* Kill the filter (safely) */ + filter->abstract = NULL; + php_stream_filter_free(filter TSRMLS_CC); + + /* Kill the object */ + zval_ptr_dtor(&obj); + + /* Report failure to filter_alloc */ + return NULL; + } + zval_ptr_dtor(&retval); + } + + /* set the filter property, this will be used during cleanup */ + ALLOC_INIT_ZVAL(zfilter); + ZEND_REGISTER_RESOURCE(zfilter, filter, le_userfilters); + filter->abstract = obj; + add_property_zval(obj, "filter", zfilter); + /* add_property_zval increments the refcount which is unwanted here */ + zval_ptr_dtor(&zfilter); + + return filter; +} + +static php_stream_filter_factory user_filter_factory = { + user_filter_factory_create +}; + +static void filter_item_dtor(struct php_user_filter_data *fdat) +{ +} + +/* {{{ proto object stream_bucket_make_writeable(resource brigade) + Return a bucket object from the brigade for operating on */ +PHP_FUNCTION(stream_bucket_make_writeable) +{ + zval *zbrigade, *zbucket; + php_stream_bucket_brigade *brigade; + php_stream_bucket *bucket; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zbrigade) == FAILURE) { + RETURN_FALSE; + } + + ZEND_FETCH_RESOURCE(brigade, php_stream_bucket_brigade *, &zbrigade, -1, PHP_STREAM_BRIGADE_RES_NAME, le_bucket_brigade); + + ZVAL_NULL(return_value); + + if (brigade->head && (bucket = php_stream_bucket_make_writeable(brigade->head TSRMLS_CC))) { + ALLOC_INIT_ZVAL(zbucket); + ZEND_REGISTER_RESOURCE(zbucket, bucket, le_bucket); + object_init(return_value); + add_property_zval(return_value, "bucket", zbucket); + /* add_property_zval increments the refcount which is unwanted here */ + zval_ptr_dtor(&zbucket); + add_property_stringl(return_value, "data", bucket->buf, bucket->buflen, 1); + add_property_long(return_value, "datalen", bucket->buflen); + } +} +/* }}} */ + +/* {{{ php_stream_bucket_attach */ +static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS) +{ + zval *zbrigade, *zobject; + zval **pzbucket, **pzdata; + php_stream_bucket_brigade *brigade; + php_stream_bucket *bucket; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zo", &zbrigade, &zobject) == FAILURE) { + RETURN_FALSE; + } + + if (FAILURE == zend_hash_find(Z_OBJPROP_P(zobject), "bucket", 7, (void**)&pzbucket)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Object has no bucket property"); + RETURN_FALSE; + } + + ZEND_FETCH_RESOURCE(brigade, php_stream_bucket_brigade *, &zbrigade, -1, PHP_STREAM_BRIGADE_RES_NAME, le_bucket_brigade); + ZEND_FETCH_RESOURCE(bucket, php_stream_bucket *, pzbucket, -1, PHP_STREAM_BUCKET_RES_NAME, le_bucket); + + if (SUCCESS == zend_hash_find(Z_OBJPROP_P(zobject), "data", 5, (void**)&pzdata) && (*pzdata)->type == IS_STRING) { + if (!bucket->own_buf) { + bucket = php_stream_bucket_make_writeable(bucket TSRMLS_CC); + } + if ((int)bucket->buflen != Z_STRLEN_PP(pzdata)) { + bucket->buf = perealloc(bucket->buf, Z_STRLEN_PP(pzdata), bucket->is_persistent); + bucket->buflen = Z_STRLEN_PP(pzdata); + } + memcpy(bucket->buf, Z_STRVAL_PP(pzdata), bucket->buflen); + } + + if (append) { + php_stream_bucket_append(brigade, bucket TSRMLS_CC); + } else { + php_stream_bucket_prepend(brigade, bucket TSRMLS_CC); + } + /* This is a hack necessary to accomodate situations where bucket is appended to the stream + * multiple times. See bug35916.phpt for reference. + */ + if (bucket->refcount == 1) { + bucket->refcount++; + } +} +/* }}} */ + +/* {{{ proto void stream_bucket_prepend(resource brigade, resource bucket) + Prepend bucket to brigade */ +PHP_FUNCTION(stream_bucket_prepend) +{ + php_stream_bucket_attach(0, INTERNAL_FUNCTION_PARAM_PASSTHRU); +} +/* }}} */ + +/* {{{ proto void stream_bucket_append(resource brigade, resource bucket) + Append bucket to brigade */ +PHP_FUNCTION(stream_bucket_append) +{ + php_stream_bucket_attach(1, INTERNAL_FUNCTION_PARAM_PASSTHRU); +} +/* }}} */ + +/* {{{ proto resource stream_bucket_new(resource stream, string buffer) + Create a new bucket for use on the current stream */ +PHP_FUNCTION(stream_bucket_new) +{ + zval *zstream, *zbucket; + php_stream *stream; + char *buffer; + char *pbuffer; + int buffer_len; + php_stream_bucket *bucket; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &zstream, &buffer, &buffer_len) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, &zstream); + + if (!(pbuffer = pemalloc(buffer_len, php_stream_is_persistent(stream)))) { + RETURN_FALSE; + } + + memcpy(pbuffer, buffer, buffer_len); + + bucket = php_stream_bucket_new(stream, pbuffer, buffer_len, 1, php_stream_is_persistent(stream) TSRMLS_CC); + + if (bucket == NULL) { + RETURN_FALSE; + } + + ALLOC_INIT_ZVAL(zbucket); + ZEND_REGISTER_RESOURCE(zbucket, bucket, le_bucket); + object_init(return_value); + add_property_zval(return_value, "bucket", zbucket); + /* add_property_zval increments the refcount which is unwanted here */ + zval_ptr_dtor(&zbucket); + add_property_stringl(return_value, "data", bucket->buf, bucket->buflen, 1); + add_property_long(return_value, "datalen", bucket->buflen); +} +/* }}} */ + +/* {{{ proto array stream_get_filters(void) + Returns a list of registered filters */ +PHP_FUNCTION(stream_get_filters) +{ + char *filter_name; + int key_flags; + uint filter_name_len = 0; + HashTable *filters_hash; + ulong num_key; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + array_init(return_value); + + filters_hash = php_get_stream_filters_hash(); + + if (filters_hash) { + for(zend_hash_internal_pointer_reset(filters_hash); + (key_flags = zend_hash_get_current_key_ex(filters_hash, &filter_name, &filter_name_len, &num_key, 0, NULL)) != HASH_KEY_NON_EXISTANT; + zend_hash_move_forward(filters_hash)) + if (key_flags == HASH_KEY_IS_STRING) { + add_next_index_stringl(return_value, filter_name, filter_name_len - 1, 1); + } + } + /* It's okay to return an empty array if no filters are registered */ +} +/* }}} */ + +/* {{{ proto bool stream_filter_register(string filtername, string classname) + Registers a custom filter handler class */ +PHP_FUNCTION(stream_filter_register) +{ + char *filtername, *classname; + int filtername_len, classname_len; + struct php_user_filter_data *fdat; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &filtername, &filtername_len, + &classname, &classname_len) == FAILURE) { + RETURN_FALSE; + } + + RETVAL_FALSE; + + if (!filtername_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Filter name cannot be empty"); + return; + } + + if (!classname_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Class name cannot be empty"); + return; + } + + if (!BG(user_filter_map)) { + BG(user_filter_map) = (HashTable*) emalloc(sizeof(HashTable)); + zend_hash_init(BG(user_filter_map), 5, NULL, (dtor_func_t) filter_item_dtor, 0); + } + + fdat = ecalloc(1, sizeof(struct php_user_filter_data) + classname_len); + memcpy(fdat->classname, classname, classname_len); + + if (zend_hash_add(BG(user_filter_map), filtername, filtername_len + 1, (void*)fdat, + sizeof(*fdat) + classname_len, NULL) == SUCCESS && + php_stream_filter_register_factory_volatile(filtername, &user_filter_factory TSRMLS_CC) == SUCCESS) { + RETVAL_TRUE; + } + + efree(fdat); +} +/* }}} */ + + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c new file mode 100644 index 0000000..f0142ed --- /dev/null +++ b/ext/standard/uuencode.c @@ -0,0 +1,233 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Ilia Alshanetsky | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +/* + * Portions of this code are based on Berkeley's uuencode/uudecode + * implementation. + * + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "php.h" +#include "php_uuencode.h" + +#define PHP_UU_ENC(c) ((c) ? ((c) & 077) + ' ' : '`') +#define PHP_UU_ENC_C2(c) PHP_UU_ENC(((*(c) << 4) & 060) | ((*((c) + 1) >> 4) & 017)) +#define PHP_UU_ENC_C3(c) PHP_UU_ENC(((*(c + 1) << 2) & 074) | ((*((c) + 2) >> 6) & 03)) + +#define PHP_UU_DEC(c) (((c) - ' ') & 077) + +PHPAPI int php_uuencode(char *src, int src_len, char **dest) /* {{{ */ +{ + int len = 45; + char *p, *s, *e, *ee; + + /* encoded length is ~ 38% greater then the original */ + p = *dest = safe_emalloc((size_t) ceil(src_len * 1.38), 1, 46); + s = src; + e = src + src_len; + + while ((s + 3) < e) { + ee = s + len; + if (ee > e) { + ee = e; + len = ee - s; + if (len % 3) { + ee = s + (int) (floor(len / 3) * 3); + } + } + *p++ = PHP_UU_ENC(len); + + while (s < ee) { + *p++ = PHP_UU_ENC(*s >> 2); + *p++ = PHP_UU_ENC_C2(s); + *p++ = PHP_UU_ENC_C3(s); + *p++ = PHP_UU_ENC(*(s + 2) & 077); + + s += 3; + } + + if (len == 45) { + *p++ = '\n'; + } + } + + if (s < e) { + if (len == 45) { + *p++ = PHP_UU_ENC(e - s); + len = 0; + } + + *p++ = PHP_UU_ENC(*s >> 2); + *p++ = PHP_UU_ENC_C2(s); + *p++ = ((e - s) > 1) ? PHP_UU_ENC_C3(s) : PHP_UU_ENC('\0'); + *p++ = ((e - s) > 2) ? PHP_UU_ENC(*(s + 2) & 077) : PHP_UU_ENC('\0'); + } + + if (len < 45) { + *p++ = '\n'; + } + + *p++ = PHP_UU_ENC('\0'); + *p++ = '\n'; + *p = '\0'; + + return (p - *dest); +} +/* }}} */ + +PHPAPI int php_uudecode(char *src, int src_len, char **dest) /* {{{ */ +{ + int len, total_len=0; + char *s, *e, *p, *ee; + + p = *dest = safe_emalloc((size_t) ceil(src_len * 0.75), 1, 1); + s = src; + e = src + src_len; + + while (s < e) { + if ((len = PHP_UU_DEC(*s++)) <= 0) { + break; + } + /* sanity check */ + if (len > src_len) { + goto err; + } + + total_len += len; + + ee = s + (len == 45 ? 60 : (int) floor(len * 1.33)); + /* sanity check */ + if (ee > e) { + goto err; + } + + while (s < ee) { + *p++ = PHP_UU_DEC(*s) << 2 | PHP_UU_DEC(*(s + 1)) >> 4; + *p++ = PHP_UU_DEC(*(s + 1)) << 4 | PHP_UU_DEC(*(s + 2)) >> 2; + *p++ = PHP_UU_DEC(*(s + 2)) << 6 | PHP_UU_DEC(*(s + 3)); + s += 4; + } + + if (len < 45) { + break; + } + + /* skip \n */ + s++; + } + + if ((len = total_len > (p - *dest))) { + *p++ = PHP_UU_DEC(*s) << 2 | PHP_UU_DEC(*(s + 1)) >> 4; + if (len > 1) { + *p++ = PHP_UU_DEC(*(s + 1)) << 4 | PHP_UU_DEC(*(s + 2)) >> 2; + if (len > 2) { + *p++ = PHP_UU_DEC(*(s + 2)) << 6 | PHP_UU_DEC(*(s + 3)); + } + } + } + + *(*dest + total_len) = '\0'; + + return total_len; + +err: + efree(*dest); + return -1; +} +/* }}} */ + +/* {{{ proto string convert_uuencode(string data) + uuencode a string */ +PHP_FUNCTION(convert_uuencode) +{ + char *src, *dst; + int src_len, dst_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &src, &src_len) == FAILURE || src_len < 1) { + RETURN_FALSE; + } + + dst_len = php_uuencode(src, src_len, &dst); + + RETURN_STRINGL(dst, dst_len, 0); +} +/* }}} */ + +/* {{{ proto string convert_uudecode(string data) + decode a uuencoded string */ +PHP_FUNCTION(convert_uudecode) +{ + char *src, *dst; + int src_len, dst_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &src, &src_len) == FAILURE || src_len < 1) { + RETURN_FALSE; + } + + dst_len = php_uudecode(src, src_len, &dst); + if (dst_len < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The given parameter is not a valid uuencoded string"); + RETURN_FALSE; + } + + RETURN_STRINGL(dst, dst_len, 0); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/ext/standard/var.c b/ext/standard/var.c new file mode 100644 index 0000000..b13edf6 --- /dev/null +++ b/ext/standard/var.c @@ -0,0 +1,994 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Jani LehtimÀki | + | Thies C. Arntzen | + | Sascha Schumann | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +/* {{{ includes +*/ +#include +#include +#include +#include "php.h" +#include "php_string.h" +#include "php_var.h" +#include "php_smart_str.h" +#include "basic_functions.h" +#include "php_incomplete_class.h" + +#define COMMON (Z_ISREF_PP(struc) ? "&" : "") +/* }}} */ + +static int php_array_element_dump(zval **zv TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ +{ + int level; + + level = va_arg(args, int); + + if (hash_key->nKeyLength == 0) { /* numeric key */ + php_printf("%*c[%ld]=>\n", level + 1, ' ', hash_key->h); + } else { /* string key */ + php_printf("%*c[\"", level + 1, ' '); + PHPWRITE(hash_key->arKey, hash_key->nKeyLength - 1); + php_printf("\"]=>\n"); + } + php_var_dump(zv, level + 2 TSRMLS_CC); + return 0; +} +/* }}} */ + +static int php_object_property_dump(zval **zv TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ +{ + int level; + const char *prop_name, *class_name; + + level = va_arg(args, int); + + if (hash_key->nKeyLength == 0) { /* numeric key */ + php_printf("%*c[%ld]=>\n", level + 1, ' ', hash_key->h); + } else { /* string key */ + int unmangle = zend_unmangle_property_name(hash_key->arKey, hash_key->nKeyLength - 1, &class_name, &prop_name); + php_printf("%*c[", level + 1, ' '); + + if (class_name && unmangle == SUCCESS) { + if (class_name[0] == '*') { + php_printf("\"%s\":protected", prop_name); + } else { + php_printf("\"%s\":\"%s\":private", prop_name, class_name); + } + } else { + php_printf("\""); + PHPWRITE(hash_key->arKey, hash_key->nKeyLength - 1); + php_printf("\""); + } + ZEND_PUTS("]=>\n"); + } + php_var_dump(zv, level + 2 TSRMLS_CC); + return 0; +} +/* }}} */ + +PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC) /* {{{ */ +{ + HashTable *myht; + const char *class_name; + zend_uint class_name_len; + int (*php_element_dump_func)(zval** TSRMLS_DC, int, va_list, zend_hash_key*); + int is_temp; + + if (level > 1) { + php_printf("%*c", level - 1, ' '); + } + + switch (Z_TYPE_PP(struc)) { + case IS_BOOL: + php_printf("%sbool(%s)\n", COMMON, Z_LVAL_PP(struc) ? "true" : "false"); + break; + case IS_NULL: + php_printf("%sNULL\n", COMMON); + break; + case IS_LONG: + php_printf("%sint(%ld)\n", COMMON, Z_LVAL_PP(struc)); + break; + case IS_DOUBLE: + php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_PP(struc)); + break; + case IS_STRING: + php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_PP(struc)); + PHPWRITE(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc)); + PUTS("\"\n"); + break; + case IS_ARRAY: + myht = Z_ARRVAL_PP(struc); + if (++myht->nApplyCount > 1) { + PUTS("*RECURSION*\n"); + --myht->nApplyCount; + return; + } + php_printf("%sarray(%d) {\n", COMMON, zend_hash_num_elements(myht)); + php_element_dump_func = php_array_element_dump; + is_temp = 0; + goto head_done; + case IS_OBJECT: + myht = Z_OBJDEBUG_PP(struc, is_temp); + if (myht && ++myht->nApplyCount > 1) { + PUTS("*RECURSION*\n"); + --myht->nApplyCount; + return; + } + + if (Z_OBJ_HANDLER(**struc, get_class_name)) { + Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC); + php_printf("%sobject(%s)#%d (%d) {\n", COMMON, class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0); + efree((char*)class_name); + } else { + php_printf("%sobject(unknown class)#%d (%d) {\n", COMMON, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0); + } + php_element_dump_func = php_object_property_dump; +head_done: + if (myht) { + zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) php_element_dump_func, 1, level); + --myht->nApplyCount; + if (is_temp) { + zend_hash_destroy(myht); + efree(myht); + } + } + if (level > 1) { + php_printf("%*c", level-1, ' '); + } + PUTS("}\n"); + break; + case IS_RESOURCE: { + const char *type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(struc) TSRMLS_CC); + php_printf("%sresource(%ld) of type (%s)\n", COMMON, Z_LVAL_PP(struc), type_name ? type_name : "Unknown"); + break; + } + default: + php_printf("%sUNKNOWN:0\n", COMMON); + break; + } +} +/* }}} */ + +/* {{{ proto void var_dump(mixed var) + Dumps a string representation of variable to output */ +PHP_FUNCTION(var_dump) +{ + zval ***args; + int argc; + int i; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) { + return; + } + + for (i = 0; i < argc; i++) { + php_var_dump(args[i], 1 TSRMLS_CC); + } + efree(args); +} +/* }}} */ + +static int zval_array_element_dump(zval **zv TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ +{ + int level; + + level = va_arg(args, int); + + if (hash_key->nKeyLength == 0) { /* numeric key */ + php_printf("%*c[%ld]=>\n", level + 1, ' ', hash_key->h); + } else { /* string key */ + /* XXX: perphaps when we are inside the class we should permit access to + * private & protected values + */ + if (va_arg(args, int) && hash_key->arKey[0] == '\0') { + return 0; + } + php_printf("%*c[\"", level + 1, ' '); + PHPWRITE(hash_key->arKey, hash_key->nKeyLength - 1); + php_printf("\"]=>\n"); + } + php_debug_zval_dump(zv, level + 2 TSRMLS_CC); + return 0; +} +/* }}} */ + +static int zval_object_property_dump(zval **zv TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ +{ + int level; + const char *prop_name, *class_name; + + level = va_arg(args, int); + + if (hash_key->nKeyLength == 0) { /* numeric key */ + php_printf("%*c[%ld]=>\n", level + 1, ' ', hash_key->h); + } else { /* string key */ + zend_unmangle_property_name(hash_key->arKey, hash_key->nKeyLength - 1, &class_name, &prop_name); + php_printf("%*c[", level + 1, ' '); + + if (class_name) { + if (class_name[0] == '*') { + php_printf("\"%s\":protected", prop_name); + } else { + php_printf("\"%s\":\"%s\":private", prop_name, class_name); + } + } else { + php_printf("\"%s\"", prop_name); + } + ZEND_PUTS("]=>\n"); + } + php_debug_zval_dump(zv, level + 2 TSRMLS_CC); + return 0; +} +/* }}} */ + +PHPAPI void php_debug_zval_dump(zval **struc, int level TSRMLS_DC) /* {{{ */ +{ + HashTable *myht = NULL; + const char *class_name; + zend_uint class_name_len; + int (*zval_element_dump_func)(zval** TSRMLS_DC, int, va_list, zend_hash_key*); + int is_temp = 0; + + if (level > 1) { + php_printf("%*c", level - 1, ' '); + } + + switch (Z_TYPE_PP(struc)) { + case IS_BOOL: + php_printf("%sbool(%s) refcount(%u)\n", COMMON, Z_LVAL_PP(struc)?"true":"false", Z_REFCOUNT_PP(struc)); + break; + case IS_NULL: + php_printf("%sNULL refcount(%u)\n", COMMON, Z_REFCOUNT_PP(struc)); + break; + case IS_LONG: + php_printf("%slong(%ld) refcount(%u)\n", COMMON, Z_LVAL_PP(struc), Z_REFCOUNT_PP(struc)); + break; + case IS_DOUBLE: + php_printf("%sdouble(%.*G) refcount(%u)\n", COMMON, (int) EG(precision), Z_DVAL_PP(struc), Z_REFCOUNT_PP(struc)); + break; + case IS_STRING: + php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_PP(struc)); + PHPWRITE(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc)); + php_printf("\" refcount(%u)\n", Z_REFCOUNT_PP(struc)); + break; + case IS_ARRAY: + myht = Z_ARRVAL_PP(struc); + if (myht->nApplyCount > 1) { + PUTS("*RECURSION*\n"); + return; + } + php_printf("%sarray(%d) refcount(%u){\n", COMMON, zend_hash_num_elements(myht), Z_REFCOUNT_PP(struc)); + zval_element_dump_func = zval_array_element_dump; + goto head_done; + case IS_OBJECT: + myht = Z_OBJDEBUG_PP(struc, is_temp); + if (myht && myht->nApplyCount > 1) { + PUTS("*RECURSION*\n"); + return; + } + Z_OBJ_HANDLER_PP(struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC); + php_printf("%sobject(%s)#%d (%d) refcount(%u){\n", COMMON, class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0, Z_REFCOUNT_PP(struc)); + efree((char*)class_name); + zval_element_dump_func = zval_object_property_dump; +head_done: + if (myht) { + zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) zval_element_dump_func, 1, level, (Z_TYPE_PP(struc) == IS_ARRAY ? 0 : 1)); + if (is_temp) { + zend_hash_destroy(myht); + efree(myht); + } + } + if (level > 1) { + php_printf("%*c", level - 1, ' '); + } + PUTS("}\n"); + break; + case IS_RESOURCE: { + const char *type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(struc) TSRMLS_CC); + php_printf("%sresource(%ld) of type (%s) refcount(%u)\n", COMMON, Z_LVAL_PP(struc), type_name ? type_name : "Unknown", Z_REFCOUNT_PP(struc)); + break; + } + default: + php_printf("%sUNKNOWN:0\n", COMMON); + break; + } +} +/* }}} */ + +/* {{{ proto void debug_zval_dump(mixed var) + Dumps a string representation of an internal zend value to output. */ +PHP_FUNCTION(debug_zval_dump) +{ + zval ***args; + int argc; + int i; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) { + return; + } + + for (i = 0; i < argc; i++) { + php_debug_zval_dump(args[i], 1 TSRMLS_CC); + } + efree(args); +} +/* }}} */ + +#define buffer_append_spaces(buf, num_spaces) \ + do { \ + char *tmp_spaces; \ + int tmp_spaces_len; \ + tmp_spaces_len = spprintf(&tmp_spaces, 0,"%*c", num_spaces, ' '); \ + smart_str_appendl(buf, tmp_spaces, tmp_spaces_len); \ + efree(tmp_spaces); \ + } while(0); + +static int php_array_element_export(zval **zv TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ +{ + int level; + smart_str *buf; + + level = va_arg(args, int); + buf = va_arg(args, smart_str *); + + if (hash_key->nKeyLength == 0) { /* numeric key */ + buffer_append_spaces(buf, level+1); + smart_str_append_long(buf, (long) hash_key->h); + smart_str_appendl(buf, " => ", 4); + + } else { /* string key */ + char *key, *tmp_str; + int key_len, tmp_len; + key = php_addcslashes(hash_key->arKey, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC); + tmp_str = php_str_to_str_ex(key, key_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len, 0, NULL); + + buffer_append_spaces(buf, level + 1); + + smart_str_appendc(buf, '\''); + smart_str_appendl(buf, tmp_str, tmp_len); + smart_str_appendl(buf, "' => ", 5); + + efree(key); + efree(tmp_str); + } + php_var_export_ex(zv, level + 2, buf TSRMLS_CC); + + smart_str_appendc(buf, ','); + smart_str_appendc(buf, '\n'); + + return 0; +} +/* }}} */ + +static int php_object_element_export(zval **zv TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ +{ + int level; + smart_str *buf; + + level = va_arg(args, int); + buf = va_arg(args, smart_str *); + + buffer_append_spaces(buf, level + 2); + if (hash_key->nKeyLength != 0) { + const char *class_name; /* ignored, but must be passed to unmangle */ + const char *pname; + char *pname_esc; + int pname_esc_len; + + zend_unmangle_property_name(hash_key->arKey, hash_key->nKeyLength - 1, + &class_name, &pname); + pname_esc = php_addcslashes(pname, strlen(pname), &pname_esc_len, 0, + "'\\", 2 TSRMLS_CC); + + smart_str_appendc(buf, '\''); + smart_str_appendl(buf, pname_esc, pname_esc_len); + smart_str_appendc(buf, '\''); + efree(pname_esc); + } else { + smart_str_append_long(buf, (long) hash_key->h); + } + smart_str_appendl(buf, " => ", 4); + php_var_export_ex(zv, level + 2, buf TSRMLS_CC); + smart_str_appendc(buf, ','); + smart_str_appendc(buf, '\n'); + return 0; +} +/* }}} */ + +PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC) /* {{{ */ +{ + HashTable *myht; + char *tmp_str, *tmp_str2; + int tmp_len, tmp_len2; + const char *class_name; + zend_uint class_name_len; + + switch (Z_TYPE_PP(struc)) { + case IS_BOOL: + if (Z_LVAL_PP(struc)) { + smart_str_appendl(buf, "true", 4); + } else { + smart_str_appendl(buf, "false", 5); + } + break; + case IS_NULL: + smart_str_appendl(buf, "NULL", 4); + break; + case IS_LONG: + smart_str_append_long(buf, Z_LVAL_PP(struc)); + break; + case IS_DOUBLE: + tmp_len = spprintf(&tmp_str, 0,"%.*H", (int) EG(precision), Z_DVAL_PP(struc)); + smart_str_appendl(buf, tmp_str, tmp_len); + efree(tmp_str); + break; + case IS_STRING: + tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\", 2 TSRMLS_CC); + tmp_str2 = php_str_to_str_ex(tmp_str, tmp_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len2, 0, NULL); + + smart_str_appendc(buf, '\''); + smart_str_appendl(buf, tmp_str2, tmp_len2); + smart_str_appendc(buf, '\''); + + efree(tmp_str2); + efree(tmp_str); + break; + case IS_ARRAY: + myht = Z_ARRVAL_PP(struc); + if(myht && myht->nApplyCount > 0){ + smart_str_appendl(buf, "NULL", 4); + zend_error(E_WARNING, "var_export does not handle circular references"); + return; + } + if (level > 1) { + smart_str_appendc(buf, '\n'); + buffer_append_spaces(buf, level - 1); + } + smart_str_appendl(buf, "array (\n", 8); + zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) php_array_element_export, 2, level, buf); + + if (level > 1) { + buffer_append_spaces(buf, level - 1); + } + smart_str_appendc(buf, ')'); + + break; + + case IS_OBJECT: + myht = Z_OBJPROP_PP(struc); + if(myht && myht->nApplyCount > 0){ + smart_str_appendl(buf, "NULL", 4); + zend_error(E_WARNING, "var_export does not handle circular references"); + return; + } + if (level > 1) { + smart_str_appendc(buf, '\n'); + buffer_append_spaces(buf, level - 1); + } + Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC); + + smart_str_appendl(buf, class_name, class_name_len); + smart_str_appendl(buf, "::__set_state(array(\n", 21); + + efree((char*)class_name); + if (myht) { + zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) php_object_element_export, 1, level, buf); + } + if (level > 1) { + buffer_append_spaces(buf, level - 1); + } + smart_str_appendl(buf, "))", 2); + + break; + default: + smart_str_appendl(buf, "NULL", 4); + break; + } +} +/* }}} */ + +/* FOR BC reasons, this will always perform and then print */ +PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC) /* {{{ */ +{ + smart_str buf = {0}; + php_var_export_ex(struc, level, &buf TSRMLS_CC); + smart_str_0 (&buf); + PHPWRITE(buf.c, buf.len); + smart_str_free(&buf); +} +/* }}} */ + + +/* {{{ proto mixed var_export(mixed var [, bool return]) + Outputs or returns a string representation of a variable */ +PHP_FUNCTION(var_export) +{ + zval *var; + zend_bool return_output = 0; + smart_str buf = {0}; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &var, &return_output) == FAILURE) { + return; + } + + php_var_export_ex(&var, 1, &buf TSRMLS_CC); + smart_str_0 (&buf); + + if (return_output) { + RETVAL_STRINGL(buf.c, buf.len, 1); + } else { + PHPWRITE(buf.c, buf.len); + } + smart_str_free(&buf); +} +/* }}} */ + +static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var_hash TSRMLS_DC); + +static inline int php_add_var_hash(HashTable *var_hash, zval *var, void *var_old TSRMLS_DC) /* {{{ */ +{ + ulong var_no; + char id[32], *p; + register int len; + + /* relies on "(long)" being a perfect hash function for data pointers, + * however the actual identity of an object has had to be determined + * by its object handle since 5.0. */ + if ((Z_TYPE_P(var) == IS_OBJECT) && Z_OBJ_HT_P(var)->get_class_entry) { + p = smart_str_print_long(id + sizeof(id) - 1, (long) Z_OBJ_HANDLE_P(var)); + *(--p) = 'O'; + len = id + sizeof(id) - 1 - p; + } else { + p = smart_str_print_long(id + sizeof(id) - 1, (long) var); + len = id + sizeof(id) - 1 - p; + } + + if (var_old && zend_hash_find(var_hash, p, len, var_old) == SUCCESS) { + if (!Z_ISREF_P(var)) { + /* we still need to bump up the counter, since non-refs will + * be counted separately by unserializer */ + var_no = -1; + zend_hash_next_index_insert(var_hash, &var_no, sizeof(var_no), NULL); + } +#if 0 + fprintf(stderr, "- had var (%d): %lu\n", Z_TYPE_P(var), **(ulong**)var_old); +#endif + return FAILURE; + } + + /* +1 because otherwise hash will think we are trying to store NULL pointer */ + var_no = zend_hash_num_elements(var_hash) + 1; + zend_hash_add(var_hash, p, len, &var_no, sizeof(var_no), NULL); +#if 0 + fprintf(stderr, "+ add var (%d): %lu\n", Z_TYPE_P(var), var_no); +#endif + return SUCCESS; +} +/* }}} */ + +static inline void php_var_serialize_long(smart_str *buf, long val) /* {{{ */ +{ + smart_str_appendl(buf, "i:", 2); + smart_str_append_long(buf, val); + smart_str_appendc(buf, ';'); +} +/* }}} */ + +static inline void php_var_serialize_string(smart_str *buf, char *str, int len) /* {{{ */ +{ + smart_str_appendl(buf, "s:", 2); + smart_str_append_long(buf, len); + smart_str_appendl(buf, ":\"", 2); + smart_str_appendl(buf, str, len); + smart_str_appendl(buf, "\";", 2); +} +/* }}} */ + +static inline zend_bool php_var_serialize_class_name(smart_str *buf, zval *struc TSRMLS_DC) /* {{{ */ +{ + PHP_CLASS_ATTRIBUTES; + + PHP_SET_CLASS_ATTRIBUTES(struc); + smart_str_appendl(buf, "O:", 2); + smart_str_append_long(buf, (int)name_len); + smart_str_appendl(buf, ":\"", 2); + smart_str_appendl(buf, class_name, name_len); + smart_str_appendl(buf, "\":", 2); + PHP_CLEANUP_CLASS_ATTRIBUTES(); + return incomplete_class; +} +/* }}} */ + +static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_ptr, HashTable *var_hash TSRMLS_DC) /* {{{ */ +{ + int count; + zend_bool incomplete_class; + + incomplete_class = php_var_serialize_class_name(buf, struc TSRMLS_CC); + /* count after serializing name, since php_var_serialize_class_name + * changes the count if the variable is incomplete class */ + count = zend_hash_num_elements(HASH_OF(retval_ptr)); + if (incomplete_class) { + --count; + } + smart_str_append_long(buf, count); + smart_str_appendl(buf, ":{", 2); + + if (count > 0) { + char *key; + zval **d, **name; + ulong index; + HashPosition pos; + int i; + zval nval, *nvalp; + HashTable *propers; + + ZVAL_NULL(&nval); + nvalp = &nval; + + zend_hash_internal_pointer_reset_ex(HASH_OF(retval_ptr), &pos); + + for (;; zend_hash_move_forward_ex(HASH_OF(retval_ptr), &pos)) { + i = zend_hash_get_current_key_ex(HASH_OF(retval_ptr), &key, NULL, &index, 0, &pos); + + if (i == HASH_KEY_NON_EXISTANT) { + break; + } + + if (incomplete_class && strcmp(key, MAGIC_MEMBER) == 0) { + continue; + } + zend_hash_get_current_data_ex(HASH_OF(retval_ptr), (void **) &name, &pos); + + if (Z_TYPE_PP(name) != IS_STRING) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only containing the names of instance-variables to serialize."); + /* we should still add element even if it's not OK, + * since we already wrote the length of the array before */ + smart_str_appendl(buf,"N;", 2); + continue; + } + propers = Z_OBJPROP_P(struc); + if (zend_hash_find(propers, Z_STRVAL_PP(name), Z_STRLEN_PP(name) + 1, (void *) &d) == SUCCESS) { + php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name)); + php_var_serialize_intern(buf, *d, var_hash TSRMLS_CC); + } else { + zend_class_entry *ce; + ce = zend_get_class_entry(struc TSRMLS_CC); + if (ce) { + char *prot_name, *priv_name; + int prop_name_length; + + do { + zend_mangle_property_name(&priv_name, &prop_name_length, ce->name, ce->name_length, Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS); + if (zend_hash_find(propers, priv_name, prop_name_length + 1, (void *) &d) == SUCCESS) { + php_var_serialize_string(buf, priv_name, prop_name_length); + pefree(priv_name, ce->type & ZEND_INTERNAL_CLASS); + php_var_serialize_intern(buf, *d, var_hash TSRMLS_CC); + break; + } + pefree(priv_name, ce->type & ZEND_INTERNAL_CLASS); + zend_mangle_property_name(&prot_name, &prop_name_length, "*", 1, Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS); + if (zend_hash_find(propers, prot_name, prop_name_length + 1, (void *) &d) == SUCCESS) { + php_var_serialize_string(buf, prot_name, prop_name_length); + pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS); + php_var_serialize_intern(buf, *d, var_hash TSRMLS_CC); + break; + } + pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS); + php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name)); + php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "\"%s\" returned as member variable from __sleep() but does not exist", Z_STRVAL_PP(name)); + } while (0); + } else { + php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name)); + php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC); + } + } + } + } + smart_str_appendc(buf, '}'); +} +/* }}} */ + +static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var_hash TSRMLS_DC) /* {{{ */ +{ + int i; + ulong *var_already; + HashTable *myht; + + if (var_hash && php_add_var_hash(var_hash, struc, (void *) &var_already TSRMLS_CC) == FAILURE) { + if (Z_ISREF_P(struc)) { + smart_str_appendl(buf, "R:", 2); + smart_str_append_long(buf, (long)*var_already); + smart_str_appendc(buf, ';'); + return; + } else if (Z_TYPE_P(struc) == IS_OBJECT) { + smart_str_appendl(buf, "r:", 2); + smart_str_append_long(buf, (long)*var_already); + smart_str_appendc(buf, ';'); + return; + } + } + + switch (Z_TYPE_P(struc)) { + case IS_BOOL: + smart_str_appendl(buf, "b:", 2); + smart_str_append_long(buf, Z_LVAL_P(struc)); + smart_str_appendc(buf, ';'); + return; + + case IS_NULL: + smart_str_appendl(buf, "N;", 2); + return; + + case IS_LONG: + php_var_serialize_long(buf, Z_LVAL_P(struc)); + return; + + case IS_DOUBLE: { + char *s; + + smart_str_appendl(buf, "d:", 2); + s = (char *) safe_emalloc(PG(serialize_precision), 1, MAX_LENGTH_OF_DOUBLE + 1); + php_gcvt(Z_DVAL_P(struc), PG(serialize_precision), '.', 'E', s); + smart_str_appends(buf, s); + smart_str_appendc(buf, ';'); + efree(s); + return; + } + + case IS_STRING: + php_var_serialize_string(buf, Z_STRVAL_P(struc), Z_STRLEN_P(struc)); + return; + + case IS_OBJECT: { + zval *retval_ptr = NULL; + zval fname; + int res; + zend_class_entry *ce = NULL; + + if (Z_OBJ_HT_P(struc)->get_class_entry) { + ce = Z_OBJCE_P(struc); + } + + if (ce && ce->serialize != NULL) { + /* has custom handler */ + unsigned char *serialized_data = NULL; + zend_uint serialized_length; + + if (ce->serialize(struc, &serialized_data, &serialized_length, (zend_serialize_data *)var_hash TSRMLS_CC) == SUCCESS) { + smart_str_appendl(buf, "C:", 2); + smart_str_append_long(buf, (int)Z_OBJCE_P(struc)->name_length); + smart_str_appendl(buf, ":\"", 2); + smart_str_appendl(buf, Z_OBJCE_P(struc)->name, Z_OBJCE_P(struc)->name_length); + smart_str_appendl(buf, "\":", 2); + + smart_str_append_long(buf, (int)serialized_length); + smart_str_appendl(buf, ":{", 2); + smart_str_appendl(buf, serialized_data, serialized_length); + smart_str_appendc(buf, '}'); + } else { + smart_str_appendl(buf, "N;", 2); + } + if (serialized_data) { + efree(serialized_data); + } + return; + } + + if (ce && ce != PHP_IC_ENTRY && zend_hash_exists(&ce->function_table, "__sleep", sizeof("__sleep"))) { + INIT_PZVAL(&fname); + ZVAL_STRINGL(&fname, "__sleep", sizeof("__sleep") - 1, 0); + BG(serialize_lock)++; + res = call_user_function_ex(CG(function_table), &struc, &fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC); + BG(serialize_lock)--; + + if (res == SUCCESS && !EG(exception)) { + if (retval_ptr) { + if (HASH_OF(retval_ptr)) { + php_var_serialize_class(buf, struc, retval_ptr, var_hash TSRMLS_CC); + } else { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only containing the names of instance-variables to serialize"); + /* we should still add element even if it's not OK, + * since we already wrote the length of the array before */ + smart_str_appendl(buf,"N;", 2); + } + zval_ptr_dtor(&retval_ptr); + } + return; + } + } + + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + /* fall-through */ + } + case IS_ARRAY: { + zend_bool incomplete_class = 0; + if (Z_TYPE_P(struc) == IS_ARRAY) { + smart_str_appendl(buf, "a:", 2); + myht = HASH_OF(struc); + } else { + incomplete_class = php_var_serialize_class_name(buf, struc TSRMLS_CC); + myht = Z_OBJPROP_P(struc); + } + /* count after serializing name, since php_var_serialize_class_name + * changes the count if the variable is incomplete class */ + i = myht ? zend_hash_num_elements(myht) : 0; + if (i > 0 && incomplete_class) { + --i; + } + smart_str_append_long(buf, i); + smart_str_appendl(buf, ":{", 2); + if (i > 0) { + char *key; + zval **data; + ulong index; + uint key_len; + HashPosition pos; + + zend_hash_internal_pointer_reset_ex(myht, &pos); + for (;; zend_hash_move_forward_ex(myht, &pos)) { + i = zend_hash_get_current_key_ex(myht, &key, &key_len, &index, 0, &pos); + if (i == HASH_KEY_NON_EXISTANT) { + break; + } + if (incomplete_class && strcmp(key, MAGIC_MEMBER) == 0) { + continue; + } + + switch (i) { + case HASH_KEY_IS_LONG: + php_var_serialize_long(buf, index); + break; + case HASH_KEY_IS_STRING: + php_var_serialize_string(buf, key, key_len - 1); + break; + } + + /* we should still add element even if it's not OK, + * since we already wrote the length of the array before */ + if (zend_hash_get_current_data_ex(myht, (void **) &data, &pos) != SUCCESS + || !data + || data == &struc + || (Z_TYPE_PP(data) == IS_ARRAY && Z_ARRVAL_PP(data)->nApplyCount > 1) + ) { + smart_str_appendl(buf, "N;", 2); + } else { + if (Z_TYPE_PP(data) == IS_ARRAY) { + Z_ARRVAL_PP(data)->nApplyCount++; + } + php_var_serialize_intern(buf, *data, var_hash TSRMLS_CC); + if (Z_TYPE_PP(data) == IS_ARRAY) { + Z_ARRVAL_PP(data)->nApplyCount--; + } + } + } + } + smart_str_appendc(buf, '}'); + return; + } + default: + smart_str_appendl(buf, "i:0;", 4); + return; + } +} +/* }}} */ + +PHPAPI void php_var_serialize(smart_str *buf, zval **struc, php_serialize_data_t *var_hash TSRMLS_DC) /* {{{ */ +{ + php_var_serialize_intern(buf, *struc, *var_hash TSRMLS_CC); + smart_str_0(buf); +} +/* }}} */ + +/* {{{ proto string serialize(mixed variable) + Returns a string representation of variable (which can later be unserialized) */ +PHP_FUNCTION(serialize) +{ + zval **struc; + php_serialize_data_t var_hash; + smart_str buf = {0}; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &struc) == FAILURE) { + return; + } + + Z_TYPE_P(return_value) = IS_STRING; + Z_STRVAL_P(return_value) = NULL; + Z_STRLEN_P(return_value) = 0; + + PHP_VAR_SERIALIZE_INIT(var_hash); + php_var_serialize(&buf, struc, &var_hash TSRMLS_CC); + PHP_VAR_SERIALIZE_DESTROY(var_hash); + + if (buf.c) { + RETURN_STRINGL(buf.c, buf.len, 0); + } else { + RETURN_NULL(); + } +} +/* }}} */ + +/* {{{ proto mixed unserialize(string variable_representation) + Takes a string representation of variable and recreates it */ +PHP_FUNCTION(unserialize) +{ + char *buf = NULL; + int buf_len; + const unsigned char *p; + php_unserialize_data_t var_hash; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) { + RETURN_FALSE; + } + + if (buf_len == 0) { + RETURN_FALSE; + } + + p = (const unsigned char*) buf; + PHP_VAR_UNSERIALIZE_INIT(var_hash); + if (!php_var_unserialize(&return_value, &p, p + buf_len, &var_hash TSRMLS_CC)) { + PHP_VAR_UNSERIALIZE_DESTROY(var_hash); + zval_dtor(return_value); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset %ld of %d bytes", (long)((char*)p - buf), buf_len); + RETURN_FALSE; + } + PHP_VAR_UNSERIALIZE_DESTROY(var_hash); +} +/* }}} */ + +/* {{{ proto int memory_get_usage([real_usage]) + Returns the allocated by PHP memory */ +PHP_FUNCTION(memory_get_usage) { + zend_bool real_usage = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &real_usage) == FAILURE) { + RETURN_FALSE; + } + + RETURN_LONG(zend_memory_usage(real_usage TSRMLS_CC)); +} +/* }}} */ + +/* {{{ proto int memory_get_peak_usage([real_usage]) + Returns the peak allocated by PHP memory */ +PHP_FUNCTION(memory_get_peak_usage) { + zend_bool real_usage = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &real_usage) == FAILURE) { + RETURN_FALSE; + } + + RETURN_LONG(zend_memory_peak_usage(real_usage TSRMLS_CC)); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c new file mode 100644 index 0000000..7591ca7 --- /dev/null +++ b/ext/standard/var_unserializer.c @@ -0,0 +1,1182 @@ +/* Generated by re2c 0.13.5 on Mon Jan 21 11:34:03 2013 */ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Sascha Schumann | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "ext/standard/php_var.h" +#include "php_incomplete_class.h" + +/* {{{ reference-handling for unserializer: var_* */ +#define VAR_ENTRIES_MAX 1024 + +typedef struct { + zval *data[VAR_ENTRIES_MAX]; + long used_slots; + void *next; +} var_entries; + +static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval) +{ + var_entries *var_hash = (*var_hashx)->last; +#if 0 + fprintf(stderr, "var_push(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval)); +#endif + + if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) { + var_hash = emalloc(sizeof(var_entries)); + var_hash->used_slots = 0; + var_hash->next = 0; + + if (!(*var_hashx)->first) { + (*var_hashx)->first = var_hash; + } else { + ((var_entries *) (*var_hashx)->last)->next = var_hash; + } + + (*var_hashx)->last = var_hash; + } + + var_hash->data[var_hash->used_slots++] = *rval; +} + +PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval) +{ + var_entries *var_hash = (*var_hashx)->last_dtor; +#if 0 + fprintf(stderr, "var_push_dtor(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval)); +#endif + + if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) { + var_hash = emalloc(sizeof(var_entries)); + var_hash->used_slots = 0; + var_hash->next = 0; + + if (!(*var_hashx)->first_dtor) { + (*var_hashx)->first_dtor = var_hash; + } else { + ((var_entries *) (*var_hashx)->last_dtor)->next = var_hash; + } + + (*var_hashx)->last_dtor = var_hash; + } + + Z_ADDREF_PP(rval); + var_hash->data[var_hash->used_slots++] = *rval; +} + +PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **nzval) +{ + long i; + var_entries *var_hash = (*var_hashx)->first; +#if 0 + fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval)); +#endif + + while (var_hash) { + for (i = 0; i < var_hash->used_slots; i++) { + if (var_hash->data[i] == ozval) { + var_hash->data[i] = *nzval; + /* do not break here */ + } + } + var_hash = var_hash->next; + } +} + +static int var_access(php_unserialize_data_t *var_hashx, long id, zval ***store) +{ + var_entries *var_hash = (*var_hashx)->first; +#if 0 + fprintf(stderr, "var_access(%ld): %ld\n", var_hash?var_hash->used_slots:-1L, id); +#endif + + while (id >= VAR_ENTRIES_MAX && var_hash && var_hash->used_slots == VAR_ENTRIES_MAX) { + var_hash = var_hash->next; + id -= VAR_ENTRIES_MAX; + } + + if (!var_hash) return !SUCCESS; + + if (id < 0 || id >= var_hash->used_slots) return !SUCCESS; + + *store = &var_hash->data[id]; + + return SUCCESS; +} + +PHPAPI void var_destroy(php_unserialize_data_t *var_hashx) +{ + void *next; + long i; + var_entries *var_hash = (*var_hashx)->first; +#if 0 + fprintf(stderr, "var_destroy(%ld)\n", var_hash?var_hash->used_slots:-1L); +#endif + + while (var_hash) { + next = var_hash->next; + efree(var_hash); + var_hash = next; + } + + var_hash = (*var_hashx)->first_dtor; + + while (var_hash) { + for (i = 0; i < var_hash->used_slots; i++) { + zval_ptr_dtor(&var_hash->data[i]); + } + next = var_hash->next; + efree(var_hash); + var_hash = next; + } +} + +/* }}} */ + +static char *unserialize_str(const unsigned char **p, size_t *len, size_t maxlen) +{ + size_t i, j; + char *str = safe_emalloc(*len, 1, 1); + unsigned char *end = *(unsigned char **)p+maxlen; + + if (end < *p) { + efree(str); + return NULL; + } + + for (i = 0; i < *len; i++) { + if (*p >= end) { + efree(str); + return NULL; + } + if (**p != '\\') { + str[i] = (char)**p; + } else { + unsigned char ch = 0; + + for (j = 0; j < 2; j++) { + (*p)++; + if (**p >= '0' && **p <= '9') { + ch = (ch << 4) + (**p -'0'); + } else if (**p >= 'a' && **p <= 'f') { + ch = (ch << 4) + (**p -'a'+10); + } else if (**p >= 'A' && **p <= 'F') { + ch = (ch << 4) + (**p -'A'+10); + } else { + efree(str); + return NULL; + } + } + str[i] = (char)ch; + } + (*p)++; + } + str[i] = 0; + *len = i; + return str; +} + +#define YYFILL(n) do { } while (0) +#define YYCTYPE unsigned char +#define YYCURSOR cursor +#define YYLIMIT limit +#define YYMARKER marker + + + + + + +static inline long parse_iv2(const unsigned char *p, const unsigned char **q) +{ + char cursor; + long result = 0; + int neg = 0; + + switch (*p) { + case '-': + neg++; + /* fall-through */ + case '+': + p++; + } + + while (1) { + cursor = (char)*p; + if (cursor >= '0' && cursor <= '9') { + result = result * 10 + (size_t)(cursor - (unsigned char)'0'); + } else { + break; + } + p++; + } + if (q) *q = p; + if (neg) return -result; + return result; +} + +static inline long parse_iv(const unsigned char *p) +{ + return parse_iv2(p, NULL); +} + +/* no need to check for length - re2c already did */ +static inline size_t parse_uiv(const unsigned char *p) +{ + unsigned char cursor; + size_t result = 0; + + if (*p == '+') { + p++; + } + + while (1) { + cursor = *p; + if (cursor >= '0' && cursor <= '9') { + result = result * 10 + (size_t)(cursor - (unsigned char)'0'); + } else { + break; + } + p++; + } + return result; +} + +#define UNSERIALIZE_PARAMETER zval **rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC +#define UNSERIALIZE_PASSTHRU rval, p, max, var_hash TSRMLS_CC + +static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long elements, int objprops) +{ + while (elements-- > 0) { + zval *key, *data, **old_data; + + ALLOC_INIT_ZVAL(key); + + if (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) { + zval_dtor(key); + FREE_ZVAL(key); + return 0; + } + + if (Z_TYPE_P(key) != IS_LONG && Z_TYPE_P(key) != IS_STRING) { + zval_dtor(key); + FREE_ZVAL(key); + return 0; + } + + ALLOC_INIT_ZVAL(data); + + if (!php_var_unserialize(&data, p, max, var_hash TSRMLS_CC)) { + zval_dtor(key); + FREE_ZVAL(key); + zval_dtor(data); + FREE_ZVAL(data); + return 0; + } + + if (!objprops) { + switch (Z_TYPE_P(key)) { + case IS_LONG: + if (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)==SUCCESS) { + var_push_dtor(var_hash, old_data); + } + zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL); + break; + case IS_STRING: + if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) { + var_push_dtor(var_hash, old_data); + } + zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL); + break; + } + } else { + /* object properties should include no integers */ + convert_to_string(key); + zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, + sizeof data, NULL); + } + + zval_dtor(key); + FREE_ZVAL(key); + + if (elements && *(*p-1) != ';' && *(*p-1) != '}') { + (*p)--; + return 0; + } + } + + return 1; +} + +static inline int finish_nested_data(UNSERIALIZE_PARAMETER) +{ + if (*((*p)++) == '}') + return 1; + +#if SOMETHING_NEW_MIGHT_LEAD_TO_CRASH_ENABLE_IF_YOU_ARE_BRAVE + zval_ptr_dtor(rval); +#endif + return 0; +} + +static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) +{ + long datalen; + + datalen = parse_iv2((*p) + 2, p); + + (*p) += 2; + + if (datalen < 0 || (*p) + datalen >= max) { + zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, (long)(max - (*p))); + return 0; + } + + if (ce->unserialize == NULL) { + zend_error(E_WARNING, "Class %s has no unserializer", ce->name); + object_init_ex(*rval, ce); + } else if (ce->unserialize(rval, ce, (const unsigned char*)*p, datalen, (zend_unserialize_data *)var_hash TSRMLS_CC) != SUCCESS) { + return 0; + } + + (*p) += datalen; + + return finish_nested_data(UNSERIALIZE_PASSTHRU); +} + +static inline long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) +{ + long elements; + + elements = parse_iv2((*p) + 2, p); + + (*p) += 2; + + object_init_ex(*rval, ce); + return elements; +} + +#ifdef PHP_WIN32 +# pragma optimize("", off) +#endif +static inline int object_common2(UNSERIALIZE_PARAMETER, long elements) +{ + zval *retval_ptr = NULL; + zval fname; + + if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_OBJPROP_PP(rval), elements, 1)) { + return 0; + } + + if (Z_OBJCE_PP(rval) != PHP_IC_ENTRY && + zend_hash_exists(&Z_OBJCE_PP(rval)->function_table, "__wakeup", sizeof("__wakeup"))) { + INIT_PZVAL(&fname); + ZVAL_STRINGL(&fname, "__wakeup", sizeof("__wakeup") - 1, 0); + BG(serialize_lock)++; + call_user_function_ex(CG(function_table), rval, &fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC); + BG(serialize_lock)--; + } + + if (retval_ptr) + zval_ptr_dtor(&retval_ptr); + + return finish_nested_data(UNSERIALIZE_PASSTHRU); + +} +#ifdef PHP_WIN32 +# pragma optimize("", on) +#endif + +PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) +{ + const unsigned char *cursor, *limit, *marker, *start; + zval **rval_ref; + + limit = max; + cursor = *p; + + if (YYCURSOR >= YYLIMIT) { + return 0; + } + + if (var_hash && cursor[0] != 'R') { + var_push(var_hash, rval); + } + + start = cursor; + + + + +{ + YYCTYPE yych; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }; + + if ((YYLIMIT - YYCURSOR) < 7) YYFILL(7); + yych = *YYCURSOR; + switch (yych) { + case 'C': + case 'O': goto yy13; + case 'N': goto yy5; + case 'R': goto yy2; + case 'S': goto yy10; + case 'a': goto yy11; + case 'b': goto yy6; + case 'd': goto yy8; + case 'i': goto yy7; + case 'o': goto yy12; + case 'r': goto yy4; + case 's': goto yy9; + case '}': goto yy14; + default: goto yy16; + } +yy2: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == ':') goto yy95; +yy3: + { return 0; } +yy4: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == ':') goto yy89; + goto yy3; +yy5: + yych = *++YYCURSOR; + if (yych == ';') goto yy87; + goto yy3; +yy6: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == ':') goto yy83; + goto yy3; +yy7: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == ':') goto yy77; + goto yy3; +yy8: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == ':') goto yy53; + goto yy3; +yy9: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == ':') goto yy46; + goto yy3; +yy10: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == ':') goto yy39; + goto yy3; +yy11: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == ':') goto yy32; + goto yy3; +yy12: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == ':') goto yy25; + goto yy3; +yy13: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == ':') goto yy17; + goto yy3; +yy14: + ++YYCURSOR; + { + /* this is the case where we have less data than planned */ + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data"); + return 0; /* not sure if it should be 0 or 1 here? */ +} +yy16: + yych = *++YYCURSOR; + goto yy3; +yy17: + yych = *++YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy20; + } + if (yych == '+') goto yy19; +yy18: + YYCURSOR = YYMARKER; + goto yy3; +yy19: + yych = *++YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy20; + } + goto yy18; +yy20: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy20; + } + if (yych != ':') goto yy18; + yych = *++YYCURSOR; + if (yych != '"') goto yy18; + ++YYCURSOR; + { + size_t len, len2, len3, maxlen; + long elements; + char *class_name; + zend_class_entry *ce; + zend_class_entry **pce; + int incomplete_class = 0; + + int custom_object = 0; + + zval *user_func; + zval *retval_ptr; + zval **args[1]; + zval *arg_func_name; + + if (*start == 'C') { + custom_object = 1; + } + + INIT_PZVAL(*rval); + len2 = len = parse_uiv(start + 2); + maxlen = max - YYCURSOR; + if (maxlen < len || len == 0) { + *p = start + 2; + return 0; + } + + class_name = (char*)YYCURSOR; + + YYCURSOR += len; + + if (*(YYCURSOR) != '"') { + *p = YYCURSOR; + return 0; + } + if (*(YYCURSOR+1) != ':') { + *p = YYCURSOR+1; + return 0; + } + + len3 = strspn(class_name, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\\"); + if (len3 != len) + { + *p = YYCURSOR + len3 - len; + return 0; + } + + class_name = estrndup(class_name, len); + + do { + /* Try to find class directly */ + BG(serialize_lock) = 1; + if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) { + BG(serialize_lock) = 0; + ce = *pce; + break; + } + BG(serialize_lock) = 0; + + /* Check for unserialize callback */ + if ((PG(unserialize_callback_func) == NULL) || (PG(unserialize_callback_func)[0] == '\0')) { + incomplete_class = 1; + ce = PHP_IC_ENTRY; + break; + } + + /* Call unserialize callback */ + MAKE_STD_ZVAL(user_func); + ZVAL_STRING(user_func, PG(unserialize_callback_func), 1); + args[0] = &arg_func_name; + MAKE_STD_ZVAL(arg_func_name); + ZVAL_STRING(arg_func_name, class_name, 1); + BG(serialize_lock) = 1; + if (call_user_function_ex(CG(function_table), NULL, user_func, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) { + BG(serialize_lock) = 0; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "defined (%s) but not found", user_func->value.str.val); + incomplete_class = 1; + ce = PHP_IC_ENTRY; + zval_ptr_dtor(&user_func); + zval_ptr_dtor(&arg_func_name); + break; + } + BG(serialize_lock) = 0; + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + + /* The callback function may have defined the class */ + if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) { + ce = *pce; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function %s() hasn't defined the class it was called for", user_func->value.str.val); + incomplete_class = 1; + ce = PHP_IC_ENTRY; + } + + zval_ptr_dtor(&user_func); + zval_ptr_dtor(&arg_func_name); + break; + } while (1); + + *p = YYCURSOR; + + if (custom_object) { + int ret = object_custom(UNSERIALIZE_PASSTHRU, ce); + + if (ret && incomplete_class) { + php_store_class_name(*rval, class_name, len2); + } + efree(class_name); + return ret; + } + + elements = object_common1(UNSERIALIZE_PASSTHRU, ce); + + if (incomplete_class) { + php_store_class_name(*rval, class_name, len2); + } + efree(class_name); + + return object_common2(UNSERIALIZE_PASSTHRU, elements); +} +yy25: + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych != '+') goto yy18; + } else { + if (yych <= '-') goto yy26; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy27; + goto yy18; + } +yy26: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy27: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy27; + if (yych >= ';') goto yy18; + yych = *++YYCURSOR; + if (yych != '"') goto yy18; + ++YYCURSOR; + { + + INIT_PZVAL(*rval); + + return object_common2(UNSERIALIZE_PASSTHRU, + object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR)); +} +yy32: + yych = *++YYCURSOR; + if (yych == '+') goto yy33; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy34; + goto yy18; +yy33: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy34: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy34; + if (yych >= ';') goto yy18; + yych = *++YYCURSOR; + if (yych != '{') goto yy18; + ++YYCURSOR; + { + long elements = parse_iv(start + 2); + /* use iv() not uiv() in order to check data range */ + *p = YYCURSOR; + + if (elements < 0) { + return 0; + } + + INIT_PZVAL(*rval); + + array_init_size(*rval, elements); + + if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_ARRVAL_PP(rval), elements, 0)) { + return 0; + } + + return finish_nested_data(UNSERIALIZE_PASSTHRU); +} +yy39: + yych = *++YYCURSOR; + if (yych == '+') goto yy40; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy41; + goto yy18; +yy40: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy41: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy41; + if (yych >= ';') goto yy18; + yych = *++YYCURSOR; + if (yych != '"') goto yy18; + ++YYCURSOR; + { + size_t len, maxlen; + char *str; + + len = parse_uiv(start + 2); + maxlen = max - YYCURSOR; + if (maxlen < len) { + *p = start + 2; + return 0; + } + + if ((str = unserialize_str(&YYCURSOR, &len, maxlen)) == NULL) { + return 0; + } + + if (*(YYCURSOR) != '"') { + efree(str); + *p = YYCURSOR; + return 0; + } + + YYCURSOR += 2; + *p = YYCURSOR; + + INIT_PZVAL(*rval); + ZVAL_STRINGL(*rval, str, len, 0); + return 1; +} +yy46: + yych = *++YYCURSOR; + if (yych == '+') goto yy47; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy48; + goto yy18; +yy47: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy48: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy48; + if (yych >= ';') goto yy18; + yych = *++YYCURSOR; + if (yych != '"') goto yy18; + ++YYCURSOR; + { + size_t len, maxlen; + char *str; + + len = parse_uiv(start + 2); + maxlen = max - YYCURSOR; + if (maxlen < len) { + *p = start + 2; + return 0; + } + + str = (char*)YYCURSOR; + + YYCURSOR += len; + + if (*(YYCURSOR) != '"') { + *p = YYCURSOR; + return 0; + } + + YYCURSOR += 2; + *p = YYCURSOR; + + INIT_PZVAL(*rval); + ZVAL_STRINGL(*rval, str, len, 1); + return 1; +} +yy53: + yych = *++YYCURSOR; + if (yych <= '/') { + if (yych <= ',') { + if (yych == '+') goto yy57; + goto yy18; + } else { + if (yych <= '-') goto yy55; + if (yych <= '.') goto yy60; + goto yy18; + } + } else { + if (yych <= 'I') { + if (yych <= '9') goto yy58; + if (yych <= 'H') goto yy18; + goto yy56; + } else { + if (yych != 'N') goto yy18; + } + } + yych = *++YYCURSOR; + if (yych == 'A') goto yy76; + goto yy18; +yy55: + yych = *++YYCURSOR; + if (yych <= '/') { + if (yych == '.') goto yy60; + goto yy18; + } else { + if (yych <= '9') goto yy58; + if (yych != 'I') goto yy18; + } +yy56: + yych = *++YYCURSOR; + if (yych == 'N') goto yy72; + goto yy18; +yy57: + yych = *++YYCURSOR; + if (yych == '.') goto yy60; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy58: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); + yych = *YYCURSOR; + if (yych <= ':') { + if (yych <= '.') { + if (yych <= '-') goto yy18; + goto yy70; + } else { + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy58; + goto yy18; + } + } else { + if (yych <= 'E') { + if (yych <= ';') goto yy63; + if (yych <= 'D') goto yy18; + goto yy65; + } else { + if (yych == 'e') goto yy65; + goto yy18; + } + } +yy60: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy61: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); + yych = *YYCURSOR; + if (yych <= ';') { + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy61; + if (yych <= ':') goto yy18; + } else { + if (yych <= 'E') { + if (yych <= 'D') goto yy18; + goto yy65; + } else { + if (yych == 'e') goto yy65; + goto yy18; + } + } +yy63: + ++YYCURSOR; + { +#if SIZEOF_LONG == 4 +use_double: +#endif + *p = YYCURSOR; + INIT_PZVAL(*rval); + ZVAL_DOUBLE(*rval, zend_strtod((const char *)start + 2, NULL)); + return 1; +} +yy65: + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych != '+') goto yy18; + } else { + if (yych <= '-') goto yy66; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy67; + goto yy18; + } +yy66: + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych == '+') goto yy69; + goto yy18; + } else { + if (yych <= '-') goto yy69; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; + } +yy67: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy67; + if (yych == ';') goto yy63; + goto yy18; +yy69: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy67; + goto yy18; +yy70: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); + yych = *YYCURSOR; + if (yych <= ';') { + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy70; + if (yych <= ':') goto yy18; + goto yy63; + } else { + if (yych <= 'E') { + if (yych <= 'D') goto yy18; + goto yy65; + } else { + if (yych == 'e') goto yy65; + goto yy18; + } + } +yy72: + yych = *++YYCURSOR; + if (yych != 'F') goto yy18; +yy73: + yych = *++YYCURSOR; + if (yych != ';') goto yy18; + ++YYCURSOR; + { + *p = YYCURSOR; + INIT_PZVAL(*rval); + + if (!strncmp(start + 2, "NAN", 3)) { + ZVAL_DOUBLE(*rval, php_get_nan()); + } else if (!strncmp(start + 2, "INF", 3)) { + ZVAL_DOUBLE(*rval, php_get_inf()); + } else if (!strncmp(start + 2, "-INF", 4)) { + ZVAL_DOUBLE(*rval, -php_get_inf()); + } + + return 1; +} +yy76: + yych = *++YYCURSOR; + if (yych == 'N') goto yy73; + goto yy18; +yy77: + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych != '+') goto yy18; + } else { + if (yych <= '-') goto yy78; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy79; + goto yy18; + } +yy78: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy79: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy79; + if (yych != ';') goto yy18; + ++YYCURSOR; + { +#if SIZEOF_LONG == 4 + int digits = YYCURSOR - start - 3; + + if (start[2] == '-' || start[2] == '+') { + digits--; + } + + /* Use double for large long values that were serialized on a 64-bit system */ + if (digits >= MAX_LENGTH_OF_LONG - 1) { + if (digits == MAX_LENGTH_OF_LONG - 1) { + int cmp = strncmp(YYCURSOR - MAX_LENGTH_OF_LONG, long_min_digits, MAX_LENGTH_OF_LONG - 1); + + if (!(cmp < 0 || (cmp == 0 && start[2] == '-'))) { + goto use_double; + } + } else { + goto use_double; + } + } +#endif + *p = YYCURSOR; + INIT_PZVAL(*rval); + ZVAL_LONG(*rval, parse_iv(start + 2)); + return 1; +} +yy83: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= '2') goto yy18; + yych = *++YYCURSOR; + if (yych != ';') goto yy18; + ++YYCURSOR; + { + *p = YYCURSOR; + INIT_PZVAL(*rval); + ZVAL_BOOL(*rval, parse_iv(start + 2)); + return 1; +} +yy87: + ++YYCURSOR; + { + *p = YYCURSOR; + INIT_PZVAL(*rval); + ZVAL_NULL(*rval); + return 1; +} +yy89: + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych != '+') goto yy18; + } else { + if (yych <= '-') goto yy90; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy91; + goto yy18; + } +yy90: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy91: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy91; + if (yych != ';') goto yy18; + ++YYCURSOR; + { + long id; + + *p = YYCURSOR; + if (!var_hash) return 0; + + id = parse_iv(start + 2) - 1; + if (id == -1 || var_access(var_hash, id, &rval_ref) != SUCCESS) { + return 0; + } + + if (*rval == *rval_ref) return 0; + + if (*rval != NULL) { + zval_ptr_dtor(rval); + } + *rval = *rval_ref; + Z_ADDREF_PP(rval); + Z_UNSET_ISREF_PP(rval); + + return 1; +} +yy95: + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych != '+') goto yy18; + } else { + if (yych <= '-') goto yy96; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy97; + goto yy18; + } +yy96: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy97: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy97; + if (yych != ';') goto yy18; + ++YYCURSOR; + { + long id; + + *p = YYCURSOR; + if (!var_hash) return 0; + + id = parse_iv(start + 2) - 1; + if (id == -1 || var_access(var_hash, id, &rval_ref) != SUCCESS) { + return 0; + } + + if (*rval != NULL) { + zval_ptr_dtor(rval); + } + *rval = *rval_ref; + Z_ADDREF_PP(rval); + Z_SET_ISREF_PP(rval); + + return 1; +} +} + + + return 0; +} diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re new file mode 100644 index 0000000..2049957 --- /dev/null +++ b/ext/standard/var_unserializer.re @@ -0,0 +1,764 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Sascha Schumann | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "ext/standard/php_var.h" +#include "php_incomplete_class.h" + +/* {{{ reference-handling for unserializer: var_* */ +#define VAR_ENTRIES_MAX 1024 + +typedef struct { + zval *data[VAR_ENTRIES_MAX]; + long used_slots; + void *next; +} var_entries; + +static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval) +{ + var_entries *var_hash = (*var_hashx)->last; +#if 0 + fprintf(stderr, "var_push(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval)); +#endif + + if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) { + var_hash = emalloc(sizeof(var_entries)); + var_hash->used_slots = 0; + var_hash->next = 0; + + if (!(*var_hashx)->first) { + (*var_hashx)->first = var_hash; + } else { + ((var_entries *) (*var_hashx)->last)->next = var_hash; + } + + (*var_hashx)->last = var_hash; + } + + var_hash->data[var_hash->used_slots++] = *rval; +} + +PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval) +{ + var_entries *var_hash = (*var_hashx)->last_dtor; +#if 0 + fprintf(stderr, "var_push_dtor(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval)); +#endif + + if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) { + var_hash = emalloc(sizeof(var_entries)); + var_hash->used_slots = 0; + var_hash->next = 0; + + if (!(*var_hashx)->first_dtor) { + (*var_hashx)->first_dtor = var_hash; + } else { + ((var_entries *) (*var_hashx)->last_dtor)->next = var_hash; + } + + (*var_hashx)->last_dtor = var_hash; + } + + Z_ADDREF_PP(rval); + var_hash->data[var_hash->used_slots++] = *rval; +} + +PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **nzval) +{ + long i; + var_entries *var_hash = (*var_hashx)->first; +#if 0 + fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval)); +#endif + + while (var_hash) { + for (i = 0; i < var_hash->used_slots; i++) { + if (var_hash->data[i] == ozval) { + var_hash->data[i] = *nzval; + /* do not break here */ + } + } + var_hash = var_hash->next; + } +} + +static int var_access(php_unserialize_data_t *var_hashx, long id, zval ***store) +{ + var_entries *var_hash = (*var_hashx)->first; +#if 0 + fprintf(stderr, "var_access(%ld): %ld\n", var_hash?var_hash->used_slots:-1L, id); +#endif + + while (id >= VAR_ENTRIES_MAX && var_hash && var_hash->used_slots == VAR_ENTRIES_MAX) { + var_hash = var_hash->next; + id -= VAR_ENTRIES_MAX; + } + + if (!var_hash) return !SUCCESS; + + if (id < 0 || id >= var_hash->used_slots) return !SUCCESS; + + *store = &var_hash->data[id]; + + return SUCCESS; +} + +PHPAPI void var_destroy(php_unserialize_data_t *var_hashx) +{ + void *next; + long i; + var_entries *var_hash = (*var_hashx)->first; +#if 0 + fprintf(stderr, "var_destroy(%ld)\n", var_hash?var_hash->used_slots:-1L); +#endif + + while (var_hash) { + next = var_hash->next; + efree(var_hash); + var_hash = next; + } + + var_hash = (*var_hashx)->first_dtor; + + while (var_hash) { + for (i = 0; i < var_hash->used_slots; i++) { + zval_ptr_dtor(&var_hash->data[i]); + } + next = var_hash->next; + efree(var_hash); + var_hash = next; + } +} + +/* }}} */ + +static char *unserialize_str(const unsigned char **p, size_t *len, size_t maxlen) +{ + size_t i, j; + char *str = safe_emalloc(*len, 1, 1); + unsigned char *end = *(unsigned char **)p+maxlen; + + if (end < *p) { + efree(str); + return NULL; + } + + for (i = 0; i < *len; i++) { + if (*p >= end) { + efree(str); + return NULL; + } + if (**p != '\\') { + str[i] = (char)**p; + } else { + unsigned char ch = 0; + + for (j = 0; j < 2; j++) { + (*p)++; + if (**p >= '0' && **p <= '9') { + ch = (ch << 4) + (**p -'0'); + } else if (**p >= 'a' && **p <= 'f') { + ch = (ch << 4) + (**p -'a'+10); + } else if (**p >= 'A' && **p <= 'F') { + ch = (ch << 4) + (**p -'A'+10); + } else { + efree(str); + return NULL; + } + } + str[i] = (char)ch; + } + (*p)++; + } + str[i] = 0; + *len = i; + return str; +} + +#define YYFILL(n) do { } while (0) +#define YYCTYPE unsigned char +#define YYCURSOR cursor +#define YYLIMIT limit +#define YYMARKER marker + + +/*!re2c +uiv = [+]? [0-9]+; +iv = [+-]? [0-9]+; +nv = [+-]? ([0-9]* "." [0-9]+|[0-9]+ "." [0-9]*); +nvexp = (iv | nv) [eE] [+-]? iv; +any = [\000-\377]; +object = [OC]; +*/ + + + +static inline long parse_iv2(const unsigned char *p, const unsigned char **q) +{ + char cursor; + long result = 0; + int neg = 0; + + switch (*p) { + case '-': + neg++; + /* fall-through */ + case '+': + p++; + } + + while (1) { + cursor = (char)*p; + if (cursor >= '0' && cursor <= '9') { + result = result * 10 + (size_t)(cursor - (unsigned char)'0'); + } else { + break; + } + p++; + } + if (q) *q = p; + if (neg) return -result; + return result; +} + +static inline long parse_iv(const unsigned char *p) +{ + return parse_iv2(p, NULL); +} + +/* no need to check for length - re2c already did */ +static inline size_t parse_uiv(const unsigned char *p) +{ + unsigned char cursor; + size_t result = 0; + + if (*p == '+') { + p++; + } + + while (1) { + cursor = *p; + if (cursor >= '0' && cursor <= '9') { + result = result * 10 + (size_t)(cursor - (unsigned char)'0'); + } else { + break; + } + p++; + } + return result; +} + +#define UNSERIALIZE_PARAMETER zval **rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC +#define UNSERIALIZE_PASSTHRU rval, p, max, var_hash TSRMLS_CC + +static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long elements, int objprops) +{ + while (elements-- > 0) { + zval *key, *data, **old_data; + + ALLOC_INIT_ZVAL(key); + + if (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) { + zval_dtor(key); + FREE_ZVAL(key); + return 0; + } + + if (Z_TYPE_P(key) != IS_LONG && Z_TYPE_P(key) != IS_STRING) { + zval_dtor(key); + FREE_ZVAL(key); + return 0; + } + + ALLOC_INIT_ZVAL(data); + + if (!php_var_unserialize(&data, p, max, var_hash TSRMLS_CC)) { + zval_dtor(key); + FREE_ZVAL(key); + zval_dtor(data); + FREE_ZVAL(data); + return 0; + } + + if (!objprops) { + switch (Z_TYPE_P(key)) { + case IS_LONG: + if (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)==SUCCESS) { + var_push_dtor(var_hash, old_data); + } + zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL); + break; + case IS_STRING: + if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) { + var_push_dtor(var_hash, old_data); + } + zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL); + break; + } + } else { + /* object properties should include no integers */ + convert_to_string(key); + zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, + sizeof data, NULL); + } + + zval_dtor(key); + FREE_ZVAL(key); + + if (elements && *(*p-1) != ';' && *(*p-1) != '}') { + (*p)--; + return 0; + } + } + + return 1; +} + +static inline int finish_nested_data(UNSERIALIZE_PARAMETER) +{ + if (*((*p)++) == '}') + return 1; + +#if SOMETHING_NEW_MIGHT_LEAD_TO_CRASH_ENABLE_IF_YOU_ARE_BRAVE + zval_ptr_dtor(rval); +#endif + return 0; +} + +static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) +{ + long datalen; + + datalen = parse_iv2((*p) + 2, p); + + (*p) += 2; + + if (datalen < 0 || (*p) + datalen >= max) { + zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, (long)(max - (*p))); + return 0; + } + + if (ce->unserialize == NULL) { + zend_error(E_WARNING, "Class %s has no unserializer", ce->name); + object_init_ex(*rval, ce); + } else if (ce->unserialize(rval, ce, (const unsigned char*)*p, datalen, (zend_unserialize_data *)var_hash TSRMLS_CC) != SUCCESS) { + return 0; + } + + (*p) += datalen; + + return finish_nested_data(UNSERIALIZE_PASSTHRU); +} + +static inline long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) +{ + long elements; + + elements = parse_iv2((*p) + 2, p); + + (*p) += 2; + + object_init_ex(*rval, ce); + return elements; +} + +#ifdef PHP_WIN32 +# pragma optimize("", off) +#endif +static inline int object_common2(UNSERIALIZE_PARAMETER, long elements) +{ + zval *retval_ptr = NULL; + zval fname; + + if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_OBJPROP_PP(rval), elements, 1)) { + return 0; + } + + if (Z_OBJCE_PP(rval) != PHP_IC_ENTRY && + zend_hash_exists(&Z_OBJCE_PP(rval)->function_table, "__wakeup", sizeof("__wakeup"))) { + INIT_PZVAL(&fname); + ZVAL_STRINGL(&fname, "__wakeup", sizeof("__wakeup") - 1, 0); + BG(serialize_lock)++; + call_user_function_ex(CG(function_table), rval, &fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC); + BG(serialize_lock)--; + } + + if (retval_ptr) + zval_ptr_dtor(&retval_ptr); + + return finish_nested_data(UNSERIALIZE_PASSTHRU); + +} +#ifdef PHP_WIN32 +# pragma optimize("", on) +#endif + +PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) +{ + const unsigned char *cursor, *limit, *marker, *start; + zval **rval_ref; + + limit = max; + cursor = *p; + + if (YYCURSOR >= YYLIMIT) { + return 0; + } + + if (var_hash && cursor[0] != 'R') { + var_push(var_hash, rval); + } + + start = cursor; + + + +/*!re2c + +"R:" iv ";" { + long id; + + *p = YYCURSOR; + if (!var_hash) return 0; + + id = parse_iv(start + 2) - 1; + if (id == -1 || var_access(var_hash, id, &rval_ref) != SUCCESS) { + return 0; + } + + if (*rval != NULL) { + zval_ptr_dtor(rval); + } + *rval = *rval_ref; + Z_ADDREF_PP(rval); + Z_SET_ISREF_PP(rval); + + return 1; +} + +"r:" iv ";" { + long id; + + *p = YYCURSOR; + if (!var_hash) return 0; + + id = parse_iv(start + 2) - 1; + if (id == -1 || var_access(var_hash, id, &rval_ref) != SUCCESS) { + return 0; + } + + if (*rval == *rval_ref) return 0; + + if (*rval != NULL) { + zval_ptr_dtor(rval); + } + *rval = *rval_ref; + Z_ADDREF_PP(rval); + Z_UNSET_ISREF_PP(rval); + + return 1; +} + +"N;" { + *p = YYCURSOR; + INIT_PZVAL(*rval); + ZVAL_NULL(*rval); + return 1; +} + +"b:" [01] ";" { + *p = YYCURSOR; + INIT_PZVAL(*rval); + ZVAL_BOOL(*rval, parse_iv(start + 2)); + return 1; +} + +"i:" iv ";" { +#if SIZEOF_LONG == 4 + int digits = YYCURSOR - start - 3; + + if (start[2] == '-' || start[2] == '+') { + digits--; + } + + /* Use double for large long values that were serialized on a 64-bit system */ + if (digits >= MAX_LENGTH_OF_LONG - 1) { + if (digits == MAX_LENGTH_OF_LONG - 1) { + int cmp = strncmp(YYCURSOR - MAX_LENGTH_OF_LONG, long_min_digits, MAX_LENGTH_OF_LONG - 1); + + if (!(cmp < 0 || (cmp == 0 && start[2] == '-'))) { + goto use_double; + } + } else { + goto use_double; + } + } +#endif + *p = YYCURSOR; + INIT_PZVAL(*rval); + ZVAL_LONG(*rval, parse_iv(start + 2)); + return 1; +} + +"d:" ("NAN" | "-"? "INF") ";" { + *p = YYCURSOR; + INIT_PZVAL(*rval); + + if (!strncmp(start + 2, "NAN", 3)) { + ZVAL_DOUBLE(*rval, php_get_nan()); + } else if (!strncmp(start + 2, "INF", 3)) { + ZVAL_DOUBLE(*rval, php_get_inf()); + } else if (!strncmp(start + 2, "-INF", 4)) { + ZVAL_DOUBLE(*rval, -php_get_inf()); + } + + return 1; +} + +"d:" (iv | nv | nvexp) ";" { +#if SIZEOF_LONG == 4 +use_double: +#endif + *p = YYCURSOR; + INIT_PZVAL(*rval); + ZVAL_DOUBLE(*rval, zend_strtod((const char *)start + 2, NULL)); + return 1; +} + +"s:" uiv ":" ["] { + size_t len, maxlen; + char *str; + + len = parse_uiv(start + 2); + maxlen = max - YYCURSOR; + if (maxlen < len) { + *p = start + 2; + return 0; + } + + str = (char*)YYCURSOR; + + YYCURSOR += len; + + if (*(YYCURSOR) != '"') { + *p = YYCURSOR; + return 0; + } + + YYCURSOR += 2; + *p = YYCURSOR; + + INIT_PZVAL(*rval); + ZVAL_STRINGL(*rval, str, len, 1); + return 1; +} + +"S:" uiv ":" ["] { + size_t len, maxlen; + char *str; + + len = parse_uiv(start + 2); + maxlen = max - YYCURSOR; + if (maxlen < len) { + *p = start + 2; + return 0; + } + + if ((str = unserialize_str(&YYCURSOR, &len, maxlen)) == NULL) { + return 0; + } + + if (*(YYCURSOR) != '"') { + efree(str); + *p = YYCURSOR; + return 0; + } + + YYCURSOR += 2; + *p = YYCURSOR; + + INIT_PZVAL(*rval); + ZVAL_STRINGL(*rval, str, len, 0); + return 1; +} + +"a:" uiv ":" "{" { + long elements = parse_iv(start + 2); + /* use iv() not uiv() in order to check data range */ + *p = YYCURSOR; + + if (elements < 0) { + return 0; + } + + INIT_PZVAL(*rval); + + array_init_size(*rval, elements); + + if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_ARRVAL_PP(rval), elements, 0)) { + return 0; + } + + return finish_nested_data(UNSERIALIZE_PASSTHRU); +} + +"o:" iv ":" ["] { + + INIT_PZVAL(*rval); + + return object_common2(UNSERIALIZE_PASSTHRU, + object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR)); +} + +object ":" uiv ":" ["] { + size_t len, len2, len3, maxlen; + long elements; + char *class_name; + zend_class_entry *ce; + zend_class_entry **pce; + int incomplete_class = 0; + + int custom_object = 0; + + zval *user_func; + zval *retval_ptr; + zval **args[1]; + zval *arg_func_name; + + if (*start == 'C') { + custom_object = 1; + } + + INIT_PZVAL(*rval); + len2 = len = parse_uiv(start + 2); + maxlen = max - YYCURSOR; + if (maxlen < len || len == 0) { + *p = start + 2; + return 0; + } + + class_name = (char*)YYCURSOR; + + YYCURSOR += len; + + if (*(YYCURSOR) != '"') { + *p = YYCURSOR; + return 0; + } + if (*(YYCURSOR+1) != ':') { + *p = YYCURSOR+1; + return 0; + } + + len3 = strspn(class_name, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\\"); + if (len3 != len) + { + *p = YYCURSOR + len3 - len; + return 0; + } + + class_name = estrndup(class_name, len); + + do { + /* Try to find class directly */ + BG(serialize_lock) = 1; + if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) { + BG(serialize_lock) = 0; + ce = *pce; + break; + } + BG(serialize_lock) = 0; + + /* Check for unserialize callback */ + if ((PG(unserialize_callback_func) == NULL) || (PG(unserialize_callback_func)[0] == '\0')) { + incomplete_class = 1; + ce = PHP_IC_ENTRY; + break; + } + + /* Call unserialize callback */ + MAKE_STD_ZVAL(user_func); + ZVAL_STRING(user_func, PG(unserialize_callback_func), 1); + args[0] = &arg_func_name; + MAKE_STD_ZVAL(arg_func_name); + ZVAL_STRING(arg_func_name, class_name, 1); + BG(serialize_lock) = 1; + if (call_user_function_ex(CG(function_table), NULL, user_func, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) { + BG(serialize_lock) = 0; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "defined (%s) but not found", user_func->value.str.val); + incomplete_class = 1; + ce = PHP_IC_ENTRY; + zval_ptr_dtor(&user_func); + zval_ptr_dtor(&arg_func_name); + break; + } + BG(serialize_lock) = 0; + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + + /* The callback function may have defined the class */ + if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) { + ce = *pce; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function %s() hasn't defined the class it was called for", user_func->value.str.val); + incomplete_class = 1; + ce = PHP_IC_ENTRY; + } + + zval_ptr_dtor(&user_func); + zval_ptr_dtor(&arg_func_name); + break; + } while (1); + + *p = YYCURSOR; + + if (custom_object) { + int ret = object_custom(UNSERIALIZE_PASSTHRU, ce); + + if (ret && incomplete_class) { + php_store_class_name(*rval, class_name, len2); + } + efree(class_name); + return ret; + } + + elements = object_common1(UNSERIALIZE_PASSTHRU, ce); + + if (incomplete_class) { + php_store_class_name(*rval, class_name, len2); + } + efree(class_name); + + return object_common2(UNSERIALIZE_PASSTHRU, elements); +} + +"}" { + /* this is the case where we have less data than planned */ + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data"); + return 0; /* not sure if it should be 0 or 1 here? */ +} + +any { return 0; } + +*/ + + return 0; +} diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c new file mode 100644 index 0000000..aadbcaf --- /dev/null +++ b/ext/standard/versioning.c @@ -0,0 +1,255 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Stig Sæther Bakken | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#include +#include +#include +#include +#include +#include "php.h" +#include "php_versioning.h" + +#define sign(n) ((n)<0?-1:((n)>0?1:0)) + +/* {{{ php_canonicalize_version() */ + +PHPAPI char * +php_canonicalize_version(const char *version) +{ + int len = strlen(version); + char *buf = safe_emalloc(len, 2, 1), *q, lp, lq; + const char *p; + + if (len == 0) { + *buf = '\0'; + return buf; + } + + p = version; + q = buf; + *q++ = lp = *p++; + + while (*p) { +/* s/[-_+]/./g; + * s/([^\d\.])([^\D\.])/$1.$2/g; + * s/([^\D\.])([^\d\.])/$1.$2/g; + */ +#define isdig(x) (isdigit(x)&&(x)!='.') +#define isndig(x) (!isdigit(x)&&(x)!='.') +#define isspecialver(x) ((x)=='-'||(x)=='_'||(x)=='+') + + lq = *(q - 1); + if (isspecialver(*p)) { + if (lq != '.') { + *q++ = '.'; + } + } else if ((isndig(lp) && isdig(*p)) || (isdig(lp) && isndig(*p))) { + if (lq != '.') { + *q++ = '.'; + } + *q++ = *p; + } else if (!isalnum(*p)) { + if (lq != '.') { + *q++ = '.'; + } + } else { + *q++ = *p; + } + lp = *p++; + } + *q++ = '\0'; + return buf; +} + +/* }}} */ +/* {{{ compare_special_version_forms() */ + +typedef struct { + const char *name; + int order; +} special_forms_t; + +static int +compare_special_version_forms(char *form1, char *form2) +{ + int found1 = -1, found2 = -1; + special_forms_t special_forms[11] = { + {"dev", 0}, + {"alpha", 1}, + {"a", 1}, + {"beta", 2}, + {"b", 2}, + {"RC", 3}, + {"rc", 3}, + {"#", 4}, + {"pl", 5}, + {"p", 5}, + {NULL, 0}, + }; + special_forms_t *pp; + + for (pp = special_forms; pp && pp->name; pp++) { + if (strncmp(form1, pp->name, strlen(pp->name)) == 0) { + found1 = pp->order; + break; + } + } + for (pp = special_forms; pp && pp->name; pp++) { + if (strncmp(form2, pp->name, strlen(pp->name)) == 0) { + found2 = pp->order; + break; + } + } + return sign(found1 - found2); +} + +/* }}} */ +/* {{{ php_version_compare() */ + +PHPAPI int +php_version_compare(const char *orig_ver1, const char *orig_ver2) +{ + char *ver1; + char *ver2; + char *p1, *p2, *n1, *n2; + long l1, l2; + int compare = 0; + + if (!*orig_ver1 || !*orig_ver2) { + if (!*orig_ver1 && !*orig_ver2) { + return 0; + } else { + return *orig_ver1 ? 1 : -1; + } + } + if (orig_ver1[0] == '#') { + ver1 = estrdup(orig_ver1); + } else { + ver1 = php_canonicalize_version(orig_ver1); + } + if (orig_ver2[0] == '#') { + ver2 = estrdup(orig_ver2); + } else { + ver2 = php_canonicalize_version(orig_ver2); + } + p1 = n1 = ver1; + p2 = n2 = ver2; + while (*p1 && *p2 && n1 && n2) { + if ((n1 = strchr(p1, '.')) != NULL) { + *n1 = '\0'; + } + if ((n2 = strchr(p2, '.')) != NULL) { + *n2 = '\0'; + } + if (isdigit(*p1) && isdigit(*p2)) { + /* compare element numerically */ + l1 = strtol(p1, NULL, 10); + l2 = strtol(p2, NULL, 10); + compare = sign(l1 - l2); + } else if (!isdigit(*p1) && !isdigit(*p2)) { + /* compare element names */ + compare = compare_special_version_forms(p1, p2); + } else { + /* mix of names and numbers */ + if (isdigit(*p1)) { + compare = compare_special_version_forms("#N#", p2); + } else { + compare = compare_special_version_forms(p1, "#N#"); + } + } + if (compare != 0) { + break; + } + if (n1 != NULL) { + p1 = n1 + 1; + } + if (n2 != NULL) { + p2 = n2 + 1; + } + } + if (compare == 0) { + if (n1 != NULL) { + if (isdigit(*p1)) { + compare = 1; + } else { + compare = php_version_compare(p1, "#N#"); + } + } else if (n2 != NULL) { + if (isdigit(*p2)) { + compare = -1; + } else { + compare = php_version_compare("#N#", p2); + } + } + } + efree(ver1); + efree(ver2); + return compare; +} + +/* }}} */ +/* {{{ proto int version_compare(string ver1, string ver2 [, string oper]) + Compares two "PHP-standardized" version number strings */ + +PHP_FUNCTION(version_compare) +{ + char *v1, *v2, *op = NULL; + int v1_len, v2_len, op_len = 0; + int compare, argc; + + argc = ZEND_NUM_ARGS(); + if (zend_parse_parameters(argc TSRMLS_CC, "ss|s", &v1, &v1_len, &v2, + &v2_len, &op, &op_len) == FAILURE) { + return; + } + compare = php_version_compare(v1, v2); + if (argc == 2) { + RETURN_LONG(compare); + } + if (!strncmp(op, "<", op_len) || !strncmp(op, "lt", op_len)) { + RETURN_BOOL(compare == -1); + } + if (!strncmp(op, "<=", op_len) || !strncmp(op, "le", op_len)) { + RETURN_BOOL(compare != 1); + } + if (!strncmp(op, ">", op_len) || !strncmp(op, "gt", op_len)) { + RETURN_BOOL(compare == 1); + } + if (!strncmp(op, ">=", op_len) || !strncmp(op, "ge", op_len)) { + RETURN_BOOL(compare != -1); + } + if (!strncmp(op, "==", op_len) || !strncmp(op, "=", op_len) || !strncmp(op, "eq", op_len)) { + RETURN_BOOL(compare == 0); + } + if (!strncmp(op, "!=", op_len) || !strncmp(op, "<>", op_len) || !strncmp(op, "ne", op_len)) { + RETURN_BOOL(compare != 0); + } + RETURN_NULL(); +} + +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ diff --git a/ext/standard/winver.h b/ext/standard/winver.h new file mode 100644 index 0000000..7152d60 --- /dev/null +++ b/ext/standard/winver.h @@ -0,0 +1,97 @@ +#ifndef _PHP_WINVER_H +#define _PHP_WINVER_H + +#ifndef SM_TABLETPC +#define SM_TABLETPC 86 +#endif +#ifndef SM_MEDIACENTER +#define SM_MEDIACENTER 87 +#endif +#ifndef SM_STARTER +#define SM_STARTER 88 +#endif +#ifndef SM_SERVERR2 +#define SM_SERVERR2 89 +#endif +#ifndef VER_SUITE_WH_SERVER +#define VER_SUITE_WH_SERVER 0x8000 +#endif + +#ifndef PRODUCT_ULTIMATE +#define PRODUCT_UNDEFINED 0x00000000 +#define PRODUCT_ULTIMATE 0x00000001 +#define PRODUCT_HOME_BASIC 0x00000002 +#define PRODUCT_HOME_PREMIUM 0x00000003 +#define PRODUCT_ENTERPRISE 0x00000004 +#define PRODUCT_HOME_BASIC_N 0x00000005 +#define PRODUCT_BUSINESS 0x00000006 +#define PRODUCT_STANDARD_SERVER 0x00000007 +#define PRODUCT_DATACENTER_SERVER 0x00000008 +#define PRODUCT_SMALLBUSINESS_SERVER 0x00000009 +#define PRODUCT_ENTERPRISE_SERVER 0x0000000A +#define PRODUCT_STARTER 0x0000000B +#define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C +#define PRODUCT_STANDARD_SERVER_CORE 0x0000000D +#define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E +#define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F +#define PRODUCT_BUSINESS_N 0x00000010 +#define PRODUCT_WEB_SERVER 0x00000011 +#define PRODUCT_CLUSTER_SERVER 0x00000012 +#define PRODUCT_HOME_SERVER 0x00000013 +#define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014 +#define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015 +#define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016 +#define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017 +#define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018 +#define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019 +#endif + +#ifndef VER_NT_WORKSTATION +#define VER_NT_WORKSTATION 0x0000001 +#define VER_NT_DOMAIN_CONTROLLER 0x0000002 +#define VER_NT_SERVER 0x0000003 +#endif + +#ifndef VER_SUITE_SMALLBUSINESS +#define VER_SUITE_SMALLBUSINESS 0x00000001 +#define VER_SUITE_ENTERPRISE 0x00000002 +#define VER_SUITE_BACKOFFICE 0x00000004 +#define VER_SUITE_COMMUNICATIONS 0x00000008 +#define VER_SUITE_TERMINAL 0x00000010 +#define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020 +#define VER_SUITE_EMBEDDEDNT 0x00000040 +#define VER_SUITE_DATACENTER 0x00000080 +#define VER_SUITE_SINGLEUSERTS 0x00000100 +#define VER_SUITE_PERSONAL 0x00000200 +#define VER_SUITE_BLADE 0x00000400 +#define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800 +#define VER_SUITE_SECURITY_APPLIANCE 0x00001000 +#endif + +#ifndef VER_SUITE_STORAGE_SERVER +# define VER_SUITE_STORAGE_SERVER 0x00002000 +#endif + +#ifndef VER_SUITE_COMPUTE_SERVER +# define VER_SUITE_COMPUTE_SERVER 0x00004000 +#endif + +#ifndef PROCESSOR_ARCHITECTURE_AMD64 +#define PROCESSOR_ARCHITECTURE_AMD64 9 +#endif + +typedef struct _php_win_OSVERSIONINFOEXA { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + CHAR szCSDVersion[128]; + WORD wServicePackMajor; + WORD wServicePackMinor; + WORD wSuiteMask; + BYTE wProductType; + BYTE wReserved; +} php_win_OSVERSIONINFOEX; + +#endif \ No newline at end of file -- cgit v1.2.1